text:
Q: What do top's %MEM and VSZ mean? I'm working on an embedded Linux system (128MB RAM) without any swap partition. Below is its top output:
Mem: 37824K used, 88564K free, 0K shrd, 0K buff, 23468K cached
CPU:   0% usr   0% sys   0% nic  60% idle   0% io  38% irq   0% sirq
Load average: 0.00 0.09 0.26 1/50 1081
  PID  PPID USER     STAT   VSZ %MEM CPU %CPU COMMAND
 1010     1 root     S     2464   2%   0   8% -/sbin/getty -L ttyS0 115200 vt10
 1081  1079 root     R     2572   2%   0   1% top
    5     2 root     RW<      0   0%   0   1% [events/0]
 1074   994 root     S     7176   6%   0   0% sshd: root@ttyp0
 1019     1 root     S    13760  11%   0   0% /SecuriWAN/mi
  886     1 root     S     138m 112%   0   0% /usr/bin/rstpd 51234  <== 112% MEM?!?
 1011   994 root     S     7176   6%   0   0% sshd: root@ttyp2
  994     1 root     S     4616   4%   0   0% /usr/sbin/sshd
 1067  1030 root     S     4572   4%   0   0% ssh passive
  932     1 root     S     4056   3%   0   0% /sbin/ntpd -g -c /etc/ntp.conf
 1021     1 root     S     4032   3%   0   0% /SecuriWAN/HwClockSetter
  944     1 root     S     2680   2%   0   0% dbus-daemon --config-file=/etc/db
 1030  1011 root     S     2572   2%   0   0% -sh
 1079  1074 root     S     2572   2%   0   0% -sh
    1     0 root     S     2460   2%   0   0% init
  850     1 root     S     2460   2%   0   0% syslogd -m 0 -s 2000 -b 2 -O /var
  860     1 root     S     2460   2%   0   0% klogd -c 6
  963     1 root     S     2184   2%   0   0% /usr/bin/vsftpd /etc/vsftpd.conf
    3     2 root     SW<      0   0%   0   0% [ksoftirqd/0]
  823     2 root     SWN      0   0%   0   0% [jffs2_gcd_mtd6]

