text:
Q: Microsoft.Jet.OLEDB.4.0 can not read the file name with Azure App service On  Azure App service,  my application use Microsoft.Jet.OLEDB.4.0 to read my file with japanese file name. It worked well until 2017/09/21, but it throw exception from 2017/09/22. It only read file without japanese file name.
If to read one with japanese file name, it throw exceptions are as follows
System.Data.OleDb.OleDbCommand.ExecuteCommandTextErrorHandling(OleDbHResult hr)
 at System.Data.OleDb.OleDbCommand.ExecuteCommandTextForSingleResult(tagDBPARAMS dbParams, Object& executeResult)
 at System.Data.OleDb.OleDbCommand.ExecuteCommandText(Object& executeResult)
 at System.Data.OleDb.OleDbCommand.ExecuteCommand(CommandBehavior behavior, Object& executeResult)
 at System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehavior behavior, String method)
 at System.Data.OleDb.OleDbCommand.ExecuteReader(CommandBehavior behavior)
 at System.Data.OleDb.OleDbCommand.System.Data.IDbCommand.ExecuteReader(CommandBehavior behavior)
 at System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)
 at System.Data.Common.DbDataAdapter.Fill(DataTable[] dataTables, Int32 startRecord, Int32 maxRecords, IDbCommand command, CommandBehavior behavior)
 at System.Data.Common.DbDataAdapter.Fill(DataTable dataTable)
I asked Microsoft support site, but no useful answer.
Has my codes some wrong  ?
my code:
   public static DataTable readCSV(string filePath)
    {
        DataTable dt = new DataTable();
        if (File.Exists(filePath) == false)
        {
            return dt;
        }

        string header = "No";
        string pathOnly = Path.GetDirectoryName(filePath);
        string fileName = Path.GetFileName(filePath);

        FileInfo fInfo = new FileInfo(filePath);
        FileInfo dinfo = new FileInfo(pathOnly);
        if (dinfo.IsReadOnly)
        {
            dinfo.IsReadOnly = false;
        }

        if (fInfo.IsReadOnly)
        {
            fInfo.IsReadOnly = false;
        }
        var encoding = Encoding.GetEncoding(932);
        using (StreamReader reader = new StreamReader(filePath, Encoding.GetEncoding(932), true))
        {
            reader.Peek(); // you need this!
            encoding = reader.CurrentEncoding;
        }
        string sql = @"SELECT * FROM [" + fileName + "]";

        using (OleDbConnection connection = new OleDbConnection(
                  @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + pathOnly +
                  ";Extended Properties=\"Text;IMEX=1;CharacterSet=" + encoding.CodePage + ";HDR=" + header + "\""))
        using (OleDbCommand command = new OleDbCommand(sql, connection))
        using (OleDbDataAdapter adapter = new OleDbDataAdapter(command))
        {
            DataTable dataTable = new DataTable();
            dataTable.Locale = CultureInfo.CurrentCulture;
            adapter.Fill(dataTable);

            return dataTable;
        }
    }

A: This might be caused by Windows security update KB4041681. At https://social.technet.microsoft.com/Forums/en-US/55b1d633-b715-491e-917e-b7cb01ae0523 several people have reported that uninstalling that update has solved their problems. Another solution is to use the Microsoft.ACE.OLEDB.12.0 driver instead of of Microsoft.Jet.OLEDB.4.0.


text: Q: Converting Month, Date, Year to FILETIME Is there any function that converts a Month, Day, Year combination (e.g., "March 21, 2009"), to FILETIME? I don't mind doing it manually using a SYSTEMTIME, but anything Windows provides will be better than what I do.  Thanks for any info.

redpajama_set_name: RedPajamaStackExchange


text:
Q: super allocWithZone having some doubts in singleton class concept I am new in Objective-C and I am trying to create a singleton class based on Apple's documentation.
+ (MyGizmoClass*)sharedManager
{
    if (sharedGizmoManager == nil) {
        sharedGizmoManager = [[super allocWithZone:NULL] init];
    }
    return sharedGizmoManager;
}

+ (id)allocWithZone:(NSZone *)zone
{
    return [[self sharedManager] retain];
}

In this code sharedManager is a static method which will check if object of this class is present. If so it will return the previous created object, otherwise it create a new one.
I have some questions:

*

*If sharedManager is static, how can it to access super?

*When I print [super class] why does it give the current class name?

*Why does [[super allocWithZone:NULL] init] is return the current class object?

*If super is equal to self here than why its not calling current class's allocWithZone:(NSZone *)zone?

A: There is a couple of things to consider here. First, the Cocoa Fundamentals guide is somewhat out-of date. It doesn't take into account some of the current technologies Apple has developed, like Grand Central Dispatch, and Automated Reference Counting. The [retain] in your allocWithZone method would not compile correctly in a ARC-enabled project (since you're new to Obj-C, I'm making an assumption here you're new to iOS/iPhone as well, and so you should read up on those two technologies).
There is a very good discussion of different singleton design patterns over in this thread:
What should my Objective-C singleton look like?
However that is an older thread, and as such does not take into account Automated Reference Counting (I've utilized Louis Gerbang's answer for years and it no longer works in ARC-enabled projects).
For ARC-enabled projects/files (yes ARC can be enabled just for single files) - we've moved to a singleton that uses GCD and works quite well:
static YourClassName * volatile sharedInstance = nil;

+ (YourClassName *)sharedInstance
{
    static dispatch_once_t sharedInstanceToken;
    dispatch_once(&sharedInstanceToken, ^{
        sharedInstance = [[YourClassName alloc] init];
    });
    return sharedInstance;
}

What's going on here? Well if you take a look through the GCD docs, you'll see dispatch_once only gets executed once during the entire lifetime of an application for a particular object. As the docs go onto say, this makes it very useful for creating singletons in a thread-safe manner.
On top of that, we declare the sharedInstance method as volatile, meaning the compiler/runtime should never try to cache a call to the method and should always execute the code inside. This makes sure we always call into GCD and that we always get back the object we're supposed to.
I'm glossing over a bunch since you're new to Obj-C, but definetly take a look into GCD, ARC, and then once you've got a solid grounding in Obj-C, looking into IMP caching, which is what volatile is preventing from happening.

A: The other answers, though they point out good information with regard to singletons, didn't actually answer your question. Your question is actually mostly based on Object orientation, the fact that you specifically reference a singleton is incidental.

*

*I answered this question with reference to self, here is the paraphrased, important part of the answer

super does have meaning in class level contexts, but it refers to the superclass itself, not an instance

*This one was throwing me off too. I asked this question and it was concluded:

[super class] calls the super method on the current instance (i.e. self). If self had an overridden version, then it would be called and it would look different. Since you don't override it, calling [self class] is the same as calling [super class].

*Are you sure it's actually returning an instance of this class? Or are you assigning it to an instance sharedGizmoManager of this class?

*Super isn't equal to self, but some of the methods you have called: e.g. [super class] is calling the same implementation of the method that [self class] would call.

A: (1.) What is super in a 'static function'? In Objective-C, +methods are properly called class methods, -methods are called instance methods. These +methods are not true static methods because Objective-C classes are themselves objects of an opaque type called Class. So both super and self are defined in +methods. super sends messages to the superclass of MyGizmoClass, but when called from a +method super looks for an equivalent +method, and when called from an -method super looks for a corresponding -method.self in +methods of MyGizmoClass returns MyGizmoClass which is a Class, whereas in -methods self is a pointer to a MyGizmoClass instance.
(2.) The method +class returns self.isa. Yes [super class] invokes the superclass's:+class method, however, when self is passed up to +methods neither its value nor its type are modified (whereas self's type is cast to the superclass when it is passed up through -methods). So when an implementation of the +class method up the chain asks for self.isa, it gets the same value, MyGizmoClass. To be certain, you can verify that super does call +class in superclasses by deriving MyGizmoClass from a MyGizmoSuperClass where you can place an override:
    @interface MyGizmoSuperClass : NSObject
    @end
    @implementation MyGizmoSuperClass
    +(Class) class {
        NSLog(@"yes it calls MyGizmoSuperClass:class");
        return [super class];
    }
    @end
    @interface MyGizmoClass : MyGizmoSuperClass
    +(Class) classviasuper;
    @end
    @implementation MyGizmoClass
    +(Class) classviasuper {
        return [super class]; //which version of class will super call?
    }
    @end
    int main(int argc, char *argv[])
    {
       NSLog(@"returned %@",[MyGizmoClass classviasuper]);
    }

prints

yes it calls MyGizmoSuperClass:class
    returned MyGizmoClass

(3.) Again super calls the superclass version of allocWithZone but the self value passed to the method still points to a MyGizmoClass, and since allocWithZone returns an object of the receiver's class, you get a MyGizmoClass back.
(4.) You can easily verify super is different to self. If you implement [self allocWithZone:NULL] your code will call MyGizmoClass's implementation of allocWithZone and loop indefinitely. With [super allocWithZone:NULL], the superclass's version gets called.


text:
Q: WPF UI is not updating I have developed a simple wpf application using MVVM model and code as below.I debug the code and found that collection is updating but UI is not updating even I don't see any record in listbox.
EDIT

<Window x:Class="Model.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="WPF Dispatcher Demo" Height="350" Width="525">

    <DockPanel>
        <Grid DockPanel.Dock="Bottom">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="2*" Name="col0" />
                <ColumnDefinition Width="*" />
            </Grid.ColumnDefinitions>
            <TextBox Name="textBlock1" Text="{Binding ShowPath}"
                 VerticalAlignment="Center" HorizontalAlignment="Left"
                  Margin="30" Grid.Column="0" />
            <Button Name="FindButton" Content="Select Path"
              Width="100" Margin="20" Click="FindButton_Click" Grid.Column="1" />
        </Grid>
        <ListBox Name="listBox1"  ItemsSource="{Binding Path=Files}"/>

    </DockPanel>
</Window>

Model
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Windows.Threading;
using System.ComponentModel;
using System.Collections.ObjectModel;

namespace Model
{
    public class DirectorySearchModel : INotifyPropertyChanged
    {
        private ObservableCollection<string> _files = new ObservableCollection<string>();
        private string _showPath;
        public DirectorySearchModel() { }
        void ShowCurrentPath(string path)
        {
            ShowPath = path;
        }

        void AddFileToCollection(string file)
        {
            _files.Add(file);
        }
        public void Search(string path, string pattern)
        {

            if (System.Windows.Application.Current.Dispatcher.CheckAccess())
                ShowPath = path;
            else
                System.Windows.Application.Current.Dispatcher.Invoke(
                  new Action<string>(ShowCurrentPath), DispatcherPriority.Background, new string[] { path }
                );
            string[] files = Directory.GetFiles(path, pattern);
            foreach (string file in files)
            {
                if (System.Windows.Application.Current.Dispatcher.CheckAccess())
                    Files.Add(file);
                else
                    System.Windows.Application.Current.Dispatcher.Invoke(new Action<string>(AddFileToCollection), DispatcherPriority.Background,
                      new string[] { file }
                    );
            }
            string[] dirs = System.IO.Directory.GetDirectories(path);
            foreach (string dir in dirs)
                Search(dir, pattern);
        }

        public string ShowPath
        {
            get
            {
                return _showPath;
            }
            set
            {
                _showPath = value;
                OnPropertyChanged("ShowPath");
            }
        }
        public ObservableCollection<string> Files
        {
            get
            {
                return _files;
            }
            set
            {
                _files = value;
                OnPropertyChanged("Files");
            }
        }
        public void OnPropertyChanged(string name)
        {
            if (PropertyChanged != null)
            {
                PropertyChanged(this, new PropertyChangedEventArgs(name));

            }
        }
        public event PropertyChangedEventHandler PropertyChanged;
    }
}

