text:
Q: AJAX virtual pageviews not registered in Analytics (Global Site Tag and Barba.js) I'm working on fixing the bounce rate of a website built using Barba.js for AJAX navigation. I've read multiple articles including Analytics' documentation regarding virtual pageviews and SPA's and cannot figure out why my pageviews are not registering.
When I access a page using the address bar or refreshing it, I pop up in Analytics live view, but not when navigating to another page using internal links (with Barba handling the page load).
Here's what I'm using to get the page path and send my pageview:

$(document).ready(function() {
  // other stuff
  init_on_each_new_page();
});

function init_on_each_new_page() {
  // other stuff
  init_analytics();
}

function init_analytics() {
  // Grab the page URL, split at ".com"
  var $full_path = $(location).attr("href");
  var $path_split = $full_path.split(".com");
  var $ga_page_path;

  /* If there's something after .com and it's not just a slash,
  make that the path sent to Analytics */
  if ($path_split[1] && $path_split[1] != "/") {
    var $path = $path_split[1];
    var $last_char = $path[$path.length - 1];
    if ($last_char == "/") {
      $ga_page_path = $path_split[1].slice(0, -1);
    } else {
      $ga_page_path = $path_split[1];
    }
  }
  /* If there's nothing after .com, we're on the homepage so the
  path visited for Analytics is "/" */
  else {
    $ga_page_path = "/";
  }

  // Set GA page
  ga('set', 'page', $ga_page_path);
  // Send pageview
  ga('send', {
    'hitType': 'pageview',
    'hitCallback': function() {
      console.log('--> hit sent <--');
    }
  });
}

I added the hitCallback like documented here to try and get a confirmation that the pageview was sent but nothing ever shows up in the console.
I can confirm that GA is correctly set up since "hard" pageviews are showing up.
I have seen a couple of threads regarding virtual pageviews on AJAX pages but all with previous versions of Analytics. I haven't found anything working with the new Global Site Tag. Did I miss something?

A: You need to include a path for your pageview, like so:
ga('send', 'pageview', location.pathname);

See: https://developers.google.com/analytics/devguides/collection/analyticsjs/pages

A: It would have been obvious to some if I had posted my tracking code first but I figured out my mistake: I was using ga functions but with a gtag tracking code. I never thought twice about it because the tracking code was inserted a while before I started fixed the virtual page views and all my googling was bringing me to Analytics.js documentation.
See here for migrating from Analytics.js to gtag.js and here specifically for single page application tracking with gtag.js.


text:
Q: Defining buttons in XAML for usercontrol I am wanting to write a user control that contains a customizable CommandBar. There are standard items which are always present in the command bar, and the page hosting the user control can define additional items.
I have tried to implement it like this:
User control
        private ICommandBarElement[] _toolbarItems;

        public ICommandBarElement[] ToolbarItems
        {
            get => _toolbarItems;
            set
            {
                _toolbarItems = value;
                if (_toolbarItems.Length == 0)
                    removeToolbarItems();
                else
                    addToolbarItems();
            }
        }

Hosting page
        <local:HostControl x:Name="ctl">
            <local:HostControl.ToolbarItems>
                <AppBarButton Icon="Save" Content="Save" />
                <AppBarButton Icon="SaveLocal" Content="Save" />
                <AppBarButton Icon="AddFriend" Content="Friend" />
            </local:HostControl.ToolbarItems>
        </local:HostControl>

When I compile the application, compilation fails so I can't even debug. The error I get is
Xaml Internal Error error WMC9999: Object reference not set to an instance of an object.
There is no line reference, but removing the <local:HostControl.ToolbarItems> node will cause it to compile, so the error must be how I'm defining the property in the user control.
How do I do it so I am able to define elements for the CommandBar inside of the host page xaml?

A: You should create a DependencyProperty.
HostControl.xaml.cs
public sealed partial class HostControl : UserControl
{
    public HostControl()
    {
        this.InitializeComponent();
        this.Loaded += HostControl_Loaded;
    }

    private void HostControl_Loaded(object sender, RoutedEventArgs e)
    {
        this.CommandBar.PrimaryCommands.Clear();

        foreach (var item in ToolbarItems)
        {
            this.CommandBar.PrimaryCommands.Add(item);
        }
    }

    public IList<ICommandBarElement> ToolbarItems
    {
        get { return (IList<ICommandBarElement>)GetValue(ToolbarItemsProperty); }
        set { SetValue(ToolbarItemsProperty, value); }
    }

    public static readonly DependencyProperty ToolbarItemsProperty = DependencyProperty.Register(
        nameof(ToolbarItems),
        typeof(IList<ICommandBarElement>),
        typeof(HostControl),
        new PropertyMetadata(new List<ICommandBarElement>());
}

redpajama_set_name: RedPajamaStackExchange


text:
Q: I want to create a View (cshtml file), which works similar to excel In Excel we have different sheets, when we select a sheet a different data is loaded, i want something like that in my cshtml View, please see the below image for reference .
Any suggestions how to achieve this using html css javascipt in my MVC project .


text:
Q: What is the number behind tethering Wi-Fi name on Windows and how to reset it? I often use my Android phone data to access the internet on a PC running Windows 10 by tethering. And I noticed the Wi-Fi has a number behind its name. The number keeps going up every time I turn on the portable hotspot and connect my PC to it.
What is that number and how to reset it back to 0 or 1?


text:
Q: Unity, Quaternion.Euler, rotate only around Y axis I have my main camera in the scene:

And I have this code that smoothly rotates the camera:
private IEnumerator SmoothlyRotateCamera()
{
    float duration = 0.3f;
    Quaternion from = transform.rotation;
    Quaternion to = from * Vector3.up * 180f;

    float elapsed = 0.0f;

    while (elapsed < duration)
    {
        transform.rotation = Quaternion.Slerp(from, to, elapsed / duration);
        elapsed += Time.deltaTime;
        yield return null;
    }

    transform.rotation = to;

    isRotating = false;

    yield return null;
}

Currently, my camera's rotation is [30, -60, 0] and I want it to rotate around Y axis by 180 degrees.
In theory, to achieve that I need to rotate it for Vector3.up * 180f, everything sound fine, except the fact, when I rotate it that way, it also rotates all other axes as well.
If I rotate it by new Vector3(180f, 0f, 0f) - only X axis will be affected.
If I rotate it by new Vector3(0f, 0f, 180f) - only Z axis will be affected.
And if I rotate it by new Vector3(0f, 180f, 0f) - all of the axis will rotate as well.
I've checked the rotation by setting my X rotation to 0, so now my camera's rotation is [0, -60, 0] and if I rotate it the way it intended to be, by Vector3.up * 180f, then everything works fine! BUT, I need my camera's X to stay in the place. E.g., rotation in the Editor itself only by Y gives me the result that I want.
What should I do? How do I rotate it by 180 degrees by Y axis only?
P.S. I know about transform.Rotate but in my case I need to rotate it using the way that I have described here.
Thanks!

A: Rather use transform.Rotate
private IEnumerator SmoothlyRotateCamera()
{
    var duration = 0.3f;

    // in angles per second
    var rotationSpeed = 180f / duration;

    float rotated = 0;

    do
    {
        var angle = Mathf.Min(180.0f - rotated, rotationSpeed * Time.deltaTime);
        var rotation = Vector3.up * angle;

        rotated += angle;

        // depends which Y axis you want to rotate around here
        // pass Space.World to rotate around the global Y axis instead of the local one
        // if left out it rotates around its transform.up vector instead
        transform.Rotate(rotation, Space.World);

        yield return null;
    } while (rotated < 180f);

    isRotating = false;

    // your last yield return is redundant
}

I added the Mathf.Min to make sure there is no overshooting. As you can see it lands exactly on 180° and is smooth in time (you don't need necessarily Lerp for that only use Time.deltaTime).
In order to show the effect I only changed the duration to 3 instead of 0.3 (which is to fast to notice it).
Rotating around global Y using transform.Rotate(rotation, Space.World);

Rotating around local Y using transform.Rotate(rotation);

A: You can try with Euler Angles.
transform.eulerAngles = new Vector3(transform.eulerAngles.x, transform.eulerAngles.y + 180, transform.eulerAngles.);

Your code will become:
private IEnumerator SmoothlyRotateCamera()
{
    float duration = 0.3f;
    Vector3 from = transform.eulerAngles;
    Vector3 to = new Vector3(transform.eulerAngles.x, transform.eulerAngles.y +180, transform.eulerAngles.z);

    float elapsed = 0.0f;

    while (elapsed < duration)
    {
        transform.eulerAngles =  Vector3.Slerp(from, to, elapsed / duration);
        elapsed += Time.deltaTime;
        yield return null;
    }

    transform.eulerAngles = to;

    isRotating = false;

    yield return null;
}


text:
Q: How to check which version of Java, Maven, Gradle How to check which version of Java, Maven, Gradle, NodeJs installed on your machine and how to set environment variables for all these building tools or JDK ?

A: Goto your CMD (for Windows) or shell terminal (for linux / ubuntu)
To check which Java version and compiler version installed:
C:\>java -version
java version "1.7.0_71"
Java(TM) SE Runtime Environment (build 1.7.0_71-b14)
Java HotSpot(TM) 64-Bit Server VM (build 24.71-b01, mixed mode)

Here you can check compiler version
C:\>javac -version
    javac 1.7.0_71

To check which version of Maven installed: Use(mvn -v or mvn version)
C:\>mvn -v
Apache Maven 3.2.5 (12a6b3acb947671f09b81f49094c53f426d8cea1; 2014-12-14T22:59:23+05:30)
Maven home: C:\apache-maven-3.2.5
Java version: 1.7.0_71, vendor: Oracle Corporation
Java home: C:\Program Files\Java\jdk1.7.0_71\jre
Default locale: en_US, platform encoding: Cp1252
OS name: "windows 7", version: "6.1", arch: "amd64", family: "windows"

To check which version of Gradle installed:
C:\>gradle -version

    ------------------------------------------------------------
    Gradle 2.2.1
    ------------------------------------------------------------

    Build time:   2014-11-24 09:45:35 UTC
    Build number: none
    Revision:     6fcb59c06f43a4e6b1bcb401f7686a8601a1fb4a

    Groovy:       2.3.6
    Ant:          Apache Ant(TM) version 1.9.3 compiled on December 23 2013
    JVM:          1.7.0_71 (Oracle Corporation 24.71-b01)
    OS:           Windows 7 6.1 amd64

To check which version of node installed:
C:\>node -v

v0.12.0

Setting environment variables for
1) JAVA
Windows: Set the environment variable JAVA_HOME to C:\Program Files\Java\jdk1.6.0_21

Linux: export JAVA_HOME=/usr/local/java-current

2) Maven
(extract distribution here (You can extract any where you want)
Windows:  C:\Program Files\Apache Software Foundation\apache-maven-3.2.1
Linux: /usr/local/apache-maven

Windows:-
M2_HOME=C:\Program Files\Apache Software Foundation\apache-maven-2.2.1
M2=%M2_HOME%\bin
MAVEN_OPTS=-Xms256m -Xmx512m

Linux:
Open command terminal and set environment variables.
export M2_HOME=/usr/local/apache-maven/apache-maven-2.2.1
export M2=$M2_HOME/bin
export MAVEN_OPTS=-Xms256m -Xmx512m

3)