ps (which doesn't understand any options besides -w on busybox) shows:
  PID USER       VSZ STAT COMMAND
    1 root      2460 S    init
    2 root         0 SW<  [kthreadd]
    3 root         0 SW<  [ksoftirqd/0]
    4 root         0 SW<  [watchdog/0]
    5 root         0 SW<  [events/0]
    6 root         0 SW<  [khelper]
   37 root         0 SW<  [kblockd/0]
   90 root         0 SW   [pdflush]
   91 root         0 SW   [pdflush]
   92 root         0 SW<  [kswapd0]
  137 root         0 SW<  [aio/0]
  146 root         0 SW<  [nfsiod]
  761 root         0 SW<  [mtdblockd]
  819 root         0 SW<  [rpciod/0]
  823 root         0 SWN  [jffs2_gcd_mtd6]
  850 root      2460 S    syslogd -m 0 -s 2000 -b 2 -O /var/log/syslog
  860 root      2460 S    klogd -c 6
  886 root      138m S    /usr/bin/rstpd 51234
  945 root      2680 S    dbus-daemon --config-file=/etc/dbus-system.conf --for
  964 root      2184 S    /usr/bin/vsftpd /etc/vsftpd.conf
  984 root      4616 S    /usr/sbin/sshd
  987 root       952 S    /sbin/udhcpd /ftp/dhcpd.conf
 1002 root      4056 S    /sbin/ntpd -g -c /ftp/ntp.conf
 1022 root      2464 S    -/sbin/getty -L ttyS0 115200 vt102
 1023 root      7176 S    sshd: root@ttyp0
 1028 root      2572 S    -sh
 1030 root      2572 R    ps

When you look at process 886, you see that it uses 112% of the availble memory and has VSZ (virtual memory size) of 138MB. That doesn't make any sense to me.
In the top man page it says:

%MEM -- Memory usage (RES)
     A task's currently used share of available physical memory.

How can this process consume more than 100% memory?
And if it's such a memory hog, why are there still 88564K RAM free on the system?

A: It is likely that rstpd has a lot of dynamic libraries linked to it, but they have not been loaded into memory yet.
See Why the value of VSIZE in top is different from the value of VSZ (Virtual set size) in ps?
What does ps aux show for that process?

A: The man page you refer to comes from the procps version of top.
But you're on an embedded system, so you have the busybox version of top.
It looks like busybox top calculates %MEM as VSZ/MemTotal instead of RSS/MemTotal.
The latest version of busybox calls that column %VSZ to avoid some confusion.  commit log


text:
Q: Mac HDD secure format options and bad sectors I heard that if we format HDD with "Zero Out Data" option, then it also takes care of bad sectors and marks them and re-maps them to other blocks. Is it true?
If it is then 7-Pass or 35-Pass would do the same (bad sectors fix) and with high assurance?

A: Zero Out Data is enough. It is highly unlikely that any marginal blocks will be missed, so extra passes are a waste of time as far as locking out blocks goes. The 35-pass erase overkill froISA security perspective as well, since it is based on what amounts to an urban legend about how to securely erase any of the ancient obsolete styles of hard drives from the 1980's.
Beware that any drive that has detected bad blocks is probably circling the drain already. Don't trust it for anything.

redpajama_set_name: RedPajamaStackExchange


text:
Q: What is the definition of "Node Failure" in Hadoop? Can a faulty node transfer data although it cannot be part of the computation?

A: A node failure can be anything from "the daemon doesn't respond" to "the whole rack went down".

Can a faulty node transfer data although it cannot be part of the computation?

Yes a datanode can serve data, even if it is flagged as down. The reason is that sometimes heartbeats from the datanode to the namenode are delayed and thus the namenode will flag a datanode as dead. However, even if a datanode is considered dead, it can still serve the blocks that were requested before it transitioned into a dead state.
This also applies for local short-circuit reads that do not contact the datanode, but rather read their blocks from disk directly.


text:
Q: Snowflake Total Bytes Over Network at any Given Point of Time I am trying to check on the snowflake account level, how much data been transferred from snowflake in and out at any given point of time. BYTES_SENT_OVER_THE_NETWORK - I tried to research this column from the Query History table but I couldn't get the given point in time instead I am getting start time and end time and how much bytes transferred. Is there any way we can get these details. Happy to share more context if required.

A: There is a Data_TRANSFER_HISTORY view in account usage which capture this for COPY, REPLICATION and EXTERNAL_FUNCTIONS
https://docs.snowflake.com/en/sql-reference/account-usage/data_transfer_history.html
For each query data transfer, you can use columns INBOUND_DATA_TRANSFER_BYTES and OUTBOUND_DATA_TRANSFER_BYTES
https://docs.snowflake.com/en/sql-reference/account-usage/query_history.html


text:
Q: PHPStan do not like logical if shorthand? Why does phpstan dislike the definition of foo.
That's not a wrong code, or is it?
Although logical if shorthands are difficult to read and are very error-prone.
<?php declare(strict_types = 1);

if(!defined('BAR')) define('BAR', 'bar');
!defined('FOO') && define('FOO', 'foo');

echo BAR;
echo FOO;

Test: https://3v4l.org/iuIrm
PHPStan: https://phpstan.org/r/366b787e-53e9-4601-9770-c65c9382212e


text:
Q: Why am I getting an error about NSCollectionView not being nil? This is my BookListObject.h:
@ property (nonatomic,retain)NSImage *bookImage;

@ property (nonatomic,copy)  NSString *bookName;

and I connect these bindings:

bookImage ----- representedObject.bookImage

bookName ------representedObject.bookName

arrayController-------arrangedObject

-(void)awakeFromNib{
    BookListObject * book=[[BookListObject alloc] init];

    book.bookName=@"unknown";

    book.bookImage=[NSImage imageNamed:@"dis"];

    _bookList=[NSMutableArray arrayWithObjects:book, nil];

    [arrayController addObject:_bookList];
}

I have seen this video.
When I run my project, it crashes and prompts that NSCollectionView item prototype must not be nil.
I found the following method, but it doesn't work:
NSCollectionViewItem *itemPrototype = [self.storyboard instantiateControllerWithIdentifier:@"collectionViewItem"];
self.bookListCV.itemPrototype=itemPrototype;

The problem remains. What should I do? How  can I bind the collectionView with collectionViewItem in the storyboard? I think XCode6 supports it only when you use xib.


text:
Q: Neutrino Oscillations and Conservation of Momentum I would like to better understand how neutrino oscillations are consistent with conservation of momentum because I'm encountering some conceptual difficulties when thinking about it. I do have a background in standard QM but only rudimentary knowledge of particle physics.
If the velocity expectation value of a neutrino in transit is constant, then it would appear to me that conservation of momentum could be violated when the flavor eigenstate at the location of the neutrino source is different from that at the location of the interaction, since they are associated with different masses.
For this reason I would think that the velocity expectation value changes in transit (for instance, in such a way to keep the momentum expectation value constant as the neutrino oscillates), but then it seems to me that the neutrino is in effect "accelerating" without a "force" acting on it (of course, since the momentum expectation value is presumed constant, there may not be a real problem here, but it still seems strange).
Any comments?

A: If by "they are associated with different masses" you mean that the flavor eigenstates have different masses then you are working from a misconception. Those states are not eigenstates of the free Hamiltonian so they don't have a mass as such. (They do have a mean expectation if you could weight a bunch of them, but it does not apply to any given neutrino.)

Update 30 April 2012 I had a talk with Fermilab theorist Boris Kayser today after he gave a colloquium and he squared me away on a few things.

*

*This question is one that has been considered many times by many people in many ways.

*Not only is what I had written originally not rigorous, but attempts to make it rigorous run into real trouble and get a result at odds with the conventional formalism and inconsistent with experiment.

*There is a way to make a rigorous analysis (whole thing at arXiv:1110.3047), and it ends up agreeing with the usual formulation at first order in $\Delta m^2_{i,j}$. It requires that you consider an experiment in the rest frame of the particle that decays to produce the neutrino (and a charged lepton). You define that decay as occurring at space time point $(0,0)$ and compute the amplitude for a neutrino in mass state $i$ to be detected at space time point $(x_\nu, t_\nu)$ in coincidence with the charged lepton being detected at space time point $(x_l, t_l)$ (both also written in the rest frame of the decay particle). Then you notice that the propagators for the two leptons are kinematically entangled. Sum the amplitudes coherently (because the mass state of the neutrino is unobserved). Using the fact that the neutrinos are ultra-relativistic approximate to first order in $\delta m^2_{i,j}$ and drop all terms that don't affect the phase-differences (because neutrino mixing only depends on the phase differences). Somewhere in there was a boost back to the lab frame and a cute calculation of how L-over-E is invariant under the boost: $\frac{L^0}{E^0} = \frac{L}{E}$. The result should be the one we usually give, only now we've dealt with this cute little puzzle.
Here's an image from an earlier talk he gave on the same subject which shows the whole process on which the calculation is performed:

So, long story short: Good question, the usual formalism doesn't seem to have a good answer, but a rigorous calculation can be made and at to leading order agrees with the usual formalism.


text:
Q: Can't boot to Ubuntu after installing it with Wubi Hi I'm trying to install Ubuntu using Wubi, but when I reboot I press esc for advanced options, selected verbose mode it stops here

My hardware is: Intel dp67bg motherboard, Intel 2600k CPU, and the Windows/Wubi installation is on a GSkill phoenix Pro SSD.
Does any one knows what is going wrong?

A: Your computer detects a Nvidia graphics card and attempts to load the open-source nouveau drivers, if that is not working for you you need to disable those at boot.
Edit the file \ubuntu\install\wubildr-disk.cfg where you installed Wubi to and open that file with a text editor, look down to the line with quiet splash and in front of splash add nomodeset.
It should read then quiet splash nomodeset.
Save the file and reboot.


text:
Q: how to fix window.open("").closed returns true when opening the link of google search

//if this is the link, return false
var tab = window.open("https://www.google.com.vn/", "_blank");

// if this is the link, reture true
// var tab = window.open("https://www.google.com/search?q=coin&oq=coin&aqs=chrome..69i57j0i131i433i512j0i433i512l2j46i131i199i433i465i512j0i131i433i512j46i131i199i433i465i512j0i131i433i512j0i433i512j0i512.665j0j15&sourceid=chrome&ie=UTF-8", "_blank");
// I want to know why it is true and how to fix it

setInterval(function() {
  checkTabsClosed()
}, 3000);

function checkTabsClosed() {
  console.log(tab);
  if (tab && tab.closed) {
    console.log("close");
  } else
    console.log("open");
}


text:
Q: Answer does not make sense using conditional probability As of now, there are 64.1 million people residing in the UK. 5.4 million of them are thought to be asthmatic. A new test for asthma has recently been introduced and medical trials indicate that

*

*in patients with asthma, the test correctly returns positive 68% of the time

*in patients that does not suffer from asthma, the test correctly returns 82% of the time.

Assuming a patient undergo medical inspection. What is the probability that the patient has asthma,

*

*if the test comes back positive?

*if the test comes back negative?

For Part 1, I used this method:
Step 1:
$$
P(A|+)=\frac{P(+|A)P(A)}{P(+)}
$$
Step 2:
$$
P(+)=P(+│A)P(A)+P(+│N)P(N)=(0.68)\left(\frac{54}{641}\right)+(0.18)\left(\frac{587}{641}\right)=\frac{7119}{32050}
$$
Step 3:
$$
P(A│+)=\frac{P(+|A)P(A)}{P(+)}=\frac{0.68\times\frac{54}{641}}{\frac{7119}{32050}}=\frac{204}{791}=25.79\%
$$
For Part 2, I used the same method as Part 1 but I got a very small answer. Assuming if I insert all the values in the equations correctly, would it be sensible if my answer for Part 2 is 3.47%?
However, personally, it does not make logical sense if the probability of test returning negative is 3.47% because that would mean almost everyone in the nation would be asthmatic.
Or I could just write it as
$$
100-25.79 = 74.21%
$$
but I'm afraid this isn't the answer given the complexity of the question.

A: One instructive way to do these kinds of $2 \times 2$ problems, since there are only four distinct populations, is to enumerate them and calculate the marginal probabilities by inspection.
$$
\begin{array}{|c|c|c|c|} \hline
& \text{asthmatic} & \text{not asthmatic} & \text{TOTALS} \\ \hline
\text{positive} & 3.672 & 10.566 & 14.238 \\ \hline
\text{negative} & 1.728 & 48.134 & 49.862 \\ \hline
\text{TOTALS} & 5.400 & 58.700 & 64.100 \\ \hline
\end{array}
$$
From this, one can read off
$$
P(\text{asthmatic} \mid \text{positive}) = 3.672/14.238 \doteq 0.25790
$$
and
$$
P(\text{asthmatic} \mid \text{negative}) = 1.728/49.862 \doteq 0.34656
$$
ETA: Two of the cells—$3.672 = (0.68)(5.400)$ and $48.134 = (0.82)(58.7)$—are filled directly by the given parameters.  Everything else is bookkeeping.
The abysmal false positive rate is due to a combination of the low specificity of the test ($82$ percent) and the relatively low prevalence of asthma ($5.4/64.1 \doteq 8.4$ percent), so that although only a minority (sizable, but still a minority) of non-asthmatics test positive, they still dwarf the asthmatics who test positive, because there are so few asthmatics available to test positive in the first place.  Even if the test were $100$ percent sensitive, the false positive rate would still have been $10.566/(10.566+5.400) \doteq 66$ percent.


text:
Q: Getting connection refused when trying to connect Questdb to Grafana I'm running QuestDB in docker and exposing the postgres port on 8812:
docker run -p 9000:9000 -p 9009:9009 -p 8812:8812 questdb/questdb:6.0.2

Then I'm running grafana with
docker run -p 3000:3000 grafana/grafana

I get an error saying connection refused: screenshot of the grafana setup
How can I connect grafana properly?

A: This is because you are running QuestDB via docker and Grafana via docker, which means that they run in their own network which is different from what you are exposing.
To solve your issue, you need to find the IP of the questDB network (within docker) and connect Grafana to it.

*

*In your terminal type: docker network inspect bridge. this will open a list of jsons.

*Under "Containers" you should see both "Name": "grafana". and "Name": "questdb".. You are looking for questdb's IPv4Address before the /. For example the ``IPv4Address can be something like:  "122.12.0.3/22" - so you need just the 122.12.0.3.

*Now go to your Grafana UI and use 122.12.0.3 to make the connection as described here.


text:
Q: Are C++ vectors in a user-defined aggregate function a POD for Postgres? The official postgres documentation (docs) states in section "37.10.11. Using C++ for Extensibility" that

*

*If calling backend functions from C++ code, be sure that the C++ call stack contains only plain old data structures (POD). This is necessary because backend errors generate a distant longjmp() that does not properly unroll a C++ call stack with non-POD objects

So, are std::vectors< uint64_t > considered POD or not? I wish I could tell from reading the above instructions but I cannot. Can someone help? Thanks.

A: Yes, they are, because they do not appear in plain C.


text:
Q: How to alter retrieved data dynamically for all models Every time records are retrieved from the database, I want to intercept the data in the observer so that I can change its value, then return the altered records to the controller.
I currently have a base model where I have set up an observer, so that every time data is retrieved, it triggers the following bit of code :
public function retrieved($data)
{
    $data->field = 'new value';
//return to controller
}

The problem is that the retrieved event happens after the controller receives the data, which means that any alterations made to the model are not available to the controller.
Is there anyway to send this altered data back to the controllers. Am I even going about this the right way ? Is there a better solution for my aims ?

A: In this case an accessor seem like a good choice since you want to modify the result when you access a property. A mutator is for when you want to modify the value when you update a property value.
To retrieve the original value you can use $someObj->getRawOriginal('property');
Also, you can append custom properties to a model (using class property $appends) with their own accessors if needed.

A: Maybe you should look at Laravel mutators
Since you are using laravel 8, you should use old school way of defining mutators.
Like this:
class SomeModel {
  ...
    /**
    * Get field attribute
    * Called when controller or view calls `->field` property
    * If you want to make it work on `some_field` then, rename it with `getSomeFieldAttribute`
    */
    public function getFieldAttribute($current_field_value)
    {
      // return whatever you want after calculation
      return 'new value ' . $current_field_value;
    }
  ...
}

With same logic you can use setFieldAttribute funtion as well.

A: I think what you need is a transformer, that will transform the data that you retrieved from the DB or some source, which can then be used within the same controller or passed on to different functions (controller).
Have a look at Fractal Transformers
SomeModelTransformer.php
<?php

namespace App\Transformers;

use App\Models\SomeModel;
use League\Fractal\TransformerAbstract;

class SomeModelTransformer extends TransformerAbstract
{
    /**
     * A Fractal transformer.
     *
     * @param SomeModel $someModel
     * @return array
     */
    public function transform(SomeModel $someModel): array
    {
        return [
            'name' => $someModel->name . " world",
        ];
    }
}

SomeModel.php
<?php

namespace App\Models;

class SomeModel {
    public $name;

    public function __construct($name)
    {
        $this->name = $name;
    }

}

use App\Models\SomeModel;
use App\Transformers\SomeModelTransformer;

$someModel = new SomeModel('hello');
$transformedData = (new SomeModelTransformer)->transform($someModel);

$transformedData
[
  "name" => "hello world",
]


text:
Q: How do I emulate a Firebase extension? I just installed a Firebase extension, and can see it in my Console. How do I get my local Functions emulator to use the extension as well?
When I start the emulators using the CLI, I can see that the functions emulator is 'Watching [locally defined path] for Cloud Functions...', but no evidence that the Firebase extension is downloaded or otherwise watched somehow.

A: July 2022: It is now possible to run extensions in the emulator. See the documentation on using the Extensions Emulator to evaluate extensions for full details.

There's currently no built in support for running Extensions on Firebase's Emulator Suite yet.
Luckily Firebase Extensions are mostly "just" predefined Cloud Functions with some installation and configuration data. And since Cloud Functions can be emulated, you can get the same functionality locally with some work.
To run an extension on your local emulator, you will have to get the source of the extension (which is linked from the extension's page), and make the Cloud Functions (and possibly application) code connect to the emulators instead of the cloud-hosted services.
Update: There is a workaround, which of the engineers working on Extensions documented here.


text:
Q: XPath expression not evaluating I have the following XML:
    <?xml version="1.0" encoding="UTF-8"?>
<Lenders>
    <ns:FinancialOrganization xmlns:ns="http://www.starstandard.org/STAR/5">
    <ns:BusinessTypeCode>F</ns:BusinessTypeCode>
    <ns:CompanyName>FIRST NIAGARA BANK</ns:CompanyName>
    <ns:CompanyCode>1ST NIAGARA BANK</ns:CompanyCode>
    <ns:PostalAddress>
        <ns:LineOne>PO BOX 76</ns:LineOne>
        <ns:LineTwo>HUDSON, NY 12534</ns:LineTwo>
        <ns:CountryID>US</ns:CountryID>
        <ns:Privacy>
            <ns:PrivacyIndicator>false</ns:PrivacyIndicator>
        </ns:Privacy>
    </ns:PostalAddress>
    <ns:LegalClassificationCode>NIAG</ns:LegalClassificationCode>
</ns:FinancialOrganization>
<ns:FinancialOrganization xmlns:ns="http://www.starstandard.org/STAR/5">
<ns:BusinessTypeCode>F</ns:BusinessTypeCode>
<ns:CompanyName>BALLSTON SPA NATIONAL BANK</ns:CompanyName>
<ns:CompanyCode>BALLSTON SPA FIN</ns:CompanyCode>
<ns:PostalAddress>
    <ns:LineOne>87 FRONT STREET</ns:LineOne>
    <ns:LineTwo>BALLSTON SPA, NY 12020</ns:LineTwo>
    <ns:CityName>BALLSTON SPA</ns:CityName>
    <ns:CountryID>US</ns:CountryID>
    <ns:Postcode>12020</ns:Postcode>
    <ns:StateOrProvinceCountrySub-DivisionID>NY</ns:StateOrProvinceCountrySub-DivisionID>
    <ns:Privacy>
        <ns:PrivacyIndicator>false</ns:PrivacyIndicator>
    </ns:Privacy>
</ns:PostalAddress>
<ns:LegalClassificationCode>BSN</ns:LegalClassificationCode>
</ns:FinancialOrganization>
<ns:FinancialOrganization xmlns:ns="http://www.starstandard.org/STAR/5">
<ns:BusinessTypeCode>F</ns:BusinessTypeCode>
<ns:CompanyName>CAPITAL ONE AUTO FINANCE</ns:CompanyName>
<ns:CompanyCode>CAP</ns:CompanyCode>
<ns:PostalAddress>
    <ns:LineOne>P.O.BOX 255605</ns:LineOne>
    <ns:LineTwo>SACRAMENTO CA 95865-5587</ns:LineTwo>
    <ns:CityName>SACRAMENTO</ns:CityName>
    <ns:CountryID>US</ns:CountryID>
    <ns:Postcode>958655587</ns:Postcode>
    <ns:StateOrProvinceCountrySub-DivisionID>CA</ns:StateOrProvinceCountrySub-DivisionID>
    <ns:Privacy>
        <ns:PrivacyIndicator>false</ns:PrivacyIndicator>
    </ns:Privacy>
</ns:PostalAddress>
<ns:LegalClassificationCode>CAP</ns:LegalClassificationCode>
</ns:FinancialOrganization>
</Lenders>

I'm trying to use XPath to get a count of the number of items returned and also then get the individual element. Here's my examples that are not returning the correct result:
/Lenders/ns:FinancialOrganization[1]/ns:BusinessTypeCode

count(/Lenders/ns:FinancialOrganization/ns:BusinessTypeCode)

I'm pretty new to XPath but this particular challenge has me stumped. I'm using the W3c Xpath evaluation online tool:
http://www.utilities-online.info/xpath/?save=7f748259-a214-4f1e-8872-6f6306199331-xpath

A: Most likely, the online tool you're using doesn't support namespace prefix in the XPath. I tried to remove prefixes from the XML, for example this element :
<ns:FinancialOrganization xmlns:ns="http://www.starstandard.org/STAR/5">

became this unprefixed element :
<FinancialOrganization xmlns:ns="http://www.starstandard.org/STAR/5">

Then this XPath returned 3 as expected :
count(/Lenders/FinancialOrganization/BusinessTypeCode)

In my expereience using several .NET libraries that support XPath, we need to manually declare prefix-to-namespace-URI mapping before we can use that prefix in our XPath query. It seems that the same applies in Java.


text:
Q: redirect unknown address in traefik How to setup up traefik to redirect all unknown addresses? What I mean is the following - I use docker swarm with traefik and I have couple of services with rules set up in labels:

*

*"traefik.http.routers.app.rule=Host(`app.example.com`)"

*"traefik.http.routers.else.rule=Host(`else.example.com`)"

*etc.

What I want is to handle requests for which no matching rule is found, e.g. lalala.example.com -> example.com.
I tried to add the following in my traefik container labels section:
- "traefik.http.routers.default.rule=HostRegexp(`{host:.+}`)"
- "traefik.http.routers.default.entrypoints=web,websecure"
- "traefik.http.routers.default.priority=1"
- "traefik.http.routers.default.middlewares=default-redirect"
- "traefik.http.middlewares.default-redirect.redirectregex.regex=.*"
- "traefik.http.middlewares.default-redirect.redirectregex.replacement=https://example.com"

However, this doesn't work, each attempt to request non-existent address ends with:
Websites prove their identity via certificates. Firefox does not trust this site because it uses a certificate that is not valid for lalala.example.com. The certificate is only valid for <some_random_id>.traefik.default.

Error code: MOZILLA_PKIX_ERROR_SELF_SIGNED_CERT

Letsencrypt works fine on my existing services and I'm also redirecting all http to https if that's relevant.

A: Try to use the following labels to set the redirections via middleware
- traefik.http.middlewares.default_host.redirectregex.regex=^https://(.*)?example.com(.*)$$
- traefik.http.middlewares.default_host.redirectregex.replacement=https://example.com
- traefik.http.middlewares.default_host.redirectregex.permanent=true
- traefik.http.routers.http_catchall.rule=HostRegexp(`{any:.+}`)
- traefik.http.routers.http_catchall.entrypoints=web,websecure
- traefik.http.routers.http_catchall.middlewares=bevision

You also need to make sure that lets encrypt can handle SSL certs for all domains (You need a wildcard cert for this)
- traefik.http.routers.wildcard.tls=true
- traefik.http.routers.wildcard.tls.certresolver=route53
- traefik.http.routers.wildcard.tls.domains[0].main=example.com
- traefik.http.routers.wildcard.tls.domains[0].sans=*.example.com


text:
Q: Add computed column into existed table with rand() function I have an existed table product, and want to add a new computed column test, with the formula is SUBSTRING(MD5(RAND()) FROM 1 FOR 16)
So the query is like this:
alter table product add test varchar(255) as (SUBSTRING(MD5(RAND()) FROM 1 FOR 16));

But it returns me the error is
Error Code: 3763. Expression of generated column 'test' contains a disallowed function: rand.

Do anyone know why and how to fix it?

A: As others have stated in comments, you can't use RAND() in a computed column. But you can get the same intended result using a trigger.
First, add the column (I've called it test_md5rand):
ALTER TABLE product add test_md5rand varchar(255);

Then add the trigger:
CREATE TRIGGER product_md5
BEFORE INSERT
ON product FOR EACH ROW
BEGIN
  SET NEW.test_md5rand = SUBSTRING(MD5(RAND()) FROM 1 FOR 16);
END

Perhaps update the existing rows:
UPDATE product
   SET test_md5rand = SUBSTRING(MD5(RAND()) FROM 1 FOR 16)
 WHERE test_md5rand IS NULL;

dbfiddle

A: You cannot add the value as a computed column -- the reason is simple:  the value changes on each execution.  Technically, this is because rand() is a volatile function.
If you really wanted this functionality, you could use a view:
create view v_product as
    select p.*, left(md5(rand()), 16) as test
    from product p;

Having value that changes is probably not what you want.  As the other answer suggests, you can use a trigger.  In my opinion, that is also unpleasant.
One option is to base the calculated value on existing columns, such as the name:
alter table product add test varchar(16) as left(md5(product_name), 16);

The only possible downside to this approach is that if the column changes, then test changes.


text:
Q: Is there an equivalent of .currentTime = 0 for phaser 3 audio? I'm making a game in phaser 3 and I need to make it so that the music pauses and resets the time when you die, but I don't know if there's an equivalent of the audioObject.currentTime value for a phaser 3 audio object that can be used to restart audio, or something similar. Anyone know what I can do?

A: A Phaser 3 Audio object has all the property and method described here
You can play/pause/resume an audio, and you can access members like duration/totalDuration.


text:
Q: try/catch around reference assignment I would like to catch an exception from a method that returns a reference, without catching the same exception from a later call which uses the reference. For example:
try {
    Something &o = myMap.at(myIndex);
    foo(o);
} catch(std::out_of_range &e) {
    // If this was thrown by myMap.at, we can handle it
    // If this was thrown by foo, we can't, and need to propagate it
}

So I'm looking to do something like this:
Something &o;
try {
    o = myMap.at(myIndex);
} catch(std::out_of_range &e) {
    // Handle the error
}
foo(o);

But of course, that's not valid. I can think of ways to wrap foo's exceptions in another exception then unwrap it outside the try, but that's rather messy. Is there a better way?
MCVE can be found here: https://ideone.com/DJHxpO

A: You can use an immediately invoked lambda expression:
Something &o = [&]() -> decltype(auto) {
    try {
        return myMap.at(myIndex);
    } catch(std::out_of_range &e) {
        // Handle the error
        // Return some other object for o to refer to.
    }
}();
foo(o);

A: You can use pointer instead:
Something *o; // initialize it with nullptr if necessary
try {
    o = &myMap.at(myIndex);
} catch(std::out_of_range &e) {
    // Handle the error
}
foo(*o);      // check whether it's nullptr before dereference if necessary

A: I think this is a good use case for boost::optional (std:: in c++17).
You don't really want to generate or handle and exception because the item not being in the map is not an exceptional circumstance.
I think I would express it like this:
int myIndex = 1;
foo(maybe_at(myMap, myIndex).value_or_eval([]()->Something& {
    // perform error code here
    return default_something;
}));

Full code example here:
#include <map>
#include <type_traits>
#include <boost/optional.hpp>

template<class Container>
struct container_traits
{
    using maybe_const_type = std::remove_reference_t<Container>;
    using container_type = std::decay_t<Container>;
    using is_const = std::is_const<maybe_const_type>;
    using key_type = typename container_type::key_type;
    using raw_mapped_type = typename container_type::mapped_type;
    using mapped_type = std::conditional_t<is_const::value, std::add_const_t<raw_mapped_type>, raw_mapped_type>;
    using mapped_reference = std::add_lvalue_reference_t<mapped_type >;
};

template<class Container, class Key>
auto maybe_at(Container&& container, Key&& key)
{
    using traits = container_traits<Container>;
    using result_type = boost::optional<typename traits::mapped_reference>;

    auto result = result_type {};
    auto ifind = container.find(key);
    if (ifind != container.end()) {
        result = ifind->second;
    }
    return result;
}

struct Something {};

void foo(Something&) {}
void foo(const Something&) {}

std::map<int, Something> myMap1;
const std::map<int, Something> myMap2;

auto default_something = Something{};

int main() {

    int myIndex = 1;

    foo(maybe_at(myMap1, myIndex).value_or_eval([]()->Something& {
        // perform error code here
        return default_something;
    }));

    foo(maybe_at(myMap2, myIndex).value_or_eval([]()->Something const& {
        // perform error code here
        return default_something;
    }));

}

A: A simple way, which works with all versions of C++, would be
bool mapped = false;
try {
    Something &o = myMap.at(myIndex);
    mapped = true;
    foo(o);
} catch(std::out_of_range &e) {
     if (mapped) throw;
     //   if we get to here, the exception was thrown by myMap.at()
}

This also avoids the need to make the reference refer to some other object if myMap.at() fails.


text:
Q: Integral tends to infty How can we prove that $\lim\limits_{\varepsilon\searrow 0} \dfrac{1}{\varepsilon} \displaystyle\int_0^1 \left [\dfrac{1}{4}-\dfrac{1}{\pi^2}\arctan^2\left (\dfrac{x}{\varepsilon}\right )\right ]^2 dx=+\infty$?
I came across this integral in studying the Heaviside aproximation function. I used the following sharp estimate:
$\arctan(x)<\dfrac{\pi^2 x}{4+\sqrt{32+(2\pi x)^2}}, \forall\ x>0$, but the limit goes to $0$ (I computed it exactly with wolfram). This estimation and many others can be found here:
https://journalofinequalitiesandapplications.springeropen.com/articles/10.1186/s13660-018-1734-7
The integral in the statement is simulated here:
https://www.wolframalpha.com/input/?i=int_0%5E1+1000000000+%281%2F4+-+%281%2Fpi%5E2%29+%28arctan%2810000000000+x%29%29%29%5E2+dx
But I wonder if it can be proved that it really tends to infinity. Maybe there are some singularities and the program gives some big errors.

A: We can approach the value given by @Sangchul Lee in comments.
Let
$$f(t)= \left[\frac{1}{4} - \frac{1}{\pi^2} \arctan^2 \bigl( t^2 \bigr) \right]^2 $$ and write for example
$$\int_0^\infty f(t)\,dt=\int_0^1 f(t)\,dt+\int_1^\infty f(t)\,dt$$ For the first integral, using
$$f(t)=\frac{1}{16}-\frac{t^4}{2 \pi ^2}+\frac{\left(3+\pi ^2\right) t^8}{3 \pi
   ^4}-\frac{\left(120+23 \pi ^2\right) t^{12}}{90 \pi ^4}+\frac{22 \left(7+\pi
   ^2\right) t^{16}}{105 \pi ^4}-\frac{\left(14360+1689 \pi ^2\right) t^{20}}{9450
   \pi ^4}+\frac{\left(239327+24405 \pi ^2\right) t^{24}}{155925 \pi
   ^4}+O\left(t^{28}\right)$$
$$\color{blue}{\int_0^1 f(t)\,dt \sim \frac{1}{16}-\frac{58331177}{804053250 \pi ^2}+\frac{15323818}{182739375 \pi ^4}}$$
For the second integral, using
$$f(t)=\frac{1}{\pi ^2 t^4}-\frac{2}{\pi ^3 t^6}+\frac{3-2 \pi ^2}{3 \pi ^4 t^8}+\frac{2}{\pi ^3 t^{10}}+\frac{23 \pi ^2-60}{45 \pi ^4
   t^{12}}-\frac{28}{15 \pi ^3 t^{14}}-\frac{22 \left(2 \pi ^2-7\right)}{105 \pi ^4
   t^{16}}+\frac{1636}{945 \pi ^3 t^{18}}+\frac{1689 \pi ^2-7180}{4725 \pi ^4
   t^{20}}-\frac{282}{175 \pi ^3 t^{22}}+\frac{239327-48810 \pi ^2}{155925 \pi ^4
   t^{24}}+\frac{26126}{17325 \pi ^3
   t^{26}}+O\left(\frac{1}{t^{28}}\right)$$
$$\color{blue}{\int_1^\infty f(t)\,dt \sim \frac{5946893}{22713075 \pi ^2}-\frac{474283184}{2010133125 \pi
   ^3}+\frac{1446994}{13627845 \pi ^4}}$$
So
$$\color{red}{\int_0^\infty f(t)\,dt \sim \frac{1}{16}+\frac{22169236787}{117123756750 \pi ^2}-\frac{474283184}{2010133125 \pi ^3}+\frac{500797244128}{2635284526875 \pi ^4}}$$ which is $0.0760194$.
Edit
After the edit of the question, the problem is much simpler with
$$f(t)= \left[\frac{1}{4} - \frac{1}{\pi^2} \arctan^2 \bigl( t \bigr) \right]^2 $$ since there is an antiderivative.
Expanding the square,we face two integrals
$$I_1=\int\arctan^2(t)\,dt \qquad \text{and} \qquad I_2=\int\arctan^4(t)\,dt$$ Making $t=\tan(u)$
$$I_1=\int u^2 \sec ^2(u)\,du \qquad \text{and} \qquad I_2=\int u^4 \sec ^2(u)\,du $$ which can express in terms of the polylogarithm function.
Recombining the antiderivatives and using the bounds
$$\int_0^\infty \left[\frac{1}{4} - \frac{1}{\pi^2} \arctan^2 \bigl( t \bigr) \right]^2 =\frac{3 }{\pi ^3}\zeta (3)$$
Using, as before, series expansions
$$\color{blue}{\int_0^1 f(t)\,dt \sim \frac{1}{16}+\frac{40832183318753}{559056788915625 \pi
   ^4}-\frac{56140585778267}{452214824811750 \pi ^2}}$$
$$\color{blue}{\int_1^\infty f(t)\,dt \sim \frac{1112361876473779}{7102091799928125 \pi
   ^4}-\frac{478852611552730453}{679000559454842625 \pi
   ^3}+\frac{2370558288062177347}{2799586611272075625 \pi ^2}}$$
This gives $\sim 0.11533$ while $\frac{3 }{\pi ^3}\zeta (3)\sim 0.11630$.

A: OHH, please sorry. I made a mistake putting an extra $2$. It should be:
$$\lim\limits_{\varepsilon\searrow 0} \dfrac{1}{\varepsilon} \displaystyle\int_0^1 \left [\dfrac{1}{4}-\dfrac{1}{\pi^2}\arctan^2\left (\dfrac{x}{\varepsilon}\right )\right ]^2 dx=+\infty$$


text:
Q: Why does www.mywebsite.com/folder work, but www.mywebsite.com/folder/ does not? Why does mywebsite.com/page work, but mywebsite.com/page/ does not? We have an htaccess entry that removes the .php ending of files, for example "mywebsite.com/new.php" can be accessed simply as "mywebsite.com/new". However, if a forward slash is added (and this seems to happen with some search engines adding it or browsers for some reason) then our 404 error page is shown. Any ideas? Many thanks!
Here are all the rewriterules in the .htaccess file:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([a-z0-9\-_]+)/?$ $1.php [NC,L]

rewriteCond %{HTTP_HOST} ^mywebsite.cz [NC]
rewriteRule ^(.*)$ http://www.mywebsite.cz/$1 [R=301,L]

rewriteCond %{HTTP_HOST} ^mywebsite.com [NC]
rewriteRule ^(.*)$ http://www.mywebsite.com/$1 [R=301,L]

RewriteCond %{HTTP_HOST} ^mywebsite.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.mywebsite.com$
RewriteRule ^cs$ "http\:\/\/www\.mywebsite\.com\/index_cz\.php" [R=301,L]

RewriteCond %{HTTP_HOST} ([^.]+)\.mywebsite.com [NC]
RewriteCond %{HTTP:Accept-Language} (cs) [NC]
RewriteRule ^$ http://www.mywebsite.cz [L,R=301]

RewriteCond %{HTTP_HOST} ([^.]+)\.mywebsite.cz [NC]
RewriteCond %{HTTP:Accept-Language} (cs) [NC]
RewriteRule ^$ /index_cz [L,R=301]

RewriteCond %{HTTP_HOST} ^www.mywebsite\.com
RewriteRule ^([0-9]+)/?$ project.php?id=$1 [NC,L] # Handle project requests

RewriteCond %{HTTP_HOST} ^www.mywebsite\.cz
RewriteRule ^([0-9]+)/?$ project_cz.php?id=$1 [NC,L] # Handle project requests

A: You can try this:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([a-z0-9\-_]+)/?$ $1.php [NC,L]

also, you have to change all your , ,  to point to the root of the folder. eg:
<link rel="Shortcut Icon" type="image/ico" href="favicon.ico"/>
<script type="text/javascript" src="js/charactercounter.js"></script>

will become:
<link rel="Shortcut Icon" type="image/ico" href="/favicon.ico"/>
<script type="text/javascript" src="/js/charactercounter.js"></script>

A: when you are writing mysite.com/page, this is directing you to the document in the root directory.  However, when you write my site.com/page/ Apache will think you are references a directory named page, and then looking for a document in the page directory.

A: maybe something like this...
      RewriteCond %{HTTP_HOST} !^\.yoursite\.com$ [NC]
      RewriteRule ^(.+)/$ http://%{HTTP_HOST}/$1 [R=301,L]


text:
Q: Magento 1.9 - Varnish, nginx and redirects (http -> https and non-www to www) trying to redirect all non-www traffic to www and all http traffic to https.
Environment is Magento 1.9 with Varnish and nginx. We also have Cloudflare (fully SSL enabled). Using the code below in vhosts, it doesn't redirect correctly - anybody see anything wrong?
Many thanks
server {
  listen 80;
  server_name www.example.com example.com;
   return 301 https://www.example.com$request_uri;
}
server {
  server_name example.com;
  {{ssl_listener}};
  {{ssl_certificate}};
  {{ssl_certificate_key}};
  ssl_session_cache  builtin:1000  shared:SSL:10m;
  ssl_session_timeout  10m;
  ssl_protocols TLSv1.1 TLSv1.2;
  ssl_ciphers 'ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384';
  ssl_prefer_server_ciphers on;
  ssl_stapling on;
  ssl_stapling_verify on;
  return 301 https://www.example.com$request_uri;
}


text:
Q: CodeIgniter Error : Fatal error: Call to private IOFactory::__construct() from context 'CI_Loader' I was trying to implement PHPExcel through codeigniter and I am getting this error
 class Users extends CI_Controller {

/**
 * Index Page for this controller.
 *
 * Maps to the following URL
 *      http://example.com/index.php/welcome
 *  - or -
 *      http://example.com/index.php/welcome/index
 *  - or -
 * Since this controller is set as the default controller in
 * config/routes.php, it's displayed at http://example.com/
 *
 * So any other public methods not prefixed with an underscore will
 * map to /index.php/welcome/<method_name>
 * @see http://codeigniter.com/user_guide/general/urls.html
 */

public function _construct()
{
}

public function index()
{

    $this->load->library('phpexcel');
    $this->load->library('PHPExcel/iofactory');

    $objPHPExcel = new PHPExcel();
    $objPHPExcel->getProperties()->setTitle("title")
                     ->setDescription("description");

    // Assign cell values
    $objPHPExcel->setActiveSheetIndex(0);
    $objPHPExcel->getActiveSheet()->setCellValue('A1', 'cell value here');

    // Save it as an excel 2003 file
    $objWriter = IOFactory::createWriter($objPHPExcel, 'Excel5');

    $objWriter->save("nameoffile.xls");
}
}

/* End of file welcome.php */
/* Location: ./application/controllers/welcome.php */

I am getting this error:
Fatal error: Call to private IOFactory::__construct() from context 'CI_Loader' in F:\xampp\htdocs\import\system\core\Loader.php on line 1099

A:
class Users extends CI_Controller {
function __construct()
{
    **parent::__construct();**
}
function index()
{
   $this->load->library('phpexcel');
   $this->load->library('PHPExcel/iofactory');

   $objPHPExcel = new PHPExcel();
   $objPHPExcel->getProperties()->setTitle("title")
                 ->setDescription("description");

   // Assign cell values
   $objPHPExcel->setActiveSheetIndex(0);
   $objPHPExcel->getActiveSheet()->setCellValue('A1', 'cell value here');

   // Save it as an excel 2003 file
   $objWriter = IOFactory::createWriter($objPHPExcel, 'Excel5');

   $objWriter->save("nameoffile.xls");
}

}
enter link description here


text:
Q: HylaFax - Get status of a job I am trying to write a front-end for sending faxes in PHP. I want to know how can I get the status of a fax job.
When the user sent a fax, how can I report the status of the job to the user ? In case when the destination line was busy, unreachable, etc.
Is there any log file or a command that contains the status of a specific fax job which is transfer-able to the front-end ? So I can report back the success/failed message to user.
I know about faxstat -d, but it's a report for all jobs and i can't fetch that on php side.

As you can see the format of output is not something that can be parsed easily.
Just for reference, here is the list of all status codes.
I had a look at Hylafax's documentation but couldn't find anything on how to trace a job status.

A:
I know about faxstat -d, but it's a report for all jobs and i can't
  fetch that on php side.

Sure you can. You have a couple options: system and exec.
Use one of those to run the faxstat command in combination with grep, and you should be able to get the data you want. Alternatively, suck in all of faxstat's output into a php variable, and then parse out the data you're looking for.

A: The file in /var/spool/hylafax/doneq/q$job_id, where $job_id is your job #, is more descriptive. See here: http://hylafax.sourceforge.net/man/doneq.php

Files in the doneq directory specify completed transmission job
  requests. These files are created by hfaxd(8C), when submitting a job
  on behalf of sendfax(1) or sendpage(1). Job description files also
  reside in the sendq directory; they are moved from there to the doneq
  directory by faxq(8C) when a job completes.


text:
Q: How to mask text on background size change Currently I am working on a new website for our web design business and I need to mask the mobile nav text so that it is shown while the background is visible and for the text to be hidden while it is not.
Currently the animation does this, with the text overlapping when the background slides out.
Image of issues
I essentially need it to do this Image of solution (photoshopped) where the text is "masked" to be hidden when it slides out.

            Home

            About

            SEO Services

            Website Design FAQ

            Portfolio

            Testimonials

            Blog

            Contact

.et_pb_menu__menu {
position: fixed;
top: 0; left: 0;
height: 100vh!important;
width: 100vw;
background: linear-gradient(135deg,rgba(254,209,7,0.95) 50.1%,rgba(0,0,0,0) 50%);
background-size: 100px 100px;
background-position: -100px -100px;
background-repeat: no-repeat;
pointer-events: none;
transition: all 1s ease;}

.et_pb_menu__menu.custom-menu-active {
pointer-events: all;
background-position: 0% 0%;
background-size: 400% 300%;}

A test version of the site is here: https://grow-my-business.dreamhosters.com/
(mobile nav is 980px and down)

A: Replace the background with mask and keep everything the same (size and position)

.et_pb_menu__menu {
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh!important;
  width: 100vw;
  background:rgba(254, 209, 7, 0.95);
  -webkit-mask: linear-gradient(135deg, #fff 50.1%, transparent 50%);
  -webkit-mask-size: 100px 100px;
  -webkit-mask-position: -100px -100px;
  -webkit-mask-repeat: no-repeat;
  transition: all 1s ease;
}

.et_pb_menu__menu:hover {
  -webkit-mask-position: 0% 0%;
  -webkit-mask-size: 400% 300%;
}

        Home

        About

        SEO Services

        Website Design FAQ

        Portfolio

        Testimonials

        Blog

        Contact

Also like below:

.et_pb_menu__menu {
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh!important;
  width: 100vw;
  background:rgba(254, 209, 7, 0.95);
  -webkit-mask: linear-gradient(135deg, #fff 50.1%, transparent 50%);
  -webkit-mask-position: 100% 100%;
  -webkit-mask-size: 200% 200%;
  -webkit-mask-repeat: no-repeat;
  transition: all 1s ease;
}

.et_pb_menu__menu:hover {
  -webkit-mask-position: 0 0;
}

        Home

        About

        SEO Services

        Website Design FAQ

        Portfolio

        Testimonials

        Blog

        Contact

Clip-path can also do it:

.et_pb_menu__menu {
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh!important;
  width: 100vw;
  background:rgba(254, 209, 7, 0.95);
  clip-path:polygon(0 0,0 0,0 0);
  transition: all 1s ease;
}

html:hover .et_pb_menu__menu{
  clip-path:polygon(0 0,200vmax 0,0 200vmax);
}

        Home

        About

        SEO Services

        Website Design FAQ

        Portfolio

        Testimonials

        Blog

        Contact


text:
Q: Qt-designer: enlarging the window does not replace my items To keep the question as simple as possible, I prepared a simple Qt designer form below

There is a Tab Widget on the left side and empty QWidget on the right side, the QWidget  as a GroupBox. The Groupbox has a radio and pusbuttons (you can see them on Object inspector window on the photo as well ). The tab widget has a line edit. The central widget has a gridlayout and horizontal qsplitter is used.
My issue is that when I enlarge the window, all items (lineedit, radiobutton, pushbutton) are on the fix position. Here is an example what I mean:

What I want is that when the window is enlarged the items should be placed on the bottom of the window, or if they are in the middle, then they should stay in the middle. ( I don't want size of the buttons/lineedits to be changed).
How can I do it?

A: The items you want to move dynamically, with window resizing must be in a layout.
So, in the example you've posted, you need two layouts; one inside the tab widget, for the QLineEdit and at least one in the GroupBox for the radio button and push button.
If you want the radio and push button to be aligned horizontally, you can start by placing them in a horizontal layout, before placing that layout in another, which all reside in the group box.
When you start to add items to layouts, such as push buttons, you'll start to notice that they can get stretched, so you may need to set the size policies of the widgets.

A: If you want the line edit to be centered horizontally, you will have to place two horizontal spacers on each side of the line edit and select the three together and set "Lay out Horizontally". This can found at the top toolbar in Qt Designer.
To always have it at the bottom of the tab widget, put a vertical spacer above the line edit in your tab widget. Then select the option "Lay out vertically" for the tab widget.
The same goes for your radio button and push button. Keep them in a horizontal layout, with horizontal spacers if required and put a vertical spacer into the group box and set the layout property for the group box as "Lay out Vertically".
Most important of all, I suggest you go through some basic tutorials before you continue. Here is a link to a good channel on youtube.
https://www.youtube.com/playlist?list=PL2D1942A4688E9D63

A: If you don't have a layout in your tabWidget or GroupBox:
You must set a layout (for example QVBoxLayout)  inside your tab widget  and a group box.
It can be done using QtDesigner. It also can be done in code like this:
 QWidget *window = new QWidget;
 QPushButton *button1 = new QPushButton("One");
 QPushButton *button2 = new QPushButton("Two");
 QPushButton *button3 = new QPushButton("Three");
 QPushButton *button4 = new QPushButton("Four");
 QPushButton *button5 = new QPushButton("Five");

 QHBoxLayout *layout = new QHBoxLayout;
 layout->addWidget(button1);
 layout->addWidget(button2);
 layout->addWidget(button3);
 layout->addWidget(button4);
 layout->addWidget(button5);

 window->setLayout(layout);

But if you do, and then you want your buttons to stay at the bottom:
Then you have to try setRowStretch method http://qt-project.org/doc/qt-4.8/qgridlayout.html#setRowStretch or take a look at QSpacerItem.


text:
Q: How do I set Variables with Query for GraphQL in .NET I can't seem to get this to work
I have the following code.
var query = new GraphQLRequest
            {

                Query = @"
  {
    query ($pageSize : Int)
{
    studentQuery(skip:20, pageSize: $pageSize ){
    totalRecords
    pageInfo{
      hasNextPage
    }
    students{
      studentCursor
      studentCode
      firstName
      surname
      studentPlacements(placementStatuses:[""Offered"", ""Published"", ""Incomplete"", ""Cancelled"", ""Accepted"", ""Completed"", ""Withdrawn Education Provider"", ""Withdrawn Student""]){
        placementId
        startDate
        endDate
        publishedPersonnelEmail
        placementStatus
        placementAgencies{
          agencyCode
          agencyName
          agencyLevel
        }
      }
    }
  }
}
}
",
                Variables = new { pageSize = 10 },

            };

I can't for the life of me get it to work with variable for pageSize
I always get an error saying Expecting Name found $

A: I had to remove the outer {}
Now on to figuring out how to pass a data


text:
Q: Stray Capacitance in my load waveform? I have just taken this trace of my Loadwave form for  PWM controlled halogen dimmer.
I was wondering if anyone could identify the cause of the transients below or above zero volts for each polarity.
That is, why does the waveform seem to dip below zero (or above) when switching.
This was taken with my USB oscilloscope and the PWM frequency is 31.25kHz
The circuit composed of two mosfets who PWM the power to a halogen bulb from a toroidal transformer.
The leads to the bulb are quite long.
Any indication as to what is causing this would be of great help!

A: My first guess would be inductive pick-up in your scope probe.
Try to make the GND loop connection from your scope probe to your board smaller in area (it's all about area for inductive pick-up) - keep it as close as possible to the side of the scope probe. Also try tightly twisting the leads to the bulb if they are, as you said, quite long.
Hopefully what you are seeing are measurement artefacts and, if so, should be reduced with the techniques described.


text:
Q: How can i get how to scrolled it is in uicollectionView I'm using uicollectionview in storyboard.
When uicollectionview scroll down i want get how scrolled down In pixels
For example, if i swipe one finger, return 200 pixels.
Is it possible?

A: you can get the scroll event with UIScrollViewDelegate and
func scrollViewDidScroll(_ scrollView: UIScrollView) { }

Now, you can have the scroll position with scrollView.contentOffset it's a CGPoint, so with a conversion (point to pixel) you should get the numbers of Pixel.
scrollView.contentOffset.y * UIScreen.main.scale

This should works.


text:
Q: Can't run JDI trace example: Error: Could not find or load main class I run in command line the following program as an example app:

java -cp "D:\projects\PDFJavaFX\lib\PDFRenderer-0.9.1.jar"
  com/sun/pdfview/PDFViewer

Then I run in command line the JDI trace example:

java -cp "C:\Program
  Files\Java\jdk1.7.0_13\lib\tools.jar;D:\projects\JDI_Trace\jar\trace.jar;D:\projects\PDFJavaFX\lib\PDFRenderer-0.9.1.jar"
  com/sun/tools/example/trace/Trace com/sun/pdfview/PDFViewer

I get this error:
Error: Could not find or load main class com.sun.pdfview.PDFViewer
 -- VM Started --
 -- The application exited --

The example app runs correctly, and it is included in the classpath.
What's the cause of this?
What am I missing?
Thanks

A: Edit: It looks like it is classpath related.
I did get this to work (well, it popped up the GUI but then crashed pretty quickly). I used the classpath environment variable instead of -cp:
C:\cos126\dev\debug>set CLASSPATH=%CLASSPATH%;c:\tmp\PDFRenderer-0.9.1.jar;c:\tmp\debug

So, not pretty, but then it did work. So it looks like the newly created VM doesn't automatically inherit -cp. I am optimistic, but not sure, that there might be an option you can change when starting the new VM to do this for you. To see the "documentation" for the VM launching options, you can add some code like
for (Map.Entry<String, Connector.Argument> arg : arguments.entrySet()) {
   System.out.println(arg.getValue().name()+" "+arg.getValue().description());
}

to Trace.java. When I do this, it prints out
home Home directory of the SDK or runtime environment used to launch the application
options Launched VM options
main Main class and arguments, or if -jar is an option, the main jar file and arguments
suspend All threads will be suspended before execution of main
quote Character used to combine space-delimited text into a single command line argument
vmexec Name of the Java VM launcher

so maybe one of those is useful? Good luck!
By the way, this is what I used JDI for:
http://cscircles.cemc.uwaterloo.ca/java-visualize/
I am in the process of making the source shareable, if you want to see it (although I'm not 100% sure it will be of use).

A: Your command :
java -cp "C:\Program Files\Java\jdk1.7.0_13\lib\tools.jar;
D:\projects\JDI_Trace\jar\trace.jar;
D:\projects\PDFJavaFX\lib\PDFRenderer-0.9.1.jar"
com/sun/tools/example/trace/Trace com/sun/pdfview/PDFViewer
Explanation :
The new VM which is created by the Trace has different class path. main class PDFViewer is in the PDFRenderer**.jar,but the new VM didn't know the jar, so it can't find the main class. I also met this problem when I used Eclipse. And by changing the working directory, I can run it successfully.
In fact, the Trace class uses JDI to launch the new VM, but it only set the main option and discard the vm options. The code below is quoted from the Thrace class source file, and I add some lines to print the options.
Map<String, Connector.Argument> connectorArguments(LaunchingConnector connector, String mainArgs) {
    Map<String, Connector.Argument> arguments = connector.defaultArguments();
    Connector.Argument mainArg =
                 (Connector.Argument)arguments.get("main");
    //added by me: begin
    java.util.Set<String> argsString = arguments.keySet();
    System.out.println("connector args size is :" + argsString.size());
    for (String arg : argsString) {
        System.out.println(arg + "=="+ arguments.get(arg).description()+"=="+arguments.get(arg).value()) ;
    //added by me: end
    }
    if (mainArg == null) {
        throw new Error("Bad launching connector");
    }
    mainArg.setValue(mainArgs);

The output of the arguments size is 6, and they are "home, options,  main, suspend, quote and vmexec". If we want to configure the new VM options, we can set the "options" by setValue method like setting "main".


text:
Q: How to remove specific message from queue on RabbitMQ Client publish 5 message in to queue(name is Q) with Rabbit MQ
Q
100 --first
101
102
103
104 -- last
I have a c# task that consumes all messages automatically when clients publish some messages.
Client can see on the UI which is consuming still or which is consumed.
Think that message("100") is consuming and Client want to remove message("103") at the same time.Is that possible?If it is possible how to solve it?


text:
Q: collision ImageView in android studio Please help me , make a code collision between two ImageView in android studio.
thank you so much
 but it is not detect collision , it always notice Not Intersected, please help me
protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);

            setContentView(R.layout.activity_second);

            int x = img_animation.getRight() - img_animation.getLeft();
            int y = img_animation.getBottom() - img_animation.getTop();
            final TranslateAnimation translate = new TranslateAnimation(
                    Animation.ABSOLUTE, x, Animation.ABSOLUTE,
                    2000, Animation.ABSOLUTE, 0,
                    Animation.ABSOLUTE, y);
            translate.setDuration(3200);//speed of the animation
            translate.setFillEnabled(true);
            translate.setFillAfter(true);
            img_animation.startAnimation(translate);

    //2nd brick animation

            int x1 = img_animation1.getRight() - img_animation1.getLeft();
            int y1 = img_animation1.getBottom() - img_animation1.getTop();
            final TranslateAnimation secondone = new TranslateAnimation(
                    Animation.ABSOLUTE, x1, Animation.ABSOLUTE,
                    -2000, Animation.ABSOLUTE, 0,
                    Animation.ABSOLUTE, y1);
            secondone.setDuration(5200);//speed of the animation
            secondone.setFillEnabled(true);
            secondone.setFillAfter(true);
            img_animation1.startAnimation(secondone);

                Rect R1=new Rect(img_animation.getLeft(), img_animation.getTop(),img_animation.getRight(),img_animation.getBottom());
                img_animation.getHitRect(R1);
                Rect R2=new Rect(img_animation1.getLeft(),img_animation1.getTop(),img_animation1.getRight(),img_animation1.getBottom());
                img_animation1.getHitRect(R2);

                if (Rect.intersects(R1, R2)) {

                    Toast.makeText(this, "Intersected!", Toast.LENGTH_SHORT).show();
                } else {

                    Toast.makeText(this, "Not Intersected!", Toast.LENGTH_SHORT).show();
                }
        }

A: try with
int x = img_animation.getX();
int y = img_animation.getY();


text:
Q: Refresh DIV with Javascript and limit time I'm using the following javascript to refresh a div on a page every 30 seconds:
<script type="text/javascript" src="jquery.min.js"></script>
<script type="text/javascript">
$(function(){
    $(document).ready(function(){
        $.ajaxSetup({cache: false});
    });
    getStatus();
});
function getStatus() {
    $('div#content').load('ajax_stream.php').fadeIn("slow");
    setTimeout("getStatus()",30000);  // refresh every 30000 milliseconds (30 seconds)
}
</script>

It occurs to me that there needs to be some form of limitation so that after 'n' minutes, we stop refreshing the div - ie if a user leaves their browser open forever, we don't just keep consuming server resources.
How can I achieve this?  Additionally, if I wanted to call a new file inside the DIV upon timeout, what is the best method?

A: maybe you could, just store the timeout and check if the time in milliseconds is lower then the time in minutes you want the script to stop ?
var timerunning;
...
timerunning = timerunning + 30000;
if(timerunning < 120000){
    setTimeout("getStatus()",30000);
}

didn't test though, good luck :)

A: How about this solution?
<script type="text/javascript" src="jquery.min.js"></script>
<script type="text/javascript">
    var statusUpdateTimeout = null;
    $(function(){
        $(document).ready(function(){
            $.ajaxSetup({cache: false});
        });

        // Run get status and repeat every 30 seconds
        getStatus();
        statusUpdateTimeout = setInterval("getStatus()", 30000);

        // Stop updating after 15 minutes
        setTimeout(function() {
            if(statusUpdateTimeout) clearInterval(statusUpdateTimeout);
        }, 900000);
    });

    function getStatus() {
        $('div#content').load('ajax_stream.php').fadeIn("slow");
    }
</script>

I replaced the setTimeout with a setInterval and moved it outside the getStatus function. Also I set a new timeout that will stop the interval after 15 minutes.
Also for future reference, please indent your code properly so that it's readable to others.

A: I think the best solution for you is to set a global variable, that increments each time getStatus() is executed, and set it back to 0 on $('body').mousemove(); (this is the behaviour that Gmail uses to set user status to IDLE on web gmail chat)

A: Here is how to do it:
<script type="text/javascript" src="jquery.min.js"></script>
<script type="text/javascript">
//when the page loads, the user is idle for 0 seconds
var idle=0;
$(function(){
    $(document).ready(function(){
        $.ajaxSetup({cache: false});
    });
    getStatus();
});
function getStatus() {
    idle+=1;
    //if idle for 5 minutes, do nothing
    if (idle==10) return;
    $('div#content').load('ajax_stream.php').fadeIn("slow");
    setTimeout("getStatus()",30000);  // refresh every 30000 milliseconds (30 seconds)
}
//reset the counter whenever an activity is done on the page
$('body').mousemove(function(){
    idle=0;
});
</script>


text:
Q: SSRS DataSource Windows Authentication fails I have a project which uses SharePoint lists as data sources to create the reports. I'm using Visual Studio 2013 for this.
I have this real annoying issue at this moment, ie. when I want to edit a dataset I created a while ago and I press 'Query Designer...' in the dataset properties to see all fields from my list I get an error which says that I am unauthorized.

My DataSource is configured to link to the SharePoint Site Url with Windows Credentials. I have also tried this out for multiple datasets on multiple reports but the error is everywhere.
Because of this I'm also not able to run my reports. They just say "An error occurred during local report processing.".

I have been working on this project since March and this is the first time this has occurred so I have no idea what might have gone wrong nor how to solve it.
Does anyone know what might cause this error and how to solve it please?
If you have any questions or remarks about my question/problem, please, don't hesitate to leave a comment.
Kind regards

EDIT 1:
I have just tried deploying a report that I finished last week and for the first time I got a prompt that asked for my credentials. I haven't even put my credentials anywhere in the project for past authorisation so I have no idea why the project would suddenly need it now...

EDIT 2:
I have just tried changing the DataSource credentials to my own login for the SharePoint Site. If I run the report I get the same error as before but when I go to Query Designer for one of the datasets I get following error:

EDIT 3:
I just restored a back-up I made a couple of weeks ago. I can now run my reports but I still get the Unauthorized error when I try to open a dataset's query designer and the prompt for my credentials when I try to deploy a report.

A: So, the solution has been found!
Apparently something has gone wrong with my PC and I had to reconfigure my user accounts.
To do this go to Control Panel -> User Accounts

Then click on 'Manage User Accounts'. Go to the 'Advanced' tab and click on 'Manage Passwords'

Next, go to 'Windows Credentials' and change the credentials for your site or recreate them.


text:
Q: Is there a way to rerequest permissions to a newly created page without deleting the `manage_pages` permission? I am working on a web application that requests access to the pages managed by a user. It was working perfectly until I found an use case which apparently needs requesting manage_pages permission again.
Imagine the user gives permission to an application to access all of their pages (e.g. "Page 1" and "Page 2"). Now let's suppose they created another page ("Page 3"). What happens is: the application only have access to the first two pages and /me/accounts only returns "Page 1" and "Page 2". When I use the parameter auth_type=rerequest in another request, it does not prompt the permission dialogue since the manage_pages was already given (I reckon).
Is there a way to ask the user to give permission to their pages again without having to revoke permissions? The problem with revoking is that the application would have to delete users previously authorized manage_page on every login, since we would not know when a new page was created.
edit: including image of the page selector dialogue


text:
Q: Get data from internet in Android I want to get content from my internet site and show these content in listview and text view. I used the jsoup library for parsing HTML, but my app is using 25 MB ram which as you know is quite a lot for an app.
How can I improve the ram efficiency of my application?

A: You could display it with a webview, instead of trying to parse it and convert it into a native view.
@Override
    public void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
         //.. Other setup ...
         //Add webview
         WebView myWebView = (WebView) findViewById(R.id.webview);
         myWebView.getSettings().setJavaScriptEnabled(true);
         myWebView.addJavascriptInterface(new JSBridge(), "JSJavaBridge");
         myWebView.loadUrl("http://my.testdomain.com/theSharedPage.html");
    }

Then write methods in JSBridge class to handle any interactions between JS and Java.  For example:
private class JSBridge
{
    public playSound(){
         mp = MediaPlayer.create(Test.this, R.raw.mysound);
         mp.start();
    }
}

Then in HTML, use the JSBridge to play a sound from Java.
   <script type="text/javascript">

            $(document).ready(function () {
                $( '#playSound' ).click(function () {

                    if(typeof JSJavaBridge != 'undefined')
                          JSJavaBridge.playSound();
                });
            });
    </script>


text:
Q: How to extract multiple parts of a string using awk/sed/perl? I search for log files having errors using egrep and it outputs a bunch of files. What I want to do is manipulate those strings and present in a different way.
/abcd/efgh/ijkl/logs/fac_unet_abp99507.log.20220708111219.26476752.0
/abcd/efgh/ijkl/logs/fac_oxf_abp3506.log.20220708111219.26476752.0
/abcd/efgh/ijkl/logs/cirrus_abp4296EI_20220824.log
/abcd/efgh/ijkl/mcr/logs/prof_cmcr_abp4296MR.log.20220824150526.15728964.0

The output should look like:
ABP99507,UNET
ABP3506,OXF
ABP4296EI,CIRRUS
ABP4296MR,CMCR

I tried awk and sed and couldn't figure out a way to do this. I want to be able to make it dynamic and do it via regular expressions.
What I have tried so far is:
egrep -li "^error" /abcd/efgh/ijkl/logs/*202207* | awk '/unet|cirrus|oxf|csp|cmcd|cmcr|nice/ {print}'
egrep -li "^error" /abcd/efgh/ijkl/logs/*202207* | sed -n "s/.*\(cirrus|unet|cmcr|csp|cmcd|oxf|nice\)\(abp[0-9]*[A-ZA-Za-za-z]*\).*/\1,\2/p"

Sed doesn't work as the "|" operator is taken as literal; I am not using GNU version. Even escaping it doesn't work. Also I can't seem to make use of capture groups.

A: 1st solution: Simplest option would be, using awk's field separator option. With your shown samples please try following awk code.
awk -F'/|\\.|_' '{print toupper($8","$7)}' Input_file

2nd solution: In case you want to try with regular expression in awk then try. Written and tested in GNU awk.
awk 'match($0,/logs\/[^_]*_([^_]*)_([^.]*)\.log/,arr){print toupper(arr[2]","arr[1])}'  Input_file

3rd solution: With GNU sed's enabling ERE with -E option please try following code.
sed -E 's/.*logs\/[^_]*_([^_]*)_([^.]*)\.log\..*/\U\2,\U\1/' Input_file

4th solution: Adding a NON-GNU awk solution using match function.
awk '
match($0,/logs\/[^_]*_([^_]*)_([^.]*)\.log/){
  val=substr($0,RSTART+5,RLENGTH-5)
  sub(/\.log/,"",val)
  split(val,arr,"_")
  print toupper(arr[3]","arr[2])
}
'  Input_file

A:
Also I can't seem to make use of capture groups.

You did not escape | so they are meaning literal |, you need to escape it to mean alternative, as is case with ( and ) (literal vs group delimiter). After doing that and repairing minor issues I get it working: let file.txt content be
/abcd/efgh/ijkl/logs/fac_unet_abp99507.log.20220708111219.26476752.0
/abcd/efgh/ijkl/logs/fac_oxf_abp3506.log.20220708111219.26476752.0

then
sed -e 's/.*\(cirrus\|unet\|cmcr\|csp\|cmcd\|oxf\|nice\)_\(abp[0-9]*[A-ZA-Za-za-z]*\).*/\2,\1/' -e 's/[a-z]/\U&/g' file.txt

gives output
ABP99507,UNET
ABP3506,OXF

Explanation: I introduced following changes: escaped |, added _ between groups, change order of replacement (2nd group is first), dropped /p as it caused doubling output. After doing this I added second action: uppercasing using standard GNU sed way of doing so. As there are now 2 actions, I use -e to register them.
(tested in GNU sed 4.2.2)

A: Throw away egprep (which is deprecated in favor of grep -E by the way), and just use awk, e.g. using an awk that supports nextfile such as GNU awk (also already supported in some other awks and soon will be required per POSIX):
awk -v OFS=',' '
    tolower($0) ~ /^error/ {
        split(toupper(FILENAME),a,/[_.]/)
        print a[3], a[2]
        nextfile
    }
' /abcd/efgh/ijkl/logs/*202207*

or using any awk:
awk -v OFS=',' '
    FNR==1 { searching=1 }
    searching && (tolower($0) ~ /^error/) {
        split(toupper(FILENAME),a,/[_.]/)
        print a[3], a[2]
        searching=0
    }
}' /abcd/efgh/ijkl/logs/*202207*

If you really want to implement what you were apparently trying to do with /unet|cirrus|oxf|csp|cmcd|cmcr|nice/ to restrict which files the script examines then change this:
awk -v OFS=',' '
    ...
}' /abcd/efgh/ijkl/logs/*202207*

to this:
shopt -s extglob
awk -v OFS=',' '
    ...
}' /abcd/efgh/ijkl/logs/*@(unet|cirrus|oxf|csp|cmcd|cmcr|nice)*202207*


text:
Q: File I/O Extraction with structures in C The task is to read in a .txt file with a command line argument, within the file there is a list unstructured information listing every airport in the state of Florida note this is only a snippet of the total file. There is some data that must be ignored such as ASO ORL PR A 0 18400 - anything that does not pertain to the structured variables within AirPdata.
The assignment is asking for the site number, locID, fieldname, city, state, latitude, longitude, and if there is a control tower or not.
INPUT

03406.20*H 2FD7 AIR ORLANDO ORLANDO FL ASO ORL PR 28-26-08.0210N 081-28-23.2590W PR NON-NPIAS N A 0 18400
03406.18*H 32FL MEYER- INC ORLANDO FL ASO ORL PR 28-30-05.0120N 081-22-06.2490W PR NON-NPAS N 0 0

OUTPUT
   Site# LocID Airport Name City ST Latitude Longitude Control Tower
------------------------------------------------------------------------
03406.20*H 2FD7 AIR ORLANDO ORLANDO FL 28-26-08.0210N 081-28-23.2590W N
03406.18*H 32FL MEYER       ORLANDO FL 28-30.05.0120N 081-26-39.2560W N
etc..      etc. etc..       etc..   .. etc..          etc..           ..
etc..      etc. etc..       etc..   .. etc..          etc..           ..

my code so far looks like
#include <stdio.h>
#include <stdlib.h>
#include <strings.h>

typedef struct airPdata{
char *siteNumber;
char *locID;
char *fieldName;
char *city;
char *state;
char *latitude;
char *longitude;
char controlTower;
} airPdata;

int main (int argc, char* argv[])
{

char text[1000];
FILE *fp;
char firstwords[200];

if (strcmp(argv[1], "orlando5.txt") == 0)
{

    fp = fopen(argv[1], "r");
    if (fp == NULL)
    {
        perror("Error opening the file");
        return(-1);
    }

    while (fgets(text, sizeof(text), fp) != NULL)
    {
        printf("%s", text);
    }
}
else
    printf("File name is incorrect");

fflush(stdout);
fclose(fp);

}

So far i'm able to read the whole file, then output the unstructured input onto the command line.
The next thing I tried to figure out is to extract piece by piece the strings and store them into the variables within the structure. Currently i'm stuck at this phase. I've looked up information on strcpy, and other string library functions, data extraction methods, ETL, I'm just not sure what function to use properly within my code.
I've done something very similar to this in java using substrings, and if there is a way to take a substring of the massive string of text, and set parameters on what substrings are held in what variable, that would potentially work. such as... LocID is never more than 4 characters long, so anything with a numerical/letter combination that is four letters long can be stored into airPdata.LocID for example.
After the variables are stored within the structures, I know I have to use strtok to organize them within the list under site#, locID...etc.. however, that's my best guess to approach this problem, i'm pretty lost.

A: I don't know what the format is. It can't be space-separated, some of the fields have spaces in them. It doesn't look fixed-width. Because you mentioned strtok I'm going to assume its tab-separated.
You can use strsep use that. strtok has a lot of problems that strsep solves, but strsep isn't standard C. I'm going to assume this is some assignment requiring standard C, so I'll begrudgingly use strtok.
The basic thing to do is to read each line, and then split it into columns with strtok or strsep.
char line[1024];
while (fgets(line, sizeof(line), fp) != NULL) {
    char *column;
    int col_num = 0;
    for( column = strtok(line, "\t");
         column;
         column = strtok(NULL, "\t") )
    {
        col_num++;

        printf("%d: %s\n", col_num, column);
    }
}
fclose(fp);

strtok is funny. It keeps its own internal state of where it is in the string. The first time you call it, you pass it the string you're looking at. To get the rest of the fields, you call it with NULL and it will keep reading through that string. So that's why there's that funny for loop that looks like its repeating itself.
Global state is dangerous and very error prone. strsep and strtok_r fix this. If you're being told to use strtok, find a better resource to learn from.
Now that we have each column and its position, we can do what we like with it. I'm going to use a switch to choose only the columns we want.
    for( column = strtok(line, "\t");
         column;
         column = strtok(NULL, "\t") )
    {
        col_num++;

        switch( col_num ) {
            case 1:
            case 2:
            case 3:
            case 4:
            case 5:
            case 9:
            case 10:
            case 13:
                printf("%s\t", column);
                break;
            default:
                break;
        }
    }

    puts("");

You can do whatever you like with the columns at this point. You can print them immediately, or put them in a list, or a structure.
Just remember that column is pointing to memory in line and line will be overwritten. If you want to store column, you'll have to copy it first. You can do that with strdup but *sigh* that isn't standard C. strcpy is really easy to use wrong. If you're stuck with standard C, write your own strdup.
char *mystrdup( const char *src ) {
    char *dst = malloc( (sizeof(src) * sizeof(char)) + 1 );
    strcpy( dst, src );
    return dst;
}


text:
Q: Replace 'Attribute' with custom field (post-meta) value in a script that is working ( Woocommerce ) This should be fairly straight forward but I keep getting "Internal Server Error" when trying to swap the custom field value with the attribute value.
Below I have 2 workings functions...

*

*The first is a function that adds a custom field into a variable product (and displays its value/info on the front-end).

*The second subtracts an amount from the overall stock of a Variable Product using the numeric value of an attribute.
**
I would like to use the numeric value from my custom field rather than that of the attribute.
**
// -----------------------------------------
// 1. Add custom field input @ Product Data > Variations > Single Variation

add_action( 'woocommerce_variation_options_pricing', 'bbloomer_add_custom_field_to_variations', 10, 3 );

function bbloomer_add_custom_field_to_variations( $loop, $variation_data, $variation ) {
woocommerce_wp_text_input( array(
'id' => 'custom_field[' . $loop . ']',
'class' => 'short',
'label' => __( 'Amount of Product', 'woocommerce' ),
'value' => get_post_meta( $variation->ID, 'custom_field', true )
)
);
}

// -----------------------------------------
// 2. Save custom field on product variation save

add_action( 'woocommerce_save_product_variation', 'bbloomer_save_custom_field_variations', 10, 2 );

function bbloomer_save_custom_field_variations( $variation_id, $i ) {
$custom_field = $_POST['custom_field'][$i];
if ( isset( $custom_field ) ) update_post_meta( $variation_id, 'custom_field', esc_attr( $custom_field ) );
}

// -----------------------------------------
// 3. Store custom field value into variation data

add_filter( 'woocommerce_available_variation', 'bbloomer_add_custom_field_variation_data' );

function bbloomer_add_custom_field_variation_data( $variations ) {
$variations['custom_field'] = '
Amount: ' . get_post_meta( $variations[ 'variation_id' ], 'custom_field', true ) . '
';
return $variations;
}

BELOW IS THE SCRIPT TO DEDUCT THE AMOUNTS BASED ON THE ATTRIBUTE
// reduce stock based on 'pa_weight' attribute
add_filter( 'woocommerce_order_item_quantity', 'filter_order_item_quantity', 10, 3 );
function filter_order_item_quantity( $quantity, $order, $item )
{
    $product   = $item->get_product();
    $term_name = $product->get_attribute('pa_weight');

    // 'pa_weight' attribute value is "15 grams" - keep only the numbers
    $quantity_grams = preg_replace('/[^0-9.]+/', '', $term_name);

    // new quantity
    if( is_numeric ( $quantity_grams ) && $quantity_grams != 0 )
        $quantity *= $quantity_grams;

    return $quantity;
}

// check out of stock using 'pa_weight' attribute
add_filter( 'woocommerce_add_to_cart_validation', 'woocommerce_validate_attribute_weight' );
function woocommerce_validate_attribute_weight()
{
    // get product id
    if (isset($_REQUEST["add-to-cart"])) {
        $productid = (int)$_REQUEST["add-to-cart"];
    } else {
        $productid = null;
    }

    // get quantity
    if (isset($_REQUEST["quantity"])) {
        $quantity = (int)$_REQUEST["quantity"];
    } else {
        $quantity = 1;
    }

    // get weight of selected attribute
    if (isset($_REQUEST["attribute_pa_weight"])) {
        $weight = preg_replace('/[^0-9.]+/', '', $_REQUEST["attribute_pa_weight"]);
    } else {
        $weight = null;
    }

    // comparing stock
    if($productid && $weight)
    {
        $product = wc_get_product($productid);
        $productstock = (int)$product->get_stock_quantity();

        if(($weight * $quantity) > $productstock)
        {
            wc_add_notice( sprintf( 'You cannot add that amount of "%1$s" to the cart because there is not enough stock (%2$s remaining).', $product->get_title(), $productstock ), 'error' );
            return;
        }
    }

    return true;
}

I have tried replacing :
$term_name = $product->get_attribute('pa_weight');

With :
$term_name = $product->get_post_meta('custom_field');

This hasn't worked... Not sure where the issue is.


text:
Q: Jetty: ERROR [org.springframework.web.context.ContextLoader:215] - Context initialization failed I installed and configured Jetty 7 correcty for IdP Shibboleth following this guide: https://wiki.shibboleth.net/confluence/display/SHIB2/IdPJetty7Prepare
But when i start Jetty by running this command:
java -jar start.jar jetty.port=26335

I get this following error:
12:16:51.494 - ERROR [org.springframework.web.context.ContextLoader:215] - Context initialization failed
org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from URL [file:/home/fuiba/opt/shibboleth-idp//conf/internal.xml]; nested exception is java.lang.NoClassDefFoundError: org/w3c/dom/ElementTraversal
        at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:420) ~[spring-beans-2.5.6.SEC03.jar:2.5.6.SEC03]
        at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:342) ~[spring-beans-2.5.6.SEC03.jar:2.5.6.SEC03]
        at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:310) ~[spring-beans-2.5.6.SEC03.jar:2.5.6.SEC03]
        at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:143) ~[spring-beans-2.5.6.SEC03.jar:2.5.6.SEC03]
        at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:178) ~[spring-beans-2.5.6.SEC03.jar:2.5.6.SEC03]
        at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:149) ~[spring-beans-2.5.6.SEC03.jar:2.5.6.SEC03]
        at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:124) ~[spring-web-2.5.6.SEC03.jar:2.5.6.SEC03]
        at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:92) ~[spring-web-2.5.6.SEC03.jar:2.5.6.SEC03]
        at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:123) ~[spring-context-2.5.6.SEC03.jar:2.5.6.SEC03]
        at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:422) ~[spring-context-2.5.6.SEC03.jar:2.5.6.SEC03]
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:352) ~[spring-context-2.5.6.SEC03.jar:2.5.6.SEC03]
        at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:255) ~[spring-web-2.5.6.SEC03.jar:2.5.6.SEC03]
        at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:199) ~[spring-web-2.5.6.SEC03.jar:2.5.6.SEC03]
        at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:45) [spring-web-2.5.6.SEC03.jar:2.5.6.SEC03]
        at org.eclipse.jetty.server.handler.ContextHandler.startContext(ContextHandler.java:746) [jetty-server-7.6.11.v20130520.jar:7.6.11.v20130520]
        at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:238) [jetty-servlet-7.6.11.v20130520.jar:7.6.11.v20130520]
        at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1240) [jetty-webapp-7.6.11.v20130520.jar:7.6.11.v20130520]
        at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:689) [jetty-server-7.6.11.v20130520.jar:7.6.11.v20130520]
        at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:482) [jetty-webapp-7.6.11.v20130520.jar:7.6.11.v20130520]
        at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64) [jetty-util-7.6.11.v20130520.jar:7.6.11.v20130520]
        at org.eclipse.jetty.deploy.bindings.StandardStarter.processBinding(StandardStarter.java:39) [jetty-deploy-7.6.11.v20130520.jar:7.6.11.v20130520]
        at org.eclipse.jetty.deploy.AppLifeCycle.runBindings(AppLifeCycle.java:186) [jetty-deploy-7.6.11.v20130520.jar:7.6.11.v20130520]
        at org.eclipse.jetty.deploy.DeploymentManager.requestAppGoal(DeploymentManager.java:494) [jetty-deploy-7.6.11.v20130520.jar:7.6.11.v20130520]
        at org.eclipse.jetty.deploy.DeploymentManager.addApp(DeploymentManager.java:141) [jetty-deploy-7.6.11.v20130520.jar:7.6.11.v20130520]
        at org.eclipse.jetty.deploy.providers.ScanningAppProvider.fileAdded(ScanningAppProvider.java:145) [jetty-deploy-7.6.11.v20130520.jar:7.6.11.v20130520]
        at org.eclipse.jetty.deploy.providers.ScanningAppProvider$1.fileAdded(ScanningAppProvider.java:56) [jetty-deploy-7.6.11.v20130520.jar:7.6.11.v20130520]
        at org.eclipse.jetty.util.Scanner.reportAddition(Scanner.java:615) [jetty-util-7.6.11.v20130520.jar:7.6.11.v20130520]
        at org.eclipse.jetty.util.Scanner.reportDifferences(Scanner.java:540) [jetty-util-7.6.11.v20130520.jar:7.6.11.v20130520]
        at org.eclipse.jetty.util.Scanner.scan(Scanner.java:403) [jetty-util-7.6.11.v20130520.jar:7.6.11.v20130520]
        at org.eclipse.jetty.util.Scanner.doStart(Scanner.java:337) [jetty-util-7.6.11.v20130520.jar:7.6.11.v20130520]
        at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64) [jetty-util-7.6.11.v20130520.jar:7.6.11.v20130520]
        at org.eclipse.jetty.deploy.providers.ScanningAppProvider.doStart(ScanningAppProvider.java:121) [jetty-deploy-7.6.11.v20130520.jar:7.6.11.v20130520]
        at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64) [jetty-util-7.6.11.v20130520.jar:7.6.11.v20130520]
        at org.eclipse.jetty.deploy.DeploymentManager.startAppProvider(DeploymentManager.java:555) [jetty-deploy-7.6.11.v20130520.jar:7.6.11.v20130520]
        at org.eclipse.jetty.deploy.DeploymentManager.doStart(DeploymentManager.java:230) [jetty-deploy-7.6.11.v20130520.jar:7.6.11.v20130520]
        at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64) [jetty-util-7.6.11.v20130520.jar:7.6.11.v20130520]
        at org.eclipse.jetty.util.component.AggregateLifeCycle.doStart(AggregateLifeCycle.java:81) [jetty-util-7.6.11.v20130520.jar:7.6.11.v20130520]
        at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:58) [jetty-server-7.6.11.v20130520.jar:7.6.11.v20130520]
        at org.eclipse.jetty.server.handler.HandlerWrapper.doStart(HandlerWrapper.java:96) [jetty-server-7.6.11.v20130520.jar:7.6.11.v20130520]
        at org.eclipse.jetty.server.Server.doStart(Server.java:281) [jetty-server-7.6.11.v20130520.jar:7.6.11.v20130520]
        at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64) [jetty-util-7.6.11.v20130520.jar:7.6.11.v20130520]
        at org.eclipse.jetty.xml.XmlConfiguration$1.run(XmlConfiguration.java:1259) [jetty-xml-7.6.11.v20130520.jar:7.6.11.v20130520]
        at java.security.AccessController.doPrivileged(Native Method) [na:1.6.0_24]
        at org.eclipse.jetty.xml.XmlConfiguration.main(XmlConfiguration.java:1182) [jetty-xml-7.6.11.v20130520.jar:7.6.11.v20130520]