MainWindow.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Windows.Forms;
using System.IO;

namespace Model
{
    public partial class MainWindow : Window
    {
        IAsyncResult cbResult;
        public MainWindow()
        {
            InitializeComponent();
            this.Loaded += new RoutedEventHandler(MainWindow_Loaded);

        }
        void MainWindow_Loaded(object sender, RoutedEventArgs e)
        {
            this.DataContext = new DirectorySearchModel().Files;
        }

        private void FindButton_Click(object sender, RoutedEventArgs e)
        {

            FolderBrowserDialog dlg = new FolderBrowserDialog();
            string path = AppDomain.CurrentDomain.BaseDirectory;
            dlg.SelectedPath = path;
            DialogResult result = dlg.ShowDialog();
            if (result == System.Windows.Forms.DialogResult.OK)
            {
                path = dlg.SelectedPath;
                string pattern = "*.*";
                new Model.DirectorySearchModel().Search(path, pattern);
                Action<string, string> proc = new Model.DirectorySearchModel().Search;
                cbResult = proc.BeginInvoke(path, pattern, null, null);

            }
        }
    }
}

A: In WPF, there are two layers: the UI layer and the Data Layer
The Data Layer is your DataContext, and when you write a normal binding, you are binding to the DataContext.
When you write
void MainWindow_Loaded(object sender, RoutedEventArgs e)
{
    this.DataContext = new DirectorySearchModel().Files;
}

you are telling WPF that the data layer for the form is going to be an ObservableCollection of strings, however ObservableCollection<string> does not have a property called Files, so your ListBox binding is failing.
<!-- Trying to bind to DirectorySearchModel.Files.Files -->
<ListBox ItemsSource="{Binding Path=Files}"/>

You need to change your data layer to your DirectorySearchModel instead, so the binding correctly evaluates to DirectorySearchModel.Files
void MainWindow_Loaded(object sender, RoutedEventArgs e)
{
    this.DataContext = new DirectorySearchModel();
}

But this isn't your only problem. Your Button's Click event operates on a new instance of DirectorySearchModel instead of the existing one.
You could simply use (DirectorySearchModel)MainWindow.DataContext, but this isn't ideal because it tightly combines your UI and your data layers closely together, and it makes the assumption that the DataContext will always be of type DirectorySearchModel.
You could store the DirectorySearchModel used for the DataContext somewhere like moncadad suggested so you can access it from somewhere else in your code:
DirectorySearchModel _model = new DirectorySearchModel();
void MainWindow_Loaded(object sender, RoutedEventArgs e)
{
    _model = new DirectorySearchModel();
    this.DataContext = _model ;
}

private void FindButton_Click(object sender, RoutedEventArgs e)
{
    // use _model instead of "new DirectorySearchModel()" here
}

But honestly this still isn't ideal because your View and your Data layers are still tightly coupled together, and this isn't compliant with the MVVM design pattern (which you've tagged your question with, so I'm assuming you're using).
The best solution is to actually replace your button's Click event with an ICommand on the DirectorySearchModel so you don't have to worry about storing and accessing a copy of your data layer from your UI layer. This also has the added benefit of keeping application logic inside the application layer, instead of mixing it in with the UI layer:
void MainWindow_Loaded(object sender, RoutedEventArgs e)
{
    this.DataContext = new DirectorySearchModel();
}

<DockPanel>
    <Grid DockPanel.Dock="Bottom">
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="2*" Name="col0" />
            <ColumnDefinition Width="*" />
        </Grid.ColumnDefinitions>

        <TextBox Text="{Binding ShowPath}" ... />

        <Button Content="Select Path" Command="FindButtonCommand" ... />
    </Grid>
    <ListBox ItemsSource="{Binding Path=Files}"/>
</DockPanel>

This correctly separates your UI from your Data layer, which is the primary goal of the MVVM design pattern.
This way, your application logic all stays inside your application objects, while your UI becomes just a pretty user-friendly interface that is used to interact with your application objects.
I like to write beginner WPF articles, and I'd suggest reading my post What is this "DataContext" you speak of? to understand what the DataContext is and how it works a bit better :)

A: You have:
    this.DataContext = new DirectorySearchModel().Files;
and this:
    <ListBox Name="listBox1"  ItemsSource="{Binding Path=Files}"/>
Which means it will try to bind to DirectorySearchModel().Files.Files.  You probably want to change to this: this.DataContext = new DirectorySearchModel();

A: ** Edit **
I was staring blind :)
You're not reusing your model:
This works, I just tested it
    private DirectorySearchModel model = new DirectorySearchModel();

    public MainWindow()
    {
        InitializeComponent();
        this.Loaded += new RoutedEventHandler(MainWindow_Loaded);

    }
    void MainWindow_Loaded(object sender, RoutedEventArgs e)
    {
        this.DataContext = model; //The model is already available as private member
    }

    private void FindButton_Click(object sender, RoutedEventArgs e)
    {

        FolderBrowserDialog dlg = new FolderBrowserDialog();
        string path = AppDomain.CurrentDomain.BaseDirectory;
        dlg.SelectedPath = path;
        DialogResult result = dlg.ShowDialog();
        if (result == System.Windows.Forms.DialogResult.OK)
        {
            path = dlg.SelectedPath;
            string pattern = "*.*";
            Action<string, string> proc = model.Search; // use existing model (the private member).
            cbResult = proc.BeginInvoke(path, pattern, null, null);

        }
    }

In Xaml put this:
<ListBox ItemsSource="{Binding Path=Files}"/>

A: In your MainWindow.cs, change to:
public partial class MainWindow : Window
{
    IAsyncResult cbResult;
    DirectorySearchModel _model = new DirectorySearchModel();
    public MainWindow()
    {
        InitializeComponent();
        this.DataContext = _model;
    }
...

In your Xaml, update your binding to:
<ListBox Name="listBox1"  ItemsSource="{Binding Files, UpdateSourceTrigger="PropertyChanged"}"/>

A: You have to set the DataContext of your window to a new instance of DirectorySearchModel. it is not updating because your ListBox inherited the DataContext of the window which is set to the Files property. Your listbox is looking for the Files Property of the Files Collection which does not exists.
You can use this Code
public MainWindow()
{
   this.DataContext = new DirectorySearchModel();
}

this way your list box will have a datacontext of a new directory search model and will be looking for the Files property which you had specify on the Path property of the ItemSource Binding.
UPDATE:
    private void FindButton_Click(object sender, RoutedEventArgs e)
    {

        FolderBrowserDialog dlg = new FolderBrowserDialog();
        string path = AppDomain.CurrentDomain.BaseDirectory;
        dlg.SelectedPath = path;
        DialogResult result = dlg.ShowDialog();
        if (result == System.Windows.Forms.DialogResult.OK)
        {
            path = dlg.SelectedPath;
            string pattern = "*.*";
            //OLD CODE
            //new Model.DirectorySearchModel().Search(path, pattern);
            //SUGGESTION
            (this.DataContext AS DirectorySearchModel).Search(path, pattern);
            Action<string, string> proc = (this.DataContext AS DirectorySearchModel).Search;
            cbResult = proc.BeginInvoke(path, pattern, null, null);

        }
    }


text:
Q: Calling g_signal_connect in a callback in a Qt thread It seems that if I call g_signal_connect in a callback function that is registered in a Qt thread, then the callback function registered by that g_signal_connect is not called. For example, using the first uncommented main in this code, udp_source_timeout_callback is not called, but it is called if I use the commented out main instead. The callbacks registered in the run method are called in both cases. Why is this?
EDIT: Is this a bad approach? Should I not be registering callback functions inside of callback functions? I'm not sure of another way to do this.
acquisitiontype.h
#ifndef ACQUISITIONTYPE_H
#define ACQUISITIONTYPE_H

#include <QObject>

class AcquisitionType : public QObject
{
    Q_OBJECT

public:
    explicit AcquisitionType(QObject *parent = nullptr);

public slots:
    void run();
};

#endif // ACQUISITIONTYPE_H

main.cpp
#include <gst/gst.h>
#include <gst/app/gstappsink.h>

#include <cstdlib>
#include <cstdio>

#include <QApplication>
#include <QThread>

#include "acquisitiontype.h"

struct gstreamer_data {
    GstElement* pipeline;
    GstElement* udp_source;
    GstElement* rtp_decoder;
    GstElement* video_decoder;
    GstElement* video_converter;
    GstElement* app_sink;
    gulong signal_handler_id;
    GMainLoop* main_loop;
};

AcquisitionType::AcquisitionType(QObject *parent) : QObject(parent) {
}

GstPadProbeReturn udp_source_buffer_pad_probe_callback(GstPad* pad, GstPadProbeInfo *info, gstreamer_data* user_data);
void udp_source_timeout_callback(GstBus* bus, GstMessage* message, gstreamer_data* data);

GstFlowReturn new_sample_callback(GstAppSink* appsink, gstreamer_data* user_data) {
    (void) user_data;
    GstSample* sample;
    GstCaps* caps;
    GstBuffer* buffer;
    GstMapInfo map;

    sample = gst_app_sink_pull_sample(appsink);
    if (sample) {
        caps = gst_sample_get_caps(sample);

        buffer = gst_sample_get_buffer(sample);
        if (gst_buffer_map(buffer, &map, GST_MAP_READ)) {
            printf("have sample\n");

            gst_buffer_unmap(buffer, &map);
        }

        gst_sample_unref(sample);
    }

    return GST_FLOW_OK;
}

GstPadProbeReturn udp_source_buffer_pad_probe_callback(GstPad* pad, GstPadProbeInfo *info, gstreamer_data* user_data) {
    (void) pad;
    (void) info;
    GstBus* bus;

    printf("have data\n");

    bus = gst_element_get_bus(user_data->pipeline);
    user_data->signal_handler_id = g_signal_connect(G_OBJECT(bus), "message::element", (GCallback) udp_source_timeout_callback, user_data);
    gst_object_unref(bus);

    return GST_PAD_PROBE_REMOVE;
}

void udp_source_timeout_callback(GstBus* bus, GstMessage* message, gstreamer_data* data) {
    const GstStructure* st = gst_message_get_structure(message);
    GstPad* pad;

    if (GST_MESSAGE_TYPE(message) == GST_MESSAGE_ELEMENT) {
        if (gst_structure_has_name(st, "GstUDPSrcTimeout")) {

            printf("no data\n");

            g_signal_handler_disconnect(G_OBJECT(bus), data->signal_handler_id);

            pad = gst_element_get_static_pad(data->udp_source, "src");
            gst_pad_add_probe(pad, GST_PAD_PROBE_TYPE_BUFFER, (GstPadProbeCallback) udp_source_buffer_pad_probe_callback, data, NULL);
            gst_object_unref(pad);
        }
    }
}

void bus_error_callback(GstBus* bus, GstMessage* message, gstreamer_data* data) {
    (void) bus;
    GError* err;
    gchar* debug_info;

    gst_message_parse_error(message, &err, &debug_info);
    g_printerr("Error received from element %s: %s\n", GST_OBJECT_NAME(message->src), err->message);
    g_printerr("Debugging information: %s\n", debug_info ? debug_info : "none");
    g_clear_error(&err);
    g_free(debug_info);

    g_main_loop_quit(data->main_loop);
}

void AcquisitionType::run() {
    gstreamer_data data;
    GstStateChangeReturn ret;
    GstBus* bus;
    GstPad* pad;

    gst_init(NULL, NULL);

    data.udp_source = gst_element_factory_make("udpsrc", "udp_source");
    g_object_set(G_OBJECT(data.udp_source),
        "port", 5000,
        "caps", gst_caps_new_empty_simple("application/x-rtp"),
        "timeout", 1000000000,
        NULL);

    data.rtp_decoder = gst_element_factory_make("rtph264depay", "rtp_decoder");

    data.video_decoder = gst_element_factory_make("avdec_h264", "video_decoder");

    data.video_converter = gst_element_factory_make("videoconvert", "video_converter");

    data.app_sink = gst_element_factory_make("appsink", "app_sink");
    g_object_set(G_OBJECT(data.app_sink),
        "emit-signals", true,
        NULL);

    g_signal_connect(data.app_sink, "new-sample", (GCallback) new_sample_callback, &data);

    data.pipeline = gst_pipeline_new("pipeline");

    if (
        !data.pipeline ||
        !data.udp_source ||
        !data.rtp_decoder ||
        !data.video_decoder ||
        !data.video_converter ||
        !data.app_sink
        )
        {
            g_printerr("Not all elements could be created.\n");
            exit(-1);
        }

    gst_bin_add_many(
        GST_BIN(data.pipeline),
        data.udp_source,
        data.rtp_decoder,
        data.video_decoder,
        data.video_converter,
        data.app_sink,
        NULL);

    if (gst_element_link_many(
        data.udp_source,
        data.rtp_decoder,
        data.video_decoder,
        data.video_converter,
        data.app_sink,
        NULL) != TRUE)
        {
            g_printerr("Elements could not be linked.\n");
            gst_object_unref(data.pipeline);
            exit(-1);
        }

    pad = gst_element_get_static_pad(data.udp_source, "src");
    gst_pad_add_probe(pad, GST_PAD_PROBE_TYPE_BUFFER, (GstPadProbeCallback) udp_source_buffer_pad_probe_callback, &data, NULL);
    gst_object_unref(pad);

    bus = gst_element_get_bus(data.pipeline);
    gst_bus_add_signal_watch(bus);
    g_signal_connect(G_OBJECT(bus), "message::error", (GCallback) bus_error_callback, &data);
    gst_object_unref(bus);

    ret = gst_element_set_state(data.pipeline, GST_STATE_PLAYING);
    if (ret == GST_STATE_CHANGE_FAILURE) {
        g_printerr("Unable to set the pipeline to the playing state.\n");
        gst_object_unref(data.pipeline);
        exit(-1);
    }

    data.main_loop = g_main_loop_new(NULL, FALSE);
    g_main_loop_run(data.main_loop);
}

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