text:
Q: PHP insert mysql array from paypal response I'm trying to get transaction details of a PayPal account, which I was successfully in doing so, but I get this long (what i assume is an array) and I need to insert the details into a MySQL database. I've tried several foreach methods but apparently I am doing something wrong.
This is the reponse from PayPal after successful request (stored as $httpParsedResponse)
TransactionSearch Completed Successfully: Array (
    [L_TIMESTAMP0] => 2012%2d08%2d14T18%3a46%3a00Z
    [L_TIMESTAMP1] => 2012%2d08%2d14T18%3a45%3a32Z
    [L_TIMESTAMP2] => 2012%2d08%2d13T01%3a45%3a48Z
    [L_TIMESTAMP3] => 2012%2d08%2d13T01%3a34%3a12Z
    [L_TIMEZONE0] => GMT
    [L_TIMEZONE1] => GMT
    [L_TIMEZONE2] => GMT
    [L_TIMEZONE3] => GMT
    [L_TYPE0] => Payment
    [L_TYPE1] => Payment
    [L_TYPE2] => Payment
    [L_TYPE3] => Transfer
    [L_EMAIL0] => pmd_1333866_per%40yahoo%2ecom
    [L_EMAIL1] => pmd_1333866_per%40yahoo%2ecom
    [L_EMAIL2] => pmd_1333866_per%40yahoo%2ecom
    [L_NAME0] => Joshua%20O
    [L_NAME1] => Joshua%20O
    [L_NAME2] => Joshua%20O
    [L_NAME3] => PayPal
    [L_TRANSACTIONID0] => 58289472YK615973G
    [L_TRANSACTIONID1] => 4U113116FL1819900
    [L_TRANSACTIONID2] => 2X978155KR373471P
    [L_TRANSACTIONID3] => 3TH38971MF599302V
    [L_STATUS0] => Completed
    [L_STATUS1] => Completed
    [L_STATUS2] => Completed
    [L_STATUS3] => Completed
    [L_AMT0] => %2d100%2e00
    [L_AMT1] => %2d50%2e00
    [L_AMT2] => %2d200%2e00
    [L_AMT3] => 2000%2e00
    [L_CURRENCYCODE0] => USD
    [L_CURRENCYCODE1] => USD
    [L_CURRENCYCODE2] => USD
    [L_CURRENCYCODE3] => USD
    [L_FEEAMT0] => 0%2e00
    [L_FEEAMT1] => 0%2e00
    [L_FEEAMT2] => 0%2e00
    [L_FEEAMT3] => 0%2e00
    [L_NETAMT0] => %2d100%2e00
    [L_NETAMT1] => %2d50%2e00
    [L_NETAMT2] => %2d200%2e00
    [L_NETAMT3] => 2000%2e00
    [TIMESTAMP] => 2012%2d08%2d25T17%3a59%3a01Z
    [CORRELATIONID] => bf5b1a824d937
    [ACK] => Success
    [VERSION] => 51%2e0
    [BUILD] => 3435050
)

Obviously enough I guess the array is structured as
 [L_TIMESTAMP0]
 [L_TIMESTAMP1]
 [L_TIMESTAMP2]

and this continues for how ever many sets of transaction details there are for each set, ie timestamp, timezone, type, email, ect...
In this case there are 3 sets of transaction details but whatever solution needs to be able to loop through it wheither there is only 1 transaction pulled or 100.
Like I said the only goal here is to take this returned array from PayPal and insert into a MySQL database.
I hope this makes sense, any help at all would be greatly appreciated! Thanks!
Im sorry I had to edit my old question because im a newbie I guess -  At any rate I think your code helped organize it a bit better, this is now the response I get... still confused on how to insert it into a mysql database tho...
Array ( [0] => Array ( [timestamp] => 2012%2d08%2d14T18%3a46%3a00Z
[timezone] => GMT
[type] => Payment
[email] => pmd_1333866_per%40yahoo%2ecom
[name] => Joshua%20O
[transactionid] => 58289472YK615973G
[status] => Completed
[amt] => %2d100%2e00
[feeamt] => 0%2e00
[netamt] => %2d100%2e00 )

[1] => Array ( [timestamp] => 2012%2d08%2d14T18%3a45%3a32Z
[timezone] => GMT
[type] => Payment
[email] => pmd_1333866_per%40yahoo%2ecom
[name] => Joshua%20O
[transactionid] => 4U113116FL1819900
[status] => Completed
[amt] => %2d50%2e00
[feeamt] => 0%2e00
[netamt] => %2d50%2e00 )

[2] => Array ( [timestamp] => 2012%2d08%2d13T01%3a45%3a48Z
[timezone] => GMT
[type] => Payment
[email] => pmd_1333866_per%40yahoo%2ecom
[name] => Joshua%20O
[transactionid] => 2X978155KR373471P
[status] => Completed
[amt] => %2d200%2e00
[feeamt] => 0%2e00
[netamt] => %2d200%2e00 )

[3] => Array ( [timestamp] => 2012%2d08%2d13T01%3a34%3a12Z
[timezone] => GMT
[type] => Transfer
[email] =>
[name] => PayPal
[transactionid] => 3TH38971MF599302V
[status] => Completed
[amt] => 2000%2e00
[feeamt] => 0%2e00
[netamt] => 2000%2e00 ) )

A: Two ideas are:
$numOfTransactions=intval((count($response)-5)/11);
where 5 is the number of values not duplicated for each transaction and 11 is the number of values for each transaction. This depends on the structure being reliable.
OR
$numOfTransactions=0;
foreach ($response as $key=>$value){
 $check=strpos($key,'L_TIMESTAMP');
 if ($check===false) break;
 $numOfTransactions++;
}

Then you can loop through the response to structure your data
for ($i=0;$i<$numOfTransactions;$i++){
 $data[$i]=array("timestamp"=>$response['L_TIMESTAMP'.$i],"timezone"=>$response['L_TIMEZONE'.$i]...);
}


text:
Q: Подскажите, как сделан эффект параллакса Мне нужен такой же сайт, конечно с другим дизайном, но не могу понять, как создаются такие параллакс сайты. Могу сказать, что на ширину и высоту ставится 100%, а остальное скрывается overflow:hidden. Ссылки крепятся якорем, я так понимаю. Пожалуйста будьте добры, подскажите. Вот пример сайта
A: Это просто подшамененный плагин на jquery:
https://github.com/IanLunn
http://smashinghub.com/7-jquery-parallax-and-scrolling-effect-plugins.htm
http://habrahabr.ru/post/142137/
http://stephband.info/jparallax/
Можно так же просто скопировать код того сайта и подправить под себя


text:
Q: Perl critic policy violation in checking index of substring in a string for my $item (@array) {
    if (index($item, '$n') != -1) {
       print "HELLO\n";
    }
}

Problem is: Perl critic gives below policy violation.

String may require interpolation at line 168, near '$item, '$n''. (Severity: 1)

Please advise how do I fix this?

A: In this case the analyzer either found a bug or is plain wrong in flagging your code.
Are you looking for a literal "$n" in $item, or for what $n variable evaluates to?

*

*If you want to find the literal $n characters then there is nothing wrong with your code

*If you expect $item to contain the value stored in $n variable then allow it to be evaluated,
if (index($item, $n)  != -1)

If this is indeed the case but $n may also contain yet other escaped sequences or encodings which you need as literal characters (so to suppress their evaluation) then you may need to do a bit more, depending of what exactly may be in that variable.
In case you do need to find characters $ followed by n (what would explain a deliberate act of putting single quotes around a variable) you need to handle the warning.
For the particular policy that is violated see Perl::Critic::Policy::ValuesAndExpressions

This policy warns you if you use single-quotes or q// with a string that has unescaped metacharacters that may need interpolation.

To satisfy the policy you'd need to use double quotes and escape the $, for example qq(\$n). In my opinion this would change the fine original code segment into something strange to look at.
If you end up wanting to simply silence the warning see documentation, in Bending The Rules
A comment. The tool perlcritic is useful but you have to use it right. It's a static code analyzer and it doesn't know what your program is doing, so to say; it can catch bad practices but can't tell you how to write programs.  Many of its "policies" are unsuitable for particular code.
The book that it is based on says all this very nicely in its introduction.    Use sensibly.

When I look at the question where this comes from it appears that you are looking for index at which substrings were matched, so you need the content of $n variable, not literal "$n". Then perlcritic identified a bug in the code, good return for using it!


text:
Q: How to change the top directory in LTspice? I installed LTspice in C:\Program Files, and when I go to "search components", the top directory is C:\Documents.
How can I change my top directory?

A: You can add additional paths/folders/directories by going to Tools > Control Panel

Then select the Sym. & Lib. Search Paths tab.

Since you are trying to add paths to symbols, add the paths in the top textbox:
Symbol Search Path[*]
Multiple paths can be separated on new lines, or by semicolons ; (which will be converted to new lines after closing the window).
If a path does not yet exist (perhaps you made a typo) then LTspice will ask if you want to include them anyway. Note that if they don't yet exist, they will not show up in the directory selection drop-down list.
If all goes well, you will see your new paths in the list:

A: Bort answer is ok, but I wanted to move the primary lib directory to another drive so I don't loose updates between windows installs.
So I make a symlink. This is how you can do it.
Close LTSpice. Rename original lib directory to lib.bak. Start command prompt and to go the lib lib directory - in my case.
Let's say you want to change the directory to D:\Programs\LTspice\lib :
c:
cd "C:\Users\user\Documents\LTspiceXVII"
rename lib lib.bak
mklink /J "lib" "D:\Programs\LTspice\lib"

You could still add additional directories in control panel if you like according to Bort's answer


text:
Q: Javascript logic not flowing as expected I am writing the following logic to determine the current page and fetch the page_number from the current page - but although I correctly obtain the current page URL, when I modify it, the value seems to be reset to undefined.
I think this may be a scope resolution error, but declaring the variable new_page using var instead of let does not seem to resolve the issue.
I know I am overlooking something trivial - but I can't, for the life of me, spot it.
Here is my code:
$().ready(function(e){
  $('button#ghead-submit').on('click', function(e){
    let val = $('input.sort-order[name=rdoMystuff]:checked').val()
    let url = window.location.href;

    console.log(url);

    let page_number = 1
    let new_page;

    if (url.includes('?page=')){
      console.log('true');
      let temp = url.split('?page=');
      let page_number = parseInt(temp[1]);
      new_page = `${temp[0]}${page_number}`;
      console.log(new_page);  /* correct out put here */
    }
    else {
      console.log('false');
      new_page = `${new_page}?page=1`;
      console.log(new_page);  /* correct out put here */
    }

    alert(val);
    alert(new_page);  /* output as 'undefined'! */
  })
});

A: You declare page_number twice. Thus, it's undefined in the upper scope (outside of the if) which is why your result is undefined as well.
let page_number = 1                      // <-- You declare page_number here
let new_page;                            //  |
                                         //  |
if (url.includes('?page=')){             //  |
    console.log('true');                 //  |
    let temp = url.split('?page=');      //  |
    let page_number = parseInt(temp[1]); // <-- you declare it here again.
    new_page = `${temp[0]}${page_number}`;
    console.log(new_page);  /* correct out put here */
}

Remove the let before page_number in the if block.

A: It's because you're re-declaring the variable page_number inside the first if-statement.

$().ready(function(e){
  $('button#ghead-submit').on('click', function(e){
    let val = $('input.sort-order[name=rdoMystuff]:checked').val()
    let url = window.location.href;

    console.log(url);

    let page_number = 1
    let new_page;

    if (url.includes('?page=')){
      console.log('true');
      let temp = url.split('?page=');
      let page_number = parseInt(temp[1]); // here, you can remove the "let"
      new_page = `${temp[0]}${page_number}`;
      console.log(new_page);  /* correct out put here */
    }
    else {
      console.log('false');
      new_page = `${new_page}?page=1`;
      console.log(new_page);  /* correct out put here */
    }

    alert(val);
    alert(new_page);  /* output as 'undefined'! */
  })
});


text:
Q: Finding year with equal occurrences I'm using the babynames package to find out when a certain name(like Alex) was closest to having an equal number of male and female babies that had that name.
I currently have but I'm not sure what math needs to be done to find out when this name was most unisex, since it probably wasn't a perfect 50/50.
Alex <- babynames %>%
  filter(name == "Alex", year >=1920) %>%
  group_by(year, sex) %>%
  summarise(n = sum(n)) %>%
  mutate(n = n/sum(n) * 100)

Thank you.

A: Graphically:
library(babynames)
library(dplyr)
library(ggplot2)
babynames %>%
  filter(name == "Alex", year >=1920) %>%
  ggplot(aes(year, n, color=sex)) +
  geom_line()

Numerically:
library(tidyr)
babynames %>%
filter(name == "Alex", year >=1920) %>%
group_by(year) %>%
mutate(pct = n / sum(n, na.rm = TRUE)) %>%
ungroup() %>%
select(year, name, pct, sex) %>%
pivot_wider(names_from = sex, values_from = pct) %>%
mutate(diff = abs(F - M)) %>%
arrange(diff)

For all names:
babynames %>%
  filter(year >=1920) %>%
  group_by(name, year) %>%
  mutate(pct = n / sum(n, na.rm = TRUE),
         total = sum(n)) %>%
  ungroup() %>%
  select(year, name, total, pct, sex) %>%
  pivot_wider(names_from = sex, values_from = pct) %>%
  mutate(diff = abs(F - M)) %>%
  arrange(diff)

Not sure about this data set though ;)
babynames %>%
  filter(name == "Othello", year ==1920)

   year sex   name        n       prop
  <dbl> <chr> <chr>   <int>      <dbl>
1  1920 F     Othello     8 0.00000643
2  1920 M     Othello     8 0.00000727


text:
Q: Three Dimensional Hough Space Im searching for radius and the center coordinates of circle in a image. have already tried 2D Hough transform. but my circle radius is also a unknown. Im still a beginner to Computer vision so need guild lines and help for implementing three dimensional hough space.

A: You implement it just like 2D Hough space, but with an additional parameter. Pseudo code would look like this:
for each (x,y) in image
     for each test_radius in [min_radius .. max_radius]
         for each point (tx,ty) in the circle with radius test_radius around (x,y)
             HoughSpace(tx,ty,test_radius) += image(x,y)

