text:
Q: Eigen: How to check if Matrix is invertible I would like to generate a random invertible Matrix using Eigen, which fulfills these criteria:
Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic> res(M, N + 1);
Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic> y(M, 1);
y.setRandom();
while (true) {
    res.setRandom();
    Eigen::FullPivLU<Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic>> lu(res.transpose() * res);
    if (lu.isInvertible()) {
        break;
    }
}

So res^T*res should be invertible, but i need a random res.

A: Your check isInvertible should work here. For a diagnostic, you can check the absolute value of the determinant or the condition number of your matrix. You should be able to use the determinant member function, see: https://eigen.tuxfamily.org/dox/classEigen_1_1MatrixBase.html#a7ad8f77004bb956b603bb43fd2e3c061


text:
Q: RuntimeERROR"The ConnectionString property has not been initialized"in visual studio i having Problem regarding connecting my windowsform with database.When i compile the forms it show"The ConnectionString property has not been initialized.'"
Dlayer
public static string ConnectionStr
        {

            get { return ConfigurationManager.AppSettings["dbi"]; }
        }
        public static SqlConnection Getconnection()
        {
            SqlConnection con = new SqlConnection(ConnectionStr);
            if (con.State != ConnectionState.Open)

            {
                con.Open();
            }
            return con;
        }

app.config
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <appSettings>
        <add key="dbi" value=" Data Source=.;Initial Catalog=smproject;Integrated Security=true;"/>
    </appSettings>
    <startup>
        <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
    </startup>
</configuration>

redpajama_set_name: RedPajamaStackExchange