Caused by: java.lang.NoClassDefFoundError: org/w3c/dom/ElementTraversal
        at org.apache.xerces.dom.DeferredDocumentImpl.getNodeObject(Unknown Source) ~[na:na]
        at org.apache.xerces.dom.DeferredDocumentImpl.synchronizeChildren(Unknown Source) ~[na:na]
        at org.apache.xerces.dom.ParentNode.getLastChild(Unknown Source) ~[na:na]
        at org.apache.xerces.dom.DeferredDocumentImpl.synchronizeData(Unknown Source) ~[na:na]
        at org.apache.xerces.dom.DeferredDocumentImpl.synchronizeChildren(Unknown Source) ~[na:na]
        at org.apache.xerces.dom.CoreDocumentImpl.getDocumentElement(Unknown Source) ~[na:na]
        at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.registerBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:87) ~[spring-beans-2.5.6.SEC03.jar:2.5.6.SEC03]
        at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.registerBeanDefinitions(XmlBeanDefinitionReader.java:507) ~[spring-beans-2.5.6.SEC03.jar:2.5.6.SEC03]
        at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:398) ~[spring-beans-2.5.6.SEC03.jar:2.5.6.SEC03]
        ... 43 common frames omitted

Where i did wrong?
How can i include ElementTraversal?
Thank you for any help!
Best regards.