A: Thiton gives you the correct approach to formalize the problem. But then, you will run in other problems inherent to the hough transform:

*

*how do you visualize the parameter space? You may implement something with a library like VTK, but 3D visualization of data is always a difficult topic. The visualization is important for debugging your detection algorithm and is one of the nice thing with 2D hough transform

*the local maximum detection is non trivial. The new dimension will mean that your parameter space will be more sparse. You will have more tuning to do in this area
If you are looking for a circle detection algorithm, you may have better options than the hough transform (google "Fast Circle Detection Using Gradient Pair Vectors" looks good to me)


text:
Q: After cloning/forking a github repo, is there a way to push only new commits? So what I am trying to do is fork one of my own repositories on Github.  Github does not allow you to do this easily on their site, so I did it this way: http://bitdrift.com/post/4534738938/fork-your-own-project-on-github
This works out great but when I commit the newly forked repository, all of the past commits show up on my Github account rather than my just my initial commit after forking.  Is there a way to make it so that only my new commits on this project/fork are pushed to github?  Thanks!

A: Just create a new git repository based off of the forked content:
# After forking repo:
$ cd /path/to/repo
$ rm -rf .git
$ git init
$ git add .
$ git commit -m "Initial commit (forked from parent/repo)"
$ git remote add origin git@github.com:forked/repo
$ git push origin master

After removing and recreating the git repository, GitHub will have no history of past commits and think that everything was done in a large initial commit.


text:
Q: How can I separate JSON object elements into separate arrays in Python? {'labels': 'Middle East', 'default': 193}
{'labels': 'Coronavirus pandemic', 'default': 116}
{'labels': 'Europe', 'default': 90}
{'labels': 'United States', 'default': 67}
{'labels': 'Health', 'default': 63}

I have JSON objects like above.
I am trying to make below type array in python. plz help
{'labels': ['Middle East', 'Coronavirus pandemic', 'Europe', 'United States', 'Health'], 'default': [193, 116, 90, 67, 63]}

A: You can use list comprehension, assuming you have all those dictionaries inside an array:
dictionaries=[
{'labels': 'Middle East', 'default': 193},
{'labels': 'Coronavirus pandemic', 'default': 116},
{'labels': 'Europe', 'default': 90},
{'labels': 'United States', 'default': 67},
{'labels': 'Health', 'default': 63}]

labels=[d['labels'] for d in dictionaries]
default=[d['default'] for d in dictionaries]
result={'labels' : labels, 'default': default}
print(result)

Output:
{'labels': ['Middle East', 'Coronavirus pandemic', 'Europe', 'United States', 'Health'], 'default': [193, 116, 90, 67, 63]}

A: you can create a function merge that can take multiple dictionaries and then merge those dictionaries
def merge(*dicts):
    res = {}
    for d in dicts:
        for key in d.keys():
            if key in res:
                res[key].append(d[key])
            else:
                res[key] = []
                res[key].append(d[key])
    return res

a = {'labels': 'Middle East', 'default': 193}
b = {'labels': 'Coronavirus pandemic', 'default': 116}
c = {'labels': 'Europe', 'default': 90}
d = {'labels': 'United States', 'default': 67}
e = {'labels': 'Health', 'default': 63}
c = merge(a, b, c, d, e)
print(c)

output:
{'labels': ['Middle East', 'Coronavirus pandemic', 'Europe', 'United States', 'Health'], 'default': [193, 116, 90, 67, 63]}


text:
Q: Can I directly serialize to a file using PHP's thrift library?
Related: Apache Thrift: Serializing data

Hi guys : I am noting that the PHP thrift extensions don't appear to have a TFileTransport class.  This leads me to wonder : what is  the mechanism for writing a thrift object to a FILE in PHP ?
Unfortunately, available documentation is focused on the client/server model for using thrift : but I need to use PHP to serialize binary thrift files on disc, which contain a stream of thrift objects.

A: Try extending TPhpStream by overriding:
private static function inStreamName() {
    if (php_sapi_name() == 'cli') {
      return 'php://stdin';
    }
    return 'php://input';   }

and you would also probably need to alter open method to open write file of your choosing. In case you need it, here is nice tutorial about php streams.
If that does not work out for you, consider using TMemoryBuffer to serialize to string, and than you will find your way to put that into a file.


text:
Q: How to use map method in rails views I have a restaurant that has_many menus and a menu that has_many sub_menus. Am trying to get the total orders for each menu or sub_menu within rails views. I already have the logic of splitting the two (menu and sub_menu) through if, else statement. But am having trouble of having sum of all orders for each menu or sub_menu. I have tried this
<% restaurant.menus.each do |menu| %>
    <%= menu.orders.map{|sum, order|sum+order %>
<% end %>

this throws an symbol '+' error while this gets count but not total
<%= restaurant.menus.orders.count %>

UPDATE

A restaurant has_many menus (model Menu) while a menu has_many sub_menus (Model sub_menu). Both menu and sub_menu have many orders (model Order). So am trying to get count of orders a menu or sub_menu has. Hope its quite clear.

A: The method map iterates over all the orders of the given menu, yielding a single order object everytime. This object is stored in sum because it is the first variable in the block-local list you have provided |sum, order|. Since nothing more is yielded, order variable will be nil for each iteration.
Now as you can well imagine, no + method is defined on your order model class. Hence it throws a undefined method+' for ` exception.
If this seems strange, then always remember that writing a+b is just a short-form of writing a.+(b) where + is a method of a.
The following may be helpful:
sum=0;
menu.orders.map{|order| sum+=order.price}

I assumed there was a price field in your order model. Hope this helps. And btw, you have a missing } in the code. Did you see it?

A: u can make the below changes to get the count of menu orders and sub menu orders for a restaurant
Restaurant
  has_many :menus
  has_many :sub_menus #u can add this if it doesnt exist
  has_many :menu_orders, :through => :menus, :class_name => "Order" #this will give u an array of orders for all the menus of the restaurant
  has_many :sub_menu_orders, :through => :sub_menus, :class_name => "Order" #this will give array of orders for all the submenus of the restaurant

Menu
  belongs_to :restaurant
  has_many :sub_menus
  has_many :orders

SubMenu
  belongs_to :restaurant #u can add this if it doesnt exist
  belongs_to :menu
  has_many :orders

Order
  belongs_to :menu
  belongs_to :sub_menu


text:
Q: Symfony2 Sonata Userbundle 8 installed with SonataAdminBundle, the admin area is working well, and I'm on the stage to install SonataUserBundle which is installed in src/Application. Everything is looking good, but when I try to force doctrine:schema:update I get this error:
[Doctrine\DBAL\DBALException]
  Unknown column type "json" requested. Any Doctrine type that you use has to be registered with \Doctrine\DBAL\Types\Type::addType(). You can get a list of all the
  known types with \Doctrine\DBAL\Types\Type::getTypesMap(). If this error occurs during database introspection then you might have forgot to register all database t
  ypes for a Doctrine Type. Use AbstractPlatform#registerDoctrineTypeMapping() or have your custom types implement Type#getMappedDatabaseTypes(). If the type name is
   empty you might have a problem with the cache or forgot some mapping information.