    QThread* thread;
    AcquisitionType* worker;

    thread = new QThread;
    worker = new AcquisitionType(nullptr);

    worker->moveToThread(thread);

    QObject::connect(thread, SIGNAL(started()), worker, SLOT(run()));

    thread->start();

    return app.exec();
}

/*
int main() {
    AcquisitionType t;

    t.run();

    return 0;
}
*/

A: Refer to gobject tests @ https://github.com/GNOME/glib/blob/main/tests/gobject/signals.c
 * ...
 * It also demonstrates that signal handlers connected from a signal
 * from an earlier handler in the same emission will not be run.
 */

calling g_signal_connect inside a callback function does not call the callback function set inside this g_signal_connect


text:
Q: Handlebars page rendering as a empty bracket When i run my webapp using handlebars as the template engine and want to go to the /dashboard page it renders an empty bracket instead of the actual code.
http://localhost:3001/dashboard
what is rendered
{}
Here is the route
router.get('/dashboard', withAuth, async (req, res) => {
    try{
        const dbUserData = await User.findByPk(req.session.user_id, {
            attributes: { exclude: ['password'] },
            include: [{ model: Post }],
          });

        const user = dbUserData.get({plain: true});
        res.render('dashboard', {
           ...user,
           loggedIn: req.session.loggedIn,
        })
    } catch(err){
    console.log(err);
    res.status(500).json(err);
    }
})

Here is the dashboard.handlebars code

Welcome, {{username}}!

Create New Post

    <form id="new-form" class=" margin-10 new-post-form">

            Title
            <input type="text" id="post-title" name="post-title" />

            Text
            <input id="post-text" name="post-text" />

        <button type="submit" class="black-button">Create</button>
    </form>

{{#if posts.length}}

Your Posts

    {{#each posts as |post|}}

      {{> post-info post}}
      Edit post

    {{/each}}

{{/if}}


text:
Q: Is it possible to move  to a separate file? I've got a couple of animations as storyboards in window resources.
Is there a way to move them to a separate file and still access them?
If yes, please tell me how.
Just to be clear, I want to move the following generated code from my MainWindow.xaml file to a separate file so I can keep code tidy and organized:
<Window.Resources>
        <Storyboard x:Key="sbShowWindow">
            <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX)" Storyboard.TargetName="layoutRoot">
                <EasingDoubleKeyFrame KeyTime="0" Value="0.874">
                    <EasingDoubleKeyFrame.EasingFunction>
                        <CircleEase EasingMode="EaseInOut"/>
                    </EasingDoubleKeyFrame.EasingFunction>
                </EasingDoubleKeyFrame>
                <EasingDoubleKeyFrame KeyTime="0:0:0.3" Value="1">
                    <EasingDoubleKeyFrame.EasingFunction>
                        <CircleEase EasingMode="EaseInOut"/>
                    </EasingDoubleKeyFrame.EasingFunction>
                </EasingDoubleKeyFrame>
            </DoubleAnimationUsingKeyFrames>
            <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleY)" Storyboard.TargetName="layoutRoot">
                <EasingDoubleKeyFrame KeyTime="0" Value="0.874">
                    <EasingDoubleKeyFrame.EasingFunction>
                        <CircleEase EasingMode="EaseInOut"/>
                    </EasingDoubleKeyFrame.EasingFunction>
                </EasingDoubleKeyFrame>
                <EasingDoubleKeyFrame KeyTime="0:0:0.3" Value="1">
                    <EasingDoubleKeyFrame.EasingFunction>
                        <CircleEase EasingMode="EaseInOut"/>
                    </EasingDoubleKeyFrame.EasingFunction>
                </EasingDoubleKeyFrame>
            </DoubleAnimationUsingKeyFrames>
            <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.X)" Storyboard.TargetName="layoutRoot">
                <EasingDoubleKeyFrame KeyTime="0" Value="0">
                    <EasingDoubleKeyFrame.EasingFunction>
                        <CircleEase EasingMode="EaseInOut"/>
                    </EasingDoubleKeyFrame.EasingFunction>
                </EasingDoubleKeyFrame>
                <EasingDoubleKeyFrame KeyTime="0:0:0.3" Value="0">
                    <EasingDoubleKeyFrame.EasingFunction>
                        <CircleEase EasingMode="EaseInOut"/>
                    </EasingDoubleKeyFrame.EasingFunction>
                </EasingDoubleKeyFrame>
            </DoubleAnimationUsingKeyFrames>
            <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.Y)" Storyboard.TargetName="layoutRoot">
                <EasingDoubleKeyFrame KeyTime="0" Value="0">
                    <EasingDoubleKeyFrame.EasingFunction>
                        <CircleEase EasingMode="EaseInOut"/>
                    </EasingDoubleKeyFrame.EasingFunction>
                </EasingDoubleKeyFrame>
                <EasingDoubleKeyFrame KeyTime="0:0:0.3" Value="0">
                    <EasingDoubleKeyFrame.EasingFunction>
                        <CircleEase EasingMode="EaseInOut"/>
                    </EasingDoubleKeyFrame.EasingFunction>
                </EasingDoubleKeyFrame>
            </DoubleAnimationUsingKeyFrames>
            <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="layoutRoot">
                <EasingDoubleKeyFrame KeyTime="0" Value="0">
                    <EasingDoubleKeyFrame.EasingFunction>
                        <CircleEase EasingMode="EaseIn"/>
                    </EasingDoubleKeyFrame.EasingFunction>
                </EasingDoubleKeyFrame>
                <EasingDoubleKeyFrame KeyTime="0:0:0.3" Value="0.595">
                    <EasingDoubleKeyFrame.EasingFunction>
                        <CircleEase EasingMode="EaseIn"/>
                    </EasingDoubleKeyFrame.EasingFunction>
                </EasingDoubleKeyFrame>
                <EasingDoubleKeyFrame KeyTime="0:0:0.5" Value="1">
                    <EasingDoubleKeyFrame.EasingFunction>
                        <CircleEase EasingMode="EaseIn"/>
                    </EasingDoubleKeyFrame.EasingFunction>
                </EasingDoubleKeyFrame>
            </DoubleAnimationUsingKeyFrames>
        </Storyboard>
        <Storyboard x:Key="sbHideWindow">
            <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX)" Storyboard.TargetName="layoutRoot">
                <EasingDoubleKeyFrame KeyTime="0" Value="1">
                    <EasingDoubleKeyFrame.EasingFunction>
                        <CircleEase EasingMode="EaseOut"/>
                    </EasingDoubleKeyFrame.EasingFunction>
                </EasingDoubleKeyFrame>
                <EasingDoubleKeyFrame KeyTime="0:0:0.3" Value="0.874">
                    <EasingDoubleKeyFrame.EasingFunction>
                        <CircleEase EasingMode="EaseOut"/>
                    </EasingDoubleKeyFrame.EasingFunction>
                </EasingDoubleKeyFrame>
            </DoubleAnimationUsingKeyFrames>
            <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleY)" Storyboard.TargetName="layoutRoot">
                <EasingDoubleKeyFrame KeyTime="0" Value="1">
                    <EasingDoubleKeyFrame.EasingFunction>
                        <CircleEase EasingMode="EaseOut"/>
                    </EasingDoubleKeyFrame.EasingFunction>
                </EasingDoubleKeyFrame>
                <EasingDoubleKeyFrame KeyTime="0:0:0.3" Value="0.874">
                    <EasingDoubleKeyFrame.EasingFunction>
                        <CircleEase EasingMode="EaseOut"/>
                    </EasingDoubleKeyFrame.EasingFunction>
                </EasingDoubleKeyFrame>
            </DoubleAnimationUsingKeyFrames>
            <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.X)" Storyboard.TargetName="layoutRoot">
                <EasingDoubleKeyFrame KeyTime="0" Value="0">
                    <EasingDoubleKeyFrame.EasingFunction>
                        <CircleEase EasingMode="EaseOut"/>
                    </EasingDoubleKeyFrame.EasingFunction>
                </EasingDoubleKeyFrame>
                <EasingDoubleKeyFrame KeyTime="0:0:0.3" Value="0">
                    <EasingDoubleKeyFrame.EasingFunction>
                        <CircleEase EasingMode="EaseOut"/>
                    </EasingDoubleKeyFrame.EasingFunction>
                </EasingDoubleKeyFrame>
            </DoubleAnimationUsingKeyFrames>
            <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.Y)" Storyboard.TargetName="layoutRoot">
                <EasingDoubleKeyFrame KeyTime="0" Value="0">
                    <EasingDoubleKeyFrame.EasingFunction>
                        <CircleEase EasingMode="EaseOut"/>
                    </EasingDoubleKeyFrame.EasingFunction>
                </EasingDoubleKeyFrame>
                <EasingDoubleKeyFrame KeyTime="0:0:0.3" Value="0">
                    <EasingDoubleKeyFrame.EasingFunction>
                        <CircleEase EasingMode="EaseOut"/>
                    </EasingDoubleKeyFrame.EasingFunction>
                </EasingDoubleKeyFrame>
            </DoubleAnimationUsingKeyFrames>
            <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="layoutRoot">
                <EasingDoubleKeyFrame KeyTime="0" Value="1">
                    <EasingDoubleKeyFrame.EasingFunction>
                        <CubicEase EasingMode="EaseIn"/>
                    </EasingDoubleKeyFrame.EasingFunction>
                </EasingDoubleKeyFrame>
                <EasingDoubleKeyFrame KeyTime="0:0:0.3" Value="0.245">
                    <EasingDoubleKeyFrame.EasingFunction>
                        <CubicEase EasingMode="EaseIn"/>
                    </EasingDoubleKeyFrame.EasingFunction>
                </EasingDoubleKeyFrame>
                <EasingDoubleKeyFrame KeyTime="0:0:0.5" Value="0">
                    <EasingDoubleKeyFrame.EasingFunction>
                        <CubicEase EasingMode="EaseIn"/>
                    </EasingDoubleKeyFrame.EasingFunction>
                </EasingDoubleKeyFrame>
            </DoubleAnimationUsingKeyFrames>
        </Storyboard>
    </Window.Resources>