A: Is there a double slash? in this path you used -
/home/fuiba/opt/shibboleth-idp*//*conf/internal.xml


text:
Q: AJAX PHP multiple responses I have an ajax question for you all.
I want to return an array from an ajax call in php and then get the values from that array that I return for use with a jquery ajax call, but I don't know how to do this. Can anyone point me in the right direction for a tutorial?
I know there's a bunch of different encoding types for ajax responses (json and xml come to mind) but I don't know really what there use is. Right now all I do is echo what I have as a response to get some things displayed on my page, but I want to change my current implementation to use an array as the response rather than just simple text. Though I don't know where to start in looking at tutorials on how to do this.
Also, what is the point of using the encoding types if I can just echo my text out and get what I want? I guess I really don't see the point of the json type or xml if I can just echo for display.

A: Well, to start off encoding types are there specifically to solve a problem such as the one you posed.  They are there to organize multiple bits of information in a response, so you can return an array, or list, or multiple rows from a database, etc.
Json is my personal favorite, because of how light it is on syntax.  To pass the array from the PHP to javascript with AJAX, you'd first encode your array to json (basically taking the PHP array object, and making a text representation of it).  You can do this using PHP's json_encode() function (PHP.NET reference).
Next you'll need to fetch that somehow, I will recommend Jquery here, because of their built in functions.  Using Jquery, you would type something like:
$.ajax({
  url: "ajax.php",
  data: {"somedata":"somedata"},
  success: function (data)
  {
    alert(data);
  },
  dataType: "json" /*now jquery will parse the json for you*/
});