I found too many solutions on the forums and here, but none of them is working.
Here is my AppKernel.php registered Bundles:
public function registerBundles()
{
    $bundles = array(
        new Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
        new Symfony\Bundle\SecurityBundle\SecurityBundle(),
        new Symfony\Bundle\TwigBundle\TwigBundle(),
        new Symfony\Bundle\MonologBundle\MonologBundle(),
        new Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle(),
        new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(),
        new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(),
        new AppBundle\AppBundle(),
    new Sonata\CoreBundle\SonataCoreBundle(),
    new Sonata\BlockBundle\SonataBlockBundle(),
    new Knp\Bundle\MenuBundle\KnpMenuBundle(),
    new Sonata\DoctrineORMAdminBundle\SonataDoctrineORMAdminBundle(),
    new Sonata\AdminBundle\SonataAdminBundle(),
    new FOS\UserBundle\FOSUserBundle(),
    new Sonata\UserBundle\SonataUserBundle('FOSUserBundle'),
    new Sonata\EasyExtendsBundle\SonataEasyExtendsBundle(),
    new Application\Sonata\UserBundle\ApplicationSonataUserBundle(),
    );

and here is my config.yml configuration:
imports:
    - { resource: parameters.yml }
    - { resource: security.yml }
    - { resource: services.yml }

# Put parameters here that don't need to change on each machine where the app is deployed
# http://symfony.com/doc/current/best_practices/configuration.html#application-related-configuration
parameters:
    locale: en

framework:
    #esi:             ~
    translator:      { fallbacks: ["%locale%"] }
    secret:          "%secret%"
    router:
        resource: "%kernel.root_dir%/config/routing.yml"
        strict_requirements: ~
    form:            ~
    csrf_protection: ~
    validation:      { enable_annotations: true }
    #serializer:      { enable_annotations: true }
    templating:
        engines: ['twig']
        #assets_version: SomeVersionScheme
    default_locale:  "%locale%"
    trusted_hosts:   ~
    trusted_proxies: ~
    session:
        # handler_id set to null will use default session handler from php.ini
        handler_id:  ~
    fragments:       ~
    http_method_override: true

# Twig Configuration
twig:
    debug:            "%kernel.debug%"
    strict_variables: "%kernel.debug%"

# Doctrine Configuration
doctrine:
    dbal:
        driver:   pdo_mysql
        host:     "%database_host%"
        port:     "%database_port%"
        dbname:   "%database_name%"
        user:     "%database_user%"
        password: "%database_password%"
        charset:  UTF8
        # if using pdo_sqlite as your database driver:
        #   1. add the path in parameters.yml
        #     e.g. database_path: "%kernel.root_dir%/data/data.db3"
        #   2. Uncomment database_path in parameters.yml.dist
        #   3. Uncomment next line:
        #     path:     "%database_path%"

    orm:
        auto_generate_proxy_classes: "%kernel.debug%"
        naming_strategy: doctrine.orm.naming_strategy.underscore
        auto_mapping: true

# Swiftmailer Configuration
swiftmailer:
    transport: "%mailer_transport%"
    host:      "%mailer_host%"
    username:  "%mailer_user%"
    password:  "%mailer_password%"
    spool:     { type: memory }
sonata_block:
    default_contexts: [cms]
    blocks:
        sonata.admin.block.admin_list:
            contexts: [admin]

# Sonata FOSUser
sonata_user:
    security_acl: true
    manager_type: orm
sonata_block:
    blocks:
        sonata.user.block.menu:    # used to display the menu in profile pages
        sonata.user.block.account: # used to display menu option (login option)
fos_user:
    db_driver:      orm
    firewall_name:  main
    user_class:     Application\Sonata\UserBundle\Entity\User
    group:
        group_class:   Application\Sonata\UserBundle\Entity\Group
        group_manager: sonata.user.orm.group_manager
    service:
        user_manager: sonata.user.orm.user_manager
doctrine:
    dbal:
        types:
            json: Sonata\Doctrine\Types\JsonType
doctrine:
    orm:
        entity_managers:
            default:
                mappings:
                    ApplicationSonataUserBundle: ~
                    SonataUserBundle: ~

A: I found the answer, first I have this configuration:
doctrine:
    dbal:
        driver:   pdo_mysql
        host:     "%database_host%"
        port:     "%database_port%"
        dbname:   "%database_name%"
        user:     "%database_user%"
        password: "%database_password%"
        charset:  UTF8
        # if using pdo_sqlite as your database driver:
        #   1. add the path in parameters.yml
        #     e.g. database_path: "%kernel.root_dir%/data/data.db3"
        #   2. Uncomment database_path in parameters.yml.dist
        #   3. Uncomment next line:
        #     path:     "%database_path%"

and after this I redeclare:
doctrine:
    dbal:
        types:
            json: Sonata\Doctrine\Types\JsonType

the two must be merged like this:
doctrine:
    dbal:
        types:
            json: Sonata\Doctrine\Types\JsonType
        driver:   pdo_mysql
        host:     "%database_host%"
        port:     "%database_port%"
        dbname:   "%database_name%"
        user:     "%database_user%"
        password: "%database_password%"
        charset:  UTF8
        # if using pdo_sqlite as your database driver:
        #   1. add the path in parameters.yml
        #     e.g. database_path: "%kernel.root_dir%/data/data.db3"
        #   2. Uncomment database_path in parameters.yml.dist
        #   3. Uncomment next line:
        #     path:     "%database_path%"


text:
Q: change css using JS I am trying to call a JS event, depending on a button press, (there are three buttons) i want some CSS to change the font-size (differently for each button), but what i have does not work. can anyone help?

body {
     background-image: url("back2.jpg");
     background-size: 100% 100%;
 }

 .buttonSize1{
    font-size: 3px;
 }

 .buttonsize2{
   font-size: 26px;
 }

 .buttonsize3{
   font-size: 45px;
 }

.fixed {
    position: fixed;
    Top: 100px;
    Left: 0px;
    width: 150px;
    border: #0E6B5B 3px solid;
    background-color: #FF9933;
}

p {
    padding-left: 100px;
}
td {
    padding-top: 10px;
    padding-bottom: 50px;
    text-align: center;
    font-family: "Lucida Console", Monaco, monospace;

}
.opac {
     opacity: 0.5;
     filter: alpha(opacity=10); /* For IE8 and earlier */
 }

 .opac:hover {
     opacity: 1.0;
     filter: alpha(opacity=100); /* For IE8 and earlier */
 }
 .MainTable{
     border: #0E6B5B 3px solid;
  background-color: #FF9933;
    width: 50%;
    padding-top: 10px;
    padding-left: 100px;
 padding-right: 100px;

 }

 table.center {
    width:70%;
    margin-left:15%;
    margin-right:15%;
  }
<!doctype html>

<link rel="stylesheet" href="7Global.css"/>

<title> CSGO </title>

    Home

    Maps

    Counter
 Terrorists

    Terrorists

    About

    <button class="buttonsize1" onclick="textSizeS()">A</button> <button class= "buttonsize2" onclick="textSizeM()">A</button> <button class= "buttonsize3" onclick="textSizeL()">A</button>

    CS:GO's Next Major

Europe Region – Hosted by DreamHack

 Operation Wildfi

What's new? Visit the page below for details!

  We made some adjustments to rifles recently...

nCS:GO. M

A: fontSize not font-size
Demo https://jsfiddle.net/eLrdeagq/
function textSizeS(){
document.getElementById("Maintbl").style.fontSize  = "3px";
}

A: Like this, where I added a wrapper div to set the font size to, corrected the syntax error from ...style.font-size to ...style.fontSize and removed that duplicated id's (as they should be unique).

function textSizeS(){
  document.getElementById("MaintblWrapper").style.fontSize = "3px";
}

function textSizeM(){
  document.getElementById("MaintblWrapper").style.fontSize = "26px";
}

function textSizeL(){
  document.getElementById("MaintblWrapper").style.fontSize = "45px";
}
body {
     background-image: url("back2.jpg");
     background-size: 100% 100%;
 }

 .buttonSize1{
    font-size: 3px;
 }

 .buttonsize2{
   font-size: 26px;
 }

 .buttonsize3{
   font-size: 45px;
 }

.fixed {
    position: fixed;
    Top: 100px;
    Left: 0px;
    width: 150px;
    border: #0E6B5B 3px solid;
    background-color: #FF9933;
}

p {
    padding-left: 100px;
}
td {
    padding-top: 10px;
    padding-bottom: 50px;
    text-align: center;
    font-family: "Lucida Console", Monaco, monospace;

}
.opac {
     opacity: 0.5;
     filter: alpha(opacity=10); /* For IE8 and earlier */
 }

 .opac:hover {
     opacity: 1.0;
     filter: alpha(opacity=100); /* For IE8 and earlier */
 }
 .MainTable{
     border: #0E6B5B 3px solid;
  background-color: #FF9933;
    width: 50%;
    padding-top: 10px;
    padding-left: 100px;
 padding-right: 100px;

 }

 table.center {
    width:70%;
    margin-left:15%;
    margin-right:15%;
  }

    Home

    Maps

    Counter
 Terrorists

    Terrorists

    About

    <button class="buttonsize1" onclick="textSizeS()">A</button> <button class= "buttonsize2" onclick="textSizeM()">A</button> <button class= "buttonsize3" onclick="textSizeL()">A</button>

      CS:GO's Next Major

        Europe Region – Hosted by DreamHack

     Operation Wildfi

        What's new? Visit the page below for details!

      We made some adjustments to rifles recently...

        nCS:GO. M


text:
Q: PHP typed property, how to define default value for object I have a class with typed property object. I need to define default empty value for that property:
This doesn't work:
public object $doctor = new \stdClass();

Is this even possible?

A: This is impossible and the error you get (Constant expression contains invalid operations) explains why: in PHP the properties can only be initialized with constant expressions. You can't use any function calls, variables or an expression producing a new object instance like in your case.
See more details here:
PHP Error : Fatal error: Constant expression contains invalid operations
As a workaround I'd suggest initializing the property in the constructor

A: Just declare a new class instance and fill
$ obj = new stdClass ();
public object $doctor = new stdClass();
$doctor->name="namedoctor"
$doctor->titles= array('doc', 'specialist');


text:
Q: What is SendID in email I am extracting the Journey Builder ( Email)  data using the Data Extract Activity.
While the configuration of the Extract Activity it is asking for the

*

*Email Send Definition External Key

*Send IDs

Where I can find these details?
Thanks,

A: Email Send Definition External key is the Customer/External key of the User-Initiated Send Definition found in your Automation Studio Activities.

Send IDs are JobIDs, which you can find in Email Studio -> Tracking.


text:
Q: Inserting a line in the beginning of a file using sed in HP-UX I am trying to insert a line in the beginning of a file using sed.
I tried below commands :
sed -i '1s/^/LINE TO INSERT\n/' test.txt
sed: illegal option -- i --> Error thrown
sed '1i/^/LINE TO INSERT\n/' test.txt
sed: Function 1i/^/LINE TO INSERT\n/ cannot be parsed.   --> Error thrown
Both the ways came out to be failed.
Any possible solution to it ? I am using ksh script on HP-UX.
Thanks.

A: How about good old ed?
printf '%s\n' 1i 'LINE TO INSERT' . w | ed -s file

printf is used to send each command to ed on a separate line.
Alternatively, if you're terrified of ed like me, you can just use a temporary file, as suggested in the comments:
echo 'LINE TO INSERT' > tmp && cat tmp test > new && mv new test && rm tmp

A: I think you have a typo: you're missing the closing apostrophe from your 1st command. Otherwise it's fine. I.e.:
You have this: sed -i '1s/^/... test.txt
But you need this: sed -i '1s/^/...' test.txt
Putting all together: sed -i '1s/^/LINE TO INSERT\n/' test.txt
Update: if -i is not supported, then you can use a temporary file:
sed '1s/^/LINE TO INSERT\n/' test.txt > /tmp/test.txt.tmp
mv /tmp/test.txt.tmp test.txt


text:
Q: One single class for const and non-const iterators. Is it possible? I'm implementing a custom container with an STL-like interface for a 3D grid control for my scientific software. This is my second question regarding the iterator class for this container. Thanks for helping me with the first!
My question is just like "How do you avoid code duplication when implementing const and non-const iterators?". I just wanted to ask if it is possible to provide a template-less solution? (And without providing a second const iterator class!)
The iterator class looks like this:

class spGridIterator {
public:
    typedef forward_iterator_tag iterator_category;
    typedef spGridNode value_type;
    typedef int difference_type;
    typedef spGridNode* pointer;
    typedef spGridNode& reference;

    spGridIterator();
    spGridIterator(spGrid* gr, int index);
    spGridIterator(const spGridIterator& orig);
    virtual ~spGridIterator();

    // STL-ные операторы итератора
    bool operator == ( const spGridIterator& hs ) const {
        return (m_grid == hs.m_grid) && (m_idx == hs.m_idx);
    }

    bool operator != ( const spGridIterator& hs ) const {
        return (m_grid != hs.m_grid) || (m_idx != hs.m_idx);
    }

    // non-const operators
    spGridIterator& operator++();
    spGridIterator& operator++(int);

    reference operator*() const;
    pointer operator->() const { return &(operator*()); }

private:
    spGrid* m_grid;
    int m_idx;
};

And an implementation...
spGridIterator::spGridIterator(spGrid* gr, int index) {
    m_grid = gr;
    m_idx  = index;
}

spGridIterator& spGridIterator::operator++()
{
    int last = m_grid->numpoints;

    if (m_idx < last) {
        m_idx++;
    }
    return *this;
}

spGridIterator& spGridIterator::operator++(int) {
    return operator++();
}

spGridIterator::reference spGridIterator::operator*() const {
    return ( m_grid->GetNode(m_idx) );
}

I checked the doctor dobbs article about custom iterator implementation. They suggest implementing an iterator class template and adding an additional template parameter for the value_type.
Well, the second solution is to provide a regular iterator and a const iterator classes.
Is there third, maybe "kinda hacky", single class template-less solution? Maybe providing a conversion operator or an additional const version of operator++()?
Thanks,
Ilya

A: If you want to go kind of hacky, you may be able to abuse "const_cast" to create a const iterator out of a non-const one.


text:
Q: WSO2 APIM - JSON to SOAP out sequence not works , return empty value between the SOAP parameter arguments I tried the following codes in mediation in WSO2 server
Following code for insequence mediation
<sequence name="SOAPtoJSON" trace="disable" xmlns="http://ws.apache.org/ns/synapse">
<log level="custom" separator=",">
    <property name="TRACE" value="Global Mediation Extension"/>
</log>
<property name="messageType" scope="axis2" type="STRING" value="application/json"/>

The above insequence works fine and converts the input from SOAP to JSON and forward it to the endpoint.
The SOAP request given to the WSO2 Server via WSO2 Server API Console was,
<soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:ecomreceipt">
<soapenv:Header/>
<soapenv:Body>
    <validatepassbook xmlns="https://10.122.0.32:8243/gpp20038/1.0.0/">
        <Mode>$1</Mode>
        <Action>$2</Action>
        <Attribute>$3</Attribute>
    </validatepassbook>
</soapenv:Body>

And then, I logged the request from the WSO2 Server in the endpoint, log shows the following
{"validatepassbook":{"@encodingStyle":"http://schemas.xmlsoap.org/soap/encoding/","Mode":{"@type":"xsd:string","$":"zmzIf0CMfm5ta8lg5xc6Bj1tOEEljipbbrbX2Ph8XFxGyGl5T4vhzzmLIpNuSh6W"},"Action":{"@type":"xsd:string","$":"KGI1718SGS439-KGI14306-SGS3"},"Attribute":{"@type":"xsd:string","$":7904045393}}}

Following code for outsequence mediation
<sequence name="JSONtoSOAP" trace="disable" xmlns="http://ws.apache.org/ns/synapse">
<payloadFactory media-type="xml">
    <format>
        <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://ws.cdyne.com/PhoneVerify/query">
            <SOAP-ENV:Body>
                <ns1:CheckPhoneNumbers>
                    <ns1:PhoneNumbers>
                        <ns1:string>$1</ns1:string>
                    </ns1:PhoneNumbers>
                    <ns1:LicenseKey>$2</ns1:LicenseKey>
                </ns1:CheckPhoneNumbers>
            </SOAP-ENV:Body>
        </SOAP-ENV:Envelope>
    </format>
    <args>
        <arg evaluator="xml" expression="//request/PhoneNumber"/>
        <arg evaluator="xml" expression="//request/LicenseKey"/>
    </args>
</payloadFactory>
<property name="messageType" scope="axis2" type="STRING" value="application/soap+xml"/>

And then, I logged the respond that to be sent to  WSO2 Server in the endpoint, log shows the following
"{\"request\":{\"PhoneNumber\":\"18006785432\",\"LicenseKey\":\"0\"}}"

And then, I got the output in WSO2 Server API Console was,
Response Body
<?xml version='1.0' encoding='UTF-8'?><SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://ws.cdyne.com/PhoneVerify/query"><SOAP-ENV:Body><ns1:CheckPhoneNumbers><ns1:PhoneNumbers><ns1:string/></ns1:PhoneNumbers><ns1:LicenseKey/></ns1:CheckPhoneNumbers></SOAP-ENV:Body></SOAP-ENV:Envelope>

The above response with empty values , but I expect like following reponse
<?xml version='1.0' encoding='UTF-8'?><SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://ws.cdyne.com/PhoneVerify/query"><SOAP-ENV:Body><ns1:CheckPhoneNumbers><ns1:PhoneNumbers><ns1:string/>18006785432</ns1:PhoneNumbers><ns1:LicenseKey>0</ns1:LicenseKey></ns1:CheckPhoneNumbers></SOAP-ENV:Body></SOAP-ENV:Envelope>


text:
Q: UWP respond to Control width change I want my control to respond to its width change instead of the Window width change. Can I achieve that using VisualStateManager or pure xaml?
One possible solution I can think of is using DataTriggerBehavior. For example:
<Interactivity:Interaction.Behaviors>
    <Interactions:DataTriggerBehavior Binding="{Binding Width, ElementName=PlaylistDataTemplateControl}" ComparisonCondition="Equal" Value="1000">
        <Interactions:ChangePropertyAction TargetObject="{Binding ElementName=AlbumTextBlock}" PropertyName="Visibility" Value="Collapsed"/>
    </Interactions:DataTriggerBehavior>
</Interactivity:Interaction.Behaviors>

I put it in the PlaylistDataTemplateControl but nothing happens when width changes.

A: The default trigger for UWP is only about the window. If you want to implement triggering on the control, there are two ways. The first is to listen for the SizeChanged event, and the second is to write the trigger yourself.
Here is the first case:
xaml
<StackPanel>

    <VisualStateManager.VisualStateGroups>
        <VisualStateGroup>
            <VisualState x:Name="Narrow">
                <VisualState.Setters>
                    <Setter Target="MyControl.Background" Value="White"/>
                </VisualState.Setters>
            </VisualState>
            <VisualState x:Name="Width">
                <VisualState.Setters>
                    <Setter Target="MyControl.Background" Value="Blue"/>
                </VisualState.Setters>
            </VisualState>
        </VisualStateGroup>
    </VisualStateManager.VisualStateGroups>

    <ContentControl x:Name="MyControl" Width="200" Height="100" SizeChanged="MyControl_SizeChanged"/>

    <Button Content="Change Width" x:Name="WidthButton" Click="WidthButton_Click"/>
</StackPanel>

xaml.cs
private void MyControl_SizeChanged(object sender, SizeChangedEventArgs e)
{
    if (e.NewSize.Width == 200)
    {
        VisualStateManager.GoToState(this, "Narrow", true);
    }
    else
    {
        VisualStateManager.GoToState(this, "Width", true);
    }
}

private void WidthButton_Click(object sender, RoutedEventArgs e)
{
    MyControl.Width = MyControl.Width == 300 ? 200 : 300;
}

This is just a simple example. First define the VisualState of the control in XAML, then change the state of the control in the SizeChanged event, which can achieve your purpose.
If you are interested in custom triggers, you can refer to this Microsoft-provided example, which has a trigger on Control Size.
Best regrads.


text:
Q: How can I include all js files like we add all css files in one main.css We can use all css files as one file for example main.css:
@import url(bootstrap.css);
@import url(bootstrap.min.css);
@import url(bootstrap-theme.css);
@import url(bootstrap-theme.min.css);
@import url(style.css);
@import url(w3.css);

How can we include and use all js files as one main.js and use all javascript files for example
main.js
<script src="http://127.0.0.1:7070/js/aa.js">
<script src="http://127.0.0.1:7070/js/bb.js">
<script src="http://127.0.0.1:7070/js/cc.js">
<script src="http://127.0.0.1:7070/js/dd.js">
<script src="http://127.0.0.1:7070/js/ee.js">

A: You can't natively include JS files like the import statement in CSS (though it's important to note that the CSS import still downloads multiple files, it's just a convenience for organizing the rules.  )
Have a look at tools like Webpack, require.js, Grunt, and Gulp.  All of which do concatenation and minification for you as build steps.


text:
Q: angular test case $scope.$apply Why is it mandatory to execute $scope.$apply() in a test case for async process to finish.
say i have a service
angular.service("a",function($q){
    return {
        getValue: function(){
            return $q.resolve(someObj)
        }
    }
})

And in my test
it("test this",function(done){
    a.getValue()
    .then(function(data){
        expect(data).toEqual(data)
        done();
    })
    $scope.$apply();
})

A: It triggers the digest cycle.
From the docs:

When testing promises, it's important to know that the resolution of
  promises is tied to the digest cycle. That means a promise's then,
  catch and finally callback functions are only called after a digest
  has run. In tests, you can trigger a digest by calling a scope's
  $apply function. If you don't have a scope in your test, you can
  inject the $rootScope and call $apply on it.

For http calls, you use $httpBackend.flush(). From the docs,

The $httpBackend used in production always responds to requests
  asynchronously. If we preserved this behavior in unit testing, we'd
  have to create async unit tests, which are hard to write, to follow
  and to maintain. But neither can the testing mock respond
  synchronously; that would change the execution of the code under test.
  For this reason, the mock $httpBackend has a flush() method, which
  allows the test to explicitly flush pending requests. This preserves
  the async api of the backend, while allowing the test to execute
  synchronously.


text:
Q: How to prevent web browser from caching IMG tag that contains sensitive information? In my PHP script I may generate a QR code that is used as a two-factor authentication private key for a user login. (Such QR code is shown only at the moment when user account is created.) The QR code itself is generated as an image as such:
<img src="https://chart.googleapis.com/chart?chs=200x200&chld=M%7C0&cht=qr&chl=otpauth://totp/Example:alice@gmail.com?secret=TGABZXEP4LKB46AX&issuer=Example" alt="QR code">

Because this QR code contains sensitive information, I was wondering if there's a way to prevent web browsers from caching (or in any way saving) this image on the client's computer?


text:
Q: SQL query to subtract net position from same table I'm developing a phonegap app - working out who owes who a drink. I think I'm close to a solution but can't work out the last part without outer join (which SQL Lite does not support).
The database is structured with user IDs representing the buyer and receiver, and separate drink types (beer, wine, cocktails etc). I want to go through and cancel drinks of the same type to work out who is ahead in each type.
The results should be a table with each drink code down the side, and the number owed (could be negative)
var sql = "select too.drinkType, ifnull(fro.cnt, 0) - ifnull(too.cnt, 0) as cnt FROM "+
"(SELECT drinkType, count(drinkType) as Cnt FROM drink "+
"WHERE boughtBy = "+0+" and boughtFor = " + id + " GROUP BY drinkType) too "+
" LEFT OUTER JOIN  " +
"(SELECT drinkType, count(drinkType) as Cnt FROM drink "+
"WHERE boughtBy = "+id+" and boughtFor = " + 0 + " GROUP BY drinkType) fro "+
"on too.drinkType = fro.drinkType "

tx.executeSql(sql, [], getDrinksNet_success);

This nearly works, but misses drinkTypes that were only returned by the second query (fro). I think an outer join is what I need, but phonegap doesn't seem to support that. Is there a way around it?

A: Try using a query like this, where you count up or down depending on who bought the drink:
SELECT drinkType, SUM(CASE WHEN boughtBy = :id THEN 1 ELSE -1 END) AS cnt
FROM drink
WHERE (boughtBy = :id AND boughtFor = 0)
OR (boughtFor = :id AND boughtBy = 0)
GROUP BY drinkType

A: In the general case, you can implement a FULL OUTER JOIN by combining a left and a right outer join, and implement a RIGHT OUTER JOIN by using a LEFT OUTER JOIN and exchanging the two tables.
Your query would then look like this:
SELECT ... FROM
(SELECT ...) too
LEFT OUTER JOIN
(SELECT ...) fro
ON too.drinkType = fro.drinkType
UNION
SELECT ... FROM
(SELECT ...) fro
LEFT OUTER JOIN
(SELECT ...) too
ON fro.drinkType = too.drinkType


text:
Q: How to decrease Epoch time length and perform substract operation for get one minute ago time in Nifi I have a use case, where i need to generate timestamp in Epoch UTC format till seconds 1662371646, and perform Substract operation for generate one minute ago time in same format.
below is my Jolt Spec :
[
  {
    "operation": "default",
    "spec": {
      "currenttime": "${now():toNumber()}"

    }
  },
  {
    "operation": "modify-overwrite-beta",
    "spec": {
      "timeOneMinu": "=Subtract(@(1,currenttime),60)"
    }
  }
]

Expected Output
{
  "currenttime": "1662372281",
  "timeOneMinu": "1662372221"
}

Please suggest, How we can do this.

A: There's no function called Subtract but intSum, but prefer using it for an integer with less than ten digits. Split by using substring function in order to do this, and then remove extra created attributes such as
[
  {
    "operation": "default",
    "spec": {
      "currenttime": "${now():toNumber()}"

    }
  },
  {
    "operation": "modify-overwrite-beta",
    "spec": {
      "ct1": "=substring(@(1,currenttime),0,4)",
      "ct2_": "=substring(@(1,currenttime),4,13)",
      "ct2": "=intSum(-60,@(1,ct2_))",
      "timeOneMinute": "=concat(@(1,ct1),@(1,ct2))"
    }
  },
  {
    "operation": "remove",
    "spec": {
      "ct*": ""
    }
  }
]

the demo on apache ni-fi is :


text:
Q: vlc - audio stuttering on certain dvds only - Xubuntu 22.04 This PC has been on Ubuntu for ~10 years. It has never been plain sailing but had been working until 2 days ago when we left a DVD video on pause in VLC. When we unpaused a few hours later, the audio started stuttering constantly at high volume that can't be lowered in either VLC or the OS once it starts.
The DVD video/image playback looks ok.
Playback of .mp4 files in VLC is okay (so a potential workround is to rip the DVDs).
Audio works fine in Firefox, Steam games etc - so I believe the problem is isolated to vlc dvd playback.
The dvds it has happened to so far reputedly have some copy protection or encryption on them. I suppose scrambling the sound might be a feature of that.
The soundcard is onboard: HDA Intel
Playback is IEC958 / SPDIF digital stereo, which goes to an AV Receiver, which is currently set to split the stereo signal into virtual 5.1 surround sound.
If I buy an adaptor there would exist the option to play sound via the graphics card and use HDMI instead.
The audio is set to Pulseaudio Sound Server. Switching it to ALSA doesn't seem to affect this problem.
vlc is giving numerous error messages (pasted below), most of which I've searched and the results haven't seemed particularly useful so far.
At the moment I think it might be a problem with the buffer size or that too many other programs are open relative to the buffer. So I'm looking at vlc Advanced Preferences > Input/Codecs. But if anyone has seen the same errors I'd be hugely grateful for any pointers.
This block of errors reflects multiple attempts
VLC media player 3.0.16 Vetinari (revision 3.0.13-8-g41878ff4f2)
[000055f012e10580] main libvlc: Running vlc with the default interface. Use 'cvlc' to use vlc without interface.
[000055f012eb03d0] main playlist: playlist is empty
qt.qpa.xcb: QXcbConnection: XCB error: 3 (BadWindow), sequence: 4434, resource id: 23207761, major code: 40 (TranslateCoords), minor code: 0
[00007fe35c0042c0] dvdnav demux: DVD Title: HOBBIT_BATTLE_OF_FIVE_ARMIES
[00007fe35c0042c0] dvdnav demux: DVD Serial Number: 46435A1D
[00007fe35c0042c0] dvdnav demux: DVD Title (Alternative): HOBBIT_BATTLE_OF_FIVE_ARMIES
[00007fe35c0042c0] dvdnav demux: DVD disk reports itself with Region mask 0x00e50000. Regions: 02 04 05
[00007fe35c0042c0] dvdnav demux: Attempting to retrieve all CSS keys
[00007fe35c0042c0] dvdnav demux: This can take a _long_ time, please be patient
[00007fe35c0042c0] dvdnav demux: Menu Languages available: ��
[00007fe35c0042c0] dvdnav demux: Menu Languages available: ��
[00007fe35c0042c0] dvdnav demux: Menu Languages available: ��
[00007fe344004fc0] gl gl: Initialized libplacebo v4.192.1 (API v192)
libva info: VA-API version 1.14.0
libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/nvidia_drv_video.so
libva info: va_openDriver() returns -1
[00007fe344004fc0] glconv_vaapi_x11 gl error: vaInitialize: unknown libva error
libva info: VA-API version 1.14.0
libva error: vaGetDriverNameByIndex() failed with unknown libva error, driver_name = (null)
[00007fe344004fc0] glconv_vaapi_drm gl error: vaInitialize: unknown libva error
libva info: VA-API version 1.14.0
libva error: vaGetDriverNameByIndex() failed with unknown libva error, driver_name = (null)
[00007fe344004fc0] glconv_vaapi_drm gl error: vaInitialize: unknown libva error
[00007fe344004fc0] gl gl: Initialized libplacebo v4.192.1 (API v192)
[00007fe35c06bbe0] avcodec decoder: Using NVIDIA VDPAU Driver Shared Library  510.108.03  Thu Oct 20 04:59:03 UTC 2022 for hardware decoding
[00007fe35c06bbe0] main decoder error: buffer deadlock prevented
[000055f012ee0e70] main audio output error: too low audio sample frequency (0)
[00007fe35c1b4c30] main decoder error: failed to create audio output
[00007fe35c1b4c30] main decoder error: Timestamp conversion failed for 128389: no reference clock
[00007fe35c1b4c30] main decoder error: Could not convert timestamp 0 for spdif
[000055f012ee0e70] main audio output error: too low audio sample frequency (0)
[00007fe35c1c69c0] main decoder error: failed to create audio output
[00007fe344004fc0] gl gl: Initialized libplacebo v4.192.1 (API v192)
[00007fe344004fc0] gl gl: Initialized libplacebo v4.192.1 (API v192)
[00007fe35c06bbe0] avcodec decoder: Using NVIDIA VDPAU Driver Shared Library  510.108.03  Thu Oct 20 04:59:03 UTC 2022 for hardware decoding
[00007fe3500015b0] main input error: ES_OUT_SET_(GROUP_)PCR  is called too late (pts_delay increased to 1000 ms)
[00007fe3500015b0] main input error: ES_OUT_SET_(GROUP_)PCR  is called too late (jitter of 35228 ms ignored)
[00007fe35c06bbe0] main decoder error: Timestamp conversion failed (delay 1000000, buffering 3361, bound 9000000)
[00007fe35c06bbe0] main decoder error: Could not convert timestamp 100050639013 for FFmpeg
[00007fe35c06bbe0] main decoder error: Timestamp conversion failed (delay 1000000, buffering 3361, bound 9000000)
[00007fe35c06bbe0] main decoder error: Could not convert timestamp 100050679013 for FFmpeg
[00007fe35c06bbe0] main decoder error: Timestamp conversion failed (delay 1000000, buffering 12825, bound 9000000)
[00007fe35c06bbe0] main decoder error: Could not convert timestamp 100050719013 for FFmpeg
[00007fe35c06bbe0] main decoder error: Timestamp conversion failed (delay 1000000, buffering 12825, bound 9000000)
[00007fe35c06bbe0] main decoder error: Could not convert timestamp 100050759013 for FFmpeg
[00007fe35c06bbe0] main decoder error: Timestamp conversion failed (delay 1000000, buffering 13130, bound 9000000)
[00007fe35c06bbe0] main decoder error: Could not convert timestamp 100050799013 for FFmpeg
[00007fe35c06bbe0] main decoder error: Timestamp conversion failed (delay 1000000, buffering 13130, bound 9000000)
[00007fe35c06bbe0] main decoder error: Could not convert timestamp 100050839013 for FFmpeg
[00007fe35c06bbe0] main decoder error: Timestamp conversion failed (delay 1000000, buffering 13130, bound 9000000)
[00007fe35c06bbe0] main decoder error: Could not convert timestamp 100050879013 for FFmpeg
[00007fe35c06bbe0] main decoder error: Timestamp conversion failed (delay 1000000, buffering 20749, bound 9000000)
[00007fe35c06bbe0] main decoder error: Could not convert timestamp 100050919013 for FFmpeg
[00007fe35c06bbe0] main decoder error: Timestamp conversion failed (delay 1000000, buffering 20749, bound 9000000)
[00007fe35c06bbe0] main decoder error: Could not convert timestamp 100050959013 for FFmpeg
[00007fe35c06bbe0] main decoder error: Timestamp conversion failed (delay 1000000, buffering 20749, bound 9000000)
[00007fe35c06bbe0] main decoder error: Could not convert timestamp 100050999013 for FFmpeg
[00007fe35c06bbe0] main decoder error: Timestamp conversion failed (delay 1000000, buffering 20749, bound 9000000)
[00007fe35c06bbe0] main decoder error: Could not convert timestamp 100051039013 for FFmpeg
[00007fe35c06bbe0] main decoder error: Timestamp conversion failed (delay 1000000, buffering 20749, bound 9000000)
[00007fe35c06bbe0] main decoder error: Could not convert timestamp 100051079013 for FFmpeg
[00007fe35c06bbe0] main decoder error: Timestamp conversion failed (delay 1000000, buffering 20749, bound 9000000)
[00007fe35c06bbe0] main decoder error: Could not convert timestamp 100051119013 for FFmpeg
[00007fe35c06bbe0] main decoder error: Timestamp conversion failed (delay 1000000, buffering 20749, bound 9000000)
[00007fe35c06bbe0] main decoder error: Could not convert timestamp 100051159013 for FFmpeg
[00007fe35c06bbe0] main decoder error: Timestamp conversion failed (delay 1000000, buffering 20749, bound 9000000)
[00007fe35c06bbe0] main decoder error: Could not convert timestamp 100051199013 for FFmpeg
[00007fe35c06bbe0] main decoder error: Timestamp conversion failed (delay 1000000, buffering 20749, bound 9000000)
[00007fe35c06bbe0] main decoder error: Could not convert timestamp 100051239013 for FFmpeg
[00007fe35c06bbe0] main decoder error: Timestamp conversion failed (delay 1000000, buffering 20749, bound 9000000)
[00007fe35c06bbe0] main decoder error: Could not convert timestamp 100051279013 for FFmpeg
[00007fe35c06bbe0] main decoder error: Timestamp conversion failed (delay 1000000, buffering 20749, bound 9000000)
[00007fe35c06bbe0] main decoder error: Could not convert timestamp 100051319013 for FFmpeg
[00007fe35c06bbe0] main decoder error: Timestamp conversion failed (delay 1000000, buffering 20749, bound 9000000)
[00007fe35c06bbe0] main decoder error: Could not convert timestamp 100051359013 for FFmpeg
[00007fe35c06bbe0] main decoder error: Timestamp conversion failed (delay 1000000, buffering 20749, bound 9000000)
[00007fe35c06bbe0] main decoder error: Could not convert timestamp 100051399013 for FFmpeg
[00007fe35c06bbe0] main decoder error: Timestamp conversion failed (delay 1000000, buffering 20749, bound 9000000)
[00007fe35c06bbe0] main decoder error: Could not convert timestamp 100051439013 for FFmpeg
[00007fe35c06bbe0] main decoder error: Timestamp conversion failed (delay 1000000, buffering 20749, bound 9000000)
[00007fe35c06bbe0] main decoder error: Could not convert timestamp 100051479013 for FFmpeg
[00007fe35c0042c0] dvdnav demux: Menu Languages available: ��
[00007fe35c06bbe0] main decoder error: Timestamp conversion failed for 10438012: no reference clock
[00007fe35c06bbe0] main decoder error: Could not get display date for timestamp 0
[00007fe35c06bbe0] main decoder error: Timestamp conversion failed for 10438012: no reference clock
[00007fe35c06bbe0] main decoder error: Could not convert timestamp 0 for FFmpeg
[00007fe35c0042c0] dvdnav demux: Menu Languages available: ��
[00007fe35c0042c0] dvdnav demux: Menu Languages available: ��
[00007fe35c0042c0] dvdnav demux: Menu Languages available: ��
[00007fe35c0042c0] dvdnav demux: Menu Languages available: ��
[00007fe35c0042c0] dvdnav demux: Menu Languages available: ��
[00007fe35c0042c0] dvdnav demux: Menu Languages available: ��
[00007fe35c0042c0] dvdnav demux: Menu Languages available: ��
[00007fe344004fc0] gl gl: Initialized libplacebo v4.192.1 (API v192)
[00007fe344004fc0] gl gl: Initialized libplacebo v4.192.1 (API v192)
[00007fe35c1b4c30] avcodec decoder: Using NVIDIA VDPAU Driver Shared Library  510.108.03  Thu Oct 20 04:59:03 UTC 2022 for hardware decoding
[00007fe35c1b4c30] main decoder error: buffer deadlock prevented
[00007fe35c0042c0] dvdnav demux: Menu Languages available: ��
[00007fe35c0042c0] dvdnav demux: Menu Languages available: ��
[00007fe35c0042c0] dvdnav demux: Menu Languages available: ��
[00007fe3500015b0] main input error: ES_OUT_SET_(GROUP_)PCR  is called too late (jitter of 35228 ms ignored)
[00007fe35c0042c0] dvdnav demux: Menu Languages available: ��
[00007fe35c1b4c30] main decoder error: buffer deadlock prevented
[000055f012ee0e70] main audio output error: too low audio sample frequency (0)
[00007fe35c1b4c30] main decoder error: failed to create audio output
[000055f012ee0e70] main audio output error: too low audio sample frequency (0)
[00007fe35c1b4c30] main decoder error: failed to create audio output
[000055f012ee0e70] main audio output error: too low audio sample frequency (0)
[00007fe35c1b4c30] main decoder error: failed to create audio output
[00007fe344004fc0] gl gl: Initialized libplacebo v4.192.1 (API v192)
[00007fe344004fc0] gl gl: Initialized libplacebo v4.192.1 (API v192)
[00007fe35c1c69c0] avcodec decoder: Using NVIDIA VDPAU Driver Shared Library  510.108.03  Thu Oct 20 04:59:03 UTC 2022 for hardware decoding
QObject::~QObject: Timers cannot be stopped from another thread
dave@ubuntustudio2019:~$ vlc
VLC media player 3.0.16 Vetinari (revision 3.0.13-8-g41878ff4f2)
[0000564ce1080580] main libvlc: Running vlc with the default interface. Use 'cvlc' to use vlc without interface.
[0000564ce11203d0] main playlist: playlist is empty
[00007f948c003ec0] dvdnav demux: DVD Title: HOBBIT_BATTLE_OF_FIVE_ARMIES
[00007f948c003ec0] dvdnav demux: DVD Serial Number: 46435A1D
[00007f948c003ec0] dvdnav demux: DVD Title (Alternative): HOBBIT_BATTLE_OF_FIVE_ARMIES
[00007f948c003ec0] dvdnav demux: DVD disk reports itself with Region mask 0x00e50000. Regions: 02 04 05
[00007f948c003ec0] dvdnav demux: Attempting to retrieve all CSS keys
[00007f948c003ec0] dvdnav demux: This can take a _long_ time, please be patient
[00007f948c003ec0] dvdnav demux: Menu Languages available: ��
[00007f948c003ec0] dvdnav demux: Menu Languages available: ��
[00007f948c003ec0] dvdnav demux: Menu Languages available: ��
[00007f94740048b0] gl gl: Initialized libplacebo v4.192.1 (API v192)
libva info: VA-API version 1.14.0
libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/nvidia_drv_video.so
libva info: va_openDriver() returns -1
[00007f94740048b0] glconv_vaapi_x11 gl error: vaInitialize: unknown libva error
libva info: VA-API version 1.14.0
libva error: vaGetDriverNameByIndex() failed with unknown libva error, driver_name = (null)
[00007f94740048b0] glconv_vaapi_drm gl error: vaInitialize: unknown libva error
libva info: VA-API version 1.14.0
libva error: vaGetDriverNameByIndex() failed with unknown libva error, driver_name = (null)
[00007f94740048b0] glconv_vaapi_drm gl error: vaInitialize: unknown libva error
[00007f94740048b0] gl gl: Initialized libplacebo v4.192.1 (API v192)
[00007f94740048b0] gl gl: Initialized libplacebo v4.192.1 (API v192)
[00007f948c0687c0] main decoder error: buffer deadlock prevented
[0000564ce11580a0] main audio output error: too low audio sample frequency (0)
[00007f948c06e460] main decoder error: failed to create audio output
[00007f948c06e460] main decoder error: Timestamp conversion failed for 128389: no reference clock
[00007f948c06e460] main decoder error: Could not convert timestamp 0 for spdif
[0000564ce11580a0] main audio output error: too low audio sample frequency (0)
[00007f948c1c6c00] main decoder error: failed to create audio output
[00007f94740048b0] gl gl: Initialized libplacebo v4.192.1 (API v192)
[00007f94740048b0] gl gl: Initialized libplacebo v4.192.1 (API v192)
[00007f94740048b0] gl gl: Initialized libplacebo v4.192.1 (API v192)
[00007f94880015e0] main input error: ES_OUT_SET_(GROUP_)PCR  is called too late (pts_delay increased to 1000 ms)
[00007f94880015e0] main input error: ES_OUT_SET_(GROUP_)PCR  is called too late (pts_delay increased to 1162 ms)
[00007f94880015e0] main input error: ES_OUT_SET_(GROUP_)PCR  is called too late (pts_delay increased to 2083 ms)
[00007f94880015e0] main input error: ES_OUT_SET_(GROUP_)PCR  is called too late (jitter of 7128 ms ignored)
[00007f94880015e0] main input error: ES_OUT_SET_(GROUP_)PCR  is called too late (pts_delay increased to 4814 ms)
[00007f94880015e0] main input error: ES_OUT_SET_(GROUP_)PCR  is called too late (jitter of 21176 ms ignored)
[00007f94880015e0] main input error: ES_OUT_SET_(GROUP_)PCR  is called too late (pts_delay increased to 5954 ms)
[00007f948c003ec0] dvdnav demux: Menu Languages available: ��
[00007f948c003ec0] dvdnav demux: Menu Languages available: ��
[00007f948c0687c0] main decoder error: Timestamp conversion failed for 15493623: no reference clock
[00007f948c0687c0] main decoder error: Could not convert timestamp 0 for FFmpeg
[00007f948c1c6c00] main decoder error: Timestamp conversion failed for 15445623: no reference clock
[00007f948c1c6c00] main decoder error: Could not convert timestamp 0 for spdif
[00007f948c003ec0] dvdnav demux: Menu Languages available: ��
[00007f948c003ec0] dvdnav demux: Menu Languages available: ��
[00007f948c003ec0] dvdnav demux: Menu Languages available: ��
[00007f948c003ec0] dvdnav demux: Menu Languages available: ��
[00007f948c003ec0] dvdnav demux: Menu Languages available: ��
[00007f948c003ec0] dvdnav demux: Menu Languages available: ��
[00007f948c003ec0] dvdnav demux: Menu Languages available: ��
[00007f94740048b0] gl gl: Initialized libplacebo v4.192.1 (API v192)
[00007f94740048b0] gl gl: Initialized libplacebo v4.192.1 (API v192)
[00007f94740048b0] gl gl: Initialized libplacebo v4.192.1 (API v192)
[00007f948c06e460] main decoder error: buffer deadlock prevented
[00007f948c003ec0] dvdnav demux: Menu Languages available: ��
[00007f948c003ec0] dvdnav demux: Menu Languages available: ��
[00007f948c003ec0] dvdnav demux: Menu Languages available: ��
[00007f94880015e0] main input error: ES_OUT_SET_(GROUP_)PCR  is called too late (jitter of 14233 ms ignored)
[00007f948c003ec0] dvdnav demux: Menu Languages available: ��
[00007f948c06e460] main decoder error: buffer deadlock prevented
[0000564ce11580a0] main audio output error: too low audio sample frequency (0)
[00007f948c06e460] main decoder error: failed to create audio output
[0000564ce11580a0] main audio output error: too low audio sample frequency (0)
[00007f948c06e460] main decoder error: failed to create audio output
[0000564ce11580a0] main audio output error: too low audio sample frequency (0)
[00007f948c06e460] main decoder error: failed to create audio output
[00007f94740048b0] gl gl: Initialized libplacebo v4.192.1 (API v192)
[00007f94740048b0] gl gl: Initialized libplacebo v4.192.1 (API v192)
[00007f94740048b0] gl gl: Initialized libplacebo v4.192.1 (API v192)
[00007f94880015e0] main input error: ES_OUT_SET_(GROUP_)PCR  is called too late (jitter of 8362 ms ignored)
[00007f94880015e0] main input error: ES_OUT_SET_(GROUP_)PCR  is called too late (jitter of 6018 ms ignored)
[mpeg2video @ 0x7f947807e140] get_buffer() failed
[mpeg2video @ 0x7f947807e140] thread_get_buffer() failed
[mpeg2video @ 0x7f947807e140] get_buffer() failed (-12 (nil))
QObject::~QObject: Timers cannot be stopped from another thread
dave@ubuntustudio2019:~$ vlc
VLC media player 3.0.16 Vetinari (revision 3.0.13-8-g41878ff4f2)
[000055f657ac0580] main libvlc: Running vlc with the default interface. Use 'cvlc' to use vlc without interface.
[000055f657b603d0] main playlist: playlist is empty
[00007f5cf4007680] dvdnav demux: DVD Title: HOBBIT_BATTLE_OF_FIVE_ARMIES
[00007f5cf4007680] dvdnav demux: DVD Serial Number: 46435A1D
[00007f5cf4007680] dvdnav demux: DVD Title (Alternative): HOBBIT_BATTLE_OF_FIVE_ARMIES
[00007f5cf4007680] dvdnav demux: DVD disk reports itself with Region mask 0x00e50000. Regions: 02 04 05
[00007f5cf4007680] dvdnav demux: Attempting to retrieve all CSS keys
[00007f5cf4007680] dvdnav demux: This can take a _long_ time, please be patient
[00007f5cf4007680] dvdnav demux: Menu Languages available: ��
[00007f5cf4007680] dvdnav demux: Menu Languages available: ��
[00007f5cf4007680] dvdnav demux: Menu Languages available: ��
[00007f5ce40048b0] gl gl: Initialized libplacebo v4.192.1 (API v192)
libva info: VA-API version 1.14.0
libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/nvidia_drv_video.so
libva info: va_openDriver() returns -1
[00007f5ce40048b0] glconv_vaapi_x11 gl error: vaInitialize: unknown libva error
libva info: VA-API version 1.14.0
libva error: vaGetDriverNameByIndex() failed with unknown libva error, driver_name = (null)
[00007f5ce40048b0] glconv_vaapi_drm gl error: vaInitialize: unknown libva error
libva info: VA-API version 1.14.0
libva error: vaGetDriverNameByIndex() failed with unknown libva error, driver_name = (null)
[00007f5ce40048b0] glconv_vaapi_drm gl error: vaInitialize: unknown libva error
[00007f5ce40048b0] gl gl: Initialized libplacebo v4.192.1 (API v192)
[00007f5ce40048b0] gl gl: Initialized libplacebo v4.192.1 (API v192)
[00007f5cf4069960] main decoder error: buffer deadlock prevented
[000055f657b90e70] main audio output error: too low audio sample frequency (0)
[00007f5cf40682a0] main decoder error: failed to create audio output
[000055f657b90e70] main audio output error: too low audio sample frequency (0)
[00007f5cf41ca330] main decoder error: failed to create audio output
[00007f5ce40048b0] gl gl: Initialized libplacebo v4.192.1 (API v192)
[00007f5ce40048b0] gl gl: Initialized libplacebo v4.192.1 (API v192)
[00007f5ce40048b0] gl gl: Initialized libplacebo v4.192.1 (API v192)
QObject::~QObject: Timers cannot be stopped from another thread
dave@ubuntustudio2019:~$ vlc
VLC media player 3.0.16 Vetinari (revision 3.0.13-8-g41878ff4f2)
[000056435ab1b580] main libvlc: Running vlc with the default interface. Use 'cvlc' to use vlc without interface.
[000056435abbb3a0] main playlist: playlist is empty
[00007f112c001130] dvdnav demux: DVD Title: HOBBIT_BATTLE_OF_FIVE_ARMIES
[00007f112c001130] dvdnav demux: DVD Serial Number: 46435A1D
[00007f112c001130] dvdnav demux: DVD Title (Alternative): HOBBIT_BATTLE_OF_FIVE_ARMIES
[00007f112c001130] dvdnav demux: DVD disk reports itself with Region mask 0x00e50000. Regions: 02 04 05
[00007f112c001130] dvdnav demux: Attempting to retrieve all CSS keys
[00007f112c001130] dvdnav demux: This can take a _long_ time, please be patient
[00007f112c001130] dvdnav demux: Menu Languages available: ��
[00007f112c001130] dvdnav demux: Menu Languages available: ��
[00007f112c001130] dvdnav demux: Menu Languages available: ��
[00007f111c004490] gl gl: Initialized libplacebo v4.192.1 (API v192)
libva info: VA-API version 1.14.0
libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/nvidia_drv_video.so
libva info: va_openDriver() returns -1
[00007f111c004490] glconv_vaapi_x11 gl error: vaInitialize: unknown libva error
libva info: VA-API version 1.14.0
libva error: vaGetDriverNameByIndex() failed with unknown libva error, driver_name = (null)
[00007f111c004490] glconv_vaapi_drm gl error: vaInitialize: unknown libva error
libva info: VA-API version 1.14.0
libva error: vaGetDriverNameByIndex() failed with unknown libva error, driver_name = (null)
[00007f111c004490] glconv_vaapi_drm gl error: vaInitialize: unknown libva error
[00007f111c004490] gl gl: Initialized libplacebo v4.192.1 (API v192)
[00007f111c004490] gl gl: Initialized libplacebo v4.192.1 (API v192)
[00007f112c063690] main decoder error: buffer deadlock prevented
[000056435abf31e0] main audio output error: too low audio sample frequency (0)
[00007f112c1b16f0] main decoder error: failed to create audio output
[000056435abf31e0] main audio output error: too low audio sample frequency (0)
[00007f112c1a84e0] main decoder error: failed to create audio output
[00007f111c004490] gl gl: Initialized libplacebo v4.192.1 (API v192)
[00007f111c004490] gl gl: Initialized libplacebo v4.192.1 (API v192)
[00007f111c004490] gl gl: Initialized libplacebo v4.192.1 (API v192)
QObject::~QObject: Timers cannot be stopped from another thread
dave@ubuntustudio2019:~$ vlc
VLC media player 3.0.16 Vetinari (revision 3.0.13-8-g41878ff4f2)
[000055b33fc5e580] main libvlc: Running vlc with the default interface. Use 'cvlc' to use vlc without interface.
[000055b33fcfe3a0] main playlist: playlist is empty```

A: I was able to stop the stuttering on affected dvds by going into:-
Preferences (Advanced) > Input/Codecs > Advanced
and increasing all the caching settings to:-
File caching (ms): 10000
Live capture: 3000
Disc caching: 10000      < I think this is probably the only one that matters
Network caching: 10000
Clock reference: 40
Clock synchronisation: Default
Clock jitter: 5000
It now takes noticeably longer for videos to load (around 10s, naturally).
Not all of the errors are resolved, indeed vlc isn't looking too happy, but the stuttering problem is gone and dvds play. I'll paste some of the current errors below:-
VLC media player 3.0.16 Vetinari (revision 3.0.13-8-g41878ff4f2)
[000055eac3cbf580] main libvlc: Running vlc with the default interface. Use 'cvlc' to use vlc without interface.
[000055eac3d5f3a0] main playlist: playlist is empty
[00007f59f4001130] dvdnav demux: DVD Title: HOBBIT_BATTLE_OF_FIVE_ARMIES
[00007f59f4001130] dvdnav demux: DVD Serial Number: 46435A1D
[00007f59f4001130] dvdnav demux: DVD Title (Alternative): HOBBIT_BATTLE_OF_FIVE_ARMIES
[00007f59f4001130] dvdnav demux: DVD disk reports itself with Region mask 0x00e50000. Regions: 02 04 05
[00007f59f4001130] dvdnav demux: Attempting to retrieve all CSS keys
[00007f59f4001130] dvdnav demux: This can take a _long_ time, please be patient
[00007f59f4001130] dvdnav demux: Menu Languages available: ��
[00007f59f4001130] dvdnav demux: Menu Languages available: ��
[00007f59f4001130] dvdnav demux: Menu Languages available: ��
[00007f59f0004ba0] gl gl: Initialized libplacebo v4.192.1 (API v192)
libva info: VA-API version 1.14.0
libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/nvidia_drv_video.so
libva info: va_openDriver() returns -1
[00007f59f0004ba0] glconv_vaapi_x11 gl error: vaInitialize: unknown libva error
libva info: VA-API version 1.14.0
libva error: vaGetDriverNameByIndex() failed with unknown libva error, driver_name = (null)
[00007f59f0004ba0] glconv_vaapi_drm gl error: vaInitialize: unknown libva error
libva info: VA-API version 1.14.0
libva error: vaGetDriverNameByIndex() failed with unknown libva error, driver_name = (null)
[00007f59f0004ba0] glconv_vaapi_drm gl error: vaInitialize: unknown libva error
[00007f59f0004ba0] gl gl: Initialized libplacebo v4.192.1 (API v192)
[00007f59f0004ba0] gl gl: Initialized libplacebo v4.192.1 (API v192)
[00007f59f4065320] main decoder error: buffer deadlock prevented
[000055eac3d971b0] main audio output error: too low audio sample frequency (0)
[00007f59f41b11a0] main decoder error: failed to create audio output
[000055eac3d971b0] vlcpulse audio output error: digital pass-through stream connection failure: Device or resource busy
[000055eac3d971b0] main audio output error: module not functional
[00007f59f41b11a0] main decoder error: failed to create audio output
[00007f59f41b11a0] main decoder error: Timestamp conversion failed for 128389: no reference clock
[00007f59f41b11a0] main decoder error: Could not convert timestamp 0 for FFmpeg
[000055eac3d971b0] main audio output error: too low audio sample frequency (0)
[00007f59f404fc00] main decoder error: failed to create audio output
[000055eac3d971b0] vlcpulse audio output error: digital pass-through stream connection failure: Device or resource busy
[000055eac3d971b0] main audio output error: module not functional
[00007f59f404fc00] main decoder error: failed to create audio output
[00007f59f0004ba0] gl gl: Initialized libplacebo v4.192.1 (API v192)
[00007f59f0004ba0] gl gl: Initialized libplacebo v4.192.1 (API v192)
[00007f59f0004ba0] gl gl: Initialized libplacebo v4.192.1 (API v192)
[00007f59f4001130] dvdnav demux: Menu Languages available: ��
[00007f59f4001130] dvdnav demux: Menu Languages available: ��
[00007f59f4001130] dvdnav demux: Menu Languages available: ��
[00007f59f4001130] dvdnav demux: Menu Languages available: ��
[00007f59f4001130] dvdnav demux: Menu Languages available: ��
[00007f59f4001130] dvdnav demux: Menu Languages available: ��
[00007f59f4001130] dvdnav demux: Menu Languages available: ��
[00007f59f4001130] dvdnav demux: Menu Languages available: ��
[00007f59f0004ba0] gl gl: Initialized libplacebo v4.192.1 (API v192)
[00007f59f0004ba0] gl gl: Initialized libplacebo v4.192.1 (API v192)
[00007f59f0004ba0] gl gl: Initialized libplacebo v4.192.1 (API v192)
[00007f59f41b11a0] main decoder error: buffer deadlock prevented
[00007f59f4001130] dvdnav demux: Menu Languages available: ��
[00007f59f4001130] dvdnav demux: Menu Languages available: ��
[00007f59f4001130] dvdnav demux: Menu Languages available: ��
[00007f5a040009a0] main input error: ES_OUT_SET_(GROUP_)PCR  is called too late (pts_delay increased to 10000 ms)
[00007f59f4001130] dvdnav demux: Menu Languages available: ��
[00007f59f41b11a0] main decoder error: buffer deadlock prevented
[000055eac3d971b0] main audio output error: too low audio sample frequency (0)
[00007f59f41b11a0] main decoder error: failed to create audio output
[000055eac3d971b0] vlcpulse audio output error: digital pass-through stream connection failure: Device or resource busy
[000055eac3d971b0] main audio output error: module not functional
[00007f59f41b11a0] main decoder error: failed to create audio output
[000055eac3d971b0] main audio output error: too low audio sample frequency (0)
[00007f59f41b11a0] main decoder error: failed to create audio output
[000055eac3d971b0] vlcpulse audio output error: digital pass-through stream connection failure: Device or resource busy
[000055eac3d971b0] main audio output error: module not functional
[00007f59f41b11a0] main decoder error: failed to create audio output
[000055eac3d971b0] main audio output error: too low audio sample frequency (0)
[00007f59f41b11a0] main decoder error: failed to create audio output
[000055eac3d971b0] vlcpulse audio output error: digital pass-through stream connection failure: Device or resource busy
[000055eac3d971b0] main audio output error: module not functional
[00007f59f41b11a0] main decoder error: failed to create audio output
[00007f59f0004ba0] gl gl: Initialized libplacebo v4.192.1 (API v192)
[00007f59f0004ba0] gl gl: Initialized libplacebo v4.192.1 (API v192)
[00007f59f0004ba0] gl gl: Initialized libplacebo v4.192.1 (API v192)
QObject::~QObject: Timers cannot be stopped from another thread
dave@ubuntustudio2019:~$ vlc
VLC media player 3.0.16 Vetinari (revision 3.0.13-8-g41878ff4f2)
[00005561349da580] main libvlc: Running vlc with the default interface. Use 'cvlc' to use vlc without interface.
[0000556134a7a3a0] main playlist: playlist is empty


text:
Q: Jolt grouping together I have this input in JSON, I am having difficulty grouping things together:
[
    {
        "PK": "123",
        "SURNAME": "CHEN",
        "SEX": "F",
        "DATE_OF_BIRTH": "1962-08-29 00:00:00.0",
        "PHONE_TYPE": "05",
        "PHONE_NO": "12312312",
        "OPERATION": "INSERT",
    }, {
        "PK": "123",
        "SURNAME": "CHEN",
        "SEX": "F",
        "DATE_OF_BIRTH": "1962-08-29 00:00:00.0",
        "PHONE_TYPE": "04",
        "PHONE_NO": "78787878",
        "OPERATION": "UPDATE"
    },{
        "PK": "456",
        "SURNAME": "DEV",
        "SEX": "M",
        "DATE_OF_BIRTH": "1953-06-06 00:00:00.0",
        "PHONE_TYPE": "05",
        "PHONE_NO": "34343434",
        "OPERATION": "INSERT"
    }, {
        "CLIENT_ID": "456",
        "SURNAME": "DEV",
        "SEX": "M",
        "DATE_OF_BIRTH": "1953-06-06 00:00:00.0",
        "PHONE_TYPE": "02",
        "PHONE_NO": "56565656",
        "OPERATION": "DELETE",
    }
]

And this is the expected output:
{
    "Customers": [{
            "MatchingProfile": {
                "CustomerNumber": "", // leave blank
                "DBType": "Oracle",
                "DBKey": "123",
                "LastName": "CHEN",
                "Gender": "Female",
                "Birthdate": "1962-08-29",
            },
            "Contacts": [{
                    "ContactType": "Fax",
                    "CountryCode": "", // leave blank
                    "Phone_Number": "12312312",
                    "Status": "Active"
                }, {
                    "ContactType": "Mobile",
                    "CountryCode": "", // leave blank
                    "PhoneNumber": "78787878",
                    "Status": "Active"
                }
            ]
        },{
            "MatchingProfile": {
                "CustomerNumber": "", // leave blank
                "DBType": "Oracle",
                "DBKey": "456",
                "LastName": "DEV",
                "Gender": "Male",
                "Birthdate": "1953-06-06",
            },
            "Contacts": [{
                    "ContactType": "Fax",
                    "CountryCode": "", // leave blank
                    "PhoneNumber": "34343434",
                    "Status": "Active"
                }, {
                    "ContactType": "Office",
                    "CountryCode": "", // leave blank
                    "PhoneNumber": "56565656",
                    "Status": "Inactive"
                }
            ]
        }
    ]
}

The SEX from input is "M", "F", plus some other coded values. Corresponding values for the output Gender is "Male", "Female" and left "" (blank) otherwise. (Don't accuse me of being gender-biased, I know, this is a project requirement, okay? Not my call)
The OPERATION from input that is "INSERT" and "UPDATE" will be a corresponding Status: "Active" ; for "DELETE" it will be Status : "Inactive".
Plus the Birthdate output is truncated equivalent of DATE_OF_BIRTH, minus the time.
The PHONE_TYPE are the following: 02 - "Office", 04 - "Mobile", 05 - "Fax" (I purposedly left out the others).
Is it possible to have a mapping for this in Jolt? Can you show a spec? I'm new with Jolt and I am bit confused. This is 10x harder than Excel Pivot.

A: This is pretty much as close as OOTB Jolt can get.   Note Jolt is for changing the structure of your data, not doing custom data mappings of things like "PHONE_TYPE": "04" means "Fax".
Transformed Output
{
  "Customers" : [ {
    "MatchingProfile" : {
      "DBKey" : "123",
      "Gender" : "F",
      "LastName" : "CHEN",
      "Birthdate" : "1962-08-29 00:00:00.0",
      "Contacts" : [ {
        "ContactType" : "05",
        "Phone_Number" : "12312312",
        "Status" : "INSERT"
      }, {
        "ContactType" : "04",
        "Phone_Number" : "78787878",
        "Status" : "UPDATE"
      } ]
    }
  }, {
    "MatchingProfile" : {
      "DBKey" : "456",
      "Gender" : "M",
      "LastName" : "DEV",
      "Birthdate" : "1953-06-06 00:00:00.0",
      "Contacts" : [ {
        "ContactType" : "05",
        "Phone_Number" : "34343434",
        "Status" : "INSERT"
      }, {
        "ContactType" : "02",
        "Phone_Number" : "56565656",
        "Status" : "DELETE"
      } ]
    }
  } ]
}

Jolt Spec
[
  // first pivot by the value of SURNAME
  {
    "operation": "shift",
    "spec": {
      "*": { // for each item in the array
        "SURNAME": { // match SURNAME
          "*": { // match any value of SURNAME
            "@2": "&[]" // copy the whole record from 2 levels up to the SURNAME as an array, so we know that in the next step it is always an array
          }
        }
      }
    }
  },
  {
    "operation": "shift",
    "spec": {
      "*": { // match CHEN or DEV
        "0": {
          // only pull pk, sex, dob from the first entry of the SURNAME array so as to not duplicate output
          "PK": "Customers[#3].MatchingProfile.DBKey",
          "SEX": "Customers[#3].MatchingProfile.Gender",
          "SURNAME": "Customers[#3].MatchingProfile.LastName",
          "DATE_OF_BIRTH": "Customers[#3].MatchingProfile.Birthdate",

          // this does mean that the PHONE_TYPE has to be dealt with twice
          // once for the zeroth item, and then once again for the rest
          "PHONE_TYPE": "Customers[#3].MatchingProfile.Contacts[0].ContactType",
          "PHONE_NO": "Customers[#3].MatchingProfile.Contacts[0].Phone_Number",
          "OPERATION": "Customers[#3].MatchingProfile.Contacts[0].Status"
        },
        "*": {
          // handle PHONE_TYPE and friends for the other records
          "PHONE_TYPE": "Customers[#3].MatchingProfile.Contacts[&1].ContactType",
          "PHONE_NO": "Customers[#3].MatchingProfile.Contacts[&1].Phone_Number",
          "OPERATION": "Customers[#3].MatchingProfile.Contacts[&1].Status"
        }
      }
    }
  }
]

If if you find Jolt valuable for the pivot and the structure change, then your best bet is to "fixup" your input data array, aka map "PHONE_TYPE": "04" to "Fax", trim the 00:00:00 from the birthday, and then use Jolt to make the nested "Customers[].MatchingProfile.Contacts[]" structure.


text:
Q: select() on STDIN and Incoming Socket I'm trying to write a very basic chat client in C which communicates with another machine using sockets, and I'm having some issues with understanding select. Here's a quick snippet of the relevant code.
while(1)
  {
    FD_ZERO(&readfds);
    FD_ZERO(&writefds);

    FD_SET(STDIN, &writefds);
    FD_SET(connectFD, &readfds);

    select(connectFD+1, &readfds, &writefds, NULL, NULL);

    if(FD_ISSET(connectFD, &readfds) != 0)
    {
      char buf[1024];
      memset(buf, 0, sizeof(buf));
      int lastBit;

      lastBit = recv(connectFD, buf, sizeof(buf), 0);
      if (lastBit > 0 && lastBit < 1024)
      {
        buf[lastBit] = '\0';
      }
      else
      {
        close(connectFD);
        break;
      }
      printf("%s\n", buf);
    }

    else if (FD_ISSET(STDIN, &writefds))
    {
      char msg[1024];
      memset(msg, 0, sizeof(msg));
      read(STDIN, msg, sizeof(msg));
    }
  }
}

What I'm looking to do is have incoming messages processed as soon as they arrive, and only have outgoing messages sent after I hit ENTER, but what I have now only processes incoming data after I hit ENTER instead of immediately. I assume it's because read is a blocking call and select is returning when there's ANY data in the buffer, not just when there's a newline (which is when read returns), but I don't know how to process this otherwise. Any advice or tips for leading me down the right path?
Thank you guys so much!

A:
FD_SET(STDIN, &writefds);

You want to read from STDIN so you should add STDIN to the &readfds and not &writefds. Writing to STDIN is almost always possible so your code effectively got the information that writing is possible to STDIN but then attempts to read from STDIN and hangs there until the read actually gets possible.


text:
Q: Powershell - Move files in different folders every hour Trying to move images from one folder into another folder but this needs to be scheduled every hour moving a chunk at a time, I've got the images chunked into folders with 1000 images in each folder.
Folder structure;

tobemoved\1
tobemoved\2
tobemoved\3
tobemoved\4

[etc.. up to 66]

These files are being moved into a single folder on the network \\images\web\upload
Is it possible to achieve this with a Powershell script, or any suggestions of an easy way to do this?

A: I wouldn't use Sleep as mentioned in the comments, this would mean you have a single long-running script with minimal option to recover from failure. If the script crashes, no more copy actions happen until it's re-launched.
instead, use Task Scheduler to run the script every hour. It's purpose built to run tasks on a schedule and has options to deal with failure and re-running.
Each task is run in its own process, so if the previous task fails it doesn't affect the next task - which still runs as normal.

No need to batch the images into folders, you can use Select-Object to do this for you.
Get-ChildItem C:\folder\source -File -Recurse | Select-Object -First 1000 | Move-Item -Destination \\images\web\upload -WhatIf

This will select the first 1000 files by name and path:

C:\folder\source\imageA.jpg
C:\folder\source\imageB.jpg
C:\folder\source\folderA\imageF.jpg
C:\folder\source\folderA\imageE.jpg
C:\folder\source\folderB\imageD.jpg
C:\folder\source\folderC\imageC.jpg

And move them all into the folder \\images\web\upload:

\\images\web\upload\imageA.jpg
\\images\web\upload\imageB.jpg
\\images\web\upload\imageC.jpg
\\images\web\upload\imageD.jpg
[etc]

Note: This assumes you're using a modern version of Powershell as the -File param isn't available in earlier versions.