text:
Q: How to do sequential query execution? I have such a request:
try {
    /* 1) */
    const dayReports = await DayReport.findAll(query);
    dayReports.forEach((dayReport, index) => {
        /* 2) */
        const findAllYear = DayReport.findAll({
            where: {
                [Op.and]: [
                    {
                        report_date: {
                            [Op.between]: [new Date(dayReport.dataValues.report_date).getFullYear() + '-01-01', dayReport.dataValues.report_date]
                        }
                    }
                ]
            }
        });
        /* 3) */
        var get_sinking_year = 0;
        for (var i = 0; i < findAllYear.length; i++) {
            get_sinking_year += findAllYear[i].dataValues.sinking_day
        }
        /* 4) */
        console.log(get_sinking_year)
    })
} catch (e) {
    errorHandler(res, e);
}

And I need to execute the request in order, as the numbers in the comments are located (I.e  1,2,3,4.).
Instead, my request is executed in this order 1,3,4,2.

A: Try this. It first gathers all the findAllYear results (steps 2), then executes steps 3 and 4 for each result.
try {
    /* 1) */
    const dayReports = await DayReport.findAll(query);

    const allYearArraysPromises = [];
    dayReports.forEach((dayReport, index) => {
        /* 2) */
        const findAllYear = DayReport.findAll({
            where: {
                [Op.and]: [
                    {
                        report_date: {
                            [Op.between]: [new Date(dayReport.dataValues.report_date).getFullYear() + '-01-01', dayReport.dataValues.report_date]
                        }
                    }
                ]
            }
        });
        allYearArraysPromises.push(findAllYear);
    }
    const allYearArrays = await Promise.all(allYearArraysPromises);
    allYearArrays.forEach((findAllYear) => {
        /* 3) */
        var get_sinking_year = 0;
        for (var i = 0; i < findAllYear.length; i++) {
            get_sinking_year += findAllYear[i].dataValues.sinking_day
        }
        /* 4) */
        console.log(get_sinking_year)
    });
} catch (e) {
    errorHandler(res, e);
}

It's a little different from Tilieth's answer. If you wish to add a 5th step in the future, it would work in the correct order,
12345. With Tilieth's answer, the order would be 12534.
I'm adding some test scripts to illustrate this.
Tilieth's:

async function tilieth() {
  const dayReports = await new Promise(resolve => resolve(['a', 'b', 'c']));
  console.log('Step 1 - Result:', dayReports);
  dayReports.forEach(async(dayReport, index) => {
    console.log('Step 2 for', dayReport);
    const findAllYear = await new Promise(resolve => {
      setTimeout(() => {
        resolve(dayReport);
      }, 500);
    });
    console.log('Steps 3 & 4 for', findAllYear);
  });
  console.log('Step 5');
}
tilieth();

Mine:

async function stratubas() {
  const dayReports = await new Promise(resolve => resolve(['a', 'b', 'c']));
  console.log('Step 1 - Result:', dayReports);
  const allYearArraysPromises = [];
  dayReports.forEach((dayReport, index) => {
    console.log('Step 2 for', dayReport);
    const findAllYear = new Promise(resolve => {
      setTimeout(() => {
        resolve(dayReport);
      }, 500);
    });
    allYearArraysPromises.push(findAllYear);
  });
  const allYearArrays = await Promise.all(allYearArraysPromises);
  allYearArrays.forEach((findAllYear) => console.log('Steps 3 & 4 for', findAllYear));
  console.log('Step 5');
}
stratubas();

A: You need to await the result of the query inside the loop. At the moment it's returning a promise and goes straight to the following code.
try const findAllYear = await DayReport.findAll

A: Try using await or promises for "DayReport.findAll()". Also use map instead of for loop.


text:
Q: nodejs Out Of Memory only when running under forever, mon, upstart etc I have a node program I've tested tons of times doing nohup command & and it never runs into any memory problems as long as I pass node the --max_old_space_size=12000 as my process can use up to several GBs.
Now, I've tried running the exact same command with forever, mon, and upstart and the process will always fail with "FATAL ERROR: CodeRange::GetNextAllocationBlock Allocation failed - process out of memory"
Any ideas why this might be happening?  I haven't been able to check the memory usage right before it fails, but it looks like it fails when it reaches only about 3gb of memory.

A: Are you running via any start up script using forever ? If so just , find a way to add a the line  Max old space..

redpajama_set_name: RedPajamaStackExchange


text:
Q: Auth using jsonwebtoken(why user is equal to req.user) here is the code for auth using jsonwebtoken which i got from youtube tutorial,
why req.user =user
import jwt from "jsonwebtoken";
const auth = (req, res, next) => {
  try {
    const token = req.header("Authorization");
    if (!token) return res.status(400).json({ msg: "Invalid Authentication" });
    jwt.verify(token, process.env.SECRET_JWT, (err, user) => {
      if (err) return res.status(400).json({ msg: "Authentication Failed" });
      req.user = user;
      next();
    });

A: You set req.user = user so that you can actually use this in a later middleware function called after this one (triggered by next().
If you do not do something similar to this, you would not know who the user is in the next middleware function or you would have to verify/decode the token every time you need to know who the user is.


text:
Q: junit append file to report I have a test written in JUnit. On fail I would like to append a file to the report.
My thoughts: I just have to get the path and report name, so I can put a custom file right next to it, so it can be easily found.
How do I get that report file or path name?
Additional information: Those tests are run via Eclipse or Jenkins.
Update:
the name can be found like this: Get name of currently executing test in JUnit 4
The path seems to be a surefire topic ...


text:
Q: Call with curl works, its version with Guzzle 6 does not I am trying to convert a code that works, to its version with Guzzle, but I do not get the desired result, and I think it is due to a lack of understanding of Guzzle v6.
If I execute the following code, it's work fine
$postfields = array(
    'identifier' => $this->username,
    'secret' => $this->password,
    'accesskey' => $this->accesskey,
    'action' => 'GetClients',
    'responsetype' => self::RESPONSE_TYPE,
);

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $this->url.self::ENDPOINT);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($postfields));

$response = curl_exec($ch);

if (curl_error($ch)) {
    die('Unable to connect: ' . curl_errno($ch) . ' - ' . curl_error($ch));
}

curl_close($ch);

// Decode response
$jsonData = json_decode($response, true);

But if I try to convert to Guzzle v6, fails
$client = new GuzzleHttp\Client();

$response = $client->post($this->url.self::ENDPOINT, [
    'headers' => [
        'action' => 'GetClients',
        'identifier' => $this->username,
        'secret' => $this->password,
        'accesskey' => $this->accesskey,
        'responsetype' => self::RESPONSE_TYPE
    ]
]);

I get an exception
GuzzleHttp\Exception\ClientException  : Client error: `GET https://mydomain.test/intranet/includes/api.php` resulted in a `403 Forbidden` response:
result=error;message=Invalid IP 2.137.XXX.XX

On the other hand I do not know how to understand the call (url that forms Guzzle) with the get() method of Guzzle client.

A: An error in understanding the mechanism of sending the parameters, using headers instead of a correct form_params since it is a POST method
Correct code is
$response = $client->post($this->url.self::ENDPOINT, [
    'form_params' => [
        'action' => 'GetClients',
        'identifier' => $this->username,
        'secret' => $this->password,
        'accesskey' => $this->accesskey,
        'responsetype' => self::RESPONSE_TYPE
    ]
]);


text:
Q: Anyone know of a Java reporting tools which has a web based visual report designer? We're currently evaluating different Java reporting engines, and having a web-based ad-hoc report designer is a requirement.
We don't need anything too fancy, but we need users to be able to define a report with columns X, grouped by Y, sorted by Z, etc...
We've found that many of the open source tools do have graphical report designers, but the designers are typically not web based.  (For example, iReport from JasperReports seems to be an application, not a web tool)
Can anyone recommend a reporting tool which meets this web-based requirement?

A: Apparently JasperServer is exactly that (see "Drag and drop ad hoc report building" - http://www.jaspersoft.com/jasperserver).  Haven't used it myself though.

A: (full disclosure: yes, i work for i-net software)
Looks to me like our own i-net Clear Reports (used to be i-net Crystal-Clear) might work great.

*

*Can read Crystal Reports templates

*Supports any JDBC data source

*Has a web-based (and also Swing-based) ad hoc report creation tool

*...as well as a full-fledged report designer and report server

*includes a report repository for storing reports

*free and fully functional offline report designer as well

Check out our Ad Hoc demo and tell us what you think.

A: Use Crystal Reports for JSP pages.
It's a good tool.


text:
Q: Constantly invoke a method alongside GTKSharp application I am creating a real-time action game in GTKSharp (I know, not a good idea). I have a method that I need to constantly call that updates my game window (the images in some buttons) but I can't figure out how.
I tried putting the method in a loop and running the loop in another thread, besides the application thread.

*

*Tried it with Parallel.Invoke (although this just runs one thread after another, it fails to run them simultaneously)

    public static void Main(string[] args) {
        Parallel.Invoke(() => RunGameLoop(), () => RunApp());
    }

    public void RunGameLoop(){
        while(runGame) { //runGame is a bool, I change it to false when I click a button in MyGameWindow
            MyGameWindow.UpdateButtons(); //MyGameWindow is a GTK.Window
        }
    }

    public void RunApp(){
        MyGameWindow.Show();
        Application.Run();
    }

*

*Tried a couple of different ways to separate things in threads (which resulted in this error

Gdk:ERROR:/build/gtk+2.0-AoeliP/gtk+2.0-2.24.32/gdk/gdkregion-generic.c:1110:miUnionNonO: assertion failed: (y1 < y2)

that is followed by a bunch of text)

    public static void Main(string[] args) {
        Thread i = new Thread(new ThreadStart(RunGameLoop));
        Thread l = new Thread(new ThreadStart(RunApp));

        //I also tried with this
        //Thread i = new Thread(RunGameLoop);
        //Thread l = new Thread(RunApp);

        i.Start();
        l.Start();
    }

    public void RunGameLoop(){
        while(runGame) {
            MyGameWindow.UpdateButtons();
        }
    }

    public void RunApp(){
        MyGameWindow.Show();
        Application.Run();
    }

*

*I also tried to use tasks rather than threads (also doesn't work)

    public static void Main(string[] args) {
        Task[] tasks = new Task[2];

        tasks[0] = Task.Run(() => RunGameLoop());
        tasks[1] = Task.Run(() => RunApp());

        Task.WaitAll(tasks);
    }

    public void RunGameLoop(){
        while(runGame) {
            MyGameWindow.UpdateButtons();
        }
    }

    public void RunApp(){
        MyGameWindow.Show();
        Application.Run();
    }

    public static void Main(string[] args) {
        Task t1 = Task.Factory.StartNew(() => RunGameLoop());
        Task t2 = Task.Factory.StartNew(() => RunApp());
        Task.WaitAll(tasks);
    }

    public void RunGameLoop(){
        while(runGame) {
            MyGameWindow.UpdateButtons();
        }
    }

    public void RunApp(){
        MyGameWindow.Show();
        Application.Run();
    }

I have wasted a couple of hours on this issue and I honestly don't know, I could be misunderstanding something about how threading works or how GTKSharp works. I have thought of transferring the project to something proper like Unity but I've wasted a lot of time figuring out GTKSharp.
I am using Monodevelop 7.8.4 (build 2) and the project is a GTK# 2.0 Project.

A: After a good amount of searching for solutions, I came across this: How do I access GUI (GTK) from multi threads?. So, what I was trying to do was doomed from the beginning. After a bit more time, I found this: Winforms - Invoking a method in another thread which is for WinForms, the GTK equivalent is supposedly GLib.Timeout which I also couldn't get to work.
I guess it is completely impossible in GTK#. I will have to change how my program works.


text:
Q: Updating item in array of objects in Vue.js: is it better to replace the array or change one value I'm using Vue/Vuex to generate components from an array with this structure (retrieved from SQLite using better-sqlite3).
let table=[
  {
    id:1,
    column_1:'data',
    column_2:'data',
    column_3:{'1':'data','2':'data','3':'data'}
  },
  {
    id:2,
    column_1:'data',
    column_2:'data',
    column_3:{'1':'data','2':'data','3':'data'}
  },
  ...
]

There are cases where the data of multiple rows need to be updated at once. Since I need to pass data back and forth between SQLite and Vue, I'm wondering whether it'll be simpler and harmless to update the data with sql and then replace the entire javascript array with the updated data, including the unmodified rows. Otherwise I imagine I'll have to use .find() to go through and change the specific  items. So my question is whether replacing the whole array is a Bad Idea as far as reactivity goes, or whether Vue can smart update accordingly.

A: Vue has a different way of tracking when it comes to update the UI
Vue uses getters/setters on the data object for mutation tracking. When you execute this.table = [{}, {}, {}, ...];, It will go through the setter of table. In the setter, there's a function to notify the watcher and add this data changes to a queue.
Limitation/Behaviour while updating the Arrays :
Vue cannot detect the following changes to an array :

*

*When you directly set an item with the index, e.g. vm.items[indexOfItem] = newValue

*When you modify the length of the array, e.g. vm.items.length = newLength

Demo as per above two statements :

const app = new Vue({
  el: '#app',
  data() {
    return {
      table: [{
        id:1,
        column_1:'data1',
        column_2:'data',
        column_3:{'1':'data','2':'data','3':'data'}
      }, {
        id:2,
        column_1:'data2',
        column_2:'data',
        column_3:{'1':'data','2':'data','3':'data'}
      }]
    }
  },
  mounted() {
    // We are updating the array item and It's not reactive (You can see it's not updating UI)
    this.table[1] = {
      id: 3,
      column_1: 'data3',
      column_2:'data',
      column_3:{'1':'data','2':'data','3':'data'}
    }
  }
})

      {{ item.column_1 }}

Answer of your Question : In consideration of above two statements, You have to update whole array including the unmodified rows.
Demo as per the answer of your question :

const app = new Vue({
  el: '#app',
  data() {
    return {
      table: [{
        id:1,
        column_1:'data1',
        column_2:'data',
        column_3:{'1':'data','2':'data','3':'data'}
      }, {
        id:2,
        column_1:'data2',
        column_2:'data',
        column_3:{'1':'data','2':'data','3':'data'}
      }]
    }
  },
  mounted() {
    // We are updating the whole array and It's reactive (You can see it's updating UI)
    this.table = [{
        id:1,
        column_1:'data1',
        column_2:'data',
        column_3:{'1':'data','2':'data','3':'data'}
      }, {
      id: 3,
      column_1: 'data3',
      column_2:'data',
      column_3:{'1':'data','2':'data','3':'data'}
    }]
  }
})

      {{ item.column_1 }}


text:
Q: handling request errors in node I am using request to access data from an api. sometimes, when the api Url is down, node throws error and shuts down with the following error
`at ClientRequest.emit (events.js:315:20)`
`at TLSSocket.socketErrorListener (_http_client.js:426:9)`
`at TLSSocket.emit (events.js:315:20)`
`at emitErrorNT (internal/streams/destroy.js:92:8)`
`at processTicksAndRejections (internal/process/task_queues.js:84:21)

errno: 'ENOTFOUND',
code: 'ENOTFOUND',
syscall: 'getaddrinfo',
hostname: APIURL
is there any way to handle this and prevent node from exiting?
my code is
const JSONdata= ()=>{
request({url:API_URL2,json:true},(error,response,body)=>{
    const data=[]
    var jsondata=body
    data.push(jsondata)
    const data2=JSON.stringify(data)
    fs.writeFile('sample.txt',data2,(err) => { if(error){console.log(error} })})

A: having a try-catch will prevent failure or system crash, also you get process.uncaughtException() to do something when the system crashes
check below link for more details
https://nodejs.org/api/process.html#process_event_uncaughtexception


text:
Q: List items in Powershell edited last 4 years I need to have a list of all files paths (not only filenames), of all the files eidted in the last 4 years.
The file must have extension .xxx
I am trying this:
ls –recurse -filter *.xxx | where-object {$_.lastwritetime -gt (get-date).addDays(-1460)}

This seems to work. However the results are not in the format I need:
    Directory: \\networkfolder\customerfolder

Mode                LastWriteTime         Length Name
----                -------------         ------ ----
-a----       18.02.2019     10:23           1558 file.xxx

I would like a list with all the paths, such as:
18.02.2019     10:23           1558 \\networkfolder\customerfolder\file.xxx
18.02.2019     11:23           1558 \\networkfolder\customerfolder2\file.xxx
18.02.2019     11:23           1558 \\networkfolder\customerfolder3\file.xxx

How can I achieve that?
I am analyzing a huge list of thousands of folders with child folders so it has to be recursive and in a clean format for another person to easily go one by one to those network paths and do their job on those files.

A: Select-Object may help you. See this link for detailed information about it.
ls –recurse -filter *.xxx | where-object {$_.lastwritetime -gt (get-date).addDays(-1460)} | Select-Object LastWriteName, Length, FullName


text:
Q: is there any horizontal scalable CEP(Complex event processing) engine available? are there any Complex event processing systems available which can scale horizontally. or is it possible to implement such system with current available technologies

A: Esper with Enterprise Edition comes to mind. The stack used there is based on Zookeeper and Kafka.
http://espertech.com/esper/faq_esper.php#scaling
http://www.espertech.com/products/esperee.php


text:
Q: Tkinter. Text. Python2.7. Не выводится текст Проблема заключается в следующем: при нажатии на кнопку "вперёд" или "назад" меняется изображение (это работает) и вместе с ним должен выводится текст в другой виджет.
#-*- coding: utf-8 -*-#
#Импорт библиотек#
import sys,os
sys.path.append("mdls/")

from PIL import Image,ImageTk
import Tkinter,tkMessageBox
#import textf as tf

#Создание трёх основных виджетов#
root_image = Tkinter.Tk()
root_image.geometry("400x400+100+140")
root_image.title("Изображения")

root_text = Tkinter.Toplevel()
root_text.geometry("600x400+300+300")
root_text.title("Текст")

buttons_frame = Tkinter.Toplevel()
buttons_frame.title("Управление")
buttons_frame.geometry("300x30+0+0")
buttons_frame.resizable(0,0)

import glob

image_list = glob.glob("images/*.gif")
text_list = glob.glob("text/*.txt")

current_image = 0
current_text = 0

def program_information():
    info_widget = Tkinter.Toplevel()
    info_widget.title("Информация")
    info_widget.geometry("595x650+650+100")
    info_widget.resizable(0,0)

    who_created = ("\t|Создал NAME NAME | 2015 год|")
    text= Tkinter.Text(info_widget,font=("consolas",12),
                       width=len(who_created),height=1,
                       fg="lightblue",bg="black",wrap=Tkinter.WORD)
    text.pack()

    text.insert(1.0,who_created)

    info_linky_image = Tkinter.PhotoImage(file="mdls/title_demo_image.gif")
    info_label = Tkinter.Label(info_widget,image=info_linky_image)
    info_label.pack(side=Tkinter.TOP)

    tkMessageBox.showinfo(message="Производим велосипеды уже три года")

    info_widget.mainloop()

def change_image(delta):
    global current_image,current_text,image_list,text_list

    current_image += delta
    current_text += delta

    image = Image.open(image_list[current_image])
    photo = ImageTk.PhotoImage(image)

    textf = Tkinter.Text(root_text)#,font=("times",14))
    textf.insert(Tkinter.END, open("text/txt"+str(current_image)+".txt").read())

    image_label['text'] = image_list[current_image]
    image_label['image'] = photo
    image_label.photo = photo

#Область изображений#
image_label = Tkinter.Label(root_image, compound=Tkinter.TOP)
image_label.pack()

#Область текста#
text_label = Tkinter.Text(root_text)
text_label.pack(side=Tkinter.TOP)
#text_label.insert(1.0,sorted(os.listdir("images/")))

#Описание действий кнопок#
Tkinter.Button(buttons_frame, text="Назад",relief=Tkinter.GROOVE,
               command=lambda: change_image(-1)).pack(side=Tkinter.LEFT)

Tkinter.Button(buttons_frame,relief=Tkinter.GROOVE,
               text="Вперёд", command=lambda: change_image(+1)).pack(side=Tkinter.LEFT)

Tkinter.Button(buttons_frame, text="Выход",relief=Tkinter.GROOVE,
               command=root_image.destroy).pack(side=Tkinter.LEFT)

Tkinter.Button(buttons_frame, text="Информация",relief=Tkinter.GROOVE,
               command=program_information).pack()

#Завершение программы#
change_image(0)

root_text.mainloop()
root_image.mainloop()

A: from Tkinter import *
from random import choice

root = Tk()
root.geometry('800x600')
texts = ('qwe','dfgh','2345wg','.,mnlwert','@#$%@#$%')

def click(event):
    label['text'] = choice(texts)
    #print(dir(text))
    text.delete('1.0',END)
    text.insert(0.0,label['text'])

label = Label(root,text='hi')
label.pack()

text = Text(root)
text.pack()

root.bind('<1>',click)
root.mainloop()


text:
Q: How to identify whether automatic date and time is enabled in iOS using Xamarin Forms I have a Xamarin Forms application where I need to check the Automatic date and time setting value in both Android and iOS devices. For Android I used the below code and getting the value based on the setting.
android.provider.Settings.Global.getInt(getContentResolver(),android.provider.Settings.Global.AUTO_TIME, 0);

However for Xamarin.iOS, I did not find any code to achieve this. Please help me.


text:
Q: Install Donkey car Python TensorFlow - Raspberry Pi use Raspberry Pi 4 Model B 2GB
Raspbian BULLSEYE (DEBIAN 11) ARMV71
package name "2022-04-04-raspios-bullseye-armhf-full"
i try Install Donkeycar Python Code from official website when I enter installation code
pip install https://github.com/lhelontra/tensorflow-on-arm/releases/download/v2.2.0/tensorflow-2.2.0-cp37-none-linux_armv7l.whl

Error: donkeycar tensorflow-2.2.0-cp37-none-linux_armv7l.whl is not a supported wheel on this platform.

A: If you run the 64-bit Raspberry Pi OS you can install Tensorflow in the standard way - pip3 install tensorflow. The 64-bit system comes with a reasonably recent version of python 3 preinstalled (3.8 maybe? - I can't remember exactly), so you can just create a virtual environment and go.
That's how I remember it anyway - I'm hoping I'm not forgetting some obstacle.
It appeared to work OK to me, but it's slow - much slower than on an x86 cpu.
I never managed to install Tensorflow on 32-bit Raspbian. And conda didn't seem to work either - I think it assumes a higher ARM spec than the Pi uses.
[Edited to add...] After checking, I think you may need to pip install tensorflow-aarch64, not standard tensorflow.


text:
Q: Setting email sender and recipient from share sheet (ios) Goal: implement a sharesheet (UIActivityViewController) that includes Gmail as an option, and sets the recipient and subject
Problem: setting subject works, but setting recipient (forKey: "to") crashes the program.
I would like to have the ability to set the sender and recipient field of the share sheet email client, but so far I have been unable to find any way of doing this. Any help is appreciated!
Relevant code:
let email = ["bob@bobsCompany.com"]
let activityVC = UIActivityViewController(activityItems: [""], applicationActivities: nil)

activityVC.excludedActivityTypes = excludedActivity

activityVC.setValue("Subject Title", forKey: "subject")

activityVC.setValue(email[0], forKey: "to")

activityVC.popoverPresentationController?.sourceView = self.view
self.presentViewController(activityVC, animated: true, completion: nil)

A: You can only set the Subject for UIActivityViewController. The program crashes because there is no "to" key. You will have to use the MailMFComposeViewController if you want to set the recipients and sender fields.
    if !MFMailComposeViewController.canSendMail()
    {
      let alertMsg = UIAlertController(title: "Test", message: "Mail services not available.", preferredStyle: UIAlertControllerStyle.Alert)
      alertMsg.addAction(UIAlertAction(title: "OK", style: UIAlertActionStyle.Default, handler: nil))
      self.presentViewController(alertMsg, animated: true, completion: nil)
    }
    else
    {
      let composeVC = MFMailComposeViewController()
      composeVC.mailComposeDelegate = self

      // Configure the fields of the interface.
      composeVC.setToRecipients(["mail@egmail.com"])
      composeVC.setSubject("Subject)
      composeVC.setMessageBody("Hi.", isHTML: false)

      // Present the view controller modally.
      self.presentViewController(composeVC, animated: true, completion: nil)
    }


text:
Q: Child component not displaying records from Parent record I am passing the results from Parent component to Child component but the results are not displayed for some reason. I have gone through many example codes and it seems I have done everything correctly. Can someone please help me with this issue?
Parent Component:
<aura:attribute access="public" type="Engage__c[]" name="Recs" />

Parent Component attribute is set in the helper.js with the results:
component.set("v.Recs",response.getReturnValue());

Child Component:
<aura:attribute access="public" name="datarows" type="Engage__c[]" />

Included this in the Parent component:
<c:RecList dataRows="{!v.Recs}"/>

It displays the results when I iterate all the {!v.Recs} in the Parent Component. It means {!v.Recs} attribute has got all the results correctly.
Just wondering what could be the issue?

A: lightning components are case-sensitive, so either change name of attribute to  name="dataRows" or change calling child component
<c:RecList datarows="{!v.Recs}"/>


text:
Q: hibernate data fetching from multiple tables I have 3 tables. Master,child1,child2.
Master has one to many relationship with child1.
Master has one to many relationship with child2.
There is no relation between child1 and child2.
I want to retrieve data from all 3 tables in single query using hibernate.
Table - Master
   id
   11
   12

Table - child1
   id    deposited_date      Master_child1_reltion_key
   2     2012-10-10                   11
   3     2012-10-10                   11
   4     2012-10-10                   11
   5     2011-01-01                   12
   6     2005-02-20                   13

Table - child2
   id    phoneNo      phone_type        master_child2_relation_key
   15    1111111      personal              11
   16    2222222      office                11
   17    3333333      home                  11
   18    1010100      personal              12

In table child2 there can be none,1,2, or 3 records against Master table.
I wanted to retrieve values from all 3 tables. like
  id     deposited_date    phoneno1     phoneno2     phoneno3
  11       2012-10-10      1111111      2222222       3333333
  12       2011-01-01      1010100
  13       2005-02-20

Is it possible to retrieve data using single query in hibernate or do I need to use multiple queries ?

A: Select master from master master left join fetch master.child1 left join fetch master.child2
This will bring master as a root with two populated list of childs?
As concern to id=13 i didn't understand how  do you have a FK to not existing master.

A: You can use Criteria to fetch data from all the 3 tables as following:
Criteria crit = session.createCriteria(Master.class);
crit.setFetchMode("child1", FetchMode.JOIN);
crit.setFetchMode("child2", FetchMode.JOIN);
crit.setResultTransformer(criteria.DISTINCT_ROOT_ENTITY);
List<Master> masters = crit.list();

Here masters will be a list of Master with associated child1 & child2 entities.


text:
Q: Is there a way to register user and password for an account on IIS? I have a Web Service running on IIS.
My goal is to be able to access a network folder on a Linux machine (Samba Server) which is password protected. Can I make a user account on IIS which will have username and password register and this account will be the account the asp.net uses to run the service. Also I will give full access to this account from the Linux machine.
My Question is, if it is possible to pass a password to IIS metabase.

A: Usually I do this with impersonation in code. You could use this small helper class in an easy-to-use manner:
using ( new Impersonator( "myUsername", "myDomainname", "myPassword" ) )
{
   // <code that executes under the new context>
}

Alternatively, there is also ASP.NET Impersonation available.

A: How TO: Change Application Pool Identity Programmatically
   //Initialize the metabase path
    string metabasePath = "IIS://localhost/W3SVC/AppPools";
    //Specify the name for your application pool
    string appPoolName = "testAppPool"; //specify the domain account as domain\username
    //Specify the identity that will run the application pool
    string appPoolUser = "User1";
    //Specify the password for the user
    string appPoolPass = "Password1";
    DirectoryEntry pool1;
    DirectoryEntry apppools = new DirectoryEntry(metabasePath);
    pool1 = apppools.Children.Find(appPoolName, "IIsApplicationPool");

    /*Change Application Pool Identity*/
    pool1.InvokeSet("AppPoolIdentityType", new Object[] { 3 });
    pool1.InvokeSet("WAMUserName", new Object[] { Environment.MachineName + @"\" + appPoolUser }); //If you are using a local account

    pool1.InvokeSet("WAMUserPass", new Object[] { appPoolPass });
    /*Commit changes*/

    pool1.CommitChanges();


text:
Q: How should I organize this star grounding network? I am trying to lay out a PCB for a SEPIC switching regulator. However, I cannot be sure how to layout the ground tracks. My area and budget are limited and my components are big. A picture says more than my words, so here are the schematic, my questions and some more details:
I only included some of the components for the sake of simplicity, if the whole schematic needed, I can upload.
Grounds of CU2, U2 and U1 are tied together (may be daisy chained), then gathered in one point which is "AGND".
Grounds of C1 (which supplies the additional current to the push-pull driver since 78L12 can only supply 100mA), Q2 and Q3 are star tied together at one point that is "PGND".
Then, PGND and AGND are star tied to the ground point of C6, which I've chosen to be the reference point.

*

*If my star network is connected wrong or can be problematic, how should I organize it?

*Is the ground side of C6 a good place for the reference point for the star ground network?

*Will daisy-chaining AGND nodes lead to problems?

*Should I star-connect 12V rails, if so, how? (U1 has a 100nF bypass cap which is not shown here)

Here is the datasheet for Q3 which is a IXTP44N10T. BC817 and BC807 are 500mA transistors. Here is the internals of 78LXX.
If it will help, here is my current board layout for the mentioned part:
Top, Bottom, Bottom Inverted

A: Star grounds for most things, and especially for power supplies, is bad.  It is much better to just have a giant solid ground plane across the entire PCB, and have short & thick traces from your components directly to the plane.
While you're at it, you should have a solid plane for your +12v rail.  Although I'm less sure about this, because it depends a lot of stuff you didn't put in your schematic.
The reason why star grounds are generally bad is because it provides the opportunity to have ground voltage differences in different areas of the PCB's due to current flow in the ground traces.  Very careful PCB routing with really wide traces can prevent that, but just using a solid plane will reduce the ground inductance/resistance enough that for most applications the need for a star ground (or isolated ground) just goes away.
Update:
If for some reason you can't have a solid ground plane, then approximate one as best you can.
Do it like this:  First, identify your high-current paths.  This is normally your Vin, Vout, any FET's and Diodes used as the switching elements, inductors, the caps on Vin and Vout, and the GND that connects these parts.  Route these traces first.  Make them as short and fat as possible.  What you're trying to do is give that path a very low impedance/resistance and also reduce the loop areas.  After that, route everything else.  When routing the GND, try to approximate a gnd plane.  Sure there will be lots of holes, but you'll get reasonably close.  And since you routed all of your high-current GND traces already, the really critical stuff has already been done.
It is most important to reduce the noise on the high current paths, even if that means more noise on the grounds.  This is a switching regulator after all, some noise is to be expected.  By dealing with the high current paths first, you are going to have a higher net noise reduction than anything with a star ground.
Unfortunately, if you can't have solid power/ground planes then everything is going to be a compromise.  It'll never be perfect, and it'll never be "right".  You'll have to settle for "good enough".  On the plus side, I'm sure you can end up with something that works for you.


text:
Q: Java Jasper Report Tutorial I'm new to Java and looking to learn Jasper reports. Are there any good online video tutorials for Jasper Reports ?. I'm working with Spring 4.x, Hibernate 5.x and MySQL database.

A: When I used this frameworks with Jasper report but i didn't find any video already I did not do anything specific.Firstly i described "datasource" and passed value to report after that i learnt how to define subreport.I think this approach works.You can do research in this way.


text:
Q: GNU Radio circular buffer manipulation I encountered the following error
gr::log :WARN: tpb_thread_body - asynchronous message buffer overflowing, dropping message

Out of serendipity, I ran into this GNU Radio presentation on
Youtube.
The presenter mentioned an OOT block he called "buffer" that is capable of eliminating the "buffer overflowing" error. Apparently, this block plays with different sample rates and the so-called "circular buffers". I haven't worked with circular buffers myself. Any ideas on circular buffers or any hints on how to build this buffer block are welcome.

EDIT
Below is the flowgraph that generates the error. As it was suggested in the comments, the culprits could be the message processing blocks (red-circled) namely generateCADU (for generating standard CCSDS frames) and processCADU (for extracting CADUs from a data stream).

The implementation file of the generateCADU block is given below
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif

#include <gnuradio/io_signature.h>
#include "generateCADU_impl.h"
#include "fec/ReedSolomon/ReedSolomon.h"
#include "fec/Scrambler/Scrambler.h"

namespace gr {
  namespace ccsds {

generateCADU::sptr
generateCADU::make(int frameLength,std::string sync, int scramble, int rs, int intDepth)
{
  return gnuradio::get_initial_sptr
    (new generateCADU_impl(frameLength, sync, scramble, rs, intDepth));
}

/*
 * The private constructor
 */
generateCADU_impl::generateCADU_impl(int frameLength,std::string sync, int scramble, int rs, int intDepth)
  : gr::sync_block("generateCADU",
          gr::io_signature::make(1, 1, sizeof(unsigned char)),
           gr::io_signature::make(0, 0, 0)),
d_frameLength(frameLength),d_scramble(scramble == 1),d_rs(rs >= 1), d_basis(rs >= 2), d_intDepth(intDepth)

{
  set_output_multiple(d_frameLength);
  //Registering output port
  message_port_register_out(pmt::mp("out"));
  d_sync = parse_string(sync);
}

/*
 * Our virtual destructor.
 */
generateCADU_impl::~generateCADU_impl()
{
}

unsigned char
generateCADU_impl::parse_hex(char c)
{
  if ('0' <= c && c <= '9') return c - '0';
  if ('A' <= c && c <= 'F') return c - 'A' + 10;
  if ('a' <= c && c <= 'f') return c - 'a' + 10;
  std::abort();
}

std::vector<unsigned char>
generateCADU_impl::parse_string(const std::string & s)
{
  if (s.size() % 2 != 0) std::abort();
  std::vector<unsigned char> result(s.size() / 2);

  for (std::size_t i = 0; i != s.size() / 2; ++i)
    result[i] = 16 * parse_hex(s[2 * i]) + parse_hex(s[2 * i + 1]);

  return result;
}
int
generateCADU_impl::work(int noutput_items,
    gr_vector_const_void_star &input_items,
    gr_vector_void_star &output_items)
{
  const unsigned char *in = (const unsigned char *) input_items[0];

  //Reed-Solomon and Scrambler objects
  ReedSolomon RS(16,d_intDepth,d_basis);// False = conventional, True = dual-basis
  Scrambler S;

  //Buffers
  unsigned char *frameBuffer1 = (unsigned char*)malloc(d_frameLength*sizeof(unsigned char));
  std::vector<unsigned char> frameBuffer2;

  //The work function engine
  for(int i = 0; (i + d_frameLength) < noutput_items; i += d_frameLength)
{
  //Copying data from input stream
  memcpy(frameBuffer1,in + i + d_frameLength,d_frameLength);

  //Copying frame into std::vector buffer
  frameBuffer2.insert(frameBuffer2.begin(),frameBuffer1, frameBuffer1 + d_frameLength);

  //Optional scrambling and Reed-Solomon
  if (d_rs) RS.Encode_RS(frameBuffer2);
  if (d_scramble) S.Scramble(frameBuffer2);

  //Insert sync word
  frameBuffer2.insert(frameBuffer2.begin(), d_sync.begin(), d_sync.end());

  //Transmitting PDU
  pmt::pmt_t pdu(pmt::cons(pmt::PMT_NIL,pmt::make_blob(frameBuffer2.data(),frameBuffer2.size())));
  message_port_pub(pmt::mp("out"), pdu);

  //Clear buffer
  frameBuffer2.clear();
}

  // Tell runtime system how many output items we produced.
  return noutput_items;
}

} /* namespace ccsds */
} /* namespace gr */

And here is the processCADU block. This block uses tags generated by the synchronizeCADU (which is simply a wrapper for the correlate_access_tag block) to extract CADUs
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif

#include <gnuradio/io_signature.h>
#include "processCADU_impl.h"
#include "fec/ReedSolomon/ReedSolomon.h"
#include "fec/Scrambler/Scrambler.h"

namespace gr {
   namespace ccsds {

processCADU::sptr
processCADU::make(int frameLength, int scramble, int rs, int intDepth, std::string tagName)
{
  return gnuradio::get_initial_sptr
    (new processCADU_impl(frameLength, scramble, rs, intDepth, tagName));
}

/*
 * The private constructor
 */
processCADU_impl::processCADU_impl(int frameLength, int scramble, int rs, int intDepth, std::string tagName)
  : gr::sync_block("processCADU",
           gr::io_signature::make(1, 1, sizeof(unsigned char)),
           gr::io_signature::make(0, 0, 0)),
d_frameLength(frameLength),d_scramble(scramble == 1),d_rs(rs >= 1), d_basis(rs >= 2), d_intDepth(intDepth)
{
  //Multiple input
  set_output_multiple(d_frameLength * 8);

  //Registering output port
  message_port_register_out(pmt::mp("out"));

  if (d_rs) d_frameLength += 32 * d_intDepth;
  //SEtting tag name
  key = pmt::mp(tagName);
}

/*
 * Our virtual destructor.
 */
processCADU_impl::~processCADU_impl()
{
  delete d_pack;
}

int
processCADU_impl::work(int noutput_items,
           gr_vector_const_void_star &input_items,
           gr_vector_void_star &output_items)
{
  const unsigned char *in = (const unsigned char *) input_items[0];
  unsigned char *out = (unsigned char *) output_items[0];

  void *msg_data = NULL;
  unsigned char frame_data[d_frameLength];
  unsigned char frame_len = 0;
  std::vector<unsigned char> frameBuffer;

  //Reed-Solomon and Scrambler objects
  ReedSolomon RS(16,d_intDepth,d_basis);// False = conventional, True = dual-basis
  std::vector<int> errors;//errors.push_back(0);
  Scrambler S;

  d_tags.clear();
  d_pack = new blocks::kernel::pack_k_bits(8);

  this->get_tags_in_window(d_tags, 0, 0, noutput_items,key);
  for(d_tags_itr = d_tags.begin(); d_tags_itr != d_tags.end(); d_tags_itr++) {
// Check that we have enough data for a full frame
if ((d_tags_itr->offset - this->nitems_read(0)) > (noutput_items - (d_frameLength) * 8))
  {
    return (d_tags_itr->offset - this->nitems_read(0) - 1);
  }
//Pack bits into bytes
d_pack->pack(frame_data, &in[d_tags_itr->offset - this->nitems_read(0)], d_frameLength);

//Copying frame into std::vector buffer
frameBuffer.insert(frameBuffer.begin(),frame_data, frame_data + d_frameLength);

//Optional scrambling and Reed-Solomon
if (d_scramble) S.Scramble(frameBuffer);
//if (d_rs) RS.Decode_RS(frameBuffer,errors);
//If there is Reed-Solomon decoding

if(d_rs)
  {
    RS.Decode_RS(frameBuffer,errors);
    if (RS.Success(errors)) // Success
      {
    //std::cout << "Success" << std::endl;
    pmt::pmt_t pdu(pmt::cons(pmt::PMT_NIL,pmt::make_blob(frameBuffer.data(),frameBuffer.size())));
        message_port_pub(pmt::mp("out"), pdu);
    /*for(int i=0; i < errors.size(); i++)
      {

        //std::cout << "Number of Errors : " << errors.at(i) << std::endl << std::endl;
        }*/
      }
    else // Failure
      {
    std::cout << "RS failure" << std::endl;
      }
  }
  else{
  pmt::pmt_t pdu(pmt::cons(pmt::PMT_NIL,pmt::make_blob(frameBuffer.data(),frameBuffer.size())));
  message_port_pub(pmt::mp("out"), pdu);
  }

//Clear buffers
frameBuffer.clear();
errors.clear();
  }

  // Tell runtime system how many output items we produced.
  return noutput_items;
}

} /* namespace ccsds */
} /* namespace gr */

Regards,
M

A: Thanks to @MarcusMüller suggestion, using the tagged_stream paradigma as opposed to PDUs solved the problem. I was able to transmit 47 terabytes of data without any problems. Below is the code for the newly implemented block.
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif

#include <gnuradio/io_signature.h>
#include "genCADU_impl.h"

namespace gr {
  namespace ccsds {

genCADU::sptr
genCADU::make(int frameLength,std::string sync, int scramble, int rs, int intDepth, std::string len_tag_key)
{
  return gnuradio::get_initial_sptr
    (new genCADU_impl(frameLength, sync, scramble, rs, intDepth, len_tag_key));
}

/*
 * The private constructor
 */
genCADU_impl::genCADU_impl(int frameLength,std::string sync, int scramble, int rs, int intDepth, std::string len_tag_key)
  : gr::tagged_stream_block("genCADU",
          gr::io_signature::make(1, 1, sizeof(unsigned char)),
          gr::io_signature::make(1, 1, sizeof(unsigned char)),len_tag_key),
    d_frameLength(frameLength),d_scramble(scramble == 1),d_rs(rs >= 1), d_basis(rs >= 2), d_intDepth(intDepth)
{
    //Synchronization pattern
    d_sync = parse_string(sync);

    //Reed-Solomon and Scrambler objects
RS = new ReedSolomon(16,d_intDepth,d_basis);// False = conventional, True = dual-basis
    S = new Scrambler();
}

/*
 * Our virtual destructor.
 */
genCADU_impl::~genCADU_impl()
{
  delete RS;
  delete S;
}

int
genCADU_impl::calculate_output_stream_length(const gr_vector_int &ninput_items)
{
  int noutput_items = (d_rs) ? d_frameLength + 32*d_intDepth + d_sync.size() : d_frameLength + d_sync.size();
  return noutput_items ;
}

unsigned char
genCADU_impl::parse_hex(char c)
{
  if ('0' <= c && c <= '9') return c - '0';
  if ('A' <= c && c <= 'F') return c - 'A' + 10;
  if ('a' <= c && c <= 'f') return c - 'a' + 10;
  std::abort();
}

std::vector<unsigned char>
genCADU_impl::parse_string(const std::string & s)
{
  if (s.size() % 2 != 0) std::abort();
  std::vector<unsigned char> result(s.size() / 2);

  for (std::size_t i = 0; i != s.size() / 2; ++i)
    result[i] = 16 * parse_hex(s[2 * i]) + parse_hex(s[2 * i + 1]);

  return result;
}

int
genCADU_impl::work (int noutput_items,
                   gr_vector_int &ninput_items,
                   gr_vector_const_void_star &input_items,
                   gr_vector_void_star &output_items)
{
  const unsigned char *in = (const unsigned char *) input_items[0];
  unsigned char *out = (unsigned char *) output_items[0];

  int total_len;

  //Copy pdu from circular buffer to local buffer
  buffer.insert(buffer.end(), in, in +  d_frameLength);

  //Optional scrambling and Reed-Solomon. TO DO: Turbo and LDPC
  if (d_rs) RS->Encode_RS(buffer);
  if (d_scramble) S->Scramble(buffer);

  //Insert sync word
  buffer.insert(buffer.begin(), d_sync.begin(), d_sync.end());

  //Copy from local buffer to circular buffer
  std::copy(buffer.begin(),buffer.end(),out);

  //Clear the local buffer
  total_len = buffer.size();
  buffer.clear();

  // Tell runtime system how many output items we produced.
  return total_len;
}

} /* namespace ccsds */
} /* namespace gr */

Regards,
M.


text:
Q: Parent/child model for DTO I am not sure if this situation would more be related to generics than DTOs, but here it goes:
I have a DTO that represents a Person. A Person can have as children other Person(s) or just ResourceLink to those Person(s). This means that the child can be of either of the 2 types: Person (the DTO) or the ResourceLink. What type it would be, is determined through a queryParam and consequently logically through the flow follwed. I want to represent them using just ONE collection object and am not aware of the best way to do so.
Here is what I have so far:
public class PersonDTO<T> {

    @XmlElementWrapper(name = "children")
    @XmlElement(name = "child")
    List<T> children;
    // other stuff

}

With this approach, I need to define the translated type based on an if...else condition.
Earlier I had 2 different collections, one of which remained NULL. I also thought of extracting the relationship thing out in a new DTO as ChildrenDTO (not sure if that's a great idea)
I would like to know if there is a best practice for this situation, otherwise, if it is possible to declare a PersonDTO<PersonDTO> or PersonDTO<ResourceLink> depending on a condition.
Thanks in advance!

A: I'd suggest instead, using a third type for the elements of List children:
    public interface PersonResolver () {
          Person resolvePerson ();
    }

    public class Person implements PersonResolver {
          Person resolvePerson () { return this; }
    }

    public class ResourceLink implements PersonResolver {
          Person resolvePerson () {
               if (myLinkTargetType == TARGET_TYPE_PERSON)
                      { return (Person) myTarget; }
               return null;
          }
    }


text:
Q: Regular expression in JavaScript that matches ${} I want regular expressions to match string that starts with either ${ , "${ , '${ and ends with } , }' , }". My string may be ${anythinghere}, "${anythinghere}", '${anythinghere}'. I tried with the following
var str = "${a}";
var patt = /^("|'|${)*(}|'|")$/;
var res = patt.test(str);
alert(res);

But my above code always returns false.

A: You have to escape the inner $ with a backslash, since it's a special character. But that alone won't fix the problem. As it is above, patt matches any string that begins with " or ' or ${, 0 or more times, and ends with } or ' or ". The regular expression that you want would be something like this:
var str = "${a}";
var patt = /^(['"]?)\${.*}\1$/;
var res = patt.test(str);
alert(res);

Here is what each part of patt is doing:

*

*^(['"]?): The string must begin with 0 or 1 single quote, or with 0 or 1 double quote. This is in parentheses so that we can reference it at the end of the regexp

*\${: Next must be a dollar sign followed by an open curly bracket

*.*: Next must be 0 or more of any character (other than a newline)

*}: Next must be a closed curly bracket

*\1$: Finally, the string must end with whatever pattern was matched at the beginning of the string. \1 is a "back-reference" to the first capturing group (in the parentheses), so if the string began with a single quote, it will only match if it also ends with a single quote. Same goes for double quotes, and no quotes at all

A: $ has a special meaning in regex, so it must be escaped using a backslash \. If you want 1 or more wildcards, that's represented with a .+, not a *. The following code will match the test pattern:
/^'?"?\${.+}'?"?$/

A: This works:
var str = "\"${a}\"";
var patt = /^\"\$\{((?!\").)+\}\"$/;
var res = patt.test(str);
alert(res);

Note that the value assigned to str has been changed to \"${a}\" in order to reflect what you stated targets. You must escape (put a backslash before) any character you wish to be read literally and not as a metacharacter. In order to have this match any one of your targets at once, simply repeat the pattern in patt three times, separated by pipes as usual, replacing the \" with \' or nothing at all (in which case, you should change the \" inside the inner most parenthesis to }). These changes are shown below:
var patt = /^\"\$\{((?!\").)+\}\"$|^\'\$\{((?!\').)+\}\'$|^\$\{((?!\}).)+\}$/;

A: You can use
var a=new RegExp("\^(\'\\$\{)[a-z]+(\}\')|(\"\\$\{)[a-z]+(\}\")|(\\$\{)[a-z]+(\})\$");
a.test("${vijay}")//true
a.test("\'${vijay}\'")//true
a.test("\"${vijay}\"")//true
a.test("\'${vijay}\"")//false

If you use only \$ it takes as end og expresion.So use\\$ means $ as a special character


text:
Q: scheduling a command to execute right after a *running* command finishes? Sometimes I will run a command 'foo', and it takes way longer than I expect it to. If I were to rerun it, I'd probably do something like:
foo && mail -s "foo is done" me@com.com

..so it emails me when it's done and I can go do something else. But what if I already launched foo and I don't want to restart it? Is there a way to append the && mail... part to the original command, so to speak?
Thanks.

A: You can suspend foo with Control-Z, then relaunch it with fg. To run mail after foo is done, suspend and relaunch with fg && mail -s "foo is done" me@com.com, which will continue foo and execute mail when foo is done. (Note that because you're using &&, mail will only execute if foo is successful. To run regardless of if it succeeds or fails, use ; instead of &&.

A: Suspend it with ctrl-z and then use bg to send it to the background and then wait %1 && <command> (where %1 is the number in brackets from running bg) or if it is the only backgrounded command then just wait; <command> will work (but you can't use && reliably in that case since a bare wait always returns zero).


text:
Q: Parametric fit of a cdf to data using arbitrary loss functions in R I'd like to use R to fit a cdf to a set of data points of the form ${ (x_i, y_i) }_{i=1}^N$, where the cdf is taken from a parametric family. (For the sake of illustration, imagine, say, the Beta family of cdfs.)
Ordinarily when fitting a distribution parametrically, one would perhaps use MLE. However, instead of choosing the parameters of the distribution family such that the (log-)likelihood is maximized, I would like to choose them such that a different, arbitrary (non-standard) loss function is minimized.
My overall loss function is still additively separable in that it has the form $\mathcal L = \sum_{i=1}^N \ell(y_i, \hat y_i)$, where $\ell$ measures loss for each observation and where $\hat y_i = F(x_i; \hat{\mathbf\theta})$ is the fitted value obtained from fitting the parametric cdf (with parameter vector $\mathbf\theta$).
Some googling suggests that this is basically M-estimation. So my question is, how do I do this in R? The function $\ell$ can be implemented, but I'm unsure as to how to proceed from there. Are there any packages for this, or should I, for a given parametric family $F(\cdot, \mathbf\theta)$, simply plug $F$ into $\ell$ and use optim() or an alternative (which?) to choose the parameters $\mathbf\theta$ minimizing overall loss?
Thank you!
Edit: I forgot to mention I found this function, but it doesn't allow for arbitrary loss functions.
Side note: it seems that SO, unlike other SX sites, does not support embedded TeX for math. Apologies; I could edit this post, but I feel it's actually easier to mentally parse the TeX commands than to try to recreate the formulas poorly using Markdown.


text:
Q: Confidence interval for difference between proportions I'm wondering if someone could let me know if I have calculated the confidence interval for the difference between two proportions correctly.
The sample size is 34, of which 19 are females and 15 are males. Therefore, the difference in proportions is 0.1176471.
I calculate the 95% confidence interval for the difference to be between -0.1183872 and 0.3536814. As the confidence interval passes through zero, the difference is not statistically significant.
Below are my workings out in R, with results as comments:
f <- 19/34
# 0.5588235

m <- 15/34
# 0.4411765

n <- 34
# 34

difference <- f-m
# 0.1176471

lower <- difference-1.96*sqrt((f*(1-f))/n+(m*(1-m))/n)
# -0.1183872

upper <- difference+1.96*sqrt((f*(1-f))/n+(m*(1-m))/n)
# 0.3536814

A: My original answer that was accepted by OP assumes a two-sample setting. OP's question deals with a one-sample setting. Hence, @Robert Lew's answer is the correct one in this case.
Original answer
Your formulas and calculations are correct. Rs internal function to compare proportions yields the same result (without continuity correction though):
prop.test(x=c(19,15), n=c(34,34), correct=FALSE)

    2-sample test for equality of proportions without continuity correction

data:  c(19, 15) out of c(34, 34)
X-squared = 0.9412, df = 1, p-value = 0.332
alternative hypothesis: two.sided
95 percent confidence interval:
 -0.1183829  0.3536770
sample estimates:
   prop 1    prop 2
0.5588235 0.4411765

A: In this case you have to use a one-sample test, as this is a single sample. Your question boils down to whether males (or females) are one half.
Here's how you'd do it using prop.test():
prop.test(x=19, n=34, p=0.5, correct=FALSE)

    1-sample proportions test without continuity correction

data:  19 out of 34, null probability 0.5
X-squared = 0.47059, df = 1, p-value = 0.4927
alternative hypothesis: true p is not equal to 0.5
95 percent confidence interval:
 0.3945390 0.7111652
sample estimates:
    p
0.5588235

A: Thought of small sample sizes, an exact CI can be computed using ExactCIdiff::BinomCI such that:
library(ExactCIdiff)
BinomCI(34,34,19,15)
$conf.level
[1] 0.95

$CItype
[1] "Two.sided"

$estimate
[1] 0.1176

$ExactCI
[1] -0.1107  0.3393


text:
Q: Как передать параметр между методами ASP.net Как получить из формы Post переменную, чтобы потом её вызвать в другом методе контроллера?
Цель такая: Есть база данных. Я ввожу через форму Data. А дальше выводиться список элементов из БД, у которых эта Data совпадает, как это сделать?
Получаю:
[HttpPost]
public ActionResult Search(int Price)
{
    IEnumerable<Book> books = db.Books;
    ViewBag.Books = books;
    ViewBag.Price = Price;
    return View();
}

Как мне теперь вызвать метод Show(), учитывая эту переменную Price?

A: Другой метод можно вызвать следующим образом:
return RedirectToAction("Search", new { Price = Data });

Где Data - переменная, считанная из формы.

A: Внесите логику из метода show в закрытый метод всего контроллера и вызывайте этот закрытый метод в обоих http методах. Вызывать открытые методы друг из друга в mvc - не лучшая идея.


text:
Q: com.facebook.sdk error 2 in ios When choosing not to allow a 'Connect' to a Facebook app, I'm stuck with Facebook throwing "com.facebook.sdk error2." errors at me, even after re-installing my app.
Is this a bug in the Facebook SDK or am I missing something?
I have gone through all post available as well as few bugs on developer.facebook.com, i have also made some changes in my code as per advice but still my users are reporting same issue.
I have followed this similar question but no solution.


text:
Q: How to: Use ejs without express I'm starting with node in general, and I'm attempting to do a site without express.
I would none the less want to use ejs to inject my html and this is where my problem is...
How do I attach the ejs.render(...) to the response?
PS: I know it might be a better option to use express, but I want to know how it works underneath before bridging it.
Something like:
var ejs = require("ejs");

function index (response, request, sequelize) {
    response.writeHead(200, {"Content-Type": "text/html"});
    test_data = "test data";
    response.end(ejs.render("./views/home.html",test_data));
}

exports.index = index;

But that works ^_^
Thanks!

A: First of all, You need install ejs -> $ npm install ejs --save
Simple example:
main.ejs:

 <%= exampleRenderEjs  %>

server.ejs
var ejs = require('ejs');
var fs = require('fs');

var htmlContent = fs.readFileSync(__dirname + '/main.ejs', 'utf8');

var htmlRenderized = ejs.render(htmlContent, {filename: 'main.ejs', exampleRenderEjs: 'Hello World!'});

console.log(htmlRenderized);

A: There is a project called Consolidate.js which provides a common API for many template engines.  This ensures they can all be interchangeable.  If you want to render templates directly, you want to be compatible with this API.
Sample code from the Consolidate.js README:
var cons = require('consolidate');
cons.swig('views/page.html', { user: 'tobi' }, function(err, html){
  if (err) throw err;
  console.log(html); // Or write to your `res` object here
});

This sample is for Swig, but similar code works for EJS or any of the compatible engines.

A: Example from some book:
template.ejs

    <% entries.map(entry => { %>

<%= entry.title %>

<%= entry.date %>

<%= entry.body %>

    <% }); %>

function blogPage(entries) {
    const values = { entries };
    const template = fs.readFileSync('./template.ejs', 'utf8');
    return ejs.render(template, values);
}

const server = http.createServer((req, res) => {
    const entries = getEntries();
    const output = blogPage(entries);
    res.writeHead(200, {'Content-Type': 'text/html'});
    res.end(output);
    console.log('run server');
});
server.listen(8000);


text:
Q: Reflection Java - Get all fields of all declared class based on this question
Get all Fields of class hierarchy
I have a similar question:
i have class A and B:
class A {
  @SomeAnnotation
  long field1;

  B field2; //how can i access field of this class?

}

class B {

  @SomeAnnotation
  long field3;

}

I want to get all fields values that have the annotation @SomeAnnotation from this 2 class.
like:
A.field1
B.field3

A: You can do it like this. You need to add more condition as per your requirement in filter:
public static List<Field> getAllFields(List<Field> fields, Class<?> type) {
    fields.addAll(
            Arrays.stream(type.getDeclaredFields())
                    .filter(field -> field.isAnnotationPresent(NotNull.class))
                    .collect(Collectors.toList())
    );
    if (type.getSuperclass() != null) {
        getAllFields(fields, type.getSuperclass());
    }
    return fields;
}

Call example:
List<Field> fieldList = new ArrayList<>();
getAllFields(fieldList,B.class);

A: You can use the "reflections" library.
https://github.com/ronmamo/reflections
    Reflections reflections = new Reflections(
            new ConfigurationBuilder()
                    .setUrls(ClasspathHelper.forPackage("your.packageName"))
                    .setScanners(new SubTypesScanner(), new TypeAnnotationsScanner(), new FieldAnnotationsScanner()));

    Set<Field> fields =
            reflections.getFieldsAnnotatedWith(YourAnnotation.class);

    fields.stream().forEach(field -> {
        System.out.println(field.getDeclaringClass());
        System.out.println(field.getName());
    });


text:
Q: setText on a TextView will overwrite previous text I have a text view that is by itself as part of a linear layout. The XML is:
<TextView
    android:id="@+id/label_text"
    android:layout_width="fill_parent"
    android:layout_height="77dp"
    android:layout_marginTop="3dp"/>

In the main program I first set the text view to a value:
private TextView character_speaking;

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

    character_speaking = (TextView) findViewById(R.id.label_text);
    character_speaking.setText("a text string that was large enough for two lines");
}

This works well.
Then I do another setText in response to a button push:
public void handleNextButtonClick(View view) {
    character_speaking.setText("first one line message");
}

And this worked as well
But then I did another setText in response to another button push:
public void handlePrevButtonClick(View view) {
    character_speaking.setText("second one line message");
}

And disaster strikes. The second one line message writes over the first one line message without clearing it.
Is there anyway to clear the first one line message before writing the second one line message?
I have already tried to get around this problem by using an EditText instead of a TextEdit but this was not acceptable because it allowed the user to write in the field.

A: I've encountered this similar issue. What made it work is funny -> I just put a black background color to my layout (LinearLayout) and it is working fine now.
It seems the background is not cleared, if it doesn't know what color to clear it with.

A: Hope this points you in the right direction.
Updated - Working Code & Description
Application min sdk is 11, and target sdk is 19.
My Previous Answer was a little miss leading because in fact you cannot define a ViewGroup in your XML. So you have to create a basic LinearLayout with a resource Id. Here is the following XML which I have come up with for you.
I hope this is exactly what you were looking for I forgot to note for you that you can't define a ViewGroup in XML, but you have to cast your layout to a ViewGroup.
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity" >

<LinearLayout
    android:id="@+id/textViewHolder"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_centerInParent="true"
    android:orientation="vertical" >
</LinearLayout>

<LinearLayout
    android:id="@+id/buttonBar"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true"
    android:orientation="horizontal"
    style="?android:attr/buttonBarStyle">

    <Button
        android:id="@+id/buttonPrevious"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:text="@string/text_Previous"
        style="?android:attr/buttonBarButtonStyle" />

    <Button
        android:id="@+id/buttonNext"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:text="@string/text_Next"
        style="?android:attr/buttonBarButtonStyle"/>
</LinearLayout>

My strings.xml:
<?xml version="1.0" encoding="utf-8"?>
 <resources>
  <string name="app_name">TextViewSwitcher</string>
  <string name="text_Previous">Previous</string>
  <string name="text_Next">Next</string>
 </resources>

And Finally my MainActivity.class:
public class MainActivity extends Activity {

// ------------------------------------
// Member Variables

private LinearLayout m_textViewHolder = null;
private Button m_btnPrevious = null;
private Button m_btnNext = null;
private final String m_nothingText = "Nothing Pressed";
private final String m_previousText = "Previous Pressed";
private final String m_nextText = "Next Pressed";

// ------------------------------------
// Class Overrides

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

    // Get a reference to the UI Elements
    m_textViewHolder    = (LinearLayout) findViewById(R.id.textViewHolder);
    m_btnPrevious       = (Button) findViewById(R.id.buttonPrevious);
    m_btnNext           = (Button) findViewById(R.id.buttonNext);

    // Add Listeners to the Buttons
    m_btnPrevious.setOnClickListener(PreviousListener);
    m_btnNext.setOnClickListener(NextListener);

    // Populate the Initial Layout with a new TextView, & set the Text
    TextView nothingTextView = new TextView(getBaseContext());
    nothingTextView.setText(m_nothingText);
    ((ViewGroup) m_textViewHolder).addView(nothingTextView);

}

// -----------------------------------------
// Private Methods

// Creates  a new TextView based on the Text Passed in, and returns the new TextView
private TextView createNewTextView(String text)
{
    TextView newTextView = new TextView(getBaseContext());
    newTextView.setText(text);

    return newTextView;
}

// Removes the Child Views of the Parent ViewGroup
private void removeChildViewsFromParent()
{
    ((ViewGroup) m_textViewHolder).removeAllViews();
}

// -------------------------------------
// Listeners

private OnClickListener PreviousListener = new OnClickListener()
{
    @Override
    public void onClick(View v)
    {
        removeChildViewsFromParent();
        ((ViewGroup) m_textViewHolder).addView(createNewTextView(m_previousText));

    }

};

private OnClickListener NextListener = new OnClickListener()
{
    @Override
    public void onClick(View v)
    {
        removeChildViewsFromParent();
        ((ViewGroup) m_textViewHolder).addView(createNewTextView(m_nextText));

    }

};

}

Sorry for the Quick Answer before but this produces the following results when the buttons are pressed.

A: I think that I have decided on a workaround.
Instead of using a TextEdit (which apparently cannot be used for what I want), I will use an EditText.
<EditText
    android:id="@+id/label_text"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:hint=""
    android:focusable="false"/>

The last line is the key.  This prevents the user from clicking on the EditText and defacing the text with a keyboard.
The rest of the code is what you would expect:
private EditText character_speaking;

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

    character_speaking = (EditText) findViewById(R.id.label_text);
    character_speaking.setText("a text string that was large enough for two lines");
}

public void handleNextButtonClick(View view) {
    character_speaking.setText("first one line message");
}

public void handlePrevButtonClick(View view) {
    character_speaking.setText("second one line message");
}

and everything is working fine.

A: You wanted to clear previous text, right?
So you can use an EditText and clear the view with editText.getText().clear().
For not making it clickable just use editText.setFocusable(false) or editText.setClickable(false). I'd rather use setClickable, but try yourself.

A: I was having the same problem, and it was caused by the way I set up the fragment. I had two framents running at the same time in the same  in the layout.
After I removed the extra fragment, the issue resolved.

A: The TextView.setText(String) method will always overwrite the String already stored.
See the documentation for this method here: http://developer.android.com/reference/android/widget/TextView.html#setText(java.lang.CharSequence)
If you want to add the previous string and the new string, use:
TextView.setText(TextView.getText().toString() + String)


text:
Q: How to build a generic/re-usable modal dialog for WPF following MVVM I would like to build a generic/re-usable modal dialog that I can use in our WPF (MVVM) - WCF LOB application.
I have a Views and associated ViewModels that I would like to display using dialogs. Bindings between Views and ViewModels are done using Type-targeted DataTemplates.
Here are some requirements that I have been able to draft:

*

*I prefer this to be based on a Window instead of using Adorners and controls that act like a modal dialog.

*It should get its minimum size from the content.

*It should center on the owner window.

*The window must not show the Minimize and Maximize buttons.

*It should get its title from the content.

What is the best way to do this?

A: I'm answering my own question to help others find all answers I struggled to find in one place. What above seems like a straight forward problem, actually presents multiple problems that I hope to answer sufficiently below.
Here goes.
Your WPF window that will serve as the generic dialog can look something like this:
<Window x:Class="Example.ModalDialogView"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:ex="clr-namespace:Example"
        Title="{Binding Path=mDialogWindowTitle}"
        ShowInTaskbar="False"
        WindowStartupLocation="CenterOwner"
        WindowStyle="SingleBorderWindow"
        SizeToContent="WidthAndHeight"
        ex:WindowCustomizer.CanMaximize="False"
        ex:WindowCustomizer.CanMinimize="False"
        >
    <DockPanel Margin="3">
        <StackPanel DockPanel.Dock="Bottom" Orientation="Horizontal" FlowDirection="RightToLeft">
            <Button Content="Cancel" IsCancel="True" Margin="3"/>
            <Button Content="OK" IsDefault="True" Margin="3" Click="Button_Click" />
        </StackPanel>
        <ContentPresenter Name="WindowContent" Content="{Binding}"/>
    </DockPanel>
</Window>

Following MVVM, the right way to show a dialog is through a mediator. To use a mediator, you typically require some service locator as well. For mediator specific details, look here.
The solution I settled on involved implementing an IDialogService interface that is resolved through a simple static ServiceLocator. This excellent codeproject article has the details on that. Take note of this message in the article forum. This solution also solves the problem of discovering the owner window via the ViewModel instance.
Using this interface, you can call IDialogService.ShowDialog(ownerViewModel, dialogViewModel). For now, I'm calling this from the owner ViewModel, meaning I have hard references between my ViewModels. If you use aggregated events, you will probably call this from a conductor.
Setting the minimum size on the View that will eventually be displayed in the dialog doesn't automatically set the minimum size of the dialog. Also, since the logical tree in the dialog contains the ViewModel, you can't just bind to the WindowContent element's properties. This question has an answer with my solution.
The answer I mention above also includes code that centers the window on the owner.
Finally, disabling the minimize and maximize buttons is something WPF can't natively do. The most elegant solution IMHO is using this.

A: I usually deal with this by injecting this interface into the appropriate ViewModels:
public interface IWindow
{
    void Close();

    IWindow CreateChild(object viewModel);

    void Show();

    bool? ShowDialog();
}

This allows the ViewModels to spaw child windows and show them modally on modeless.
A reusable implementation of IWindow is this:
public class WindowAdapter : IWindow
{
    private readonly Window wpfWindow;

    public WindowAdapter(Window wpfWindow)
    {
        if (wpfWindow == null)
        {
            throw new ArgumentNullException("window");
        }

        this.wpfWindow = wpfWindow;
    }

    #region IWindow Members

    public virtual void Close()
    {
        this.wpfWindow.Close();
    }

    public virtual IWindow CreateChild(object viewModel)
    {
        var cw = new ContentWindow();
        cw.Owner = this.wpfWindow;
        cw.DataContext = viewModel;
        WindowAdapter.ConfigureBehavior(cw);

        return new WindowAdapter(cw);
    }

    public virtual void Show()
    {
        this.wpfWindow.Show();
    }

    public virtual bool? ShowDialog()
    {
        return this.wpfWindow.ShowDialog();
    }

    #endregion

    protected Window WpfWindow
    {
        get { return this.wpfWindow; }
    }

    private static void ConfigureBehavior(ContentWindow cw)
    {
        cw.WindowStartupLocation = WindowStartupLocation.CenterOwner;
        cw.CommandBindings.Add(new CommandBinding(PresentationCommands.Accept, (sender, e) => cw.DialogResult = true));
    }
}

You can use this Window as a reusable host window. There's no code-behind:
<Window x:Class="Ploeh.Samples.ProductManagement.WpfClient.ContentWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:self="clr-namespace:Ploeh.Samples.ProductManagement.WpfClient"
        xmlns:pm="clr-namespace:Ploeh.Samples.ProductManagement.PresentationLogic.Wpf;assembly=Ploeh.Samples.ProductManagement.PresentationLogic.Wpf"
        Title="{Binding Path=Title}"
        Height="300"
        Width="300"
        MinHeight="300"
        MinWidth="300" >
    <Window.Resources>
        <DataTemplate DataType="{x:Type pm:ProductEditorViewModel}">
            <self:ProductEditorControl />
        </DataTemplate>
    </Window.Resources>
    <ContentControl Content="{Binding}" />
</Window>

You can read more about this (as well as download the full code sample) in my book.


text:
Q: convex border-top and border-bottom with css? I am trying to have a border only for top and border with a line that is thick (4px) in the middle and at the ends goes to zero. Like in the pic

.hervorheben{
    line-height: 1.6em;
    margin-bottom: 1.6em;
    margin-top: 1.6em;
    text-rendering: optimizeLegibility;
    border-top: 1px solid #105322;
    border-bottom: 1px solid #105322;
    padding: 19px;
    margin: auto auto;
}

Do you know how to do so with only css?

A: You can`t make border like that but you can manage with Pseudo-element (after) like following
.your_class {
    position: relative
}

.your_class:after {
    position: absolute;
    width: 100%;
    height: 4px;
    background: #000;
    border-radius: 100%;
    content: "";
    top: 0;
    left: 0;
}

Enjoy....


text:
Q: Find the index of combobox item using object value I have a combobox bound to a data source "StatusListBindingSource" with Status and StatusID. I need the index of the found item. I'll use the index to set Me.cmbResult.SelectedIndex
This works fine except I don't want to use a for/each loop:
Private Sub SetStatusIndex(ByVal StatusValue As Integer)
    Dim ItemIndex As Integer = -1
    Dim ct As Integer = 0
    For Each dView As DataRowView In Me.cmbResult.Items
        If dView.Row.Item("StatusID") = StatusValue Then
            ItemIndex = ct
            Exit For
        End If
        ct += 1
    Next
    Me.cmbResult.SelectedIndex = ItemIndex
End Property

Here's what I'd like to do:
Dim a As ComboBox.ObjectCollection = Me.cmbResult.Items

'can't cast like this
Dim lisDRView As List(Of DataRowView) = a.Cast(Of DataRowView)()

'I'd like to use something like .find
Dim drView As DataRowView = lisDRView.Find(Function(x) x.Row.Item("StatusID") = StatusValue)

'there is no drView.index so this fails
Me.cmbResult.SelectedIndex = drView.index

But I'm getting an exception on a.Cast(Of DataRowView)() and of course there's no drView.index

invalidcastexception:
  Unable to cast object
  of type 'd__aa'1[System.Data.DataRowView]'
  to type 'System.Collections.Generic.List`1[System.Data.DataRowView]'.

How do I get the index of the item with given StatusValue using find?

A: This works:
Dim lis As List(Of DataRowView) = _
        (From item As DataRowView In cmbResult.Items Select item).ToList
Dim d = lis.Find(Function(x As DataRowView) x.Row.Item("StatusID") = StatusValue)
Me.cmbResult.SelectedItem = d

With an assist from how to get the all combobox item .... using array


text:
Q: App cannot enable Google Cloud Storage? My primary app id has a very limited set of options in the Cloud Console for some reason. Notably, I cannot access "APIs & Auth" to enable GCS. Here's the menu I see on the left side. Billing is enabled and my app is actively serving traffic. Other apps I create work just fine.
Here is what I see:
Overview
Permissions
Settings
Support
Preview App Engine
Preview Cloud Datastore
BigQuery

Here is what I expect (and see from other projects):
Overview
APIs & auth
Permissions
Settings
Support
Preview App Engine
Compute Engine
Cloud Storage
Preview Cloud Datastore
Cloud SQL
BigQuery
Cloud Development

A: I had a similar problem where I did not see "Google Cloud Storage" on my Cloud Console. The solution I got from Google a while back was the following:

*

*Sign in to AppEngine under the account that created the App. (via appengine.google.com)

*Click "Application Settings" under the Administration Settings

*There you should find a button to enable Google Cloud Console, under a section called Cloud Integration
This should tie your application as you expect it.


text:
Q: How to read/write in a parent frame's variable in UWP? In my MainPage.xaml I've got a SplitView that loads many pages inside a frame created in it's SlplitView.Content.
I've got data in a MainPage's variable that needs to be sent to every page that loads in my SplitView content's frame according to the ListBoxItem clicked.
Also in the current page I may have to update the MainPage's variable before a new page is loaded.
How can I do this? Is there a way to declare a global variable? Can I transport that information from a page to another updating it's value on the parent page?

A: I think you can declare a public static variable in App Class in App.xaml.cs, and use it in any pages in the app.
In App.xaml.cs:
sealed partial class App : Application
{
    ...
    public static string MyTestVar { get; set; }
    ...
}

In MainPage.xaml.cs:
public sealed partial class MainPage : Page
{
    public MainPage()
    {
        this.InitializeComponent();
        App.MyTestVar = "world";
    }
}

And for some other cases like implementing a setting page, you can check Store and retrieve settings and other app data.

A: Complementing the last answer I solved my problem by declaring an internal static variable in my "App.xaml.cs".
internal static string foo = "";

Then to access it I used:
App.foo = "my string";

There is also a more elegant way to preserve and restore page data when leaving it (which is what I needed) as follows: https://msdn.microsoft.com/pt-br/library/windows/apps/ff967548%28v=vs.105%29.aspx


text:
Q: Restricted notions of set-theoretic geology We say that $W$ is a ground of the universe $V$ if $W$ is a model of ZFC and there is a poset $P\in W$ such that $W[G]=V$ for some $G$ which is $P$-generic over $W$. The Ground Axiom ($\text{GA}$) asserts that $V$ has no nontrivial grounds while $\text{DDG}$ is the statement: for all grounds $W_1$, $W_2$ of $V$ there is a ground $U$ (of $V$) contained in $W_1\cap W_2$.
It has already been proven that $\text{GA}$ can be forced (by means of a class forcing notion) and that $\text{DDG}$ is a theorem of ZFC. I'm interested in restricting these notions. For example, $\text{GA}_{\text{$\sigma$-closed}}$ is the assertion that the universe is not a set-forcing extension of an inner model $\sigma$-closed forcing notion.
Similarly $\text{DDG}_{\text{$\sigma$-closed}}$ is the statement: for all $\sigma$-closed grounds $W_1$, $W_2$ of $V$ there is a $\sigma$-closed ground $U$ (of $V$) contained in $W_1\cap W_2$. Of course, $\text{GA}\rightarrow \text{GA}_{\text{$\sigma$-closed}}$. How about the converse? That is, are there models of ZFC satisfying $\neg\text{GA}+\text{GA}_{\text{$\sigma$-closed}}$ or $\neg\text{GA}+\text{GA}_{\text{ccc}}$? This question arises from Reitz - The ground axiom and when it was published the question was still open.
Moreover, I'm not able to exhibit models in which

*

*$\text{DDG}_{\text{$\sigma$-closed}}$ fails,

*$\text{DDG}_{\text{ccc}}$ fails.

The last two questions are probably easier.

A: If you add a Cohen real to $L$ (or any model of the Ground Axiom), you get a model of the countably closed Ground Axiom, since all intermediate extensions are grounds for Cohen forcing. On the other hand, if you add a Sacks real to $L$, you obtain a model with no ccc grounds since Sacks forcing is not ccc and there are no intermediate extensions. So the Sacks extension is a model of the ccc Ground Axiom but not the Ground Axiom.
A counterexample to the countably closed DDG can be obtained by adding mutual generics $G$ and $H$ for $\text{Col}(\omega_1,\mathbb R)$ to $L(\mathbb R)$ when $L(\mathbb R)$ is a model of DC but not AC. Then $L(\mathbb R)[G\times H]$ has $L(\mathbb R)[G]$ and $L(\mathbb R)[H]$ as countably closed grounds, but their intersection is $L(\mathbb R)$, and moreover any countably closed ground of the two models would contain all the reals, and hence be $L(\mathbb R)$. Since AC fails in $L(\mathbb R)$, it doesn't count as a ground. (Edit: Actually I am remembering now that this example was pointed out by Gunter Fuchs at the inner model theory meeting in Girona in 2018 after I had gone overboard using $\mathbb P_\text{max}$.)
To make Asaf happy, if possible, I also point out that assuming ZFC, the countably distributive DDG is true for ZF grounds, though the example above shows it fails for ZFC grounds. (Edit: I mean the intersection of any two ZF grounds closed under countable sequences contains a ZF ground closed under countable sequences. But this need not be a ground of the ZF grounds we started with.) If $M_0$ and $M_1$ are ZF grounds, there is a ZFC ground $N$ contained in both of them by a result of Usuba. Thus $N(\text{Ord}^\omega)$ is a common inner model of $M_0$ and $M_1$ that is closed under $\omega$-sequences. Now to show that $N(\text{Ord}^\omega)$ is a ground, it suffices by a theorem of Grigorieff to show $N(\text{Ord}^\omega) = N(X)$ for some set $X$. Let $\delta$ be large enough that $N$ has the $\delta$-cover property, and we claim $N(\text{Ord}^\omega) \subseteq N(\delta^\omega)$. To see this, suppose $\sigma$ is a countable set of ordinals. Then there is a set of ordinals $\tau\in N$ covering $\sigma$ of cardinality less than $\delta$. Let $f : \gamma\to \tau$ be the increasing enumeration of $\tau$. Then $\gamma < \delta$, so $\bar \sigma = f^{-1}[\sigma]\in N(\delta^\omega)$. Therefore $\sigma = f[\bar \sigma]\in N(\delta^\omega)$.
I couldn't figure out a counterexample to ccc DDG, though, but I don't doubt that there is one.


text:
Q: C++ with random numbers only 0 to 1 #**include "stdafx.h"
#include <iostream>
#include <process.h>
#include <ctime>
#include <cstdlib>
#include <random>
using namespace std;
double printMatrix();
int main()
{
    int n = 0, m = 1;
    srand(time(0));
    rand() % 2;
    double printMatrix();
    cout << "Enter the number of rows: ";
    cin >> n;
    cout << "Enter the number of columns: ";
    cin >> m;
    system("pause");
    return 0;
}
double printMatrix()
{
    return (double)rand() / ((double)RAND_MAX + 1);
}

I am really new at C++ and I finally got the prompt for the user to enter how many rows and columns, but it also needs to show this:
{Num of rows:3                                                                           Num of col: 2
 01
 00                                                                                10}

A: If You are using C++11, You can use:
#include <iostream>
#include <random>

static std::random_device rd;  // Random device engine, usually based on /dev/random on UNIX-like systems
static std::mt19937_64 rng(rd()); // Initialize Mersennes' twister using rd to generate the seed

// Generate random doubles in the interval [initial, last)
double random_real(double initial, double last) {
    std::uniform_real_distribution<double> distribution(initial, last);
    return distribution(rng);  // Use rng as a generator
}

// Generate random int in the interval [initial, last]
int random_int(int initial, int last) {
    std::uniform_int_distribution<int> distribution(initial, last);
    return distribution(rng);  // Use rng as a generator
}

int main() {
    int rows, columns;
    std::cout << "Enter the number of rows: ";
    std::cin >> rows;
    std::cout << "Enter the number of columns: ";
    std::cin >> columns;
    // For print a binary matrix.
    std::cout << "Binary Matrix" << std::endl;
    for (int i = 0; i < rows; ++i) {
        for (int j = 0; j < columns; ++j) {
            std::cout << random_int(0, 1) << " ";
        }
        std::cout << std::endl;
    }

    // For print a matrix with doubles in interval [0, 1)
    std::cout << "Double Matrix" << std::endl;
    for (int i = 0; i < rows; ++i) {
        for (int j = 0; j < columns; ++j) {
            std::cout << random_real(0, 1) << " ";
        }
        std::cout << std::endl;
    }
}

Example of an execution:
❯❯❯ g++ ../test.cc -std=c++11 -o test && ./test
Enter the number of rows: 3
Enter the number of columns: 4
Binary Matrix
0 1 0 0
1 0 1 0
0 0 1 0
Double Matrix
0.33597 0.384928 0.062972 0.109735
0.689703 0.111154 0.0220375 0.260458
0.826409 0.601987 0.94459 0.442919

A: The standard library has a header called "random".
#include <random>
#include <ctime>

int main()
{
    std::srand(std::time(nullptr));
    int x = std::rand() % 2;
    return 0;
}


text:
Q: Dynamically changing XAML image sources? How can image sources in the XAML be changed during runtime? Right now I have them pointing to a embedded resource URI. In the view model I have the image controls defined but not bound to anything, how do I get these on the view?

A:        <Image x:Name="UserImage" Source="{Binding MembershipUserViewModel.UserId, Converter={StaticResource _userIdToImageConverter}, UpdateSourceTrigger=Explicit}" Stretch="Fill" />

public class UserIdToImageConverter : IValueConverter
{
    public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
    {
        var image = String.Format("{0}/../{1}.jpg",
                  Application.Current.Host.Source,
                  value);

        var bitmapImage = new BitmapImage(new Uri(image)){CreateOptions = BitmapCreateOptions.IgnoreImageCache};
        return bitmapImage;
    }

    public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
    {
        throw new NotImplementedException();
    }
}

A:
For example, it's possible to use imageconverter.
  If you set property to bind, you can get value from converter and then return BitmapSource to bind.

public sealed class ImageConverter : IValueConverter
{
    internal static class NativeMethods
    {
        [DllImport("gdi32.dll")]
        [return: MarshalAs(UnmanagedType.Bool)]
        internal static extern bool DeleteObject(IntPtr hObject);
    }

    public BitmapSource ToBitmapSource(System.Drawing.Bitmap source)
    {
        BitmapSource bitSrc = null;

        var hBitmap = source.GetHbitmap();

        try
        {
            bitSrc = System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap(
                hBitmap,
                IntPtr.Zero,
                Int32Rect.Empty,
                BitmapSizeOptions.FromEmptyOptions());
        }
        catch (Win32Exception)
        {
            bitSrc = null;
        }
        finally
        {
            NativeMethods.DeleteObject(hBitmap);
        }

        return bitSrc;
    }

    public object Convert(object value, Type targetType,
                          object parameter, CultureInfo culture)
    {
        // call function to get BitmapSource
        using (Bitmap bitmap = new Bitmap("{image path}"))
        {

           return ToBitmapSource(bitmap);
        }
    }

}


text:
Q: Border-radius are not centered aligned,when changing screen size I've fixed everything into the laptop screen size and everything is centred aligned until I begin to switch over to tablet/mobile screen using dev toolbars the top border-radius is shifted towards the left and the bottom 3 circles are not following properly. I heard that px is not suitable to be used instead you should use rem/em in order to be responsive to any screen size, is that true?

.container1 {
    max-width: 1000px;
    margin: 0 auto;
    padding:0 auto;
}
.circle1 p {
    position: absolute;
    transform: translate(60px, 80px);
    font-weight: bold;
    font-family: 'Lato';font-size: 28px;
}
.circle2 p{
    margin: 0;
    position: absolute;
    transform: translate(20px,80px);
    font-weight: bold;
    font-family: 'Lato';font-size: 28px;
}
.circle3 p {
    margin: 0;
    position: absolute;
    transform: translate(50px, 80px);
    font-weight: bold;
    font-family: 'Lato';font-size: 28px;
}
.navigation  {
    position:relative;
    border: 2px solid rgb(211,211,211);
    width: 300px;
    margin:100px 50px 80px 350px;
    border-radius: 100%;
    height: 300px;
    background: white;
}
.navigation ul {
    margin: 0;
    padding: 0;
    text-align: center;
    list-style-type: none;
}

.navigation li {
    padding:10px 80px 0px 68px;
    font-weight: 100;
    letter-spacing: 2px;
    font-size: 35px;
    font-family: 'Roboto', sans-serif;
}

.circle1{
    margin: 0 auto;
    position: relative;
    transform: translate(150px, 0px);
    border: 2px solid rgb(211,211,211);
    width: 210px;
    border-radius: 100%;
    height: 200px;
    background:rgb(211,211,211);

}
.circle2{
    margin: 0 auto;
    position: relative;
    transform: translate(0px);
    border: 2px solid rgb(211,211,211);
    width: 210px;
    border-radius: 100%;
    height: 200px;
    background:rgb(211,211,211);
}

.circle3{
    margin: 0 auto;
    position: relative;
    transform: translate(-150px, 0px);
    border: 2px solid rgb(211,211,211);
    width: 210px;
    border-radius: 100%;
    height: 200px;
    background:rgb(211,211,211);
}

.border-circle li{
    list-style-type: none;
    text-decoration: none;

}
.border-circle{
    min-width: 1349px;
    width: 100%;
    top: 70%;
    display: flex;
}

.fa-10x{
    opacity: 0.3;
    font-size:7em !important;
    transform: translate(50px, 30px);
    position: relative;
    text-decoration: none;
    color: inherit;
}

.fa-9x{
    position: relative;
    font-size:7em !important;
    transform: translate(40px, 30px);
    opacity: 0.3;
    color: inherit;
    text-decoration: none;
}

.fa-8x{
    position: relative;
    font-size:7em !important;
    transform: translate(50px, 30px);
    opacity: 0.3;
    color: inherit;
    text-decoration: none;
}

a {
    color: inherit;
}
<!DOCTYPE html>

    <jsp:include page="../head.html" />

Circle

in

 Circle1

 Circle2

 Circle3

A: You can use flex layout:

.container1 {
    max-width: 1000px;
    margin: 0 auto;
    padding:0 auto;
}
.circle1 p {

    font-weight: bold;
    font-family: 'Lato';font-size: 28px;
}
.circle2 p{
    margin: 0;

    font-weight: bold;
    font-family: 'Lato';font-size: 28px;
}
.circle3 p {
    margin: 0;

    font-weight: bold;
    font-family: 'Lato';font-size: 28px;
}
.navigation  {
    position:relative;
    border: 2px solid rgb(211,211,211);
    width: 300px;
    margin:100px 50px 80px 350px;
    border-radius: 100%;
    height: 300px;
    background: white;
    display: flex;
    justify-content: center;
    align-items: center;
}
.navigation ul {
    margin: 0;
    padding: 0;
    text-align: center;
    list-style-type: none;
}

.navigation li {

    font-weight: 100;
    letter-spacing: 2px;
    font-size: 35px;
    font-family: 'Roboto', sans-serif;
}

.circle1{
    margin: 0 auto;
    position: relative;
    transform: translate(150px, 0px);
    border: 2px solid rgb(211,211,211);
    width: 210px;
    border-radius: 100%;
    height: 200px;
    background:rgb(211,211,211);

}
.circle2{
    margin: 0 auto;
    position: relative;
    transform: translate(0px);
    border: 2px solid rgb(211,211,211);
    width: 210px;
    border-radius: 100%;
    height: 200px;
    background:rgb(211,211,211);
}

.circle3{
    margin: 0 auto;
    position: relative;
    transform: translate(-150px, 0px);
    border: 2px solid rgb(211,211,211);
    width: 210px;
    border-radius: 100%;
    height: 200px;
    background:rgb(211,211,211);
}

.border-circle li{
    list-style-type: none;
    text-decoration: none;

}
.border-circle{
    min-width: 1349px;
    width: 100%;
    top: 70%;
    display: flex;
}

.fa-10x{
    opacity: 0.3;
    font-size:7em !important;
    transform: translate(50px, 30px);
    position: relative;
    text-decoration: none;
    color: inherit;
}

.fa-9x{
    position: relative;
    font-size:7em !important;
    transform: translate(40px, 30px);
    opacity: 0.3;
    color: inherit;
    text-decoration: none;
}

.fa-8x{
    position: relative;
    font-size:7em !important;
    transform: translate(50px, 30px);
    opacity: 0.3;
    color: inherit;
    text-decoration: none;
}

a {
    color: inherit;
}

.circle {
  display: flex;
  justify-content: center;
  align-items: center;
}
<!DOCTYPE html>

    <jsp:include page="../head.html" />

Circle

in

 Circle1

 Circle2

 Circle3

A: You should always avoid using a fixed px in css, instead, em or rem which are relative units are always preferred.
The semantic HTML elements are not used as intended here - the text in the circle should not be contained within a list.
It is easier to position in the center by making the circle element a flexbox and using justify-content:center and align-items:center


text:
Q: Delphi: embed frame into panel and query the property of label inside the frame Using delphi XE7. I just want to load the frame into panel and then click button to query the label's caption property inside the frame during the runtime. I can't seem to get it working. Kindly please advise. Thanks.
Panel2 in Unit1
unit Unit1;
interface

uses
Winapi.Windows, Winapi.Messages, System.SysUtils,
System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Vcl.ExtCtrls;

type
TForm1 = class(TForm)
 Button4: TButton;
 Panel2: TPanel;
 procedure Button4Click(Sender: TObject);
 procedure FormCreate(Sender: TObject);

private
    { Private declarations }
public
    { Public declarations }
end;

var
  Form1: TForm1;
implementation
{$R *.dfm}

uses Unit3{TFrame3};

 procedure TForm1.Button4Click(Sender: TObject);
 begin
   ShowMessage(Frame3.Label4.caption);
 end;

 procedure TForm1.FormCreate(Sender: TObject);
 begin
    Frame3.parent:=Panel2;
 end;
end.

Frame3 in this unit
unit Unit3;
interface

uses
 Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants,
 System.Classes, Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs,
 Vcl.StdCtrls;

type
 TFrame3 = class(TFrame)
 Label4: TLabel;
 private
 public
    constructor Create(TheOwner: TComponent); override;
    destructor Destroy; override;
 end;

var
  Frame3: TFrame3;

implementation

{$R *.dfm}

constructor TFrame3.Create(TheOwner: TComponent);
 begin
   inherited Create(TheOwner);
 end;

destructor TFrame3.Destroy;
 begin
   inherited Destroy;
 end;
end.

When compiling ok, but running into error - "First chance exception at $005E098C. Exception class $C0000005 with message 'access violation at 0x005e098c: read of address 0x00000000'. Process Project1.exe (8416)"

A: You need to first create an instance of your frame before it can be referenced in Form 1.
Set your TForm1.FormCreate event to be:
 procedure TForm1.FormCreate(Sender: TObject);
 begin
    Frame3 := TFrame3.Create(Self);
    Frame3.Align := alClient;
    Frame3.Parent := Panel2;
 end;


text:
Q: Insertar filas dentro de mi tbody de mi tabla Cuando envio las filas a mi tabla no se insertan dentro de mi tbody como se muestra aqui:
El codigo que utilizo es:
$('#mytable tbody').after(fila);

Fila es mi arreglo de datos.
Que debo cambiar para que lo incorpore dentro de tbody?

A: Puedes agregarlos con las funciones append(fila) o html(fila) para remplazar el contenido
$('#mytable tbody').append(fila);

o remplaza el contenido de tbody
 $('#mytable tbody').html(fila);

A: Puedes hacerlo con el metodo .append(), te dejo un ejemplo para que mires la aplicación el append():

$('.btnAgregar').on('click', () => {

  let filas =
  `

      Dato 1
      Dato 2

`;

    $('#mytable tbody').append(filas);
});

      Titulo 1
      Titulo 2

<button class="btnAgregar">Agregar filas</button>


text:
Q: JavaScript Cookie absolutely refuses to be deleted This is related to my other question, i'm asking a new question as i've narrowed down the problem and the original question was getting rather convoluted.
In a nutshell, i have a cookie that refuses to be deleted!
My server sets the cookie "session=abc; domain=example.com; path=/;"
I want to edit this cookie client-side, so lets say i want to change abc to xyz then i run the following code
document.cookie = "session=xyz; domain=example.com; path=/;"

Now, when i inspect the cookies i actually now have the following two cookies (note the leading dot):
"session=abc; domain=example.com; path=/;"
"session=xyz; domain=.example.com; path=/;"

I quickly gave up trying to force my new cookie to drop the dot, and instead opted to delete the existing cookie before setting a new cookie.
However, this:
document.cookie = 'session=; expires=Thu, 01 Jan 1970 00:00:01 GMT;';

and this:
document.cookie = 'session=; expires=Thu, 01 Jan 1970 00:00:01 GMT; path=/; domain=example.com;';

Both do absolutely nothing
How on earth am i supposed to delete a cookie, when i can't even get the domains to match up?
NB
Whilst writing this question, things have gotten more complicated! I have just noticed that the above behaviour only happens on a specific page, if i attempt to delete the server's cookie from another page it disappears without a fuss
To add insult to injury
This actually works as expected in IE/Edge

A: This was solved by removing the domain altogether!
document.cookie = 'session=xyz; path=/; domain=;";

Hope this helps someone else, as this has been an absolute bitch to diagnose
EDIT
So in a cruel twist of fate, this does indeed fix the issue for chrome and firefox, but you guessed it - IE/Edge is now throwing the toys out of the pram!
I give up

A: I know you don't want to use dependencies unless necessary, but JS-Cookie is an extremely lightweight, extensively tested library that is cross compatible; it shouldn't affect performance and could be exactly what you're looking for
Here's a link to the GitHub repo.
Cheers!

A: Use jQuery cookie library instead of accessing document.cookie directly https://plugins.jquery.com/cookie/
Then just use it like jQuery.cookie('session','xyz',{ path: '/' });