text:
Q: How to access Bigcommerce Stencil theme objects I am new to Bigcommerce and also to Handlebars. I am currently building a website according to a design and I am using the Merchant Stencil theme.
Here is a picture of the homepage structure I need
For the moment, I hardcoded the 3 sections in the home.html template file, but I want to bring the product information (url, name, description) dynamically for each product based on it's ID .
The store only sells 3 types of products At the moment, I have a featured products section with the all the 3 products set as featured. This is working fine. The second part is that I want to access a Product Object or Product Card object (documentation links added) and I don't know how to do it. They don't have code examples and I really can't find my way around it. Any help on how can I use these objects would be much appreciated.
I have even asked the Bigcommerce support, and they sent me here. The support people there have no clue about development on their platform, so they sent me here.
Cheers!
Here is the code in my home.html file.
{{#if products.featured}}

{{lang 'home.featured_products'}}

        {{#each products.featured}}
            {{> components/products/product-grid-item
                quick_shop=../theme_settings.quick_shop
            }}
        {{/each}}

{{/if}}

Grizzly One

North America's first liquid polyurethane glue - a high-tech adhesive widely used by European woodworks and craftsmen for decades.

Ideal for proffessional, commercial, and industrial woodworking needs.

Even bonds to oily and exotic woods!

Grizzly Structan

This heavy-bodied, cartridge-loaded
            polyurethane adhesive is stronger than liquid polyurethane
            glues.

Perfect for wood, stone, tile, metal, and glass - dries to a tough elastic texture.

Industrial strength - ideal for professional and commercial applications.

Grizzly Xpress

All the srength and body of a semi-gel adhesive
 with a quick setting and curing time.

The first and only semi-gel adhesive available in North America!

Quick, professional-strength bond for wood, stone, tile, metal and glass.

A: Create a component for the dynamic sections below the featured section. Then do
 {{#each products.featured}}
    {{> components/products/your-new-component }}
 {{/each}}

Inside your component, you will get product object and you can get the data by simply {{product.id}} or {{product.title}}


text:
Q: Can two asp.net core web application coexists inside a same solution? Is it possible to have two asp.net core web application in a way that one app acts as mvc and other acts as a web api.
I tried doing so, I can compile it and run it but I cannot get data from api controller.
Here is an example


text:
Q: Consistent updates with Powershell to Azure table storage Azure storage tables implement Etag which I would like to use to confirm that I am updating the latest entry to avoid overwriting my changes when there are multiple updates happening. However, I cannot figure out how can I use this with the AzTable PS module as it seems to just overwrite and does not care about the Etag. Can I somehow make AzTable module to use Etag or any other way to achieve this in Powershell?
I am currently following https://learn.microsoft.com/en-us/azure/storage/tables/table-storage-how-to-use-powershell and bumped into this problem.

A: I have found out that the easiest way to achieve this is to change the 'InsertOrMerge' to 'Merge' in the 'Update-AzTableRow'-function https://github.com/paulomarquesc/AzureRmStorageTable/blob/master/AzureRmStorageTableCoreHelper.psm1#L696


text:
Q: TypeError: Cannot read property 'firstName' of undefined in ionic I created a function that returns Promise
ject

i can access the response's data inside the scoop of the 'then' accessor and read it's value there, but outside the data is not being attributed to the 'User' object so it's returning this error :
>Uncaught (in promise): TypeError: Cannot read property 'firstName' of undefined

A: The problem is because your console.log is out of then function.
Because the function then wait for the response, when you put out of the function, Angular will continue the process
If you want to access this form, you can write the code like this:

async ngOnInit(){
  try{
    const value =    await this.userService.getCurrentUser()
    this.user.firstName = value['data']['first_name'];
    console.log(this.user.firstName);
  }catch(error){
    console.log(error)
  }
}


text:
Q: How to Read Value from XML document and store it in a variable using Selenium Java I'm new to Automation using Selenium with Java.
I have a problem where i need to go through an XML file find a Node and read the value in that node. And i need to compare the value with the Input String.
Can someone please help me how to read the xml file and fetch the value from the xml and store it in a variable.
This is what i have in xml :

In the Image 01 i need to read the value in ChassisModuleOptionRequest partner_item= and store the value in an array.
Below is the code i tried.
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder builder = factory.newDocumentBuilder();

//Parsing of xml is done here
Document doc = builder.parse(new File("C:\\Users\\Satish_D1\\Documents\\My Received Files\\PDSL_ABM.xml"));

//Here we get the root element of XML and print out
doc.getDocumentElement().normalize();
System.out.println ("Root element of the doc is " + doc.getDocumentElement().getNodeName());

NodeList list = doc.getElementsByTagName("ChassisModuleOptionRequest");
int totalPartnerItem =list.getLength();
System.out.println("Total no of Partner Item : " + totalPartnerItem);

//Traversing all the elements from the list and printing out its data
for (int i = 0; i < list.getLength(); i++)
{

    //Getting one node from the list.
    Node childNode = list.item(i);
    System.out.println("Partner Item : " + childNode.getTextContent());
 }

A: We can use Java inbuilt libraries to create a regex pattern and search for that in the String(data in the file). The below code might give you some idea.
public static void main(String[] args) throws FileNotFoundException
{
  //Change the path for the file
  String content = new Scanner(new File("/home/santhoshkumar/Desktop/sample.xml")).useDelimiter("\\Z").next();

  //System.out.println(content);
  //Arraylist to store the values
  ArrayList<String> values = new ArrayList<>();
  //Change the pattern.
  Pattern pattern = Pattern.compile("<CChassisModuleOptionRequest partner_item=\"(.*)\">");
  Matcher matcher = pattern.matcher(content);

  while (matcher.find())
  {
    System.out.println(matcher.group(1));
    values.add(matcher.group(1));
  }
}

Hope this helps. Thanks.


text:
Q: Load cms block based on attribute text I have a custom tab on the product page which at the moment shows a static block.
What I need it to do is to show a different static block based on the text of an attribute.
For example, the tab will show a phtml file checking the text of a custom attribute then displaying the correct static block.

A: As per your requirement you will need to create number of static blocks same as your drop-down values.
Now for example you have drop-down attribute values test1,test2,test3 etc...
Create your static blocks with identifier static_blick_test1, static_blick_test2, static_blick_test3 etc...
Now in your phtml file you must have current product object and you can call it like.
<?php $attributeValue = strtolower($product->getAttributeText('custom_attribute_code')); ?>

Now based on this attribute value create your static block identifier like
<?php $staticBlockIdentifier = "static_block_".$attributeValue; ?>

Now you can call this static block like
<?php echo $this->getLayout()->createBlock("cms/block")->setBlockId($staticBlockIdentifier)->toHtml();?>

This way you can call your static block dynamically as per your custom attribute value in your product tab.


text:
Q: How to convert numeric values to binary (using a threshold) in r? I would like to know how it's possible to convert data frame values in r from numeric into binary.
data frame:
> head(predictionDB)
  TargetVar   X1         X2 X3        X4         X5         X6         X7        X8        X9       X10 X11       X12       X13
1       0 0.00 0.00000000  0 0.0000000 0.00000000 0.06666667 0.06666667 0.0000000 0.0000000 0.0000000 0.0 0.0000000 0.4666667
2       0 0.00 0.00000000  0 0.1212121 0.09090909 0.00000000 0.00000000 0.0000000 0.0000000 0.1818182 0.0 0.2727273 0.1818182
3       0 0.00 0.00000000  0 0.0000000 0.00000000 0.00000000 0.00000000 0.0000000 1.0000000 0.0000000 0.0 0.0000000 0.0000000
4       0 0.25 0.00000000  0 0.0000000 0.00000000 0.25000000 0.00000000 0.0000000 0.0000000 0.0000000 0.0 0.2500000 0.0000000
5       0 0.00 0.09090909  0 0.0000000 0.04545455 0.04545455 0.00000000 0.2727273 0.2272727 0.0000000 0.0 0.0000000 0.3181818
6       1 0.10 0.00000000  0 0.0000000 0.00000000 0.00000000 0.00000000 0.0000000 0.5000000 0.0000000 0.1 0.3000000 0.0000000

Target:
> head(predictionDB)
  TargetVar   X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13
1       0      0  0  0  0  0  1  1  0  0   0   0   0   1
2 ...

Many thanks in advance!

A: You can do:
data.frame(df[1], (df[-1] > 0) * 1)

  TargetVar X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13
1         0  0  0  0  0  0  1  1  0  0   0   0   0   1
2         0  0  0  0  1  1  0  0  0  0   1   0   1   1
3         0  0  0  0  0  0  0  0  0  1   0   0   0   0
4         0  1  0  0  0  0  1  0  0  0   0   0   1   0
5         0  0  1  0  0  1  1  0  1  1   0   0   0   1
6         1  1  0  0  0  0  0  0  0  1   0   1   1   0

A: Here are 5 ways.
First:
predictionDB[-1] <- +(predictionDB[-1] > 0)

Second:
predictionDB[-1] <- (predictionDB[-1] > 0) + 0L

Third:
predictionDB[-1] <- (predictionDB[-1] > 0)*1L

Fourth:
predictionDB[-1] <- as.integer(predictionDB[-1] > 0)

Fifth:
predictionDB[-1] <- ifelse(predictionDB[-1] > 0, 1, 0)

Once I run tests and the first seemed the fastest by a small difference. But this is only true with large data sets.
The 5th, ifelse, is consistently slower, with small or large data sets.
Data.
predictionDB <- read.table(text = "
TargetVar   X1         X2 X3        X4         X5         X6         X7        X8        X9       X10 X11       X12       X13
1       0 0.00 0.00000000  0 0.0000000 0.00000000 0.06666667 0.06666667 0.0000000 0.0000000 0.0000000 0.0 0.0000000 0.4666667
2       0 0.00 0.00000000  0 0.1212121 0.09090909 0.00000000 0.00000000 0.0000000 0.0000000 0.1818182 0.0 0.2727273 0.1818182
3       0 0.00 0.00000000  0 0.0000000 0.00000000 0.00000000 0.00000000 0.0000000 1.0000000 0.0000000 0.0 0.0000000 0.0000000
4       0 0.25 0.00000000  0 0.0000000 0.00000000 0.25000000 0.00000000 0.0000000 0.0000000 0.0000000 0.0 0.2500000 0.0000000
5       0 0.00 0.09090909  0 0.0000000 0.04545455 0.04545455 0.00000000 0.2727273 0.2272727 0.0000000 0.0 0.0000000 0.3181818
6       1 0.10 0.00000000  0 0.0000000 0.00000000 0.00000000 0.00000000 0.0000000 0.5000000 0.0000000 0.1 0.3000000 0.0000000
", header = TRUE)


text:
Q: Cannot execute multiple update queries in one statement I want to update multiple rows in one statement. I am using CodeIgniter framework. My code is given below.
$query = "update students set id = 12 where id = 10; update students set id = 13 where id = 11;";
$this->db->query($query);

But it is giving me error, saying I have a syntax error near 'update students set id = 13 where id = 11;' I don't know what I am doing wrong.

A: You can use codeigniter Active record batch update :
$data = array(
   array(
      'title' => 'My title' ,
      'name' => 'My Name 2' ,
      'date' => 'My date 2'
   ),
   array(
      'title' => 'Another title' ,
      'name' => 'Another Name 2' ,
      'date' => 'Another date 2'
   )
);

$this->db->update_batch('mytable', $data, 'title');

A: use batch query for this
$data = array(
   array(
      'title' => 'My title' ,
      'name' => 'My Name 2' ,
      'date' => 'My date 2'
   ),
   array(
      'title' => 'Another title' ,
      'name' => 'Another Name 2' ,
      'date' => 'Another date 2'
   )
);

$this->db->update_batch('mytable', $data, 'title');

// Produces:
// UPDATE `mytable` SET `name` = CASE
// WHEN `title` = 'My title' THEN 'My Name 2'
// WHEN `title` = 'Another title' THEN 'Another Name 2'
// ELSE `name` END,
// `date` = CASE
// WHEN `title` = 'My title' THEN 'My date 2'
// WHEN `title` = 'Another title' THEN 'Another date 2'
// ELSE `date` END
// WHERE `title` IN ('My title','Another title')

for more info :- https://www.codeigniter.com/userguide2/database/active_record.html#update

A: the problem, quite likely, is that mysql_query only handles one query at a time.
http://au2.php.net/mysql_query

A: Mysql_query() function can handle only one query at a time.  So you can use
$this->db->update_batch('table_name', $data_array, 'unique_field');

A: If you are talking about mysql, then you can use mysqli::multi_query . This is basically used to executes one or multiple queries which are concatenated by a semicolon.


text:
Q: Overriding constructors in Java For school I need to learn Java and since I'm used to C++ (like Cocoa/Objective-C) based languages, I get really frustrated on Java.
I've made a super-class (that can also be used as a base-class):
public class CellView {
    public CellViewHelper helper; // CellViewHelper is just an example

    public CellView() {
        this.helper = new CellViewHelper();
        this.helper.someVariable = <anything>;

        System.out.println("CellView_constructor");
    }

    public void draw() {
        System.out.println("CellView_draw");
    }

    public void needsRedraw() {
        this.draw();
    }

}

public class ImageCellView extends CellView {

    public Image someImage;

    public ImageCellView() {
        super();
        this.someImage = new Image();
        System.out.println("ImageCellView_constructor");
    }

    public void setSomeParam() {
        this.needsRedraw(); // cannot be replaced by this.draw(); since it's some more complicated.
    }

    @Override public void draw() {
        super.draw();
        System.out.println("ImageCellView_draw");
    }

}

Now, when I call it like this:
ImageCellView imageCellView = new ImageCellView();
imageCellView.setSomeParam();

I get this:

CellView_constructor
ImageCellView_constructor
CellView_draw

However, I want it to be:

CellView_constructor
ImageCellView_constructor
CellView_draw
ImageCellView_draw

How can I do this?
Thanks in advance,
Tim
EDIT:
I also implemented this method to CellView:
public void needsRedraw() {
    this.draw();
}

And this to ImageCellView:
public void setSomeParam() {
    this.needsRedraw(); // cannot be replaced by this.draw(); since it's some more complicated.
}

And I've been calling this:
ImageCellView imageCellView = new ImageCellView();
imageCellView.setSomeParam();

Does this causes the problem (when I call a function from the super it calls to the super only)? How can I solve this... (without having to redefine/override the needsRedraw()-method in every subclass?)

A: You should get proper output.
I tried you example just commented unrelated things:
import java.awt.Image;

public class CellView {
    //public CellViewHelper helper; // CellViewHelper is just an example

    public CellView() {
        //this.helper = new CellViewHelper();
        //this.helper.someVariable = <anything>;

        System.out.println("CellView_constructor");
    }

    public void draw() {
        System.out.println("CellView_draw");
    }

    public static void main(String[] args) {
        ImageCellView imageCellView = new ImageCellView();
        imageCellView.draw();
    }
}

class ImageCellView extends CellView {

    public Image someImage;

    public ImageCellView() {
        super();
        //this.someImage = new Image();
        System.out.println("ImageCellView_constructor");
    }

    @Override public void draw() {
        super.draw();
        System.out.println("ImageCellView_draw");
    }

}

and I get following output:

CellView_constructor
ImageCellView_constructor
CellView_draw
ImageCellView_draw

This is exactly what you want, and this is what your code print's.

A: The short answer is "you can't."
Objects are constructed from the bottom up, calling base class initializers before subclass initializers and base class consrtuctors before subclass constructors.
EDIT:
The code you have looks good, based on your edit.  I would go through the mundane tasks like ensuring that you have compiled your code after you've added you System.out.println calls to your subclass


text:
Q: Programatically setting a PNG to a Picture Control in Win32 APIs I use Visual Studio 2008, I have the PNG file loaded in the Resource View, assigned it IDB_BANG_PNG.
The Picture Control is called IDC_STATIC15.
I am having trouble trying to get the PNG loaded into the picture control.
LRESULT CALLBACK DialogProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{

// Way of loading a bmp with a mask perhaps?  Or a PNG file programatically?

static HBRUSH hBrushStatic;
HBITMAP hBmp = LoadBitmap(hDlg,MAKEINTRESOURCE(IDB_BANG_PNG));

switch(message)
{
case WM_INITDIALOG:
    CheckDlgButton(hDlg, IDC_CHECK, FALSE);
    EnableWindow(GetDlgItem(hDlg, IDOK), FALSE);
    // Bitmap version is IDB_BANG, PNG is at IDB_BANG_PNG
    // IDC_STATIC15 is the picture frame
    HWND item = GetDlgItem(hDlg,IDC_STATIC15);
    SendMessage(item,STM_SETIMAGE,IMAGE_BITMAP,(LPARAM)hBmp);
    return TRUE;

// .... snip

I am rather naive when it comes to Win32/GUI development, doing a quick project and got stuck her, any help is appreciated.

A: This works using GDI+ and the bitmap class :
Bitmap oBmp(L"D:\\test.png");
HBITMAP hBmp;
oBmp.GetHBITMAP(0, &hBmp);
SendMessage(item,STM_SETIMAGE,IMAGE_BITMAP,(LPARAM)hBmp);

Some caveats.Your control needs a SS_BITMAP style. Don't forget to include gdiplus.h and its library. You need to initialize (GdiplusStartup) and shutdown GDI+.
Freeing all system resources is on you.

A: I don't think LoadBitmap or any other plain GDI function (such as LoadImage) will load a PNG.
You can save your resource to a 32-bit BMP with an image editing tool and then use LoadImage with LR_CREATEDIBSECTION.
Or you can use a library that will load the PNG file into a DIBSECTION.  GDI+ will load PNG and JPG in addition to BMP.
The OLE automation libraries also have an IPicture interface that you can instantiate with various image types and then get the underlying DIBSECTION.  It's awkward to use, especially if you're not familiar with COM.  See OleLoadPicture for a starting point.

A: Personally, I use CPictureEx class. I think it doesn't support png, but bmp, jpeg and animated gif.
I also use Cairo graphics for special rendering. Cairo supports png format.
Of course Cairo is a bit harder to use.

A: Have you checked the DevIL/OpenIL library? It follows the OpenGL style of function naming and is written in the good ol' C.
I've used in the past, successfully. It's very portable also.
Check it out here: http://openil.sourceforge.net/features.php


text:
Q: copy the first table from doc1 and paste the table to doc2 in word vba I have to copy the first table from doc1 and paste the table in doc2 bookmarked place.Both documents opened by browsing method.
find below my error code
Sub MTRUpdation()

Dim myStoryRange As Range
Dim Current_MTR As Document
Dim module_name As String
Dim livcycle_version As String
Dim XML As String
Dim length As Integer
Dim finalString As String
Dim MIL_History, Test_sce_summary As Table
Dim Test_sce As Range

' Open current MTR document by dialog box
Set old_doc = Application.FileDialog(msoFileDialogOpen)
With old_doc
.Title = "Choose old MTR document"
.AllowMultiSelect = False
If .Show <> -1 Then
Exit Sub
Set MIL_History = Word.ActiveDocument.Tables(1)
Set Test_sce = Word.ActiveDocument.Tables(1).Range
Set Test_sce_summary = Word.ActiveDocument.Tables(4)
'Word.Selection.Copy
End If
'ActiveDocument.Close SaveChanges:=wdDoNotSaveChanges
'Word.ActiveDocument.Close (False)
End With

' Open current MTR document by dialog box
Set myfile = Application.FileDialog(msoFileDialogOpen)
With myfile
.Title = "Choose current MTR document"
.AllowMultiSelect = False
If .Show <> -1 Then
Exit Sub
End If

'To get the file path name
fileselected = .SelectedItems(1)

'Activate the browsed document ie current MTR document
 Set activation = Documents.Open(fileselected)
Documents(activation).Activate

ActiveDocument.Tables(1).Delete

       'moving cursor to MIL author and version history position
     With Selection.Find
        .MatchWildcards = True
        .Wrap = wdFindContinue
        .Execute findtext:="MIL author & version history"
    End With
   ' Selection.Find.Execute
    Selection.MoveDown Unit:=wdLine, count:=1
    Selection.HomeKey Unit:=wdLine
     ActiveDocument.Bookmarks.Add Name:="MIL_Author", Range:=Selection.Range
    Selection.GoTo What:=wdGoToBookmark, Name:="MIL_Author"
    'With
    Dim table_1 As Range
 Set table_1 = ActiveDocument.Bookmarks("MIL_Author").Range
 table_1.Collapse wdCollapseEnd
 table_1.FormattedText = Test_sce.FormattedText
 table_1.Collapse wdCollapseEnd
 table_1.Text = vbCrLf

  ' = Test_sce_summary.Range
    End With

End Sub

In my code i opened doc1 and copied the first table.Then opened doc2 added bookmark to paste the copied table.then go to the book marked places paste the copied table.This is what i want.please anyone help to get the correct code

A: I see there will be a problem with the With old_doc statement. The Exit Sub needs to be part of the If  ....... Then and then the Setrows need to be part of the Else.
Also the way the documents are handled is incorrect.
I have tested this with two dummy documents, the "OLD" with four tables and the "NEW" with the text "MIL author & version history"
See if it works.
Sub MTRUpdation()

    Dim myStoryRange As Range
    Dim Current_MTR As Document
    Dim module_name As String
    Dim livcycle_version As String
    Dim XML As String
    Dim new_doc As Document

    Dim length As Integer
    Dim finalString As String
    'You need to have As .... after each element to Dim it as that element
    Dim MIL_History As Table, Test_sce_summary As Table
    Dim Test_sce As Range
    Dim table_1 As Range

    'OLD MTR
    With Application.FileDialog(msoFileDialogOpen)

        .Title = "Choose old MTR document"
        .AllowMultiSelect = False

        If .Show <> -1 Then Exit Sub

        old_doc_FileName = .SelectedItems(1)

    End With 'Ending old MTR Dialog with

    'Opening the OLD MTR Doc
    Set old_doc = Documents.Open(FileName:=old_doc_FileName)

    Set MIL_History = old_doc.Tables(1)
    Set Test_sce = old_doc.Tables(1).Range
    Set Test_sce_summary = old_doc.Tables(4)

    'New MTR
    With Application.FileDialog(msoFileDialogOpen)

        .Title = "Choose current MTR document"
        .AllowMultiSelect = False

        If .Show <> -1 Then Exit Sub

        new_doc_FileName = .SelectedItems(1)

    End With ' Ending Open current MTR document by dialog box

    'Opening the NEW MTR Doc
    Set new_doc = Documents.Open(FileName:=new_doc_FileName)

    new_doc.Tables(1).Delete

    'Selecting the entire doc
    new_doc.Content.Select
    'moving cursor to MIL author and version history position
    With Selection.Find
        .MatchWildcards = True
        .Wrap = wdFindContinue
        .Execute findtext:="MIL author & version history"
    End With

    ' Selection.Find.Execute
    Selection.MoveDown Unit:=wdLine, Count:=1
    Selection.HomeKey Unit:=wdLine
    ActiveDocument.Bookmarks.Add Name:="MIL_Author", Range:=Selection.Range
    Selection.GoTo What:=wdGoToBookmark, Name:="MIL_Author"

    Set table_1 = ActiveDocument.Bookmarks("MIL_Author").Range

        With table_1
            .Collapse wdCollapseEnd
            .FormattedText = Test_sce.FormattedText
            .Collapse wdCollapseEnd
            .Text = vbCrLf
        End With

End Sub

There are many other things which can be corrected but I am not sure what some of the line are doing for your application, so I have left them.


text:
Q: How to open popup in datatable mrender? I want open popup new window in datatable mrender. but Running my code appear new tab is not new window.. How to fix my code?
in thin my code
 if (o.pay_coper_type == "test" ) {
 return '<form action="../test/test.php" method="post" target="popup" onsubmit="window.open("../test/test.php", "popup", "width=500, height=500"><input type="hidden" name="p_index" value="' + o.p_index + '" ><input type="submit"  value="print" ></form>'; }


text:
Q: How to Keep Fixed Nav Bar In Front and Not Behind Page Elements So I'm building my first personal website and I have an autoplaying presentation on my homepage (i have like 5 total pages, but i just started working on this). I recently finished making my nav bar at the top and used the table tag to space it out, color, etc.
I then went to try and make the presentation underneath. I finished it and when I scrolled, I saw that my nav bar was going behind my presentation and the two bars on the side filling it so it would have 100% width and after I scrolled past the presentation, the nav bar returned to being on top of text.
The nav bar is fixed and the slideshow and side colors are absolute. I have no clue how to make it so my nav bar is always going to show and be at the top of the page regardless of how far I've scrolled.
I couldn't post the code from my html and css because the formatting of this post apparently, so I  just used some online text host:
Link
I'll try posting the code for the HTML:

Homepage

About Me

Portfolio

Extracurriculars

Contact Me

    ❮
    ❯

Here is the code for the CSS:
#Title{font-family:Open Sans, sans-serif;
font-size:54px;
color:blue;}

#Text{font-family:Carter One, cursive;
font-size:40px;
color:black;
margin-top:5%;
}

a{text-decoration:none;
font-family:Carter One, cursive;

color:black}

html, body {
margin:0;
padding:0;
}

a:hover {
  text-decoration:underline;
}

#topnavlinks{font-size:40px;}

/* HEADER COMPLETE */

/* SECTION 1: AUTO-PLAY SLIDESHOW */

* {box-sizing:border-box}

.slideshow-container {
  max-width: 100%;
  position: absolute;
  margin: auto;
  left:25%;
}

.prev, .next {
  cursor: pointer;
  position: absolute;
  top: 50%;
  width: auto;
  margin-top: -22px;
  padding: 16px;
  color: white;
  font-weight: bold;
  font-size: 18px;
  transition: 0.6s ease;
  border-radius: 0 3px 3px 0;
  user-select: none;
}

.next {
  right: 0;
  border-radius: 3px 0 0 3px;
}

.prev:hover, .next:hover {
  background-color: rgba(0,0,0,0.8);
}

.fade {
  -webkit-animation-name: fade;
  -webkit-animation-duration: 1.5s;
  animation-name: fade;
  animation-duration: 1.5s;
}

@-webkit-keyframes fade {
  from {opacity: .4}
  to {opacity: 1}
}

@keyframes fade {
  from {opacity: .4}
  to {opacity: 1}
}

 #section1background {
      background-color: grey;
      height: 74.3%;
      position: absolute;
      top: 6.9%;
      left: 0;
      width: 100%;
    }

A: You need to use z-index to always bring it on to top
Use CSS
table{
 Width: 100%;
 height: 50px;
 position: fixed;
 top: 0;
 left: 0;
 z-index: 100;
}


text:
Q: Animation in Google Maps i'm creating a simulation model using Google maps, i have created a new KML layer and marked few areas which are dangerous to users to go through, now i want to add a moving object to resemble a person on top of it and give a warning when that object nearing the area, does any one have the idea of doing animation of that kind using Google maps?

A: If you are talking about a moving marker i think you can use the setPosition of the marker object in a for loop feeding it with the coords of a line let's say.


text:
Q: Oracle - select AND delete in a procedure I need to return a rowset from an Oracle procedure, and then delete them in that same procedure. Is there a neat way of doing this without temp tables? Something like an in-memory cursor maybe?
Basically I'm popping the records off a queue, and I want to avoid two round trips because it's a very frequent process.

A: Actually, you can do it without a SELECT these days.  You can simply DELETE the records you are interested in and use the RETURNING clause to fetch those records into a local variable as they are deleted.
DELETE FROM my_table
  WHERE <whatever conditions>
  RETURNING column1, column2, ...
  INTO array1, array2, ...

The slightly annoying part of this method is that you need to fetch each column into a separate variable.  You can't use a record type in this context.  So if you have a lot of columns it can get cumbersome.

A: You can use a cursor for update, e.g.
DECLARE
  CURSOR c_updates
  IS
    SELECT *
    FROM table1 t1
    LEFT JOIN table2 t2 ON t1.field = t2.field
    WHERE t2.field IS NULL
  FOR UPDATE OF t1.field;

  l_record c_updates%ROWTYPE;
BEGIN
  OPEN c_updates;

  LOOP
    FETCH c_updates INTO l_record;
    EXIT WHEN c_updates%NOTFOUND;

    --Do what you want with l_record

    DELETE FROM table1
    WHERE CURRENT OF c_updates;
  END LOOP;

  CLOSE c_updates;
END;

A: You can return a cursor from a procedure or an anonymous block:
BEGIN
        OPEN :cur FOR
        SELECT  *
        FROM    table
        WHERE   condition;

        DELETE
        FROM    table
        WHERE   condition;

END;

The cursor will persist after delete.
See the entry in my blog for detailed explanations:

*

*Oracle: returning deleted records
, and here is this entry in a nutshell:
CREATE TABLE t_deleter (id INT NOT NULL PRIMARY KEY, value VARCHAR2(50))
/
INSERT
INTO    t_deleter (id, value)
VALUES (1, 'Value 1')
/
INSERT
INTO    t_deleter (id, value)
VALUES (2, 'Value 2')
/
COMMIT
/
SELECT  *
FROM    t_deleter
/
VAR cur REFCURSOR
BEGIN
        OPEN    :cur FOR
        SELECT  *
        FROM    t_deleter
        WHERE   id = 1;
        DELETE
        FROM    t_deleter
        WHERE   id = 1;
END;
/
PRINT cur
SELECT  *
FROM    t_deleter
/

Table created.

1 row created.

1 row created.

Commit complete.

        ID VALUE
---------- --------------------------------------------------
         1 Value 1
         2 Value 2

PL/SQL procedure successfully completed.

/*
   PRINT CUR
   This is what returned to the client
*/

        ID VALUE
---------- --------------------------------------------------
         1 Value 1

/*
   SELECT  *
   FROM    t_deleter

   This is what's left after the procedure completed
*/

        ID VALUE
---------- --------------------------------------------------
         2 Value 2

A: Populate the data into an TYPE and return that?
e.g.
CREATE TYPE blah as (data-columns-go-here)
/

CREATE TYPE blah_table AS TABLE OF blah;
/

A: Building on reubenpeeris' answer and cagcowboy's answer:
WARNING: I don't have access to a PL/SQL compiler at the moment, so there is a chance that something is wrong.
TYPE popped_records_table_type IS TABLE OF my_table%ROWTYPE INDEX BY BINARY_INTEGER;

FUNCTION pop_records(...) RETURN popped_records_table_type IS
    popped_records popped_records_table_type;
    popped_record my_table%ROWTYPE;
    next_popped_record_index BINARY_INTEGER;

    CURSOR popped_records_cursor IS
        SELECT * FROM my_table WHERE ... FOR UPDATE;
BEGIN
    next_popped_record_index := 1;

    OPEN popped_records_cursor;

    LOOP
        FETCH popped_records_cursor INTO popped_record;
        EXIT WHEN popped_records_cursor%NOTFOUND;

        DELETE FROM my_table WHERE CURRENT OF popped_records_cursor;

        popped_records(next_popped_record_index) := popped_record;
        next_popped_record_index := next_popped_record_index + 1;
    END LOOP;

    CLOSE popped_records_cursor;

    RETURN popped_records;
END;

Edit: I believe this will also work with a stored procedure, so long as you provide an instance of the popped_records_table_type as an IN/OUT parameter:
PROCEDURE pop_records(popped_records IN OUT popped_records_table_type, ...) IS
    -- Pretty much the same as above

A: Oracle has something call advanced queuing, maybe it is better to use that feature than building your own queuing system.


text:
Q: Converting Postgresql Function to SQL Server function Our company is in planning to move a Postgres database to SQL Server. This includes all tables, functions and stored procedures etc.
Here is the Postgresql syntax:
CREATE or REPLACE FUNCTION ex.on_update_integrity_reset()
    RETURNS trigger
    LANGUAGE plpgsql
AS
$$
BEGIN
    new."integrity_error_id" := 0 ;
    new."requires_processing" := True ;
    new."datetime_amended" := now();
    return new ;
END;
$$;

I have tried the following conversion BUT no luck I am afraid. I am hoping that the solution is quite straight forward. Any assistance will be gratefully received.
My T-SQL syntax, which isn't working:
CREATE FUNCTION ex.on_update_integrity_reset()
RETURNS TABLE
WITH SCHEMABINDING
AS
BEGIN atomic
    new."integrity_error_id" := 0 ;
    new."requires_processing" := True ;
    new."datetime_amended" := GETDATE();
    return new ;
END;

A: There are a huge amount of differences between Postgres' pgSQL and SQL Server's T-SQL, triggers not the least of them. You must learn the differences from the documentation, rather than dumping in code and expecting it to just "work".
The key things to note about triggers in SQL Server:

*

*Triggers are directly defined on the table, rather than being separate functions which you can call.

*Triggers are run per-statement not per-row, and the pseudo-tables inserted and deleted may contain multiple or zero rows.

*SET NOCOUNT ON is ideal, due to problems with certain client drivers.

*Do not return resultsets from triggers, instead make any updates, inserts or deletes you wish, taking into account the pseudo-tables.

Here is an example for your use case:
CREATE TRIGGER dbo.on_update_integrity_reset ON dbo.YourTable
AFTER INSERT -- what about updates???
AS
SET NOCOUNT ON;

IF NOT EXISTS (SELECT 1 FROM inserted)
    RETURN;  -- early bail-out

UPDATE t
SET
    integrity_error_id = 0,
    requires_processing = 1,  -- boolean type is not supported
    datetime_amended = GETDATE()
FROM dbo.YourTable t
JOIN inserted i ON i.SomePrimaryKey = t.SomePrimaryKey;

Be that as it may, you probably don't actually want a trigger. Instead, you probably need DEFAULT constraints. Although there are other methods for an auto-updating datetime column.
ALTER TABLE dbo.YourTable
  ADD DEFAULT 0 FOR integrity_error_id;

ALTER TABLE dbo.YourTable
  ADD DEFAULT 1 FOR requires_processing;

ALTER TABLE dbo.YourTable
  ADD DEFAULT GETDATE() FOR datetime_amended;


text:
Q: Im having trouble trying to display graphics in my JFrame I am trying to create game with a similar layout to Wordle where there is a 5 letter scrambled word displayed and below it there are 5 separate text fields for the user to input what order the letters of the scrambled word will go in. Basically they have to unscramble the word. Sorry for the bad explanation.
Iam trying to make rectangles/squares around each of the letters of the JLabels lb1, lb2, lb3, lb4, lb5 and around each of the JTextFields tf1, tf2, tf3, tf4, tf5. I cannot figure out how to display these rectangles at all but also how they will display on top of JPanels that are already in place.
Also just a bonus here, Is there anyway to organise these labels and text fields so that i can set there exact position? i would like to have 5 of the labels on top of 5 of the text fields.
import java.awt.*;
import javax.swing.*;

public class scramble extends JFrame {

    Font mainFont = new Font("Impact", Font.BOLD, 60);
    Font smallFont = new Font("Impact", Font.BOLD, 30);

    JLabel lbWelcome;
    JLabel lb1, lb2, lb3, lb4, lb5;
    JTextField tf1, tf2, tf3, tf4, tf5;
    JFrame frame;
    GridBagConstraints gbc = new GridBagConstraints();

    scramble() {

      gbc.gridx = 0;
      gbc.gridy = 0;
      gbc.anchor = GridBagConstraints.PAGE_START;
      gbc.weightx = 1.0;
      gbc.weighty = 1.0;

         //mainPanel
         JPanel mainPanel = new JPanel();
         mainPanel.setLayout(new GridBagLayout());
         mainPanel.setBackground(new Color(12, 177, 237));
         mainPanel.setBorder(BorderFactory.createEmptyBorder(10, 40, 30, 40));

         //header/title
         lbWelcome = new JLabel("Scramble", SwingConstants.CENTER);
         lbWelcome.setFont(mainFont);
         lbWelcome.setToolTipText("Scramble is a game created by Glen Filson");
         gbc.gridx = 0;
         gbc.gridy = 0;
         mainPanel.add(lbWelcome, gbc);

          //input panel
          JPanel inputs = new JPanel();
          inputs.setSize(new Dimension(300,300));
          inputs.setBackground(new Color(12, 177, 200));
          inputs.setLayout(new GridBagLayout());
          gbc.gridx = 0;
          gbc.gridy = 3;
          mainPanel.add(inputs, gbc);

          gbc.insets = new Insets(30, 10,30,10);

         //JLabels main
         lb1  = new JLabel("F", SwingConstants.CENTER);
         lb1.setFont(smallFont);
         gbc.gridx = 0;
         gbc.gridy = 0;
         inputs.add(lb1, gbc);

         lb2  = new JLabel("I", SwingConstants.CENTER);
         lb2.setFont(smallFont);
         gbc.gridx = 1;
         gbc.gridy = 0;
         inputs.add(lb2, gbc);

         lb3  = new JLabel("G", SwingConstants.CENTER);
         lb3.setFont(smallFont);
         gbc.gridx = 2;
         gbc.gridy = 0;
         inputs.add(lb3, gbc);

         lb4  = new JLabel("H", SwingConstants.CENTER);
         lb4.setFont(smallFont);
         gbc.gridx = 3;
         gbc.gridy = 0;
         inputs.add(lb4, gbc);

         lb5  = new JLabel("T", SwingConstants.CENTER);
         lb5.setFont(smallFont);
         gbc.gridx = 4;
         gbc.gridy = 0;
         inputs.add(lb5, gbc);

         //JTextField main
         tf1  = new JTextField("s");
         tf1.setFont(smallFont);
         tf1.setHorizontalAlignment(JTextField.CENTER);
         gbc.gridx = 0;
         gbc.gridy = 1;
         inputs.add(tf1, gbc);

         tf2  = new JTextField("u");
         tf2.setFont(smallFont);
         tf2.setHorizontalAlignment(JTextField.CENTER);
         gbc.gridx = 1;
         gbc.gridy = 1;
         inputs.add(tf2, gbc);

         tf3  = new JTextField("s");
         tf3.setFont(smallFont);
         tf3.setHorizontalAlignment(JTextField.CENTER);
         gbc.gridx = 2;
         gbc.gridy = 1;
         inputs.add(tf3, gbc);

         tf4  = new JTextField("s");
         tf4.setFont(smallFont);
         tf4.setHorizontalAlignment(JTextField.CENTER);
         gbc.gridx = 3;
         gbc.gridy = 1;
         inputs.add(tf4, gbc);

         tf5  = new JTextField("y");
         tf5.setFont(smallFont);
         tf5.setHorizontalAlignment(JTextField.CENTER);
         gbc.gridx = 4;
         gbc.gridy = 1;
         inputs.add(tf5, gbc);

            //JFrame
            JFrame frame = new JFrame();
            frame.setTitle("Scramble");
            frame.setSize(500, 650);

            frame.setLocationRelativeTo(null);
            frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
            frame.getContentPane().setBackground(new Color(100, 60, 100));
            frame.setVisible(true);
            frame.add(mainPanel);

    }

    public static void main(String[] args){
       scramble myFrame = new scramble();

}
public class graphicsPanel extends JPanel {
   public void paint(Graphics g ){

      Graphics g2d = (Graphics2D) g;

      g2d.drawRect(250,325,300,300);

   }

}
}

A: There are solutions to everything you asked. So let's see from where to take it.

*

*you can add a border to any JComponent and it's subclasses. Just use setBorder().

*To have a JLabel with rectangles around each of the letters, you probably are better off not using a JLabel at all. Subclass JComponent, add a String property so you know which text to render, then override the paintComponent() method. All you need is to loop over the string's characters, calculate the character size via the GraphicsContext and the Font, add space for your box. Then draw the box using g.drawRect(), finally g.drawString().

*To organize the position use LayoutMangers. GridBagLayout is the most powerful one and will do anything you require. Check out the nice tutorial.


text:
Q: Understanding virtual inheritance class vtables and vptr creation The below code is of multiple inheritance where every class has one member variable, one normal function and one virtual function.
class basec
{
    int x;
public:
    basec()
    {
        x = 0;
    }
    void print()
    {}

    virtual void xyz()
    {}
};

class derivedc: public virtual basec
{
    int dc;
public:
    derivedc()
    {
        dc = 0;
    }
    virtual void xyzdc()
    {}
};

class  derivedd: public virtual basec
{
    int dd;
public:
    derivedd()
    {
        dd = 0;
    }
    virtual void xyzdd()
    {}
};

class child: public derivedc, public derivedd
{
    char de;
public:
    child()
    {
        de = '4';
    }
    virtual void xyzde()
    {}
};

main(int argc, char **argv)
{
    basec bobj, bobjc;
    derivedc dcobj;
    derivedd ddobj;
    child deobj;

    std::cout << "C " << sizeof(basec) << endl;
    std::cout << "D " << sizeof(derivedc) << endl;
    std::cout << "E " << sizeof(derivedd) << endl;
    std::cout << "F " << sizeof(child) << endl;

    return(0);
}

Output of the program is as follows:
main()
C 8
D 16
E 16
F 28

Seeing each of the object in gdb I see below:
(gdb) p/x bobj
$1 = {_vptr.basec = 0x8048c80, x = 0x0}

(gdb) p/x dcobj
$3 = {<basec> = {_vptr.basec = 0x8048c5c, x = 0x0}, _vptr.derivedc = 0x8048c4c, dc = 0x0}

(gdb) p/x ddobj
$4 = {<basec> = {_vptr.basec = 0x8048c1c, x = 0x0}, _vptr.derivedd = 0x8048c0c, dd = 0x0}

(gdb) p/x deobj
$5 = {<derivedc> = {<basec> = {_vptr.basec = 0x8048b90, x = 0x0}, _vptr.derivedc = 0x8048b6c, dc = 0x0}, <derivedd> = {_vptr.derivedd = 0x8048b80, dd = 0x0}, de = 0x34}

We see that in the base class "basec" and in each of the virtually derived classes "derivedc" and "derivedd" objects a vptr is added for their vtables.
Question is why the child class inspite of having a virtual function does not have its own vtable and why no vptr of its own in its object?
In which class's vtable will the virtual function of child class appear?

A: The compiler is free to put it in one on of the existing vtables, just like normal inheritance works. The virtual inheritance guarantees you that you have the virtual base class only once.
For example both clang 7 and gcc 8.2 put the child::xyzde() in the derivedc's vtable in child. See "vtable for child" (clang 7 and gcc 8.2 on godbolt).
class derivedc : public virtual basec
class derivedd : public virtual basec
class child: public derivedc, public derivedd

vtable for child:
 .quad 32
 .quad 0
 .quad typeinfo for child
 .quad derivedc::xyzdc()
 .quad child::xyzde()       <- child::xyzde() together with derivedc's methods
 .quad 16
 .quad -16
 .quad typeinfo for child
 .quad derivedd::xyzdd()
 .quad 0
 .quad -32
 .quad typeinfo for child
 .quad basec::xyz()         <- basec is only once in child

If you change child base classes to virtual as below you get three separate tables:
class child: public virtual derivedc, public virtual derivedd

clang on godbolt:
vtable for child:
 .quad 48
 .quad 32
 .quad 16
 .quad 0
 .quad typeinfo for child
 .quad child::xyzde()      <- New vtable for child
 .quad 0
 .quad 16
 .quad -16
 .quad typeinfo for child
 .quad derivedc::xyzdc()
 .quad 0
 .quad -32
 .quad typeinfo for child
 .quad basec::xyz()        <- basec is only once in child
 .quad 0
 .quad -16
 .quad -48
 .quad typeinfo for child
 .quad derivedd::xyzdd()

And if you remove all virtual inheritance you get basec twice in child as expected (clang on godbolt).
class derivedc : public basec
class derivedd : public basec
class child: public derivedc, public derivedd

vtable for child:
 .quad 0
 .quad typeinfo for child
 .quad basec::xyz()        <- basec from derivedc
 .quad derivedc::xyzdc()
 .quad child::xyzde()      <- child::xyzde() together with derivedc's methods
 .quad -16
 .quad typeinfo for child
 .quad basec::xyz()        <- basec from derivedd
 .quad derivedd::xyzdd()

C++ vtables - Part 3 - Virtual Inheritance has some short explanation of VTT and construction vtable for X-in-child.


text:
Q: Fantasy novel (series?) involving hibernating dragons who are harvested and a woman in a loveless marriage because her husband is secretly gay I read this about two years ago, I think. I think the novel opens with the scene where the dragons are sinking into swamp to hibernate until it's time (until the magic returns, maybe?). Some time later, there's a woman who wants to study the dragons and their lore, but her father is forcing her into an arranged marriage. She seems to find the ideal man, who encourages her scholarship including financing it (I think he's some sort of trader, and she's buying archaic scrolls, I think in a different language). He's a perfect gentleman, very proper and not pressuring her into sex, and then on the wedding night, he's drunk and forces himself on her. After that, she finds that, no matter how much she tries to gussy up and allure him, he rarely has sex with her, and only when drunk, and generally violent when that happens. Bit by bit, she pieces together the clues of perfumes bought that she never sees, a "hunting lodge" where he retires for prolonged amounts of time, and other unexplained expenses, all of which seem to be happening while his servant, who she trusts implicitly, helps cover things up. Long story short, it's obvious to the reader that this servant is his secret lover, with her being his beard. She gathers all of the evidence together and threatens divorce, whereupon he picks her arguments apart with the help of said servant, who backs up his lies that it's all business and/or a surprise he was planning for her.
Somewhere in there, one of the dragons does wake up, but their hibernation is incomplete, I think with one of the wings not coming back right. Meanwhile, most of the hibernating dragons have been harvested because their bones are a valuable building material. I didn't complete the book, on account of that the storyline with her being so cruelly deceived didn't sit well with me, but I want to say that this was a series.

A: Found it. Dragon Keeper by Robin Hobb.

The book opens as a group of sea serpents have nearly finished their long journey upriver to encase themselves so they might hatch into dragons. It is late in the year and the serpents are older than is normal to make the journey. The last known dragon, Tintaglia, is overseeing this journey in the hopes that dragons will be reintroduced to the world. The Rain Wilds Council has agreed to help in exchange for her helping the Rain Wilds people in their war against Chalced. Sisarqua, a queen serpent, struggles to finish her casing and is assisted by Tintaglia.
The captain of the Tarman, Leftrin, comes across a piece of wizardwood, an encased dragon that has been washed away by the river. At first he thinks to sell it for an immense profit, but then decides to use it for his ship to protect it against the acidic river.
Thymara, an 11-year-old girl with claws and scaling, consistent with Rain Wilds defects from birth, goes with her father to watch the hatching of the dragons. She is shocked to find that the new hatchlings are weak and malformed. She communicates with one when her father is almost killed and eaten. Sisarqua has turned into a dragon, naming herself Sintara, and is distraught to realize that her proportions are all wrong and she is not what she should be, and will likely never fly.
Alise Kincarron is a plain, freckled young woman, past the prime age for marriage and suspecting spinsterhood. Most of her time is consumed by her passion for dragons and her studies thereof. She is unsure of the attention she is getting from a handsome local Trader, Hest Finbok. When finally confronting him, he admits that he is not in love with her, but is wishing for a marriage of convenience for both of them. If she can provide him with an heir, he will fund her fancies, including her research of dragons, including a trip to study the hatchling dragons since he had caused her to miss a trip she had already planned to watch them hatch. Agreeing, Alise begins to hope for a real marriage to her handsome suitor, but is desperately disappointed on her wedding night. She learns that the marriage was suggested by her childhood friend, Sedric. She ultimately decides that if she sold herself, she would demand a high price, and begins to use Hest's money freely to pursue her studies of dragons and Elderlings.

....

Meanwhile, Alise has given up on all efforts to make Hest attracted, or even interested in her, as they have all been met with failure or worse. Hest is displeased with Alise's inability to produce an heir and comes for another one of his unpleasant attempts to impregnate her. When she is unwilling, he rapes her. After the shame of this event, she accuses him of being unfaithful to her, in the hopes of ending their marriage contract, and provides proof in certain things she has noted, such as his luxurious perfumes and a second house that he rents. Hest is furious and demands that Sedric, his secretary and constant companion, confirm his fidelity. Sedric confirms, though it is later revealed to be a lie, as Sedric is, in fact, Hest's lover.

I finally found it with a search on TV Tropes for novel dragons husband gay, which brought up the page for Realm of the Elderlings.


text:
Q: Writing Mocha Test Specs for front end component (react.js) I am having so much trouble writing mocha test specs for my front end components.
My component look really simple, but just have no clue how to write test specs.
Could someone please help me with this?
Any help will be greatly appreciated!
Thanks

import React from 'react';

//Submit handler takes the message and gives it to the callback of its parent component, ChatApp for rendering and emitting to server
//Keep track of the mssage when you type and assign it to a property (text) in state
class MessageForm extends React.Component {
 constructor(props) {
  super(props)
  this.changeHandler = this.changeHandler.bind(this);
  this.handleSubmit = this.handleSubmit.bind(this);
  this.state = {text: ''}
 }

 handleSubmit(e) {
  e.preventDefault();
  var message = {
   user: this.props.user,
   text: this.state.text,
   language: this.props.language,
   id: 1
  }
  //Connects to ChatApp component
  this.props.onMessageSubmit(message);
  //Set the state of the text to empty string so that next inputted text value can be hanled in the state
  this.setState({ text: '' })
 }

 changeHandler(e) {
  //change the state of text to inputted value
  this.setState({ text: e.target.value });
 }

 render() {
  return (

Write New Message

    <form onSubmit={this.handleSubmit}>
     <input
      onChange={this.changeHandler}
      value={this.state.text}
      placeholder='Write new message'
     />
    </form>

  )
 }
}

export default MessageForm;

A: With enzyme and sinon you can do something like this:
it("submits message", () => {
    // GIVEN
    const submitCallback = sinon.spy();
    const actualNode = shallow(<MessageForm onMessageSubmit={submitCallback} />);

    // WHEN
    actualNode.find("input").simulate("change", { target: { value: "Test Message" } });
    actualNode.find("form").simulate("submit");

    // THEN
    sinon.assert.calledWith(submitCallback, "Test Message");
});

This is just basic interactivity test. You can also create test to verify HTML rendering and state transitions. Look into enzyme docs to get more info.


text:
Q: Oracle apex pie chart percentage and display I am trying to display a pie chart on Oracle Apex as a percentage of each response of why a deal was rejected etc. The value of each chunk shows as equal chunks until you hover over the piece which shows it's value coming back in thousands rather than a percentage of 100. I know on the attributes setting of the pie chart you can put it as a percentage and on the format scaling the options are: Thousand, Million, Billion, Trillion and quadrillion. The SQL code I have for the pie chart is as follows
SELECT * FROM DEALS_RETURNED;

Deals_returned is the table name but I want it to count the column 'Reason' to show on the pie how many of each reason has been given for each rejected etc.
Tried to change the code to have
SELECT COUNT(Reason)
FROM DEALS_RETURNED


text:
Q: Silverlight data-driven application with NHibernate this is more of a subjective Question, but I'll ask it anyway.
I'm about to develop a very data-centric application that has to run inside the browser. The frontend will be Silverlight, backed by a Fluent NHibernate service that runs server side.
The problem here is: Wherever I look for data-driven silverlight app I wind up finding Silverlight RIA services examples, but nothing on how to build this without some ADO.NET stuff involved.
I have little to no knowledge in WCF so far, but from the limited research I did it seems like WCF is pretty much the only way to let the client talk to the server.
Are there any tutorials/best practices on how to write a Silverlight MVVM app that provides CRUD for a non-EF database?
Suggestions would be very much appreciated. Thanks
PS: I can't use .NET remoting. The backend has to run on IIS6 :(

A: If you only need CRUD why not try REST via WCF
Otherwise create just a regular wcf. Walkthrough: Creating and Accessing WCF Services

A: There's a great series of posts from Brad A about using RIA Services at Business Apps Example for Silverlight 3 RTM and .NET RIA Services July Update Summary.
Some of these will be out of date, but it does cover using RIA Services from a collection of different data sources.


text:
Q: vstest.console.exe with /EnableCodeCoverage just "hangs"... how debug, and how to fix? I'm using vstest.console.exe (VS2012) to run tests with /EnableCodeCoverage, and with a .runsettings that defines a "Code Coverage" DataCollector (see CodeCoverage.runsettings in code block below).
I'm running from a powershell build script, that invokes:
vstest.console.exe /inIsolation /Logger:trx /EnableCodeCoverage /Settings:CodeCoverage.runsettings /TestCaseFilter:"TestCategory=Customers" bin\Release\Sdm.Test.IntegTest.dll
Previously this command was working, however a recent new project that integrated some old legacy code has brought in a lot of new dependencies/DLLs.
What I see is that the command just "hangs", and never seems to run any of the tests. When I use the SysInternals Process Explorer I do see some activity in vstest.executionengine.exe ... my best guess is that it is attempting to instrument a whole bunch of DLLs that my .runsettings file say should be excluded.  But that's only a guess.
Any help in figuring out how to diagnose the issue would be appreciated.
CodeCoverage.runsettings below:
<?xml version="1.0" encoding="utf-8"?>
<RunSettings>
  <!-- Configurations that affect the Test Framework -->
  <RunConfiguration>
    <!-- Path relative to solution directory -->
    <ResultsDirectory>.\TestResults</ResultsDirectory>

    <!-- [x86] | x64
      - You can also change it from menu Test, Test Settings, Default Processor Architecture -->
    <TargetPlatform>x64</TargetPlatform>

    <!-- Framework35 | [Framework40] | Framework45 -->
    <TargetFrameworkVersion>Framework45</TargetFrameworkVersion>
  </RunConfiguration>

  <!-- Configurations for data collectors -->
  <DataCollectionRunSettings>
    <DataCollectors>
      <DataCollector friendlyName="Code Coverage" uri="datacollector://Microsoft/CodeCoverage/2.0" assemblyQualifiedName="Microsoft.VisualStudio.Coverage.DynamicCoverageDataCollector, Microsoft.VisualStudio.TraceCollector, Version=11.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
        <Configuration>
          <CodeCoverage>

            <!--
            Additional paths to search for .pdb (symbol) files. Symbols must be found for modules to be instrumented.
            If .pdb files are in the same folder as the .dll or .exe files, they are automatically found. Otherwise, specify them here.
            Note that searching for symbols increases code coverage runtime. So keep this small and local.
            -->

            <!--
            <SymbolSearchPaths>
                   <Path>C:\Users\User\Documents\Visual Studio 2012\Projects\ProjectX\bin\Debug</Path>
                   <Path>\\mybuildshare\builds\ProjectX</Path>
            </SymbolSearchPaths>
            -->

            <!--
            About include/exclude lists:
            Empty "Include" clauses imply all; empty "Exclude" clauses imply none.
            Each element in the list is a regular expression (ECMAScript syntax). See http://msdn.microsoft.com/library/2k3te2cs.aspx.
            An item must first match at least one entry in the include list to be included.
            Included items must then not match any entries in the exclude list to remain included.
            -->

            <!-- Match assembly file paths: -->
            <ModulePaths>
              <Include>
                <ModulePath>.*\.dll$</ModulePath>
                <ModulePath>.*\.exe$</ModulePath>
              </Include>
              <Exclude>
                <ModulePath>.*CPPUnitTestFramework.*</ModulePath>
                <ModulePath>.*[uU]nit[tT]est\.dll</ModulePath>
                <ModulePath>.*[iI]nteg[tT]est\.dll</ModulePath>
                <ModulePath>.*bomicustomautopoco\.dll</ModulePath>
                <ModulePath>.*Common\.Logging\.dll</ModulePath>
                <ModulePath>.*Common\.Logging\.Log4Net129.dll</ModulePath>
                <ModulePath>.*fluentassertions\.dll</ModulePath>
                <ModulePath>.*x509publickeyparser\.dll</ModulePath>
                <ModulePath>.*EFCachingProvider\.dll</ModulePath>
                <ModulePath>.*EFProviderWrapperToolkit\.dll</ModulePath>
                <ModulePath>.*log4net\.dll</ModulePath>
                <ModulePath>.*DatahelperDTCBridge\.dll</ModulePath>
                <ModulePath>.*\.ni\.dll</ModulePath>
                <ModulePath>.*mscorlib\.dll</ModulePath>
                <ModulePath>.*vjslib\.dll</ModulePath>
                <ModulePath>.*Microsoft\..*dll</ModulePath>
                <ModulePath>.*System\.EnterpriseServices\..*dll</ModulePath>
                <ModulePath>.*System\.ComponentModel\..*dll</ModulePath>
                <ModulePath>.*System\.Configuration\..*dll</ModulePath>
                <ModulePath>.*System\.Core\..*dll</ModulePath>
                <ModulePath>.*System\.Data\..*dll</ModulePath>
                <ModulePath>.*System\.Entity\..*dll</ModulePath>
                <ModulePath>.*System\.IdentityModel\..*dll</ModulePath>
                <ModulePath>.*System\.Numerics\..*dll</ModulePath>
                <ModulePath>.*System\.Runtime\..*dll</ModulePath>
                <ModulePath>.*System\.ServiceModel\..*dll</ModulePath>
                <ModulePath>.*System\.Transactions\..*dll</ModulePath>
                <ModulePath>.*System\.Web\..*dll</ModulePath>
                <ModulePath>.*System\.Xml\..*dll</ModulePath>
                <ModulePath>.*msdia110typelib_clr0200\.dll</ModulePath>
                <ModulePath>.*vstest.executionengine.exe</ModulePath>
                <ModulePath>.*BOMi2Service\.dll</ModulePath>
                <ModulePath>.*NakedObjects\..*dll</ModulePath>
                <ModulePath>.*nakedobjects\..*dll</ModulePath>
                <ModulePath>.*sdm\.corejava\.dll</ModulePath>
                <ModulePath>.*sdm\.datahelper\.dll</ModulePath>
                <ModulePath>.*sdm\.events\.dll</ModulePath>
                <ModulePath>.*Sdm\.Infrastructure\.dll</ModulePath>
                <ModulePath>.*Sdm\.Infrastructure\.Attributes\.dll</ModulePath>
                <ModulePath>.*sdm\.systems\.application\.dll</ModulePath>
                <ModulePath>.*sdm\.systems\.distribution\.library\.dll</ModulePath>
                <ModulePath>.*sdm\.systems\.distribution\.server\.dll</ModulePath>
                <ModulePath>.*sdm\.objectstore\.dll</ModulePath>
                <ModulePath>.*sdm\.profiler\.dll</ModulePath>
                <ModulePath>.*sdm\.resultsprocessor\.dll</ModulePath>
                <ModulePath>.*sdm\.systems\.reflector\.dll</ModulePath>
                <ModulePath>.*Sdm\.Test\.Fixtures\.dll</ModulePath>
                <ModulePath>.*sdm\.utilities\.dll</ModulePath>
                <ModulePath>.*Spring\.Core\.dll</ModulePath>
                <ModulePath>.*TechTalk\.SpecFlow\.dll</ModulePath>
              </Exclude>
            </ModulePaths>

            <!-- Match fully qualified names of functions: -->
            <!-- (Use "\." to delimit namespaces in C# or Visual Basic, "::" in C++.)  -->
            <Functions>
              <Exclude>
                <Function>^Fabrikam\.UnitTest\..*</Function>
                <Function>^std::.*</Function>
                <Function>^ATL::.*</Function>
                <Function>.*::__GetTestMethodInfo.*</Function>
                <Function>^Microsoft::VisualStudio::CppCodeCoverageFramework::.*</Function>
                <Function>^Microsoft::VisualStudio::CppUnitTestFramework::.*</Function>
              </Exclude>
            </Functions>

            <!-- Match attributes on any code element: -->
            <Attributes>
              <Exclude>
                <!-- Don't forget "Attribute" at the end of the name -->
                <Attribute>^System.Diagnostics.DebuggerHiddenAttribute$</Attribute>
                <Attribute>^System.Diagnostics.DebuggerNonUserCodeAttribute$</Attribute>
                <Attribute>^System.Runtime.CompilerServices.CompilerGeneratedAttribute$</Attribute>
                <Attribute>^System.CodeDom.Compiler.GeneratedCodeAttribute$</Attribute>
                <Attribute>^System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute$</Attribute>
              </Exclude>
            </Attributes>

            <!-- Match the path of the source files in which each method is defined: -->
            <Sources>
              <Exclude>
                <Source>.*\\atlmfc\\.*</Source>
                <Source>.*\\vctools\\.*</Source>
                <Source>.*\\public\\sdk\\.*</Source>
                <Source>.*\\microsoft sdks\\.*</Source>
                <Source>.*\\vc\\include\\.*</Source>
              </Exclude>
            </Sources>

            <!-- Match the company name property in the assembly: -->
            <CompanyNames>
              <Exclude>
                <CompanyName>.*microsoft.*</CompanyName>
              </Exclude>
            </CompanyNames>

            <!-- Match the public key token of a signed assembly: -->
            <PublicKeyTokens>
              <!-- Exclude Visual Studio extensions: -->
              <Exclude>
                <PublicKeyToken>^B77A5C561934E089$</PublicKeyToken>
                <PublicKeyToken>^B03F5F7F11D50A3A$</PublicKeyToken>
                <PublicKeyToken>^31BF3856AD364E35$</PublicKeyToken>
                <PublicKeyToken>^89845DCD8080CC91$</PublicKeyToken>
                <PublicKeyToken>^71E9BCE111E9429C$</PublicKeyToken>
                <PublicKeyToken>^8F50407C4E9E73B6$</PublicKeyToken>
                <PublicKeyToken>^E361AF139669C375$</PublicKeyToken>
              </Exclude>
            </PublicKeyTokens>

            <!-- We recommend you do not change the following values: -->
            <UseVerifiableInstrumentation>True</UseVerifiableInstrumentation>
            <AllowLowIntegrityProcesses>True</AllowLowIntegrityProcesses>
            <CollectFromChildProcesses>True</CollectFromChildProcesses>
            <CollectAspDotNet>False</CollectAspDotNet>

          </CodeCoverage>
        </Configuration>
      </DataCollector>

    </DataCollectors>
  </DataCollectionRunSettings>

  <!-- Adapter Specific sections -->

  <!-- MSTest adapter -->
  <MSTest>
    <MapInconclusiveToFailed>True</MapInconclusiveToFailed>
    <CaptureTraceOutput>false</CaptureTraceOutput>
    <DeleteDeploymentDirectoryAfterTestRunIsComplete>False</DeleteDeploymentDirectoryAfterTestRunIsComplete>
    <DeploymentEnabled>False</DeploymentEnabled>
  </MSTest>

</RunSettings>

A: The only clue I could find that eventually led to a solution was in the Event Viewer, specifically:
.NET Runtime version 2.0.50727.5477 - Failed to CoCreate profiler.

This did ultimately led me to a fix, which is to add:
<startup useLegacyV2RuntimeActivationPolicy="true">
  <supportedRuntime version="v4.0.30319" />
</startup>

to vstest.executionengine.exe.config (if running 64bit) or vstest.executionengine.x86.exe.config (if running 32bit).
This works under both VS (when spawned by devenv.exe) and from the command line (when spawned by vstest.console.exe)
Here's some notes that got me to this solution:
The new DLLs that are referenced include some pretty old code built against .NET 2.0.  After a lot of searching, I've pieced together that:

*

*vstest.executionengine.exe uses the .NET 4 profiling stuff to do the dynamic code coverage instrumentation

*the event viewer error message is an obscure clue that vstest.executionengine.exe is failing to kick off the .NET 2.0 profiler

*as noted above, the fix is to update the .config (that is, vstest.executionengine.exe.config).

It isn't possible to add this stuff to the app.config of the project containing the tests; it must go into the vstest.executionengine's config (because this is the exe actually running).
Other things I tried (none of which, ultimately, helped):
Diagnostics in the registry
Computer\HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\11.0\EnterpriseTools\QualityTools\Diagnostics

*

*EnableTracing DWORD = 1

*TraceLevel    DWORD = 4

Diagnostics in the *.config files
for vstest.console.exe, vstest.discoveryengine.*.exe, vstest.executionengine.*.exe
C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\CommonExtensions\Microsoft\TestWindow

added:
  <system.diagnostics>
    <switches>
      <add name="TpTraceLevel" value="4" />
    </switches>
  </system.diagnostics>

... this causes log files to be written to %TEMP%
Red herring: Tried setting environment variables to disable
- COR_ENABLE_PROFILING=0
- COMPLUS_ProfAPI_ProfilerCompatibilitySetting=DisableV2Profiler

... in an attempt to disable the .NET 2 profiler, but did nothing.
Further investigation (using procexp.exe) showed that vstest.executionengine.exe always sets COR_ENABLE_PROFILING=1 irrespective of env var.
Moreover, COR_PROFILER's set to guid

*

*for me, was COR_PROFILER={B19F184A-CC62-4137-9A6F-AF0F91730165}

*via regedit, HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID{B19F184A-CC62-4137-9A6F-AF0F91730165}\InprocServer32

*corresponds to "C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\CommonExtensions\Microsoft\IntelliTrace\11.0.0\x64\Microsoft.IntelliTrace.Profiler.11.0.0.dll"

Looking at the event viewer I saw info messages that the .NET 4 profiler was successfully started:
.NET Runtime version 4.0.30319.18063 - The profiler was loaded successfully.  Profiler CLSID: '{b19f184a-cc62-4137-9a6f-af0f91730165}'. Process ID (decimal): 7700.  Message ID: [0x2507].

The log files in %TEMP% also suggested no issues.
Red herring: Tried to go the other way, and enable via env vars:
COMPLUS_ProfAPI_ProfilerCompatibilitySetting=EnableV2Profiler
and also explicitly set
COR_PROFILER={B19F184A-CC62-4137-9A6F-AF0F91730165}

made no difference either.
Other red herrings

*

*occasional messages in Event Viewer of form:
engine::notify_process_attach failed with exception: Session "MTM_7d145e0c-1c26-44b0-89e5-acc448aaae6d" does not exist.

*vstest.discoveryengine.TpTrace.log... the error "AddProcess : Failed to AddProcess 5" also seems to be irrelevant.
'System.EventHandler`1[Microsoft.VisualStudio.TestTools.Execution.SessionStartEventArgs]' to 'Microsoft.VisualStudio.Coverage.DynamicCoverageDataCollector'
I, 2800, 11, 2014/07/01, 10:59:11.875, PCKMA0419\vstest.discoveryengine.exe, Started Vangaurd process with command line unregister /wildcard /session:MTM_*
I, 2800, 11, 2014/07/01, 10:59:11.880, PCKMA0419\vstest.discoveryengine.exe, Add Vangaurd process to the project object
W, 2800, 11, 2014/07/01, 10:59:11.882, PCKMA0419\vstest.discoveryengine.exe, AddProcess : Failed to AddProcess 5
I, 2800, 11, 2014/07/01, 10:59:11.882, PCKMA0419\vstest.discoveryengine.exe, Started Vangaurd process with command line collect /session:MTM_64f33307-c936-469e-b068-482ec0ea45cf  /output:"C:\Users\danhaywood\AppData\Local\Temp\MTM_64f33307-c936-469e-b068-482ec0ea45cf\c44e78af-2475-4747-99f3-e0fc3ca41d51\DanHaywood_PCKMA0419 2014-07-01 10_59_11.coverage" /config:
"C:\Users\danhaywood\AppData\Local\Temp\MTM_64f33307-c936-469e-b068-482ec0ea45cf\CodeCoverage.config"
~~~
Blogs consulted along the way:

*

*What 'additional configuration' is necessary to reference a .NET 2.0 mixed mode assembly in a .NET 4.0 project?

*http://blogs.msdn.com/b/dougste/archive/2009/12/30/failed-to-cocreate-profiler.aspx

*http://social.msdn.microsoft.com/Forums/en-US/cf079584-54b0-44df-a157-620cc613fca6/failed-to-cocreate-profiler?forum=netfxtoolsdev

*http://blogs.msdn.com/b/davbr/archive/2007/12/11/debugging-your-profiler-i-activation.aspx

*http://bytes.com/topic/c-sharp/answers/813648-net-crashing

*http://social.msdn.microsoft.com/Forums/en-US/ab48e868-528d-4d40-b04f-b8a39ba8bf0c/vs2010-on-windows-2008-wrong-setting-of-corprofiler-environment-variable-in-target-process?forum=vstsprofiler

*http://msdn.microsoft.com/en-us/library/dd778910(v=vs.110).aspx

*http://blogs.msdn.com/b/davbr/archive/2009/05/26/run-your-v2-profiler-binary-on-clr-v4.aspx

*http://cvpcs.org/blog/2011-06-23/getting_ncover_and_nunit_to_play_nicely_with_.net_4.0

*Force NCover 1.5.8 to use v4 framework like testdriven.net does?


text:
Q: How to use ramda mergeRight in Typescript and respect interface definitions I'm trying to make a copy of an object and change properties using Rambda's mergeRight function.  The problem is it allows me to merge in properties that do not exist in the interface definition.
import {mergeRight} from "ramda";

export interface User {
    readonly userId: string
    readonly username: string
}

const user: User = {
    userId: "12345",
    username: "SomeUser"
}

//I want this to be a compile time error, because "something" is not a property of User interface
const updatedUser: User = mergeRight(user, {something: "3"})

Is there any way I can ensure that the properties I am merging are part of the User type, without having to specify an entire new User object (thus defeating the advantage of mergeRight)?  This would prevent a simple typo from causing a runtime error that is difficult to debug.
Ideally I would like Typescript to detect this at compile time

A: To filter out keys that are not part of user, use R.pick to take just keys that exist in User from the new object.
This will only effect the root level of the object, and not deeper mismatches.

const { pick, keys, mergeDeepRight } = R

const user = {
  userId: "12345",
  username: "SomeUser"
}

const getUserKeys = pick(keys(user))

//I want this to be an error, because "something" is not a property of User interface
const updatedUser = mergeDeepRight(user, getUserKeys({
  something: "3"
}))

console.log(updatedUser)
<script src="https://cdnjs.cloudflare.com/ajax/libs/ramda/0.27.0/ramda.js"></script>

A: It seems that simply casting the anonymous object as User will give the error I want.  That's good enough for my use case.
//This causes a compile time error
const updatedUser: User = mergeRight(user, {something: "3"} as User)

//This does not
const updatedUser2: User = mergeRight(user, {userId: "3"} as User)


text:
Q: restapi with Nginx and uwsgi not passing headers info I have a flask app that runs fine with just uwsgi as a service on port 5000.  I am trying to use Nginx to proxy https to port 5000 in the back end.  It is hitting my app, but my app requires auth tokens to be sent on the header and I am not getting it when proxying through Nginx.  However if I change the URL to port 5000 the headers are passed.  How can I configure Nginx to pass everything to the app?  This app does GET,PUSH,PUT,DELETE and users will be sending not only the header, but json data as well.
##################### NGINX CONFIG #####################
    location /customer/ {
            include uwsgi_params;
            uwsgi_pass unix:///var/www/html/cisco/cisco.sock;
    }

##################### UWSGI CONFIG #####################
[uwsgi]
module = wsgi:application

master = true
processes = 5

uid=apache
gid=apache

buffer-size = 32768

http = 0.0.0.0:5000

req-logger = file:/var/log/uwsgi/cart-req.log
logger = file:/var/log/uwsgi/cart-err.log

chmod-socket = 666
vacuum = true
socket = cisco.sock

die-on-term = false

py-autoreload = 1

A: I asume we are talking about request headers. In this case you can use this directive uwsgi_pass_request_headers      on; in your location-block:
  location /customer/ {
            include uwsgi_params;
            uwsgi_pass_request_headers on;
            uwsgi_pass unix:///var/www/html/cisco/cisco.sock;
    }

However on is the default value so if not turned off anywere else the headers as well as the request-body should be sent to your Python application.
What are your header names? Are you able to update your questions with the header names or even better a example HTTP request in curl format?


text:
Q: Accessing ASP Master Page Properties I have an ASP.net page which uses a master page. The master page has a public property. Does anybody know how can I access the given property from a content page that uses the master page?

A: Look into Strongly Typing your Master Page link
Check out the <%@ MasterType  virtualPath="~/MasterPage.master"%> tag.
This enables you to directly have access to the public properties/methods.


text:
Q: jar decompiler freezes on some jars (Tried Procyon, JD-cmd and CFR) I am trying to decompile some jar files. I tried Procyon, JD-cmd and CFR so far.
They are all doing well most of the jars but they freeze and do nothing on some jars. And these jars are different for Procyon, JD and CFR. (Procyon freezes on 2nd but JD freezes on 4th etc.)
The interesting part is, when I kill the process, they stop freezing and finish their job??
I am using them from inside a small java program as follows:
ExecuteCommand cmd = new ExecuteCommand();

cmd.executeCommand("java -jar " + cfrPath + " " + jarPath + " --outputdir " + unzip);
cmd.executeCommand("java -jar " + jdPath + " -od " + unzip + " " + jarPath);
cmd.executeCommand("java -jar " + procyonPath + " -jar " + jarPath + " -o " + unzip);

And the ExecuteCommand.java class is:
public class ExecuteCommand {

    public void executeCommand(String command) {
         String s = null;

         try {

            Process p = Runtime.getRuntime().exec(command);

            BufferedReader stdInput = new BufferedReader(new
                 InputStreamReader(p.getInputStream()));

            BufferedReader stdError = new BufferedReader(new
                 InputStreamReader(p.getErrorStream()));

            while ((s = stdInput.readLine()) != null) {
                System.out.println(s);
            }

            while ((s = stdError.readLine()) != null) {
                System.out.println(s);
            }

        }
        catch (IOException e) {
            e.printStackTrace();
        }
    }
}

Am I doing something wrong? Thanks in advance!

A: I received the jars you sent.  I was able to decompile two of them successfully; the third jar (the smallest one) appears to be empty.
What version of Procyon are you using?  On my workstation, both the latest release (v0.5.30) and the current development branch decompile the first two jars without hanging, though some classes do fail to decompile properly.  Note, however, that both took a while to fully decompile: one took about 48 seconds, and the other took 2 minutes, 30 seconds on my 2013-era Core i7.
I did notice a few classes that might have taken a very long time to decompile with older versions of Procyon, back when there was a runaway complexity bug related to binary operators.  Check your version number and grab the latest release if you're out of date.
On a side note, Procyon does not do a very good job with classes that have been run through tools like dex2jar.  Even in the best cases, you should exercise a healthy level of skepticism toward any code produced by a decompiler.  For code that has been transformed by dex2jar, you should be downright suspicious of the output.


text:
Q: Doesn't "Almost Decisiveness" (ADC) imply "Decisiveness" (DC)? The title may seem a bit counter-intuitive, but I can't get my head around this:
Almost Decisiveness:
If, when all individuals in a (finite or infinite) group G prefer an alternative x to another alternative y, and other individuals (individuals in N\G) prefer y to x, the society prefers x to y, then G is almost decisive
for x against y.
Decisiveness:
If, when all individuals in a group G prefer x to y, the society prefers
x to y regardless of the preferences of other individuals, then G is decisive for x against y.
So, in the definition of ADC, that sounds decisive to me, as they've basically decided what the group prefers, they aren't almost deciding. Maybe that's just poor naming.
However it confuses me even more when the definition of DC says the group prefers x to y if G prefers x to y, regardless of the other individuals' opinions, because surely if everyone is against G in ADC, yet what G prefers the group prefers, then the group prefers what G prefers regardless of the preferences of the other individuals?
I'm not making myself very clear, I'm trying to say that in the definition of ADC, that seems like the worst case scenario for G when everyone else is against them, yet they still prevail. Surely then in ADC the society prefers what G prefers regardless of other individuals' preferences?
I'm hoping someone understands the point I'm trying to make here, your help would be appreciated!

A: You are assuming that extra support for x cannot turn x into a losing alternative. That is, you assume that all voting methods satisfy "monotonicity". However, there are methods, such as "plurality with elimination", where increased support for x can actually make x lose. See http://math.hawaii.edu/~marriott/teaching/summer2013/math100/violations.pdf for an example. So, "almost decisiveness" means decisive, except for perverse decision rules that violate monotonicity


text:
Q: How to track computer's uptime I have Linux desktop. I don't leave it 24/7 turned on. I would like to gather statistics on how much time computer was turned on each day, f.e.:
2012-08-21: 7:52
2012-08-22: 8:43
2012-08-23: 7:36

If computer wasn't turned on, no record is required.

A: You can create a script which runs uptime & dumps it into a file.
uptime >> uptime.log
After that setup a cron job for it. To know more about how to create a cron job : Create Cron Job
Or you can sign-up for an online service to do it for you : Uptime Project

A: according to last manual page:

The pseudo user reboot logs in each time the system  is  rebooted.
         Thus last reboot will show a log of all reboots since the log file
         was created.

so last column of #last reboot command gives you uptime history:
#last reboot
reboot   system boot  **************** Sat Sep 21 03:31 - 08:27 (1+04:56)
reboot   system boot  **************** Wed Aug  7 07:08 - 08:27 (46+01:19)

A: This logs the output of 'uptime' every five minutes. This output also includes the number of users currently logged on and load averages of your computer the last 1, 5 and 15 minutes:
sudo bash #root
mkdir /var/log/uptime
crontab -e

Add this line:
*/5  * * * * echo `date +\%Y\%m\%d;uptime` >> /var/log/uptime/uptime.log 2>&1

And to split+gzip the log into weekly files:
cat <<'EOF'. > /etc/logrotate.d/uptime
/var/log/uptime/uptime.log {
    weekly
    dateext
    rotate 99999
    compress
}
EOF

Then, after some time has passed, view your uptime for each day like this:
uplog() { (cd /var/log/uptime/;zcat uptime.log*gz;cat uptime.log) }
uplog|cut -c1-8|uniq -c|perl -aple'$_.=" ".("=" x ($F[0]/5))'

The number 288 (12*24) means the computer was up all day (although reboots shorter than five minutes may go undetected by this method).
Or similarly for each month like this:
uplog|cut -c1-6|uniq -c|perl -aple'$_.=" ".("=" x ($F[0]/150))'

A: There will be datestamped entries in syslog (/var/log/messages*) you can extract this information from.
You could also add K entries to /etc/rc0.d to, for example, to run logger to add a specific syslog record on shutdown. See http://www.debian-administration.org/articles/212 or equivalent for the Linux distribution you are using
$ vim /etc/init.d/uptime
$ cat /etc/init.d/uptime

# chkconfig: 0 99 1
# description: Record uptime at shutdown.

start() {
        uptime >> /var/log/uptime 2>&1
}

case "$1" in
  start)
        start
        ;;
  *)
        echo Usage: $0 start
        ;;
esac

$ chmod +x /etc/init.d/uptime

$ chkconfig --add uptime

$ chkconfig --list uptime
uptime          0:on    1:off   2:off   3:off   4:off   5:off   6:off

$ ls /etc/rc*d/*uptime*
/etc/rc0.d/S99uptime  /etc/rc3.d/K01uptime  /etc/rc6.d/K01uptime
/etc/rc1.d/K01uptime  /etc/rc4.d/K01uptime
/etc/rc2.d/K01uptime  /etc/rc5.d/K01uptime

$ /etc/rc0.d/S99uptime start

$ cat /var/log/uptime
 13:15:28 up 135 days, 12:06,  1 user,  load average: 0.07, 0.04, 0.01

A: Tuptime can do it when executing "tuptime -l", for example:
# tuptime -l
Startup:  1  at  08:55:01 AM 08/04/2015
Uptime:   24 seconds
Shutdown: OK  at  08:55:25 AM 08/04/2015

Downtime: 5 seconds

Startup:  2  at  08:55:31 AM 08/04/2015
Uptime:   20 seconds
Shutdown: OK  at  08:55:51 AM 08/04/2015

Depending on your locales, the date format can change.
Regards,

A: I've found similar question on stackoverflow https://stackoverflow.com/questions/79490/linux-uptime-history . Best uptimed seems to be what I want, thank you guys for help.
http://podgorny.cz/moin/Uptimed

A: journalctl does it for you:
-> % journalctl --list-boots
-40 979a9d6333fa456ca3dd454904423f7d Tue 2021-02-09 18:56:00 UTC—Thu 2021-02-11 23:53:07 UTC
-39 4e1cf6ede2574080a2e767991f9a6f88 Fri 2021-02-12 09:20:30 UTC—Fri 2021-02-12 22:52:42 UTC
-38 c61db5934a314044b2aa89675f3174a4 Sat 2021-02-13 11:20:51 UTC—Sat 2021-02-13 17:43:47 UTC
-37 4c17abec4dab43eea06e1886105c6421 Sat 2021-02-13 18:57:54 UTC—Sat 2021-02-13 18:45:40 UTC
-36 01bb21d727494bdb8d2e0594cdc3bff4 Sat 2021-02-13 18:46:41 UTC—Sun 2021-02-14 00:32:35 UTC
-35 5620703289264409ac6fba815ee3a405 Sun 2021-02-14 12:34:13 UTC—Sun 2021-02-14 14:09:35 UTC
-34 f3bd6be41a1946e196100a0f6814696b Sun 2021-02-14 14:28:39 UTC—Mon 2021-02-15 00:15:46 UTC
-33 2560f26a043d4fa080e113570c024ef3 Mon 2021-02-15 09:13:37 UTC—Tue 2021-02-16 00:40:29 UTC
-32 5ffa0830150f4b0aad5060ebafe0579d Tue 2021-02-16 09:41:46 UTC—Tue 2021-02-16 23:53:54 UTC
-31 a277425897734813bda531603da792a6 Wed 2021-02-17 09:54:17 UTC—Wed 2021-02-17 23:51:29 UTC
-30 d3cffbc7373b45bb8c803d1aacfb4c42 Thu 2021-02-18 08:49:56 UTC—Thu 2021-02-18 23:27:59 UTC
-29 18d8740486ae47c9b8431a8ab9ec1b08 Fri 2021-02-19 09:39:38 UTC—Fri 2021-02-19 21:40:16 UTC
-28 3b96b65f6a4a42bca74f0e0eefcdacc4 Sat 2021-02-20 12:47:30 UTC—Sat 2021-02-20 22:14:05 UTC
-27 d1b067adffd64d89856461c030806800 Sun 2021-02-21 12:10:42 UTC—Mon 2021-02-22 22:10:42 UTC
-26 317279eedab14f5fb58cbd5fa4216be9 Tue 2021-02-23 08:56:50 UTC—Wed 2021-02-24 21:38:19 UTC
-25 fe1960acffef4730b5ae322779ac8f92 Thu 2021-02-25 09:00:05 UTC—Fri 2021-02-26 21:04:27 UTC
-24 fa6888263e0f4573b32efd0b3fe44485 Fri 2021-02-26 21:38:50 UTC—Tue 2021-03-02 12:42:35 UTC
-23 1e30020c8af340b3a8402c39aa961366 Wed 2021-03-03 09:25:07 UTC—Wed 2021-03-03 23:39:48 UTC
-22 4d0a03416e584f7982c8d753c3e33b4c Thu 2021-03-04 09:24:13 UTC—Fri 2021-03-05 22:47:20 UTC
-21 2baef30e20444afc89e3b1c69d9c2953 Sat 2021-03-06 10:02:04 UTC—Sat 2021-03-06 22:49:54 UTC
-20 b6e817adf27247d3a98d6585b7a44504 Sun 2021-03-07 10:05:16 UTC—Mon 2021-03-08 18:15:57 UTC
-19 0a61263956da49deb5c29576dd99442a Mon 2021-03-08 18:16:41 UTC—Mon 2021-03-08 23:30:38 UTC
-18 929a363340a54ab683732a8e29237731 Tue 2021-03-09 09:21:29 UTC—Wed 2021-03-10 16:46:59 UTC
-17 a4c7da289f7541f8a90e71494bcddecb Wed 2021-03-10 16:47:40 UTC—Wed 2021-03-10 23:02:51 UTC
-16 954962cf43b84ff784cc998e580b27bc Thu 2021-03-11 08:59:29 UTC—Sat 2021-03-13 00:50:38 UTC
-15 36ebb83d0db548429266cdda742232b0 Sat 2021-03-13 09:47:20 UTC—Sat 2021-03-13 22:46:45 UTC
-14 606f26d5ae7a4b9fa7c0c633ee3d9392 Sun 2021-03-14 10:36:25 UTC—Wed 2021-03-17 22:52:38 UTC
-13 41abbaa6dc724cb886c814b0930395af Thu 2021-03-18 09:10:48 UTC—Thu 2021-03-18 17:43:26 UTC
-12 261bdcf9ed0a41659250b9cf76d2b21b Thu 2021-03-18 17:44:12 UTC—Thu 2021-03-18 22:22:14 UTC
-11 d74e766768e1484bbf0de082aaf7d996 Fri 2021-03-19 08:51:49 UTC—Sat 2021-03-20 23:36:31 UTC
-10 a9a1a966e3864e919e806e52d1966398 Sun 2021-03-21 10:54:47 UTC—Mon 2021-03-22 22:36:35 UTC
 -9 0bcfba4461bd4c71a0a91941f0f4ed97 Mon 2021-03-22 22:38:36 UTC—Mon 2021-03-22 23:13:25 UTC
 -8 b8bd5280be624948a50e6fbd7bd9bdae Tue 2021-03-23 08:51:35 UTC—Tue 2021-03-23 22:54:03 UTC
 -7 eeefd7f87f974017b00f1fec18f6ab35 Wed 2021-03-24 09:23:47 UTC—Wed 2021-03-24 21:27:10 UTC
 -6 5a21602ec42d49129ebaeb00fafdc169 Thu 2021-03-25 09:02:57 UTC—Thu 2021-03-25 23:31:46 UTC
 -5 a35d7b829bf14c0a8131eb55737ec180 Fri 2021-03-26 00:11:28 UTC—Fri 2021-03-26 00:11:48 UTC
 -4 0200a2ffd26e474db477c18908b68299 Fri 2021-03-26 08:43:22 UTC—Fri 2021-03-26 23:14:12 UTC
 -3 5bedcc4337634556aa92f087595328aa Sat 2021-03-27 09:56:44 UTC—Mon 2021-03-29 07:50:43 UTC
 -2 e3f09e82362b4644b89be1cb29fa7c7c Mon 2021-03-29 07:51:24 UTC—Tue 2021-03-30 23:09:29 UTC
 -1 d868669ccca04ed18d3de0789a18e052 Wed 2021-03-31 07:54:37 UTC—Wed 2021-03-31 20:53:09 UTC
  0 e016756d5af94aeeb82a369451d22b26 Thu 2021-04-01 07:45:35 UTC—Thu 2021-04-01 10:10:25 UTC


text:
Q: Cannot preview in this file - active scheme does not build this file : SwiftUI on Xcode 11 in CatalinaOS I opened Landmark App using SwiftUI on Xcode 11 in macOS Catalina(10.15) and while opening the Canvas Editor for .swift files containing SwiftUI is showing

Cannot preview in this file - active scheme does not build this file

Try Again, Diagonistics option or restarting Xcode not solving the problem.

A: I experienced the same issue. All I did was to copy the "StartingPoint" folder out of the downloaded folder and relaunched the project. It worked!!!

A: I bumped into this too, following the Landmarks tutorial. When I created the 'CircleImage.swift' it was not letting me preview it, with the above error message.
You can see the current Scheme you're using by going to Product > Scheme. I've got macOS selected.

Clicking on the CircleImage.swift file loads it, and in the rightmost sidebar it shows the Attributes inspector. A few buttons to the left of that is "Show the File inspector".
There, you can see this file's chosen "Target Membership". My problem was that "Landmarks (macOS)" was not checked. Checking this immediately got the Preview working.

I imagine I could also have changed my Product's Scheme to iOS and it would have worked, as that was already checked.

A: If this is a new project coming from a copied folder and inside an iCloud folder, just close Xcode and relaunch it. The sync was not yet done.

A: I encountered the same error for some of my SwiftUI View files when trying to preview on Canvas. What fixed the issue was I copied the code within the current file, deleted the file, created a new SwiftUI View file under the same name and pasted the original code. Hope that helps!
Creating a new folder in Documents/Desktop and copying the files over also resolves the issue.

A: This problem happened to me when I copied a folder into my project with the "Create folder reference" option instead of the "Create groups" option.
The problem was solved when I deleted the folder from project and copied the folder again with the latter option.

A: Select the Scheme that has the current file to Preview

A: You should go through Xcode and Apple SDKs Agreement and you can do it by running the following in terminal in mac:
sudo xcodebuild -license

After doing that reopen your project.

A: The described issue happened to me after cloning a project via git (no iCloud syncing as described in another answer - so I definitely know that the sync itself was completely done).
Funny enough restarting Xcode did the trick.
Just closing and opening the project isn't enough.

A: I just upgraded to both Monterey 12.3, and Xcode 13.3, and boom ran into this issue. Things were fine before the upgrade. Nothing above helped.
Creating a new project does help. So the only thing I found is to create a new project, and just add the files from the old project to the new one. Yuk.
EDIT: I hadn't rebooted the computer (mac mini), after reboot things were fine again.

A: In the schemes I was able to select, it contained only one scheme. Reopening the folder in a folder that's not in the Downloads directory made live editing work for me

A: Restarting my PC worked for me.

A: I found that the file I was trying to preview was not listed in Target -> Build Phases -> Compile Sources. Once I manually added the file, Preview worked. I had drag and dropped a directory into the project, and for some reason Xcode had not added those files to that list.

A: Try About this mac -> Storage -> Manage -> Developer, Then delete Xcode cache from here then restart Xcode...This worked out for me

A: Make sure the file you are trying to preview is in your app (the folder with the same name as your project).
I was able to fix newly created files not previewing by moving the file into my project.

A: Another solution:
Make sure you select file type Swift UI instead of Swift File when you create the file.


text:
Q: Is it correct to write 'to + Verb ing' I studied verbs followed by to and verbs followed by ing on British Council Learn English website and Cambridge Dictionary's Grammar section; however I don't know this construction is it a mistake?

It is vital that we also remember that cultural stereotypes can be detrimental to building good business relationships.

It's from a C1 reading text from BC Learn English page. Is it correct to write to+verb ing? What is the rule and/or the convention?

A: to can be the marker of the to-infinitive, but it can also be a preposition.
Some words require a to-infinitive clause:

I want to go home

Some words require an -ing clause:

I enjoy playing the piano

Some words can accept either:

I like playing/to play the piano.

Some words take a noun-phrase complement introduced by the preposition to:

That dust is detrimental to my health.

And that noun phrase can often be an -ing clause:

Cultural stereotypes can be detrimental to building good business
relationships.

So yes, it can be grammatical to have to followed by an -ing, when the to is a preposition.


text:
Q: Unbanning a member from all guilds the bot is in I am trying to unban a member from all guilds that the bot is in.
My issue is when i run the command with the banned users ID in it i get the following error.
Traceback (most recent call last):
  File "C:\Users\Shadow\AppData\Local\Programs\Python\Python311\Lib\site-packages\discord\bot.py", line 1114, in invoke_application_command
    await ctx.command.invoke(ctx)
  File "C:\Users\Shadow\AppData\Local\Programs\Python\Python311\Lib\site-packages\discord\commands\core.py", line 375, in invoke
    await injected(ctx)
  File "C:\Users\Shadow\AppData\Local\Programs\Python\Python311\Lib\site-packages\discord\commands\core.py", line 132, in wrapped
    raise ApplicationCommandInvokeError(exc) from exc
discord.errors.ApplicationCommandInvokeError: Application Command raised an exception: NotFound: 404 Not Found (error code: 10007): Unknown Member

These are the steps I have tried.
            async for guild in self.bot.fetch_guilds():
                userr = await guild.fetch_member(id)
                if userr in guild.bans:
                    await guild.unban(userr)
                    await ctx.send("Unbanned the user.")

I am expecting the bot to unban the specified ID from all the servers the bot is in.
FULL CODE:
    @commands.slash_command(name="unban", description="When you have specified the user name and hashtag the bot will unban that user from all servers.")
    async def unban(self, ctx, id: discord.SlashCommandOptionType.string):
        async for guild in self.bot.fetch_guilds():
            try:
                user = await guild.fetch_member(ctx.author.id)
            except discord.NotFound:
                continue

        head_admin = discord.utils.get(guild.roles, name="Head Admin")
        developer = discord.utils.get(guild.roles, name="Developer")
        owner = discord.utils.get(guild.roles, name="Owner")
        if head_admin or developer or owner in user.roles:
            async for guild in self.bot.fetch_guilds():
                userr = await guild.fetch_member(id)
                if userr in guild.bans:
                    await guild.unban(userr)
                    await ctx.send("Unbanned the user.")

A: I'm fairly certain this is because your id parameter is a string and it should be an int. Or you should be casting it to an int. Additionally, I think naming it id is bad practice as it will conflict with a builtin.
@commands.slash_command(name="unban", description="When you have specified the user name and hashtag the bot will unban that user from all servers.")
async def unban(self, ctx, user_id):

    try:
        user_id = int(user_id)
    except ValueError:
        # not an actual int
        # send message here
        return

    async for guild in self.bot.fetch_guilds():
        try:
            user = await guild.fetch_member(ctx.author.id)
        except discord.NotFound:
            continue

        head_admin = discord.utils.get(guild.roles, name="Head Admin")
        developer = discord.utils.get(guild.roles, name="Developer")
        owner = discord.utils.get(guild.roles, name="Owner")
        if head_admin or developer or owner in user.roles:
            async for guild in self.bot.fetch_guilds():
                userr = await guild.fetch_member(user_id)
                if userr in guild.bans:
                    await guild.unban(userr)
                    await ctx.send("Unbanned the user.")

Then just use the user_id as the parameter instead. You can get that by right-clicking on a user with the developer settings turned on.

A: After doing some troubleshooting messing around with different user converters I have found the solution to my problem.
I had changed the user_id input to a user input which then you would put the user ID in.
It then loops through the guilds and unbans the user from all guilds.
If the user is not detected in a guilds ban list it will continue going through them.
    @commands.slash_command(name="unban", description="When you have specified the user name and hashtag the bot will unban that user from all servers.")
    async def unban(self, ctx, userr: discord.User):
        async for guild in self.bot.fetch_guilds():
            try:
                user = await guild.fetch_member(ctx.author.id)
            except discord.NotFound:
                continue

            head_admin = discord.utils.get(guild.roles, name="Head Admin")
            developer = discord.utils.get(guild.roles, name="Developer")
            owner = discord.utils.get(guild.roles, name="Owner")
            if head_admin or developer or owner in user.roles:
                try:
                    async for guild in self.bot.fetch_guilds():
                        await guild.unban(userr)
                except:
                    continue
                await ctx.send("Unbanned the user.")
            else:
                await ctx.respond("You don't have permission to run this command.")