A: You can put this code into a separate resource dictionary, either in the same assembly, or in another one. Then all you need is to add that dictionary into merged dictionaries collection of window's resources:
<Window.Resources>
    <ResourceDictionary>
        <ResourceDictionary.MergedDictionaries>
            <ResourceDictionary Source="pack://application:,,,/YourAssembly;component/Folder/YourResourceDictionary.xaml"/>
        </ResourceDictionary.MergedDictionaries>
    </ResourceDictionary>
</Window.Resources>

Here's the syntax of pack URIs.

A: One solution would be to put them in App.xaml as resources. That way you would have resources which can be globally accessible.
One other way (which I prefer) is to define resource-related things in separate resource dictionary and load it in code on Application_StartUp event. It gives me more flexibility when choosing which resource files to load.
Some sample code:
        var basicUriString   = String.Format("/{0}.Base;component/Basic.xaml", skinName);

        try
        {
            var uri = new Uri(basicUriString, UriKind.RelativeOrAbsolute);
            newDict = new ResourceDictionary { Source = uri };
            if (!Application.Current.Resources.MergedDictionaries.Any(dic => dic.Source.OriginalString.Contains(basicUriString)))
            {
                Application.Current.Resources.MergedDictionaries.Add(newDict);
            }
        }
        catch (Exception e)
        {
            // log error
        }

This method adds resource dictionary to app resources assuming that there exists an assembly called {skinName}.Base which I pass in as a method paramter.


text: Q: How do I play ppsspp online on a phone? Im trying to play patapon 2 on my phone with a few friends who live in a different state. How can i get ppsspp to play online? I cant figure out what to do and the website doesn't have anything on using ppsspp on a phone.


text:
Q: Presto Query HIVE Table Exception: Failed to list directory I'm new to Presto. I have two machine for presto 0.160, one is coordinator, the other is worker. I want to query table in hive. Now I can "show tables", "desc tablename", but when I want to "select * from tablename", exception occured: "Query 20170728_123013_00011_q4s3a failed: Failed to list directory: hdfs://cdh-test/user/hive/warehouse/employee_hive"
presto> desc hive.default.employee_hive;

Column    |  Type   | Comment
-------------+---------+---------
 eid         | integer |
 name        | varchar |
 salary      | varchar |
 destination | varchar |
(4 rows)

Query 20170728_123001_00010_q4s3a, FINISHED, 2 nodes
Splits: 2 total, 2 done (100.00%)
0:00 [4 rows, 268B] [40 rows/s, 2.68KB/s]

presto> select * from hive.default.employee_hive;

Query 20170728_123013_00011_q4s3a, FAILED, 1 node
Splits: 1 total, 0 done (0.00%)
0:00 [0 rows, 0B] [0 rows/s, 0B/s]

Query 20170728_123013_00011_q4s3a failed: Failed to list directory: hdfs://cdh-test/user/hive/warehouse/employee_hive

Here is my configuration for hive catalog:
connector.name=hive-cdh4
hive.metastore.uri=thrift://***:9083
hive.config.resources=/etc/hadoop/conf/core-site.xml,/etc/hadoop/conf/hdfs-site.xml

where am I wrong?

A: The path that the table is stored on needs to exist on HDFS for Presto to open it successfully. From the path it appears your table is an "internal" hive table, meaning hive should have created the path itself. Since it hasn't, you could create it yourself using a command similar to hdfs dfs -mkdir hdfs://cdh-test/user/hive/warehouse/employee_hive, although the exact command depends on your HDFS set up.

A: you can't access the hadoop directory directory. I hope you have created the table as textfile and it stores internal directory of respective user.
you just create table as external table and you can able to access via presto
Create External Table tablename (columnames datatypes) row format delimited fields terminated by '\t' stored as textfile;

load data inpath 'Your_hadoop_directory' into table tablename;

else you just create a internal table and load it to external ORC table and access via presto
Create Table tablename (columnames datatypes) row format delimited fields terminated by '\t' stored as textfile;

load data inpath 'Your_hadoop_directory' into table tablename;

Create external Table tablename (columnames datatypes) STORED AS ORC;

insert into orc_tablename select * from internal_tablename

I solved above issue by creating ORC table.


text:
Q: Create a new record with certain values after updating an existing record - Access 2013 I have a table "1208Data" in Access 2013. It has the following fields

*

*ID (Autonumber)

*Store

*Customer

*Invoice Date

*Amount

*Notes

*Inv/Pmt

*Paid

When a record is marked Paid (update "Paid" from blank to "Paid"), then I also create a new record, a copy of the same record, but changing "Date", Reversing the "Amount", changing "Notes" to the check number, changing "Inv/Pmt" to "Pmt"
In the table before:

ID....Store...Customer...........................Invoice..Date...........Amount...Notes..........Inv/Pmt    Paid
4010..26.....APPLE CATERING, INC...6012.....10/9/2014....632.50...110 Lg Ch....Inv

In the table after:

ID......Store..Customer.........................Invoice..Date..........Amount.....Notes...........Inv/Pmt....Paid
4011....26....APPLE CATERING, INC..6012....10/9/2014.....632.50....110 Lg Ch....Inv...........Paid
4012....26....APPLE CATERING, INC..6012....10/16/2014...-632.50...ck # 1234.....Pmt.........Paid

Is there a way to do this with a form or ???
Currently I'm having to search for the Invoice in the table, mark it as paid and then go to the end of the table and enter the new record. Surely there has to be a better way.
Thanks in advance.
Jessica


text:
Q: Nested loops parsing huge object items freezes the browser at a certain thousand loops I've been trying to figure out how to improve the way my code calls a function with 3 given coords taken from a huge object. I'm using big objects with more than 3000 items on them so when executing the functions to retrieve a geodesic area the computer ends freezeing at a certain thousand loops.
My JSON looks like this:
{"coords":[
    {
        "latE6":42140202,
        "lngE6":1527653
    },
    {
        "latE6":42134147,
        "lngE6":1571707
    },
    {
        "latE6":42138114,
        "lngE6":1572871
    },
    {
        "latE6":42141407,
        "lngE6":1572997
    }]
}

I'm using 3 nested for-loops which works well with objects with less than 200-300 items, but when the object gets an elevated number of items browser ends up freezing and area can't be processed.
var x = data.coords.length;
for (i = 0; i < x; i++) {
    for (j = 0; j < x; j++) {
        for (k = 0; k < x; k++) {
            //checks for duplicated coords
            //then calls geodesic area function
            //feeds new object tem with 3 coords info and result area
        }
    }
}

So long code works and if I remove the function call and add some debugging like count the amount of loops or so, it returns the amount of loops quite fast. But when it comes to call the function computer becomes slower and slower on each loop.
Extra info, there's the area calc function (taken from L.GeometryUtils.geodesicArea):
var calcArea = function(latLngs) {
    var pointsCount = latLngs.length,
        area = 0.0,
        d2r = Math.PI / 180,
        p1, p2;

    if (pointsCount > 2) {
        for (var i = 0; i < pointsCount; i++) {
            p1 = latLngs[i];
            p2 = latLngs[(i + 1) % pointsCount];
            area += ((p2.lng - p1.lng) * d2r) *
                (2 + Math.sin(p1.lat * d2r) + Math.sin(p2.lat * d2r));
        }
        area = area * 6378137.0 * 6378137.0 / 2.0;
        return Math.abs(area);
    }
};

What would be best way to execute all these million calculations? Thanks.