In this code the anonymous function in the success will be called when the Ajax has returned information.  Because Jquery is great, it'll already have parsed the json, and put it in the object data.  Now each array item you passed from your php will be accessible via data.[ArrayKey].
Also, you had asked for a tutorial, here is one that seems to be pretty good: http://www.jquery4u.com/json/ajaxjquery-getjson-simple/#.T8PGz9VYua8
Hope that helps explain it a little better, I can give you an example if you like.

A: If you're returning arrays, I think JSON is the best way to go.
Its actually really easy to do.
PHP:
$array=array();//this is my array

$array=json_encode($array);//encode the array to JSON format, so that jQuery can decode it.

echo $array;//print it on screen

Now use some jQuery:
$.getJSON('http://mysite.com/myphpscript.php', function(my_data){

//now, my_data is your array..

//so access it like this:

alert(my_data.keyname);//"keyname" is an array key of your array

});//end of ajax request

The point of encoding your array is so that jQuery can pick it up as an array (with the help of JSON), and not just standard text.


text:
Q: Can I create a data frame that has data frame as its elements? (Pyspark using sqlContext) I have 15k small files. After processing, each file generates three Data frames object: v, vT and e. I want to store all this three data frames of all 15k files into one data frame object(Let's call it combo) and write to disk so that next time I just read it once rather than 15k times. Besides, I can also convert this combo to RDD and apply map function to 15k records at once. This would make full use of the CPU.
But currently my implementation is I write v, vT and e into one folder(per file per folder. In total, 15k folders). In each folder, there are three folders for v, vT and e separately. Now I have to read each 15k times for all the files (technically I need to read 15k * 3 = 45k times). When I apply certain algorithms on those files, I simply use a for loop to apply algorithms on them one by one. Not very smart I know
So I came up with an idea which is to store v, vT and e of the 15k files into a list called combo and then create a single data frame, combo_df. By convert combo_df to RDD, I can use map function to apply a user-defined function on all 15k at a time.
The code is as follows, for each file:
v = sqlContext.createDataFrame(uri,
                                ['id', 'URI', 'flag'])
vT = sqlContext.createDataFrame(vertex,
                               ['id', 'URI_ID_FK', 'Vertex_Type_URI_ID_FK'])
e = sqlContext.createDataFrame(edge,
                                ['src', 'dst', 'Relation_Type_URI_ID_FK'])

uri, vertex and edge are three lists object extracted from each file.
Store all v, vT and e of the 15k files into a single list combo
combo = [[v1, vT2, e3],...,[vN, vTN, eN]] (pseudo-code)

I want to create a data frame(combo_df) using combo
combo_df = sqlContext.createDataFrame(combo, ['v', 'vT', 'e'])

At this point, I got an error:

AssertionError: dataType should be DataType

I don't know how to solve this problem.

A:
Can I create a data frame that has data frame as its elements?

You cannot. Just write each DataFrame separately.

A: It looks to me like you want to keep the three dataframes separate because of their structure. Instead of creating three distinct dataframes from reading each file you should consider keeping only one and reorganizing the columns into structType() for nested dataframes. You'll end up with a schema like this:

    root
     |-- v: struct (nullable = false)
     |    |-- id: string (nullable = true)
     |    |-- URI: string (nullable = true)
     |    |-- flag: string (nullable = true)
     |-- vT: struct (nullable = false)
     |    |-- id: string (nullable = true)
     |    |-- URI_ID_FK: string (nullable = true)
     |    |-- Vertex_Type_URI_ID_FK: string (nullable = true)
     |-- e: struct (nullable = false)
     |    |-- src: string (nullable = true)
     |    |-- dst: string (nullable = true)
     |    |-- Relation_Type_URI_ID_FK: string (nullable = true)

The function for it is
from pyspark.sql.functions import struct


text:
Q: How to Draw xsd in Tikz How can I draw with xsd in TikZ?

A: Second attempt. You need to add some styles to simplify the code. A good way is to create new shapes but it's a long work. Here I saved some pictures with savedbox then you can reuse them inside new nodes but you need to take some precautions like inner xsep=0.
A problem is to get the same height inside rectangle spli part. here i used \mystrutbut perhaps there is a batter method to do this.
\documentclass[11pt,landscape]{scrartcl}
\usepackage{tikz}
\usetikzlibrary{shapes.multipart}

\def\vstrut{\vrule height 0.75ex depth 0.75ex width 0pt}
 \def\hstrut{\vrule height 0ex depth 0ex width 3mm}
\begin{document}
\newsavebox{\figone}
\savebox{\figone}{%
\begin{tikzpicture}
\fill (-2mm,-1mm) rectangle  (2mm,1mm);
\fill[yshift=3mm] (-2mm,-1mm) rectangle  (2mm,1mm);
\fill[yshift=-3mm ] (-2mm,-1mm) rectangle  (2mm,1mm);
\draw[thick] (-6mm,0) -- (-2mm,0)  (6mm,0) -- (2mm,0) ;
\draw[thick]  (-2mm,-3mm) -- ++(-2mm,0) -- ++(0mm,6mm)--++(2mm,0);
\draw[thick]  (2mm,-3mm) -- ++(2mm,0) -- ++(0mm,6mm)--++(-2mm,0);
\end{tikzpicture}%
}%

\newsavebox{\figtwo}
\savebox{\figtwo}{%
\begin{tikzpicture}
\draw (0mm,-3mm)--++(0,6mm)--++(3mm,3mm)--++(15mm,0)--++(3mm,-3mm)--++(0,-6mm)--++(-3mm,-3mm)--++(-15mm,0)--cycle;
\end{tikzpicture}%
}

\newsavebox{\tiret}
\savebox{\tiret}{%
\begin{tikzpicture}
\draw[thick] (-2mm,0mm)--++(4mm,0);
\end{tikzpicture}%
}%

\newsavebox{\connect}
\savebox{\connect}{%
\begin{tikzpicture}
  \node{\usebox\figone};
  \node[inner sep=0pt] (ft){\usebox\figtwo};
  \node[draw,minimum size=6mm,anchor=center,inner sep=0pt,fill=white,inner xsep=0](m) at (ft.east){};
  \node[inner sep=0pt] at (m) {\usebox\tiret};
\end{tikzpicture}%
}
\tikzset{split style/.style={rectangle split, rectangle split parts=2, draw,rectangle split part align={left}}}

 \tikzset{square/.style={draw,minimum size=6mm,anchor=center,inner xsep=0pt,fill=white}}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{tikzpicture}[font=\small,scale=.75,transform shape]
 \node[split style] (r1)
    {\vstrut\textbf{Root}\hstrut
    \nodepart{two} \vstrut type = Well\hstrut};
 \node[square] (b1) at (r1.east) {\usebox\tiret};
 \node[inner sep=0,anchor=west] (c1) at ([xshift=.5cm]b1.east){\usebox\connect};

 \node[split style,anchor=west] (r2) at ([xshift=0.5cm]c1.east)
    {\vstrut\textbf{BasicInfo}  1.1\hstrut
     \nodepart{two}
     \vstrut   type = Complex Type\hstrut};
  \node[square] (b2) at (r2.east) {\usebox\tiret};
  \node[inner sep=0,anchor=west] (c2) at ([xshift=0.5cm]b2.east){\usebox\connect};
  \draw (b1)-- (c1) (c1)-- (r2) (b2) --(c2);
\end{tikzpicture}

\end{document}


text:
Q: Pyspark Python Find a symbol and append next row I struggling with dataset obtained from host server in .ipt format converted to .csv.
Dataset comes with NO HEADERS.
Dataset with no headers
All I have to do it to search for \ if found then replace & append next row.
Please, can you help me on how to resolve it?
It will look like this in final stage.
Final Desirable Output