A: If optimising your code is not enough and you need to perform heavy calculations, you could consider using web workers to perform the calculations in the background (similar to how you would code a multithreaded program) without blocking the UI.
See:
https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API
https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Using_web_workers
Apart from not blocking the browser ui, you can also parallelise parts of your calculations (if the kind of problem you're dealing with allows for it)


text:
Q: How can you stub a method on an OpenStruct? I have an rspec test that does the following:
  enrollment_hash = {
      checked_dependents: []
  }
  enrollment = OpenStruct.new enrollment_hash

  org_plan_response.new(enrollment)

and in the org_plan_response I have:
@enrollment.requires_termination_reason?(x, y)

I would like to stub out the requires_termination_reason in the test but can't figure it out.
I tried: enrollment.stub(:requires_termination_reason?).with('x', 'y').and_return { false }
but get:

NoMethodError: undefined method `stub' for #< OpenStruct checked_dependents=[]>

Any help would be appreciated!

A: require 'ostruct'

describe "" do
  specify "" do
    enrollment = OpenStruct.new(checked_dependents: [])

    allow(enrollment).to receive(:requires_termination_reason?).with('x', 'y').and_return(false)

    expect(enrollment.requires_termination_reason?('x', 'y')).to be false
  end
end

The above code works for me. Be careful to ensure that the enrollment object with the stub is the same one that is used in the test.


text:
Q: HPCC Platform and Ganglia / Nagios plugin With most users moving toward cloud-based deployments, will the Nagios / Ganglia plugin continue to be supported?

A: As of 8.12.x, support for our Nagios/Ganglia Reporting and Monitoring plugin will be deprecated. The plugin will no longer be built or distributed. The installer packages for older versions of the plugin will continue to be available on our archive page.
Standalone system monitoring via Ganglia/Nagios is not affected by this change. You can also choose to use other options, such as Prometheus, Grafana, or cloud-provided services.


text:
Q: ¿Cómo puedo añadir las etiquetas de valores a este gráfico de barras apiladas? Tengo el siguiente código:
%matplotlib inline
from pandas import *
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns

X = pd.read_csv(r'C:Path.csv', encoding='latin1')

IDNivelEducativo_Programas = X.groupby(['ID_Nivel_Educativo','Programas_Conocidos']).size()

IDNivelEducativo_Programas = IDNivelEducativo_Programas.reset_index()

IDNivelEducativo_Programas = pd.pivot_table(IDNivelEducativo_Programas, columns = 'ID_Nivel_Educativo', index = 'Programas_Conocidos', values = 0)

IDNivelEducativo_Programas.plot(kind = 'bar', stacked = True)

Y el resultado es este gráfico:

¿Alguien sabe cómo añadir los rótulos de valores numéricos para cada color en cada barra? Agradezco cualquier ayuda :D

A: No es mi código, pero te podría servir esta función, que permite usar los valores y ubicarlos encima de cada barra:
def add_value_labels(ax, spacing=5):
"""(Not my code) Add labels to the end of each bar in a bar chart.

Arguments:
    ax (matplotlib.axes.Axes): The matplotlib object containing the axes
        of the plot to annotate.
    spacing (int): The distance between the labels and the bars.
"""

# For each bar: Place a label
for rect in ax.patches:
    # Get X and Y placement of label from rect.
    y_value = rect.get_height()
    x_value = rect.get_x() + rect.get_width() / 2

    # Number of points between bar and label. Change to your liking.
    space = spacing
    # Vertical alignment for positive values
    va = 'bottom'

    # If value of bar is negative: Place label below bar
    if y_value < 0:
        # Invert space to place label below
        space *= -1
        # Vertically align label at top
        va = 'top'

    # Use Y value as label and format number with zero decimal place
    label = "{:.0f}".format(y_value)

    # Create annotation
    ax.annotate(
        label,                      # Use `label` as label
        (x_value, y_value),         # Place label at end of the bar
        xytext=(0, space),          # Vertically shift label by `space`
        textcoords="offset points", # Interpret `xytext` as offset in points
        ha='center',                # Horizontally center label
        va=va)                      # Vertically align label differently for
                                    # positive and negative values.


text:
Q: Are $ \sum_{n\ge1}f(n)\quad \text{and}\quad \left(\int^n_1f(t)\cdot dt\right)_n $ of the same nature?
Let $f:(0,+\infty)\to \mathbb{C}$ such that $f$ is $\mathcal{C}^1$ and $\displaystyle \int_1^{+\infty}|f'(t)|\cdot dt$ converges
Show that these both series $\displaystyle \sum_{n\ge1}f(n)\quad (*) \quad \text{and}\quad \left(\int^n_1f(t)\cdot dt\right)_n \quad (**)\quad  $ are of the same nature.

I spent time trying to prove that :
if $(*)$ diverges then $(**)$ diverges
if $(*)$ converges then $(**)$ converges
and the converse
But the correction suggests to show that the sequence $\displaystyle u_n:=\int^{n+1}_1f(t)\cdot dt-\sum_{k=1}^nf(k)$ converges.
I really don't know why?

A: HINT:
Let's see what is the error term for the estimate
$$\int_a^b f(t) dt \approx (b-a)\frac{ f(a) + f(b)}{2}$$
Consider the function $g(x) = x - \frac{a+b}{2}$ and do an integration by parts trick
$$\int_a^b f(t) dt = \int_a^b f(t) g'(t) dt = f(x)g(x)\mid_a^b - \int_a ^b f'(t)g(t) dt =\\=(b-a)\frac{f(a)+f(b)}{2} - \int_a^b f'(t) g(t) dt $$
Therefore
$$|\int_a^b f(t) dt - (b-a)\frac{ f(a) + f(b)}{2}| \le \frac{b-a}{2}\int_a ^b |f'(t)| dt$$
Apply this for each segment $[n,n+1]$ and sum up. We get
$$\sum_{n=1}^{\infty} |\int_n^{n+1} f(t) dt - \frac{ f(n) + f(n+1)}{2}|\le \frac{1}{2} \int_1^\infty |f'(t)| dt$$


text:
Q: Workflow Foundation (WF 4.5) - states hierarchy I'm try using Workflow Foundation (WF 4.5), in particular I'm interested in state machines. The purpose would be make it easier to navigate a complex state machine.
I started with this tutorial, then I tried to create a macro-state and I found that, once entered in the inner state machine (placed in the "Entry" of the macro-state) any transition, both internal or from bookmarks, from the macro-state to to other states were not executed. the machine is stuck in the inner state-machine.
Here my attempt of hierarchical states:

Does anyone know if WF support the hierarchically nested states (as from UML standard) and how to allow transition directly from macro-states? (without using FinalState as workaround)
Thanks everyone

A: Workflow does support nested states.
and as for the reason of workflow stuck in inner state-machine your inner state-machine is like an infinite loop so it won't come out.


text:
Q: extracting a substring in Delphi using SubStr + Copy? I have a function in Delphi
var

  Ramoativ : String;
  filteredRamoativ: String;

begin

  Ramoativ := '15 - Serviços';

  filteredRamoativ := copy(Ramoativ, 1, SubString(Ramoativ, 1, '-'));

end;

The output must be = 15
The String can have more than 2 digits number, so Ramoativ can be '13823849 - Serviços', but the - will always separate the number from text.
My idea is using a function to locate the position of "-" and use it as an argument for copy, but I am having difficulties doing it

A: Your idea is the correct way to go.  However, Delphi does not have a SubString() function.  To search for the position of a substring in another string, use the System.Pos() function instead, eg:
var
  Ramoativ : String;
  P: Integer;
  filteredRamoativ: String;
begin
  Ramoativ := ...;
  P := Pos('-', Ramoativ);
  if P <> 0 then
    filteredRamoativ := Trim(Copy(Ramoativ, 1, P-1))
  else
    filteredRamoativ = '';
end;

Also, Delphi has a StrUtils.LeftStr() function to extract a substring from the left-hand edge of a string, eg:
var
  Ramoativ : String;
  P: Integer;
  filteredRamoativ: String;
begin
  Ramoativ := ...;
  P := Pos('-', Ramoativ);
  if P <> 0 then
    filteredRamoativ := Trim(LeftStr(Ramoativ, P-1))
  else
    filteredRamoativ = '';
end;


text:
Q: Getting Started With SpringBoot, Spring Web, MyBatis & MySQL I'm about to rewrite a Struts 2 webapp with SpringBoot & Spring Web.
How can I get started?  I'm using start.spring.io with three dependencies: Spring Web, MyBatis Framework and MySQL Driver
I've opened the project in IntelliJ, built the project (no problem) but can't run the webapp as it fails to connect to my MySQL instance.  Sure I realise that I'll need to provide DB URL, username, password, port, etc. but there's no configuration files included in the zip. Where do I add these so I can properly set the properties?
How can I get started with an up-to-date version of Spring Boot that includes the basic dependencies I need?
It's so frustrating to be hamstrung at the first hurdle when I know I'll be able to run the rest of the way once I get over this first step!
Thank you.

A: You can find a file named "application.yml" or "application.properties" in directory below.
src/main/resources/

So, you have to go into that, and put the configs there.
spring.jpa.hibernate.ddl-auto=update
spring.datasource.url=jdbc:mysql://${MYSQL_HOST:localhost}:3306/db_example
spring.datasource.username=springuser
spring.datasource.password=ThePassword
spring.datasource.driver-class-name =com.mysql.jdbc.Driver
#spring.jpa.show-sql: true

Also, check to make sure you have the required dependencies added. You'll probably need these dependencies Spring Web, Spring Data JPA, and MySQL Driver.
For example, in case you're using Maven. You can go check the dependencies section of POM.XML.
<dependency>
   <groupId>org.hibernate</groupId>
   <artifactId>hibernate-core</artifactId>
   <version>5.2.17.Final</version>
   <scope>runtime</scope>
</dependency>

<dependency>
   <groupId>mysql</groupId>
   <artifactId>mysql-connector-java</artifactId>
   <version>8.0.19</version>
   <scope>runtime</scope>
</dependency>

I highly recommend you to check this link.


text:
Q: An $\mathcal{S}$-measurable function defined on $\mathcal{S}=\{\bigcup_{k\in K}E_k:K\subset\mathbb{Z^+}\}$ must be constant on each $E_k$ I have proved the following statement(s) and I would like to know if my proof is correct and/or how it could be improved, thanks.
"Suppose $X$ is a set and $E_1, E_2,\dots $ is a disjoint sequence of subsets of $X$ such that $\bigcup_{k=1}^{\infty}E_k=X$. Let $\mathcal{S}=\{\bigcup_{k\in K}E_k:K\subset\mathbb{Z^+}\}$.

(a) Show that $\mathcal{S}$ is a $\sigma$-algebra on $X$.

(b) Prove that a function $f:X\to\mathbb{R}$ is $\mathcal{S}$-measurable if and only if the function is constant on $E_k$ for every $k\in\mathbb{Z^+}$.

My proof:
(a) If we take $K=\emptyset$ then $K\subset\mathbb{Z^+}$ so $\bigcup_{k\in K}E_k\in\mathcal{S}$ and $\bigcup_{k\in K}E_k=\emptyset$ so $\emptyset\in\mathcal{S}$.
Let $A\in\mathcal{S}$: then $A=\bigcup_{k\in K_A}E_k$ for some $K_A\subset\mathbb{Z^+}$ so $X\setminus A=\bigcup_{k=1}^{\infty}E_k\setminus\bigcup_{k\in K_A}E_k=\bigcup_{k\in\mathbb{Z^+}}E_k\setminus\bigcup_{k\in K_A}E_k=\bigcup_{k\in\mathbb{Z^+}\setminus K_A}E_k$ and $\mathbb{Z^+}\setminus K_A\subset\mathbb{Z^+}$ so $A\in\mathcal{S}$.
Let $A_1,A_2,\dots \in\mathcal{S}$: then $A_1=\bigcup_{k\in K_{A_1}}E_k, A_2=\bigcup_{k\in K_{A_2}}E_k,\dots, A_n=\bigcup_{k\in K_{A_n}}E_k,\dots$ so $\bigcup_{n=1}^{\infty}A_n=\bigcup_{n=1}^{\infty}\bigcup_{k\in K_{A_n}}E_k=\bigcup_{k\in K_{A_1}}E_k\cup\bigcup_{k\in K_{A_2}}E_k\cup\dots=\bigcup_{k\in K_A}E_k$, where $K_A=\bigcup_{n=1}^{\infty} K_{A_n}\subset\mathbb{Z^+}$ so $\bigcup_{k\in K_A}E_k\in\mathcal{S}$ hence $\bigcup_{n=1}^{\infty}A_n\in\mathcal{S}$.
(b) $\fbox{$\Rightarrow$}$ Let $f:X\to\mathbb{R}$ be an $\mathcal{S}$-measurable function and suppose for sake of contradiction there existed some $E_{K}, K\in\mathbb{Z^+}$ such that $f$ is not constant on it, ie $f(E_K)=\{y_1,y_2\}, y_1\neq y_2$: then since $\{y_1\}$ is a Borel measurable subset of $\mathbb{R}$ we have that $f^{-1}(\{y_1\})\in\mathcal{S}$ so $f^{-1}(\{y_1\})=\bigcup_{k\in K_{y_1}}E_k$ for some $K_{y_1}\subset \mathbb{Z^+}$ hence we have $E_K\cap\bigcup_{k\in K_{y_1}} E_k\neq\emptyset$ and since the $E_k$s form a partition of $X$ this can only be if $K\in K_{y_1}$ ie $E_K\subseteq\bigcup_{k\in K_{y_1}} E_k$ thus $f(E_k)=\{y_1,y_2\}\subseteq f(\bigcup_{k\in K_{y_1}}E_k)=\{y_1\}$, contradiction.
So, if $f:X\to\mathbb{R}$ is $S$-measurable it must be constant on each $E_k, k\in\mathbb{Z^+}$, as desired.
$\fbox{$\Leftarrow$}$ Now, let $f:X\to\mathbb{R}$ be a function which is constant on each $E_k$, ie $f(X)=\{y_1=f(E_1), y_2=f(E_2),\dots,y_n=f(E_n),\dots\}$: then

*

*if $B$ is a Borel subset of $\mathbb{R}$ with $B\cap f(X)=\emptyset$ we have $f^{-1}(B)=\emptyset\in\mathcal{S}$;

*if $B\cap f(X)=f(X)$ we have $f^{-1}(B)=X\in\mathcal{S}$;

*if $B\cap f(X)\subsetneqq f(X), B\cap f(X)=\{y_{j_1},y_{j_2},\dots, y_{j_n},\dots \}, \{j_1,\dots,j_n,\dots\}\subset \mathbb{Z^+}$ we have $f^{-1}(B)=\bigcup_{k\in \{j_1,\dots,j_n.\dots\}}E_k\in\mathcal{S}$.
So since in all possible cases $f^{-1}(B)\in\mathcal{S}$ we can conclude that $f$ is $\mathcal{S}$-measurable, as desired.


text:
Q: Appending data to your table on success - JS I am able to successfully query my database to find an existing data. But now, i don't know how to make the table only display the item being search for. When the textbox is cleared, the table should go back to it default state.
How do i achieve this please?
Controller
public function index(Request $request)
         {
            $query = "%".$request->get('myInput')."%";
            $students = Student::where('name','LIKE',$query)->where('grade_id',Auth::user()->grade_id)->paginate(5);
             return view('customer.index',compact('stduent','query'));

         }

JS

A: You may use $("#table").empty() to clear in it before appending data for new search

A: You could try this:
success: function (data) {

   var table = $("#table tbody");

   $.each(data, function(idx, elem){

   table.append("

"+elem.id+"
   "+elem.name+"
   "+elem.lastname+"

   ");
   });
  }

since you are checking if (key.length >= 1) that means if user does not input anything then leave the table with the current content. Read this


text:
Q: Why is value of let point not being reassigned I have a variable called point which update to hold the lat and lng values of a location. However I the value of point does not update when I reassign inside the if function. Once inside the if function the value of point does get reassigned and prints the correct value but when it leaves the if function it goes back to being undefined.
generateWayPoint(address: string): string {
  let point;
  const point4 = new google.maps.LatLng(51.496144, -3.182328);

  const geocoder = new google.maps.Geocoder();
  geocoder.geocode({ 'address': address }, function (results, status) {

    if (status === google.maps.GeocoderStatus.OK) {

      point = new google.maps.LatLng(results[0].geometry.location.lat(),
                                     results[0].geometry.location.lng());
      this.wayPoint = point;
      console.log('a point in the making', this.wayPoint);
      console.log('a wayPoint in the making', this.wayPoint);

    } else {
      console.log('Geocode was not successful for the followin reason:', status);

    }
  });

  console.log('a point how it should be:', point4);
  console.log('comparing a point', point);
  console.log('comparing a wayPoint', this.wayPoint);
  return point;

}

A: This has nothing to do with let.
The geocode function gets called async, so at the time it prints point the first time, it is really not assigned.


text:
Q: Permission denied while executing a command on a remote machine using pdsh I am able to connect to a remote machine using the following command:
/usr/bin/adm/pdsh -l root -w "loop"
pdsh>

but when I try to execute any command it gives following error:
pdsh> cd /var
loop: Permission denied, please try again.
loop: Permission denied, please try again.
loop: Permission denied (publickey,password).
pdsh@rushi: loop: ssh exited with exit code 255

Please, can anyone provide any solution to this? Thanks.

A: The problem is that you don't have permission to log on the remote machine. When you type the first command pdsh ..., it really doesn't connect to the server. It does when you try to execute any command, like cd /var.
As pdsh is intended to execute commands in parallel, I suggest you to configure public key authentication:

*

*Do ssh-keygen -t rsa on your server. You will be prompted to select the name and location of the key and the key.pub files.

*Open the .pub file you generated on the previous step and copy the full text.

*Paste that text on the /root/.ssh/authorized_keys file on the remote server (loop). If the file does not exist you can create it safely. (Remember to set appropriate perms, like 600 ).

*Profit!


text:
Q: Cant access phpMyAdmin after changing the privileges username and password (ERROR1405) I can't seem to get back into phpMyAdmin after changing the privileges, I keep getting the following error:

ERROR 1405
MySQL said: Documentation
1045 - Access denied for user ''root''@'localhost' (using password: YES)

I am using XAMPP on a mac. Not sure on how to go about fixing this, any ideas?

A: You have to go to C:\xampp\phpMyAdmin\config.inc.php and edit the file. The default file (without any password being set) looks like this.
<?php
/*
 * This is needed for cookie based authentication to encrypt password in
 * cookie
 */
$cfg['blowfish_secret'] = 'xampp'; /* YOU SHOULD CHANGE THIS FOR A MORE SECURE COOKIE AUTH! */

/*
 * Servers configuration
 */
$i = 0;

/*
 * First server
 */
$i++;

/* Authentication type and info */
$cfg['Servers'][$i]['auth_type'] = 'config';
$cfg['Servers'][$i]['user'] = 'root';
$cfg['Servers'][$i]['password'] = '';
$cfg['Servers'][$i]['extension'] = 'mysqli';
$cfg['Servers'][$i]['AllowNoPassword'] = true;
$cfg['Lang'] = '';

*

*If you remember the password then you can directly enter that in the password field.

*if you don't remember setting any password and it still shows some value then change it to '' (empty string).

*If this doesn't work then open the command line interface as a administrator and type sc delete mysql. This would delete the previous settings which you did in the mysql.

*Now restart now xammp server and open phpMyAdmin.


text:
Q: Where can I store my items? I'm only starting Divinity: Original Sin. And I don't know yet if some items will be useful or not. So I'm currently keeping everything (mostly ingredients), but it takes place.
So where can I safely store my items? I read that I'll get a "living quarters" during the main quest, which is said to be a safe place. I'm not there yet, so is there any other place I can use meanwhile?

A: It won't be long before you:

 Discover your homestead, at which point you can send items there by right-clicking them.

Until then, between four characters you should have sufficient carrying capacity to just keep it all in your inventory. But if you don't, pick any spot you can easily get back to later (near a portal) and drop stuff on the ground or shove it in a chest. If you want, you can even pick up chests, barrels or crates (may require some Strength or Telekinesis) and put them where you want them.

 The forge behind the abandoned shop in Cyseal is a nice location for that.


text:
Q: AngularFire Google OAuth not retrieving the user's email I want to get the email address from Google OAuth using AngularFire, but on popup, it's not asking for the email permission.
This is the code from Firebase Google auth doc
var ref = new Firebase("https://<your-firebase>.firebaseio.com");
ref.authWithOAuthPopup("google", function(error, authData) { /* Your Code */ }, {
  scope: "email"
});

It works in my angular application, but how can I fix my angular code to do the same?
var ref = new Firebase("https://<your-firebase>.firebaseio.com");
var auth = $firebaseAuth(ref);
auth.$authWithOAuthPopup("google").then(function(authData) {
   /* Code */
}).catch(function(error) {
   console.error("Authentication failed:", error);
});

Link to the same problem with answer, but I don't get the answer and how to fix it.

A: Did you try passing in the options?
var ref = new Firebase("https://<your-firebase>.firebaseio.com");
var auth = $firebaseAuth(ref);
auth.$authWithOAuthPopup("google", { scope: 'email' }).then(function(authData) {
   /* Code */
}).catch(function(error) {
   console.error("Authentication failed:", error);
});

As noted by Kato, the docs provide that information as well: link


text:
Q: How to check if a given value is a valid URL I need some function to check is the given value is a url.
I have code:
<?php
$string = get_from_db();
list($name, $url) = explode(": ", $string);
if (is_url($url)) {
    $link = array('name' => $name, 'link' => $url);
} else {
    $text = $string;
}
// Make some things
?>

A: If you're running PHP 5 (and you should be!), just use filter_var():
function is_url($url)
{
    return filter_var($url, FILTER_VALIDATE_URL) !== false;
}

Addendum: as the PHP manual entry for parse_url() (and @Liutas in his comment) points out:

This function is not meant to validate the given URL, it only breaks it up into the above listed parts. Partial URLs are also accepted, parse_url() tries its best to parse them correctly.

For example, parse_url() considers a query string as part of a URL. However, a query string is not entirely a URL. The following line of code:
var_dump(parse_url('foo=bar&baz=what'));

Outputs this:
array(1) {
  ["path"]=>
  string(16) "foo=bar&baz=what"
}

A: use parse_url and check for false
<?php
$url = 'http://username:password@hostname/path?arg=value#anchor';

print_r(parse_url($url));

echo parse_url($url, PHP_URL_PATH);
?>

The above example will output:
Array
(
   [scheme] => http
   [host] => hostname
   [user] => username
   [pass] => password
   [path] => /path
   [query] => arg=value
   [fragment] => anchor
)
/path

A: You can check if ParseUrl returns false.


text:
Q: LINQ to XML XElement Node I am creating a XML file using LinqXML.
string value = "Steet,

 City";
XElement address = new XElement("Address", value);

Once I write the xml file, the address value is shown as Steet,<BR&gt </BR&gt
I just need as it is like original. (Even if it does not well form)

A: Well if that stuff is not well-formed then don't expect to be able to treat it as XML. Thus if you want to put not well-formed HTML markup into an XML element then consider to use a CDATA section e.g.
    string value = "Steet,

 City";
    XElement address = new XElement("Address", new XCData(value));

which will result in
<Address><![CDATA[Steet,

 City]]></Address>

If you want to parse the value as XML then do so with an XmlReader in fragment mode e.g.
static void Main()
{
    string value = "Steet,

 City";
    XElement address = new XElement("Address", ParseFragment(value));
    Console.WriteLine(address);
}

static IEnumerable<XNode> ParseFragment(string fragment)
{
    using (StringReader sr = new StringReader(fragment))
    {
        using (XmlReader xr = XmlReader.Create(sr, new XmlReaderSettings() { ConformanceLevel = ConformanceLevel.Fragment }))
        {
            xr.Read();
            XNode node;
            while (!xr.EOF && (node = XNode.ReadFrom(xr)) != null)
            {
                yield return node;
            }
        }
    }
}

That results in
<Address>Steet,

 City</Address>

A: I don't think you need to change anything. < and > are how angle brackets are escaped in XML. XML parsers turn them back into literal angle brackets automatically when reading string values. CDATA is simply another way of escaping the angle brackets. They both accomplish exactly the same thing in this case. If you take your original code and read the value of the <Address> node with an XML parser, the string returned will be Street,

 City. Changing the method of escaping to CDATA doesn't actually change anything except to make your XML (arguably) harder to read.
If you want the
 tag to be actually part of the XML document, then you should make it part of the document. That is to say...
new XElement("Address", "Street,", new XElement("BR"), " City")

A: you need to wrap it in CDATA to preserve it


text:
Q: C++ Read until tab detected This may be a little bit redundant, but is there a short/compact method of reading in a string until a tab is reached in C++? Similar to other questions, but I want to keep reading even if I hit a space. For example if the STDIN is
Cute Kitty    is    fabulous as always

Then I want to read in Cute Kitty; is; fabulous as always, three times.
I've seen people do this with regex in files, but how would you do this on the stdin in C++? I want to put it in a string class and whenever I try something like
scanf("%s\t", &mystring);

It throws up an error because I'm not using an array of chars.
Thanks, please keep answers easy enough for a noob to understand.

A: This code seems to work for me. It basically gets the line that was entered from the user via stdin and then reads each character waiting for a tab character (\t), or the end of the line.
#include <iostream>
#include <string>

int main()
{
    std::string a;
    std::getline(std::cin,a);
    int index_holder = 0;
    for(std::string::size_type i = 0; i < a.size(); ++i)
    {
        if(a[i] == '\t' || (i == a.size() - 1)) {
            std::cout << a.substr(index_holder, i - index_holder) << std::endl;
            index_holder = i + 1;
        }

    }
    return 0;
}

A: Have a look at strtok:
char * strtok ( char * str, const char * delimiters );

Split string into tokens. A sequence of calls to this function split str into tokens, which are sequences of contiguous characters separated by any of the characters that are part of delimiters.


text:
Q: Delete all but one duplicate record I have a table that is supposed to keep a trace of visitors to a given profile (user id to user id pair). It turns out my SQL query was a bit off and is producing multiple pairs instead of single ones as intended. With hindsight I should have enforced a unique constraint on each id+id pair.
Now, how could I go about cleaning up the table? What I want to do is delete all duplicate pairs and leave just one.
So for example change this:
23515 -> 52525 date_visited
23515 -> 52525 date_visited
23515 -> 52525 date_visited
12345 -> 54321 date_visited
12345 -> 54321 date_visited
12345 -> 54321 date_visited
12345 -> 54321 date_visited
23515 -> 52525 date_visited
...

Into this:
23515 -> 52525 date_visited
12345 -> 54321 date_visited

Update: Here is the table structure as requested:
id  int(10)         UNSIGNED    Non     Aucun   AUTO_INCREMENT
profile_id  int(10)         UNSIGNED    Non     0
visitor_id  int(10)         UNSIGNED    Non     0
date_visited    timestamp           Non     CURRENT_TIMESTAMP

A: ANSI SQL Solution
Use group by in a subquery:
delete from my_tab where id not in
(select min(id) from my_tab group by profile_id, visitor_id);

You need some kind of unique identifier(here, I'm using id).
MySQL Solution
As pointed out by @JamesPoulson, this causes a syntax error in MySQL; the correct solution is (as shown in James' answer):
delete from `my_tab` where id not in
( SELECT * FROM
    (select min(id) from `my_tab` group by profile_id, visitor_id) AS temp_tab
);

A: Select all unique rows
Copy them to a new temp table
Truncate original table
Copy temp table data to original table

That's what I'd do. I'm not sure if there's 1 query that would do all this for you.

A: Here's Frank Schmitt's solution with a small workaround utilizing a temporary table to allow his solution to work on MySQL:
delete from `my_tab` where id not in
( SELECT * FROM
    (select min(id) from `my_tab` group by profile_id, visitor_id) AS temp_tab
)

A: This will work:
With NewCTE
AS
(
Select *, Row_number() over(partition by ID order by ID)as RowNumber from
table_name
)
Delete from NewCTE where RowNumber > 1

A: If you are using SQL you can manually delete the duplicate rows keeping one entry just follow this procedure:

*

*Go into your table where you have duplicate data.

*Apply the filter to segregate duplicate data for each individual id

*Select all the rows you want to delete.

*Press delete and save the result.

*Repeat the process for each id you have duplicate entries for.

It's a long procedure but you can see the results immediately in real-time.
Hope this solution worked for you!!


text:
Q: Changing View Background Color in Swift I am trying to change the background color of a view programatically. This code works fine (within my viewDidLoad):
self.view.backgroundColor = UIColor.blackColor()

However this doesn't:
self.view.backgroundColor = UIColor(red: 44, green: 62, blue: 80, alpha: 1.0)

What is the reason for this, and what would be the best workaround?


text:
Q: How to send 'dealloc' message to nil Object in Objective-c? I know that nil object does not received message.
but dealloc is not.
exam code is here.

Book *theLordOfTheRing = [[Book alloc] init];

...

NSLog(@"title: %@", theLordOfTheRing.titleName);

 theLordOfTheRing.titleName = nil;

[theLordOfTheRing setTitleName:[theLordOfTheRing.titleName stringByAppendingString:@" vol.4"]];

NSLog(@"title: %@", theLordOfTheRing.titleName);

[theLordOfTheRing.titleName dealloc]; //Build is fine with this line.

----- console----
title: The Fellowship
title: (null)

stringByAppendingString: message is not worked
but dealloc is worked.
why does work 'dealloc' to nil object?

A: This code will compile and run because you can send messages to objects which are nil.  When you send a message to a nil object the app will just continue executing.  When you are calling [theLordOfTheRing.titleName dealloc]; dealloc method is not actually being called because titleName is nil.  The program is just continue executing.
When you run [theLordOfTheRing setTitleName:[theLordOfTheRing.titleName stringByAppendingString:@" vol.4"]]; you are getting (null) because you sending stringByAppendingString to an object (titleName) that is already nil and the method is not being executed.
[theLordOfTheRing.titleName stringByAppendingString:@" vol.4"]; will "return" nil and and setTitleName method will be called with parameter being nil.
You should instead of setting titleName to nil set it to @"" blank string this way stringByAppendingString should work because titleName is still alloc and initialized.
theLordOfTheRing.titleName = @"";

I hope I am able to explain this clearly.  Let me know if you have any questions.


text:
Q: Row command with Link button in GridView I have two GridViews. GridView1 contains 2 link buttons in a column. When I select a link button in GridView1, the details of the link button should be displayed in GridView2.
GridView2 contains a column with radio buttons.  I need to fill the radio buttons dynamically from the database.
How can I fill the Radio button list of GridView2 by using GridView1_RowCommand?  Or Can I get it from the RowDataBound event of GridView2?
code behind:
protected void GridView1_RowCommand(Object sender, GridViewCommandEventArgs e)
{
    if (e.CommandName == "Yes")
    {
        GridViewRow gvRow = (GridViewRow)(((LinkButton)e.CommandSource).NamingContainer);
        int RowIndex = gvRow.RowIndex;
        Int32 iAppID = Convert.ToInt32(GridView1.DataKeys[gvRow.RowIndex].Value.ToString());

        dset = userApps.UserSelectedApp(iUserID, iAppID);
        if (dset.Tables[0].Rows.Count > 0)
        {
            GridViewRow gRow = GridView2.Rows[RowIndex];//I need to create object to this Gridview2, and fill the radiobutton list with some values
            RadioButtonList rdbtnSubPlans = (RadioButtonList)e.gRow.Cells[2].FindControl("rdbSubPlans");

            ds = userApps.UpgradePlans(iUserID, iAppID);
            if (ds != null)
            {
                rdbtnSubPlans.DataSource = ds;
                rdbtnSubPlans.DataValueField = "PlanID";
                rdbtnSubPlans.DataTextField = "Plans";
                rdbtnSubPlans.DataBind();
            }
        }
    }
    if (e.CommandName == "No")
    {}
     dtset = user.UserSelectedAppication(iUserID, iAppID);
     GridView2.DataSource = dtset;
     GridView2.DataBind();
     MultiView1.SetActiveView(viewRenewOrUpdate);
    }
}

ASPX code for the GridViews
<asp:GridView ID="GridView1" runat="server" DataKeyNames="ApplicationID"
    OnRowDataBound="GridView1_RowDataBound" OnRowCommand="GridView1_RowCommand"
    OnSorting="GridView1_Sorting" OnDataBound="GridView1_DataBound"
    OnSelectedIndexChanged="GridView1_SelectedIndexChanged">
    <Columns>
        <asp:TemplateField HeaderText="S.No" ItemStyle-HorizontalAlign="center" HeaderStyle-HorizontalAlign="center">
            <ItemTemplate>
                <asp:Label ID="l1" runat="server" Text="1"></asp:Label>
            </ItemTemplate>
            <HeaderStyle Width="10%" />
        </asp:TemplateField>
        < Some Bound Fields>
        <asp:TemplateField HeaderText="Action">
            <ItemTemplate>
                <asp:LinkButton ID="lnkYes" runat="server" Text="Yes"
                    CssClass="lnkbtn" Visible="false" commandname="Yes" Width="100px" >
                </asp:LinkButton>

                <asp:LinkButton ID="lnkNo" runat="server" CssClass="lnkbtn" Text="No"
                    Visible="false" commandname="No" ToolTip="No and Yes current plan" Width="100px" >
                </asp:LinkButton>
            </ItemTemplate>
        </asp:TemplateField>
    </Columns>
</asp:GridView>

<asp:GridView ID="GridView2" runat="server" DataKeyNames="ApplicationID"
    OnRowDataBound="GridView2_RowDataBound">
    <Columns>
        <asp:BoundField DataField="ApplicationName" HeaderText="Application name">
            <HeaderStyle Width="30%" />
            <ItemStyle CssClass="col" />
        </asp:BoundField>
        <asp:TemplateField HeaderText="Plans">
            <ItemTemplate>
                <asp:RadioButtonList ID="rdbSubPlans" runat="server" AutoPostBack="true"
                    OnSelectedIndexChanged="rdbSubPlan_OnSelectedIndexChanged" Enabled="false">
                </asp:RadioButtonList>
            </ItemTemplate>
        <ItemStyle CssClass="col" />
    </Columns>
</asp:GridView>

A: Fill Gridview2 first, and then do the following corrections:
GridViewRow gRow = GridView2.Rows[0]
RadioButtonList rdbtnPlans = (RadioButtonList)gRow.FindControl("rdbPlans");


text:
Q: meta-qt5 yocto layer not compile on qt release 5.15.2 I cannot build my yocto distro (from 'pyro' version) when upgrade the meta-qt5 to the Qt version 5.15.2: I checkout the repository of meta-qt5 to the master branch that now support the qt 5.15.2, but I got some error on configuration about openssl and pcre2.
I'm using a container with ubuntu 18.04 as build system (to have the openssl version 1.1.1 as required by QT5.15.x) but I cannot solve that errors during the build of qtbase recipe:
| ERROR: Feature 'system-pcre2' was enabled, but the pre-condition 'libs.pcre2' failed.
|
| ERROR: Feature 'openssl-runtime' was enabled, but the pre-condition '!features.securetransport && !features.schannel && libs.openssl_headers' failed.
| WARNING: exit code 3 from a shell command.

I tried to comment the pcre and openssl packegeconfig into the qtbase recipe (to workaround that problems) but it didn't solve it.
The configuration return:
Configure summary:

Building on: linux-oe-g++ (arm, CPU features: neon)
Building for: linux-oe-g++ (arm, CPU features: neon)
Target compiler: gcc 6.3.0
Configuration: cross_compile compile_examples enable_new_dtags largefile neon silent shared shared release c++11 c++14 concurrent dbus reduce_exports stl
Build options:
  Mode ................................... release
  Optimize release build for size ........ no
  Building shared libraries .............. yes
  Using C standard ....................... C11
  Using C++ standard ..................... C++14
  Using ccache ........................... no
  Using new DTAGS ........................ yes
  Relocatable ............................ yes
  Using precompiled headers .............. no
  Using LTCG ............................. no
  Target compiler supports:
    NEON ................................. yes
  Build parts ............................ libs tests tools
Qt modules and options:
  Qt Concurrent .......................... yes
  Qt D-Bus ............................... yes
  Qt D-Bus directly linked to libdbus .... yes
  Qt Gui ................................. yes
  Qt Network ............................. yes
  Qt Sql ................................. yes
  Qt Testlib ............................. yes
  Qt Widgets ............................. yes
  Qt Xml ................................. yes
Support enabled for:
  Using pkg-config ....................... yes
  udev ................................... yes
  Using system zlib ...................... yes
  Zstandard support ...................... no
Qt Core:
  DoubleConversion ....................... yes
    Using system DoubleConversion ........ no
  GLib ................................... no
  iconv .................................. no
  ICU .................................... no
  Built-in copy of the MIME database ..... yes
  Tracing backend ........................ <none>
  Logging backends:
    journald ............................. no
    syslog ............................... no
    slog2 ................................ no
  PCRE2 .................................. no
    Using system PCRE2 ................... no
Qt Network:
  getifaddrs() ........................... yes
  IPv6 ifname ............................ yes
  libproxy ............................... no
  Linux AF_NETLINK ....................... yes
  OpenSSL ................................ no
    Qt directly linked to OpenSSL ........ no
  OpenSSL 1.1 ............................ no
  DTLS ................................... no
  OCSP-stapling .......................... no
  SCTP ................................... no
  Use system proxies ..................... yes
  GSSAPI ................................. no
Qt Gui:
  Accessibility .......................... yes
  FreeType ............................... yes
    Using system FreeType ................ yes
  HarfBuzz ............................... yes
    Using system HarfBuzz ................ no
  Fontconfig ............................. no
  Image formats:
    GIF .................................. yes
    ICO .................................. no
    JPEG ................................. yes
      Using system libjpeg ............... yes
    PNG .................................. yes
      Using system libpng ................ yes
  Text formats:
    HtmlParser ........................... yes
    CssParser ............................ yes
    OdfWriter ............................ yes
    MarkdownReader ....................... yes
      Using system libmd4c ............... no
    MarkdownWriter ....................... yes
  EGL .................................... yes
  OpenVG ................................. yes
  OpenGL:
    Desktop OpenGL ....................... no
    OpenGL ES 2.0 ........................ yes
    OpenGL ES 3.0 ........................ yes
    OpenGL ES 3.1 ........................ no
    OpenGL ES 3.2 ........................ no
  Vulkan ................................. no
  Session Management ..................... no
Features used by QPA backends:
  evdev .................................. yes
  libinput ............................... no
  INTEGRITY HID .......................... no
  mtdev .................................. no
  tslib .................................. no
  xkbcommon .............................. no
  X11 specific:
    XLib ................................. no
    XCB Xlib ............................. no
    EGL on X11 ........................... no
    xkbcommon-x11 ........................ no
QPA backends:
  DirectFB ............................... no
  EGLFS .................................. yes
  EGLFS details:
    EGLFS OpenWFD ........................ no
    EGLFS i.Mx6 .......................... yes
    EGLFS i.Mx6 Wayland .................. no
    EGLFS RCAR ........................... no
    EGLFS EGLDevice ...................... no
    EGLFS GBM ............................ no
    EGLFS VSP2 ........................... no
    EGLFS Mali ........................... no
    EGLFS Raspberry Pi ................... no
    EGLFS X11 ............................ no
  LinuxFB ................................ no
  VNC .................................... no
Qt Sql:
  SQL item models ........................ yes
Qt Widgets:
  GTK+ ................................... no
  Styles ................................. Fusion Windows
Qt PrintSupport:
  CUPS ................................... no
Qt Sql Drivers:
  DB2 (IBM) .............................. no
  InterBase .............................. no
  MySql .................................. no
  OCI (Oracle) ........................... no
  ODBC ................................... no
  PostgreSQL ............................. no
  SQLite2 ................................ no
  SQLite ................................. yes
    Using system provided SQLite ......... yes
  TDS (Sybase) ........................... no
Qt Testlib:
  Tester for item models ................. yes

Note: Overriding option 'eglfs' with 'yes' (was: 'no')

Note: -hostbindir is not a subdirectory of -hostprefix.
Note: -hostlibdir is not a subdirectory of -hostprefix.
Note: -hostdatadir is not a subdirectory of -hostprefix.

ERROR: Feature 'system-pcre2' was enabled, but the pre-condition 'libs.pcre2' failed.

ERROR: Feature 'openssl-runtime' was enabled, but the pre-condition '!features.securetransport && !features.schannel && libs.openssl_headers' failed.
WARNING: exit code 3 from a shell command.
ERROR: Function failed: do_configure (log file is located at /yocto/pyro/build/tmp/work/armv7at2hf-neon-mx6sx-fslc-linux-gnueabi/qtbase/5.15.2+gitAUTOINC+40143c189b-r0/temp/log.do_configure.1849)

A: Try to use OpenSSL of honister (or any other poky that uses OpenSSL 1.1.x) and overwrite the prefered version of openssl in poky/meta/conf/distro/include/default-versions.inc.
Could be that you have to change the new Yocto x:append syntax back to the old x_append, depending on what Yocto version you take the OpenSSL recipe from.


text:
Q: How can I get Wordpress to function under a Debian LAMP stack? I am working on publishing a Wordpress blog. I say "working on publishing," because when I came to a point of saying, "This is great; I want it to showcase my website", Wordpress seemed to stop working.
The Wordpress version is 4.4.0; Apache is 2.4.10 compiled for Debian, and uname -a gives "Linux localhost 4.1.5-x86_64-linode61 #7 SMP Mon Aug 24 13:46:31 EDT 2015 x86_64 GNU/Linux"
There are a couple of issues that have been involved. One suggestion in online forums is to rename or delete the installation's .htaccess and plugins directory; I did that but nothing got better. There have been three basic behaviors:

*

*Display the intended content without applying any non-default styling. Part of this may be an HTTPS vs. HTTP delivery problem, which is chicken and egg: unless I manually tamper with the database (I did eventually and it didn't help), I need to access stuff under wp-content, but I'm cut off from that functionality right now because the wp-content that should address my needs is closed off completely. (Or to put this catch-22 in other words, the functionality needed to address the problem of an HTTPS page asking to load assets via HTTP depends on having solved whatever problem is ultimately responsible for HTTPS pages requesting HTTP assets.)

*Keep on redirecting to the original page 100+ times until the browser gives up.

*Not let Apache to start, and continue this behavior when I comment out the new.

The site-related Apache logging, in wordpress.error.log, is:
[Thu Feb 04 16:40:30.525930 2016] [ssl:emerg] [pid 7029] AH01895: Unable to configure verify locations for client authentication
[Thu Feb 04 16:41:51.249704 2016] [ssl:emerg] [pid 25328] AH01895: Unable to configure verify locations for client authentication
[Thu Feb 04 16:43:30.627877 2016] [ssl:emerg] [pid 25382] AH01895: Unable to configure verify locations for client authentication
[Thu Feb 04 16:49:10.735585 2016] [ssl:emerg] [pid 25531] AH01895: Unable to configure verify locations for client authentication
[Thu Feb 04 16:52:44.813763 2016] [ssl:emerg] [pid 28528] AH01895: Unable to configure verify locations for client authentication
[Thu Feb 04 16:52:57.388624 2016] [ssl:emerg] [pid 28533] AH01895: Unable to configure verify locations for client authentication
[Thu Feb 04 16:55:42.620868 2016] [ssl:emerg] [pid 28613] AH01895: Unable to configure verify locations for client authentication
[Thu Feb 04 16:57:12.032443 2016] [ssl:emerg] [pid 28651] AH01895: Unable to configure verify locations for client authentication
[Thu Feb 04 16:58:08.533882 2016] [ssl:emerg] [pid 28673] AH01895: Unable to configure verify locations for client authentication
[Thu Feb 04 17:03:55.002202 2016] [ssl:emerg] [pid 28803] AH01895: Unable to configure verify locations for client authentication

The sitewide logging has:
[Thu Feb 04 16:52:57.388709 2016] [ssl:emerg] [pid 28533] AH02311: Fatal error initialising mod_ssl, exiting. See /var/log/apache2/wordpress.error.log for more information
AH00016: Configuration Failed
[Thu Feb 04 16:55:42.620960 2016] [ssl:emerg] [pid 28613] AH02311: Fatal error initialising mod_ssl, exiting. See /var/log/apache2/wordpress.error.log for more information
AH00016: Configuration Failed
[Thu Feb 04 16:57:12.032531 2016] [ssl:emerg] [pid 28651] AH02311: Fatal error initialising mod_ssl, exiting. See /var/log/apache2/wordpress.error.log for more information
AH00016: Configuration Failed
[Thu Feb 04 16:58:08.533951 2016] [ssl:emerg] [pid 28673] AH02311: Fatal error initialising mod_ssl, exiting. See /var/log/apache2/wordpress.error.log for more information
AH00016: Configuration Failed
[Thu Feb 04 17:03:55.002286 2016] [ssl:emerg] [pid 28803] AH02311: Fatal error initialising mod_ssl, exiting. See /var/log/apache2/wordpress.error.log for more information
AH00016: Configuration Failed
And I don't know if this any help at all, but the VirtualHost SSL declaration is below, and commenting it out seems not to change behavior as far as I can tell:
    <VirtualHost *:443>
        ServerName cjshayward.com
        ServerAlias wordpress.cjshayward.com
    DirectoryIndex index.cgi index.html
        DocumentRoot /home/cjsh/wordpress
        ErrorLog /var/log/apache2/cjshayward_error.log
        CustomLog /var/log/apache2/cjshayward_access.log combined
         SSLEngine On
         SSLCertificateFile /etc/apache2/ssl/cjshayward2.crt
         SSLCertificateKeyFile /etc/apache2/ssl/cjshayward2.key
     SSLCertificateChainFile /etc/apache2/ssl/sub.class1.server.ca.pem
     SSLCaCertificateFile /etc/apache2/ssl/ca.crt
        ServerAdmin cjsh@cjsh.name
    ErrorDocument 404 /missing.html
    ErrorDocument 500 /servererror.html
        <Directory />
            Options FollowSymLinks
            AllowOverride None
        </Directory>
        <Directory /home/cjsh/mirror/>
            Options ExecCGI Indexes FollowSymLinks MultiViews
            AllowOverride None
            Order allow,deny
            allow from all
        </Directory>
    <Directory "/home/cjsh/wordpress">
        AllowOverride All
        Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
        Order allow,deny
        Allow from all
    </Directory>
    <Directory "/home/jonathan/mirror">
        AllowOverride All
        Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
        Order allow,deny
        Allow from all
    </Directory>
        ErrorLog ${APACHE_LOG_DIR}/author.cjshayward.error.log
        # Possible values include: debug, info, notice, warn, error, crit,
        # alert, emerg.
        LogLevel warn
        CustomLog ${APACHE_LOG_DIR}/access.log combined
        Alias /doc/ "/usr/share/doc/"
        <Directory "/usr/share/doc/">
            Options Indexes MultiViews FollowSymLinks
            AllowOverride None
            Order deny,allow
            Deny from all
            Allow from 127.0.0.0/255.0.0.0 ::1/128
        </Directory>
        #Alias /media/ /home/cjsh/unixytalk/media/
        #ProxyPass /media/ !
        #ProxyPass / http://wordpress.cjshayward.com/
        #ProxyPassReverse / http://wordpress.cjshayward.com/
    RewriteEngine On
    RewriteRule ^(/classicorthodoxbiblehardcover/?)$ http://www.amazon.com/gp/ product/0692525548 [R=301,L]
    RewriteRule ^(/two-watches/?)$ /christmas-gift-guide-2015 [R=301,L]
    </VirtualHost>

What kind of diagnostics can I give?
Thanks,

A: This is a problem:
     SSLCaCertificateFile /etc/apache2/ssl/ca.crt

This directive is used (along with others) to set up client certificate authentication. It should not be present at all if you do not intend to use client certificates.


text:
Q: Update a complex schema with sub embed document i m trying to update a sub embed document with mongodb, but does not work.
I want for a chapter.id & quest.id given, update the percent of this document (only this one)
My schema looks like :
{
    "_id" : ObjectId("54ae5e63e71cef26050fca9a"),
    "name" : "test",
    "chapters" : [
        {
            "id" : 1,
            "quests" : [
                {
                    "id" : 1,
                    "name" : "quest1",
                    "percent" : 0
                },
                {
                    "id" : 2,
                    "name" : "quest2",
                    "percent" : 0
                }
            ]
        },
        {
            "id" : 2,
            "quests" : [
                {
                    "id" : 3,
                    "name" : "quest3",
                    "percent" : 0
                },
                {
                    "id" : 4,
                    "name" : "quest4",
                    "percent" : 0
                }
            ]
        }
    ]
}

i tried this :
db.test.update({name:"test"  , "chapters.quests.id":1 , "chapters.id":1} , {$set:{ "chapters.quests.$.percent":1} })

and has this error
cannot use the part (chapters of chapters.quests.0.percent) to traverse the element ({chapters: [ { id: 1.0, quests: [ { id: 1.0, name: "quest1", percent: 0.0 }, { id: 2.0, name: "quest2", percent: 0.0 } ] }, { id: 2.0, quests: [ { id: 3.0, name: "quest3", percent: 0.0 }, { id: 4.0, name: "quest4", percent: 0.0 } ] } ]})

if i did it with 0
if someone can help me, it s perhaps a schema problems ?

A: Now it is not possible without know the position of the object.