text:
Q: Delphi Firedac Update don't apply modified I can not update rows in the database with the following instructions:
fdquery1.Edit;
fdquery1.fieldByName('prova').AsString := 'asdasd';

fdquery1.Open;

Why? i must use another property of TFDQuery for
changes to take effect

A: After TDataSet.Edit you must call TDataSet.Post to persist the changed values.
fdquery1.Edit;
fdquery1.fieldByName('prova').AsString := 'asdasd';
fdquery1.Post;

The documentation also has a sample for that
BTW: I am not sure why you want to open the dataset again?


text:
Q: How add a scroll bar in the scroll view of xamarin ios ? I have a scroll view in xaml page. But I could not find a scroll bar associated with it. No property is available to show the scroll bar. Should I add a custom renderer class to display scroll bar?

A: UIScrollView do not have "Win32-style" always on scrollbars, there is a scroll indicator that can to shown while you are scrolling to show the user where they are within the scrollable view.
In a custom renderer (ScrollViewRenderer) you could set items like:
scrollView.ShowsHorizontalScrollIndicator = true;
scrollView.ShowsVerticalScrollIndicator = true;
scrollView.IndicatorStyle = UIScrollViewIndicatorStyle.Black;
scrollView.ScrollIndicatorInsets = new UIEdgeInsets(0, 30, 0, 30);

But, again, the built-in scroll indictor will only be shown on screen while the user is actually scrolling.

If you need them on screen all the time you would need to draw the scrollbars yourself.
Note: This is the same behavoir as the OS-X scroll view.

redpajama_set_name: RedPajamaStackExchange


text:
Q: MassTransit Filtering messages a consumer can handle I have a generic message interface like this:
public interface IMyMessage
{
     int EventCode {get;}
}

Now I have multiple consumers handling this message:
public class MyConsumer1: IConsumer<IMyMessage>{...}
public class MyConsumer2: IConsumer<IMyMessage>{...}

I want MyConsumer1 to handle only those messages where EventCode==1, and have MyConsumer2 handle all messages where EventCode==2.
I know that I can do an if statement in the Consume method, but want to know if there is a better way like some routing filter?
My preferred way would be to create an Attribute ie. HandlesEventCodeAttribute(1) and apply it on the Consumers.
I also use Autofac container integration with the MassTransit.
Please help.
Thanks

A:
Before I give any input on the actual question, I would ask why you'd use the same message type with a property to determine which consumers actually consume the message. There are better (more efficient) methods available, such as using DIRECT exchanges with RabbitMQ.

You could create your own attribute, and create a middleware filter that would look at the consumer, see if it has the custom attribute, and then use the value from that attribute to check the message and filter it if the consumer is not interested in it.
A full working sample is shown below:
First, create the attribute.
class EventCodeAttribute :
    Attribute
{
    public int EventCode { get; }

    public EventCodeAttribute(int eventCode)
    {
        EventCode = eventCode;
    }
}

And the message type:
interface IEventMessage
{
    int EventCode { get; }
}

The middleware filter:
class EventCodeFilter<TConsumer> :
    IFilter<ConsumerConsumeContext<TConsumer, IEventMessage>>
    where TConsumer : class
{
    readonly int _eventCode;

    public EventCodeFilter()
    {
        var attribute = typeof(TConsumer).GetCustomAttribute<EventCodeAttribute>();
        if (attribute == null)
            throw new ArgumentException("Message does not have the attribute required");

        _eventCode = attribute.EventCode;
    }

    public async Task Send(ConsumerConsumeContext<TConsumer, IEventMessage> context, IPipe<ConsumerConsumeContext<TConsumer, IEventMessage>> next)
    {
        if (context.Message.EventCode.Equals(_eventCode))
        {
            await next.Send(context);
        }
    }

    public void Probe(ProbeContext context)
    {
        var scope = context.CreateFilterScope("eventCode");
        scope.Add("code", _eventCode);
    }
}

The sample consumer:
[EventCode(27)]
class EventCodeConsumer :
    IConsumer<IEventMessage>
{
    public async Task Consume(ConsumeContext<IEventMessage> context)
    {
    }
}

Finally, configure the consumer to use the filter:
builder.AddMassTransit(cfg =>
{
    cfg.AddConsumer<EventCodeConsumer>(x =>
        x.ConsumerMessage<IEventMessage>(p => p.UseFilter(new EventCodeFilter<EventCodeConsumer>())));
});


text:
Q: Как закрыть блок toogle при пропадании фокуса или при помощи esc? Есть календарь, который открывается по нажатию на ссылку Выбрать дату и закрывается соответственно на нее тоже. Как сделать так, чтобы календарь закрывался при клике на любом пустом поле, т.е. при пропадании фокуса на ссылке или esc? пример в фидле

$(function() {
  $(".nenezid").click(function() {
    $("#datapicker").toggle();
  });
});
document.addEventListener("click", function(listenerEvent) {
  if ($(listenerEvent.target).closest('#datapicker').length === 0) {
    $('#datapicker').hide();
  }
});

<link href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datetimepicker/3.1.3/css/bootstrap-datetimepicker.min.css" rel="stylesheet" />
<link href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css" rel="stylesheet" />

    Выбрать дату

              «
              Январь 2018
              »

              Пн
              Вт
              Ср
              Чт
              Пт
              Сб
              Вс

              25
              26
              27
              28
              29
              30
              31

              1
              2
              3
              4
              5
              6
              7

              8
              9
              10
              11
              12
              13
              14

              15
              16
              17
              18
              19
              20
              21

              22
              23
              24
              25
              26
              27
              28

              29
              30
              31
              1
              2
              3
              4

              Сегодня

              Очистить

              «
              2018
              »

              ЯнвФевМарАпрМайИюнИюлАвг
                СенОктНояДек

              Сегодня

              Очистить

              «
              2010-2019
              »

              20092010201120122013201420152016
                2017201820192020

              Сегодня

              Очистить

              «
              2000-2090
              »

              19902000201020202030204020502060
                2070208020902100

              Сегодня

              Очистить

              «
              2000-2900
              »

              1900200021002200230024002500
                26002700280029003000

              Сегодня

              Очистить

A:

document.addEventListener("click", function(listenerEvent) {
  if ($(listenerEvent.target).closest('#datapicker').length === 0) {
    $('#datapicker').hide();
  }
});

что-то вроде этого должно быть


text:
Q: Uniform convergence to exponential on the complex plane I would like to know if there exists unbounded  domains of the complex plane  $\mathbb{C}$ on which the sequence of functions
$\left((1-z/n)^{-n}\right)_{n\geq 1}$ converges uniformely to the exponential function.

A: It does so on any compact subset of the plane.


text:
Q: count the number of occurrences for each variable using dplyr Here is my data frame (tibble) df:
   ENSG00000000003 ENSG00000000005 ENSG00000000419 ENSG00000000457 ENSG00000000460
             <dbl>           <dbl>           <dbl>           <dbl>           <dbl>
 1              61               0              70               0               0
 2               0               0             127               0               0
 3             318               0               2               0               0
 4               1               0               0               0               0
 5               1               0              67               0               0
 6               0               0               0             139               0
 7               0               0               0               0               0
 8             113               0               0               0               0
 9               0               0               1               0               0
10               0               0               0               1               0

For each column/variable, I would like to count the number of rows with value greater than 10. In this case, column 1 would be 3, column 2 would be zero, etc. This is a test data frame, and I would like to do this for many columns.

A: We can use colSums on a logical matrix
colSums(df > 10, na.rm = TRUE)

Or using dplyr
library(dplyr)
df %>%
   summarise_all(~ sum(. > 10, na.rm = TRUE))

A: I think
library(dplyr)
df %>% summarise_all(~sum(.>10))

will do what you want.


text:
Q: How to make PHP variable name of SQL table I have an html form  in which a person fills an input field. The input field will then be sent to the PHP form handler. The form handler will then process  it and the variable input in the html form will then become the name of an SQL table. Everything is okay except that part of making the variable the name of SQL table.
Look at my code:
<?php error_reporting(E_ALL); ini_set('display_errors', 1);?>
<?php $title =$_POST['myfile']?>
<?php $info =$_POST['info']?>
<?php $tags =$_POST['tags']?>
<?php $category =$_POST['category']?>
<?php $allowcomments =$_POST['allowcomments']?>
<?php $flagging =$_POST['flagging']?>
<?php $visibility =$_POST['visibility']?>

<?php $date =$_POST['date']?>
<?php $name =$_POST['name']?>
<?php $size =$_POST['size']?>
<?php $type =$_POST['type']?>
<?php $path =$_POST['path']?>
<?php $sub =$_POST['sub']?>
<?php $cap =$_POST['cap']?>

<?php
$servername='localhost';
$username='root';
$password='you aint gonna know my password!!';
$dbname = "galaxall";

$conn = new mysqli($servername, $username, $password, $dbname);
@mysql_select_db('galaxall');

?>

<?php $title =$_POST['myfile']?>

<?php echo $title?>

<?php echo $info?>

<?php echo $tags?>

<?php echo $category?>

<?php echo $allowcomments?>

<?php echo $visibility?>

<?php echo $flagging?>

<?php echo $cap ?>
<?php  echo $date ?>
<?php  echo $name ?>
<?php echo $size ?>
<?php  echo $type ?>
<?php echo $sub ?>
<?php echo $cap ?>

<?php $file=$_POST['myfile']?>

<?php

$sql="INSERT INTO `galaxall_uploads` (`ID`, `Title`, `Producer`, `Description`, `Tags`, `Type`, `Category`, `Allow comments`, `Flag offensive comments`, `Date`, `Visibility`,`Size`,`Path`,`Subtitles_source`,`Captions_source`) VALUES (NULL, '$title', '', '$info', '$tags', '$type', '$category', '$allowcomments', '$flagging', '$date', '$visibility','$size','$path','$cap','$sub')";
$sql2="CREATE TABLE $title `Comments` ( `ID` BIGINT(255) NOT NULL AUTO_INCREMENT , `Commenter` VARCHAR(255) NOT NULL , `Comment` TEXT NOT NULL , `Date/time` DATETIME NOT NULL , `Likes` BIGINT(255) NOT NULL , `Dislikes` BIGINT(255) NOT NULL , `Replies number` BIGINT(255) NOT NULL , PRIMARY KEY (`ID`)) ENGINE = InnoDB;";

if ($conn->connect_error) {
    die("Connection failed: " . $conn->connect_error);
}

if ($conn->query($sql) === TRUE) {
    echo "New record created successfully";
} else {
    echo "Error: " . $sql . "
" . $conn->error;
}

?>
<?php
if ($conn->connect_error) {
    die("Connection failed: " . $conn->connect_error);
}

if ($conn->query($sql2) === TRUE) {
    echo "New record created successfully";
} else {
    echo "Error: " . $sql2 . "
" . $conn->error;
}

?>

The file has been uploaded

The var $title has been declared and I an even echo it.But when i try to make it the name of the table(sql2),I get the error
2018-07-20 New record created successfullyError: CREATE TABLE title `Commentsss` ( `ID` BIGINT(255) NOT NULL AUTO_INCREMENT , `Commenter` VARCHAR(255) NOT NULL , `Comment` TEXT NOT NULL , `Date/time` DATETIME NOT NULL , `Likes` BIGINT(255) NOT NULL , `Dislikes` BIGINT(255) NOT NULL , `Replies number` BIGINT(255) NOT NULL , PRIMARY KEY (`ID`)) ENGINE = InnoDB;
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '`Commentsss` ( `ID` BIGINT(255) NOT NULL AUTO_INCREMENT , `Commenter` VARCHAR(25' at line 1 The file has been uploaded

So how do I make a PHP variable the name of a table?

A: i don't want to get in your database design but the error you are facing is about string concatenation and an issue on having a space in the table name:
$sql2="CREATE TABLE `$title_Comments` ( `ID` BIGINT(255) NOT NULL AUTO_INCREMENT , `Commenter` VARCHAR(255) NOT NULL , `Comment` TEXT NOT NULL , `Date/time` DATETIME NOT NULL , `Likes` BIGINT(255) NOT NULL , `Dislikes` BIGINT(255) NOT NULL , `Replies number` BIGINT(255) NOT NULL , PRIMARY KEY (`ID`)) ENGINE = InnoDB;";

this will fix the error you mention in your question
EDIT: looking at the comments I can suggest you to have a single table for comments where you store the comment, the id of the user that does the comment and the id of the video they are commenting on. As I said, no need for a custom table each time


text:
Q: Javascript/jQuery watch for CSS Changes I have a simple dropdown that opens up a search field when you click it.  Even though I have the text field of this search set to autofocus, it's not working for all browsers.
What method of Javascript/jQuery would I use to check if the containing UL css display is set to block, so that I can force the focus to be on the field using .focus().
HTML:
Quick Search

      <form id="mainSearch" class="form-search">

            <input type="text" id="inputSearch" class="form-control" placeholder="Quick Search" required="" autofocus autocomplete="off">
            <button type="submit">SUBMIT</button>

      </form>

A: EDIT: There is no css change event so you'll have to approach the problem in 1 of 2 ways.

*

*check the dom element in set intervals to see if its css has changed

*trigger an event when the css of the dom element is changed by user interaction/your code.
the first way will look something like this:
var element = $(".dropdown-menu");
function checkForChanges()
{
    if (element.css('display') == 'block')
    {
        // do your .focus() stuff here
    }
    setTimeout(checkForChanges, 500); // does this every half second.
}

or the second way:
$('.toggle').on('click', function() {
    $('.dropdown-menu').toggle();
    $('.dropdown-menu').trigger('change');
});
$('.dropdown-menu').on('change', function(){
    if($(this).css(.css('display') == 'block')
    {
        // do your .focus() stuff here
    }
});

A: You can check the display value of the ul using pure JavaScript with this:
JS:
var display = document.getElementById('dropdown-menu')[0].style.display;
if (display === 'block') {
  //do what you want.
}

Or using jQuery:
if ($('.dropdown-menu').css('display') === 'block') {
   //do what you want.
}

A: It looks like you are using bootstrap to create the dropdown. If that is the case you can use the "shown" event. However you need to attach the event on a container element.
Html

    Quick Search

            <form id="mainSearch" class="form-search">

                    <input type="text" id="inputSearch" class="form-control" placeholder="Quick Search" required="" autofocus autocomplete="off">
                    <button type="submit">SUBMIT</button>

            </form>

Javascript
$('#quickSearchContainer').on('show.bs.dropdown', function () {
    $('#inputSearch').focus();
});

A: I want to thank everyone for their input, but the working solution that I found was to modify the bootstrap JS to allow for an autofocus on toggleClass of the OPEN for the dropdowns. Everyone gets kudos!


text:
Q: How to set selected value in multiselect attribute How to set selected value in multiselect attribute progmatically. I tried this one but it doesn't work for me.
How to Programmatically set a Product's Multi-Select Attribute by Labels
the code on the link above doesn't stop from loading
$productObj = Mage::getModel('catalog/product')->load($product->getId());
$productObj->setData('filter_category','51,52');
$productObj->save();

the code above is invoke after catalog_product_save_after

A: Since you want to do this in the action catalog_product_save_after you could simple update the individual product attribute and not the complete product, thus stopping the infinite loop problem.
$attrCode = 'your_attribute';
$sourceModel = Mage::getModel('catalog/product')->getResource()
    ->getAttribute($attrCode)->getSource();
$valuesText = explode(',', 'red,green,blue');
$valuesIds = array_map(array($sourceModel, 'getOptionId'), $valuesText);
$product->setData($attrCode, $valuesIds);
$product->getResource()->saveAttribute($product, $attrCode);

A: As others have mentioned, the problem is that you go into an infinite loop if you save the product again in the save_after event.

*

*you should use the save_before event

*Don't load() the product again, $product already contains all data

*Don't save() as the data you set on $product will be saved after the event has finished

So the code for your new observer looks like this:
public function setFilterCategoryBeforeSave(Varien_Event_Observer $observer)
{
    $observer->getProduct()->setData('filter_category','51,52');
}

That's all.

A: You can filter multiple select using finset. Below is a small example of how filter it
$collection = $this->getCollection()
            ->addAttributeToSelect('*')
            ->addAttributeToFilter('visibility', $visibility)
            ->addAttributeToFilter('status', Mage_Catalog_Model_Product_Status::STATUS_ENABLED)
            ->addAttributeToFilter($attribute,array('finset'=>array_search($selection,$valueId)))
            ->setPageSize($limit)
            ->load();
        Mage::getSingleton('cataloginventory/stock')->addInStockFilterToCollection($collection);

here $selection is the value of multiple select attribute to be filtered


text:
Q: Issue with getting data from api in chrome extension I am trying to get data from the Google custom search json api for use for my extension. However, whenever I try to send the fetch request below it throws an error that I do not know how to fix.

SyntaxError: Unexpected end of JSON input

I have tried to do the same request in my browser and it seems to work fine.
I tried to use an XMLHttp request instead which also did not work. I also tried to use the fetch api to get data from other api's which worked. I also tried to alter permissions and added https://www.googleapis.com/customsearch/v1 to the permissions in the manifest.json.
   fetch('https://www.googleapis.com/customsearch/v1?q=skeet&cx=mysearchid&key=my_api_key')
    .then(function(response) {
      return response.json();
    })
    .then(function(myJson) {
      console.log(JSON.stringify(myJson));
    });


text:
Q: How can I change the images only from css? I have this sample:
link
CODE HTML:

CODE CSS:
img{
  width:300px;
}
@keyframes cf3FadeInOut {
  0% {
    opacity:1;
  }
  45% {
    opacity:1;
  }
  55% {
    opacity:0;
  }
  100% {
    opacity:0;
  }
}

#cf3 img.top {
    animation-name: cf3FadeInOut;
    animation-timing-function: ease-in-out;
    animation-iteration-count: infinite;
    animation-duration: 10s;
    animation-direction: alternate;
}

I want to exchange images between them using keyframes.
I tried to reproduce one of the examples here but something does not work.
Can you tell me what I'm not doing right?
Thank you in advance!

A: you are accessing wrong id in css

img{
  width:300px;
  /* added this position to make images overlap */
  position: absolute;
}
@keyframes cf3FadeInOut {
  0% {
    opacity:1;
  }
  45% {
    opacity:1;
  }
  55% {
    opacity:0;
  }
  100% {
    opacity:0;
  }
}

/* here your name of id was wrong */
#cf2 img.top {
    animation-name: cf3FadeInOut;
    animation-timing-function: ease-in-out;
    animation-iteration-count: infinite;
    animation-duration: 2s;
    animation-direction: alternate;
}


text:
Q: How to activate opened excel in VBA I have a VBA code that I used to open an excel and do an automatic process. My code is
Dim strPath As String
Dim intChoice As Integer
intChoice = Application.FileDialog(msoFileDialogOpen).Show
If intChoice <> 0 Then
strPath = Application.FileDialog( _
msoFileDialogOpen).SelectedItems(1)

Workbooks.Open Filename:= _
    strPath

The process is done here, and this process is navigating between 2 excels, the one that contains the Macro and the one that contains the data. Let's say Excel A and Excel B.
I do the automation in Excel B based on a button in Excel A and then I cut the data from B and add it to A.
Now my problem is that the excels which contains the data are different in names, so I reach to this point in the code:
Windows("EPS.xlsx"). _
    Activate

Where I want this "EPS.xlsx" to be replaced by file which was already opened by strPath in the code I wrote in the beginning of this question.
Thank you in advance

A: Don't think about activating or selecting any workbooks.  All you want to do is reference the correct workbook.
Rather than use Workbooks.Open Filename:= strPath which will just open the file, you want to open the file and store a reference to it in a variable.  You can then use that variable whenever you want to do something with the workbook.
Sub Test()

    Dim wrkBk1 As Workbook
    Dim wrkBk2 As Workbook

    Set wrkBk1 = Workbooks.Open(Filename:=strPath)
    Set wrkBk2 = Workbooks.Open(Filename:=strOtherPath)

    wrkBk1.Worksheets("Sheet1").Range("A1") = 5
    wrkBk2.Worksheets("Sheet1").Range("A1") = wrkBk1.Worksheets("Sheet1").Range("A1")

    wrkBk1.Worksheets("Sheet2").Range("A2").NumberFormat = "@"
    wrkBk2.Worksheets("Sheet1").Range("A5").Font.Color = RGB(255, 0, 0)

End Sub

Your code would look something like:
Sub Test2()

    Dim strPath As String
    Dim intChoice As Integer

    Dim wrkBk As Workbook

    intChoice = Application.FileDialog(msoFileDialogOpen).Show
    If intChoice <> 0 Then
        strPath = Application.FileDialog( _
        msoFileDialogOpen).SelectedItems(1)

        Set wrkBk = Workbooks.Open(Filename:=strPath)
        MsgBox wrkBk.Name & " has been opened.", vbOKOnly + vbInformation
    End If

End Sub


text:
Q: What formula would you use to add up a column based on results from two drop down menus? I would like to calculate a column based on selections from two other columns with drop down menus.
For example :
In one column, "C" you have 3 options (A team,B team,C team), In column "F" you have the day of week to schedule (Monday, Tuesday, Wednesday, Thursday, Friday) and in Column "E" I would like to put how many minutes total each line is.
This will calculate how many minutes worth A team has on Monday.
I have been successful using SUMIFS code to narrow by the first set of criteria
i.e. =SUMIFS(E2:E20,C2:C20,"A team")
When I try to add a second set of criteria, it doesn't work.
How can I achieve my goal here? Should I be trying something different?
I have tried just adding the criteria like so:
=SUMIFS(E2:E20,C2:C20,"A team",F2:F20,"Monday") ....... but it wont work!
Thanks,
Tyler

A: one way you might do it is as follows:
Insert a new column wherever appropriate (it will be hidden afterwards). Suppose you put it in column G. In these cells concatenate Column C and F, for example in G2, =CONCATENATE(C2,F2).
Then your sumifs formula should be =SUMIFS(E2:E20,G2:G20,"A teamMonday").
You can now hide column G.

As a side note, you can of course use concatenate inside your SUMIFS, eg
A1: B team
A2: Friday
A3: =SUMIFS(E2:E20,C2:C20,CONCATENATE(A1,A2)).
Good luck.


text:
Q: verb inside lstlisting caption I try to do this:
\begin{lstlisting}[language=Perl,caption={text {\verb+myverb+} some more text}]
...
\end{lstlisting}

But it gives me something like:
Undefined control sequence ... some more

How to I include an linline verb inside my caption?

A: \verb is a very peculiar command in LaTeX and this peculiarity consists in the fact that it may not appear in the argument of another command. In your example it is in the optional argument to \begin{lstlisting} and this is disallowed (because of very good reasons).
Actually \verb is necessary only when characters special for (La)TeX are needed: # $ % ^ & { } _ \. When none of these character is needed, one can use \texttt{myverb material} with the same result as that given by \verb.
However, this doesn't solve the problem of grepping through your files for finding all \verb. You can do
\protected\def\psverb#1{\def\innerpsverb##1#1{\texttt{##1}}

and the example would become
\documentclass{article}
\usepackage{listings}
\protected\def\psverb#1{\def\innerpsverb##1#1{\texttt{##1}}\innerpsverb}

\begin{document}
\begin{lstlisting}[language=Perl,caption={text {\psverb+myverb+} some more text}]
...
\end{lstlisting}
\end{document}

Grepping for \verb or \psverb should be quite easy.

A: Another option not requiring any new commands is to use \lstinline:
\documentclass{article}
\usepackage{listings}

\begin{document}

\begin{lstlisting}[language=Perl,caption={text {\lstinline[basicstyle=\ttfamily]+myverb+} some more text}]
...
\end{lstlisting}

\end{document}

A: Using my new cprotectinside package:
%! TEX program = lualatex
\documentclass{article}
\usepackage{listings}
\usepackage{cprotectinside}

\begin{document}
\cprotectinside{*}{
\begin{lstlisting}[language=Perl,caption={text *\verb+myverb+* some more text}]
code code
code code
\end{lstlisting}
}
\end{document}

(this answer is also included in the package documentation as an example)


text:
Q: Apache mod rewrite to direct from one server to another I've got to apache web servers running. One on port 80 and another on port 8077.
I'm wanting to try and redirect all the traffic through the port 80 version if possible.
What I'm ideally wanting is to be able to go to http://translate.example.com
and the traffic get directed to http://www.example.com:8077
I've already got a lot of mod_rewrite going on at the main port 80 server, but I'm not sure which of the servers needs configuration or whether both do.
I'm wanting to make sure that translate.example.com/img (or any other subdirectory) actually points to the 8087/images directory.
update
I've now got the following:
RewriteCond %{HTTP_HOST} example[NC]
RewriteCond %{REQUEST_URI} ^/glot$ [NC]
RewriteRule    ^(.*)$  http://www.example.com:8077/$1  [P]
ProxyPassReverse / http://www.example.com/

I'm getting to see the other servers new pages, but I'm finding all the resources aren't found like images, css etc
Doing a view source all the resources in the installed product are set with leading slash
For example
/img/glotpress-logo.png

So I'm not sure how to get the resources loaded up.
Note I'm happy enough if the original starting point is www.example.com/glot instead of glot.example.com as in the original question

A: You can remap your resources to another server but having the other server on non-default port might prevent some of your visitors from viewing them as they might be block (firewalled) from accessing the port. If you're not worry about the port being block you can use mod_rewrite Remapping Resources. method.
RewriteEngine On
RewriteRule ^/images/(.+) http://www.example.com:8077/images/$1 [R,L]

If you want to make sure that everyone is able to view the external resources, you need to use proxy where apache will tunnel the visitor connection to example.com:8077 transparently. You can read more about mod_rewrite for Proxying at apache website.
RewriteEngine  on
RewriteBase    /images/
RewriteRule    ^images/(.*)$  http://example.com:8077/images/$1  [P]
ProxyPassReverse /images/ http://example.com/images/

UPDATE
Have you tried to remove
RewriteCond %{HTTP_HOST} example[NC]

This line basically tells that it will only process if the HTTP_POST is example.com if its coming from www.example.com this rule is not applicable. I'm hoping that "example[NC]" is a typo.
In the end it probably looks like
RewriteRule ^/glot/(.*)$ http://www.example.com:8077/glot/$1 [P]
ProxyPassReverse /glot/ http://www.example.com:8077/glot/

A: You need to do the configuration at the port 80 server to make it act as a proxy for the 8077 server.
The Apache document is here: http://httpd.apache.org/docs/trunk/rewrite/proxy.html


text:
Q: XML to SQL with SSIS or ADO.NET I have to import loads of little XML files to a databse. Now I'm currently doing it with an SSIS script, but it takes a lot of time (aprox 4.000 files in 30 mins).
Would it be faster if I were to make a custom program for this using ADO.NET? Because in total I'd have to transfer aprox. 500.000 files.
Thanks in advance


text:
Q: Error executing Puppeteer from PHP I have a node script which converts a webpage into a PDF document. The user enters some content and PHP builds a HTML page, which then is used in a node script (that runs Puppeteer, using a slightly modified version of an example script) to convert it to PDF.
But when I exec in PHP the command to run the node script, it fails with the following error:
(node:14832) UnhandledPromiseRejectionWarning: Error: Failed to launch chrome!
[0424/165455.239499:ERROR:icu_util.cc(133)] Invalid file descriptor to ICU data received.
[0424/165455.239717:FATAL:content_main_delegate.cc(53)] Check failed: false.
#0 0x55f27f255b0c base::debug::StackTrace::StackTrace()
#1 0x55f27f26e780 logging::LogMessage::~LogMessage()
#2 0x55f27d5f7d23 content::ContentMainDelegate::TerminateForFatalInitializationError()
#3 0x55f27ef90deb content::ContentMainRunnerImpl::Initialize()
#4 0x55f27ef9ab72 service_manager::Main()
#5 0x55f27ef8ff14 content::ContentMain()
#6 0x55f28309f9b9 headless::(anonymous namespace)::RunContentMain()
#7 0x55f28309fa42 headless::HeadlessBrowserMain()
#8 0x55f27ef97f9d headless::HeadlessShellMain()
#9 0x55f27d5f61ac ChromeMain
#10 0x7efcaad45c05 __libc_start_main
#11 0x55f27d5f602a _start

PHP is running with the apache user. However, if I run the same script with my user, it works perfectly. When I execute in a terminal using su - apache -c 'node ...' it again throws the error described above.
What is causing the error? Something related to apache user's permissions? I've followed all troubleshotting guides but I had no luck at the moment.

A: The problem seems to come from the file-system permissions on the default chromium used by puppeteer:
using ACL( my nginx group is www-data, change with yours for apache):
sudo setfacl -R -m g:www-data:rX  node_modules/puppeteer/.local-chromium/
and
sudo setfacl -dR -m g:www-data:rX  node_modules/puppeteer/.local-chromium/
after setting the permissions the error went away.

A: I was using the bundled version of Chromium which comes along with the Puppeteer library (as installed using npm install puppeteer).
Instead of using that version, I tried to install Chromium system-wide and give the node script the path to the system-wide installation of Chromium. It finally works, this version doesn't have that weird issue!
To execute Puppeteer using another executable:
const browser = await puppeteer.launch({
    args: ['--no-sandbox', '--disable-setuid-sandbox'],
    headless: true,
    executablePath: '/usr/bin/chromium-browser'
});

I will look for other answers if there's another solution instead of installing Chromium on the system.
Edit:
Now there's a puppeteer-core package on NPM that doesn't bundle Chromium.


text:
Q: SQL Server 2005: Index bigger than data stored I created 1 database with 2 file groups: 1 primary and 1 index.

*

*Primary file group includes 1 data file (*.mdf): store all tables

*Index file group includes 1 index file (*.ndf): store all indexes

Most of indexes are non-clustered indexes
After a short time using the database, the data file is 2GB but the index file is 12 GB. I do not know what problem happened in my database.
I have some questions:

*

*How do I reduce the size of the index file?

*How do I know what is stored in the index file?

*How do I trace all impacts to the index file?

*How do I limit size growing of index file?

A: My guess (which I think is where marc_s is also headed) is that you've declared your clustered indexes for at least some of your tables to be on the index file group. The clustered index determines how (and where) the actual data for your table is stored.
Posting some of your code would certainly help others pinpoint the problem though.
I think that Martin Smith answered your other questions pretty well. I'll just add this... If you want to limit index sizes you need to evaluate your indexes. Don't add indexes just because you think that you might need them. Do testing with realistic (or ideally real-world) loads on the database to see which indexes will actually give you needed boosts to performance. Indexes have costs to them. In addition to the space cost which you're seeing, they also add to the overhead of inserts and updates, which have to keep the indexes in sync. Because of these costs, you should always have a good reason to add an index and you should consciously think about the trade-offs.

A: Consider that it is actually quite common for the total storage required for Indexes to be greater than the storage required for the table data within a given database.
Your particular scenario however would appear to quite excessive. As others have pointed out, if you have assigned the Clustered Index for a given table to reside in a separate data file (Your Index data file) then the entire physical table itself will reside in this file also, because in a manner of speak the Clustered Index is the table.
Providing details of your Table Schema and Index Structures will enable us to provide you with more specific guidance.
Other posters have mentioned that:

*

*You should review your index
definitions for duplicate indexes. Take a look at Identifying Overlapping Indexes by Brent Ozar.

*You should look to identify unused
indexes. Take a look as SQL Server Pedia Article: Finding Unused Indexes
Other avenues to explore include reviewing the fragmentation of your indexes, as this can increase the storage requirements.
Heavy fragmentation, particularly in the Clustered Index of a table containing LOB data, can result in a significant increase in storage needs. Reorganizing the Clustered Index on tables that contain LOB data will compact the LOB data.
See Reorganizing and Rebuilding Indexes

A: How do I reduce size of index file ?
Drop some unneeded indexes or reduce the number of columns in existing ones. Remember that the clustered index column(s) is a "hidden" included column in all non clustered indexes.
If you have an index on a,b,c,d and an index on a,b,c you might consider dropping the second one as the first one covers the second one.
You may also be able to find potential unused indexes by looking at sys.dm_db_index_usage_stats
How to know what is stored in index file?
It will store whatever you defined it to store! The following query will help you tell which indexes are using the most space and for what reason (in row data, lob data)
SELECT  convert(char(8),object_name(i.object_id)) AS table_name, i.name AS index_name,
    i.index_id, i.type_desc as index_type,
    partition_id, partition_number AS pnum,  rows,
    allocation_unit_id AS au_id, a.type_desc as page_type_desc, total_pages AS pages
FROM sys.indexes i JOIN sys.partitions p
      ON i.object_id = p.object_id AND i.index_id = p.index_id
    JOIN sys.allocation_units a
      ON p.partition_id = a.container_id
      order by pages desc

A: @martin-smith's answer is almost what I needed...
Here is how you sort by index size in GB (mssql uses 8KB pages == 128 pages/MB)
SELECT
  object_name(p.object_id) AS table_name
  , i.name AS index_name
  , i.index_id
  , i.type_desc AS index_type
  -- , partition_id
  -- , partition_number AS pnum
  -- , allocation_unit_id AS au_id
  , rows
  , a.type_desc as page_type_desc
  , total_pages/(1024 * 128.0) AS sizeGB
FROM
    sys.indexes i
    JOIN sys.partitions p  ON i.object_id = p.object_id AND i.index_id = p.index_id
    JOIN sys.allocation_units a ON p.partition_id = a.container_id
    JOIN sys.all_objects ao ON (ao.object_id = i.object_id)
    WHERE ao.type_desc = 'USER_TABLE'
ORDER BY
    -- table_name
    sizeGB DESC


text:
Q: Android: showing image in build-in gallery I'm trying to open a picture in the build-in gallery, but it dosen't show up. I logged the URI to be
06-08 15:53:02.232: D/URI(3231): file:///mnt/sdcard/com.jesper.indkoeb/nm-image.jpg
which is the right place
                @Override
                public void onClick(View v) {
                    Intent intent = new Intent();
                    intent.setAction(android.content.Intent.ACTION_VIEW);
                    File file = new File(uri.get(position));
                    Log.d("URI",uri.get(position));
                    intent.setDataAndType(Uri.fromFile(file), "image/*");
                    context.startActivity(intent);

                }

            });

A: Following Snippet will help you.
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(Uri.parse("file:///mnt/sdcard/image/Apples.jpg"),"image/*");
startActivity(intent);


text:
Q: Why Does My CSS Grid when I add  to an image? When I add an anchor to an image, the grid breaks.
with anchor tag](https://i.stack.imgur.com/ykr64.jpg)
without acnchor tag](https://i.stack.imgur.com/6HPE4.png)
I quadrouple checked my code, I searched overstack, and google, and nothing addresses this directly.  I also noticed someone asked this question 2 years ago, but he didn't get a clear answer.  Please help me. Thanks in advance.

FEATURED MENUS

BRUNCH

LUNCH

DINNER

.food-box {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    grid-template-rows: auto;
    row-gap: 0em;
    color: #262626;
    background-color: #fdfdfd;
    font-family: 'Roboto', sans-serif;
}

#food-title {
    grid-column-start: 2;
    position: relative;
    justify-self: center;
    }

#dish1 {
    grid-column-start: 1;
    padding-left: 1em;
    grid-row-start: 2;
    max-width: 20em;
    }

#dish-title1 {
    position: relative;
    left: 7em;
    grid-column-start: 1;
    padding-left: 1em;
    }

#dish2 {
    grid-column-start: 2;
    grid-row-start: 2;
    max-width: 20em;
    }

#dish-title2 {
    position: relative;
    left: 7em;
    grid-column-start: 2;
    grid-row-start: 3;

    }

#dish3 {
    grid-column-start: 3;
    grid-row-start:2;
    max-width: 20em;
    }

#dish-title3 {
    position: relative;
    grid-column-start: 3;
    grid-row-start: 3;
    left: 7em;
    }

A: You have specific grid styling for your images (e.g. #dish1 { grid-column-start: 1; }).
When you wrap the images in links, the images are no longer grid children. The links are the grid children instead. You're styling the wrong elements.


text:
Q: Python max() function doesnt give correct results when two strings are compared I am new to Python. The task in hand is to find the latest build in a list of builds in a particular directory.
My code looks like this:
    command = 'ls ' + self.build_path
    stdin, stdout, stderr = self.ssh.exec_command(command)
    builds_list = stdout.read()

    arrBuild = builds_list.split('\n')
    joined = "|".join(arrBuild)
    self.latest_packages['relayws'] = max(re.findall("mybuild-relayws_[0-9]+.[0-9].[0-9]+-[0-9]_amd64.deb", joined))

Now my problem here is that, "mybuild-relayws_44.0.99-1_amd64.deb" is always considered latest when I have "mybuild-relayws_44.0.101-1_amd64.deb" in the list.
That is :
max(['mybuild-relayws_44.0.99-1_amd64.deb', 'mybuild-relayws_44.0.101-1_amd64.deb']) always returns mybuild-relayws_44.0.99-1_amd64.deb.
I understand that max() is using string comparison here and in that sense its returning it correct. However, in my case, I am expecting mybuild-relayws_44.0.101-1_amd64.deb
My questions are:

*

*How can I change the max() function in the above code, that would return mybuild-relayws_44.0.101-1_amd64.deb as result

*Is key=lambda in max function useful here? If yes, how to apply that to this code.

Thanks in Advance.

A: You have not given any rules about how you expect builds to be ordered.  Let me assume that you wish to order them based on the following:

*

*firebet-relayws_44.0.99-1_amd64.deb => 44.0.99-1

*then 44.0.99-1 => a sequence of numbers (44, 0, 99, 1)

*we order based on that sequence.

Then try something like:
def get_version(txt):
   # extract eg 44.0.99-1
   version_data = txt.split("_")[1]

   # split into 44.0.99 and 1
   version, release = version_data.split("-")

   # convert them to a list of numbers
   return [int(x) for x in version.split(".")] + [int(release)]

Then, for example:
>>> print(get_version("firebet-relayws_44.0.99-1_amd64.deb"))
[44, 0, 99, 1]

Now we pass this as the key function to max
>>> print(max(['mybuild-relayws_44.0.99-1_amd64.deb', 'mybuild-relayws_44.0.101-1_amd64.deb'], key=get_version))
mybuild-relayws_44.0.101-1_amd64.deb

A: You need to get the version from relayws:
def version(relayws):
    return map(int, relayws.split('_')[1].replace('-', '.').split('.'))

then you can find the max by the key:
latest = max(builds, key=version)


text:
Q: Failed to load Spring ApplicationContext I'm writing unit tests for a spring application which is sort of complex. I want to load spring context in order to use defined beans. My context.xml is located at:
src/main/resources/context.xml

After maven build, the context.xml appears at:
target/classes/context.xml

In the pom.xml, I have: (As suggested by this post)
<resources>
    <resource>
        <filtering>true</filtering>
        <directory>src/test/resources</directory>
        <includes>
            <include>**/*.properties</include>
        </includes>
        <excludes>
            <exclude>**/*local.properties</exclude>
        </excludes>
    </resource>
    <resource>
        <directory>src/main/resources</directory>
        <includes>
            <include>**/*.properties</include>
            <include>**/*.xml</include>
        </includes>
    </resource>
</resources>

I have tried to do this job in two ways:
1, Use ApplicationContext
AppliactionContext springContext = new ClassPathXmlApplicationContext("/context.xml");
MyObject myObject = springContext.getBean(myObject.class);

2, Use Annotations
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations={"/context.xml"})
public class myTest{
    @Autowired
    MyObject myObject;
    ...
}

But neither way works for me. Error message:
java.lang.IllegalStateException: Failed to load ApplicationContext
at org.springframework.test.context.TestContext.getApplicationContext(TestContext.java:157)
at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.injectDependencies(DependencyInjectionTestExecutionListener.java:109)
at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.prepareTestInstance(DependencyInjectionTestExecutionListener.java:75)
at org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:321)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.createTest(SpringJUnit4ClassRunner.java:211)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner$1.runReflectiveCall(SpringJUnit4ClassRunner.java:288)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.methodBlock(SpringJUnit4ClassRunner.java:290)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:231)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
...  more

Important point: The context.xml was actually copied from another project. These projects run together as an application but when function as Junit, I don't know how to load the context from a different project so I simply copied and pasted the file. This might be a problem
More information
Failure Trace:
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean
with name 'validator' defined in class path resource [context.xml]: BeanPostProcessor
before instantiation of bean failed; nested exception is
java.lang.NoClassDefFoundError: org.aspectj.lang.annotation.Aspect

Caused by: java.lang.NoClassDefFoundError: org.aspectj.lang.annotation.Aspect

Caused by: java.lang.ClassNotFoundException: org.aspectj.lang.annotation.Aspect

So looks like I have to import some spring aop package first?
Please give suggestions. Much appreciation.

A: When running as junit test using Spring Test annotations, you need to use classpath in the locations like this
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = "classpath:/context.xml")

And I don't use any resources definition in the pom.xml. You can remove that and try like this.


text:
Q: List declaration in the signature file is not being understood correctly in the implementation file I have the following signature file F.fsi:
module M =

    type T1 = A | B

    type T2 =
        | F
        | G
        static member x1 : list<T1>
        static member x2 : list<T1>

In my implementation file F.fs I have the following:
module M =

    type T1 = A | B

    type T2 =
        | F
        | G
        static member x1 = [T1.A; T1.B]
        static member x2 = [] // LINE MARKER 1; ERROR OCCURS HERE

Visual Studio red-lines the definition of x2 with the following error message:

Module 'M' contains static member M.T2.x2 : obj list but its signature
  specifies static member M.T2.x2 : T1 list  The types differ

It seems that in the implementation file the empty list is inferred to have a generic type, even though the signature file clearly indicates that the list is of type T1.  I attempted the following correction:
    static member (x2 : list<T1>) : []

But this time I got the following error message:

Only simple variable patterns can be bound in let rec constructs

I have skirted the problem by making x1 and x2 into functions instead, but is there a different way to get Visual Studio to infer the type of the list correctly?

A: The annotation should be
module M =

    type T1 = A | B

    type T2 =
        | F
        | G
        static member x1 = [T1.A; T1.B]
        static member x2 : List<T1> = []

because you are annotating the return type


text: Q: How can i refresh data or how to after sending email how can i display on other activity I am trying to create email section in my application using xampp and mysql. If user sends email then it will be shown to support team. I have created bd ID auto generated, KEY unique fro each email, user email, subject, user message, support message, created at, updated.


text:
Q: Programmatically adding product to cart returns empty cart I'm trying to add a product to cart programmatically in magento 1.9.3.3. The code adds database entries (created rows in sales_flat_quote_item and sales_flat_quote tables). But the cart shows as empty.
Here is my code
$cart = Mage::getSingleton('checkout/session')->getQuote();
$product = Mage::getModel('catalog/product')->load(1);
$cart->addProduct($product,1);
$cart->save();
Mage::getSingleton('customer/session')->setCartWasUpdated(true);
Mage::getSingleton('core/session')->addSuccess('The product has been added to cart');
$this->_redirect('checkout/cart');

A: <?php
include 'app/Mage.php';

Mage::app();
ini_set('display_errors', 1);

Mage::getSingleton('core/session', array('name' => 'frontend'));
try {
    $product_id = '394'; // Replace id with your product id
    $qty = '1'; // Replace qty with your qty
    $product = Mage::getModel('catalog/product')->load($product_id);
    $cart = Mage::getModel('checkout/cart');
    $cart->init();
    $cart->addProduct($product, array('qty' => $qty));
    $cart->save();
    Mage::getSingleton('checkout/session')->setCartWasUpdated(true);
    Mage::getSingleton('core/session')->addSuccess('Product added successfully');
    header('Location: ' . 'checkout/cart/');
} catch (Exception $e) {
    echo $e->getMessage();
}
?>


text:
Q: How to place an aside column to the right of main content? I am creating a self-help website for practice purposes only. I'm having trouble placing an 'aside' column (containing relevant quotes throughout history) on the right-side of my main content (excluding title & footer).
The 'float' property places the aside column to the right of all the content, but places it at the bottom. I have tried using 'flexbox' and this seems to solve the problem regarding the 'aside' element, but it places the footer vertically on-top of the content (& covering part of it) instead of horizontally at the bottom, along with moving the header to the left of the content (it should be at the top under the static nav-bar). This is what it does:

Can anybody help me? I'd really appreciate it.

body {
  display: flex;
  width: 800px;
  height: auto;
  margin-right: auto;
  margin-left: auto;
  text-align: center;
  font-family: garamond, serif;
}

#navbar {
  position: fixed;
  right: 0;
  left: 0;
}

.links {
  margin: 8px;
  padding: 16px;
  background-color: orange;
  -webkit-border-radius: 75%;
  text-decoration: none;
  color: black;
  font-weight: 900;
  transition: opacity 0.5s linear;
}

.links:hover {
  opacity: 0.30;
  width:
}

header {
  font-size: 25px;
  padding-top: 30px;
  color: orange;
  text-shadow: 8px 8px 16px grey;
}

#section1 {
  padding-top: 8px;
}

#section2 {
  padding-top: 16px;
  padding-bottom: 16px;
}

section p {
  text-align: justify;
}

#asideh2 {
  text-align: center;
}

aside {
  font-size: 12px;
  width: 15%;
  text-align: justify;
  float: right;
}

footer {
  justify-content: space-between;
  background-color: #d3d3d3;
  font-size: 12px;
  padding: 8px;
}
<!DOCTYPE html>

    <meta charset="utf-8">
    <title>Self-Help Emporium</title>

      Home
      About
      Blog
      Contact
      Disclaimer

Self-Help Emporium

Your Trusted Source for Self-help Material

Lorem ipsum dolor sit amet, consectetur adipiscing elit. In tempus, elit ut vestibulum maximus, orci felis pulvinar velit, malesuada faucibus est lacus et arcu. Cras commodo est nec venenatis blandit. Nullam pretium feugiat ultricies. Proin accumsan, mi et convallis ullamcorper, turpis leo pretium justo, non tincidunt mi est vitae purus. Aenean ultrices scelerisque lacus, eget sagittis justo consectetur ac. Vestibulum interdum consectetur nibh ut lacinia. Aliquam ac fringilla lacus, ut scelerisque purus. Nulla faucibus fringilla varius. Quisque enim ante, placerat eget semper vitae, pulvinar bibendum mi. Maecenas pulvinar tempus tellus, ut consectetur purus feugiat vel. Nulla eget viverra urna. Nulla eu ex eu nisi accumsan scelerisque. Nullam et nulla bibendum, condimentum odio eget, aliquet sem. Nunc ornare volutpat urna ut feugiat.

Maecenas scelerisque leo ipsum, id molestie dui auctor ac. Nunc feugiat laoreet tortor et convallis. Duis quis nisl et libero consectetur bibendum tempor at lectus. Praesent tristique, mi semper pharetra fermentum, metus orci porta ipsum, sit amet accumsan dolor tellus sit amet magna. Nam iaculis odio vel gravida egestas. Vestibulum venenatis est non orci pharetra ultricies. Fusce urna leo, commodo a ex vel, cursus semper sem. Etiam rutrum at est ut volutpat. Etiam vitae ullamcorper lectus. Duis tempus maximus nisi, eu aliquet felis congue ut. Donec erat arcu, malesuada eu ligula quis, consectetur suscipit mauris. Mauris commodo tortor ac elit euismod facilisis.

Vestibulum porttitor pulvinar erat finibus molestie. In at felis eu augue feugiat ullamcorper in ut sapien. Pellentesque gravida eros non sapien convallis ullamcorper. Vivamus magna odio, tristique sed sapien aliquet, dictum aliquet augue. Nunc lorem quam, rutrum quis nulla euismod, ornare aliquet urna. Nullam lobortis malesuada nisl, vitae mattis purus pharetra nec. Duis enim est, malesuada quis odio ac, rutrum luctus nisl. Morbi tortor risus, posuere quis orci ut, pulvinar luctus lectus. Mauris auctor risus ut dapibus mattis. Suspendisse euismod felis mauris, sit amet rhoncus lacus posuere et. In scelerisque lacus vel arcu pellentesque facilisis. Aliquam nisl tortor, cursus ac tincidunt luctus, malesuada quis lectus.

Lorem ipsum dolor sit amet, consectetur adipiscing elit. In tempus, elit ut vestibulum maximus, orci felis pulvinar velit, malesuada faucibus est lacus et arcu. Cras commodo est nec venenatis blandit. Nullam pretium feugiat ultricies. Proin accumsan, mi et convallis ullamcorper, turpis leo pretium justo, non tincidunt mi est vitae purus. Aenean ultrices scelerisque lacus, eget sagittis justo consectetur ac. Vestibulum interdum consectetur nibh ut lacinia. Aliquam ac fringilla lacus, ut scelerisque purus. Nulla faucibus fringilla varius. Quisque enim ante, placerat eget semper vitae, pulvinar bibendum mi. Maecenas pulvinar tempus tellus, ut consectetur purus feugiat vel. Nulla eget viverra urna. Nulla eu ex eu nisi accumsan scelerisque. Nullam et nulla bibendum, condimentum odio eget, aliquet sem. Nunc ornare volutpat urna ut feugiat.

Maecenas scelerisque leo ipsum, id molestie dui auctor ac. Nunc feugiat laoreet tortor et convallis. Duis quis nisl et libero consectetur bibendum tempor at lectus. Praesent tristique, mi semper pharetra fermentum, metus orci porta ipsum, sit amet accumsan dolor tellus sit amet magna. Nam iaculis odio vel gravida egestas. Vestibulum venenatis est non orci pharetra ultricies. Fusce urna leo, commodo a ex vel, cursus semper sem. Etiam rutrum at est ut volutpat. Etiam vitae ullamcorper lectus. Duis tempus maximus nisi, eu aliquet felis congue ut. Donec erat arcu, malesuada eu ligula quis, consectetur suscipit mauris. Mauris commodo tortor ac elit euismod facilisis.

Vestibulum porttitor pulvinar erat finibus molestie. In at felis eu augue feugiat ullamcorper in ut sapien. Pellentesque gravida eros non sapien convallis ullamcorper. Vivamus magna odio, tristique sed sapien aliquet, dictum aliquet augue. Nunc lorem quam, rutrum quis nulla euismod, ornare aliquet urna. Nullam lobortis malesuada nisl, vitae mattis purus pharetra nec. Duis enim est, malesuada quis odio ac, rutrum luctus nisl. Morbi tortor risus, posuere quis orci ut, pulvinar luctus lectus. Mauris auctor risus ut dapibus mattis. Suspendisse euismod felis mauris, sit amet rhoncus lacus posuere et. In scelerisque lacus vel arcu pellentesque facilisis. Aliquam nisl tortor, cursus ac tincidunt luctus, malesuada quis lectus.

    <form>
    </form>

      Mathew J. M. | 2018 ™
      Last updated: 11/09/2018

Self-Help Quotes:

No matter where you are in life, you'll save a lot of time by not worrying too much about what other people think about you. The earlier in your life that you can learn that, the easier the rest of it will be.

Our only limitations in life are those we set up in our own minds.

Focus on what you can control: your actions. How you react to negative feelings will be the key to your success.

Don't Take Anything Personally. Nothing others do is because of you. What others say and do is a projection of their own reality, their own dream. When you are immune to the opinions of others, you won't be the victim of needless suffering.

Edited: As you can see in the screenshot, the footer is vertical and is covering part of the main content. The header has been moved to the left of the main content. This has been caused by using 'flexbox'. If I don't use 'flexbox', the 'Self-Help Quotes' in the 'aside' element is placed under the content and not at the side.

A: I have solved this by adding a 'div' container with flexbox. I have kept the heading, nav-bar and footer outside of the flexbox container.
Note: In the picture below I have yet to add space and style for the 'aside' element.

A: You can use flexbox display: flex with fixed or sticky position position: fixed.


text:
Q: Selenium Webdriver get cookies full domain in internet explorer I am trying to obtain the Cookies from the whole domain of a site but I can't seem to get it. Here is my code:
Set<Cookie> cookies = driver.manage().getCookies();

    for (Cookie cookie : cookies) {
        System.out.println(cookie);
    }

This does what I want, however, I have a cookie that has another path value, and this snippet is not returning the correct cookie, any ideas?
Note: This works flawlessly on Chrome and Firefox, the browser in question is IE.

A: As far as my understanding and knowledge Internet explorer when opened with selenium maintain cookie and cache from earlier activities.
At the time of initiating you can clean the instance.
capabilities = DesiredCapabilities.InternetExplorer();
capabilities.SetCapability("ie.ensureCleanSession", true);

ie.ensureCleanSession

When set to true, this capability clears the cache, cookies, history, and saved form data. When using this capability, be aware that this clears the cache for all running instances of Internet Explorer, including those started manually.

Please do tell me if this information is helpful
Thanks


text:
Q: ArangoDB Get Tree Root Nodes I'm storing basic hierarchical game trees in ArangoDB as graphs. Each game tree has a start node, and each node (including the start node) 2-5 edges (actions). I have 2 collections, nodes for vertices and actions for edges.
I'm using the Node JS SDK and I'm trying to find the best way to query all start nodes? Should I add an isRoot property to nodes and query the nodes collection using that? Or should I query all nodes doing a filter using the actions collection to find nodes without inbound edges? Or a separate collection of start nodes?

A: Traversal or aggregation-based approaches to find root nodes will not be very efficient. The fastest option is probably to add an isRoot attribute that you can query for and potentially index.
You could also create an extra vertex that has an outgoing edge to every root node so that you can do a 1-hop traversal from this node to all root nodes. But that could get in the way if you want to traverse in the opposite direction and that node would be a supernode that one typically tries to avoid.


text:
Q: Does Lucene support searching between multiple index documents? In Database :
I have two tables. and there are three columns in each table.
Table_A (column_primaryKey_A,column_A1,column_A2)
Table_B (column_primaryKey_B,column_B1,column_B2)
Below is the SQL that I want to do using Lucene:
SELECT * FROM Table_A,Table_B WHERE column_primaryKey_A = column_primaryKey_B AND column_A1 = XX AND column_B1 = XX
I want to create two index documents(Index_Table_A, Index_Table_A)and how do I implement above things using the mechanism of Lucene or Hibernate Search?.
Any help will be thankful!

A: I'm not sure why do you need to indexes or why do you want to use lucene in the first place, but I can tell you how to implement it using one index. (using two indexes is possible but is significantly less performance)
Using one index, index any document as following:
title = column_primaryKey_A
column_A1 = val...
column_A2 = val2...
column_B1 = val3...
column_B2 = val4...

When searching you would like to use a conjuntion query on field queries as following
query = (column_A1:XX) AND (column_B1:XX)

You could find more information here on lucene query syntax.
EDIT: Another option consist of two searches might be less performing:
You could have a first search on the first column collecting all the corresponding titles (id's), and add them to a second query (on the second column):
Query: (Column_B1:XX) AND ( id1 OR id2 OR ...)

where the Id's are the results collected from the first search.


text:
Q: Can I tell if an ado.net DbCommand is a query or not (before executing it) I am trying to write a Powershell script to run a general SQL command against a database. The idea is that Run-SQL "select ..." will run the SQL text against the currently open database. If the SQL statement is a query, it should return a DataTable. If it is a non-query (DDL or DML) it should return nothing ($null).
In order to do this, I need to know which method (ExecuteReader or ExecuteNonQuery) to execute against the command. Is there a way to determine this? (I'm happy to prepare the command if that helps).
As an alternative, I can add a -query argument to be supplied by the user, which distinguishes the two cases, but as a potential user, I'd find this annoying (as, in my view, I have already said whether it's a query by the SQL I used, why say again?)
My key use is for Oracle databases, so an Oracle-specific answer is OK with me, although I'd prefer something generic.

A: I think you could just use ExecuteReader whether it's a query or not.  It may be overkill but in some quick experiments with doing an UPDATE ($reader returns nothing) and a COUNT ($reader[0] outputs scalar result) - it just seems to work.
$connstr = "server=.\SQLEXPRESS;Database=AdventureWorks;" +
           "Integrated Security=true;Persist Security Info=False"

$conn = new-object System.Data.SqlClient.SqlConnection $connstr
#$query = "UPDATE Production.Product SET Name = 'ACME' WHERE Name = 'Blade'"
$query = "SELECT Count(*) FROM Production.Product"

$cmd = new-object System.Data.SqlClient.SqlCommand $query,$conn
$conn.Open()
try
{
    $reader = $cmd.ExecuteReader()
    while ($reader.Read())
    {
        $reader[0]
    }
}
finally
{
    $conn.Dispose()
}

A: As an alternative to what Keith said you could try

$sql = 'Select count(1) From SomeTable;'
$sql = $sql.TrimStart(' ')
if ($sql -match "^select") { Write-Host 'ExecuteReader' }
else { Write-Host 'ExecuteNonQuery'}

The trim is there in case the SQL command has a leading space since $sql = ' select ' won't match "^select"


text:
Q: How does the github website work (architecture)? Github is a truly amazing service. I'm keen to understand what their architecture is like and how they fit the different pieces together; how they store the repositories, how they access those repositories to show file contents, how they handle displaying diffs, etc. Could someone give an overview of the technologies and techniques they use, so I can study them to expand my knowledge and in turn skills?

A: The core of Github is the open-source software git, which is a distributed version control and source code management software. Github adds many features onto git's functionality, including issue tracking, wiki, access control, etc.
However, Github is proprietary software, and many of it's internals remain unknown to general public.
In order to find out how pieces are fit together, I suggest following the leads below:

*

*Github's official Engineering Blog, which covers a wide range of topics of the design of the platform.

*

*especially this article, an extensive overview written by Github CTO.

*Projects that power Github, an officially curated list of open-source projects that power Github. Here are a few highlights:

*

*rails - web backend

*jekyll - blog engine behind Github Pages

*elasticsearch - search engine

*hubot - a chat bot for task automation

*ace - browswer based code editor

*d3 - js lib for graphs and charts

*resque - background works

*GitLab, an open-source alternative to Github, which offers pretty much the same functionalities.

*

*Read the source code of GitLab and you'll get to know how GitLab (and Github as well) works under the hood.

*GitLab Architecture Overview. This article is definitely a good entry point.

I stole a system layout diagram from Gitlab Architecture Overview. Bet you've already get a hang of how gitlab works from this diagram.
(There surely are lots of difference between Github and GitLab. But an open-source project is always better for someone who wants to learn, isn't it?)


text:
Q: Configuring HTTPS for Netlify subdomain registered on AWS Route 53 I have two websites hosted on Netlify. The first has the following domains
mydomain.io
www.mydomain.io

Netlify's one-click HTTPS works perfectly. In AWS Route 53 I have the following configurations:
NS mydomain.io

dns3.p08.nsone.net
dns1.p08.nsone.net
dns2.p08.nsone.net
dns4.p08.nsone.net

and
CNAME www.mydomain.io
random-words-d12345.netlify.com

I have a problem with my second site. The domain in Netlify is as follows:
app.mydomain.io

In Route 53:
CNAME app.mydomain.io

I can't enable HTTPS in Netlify. I've also tried using NS app.mydomain.io with the same nameservers and no luck either.

A: It looks like you are putting in the Netlify Nameservers in addition to keeping the Route 53 Nameservers or your old nameservers.

If you want Netlify to manage your DNS, remove the old NS entries and follow the docs to enter your settings on app.netlify.com.
If you want to keep managing DNS from Route 53, remove the Netlify NS entries and follow the docs for Custom Domain DNS configuration.

A: For app.mydomain.io site, you don't need to enter whole site url as a CNAME. Just add
CNAME app, record in your primary DNS Name server. This will create subdomain. In your case I believe you are using Netlify's Nameservers DNS so need to add there.
Example:


text:
Q: How to compress dataframes in RAM in R /pandas? I have a csv file of size 3.8gb. But when i zipped the csv the files size reduced to just 60 mb! I also have only 6gb RAM.
Is there anyway in R /pandas to compress the dataframe in RAM so that the dataframe will only occupy just 60 mb instead of 3.8 gb? Thus the software becoming more memory efficient?
If this feature is available then how to do this in R and pandas?


text:
Q: Javascript form validating and prevent submission How can I prevent submision if in my text field are entered  just specific characters <>{} and not all of special characters? I'm losing my mind :/

A: I don't have an exact answer as you didn't post any sample code. I can only point you to this article https://javascript.info/bubbling-and-capturing which explain how events bubbling works. A solution will be to use event.stopPropagation() in case the validation doesn't pass.
Here an working ex:

<!DOCTYPE html>
<html>

<head>
  <script>
    function validateForm() {
      const regex = new RegExp('^[a-zA-Z]+$');
      const input = document.forms['someForm']['somename'].value;
      if (regex.test(input)) {
        console.log("true");
      } else {
        console.log("false");
        return false;
      }
    }
  </script>
</head>

<body>

  <form name="someForm" onsubmit="return validateForm()" method="post">
    Name: <input type="text" name="somename">
    <input type="submit" value="Submit">
  </form>
</body>

</html>

A: I think you are looking for regex expression. Let me know if it's helpful
$(":input").each(function() {
  var input = $(this).val();
  var regex = new RegExp("^[a-zA-Z]+$");
  if(regex.test(input)) {
    alert("true");
  } else {
    alert("false");
    return false;
  }
})


text:
Q: Select user according to time php I am providing 24 hours trial membership in my android application. I do not know more about PHP. I want check user registration time and want disable trial membership if 24 hours got passed. I have made little PHP file for that.
$sql = "SELECT id, email, registration_time FROM user WHERE trial = 1";
$result = $conn->query($sql);

if($result) {
    while($row = $result->fetch_row()) {
        $id = $row[0];
        $email = $row[1];
        $registrationTime = strtotime($row[2]);
        $currentTime = strtotime("-1 day");
        if($currentTime > $registrationTime) {
            $update = "UPDATE user SET trial = 0 WHERE email = '$email'";
            $conn->query($update);

            $update = "UPDATE number_list SET disable = 1 WHERE user_id = $id";
            $conn->query($update);
        }
    }
}

Its not providing any result even I have one user which time passed more than 48 hours.
How can I solve this issue?

A: try this and check
$currentTime=date('m-d-Y',strtotime($registrationTime . "-1 days"))

A: You should use a prepared statement to update the database for all the users with the same email (your first update query). Also see the documentation.
If someone registers with an e-mail address like test'; DROP ALL TABLES; --@gmail.com1  this code will dutifully remove your database. Never put user data into code directly like that.
Now let's look at the example code;
$sql = "SELECT id, email, registration_time FROM user WHERE trial = 1";
$result = $conn->query($sql);
if($result) {
    while($row = $result->fetch_row()) {

You're saying there is no result at all. I assume that you've tested the output with a debug statement. E.g. putting echo 'users exist'; in between here. The first thing to do would be to check your user table if there are any rows. Does this SQL query produce results?
Assuming that it does, there doesn't appear to be anything wrong with the SQL statement. Assuming you have a table called user with four columns id, email, registration_time, and trial it should produce results.
Next, what you want to do is read the query function documentation. As you can see there, when a query fails, for whatever reason, it returns FALSE. Try writing an 'else' code block and logging the error that occurs. You can fetch it using the error function mysqli::error. Try appending this code;
} else {
    echo "MySQL Error: " . $conn->error;
}

Where you can replace the echo with your error handling of choice.
It's probably a good idea to write a wrapper for mysqli if you're going to execute more than a few queries in your application. That way, you can write error handlers in your wrapper class for what your application should do if a query or database connection fails.
What could also be the case is that, while your initial query succeeds and fetches some rows, the time check fails. You may want to do some stricter date/time parsing than using strtotime and hoping for the best. Assuming you're using a TIMESTAMP column to store the data, you can use this:
function readDatabaseTimestampValue($value) {
    $dateTime = date_create_from_format("Y-m-d H:i:s", $value);
    $timestamp = $dateTime->getTimestamp();
    return $timestamp;
}

Check the exact time data returned from your database. Dates and times are complicated, and if things are reinterpreted, say the day number in SQL may become the year in the PHP app, which can cause strange bugs. E.g. you can do this by doing say:
echo "24 hours ago: " . strtotime("-1 day") . ", user data: " . $row[2];

Next, you probably have some bugs in the logic. '24 hours ago' is better done by doing this, as using '-1 day' will cause weird issues when people mess with the calendar:
$timestamp = time() - 86400;

There's 86,400 seconds in a day (well, excluding DST and leap seconds, but you want 24 hours of subscription time, not 23 hours around the 21st of March).
Finally, there's problems if the same E-mail address is present more than once in the table. You will set 'trial' to 0 for one user, but may set the 'disable' flag for another if two users register within the same 24-hour period with the same e-mail. If the latter is guaranteed to be unique then this is no issue. Otherwise, you may want to update by id in both tables.
Next, we can look at some optimization. Right now, you fetch everything from the database. But you can do much better/faster by having an index on registrationTime, and using the database's sorting features. E.g. let's say we know the exact date/time of 24 hours ago as $yesterday in PHP we can write a query like:
SELECT id, email, registration_time FROM user WHERE trial = 1 AND registration_time > ?

Bind the $yesterday variable to the parameter. Now you no longer need the if() statement; the database does it for you. Also, as your database grows, you're not checking the old records one-by-one every time the code runs.
1Note, that may not be a legal e-mail address, but there's probably ways to do evil things even with a legal mail address.


text:
Q: Why can't I boot off a USB device on my new PC without getting an error message? I have just built a PC and am trying to reinstall windows 7 ultimate after it installed in a corrupted state. Basically I was having a problem that was shown in this thread but I was unable to access the 'Tasks' folder because it would not open no matter how many times I have tried to open it. - If you have a fix for this please let me know as then I will have no need to reinstall windows.
So your probably wondering how I got windows on my PC in the first place. Well it's a long story. So the first time that I booted I managed to boot of the USB but it took a very long time.
Then I had to reinstall because I installed all the drivers to the wrong HDD.
When reinstalling, I used the disk as I could now use the CD rom as the drivers were installed.
I am now at the current point in time where I need to reinstall. This is because of the above issue, and because I did the fresh install earlier I can not use the CD ROM and I can not install the drivers for the CD ROM because I get the error which I linked earlier.
So yeah, I am here now with a CD that I can not use because no drivers are installed, and a USB stick that for some reason my PC will not boot from.
The ISO I am flashing to the USB is not the one from the disk. It is one that my friend took from his windows 7 disk and gave to me on a USB so that I could install it onto parallels desktop on my MAC (I purchased a serial number).
The error I am given when I try to boot is:
reboot and select proper boot device or insert boot media in selected boot device and press a key
I have reflashed the ISO to different USBs. I have also used different software to to is as well as Terminal in my mac. None of these have worked. I have also tried to boot different OS and these haven't worked either.
The motherboard I have is a MSI Z97 MPOWER Intel Socket 1150.
I am honestly stuck for idea on what to do. I have read so many different threads, none of them have been able to solve my issue.
Just so there are no repeats, here is what I have already tried:

*

*Different Software to flash ISO to memory stick

*Different Memory Stick

*Different ISO

*I am almost certain I am in the right boot order

Just thought that I would mention that on loads of threads people said I should turn off secure boot but I have searched and am unable to find this in the BIOS. If you know where this would be located then please let me know and I can confirm that it is disabled.
Thanks very much!

A: If you have a SATA CD drive, you shouldn't need any drivers. It sounds like your motherboard just doens't want to install with a USB. My motherboard had the same problem when I tried to install Windows 7, despite the company saying it would work. Just burn the ISO onto a blank DVD using PowerISO and put it in a SATA DVD drive and then boot your PC. It should attempt to load from the DVD. Windows 7 is easy to install as it has a very visually based installer. From there you can just choose your hard drive, change your partitions and stuff.
On boot at the splash screen you can press the F11 key to access your MSI boot menu. From there you should be able to select your usb drive to boot from.
If all else fails, chances are you have a really dodgey ISO and should acquire a new one

A: Ok, so after a while I discovered the problem.
The issue was with the memory stick that I was using. I installed Ubuntu onto the USB and booted successfully off that so I knew that it was not an issue with the PC. I found that that what fixed my problem was to format the memory stick to NTFS. It is important that you uptick the 'quick format' box if using windows. I formatted the memory stick plenty of times but was only able to boot from it when the box had been untucked and I re-flashed the ISO to the memory stick using the 'Windows USB tool' that can be downloaded by clicking here.
Hope that this is helpful to anyone else having issues!


text:
Q: Does the IOB tagging method for Named Entity Recognition (NER) has any advantage in terms of model accuracy or computational time? Can we do NER without the IOB tags and with only the entities as labels? I am specifically working on token classification for visual documents like receipts. For example, This HuggingFace tutorial for LayoutLM on the CORD dataset for receipt information extraction does not use the IOB scheme.
I have trained the LayoutLMv2 model without IOB tagging and it trains well. But will doing it with IOB tags make any difference?

A: Imagine that your text is "... dark blue light green ...", where "dark blue" and "light green" are two different colours. If you want to make sure your model understands this difference, you should use IOB to check that the result is I-Color I-Color B-Color I-Color. If you just care that the model classifies these words as colours, no IOB tagging is needed.
From this it can be quite clear that the chosen tagging influences the performance metrics. Finding the correct tag-class couple is more complicated than just finding the correct class. In terms of computational time, I believe it has a minor impact due to the increase in total number of classes when including also IOB tags.


text:
Q: li with longer text, background width issue Fiddle with Issue
It can be observable in the screen short below, li with longer text has bigger background while other li background remained shorter.
Note: <ul> is scrollable. I have tried many CSS properties but not able to fix the issue.
Note: Giving background to <ul> is not required. I need to give background to individual li items.

A: If you want to use white-space:nowrap and make his container in this case the ul fill the space of the longest item then you need to change the block behavior. Try this:
ul {
  display:inline-block;
}

Check this Demo Fiddle


text:
Q: How can I make an alias on yii SQL statement using relationships? I'm trying to associate two tables using the following code on Yii:
$this->stocks= $stocks->find()->select(['id', 'type.name'])->joinWith('stockType type')->where(['fk_product' => $productId, 'fk_product_type' => 'type.id'])->all();

The problem is: I want the stocks ID and i'm geting an error saying the ID is ambiguous:

1052 Column 'id' in field list is ambiguous

So, how can I name the table $stocks or make it an alias so that I can remove the ambiguity?
Thanks!

A: Assuming that StocksModel is the prototype-class of $stocks, you can do as below.
$socksTableName = StocksModel::tableName();

$this->stocks= StocksModel::find()
    ->select([$socksTableName . '.id', 'type.name'])
    ->joinWith('stockType type')
    ->where([
        'fk_product' => $productId,
        'fk_product_type' => 'type.id'
    ])
    ->all();


text:
Q: Using GraphHopper in a building - Indoor Navigation I'm trying to use GraphHopper core to create a indoor navigation app.
I already create a .osm file of the building(with 2 floors) containing all the possible routes inside the building.
The problem that I'm facing now is that there is no way to filter points by floors, i.e, when I make a call to the web API /route the points only have lat/lon and no floor or something similar to distinguish between to points with the same lat/lon.
How can I solve this problem? Anyone can give me some hints to accomplish this task?

Side question: How can integrate GraphHopper jsprit with GraphHopper core? Where can I find some documentation about that?

A: This is a missing feature. See this issue https://github.com/graphhopper/graphhopper/issues/646
You could attach a z-component for every edge (or node) and use an EdgeFilter to pick the correct floor.


text:
Q: Java - Binary Image Pixel Index How can I tell if a binary image that I am generating is 0-indexed or 1-indexed?
I have made a program which reads in an image, generates a binary image and performs some other functions on the image.  I would like to know, however, how to tell which 'index' the pixel values in the binary image are?
How is this done?
Is there a simple built-in function (such as image.getRGB();, for example) which can be called to determine this?

A: I don't know what you mean with 0- or 1-indexed, but here are some facts.
BufferedImage is a generic image, so pixels start at coordinate (0,0)
If you want an array to work on, coming from this image, the upper-left corner will be in index 0 (unless otherwise specified)
image.getRGB(0, 0, image.getWidth(), image.getHeight(), array, 0, image.getWidth());
BufferedImage doesn't support 1 BPP images natively, but either via a Packed mode with a Colormodel, or a 2-index palette. I can't tell which one you have without examples.
Regardless of the internal format, the different getRGB() methods should always return one value per pixel, and one pixel per value. Note that the full-opacity value (0xFF000000, -16777216) will also be included in results.
eg.
    BufferedImage image = new BufferedImage(16, 16, BufferedImage.TYPE_BYTE_BINARY);

    image.setRGB(0, 0, 0xFFFFFFFF);
    image.setRGB(1, 0, 0xFF000000);
    image.setRGB(0, 1, 0xFF000000);
    image.setRGB(1, 1, 0xFFFFFFFF);

    System.out.println(image.getRGB(0, 0));
    System.out.println(image.getRGB(1, 0));
    System.out.println(image.getRGB(0, 1));
    System.out.println(image.getRGB(1, 1));

    int[] array = image.getRGB(0, 0, image.getWidth(), image.getHeight(), null, 0, image.getWidth());
    System.out.println(array[0]); // at (0,0)
    System.out.println(array[1]); // at (1,0)
    System.out.println(array[16]); // at (0,1)
    System.out.println(array[17]); // at (1,1)


text:
Q: php: creating variables from array I have a multi-part array that I want to grab a piece of and create a variable for it.  Below is a sample of the array:
array(17) {
  [0]=> array(2) {
      [0]=> int(1325003844) [1]=> array(2) {
          [0]=> int(31) [1]=> string(19) "ONBOARD TEMPERATURE" }
      }

There are 32 different parts like this where the value I want (like the text in quotes above) can be found at $foo[x][1] with x being a value from 0-31.  So I am wondering if I can use foreach or for to create a loop that will go through each iteration of the variable and pull that text and add it to a variable.
So the current code I have is:
if(isset($result[1][10])) { // If index 10 of $result exists
    $json_a =  $result[1][10];
    var_dump ($json_a);

To get the value I want in a single variable, I need to assing $foo_01 to $json_a[0][1] right now, and then do that 32 times.  ($json_a[1][1], $json_a[2][1], $json_a[3][1], etc.) I would rather just have one statement taht assigns them all at once.
Let me know if you need additional information. Thanks again!

A: Of course you can.
//Initialize an array variable to hold the names
$names= array();

//Creates an array of 32 strings (the names)
foreach ($items as $item){
    $names[]=$item[1];
}
//If you want to display all of the name at once, you can easily
//Implode the array to echo all of the items with a linebreak in between
echo implode('
', $names);

//or you can cycle through the results and do something for each name
//although this can be done in the original loop.
foreach ($names as $name){
    echo $name.'
';
}

On a side note, the array architecture you show seems a little weird to me. Knowing not much at all about what you're trying to do, do you think a format like this would be better?
array(31) {
    [0]=> array(2) {
        [id]=> int(1325003844),
        [name]=> "ONBOARD TEMPERATURE"
    },
    [1]=> array(2) {
        [id]=> int(1325003845),
        [name]=> "NAME 2"
    },
    etc...
}

This way you already have your finished array, ready to loop through?
UPDATE
foreach($results as $result){
    if(isset($result[1][10])) { // If index 10 of $result exists
        $foo[] =  $result[1][10];
    }
}

//Then you can access each one when needed
echo $foo[1];

A: If you use two consecutive '$', PHP will actually use the value of a variable to create a new variable of that name. Example:
$var1 = 'variable2'
$$var1 = 'hello';

echo $var1;
echo $variable2;

Will output:
variable2
hello

From your above examples, though, your naming conventions dont seem to support that (there's a space in "ONBOARD TEMPERATURE") so, you might be better using an array with associative id keys. Example:
$values[$foo[x][1]] = $foo[x][0];

Would get you a variable of $values['ONBOARD TEMPERATURE'] that would output 31.


text:
Q: Multiple prepared statements within class, getting error: Call to undefined function prepare() I'm trying to run the following queries within my "registration" class and I'm getting the error: Call to undefined function prepare().
I seem to be using prepared statements incorrectly.  This is my first attempt at using them within a class, so maybe I'm missing something there.  I would really like to take out the second block of code and use lastInsertId(), but I couldn't get that to work, so any suggestions related to that are welcome as well.
try{
    $sql = $this->$db->prepare("INSERT INTO `user_accounts` (`account_email`) VALUES (:email);");
    $sql->bindValue(':email', $email);
    $sql->execute();
    //The following line is giving me the error.
    $sql_2 = $this->$db->prepare("SELECT `user_account_id_PK` FROM `user_accounts` WHERE `account_email` = :email2;");
    $sql_2->bindValue(':email2', $email);
    $sql_2->execute();
    $id = $sql_2->fetch(PDO::FETCH_ASSOC);

    $query  = $this->$db->prepare("INSERT INTO `users` (`username`, `password`, `email`, `ip`, `time`, `email_code`, `ua_id_FK`) VALUES (?, ?, ?, ?, ?, ?, ?) ");
    $query->bindValue(1, $username);
    $query->bindValue(2, $password);
    $query->bindValue(3, $email);
    $query->bindValue(4, $ip);
    $query->bindValue(5, $time);
    $query->bindValue(6, $email_code);
    $query->bindValue(7, $id);
    $query->execute();

    //mail($email, 'Please activate your account', "Hello " . $username. ",\r\nThank you for registering with us. Please visit the link below so we can activate your account:\r\n\r\nhttp://www.launchevergreen.com/activate.php?email=" . $email . "&email_code=" . $email_code . "\r\n\r\n-- Evergreen team");
} catch(PDOException $e) {
    die($e->getMessage());
}

A: I am not an expert in PHP, but probably instead of...
$sql_2 = $this->$db->prepare

you are after
$sql_2 = $this->db->prepare

A: Use $this->db instead of $this->$db.

A: When you posted, I saw that only the second prepare contains a $this->$db and the two others are correctly using $this->db, but now, I see that you edited the question and all of them are containing the same mistake $this->$db.
So I assume that you added the $ to $this->db in your code
If you didn't change $this->$db to $this->db it won't work.


text:
Q: Order a list in Flutter What's the best approach to order a list on a ListView (or similar widget)?
I'm using table_calendar to display events on the calendar so I need to order the different events on one day by date (this field is already created for each event).

A:   final items = List.generate(10, (index) => index + 1);

  void order() {
    final ascending = items[0] > items[1];

    setState(() {
      if (ascending) {
        items.sort();
      } else {
        items.sort((a, b) => b - a);
      }
    });
  }

  @override
  Widget build(BuildContext context) {
    return ListView.builder(
        itemCount: items.length + 1,
        itemBuilder: (context, index) {
          if (index == items.length) {
            return FlatButton(
              onPressed: order,
              child: Text("Order"),
            );
          }

          return Center(child: Text("Entry ${items[index]}"));
        });
  }

A: Example below shows how to order a list of dates in ascending or descending:
final list = [
      DateTime.now(),
      DateTime.now().subtract(Duration(days: 1)),
      DateTime.now().subtract(Duration(days: 2)),
      DateTime.now().subtract(Duration(days: 3)),
    ];

    //Order By Descending
    list.sort((a, b) => a.isAfter(b) ? -1 : 1);

    //Order By Ascending
    list.sort((a, b) => a.isBefore(b) ? -1 : 1);

    for (var item in list) {
      print(item);
    }

sort can be used in any collection, use in your list of events comparing the date field


text:
Q: Escape # symbol in serialized string I have a serialized string which I am sending to server something like below:
counter=1&Id=4&type=2332&amount=3232&gstIncluded=3232&paymentMethod=2&notes=2332#fdsf&docId=0&ref=3232&isEdit=true

The problem which I am facing here is that there is "#" symbol in notes added by user. This results in breaking of the query string and I don't receive data after # in controller. Even docId, ref and isEdit are skip.
Can anyone please tell the better solution for this.
I have tried html escape the notes field but it don't escapes #.

A: You can use encodeURIComponent on notes value (and only on this specific value, otherwise you won't be able to parse other params) - it will escape the hashtag.
See docs on MDN: https://developer.mozilla.org/fr/docs/Web/JavaScript/Reference/Objets_globaux/encodeURIComponent

A: # is a character that you'd need to encode when it's in a URI (Uniform Resource Identifier), because it's normally used to show which ID has been selected/directed to.
You may see a # at the end of the URI in the address bar, and it may be followed by the ID of an element on the page - an example is the Lodash docs (_.uniqBy for example. You can use the inbuilt encodeURIComponent function to encode it. Encoded, it looks like %23:

console.log(encodeURIComponent("#"));

You can also encode the full URI in this way:

console.log(encodeURIComponent("counter=1&Id=4&type=2332&amount=3232&gstIncluded=3232&paymentMethod=2&notes=2332#fdsf&docId=0&ref=3232&isEdit=true"));

A: Try this
let url = "counter=1&Id=4&type=2332&amount=3232&gstIncluded=3232&paymentMethod=2&notes=2332#fdsf&docId=0&ref=3232&isEdit=true";
url.replace("#","%23");

Then send it to the server will take the ascii value of reserve character


text:
Q: Python -COMMETHOD ,No return value obtained I am very new to COM programming, Our project requires the Python script to make communication with a COM dll which is written in C#.
The generated COM signature in Python is as below
COMMETHOD([dispid(1610743820)], HRESULT, 'test',
          ( ['in', 'out'], POINTER(_midlSAFEARRAY(c_double)), 'test' ),
          ( ['retval', 'out'], POINTER(VARIANT_BOOL), 'pRetVal' )),

Where as the C# code for the same is
public bool test(ref double[,] test)
        {
            if (test == null)
                test = new double[1,2];

            test[0,0] = 0.0;
            test[0,1] = 0.5;

            return true;
        }

Note: the above is the dummy functions i have created to explain the issue
Now when I try to invoke the COM method from Python , I am only getting the values passed by reference to the method (sweepValuesX) as return value and not the actual return value (which has to be either true/false)
My function call is as below
print apxWrapper.test()

and the output is ((0.0, 0.5),)
Note: Since i was not able to find a way to pass the last arguement from Python ,I just omitted the last argument for trial purpose
Any hints why this is happening is highly appreciated or to be specific I have two questions

*

*How Can i pass the argument to be passed by reference from Python (POINTER(_midlSAFEARRAY(c_double)))

*How can i get the actual return value (true/false)

Sanjay


text:
Q: Apply Color Filter to Action Overflow Icon at Runtime Is there any way to get the Action bar overflow icon drawable at runtime to apply a color filter?  I'm looking for something similar to menu.findItem(R.id.menu_id).getIcon() except for the 3 dot overflow so that I can do a .setColorFilter.
Thanks!

A: Yes, there is a way. You just have to find overflow icon in view hierarchy. One good way is searching in ViewGroup returned by getDecorView(). You can search for it using findViewsWithText with flag FIND_VIEWS_WITH_CONTENT_DESCRIPTION.
Sample code:
public static void setOverflowButtonColor(final Activity activity, final int visibleFontColor) {
    final String overflowDescription = activity.getString(R.string.abc_action_menu_overflow_description);
    final ViewGroup decorView = (ViewGroup) activity.getWindow().getDecorView();
    final ViewTreeObserver viewTreeObserver = decorView.getViewTreeObserver();
    viewTreeObserver.addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
        @Override
        public void onGlobalLayout() {
            final ArrayList<View> outViews = new ArrayList<View>();
            decorView.findViewsWithText(outViews, overflowDescription, View.FIND_VIEWS_WITH_CONTENT_DESCRIPTION);
            if (outViews.isEmpty()) {
                return;
            }
            TintImageView overflow = (TintImageView) outViews.get(0);
            overflow.setColorFilter(Color.CYAN);
            removeOnGlobalLayoutListener(decorView, this);
        }
    });
}

public static void removeOnGlobalLayoutListener(View v, ViewTreeObserver.OnGlobalLayoutListener listener) {
    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) {
        v.getViewTreeObserver().removeGlobalOnLayoutListener(listener);
    }
    else {
        v.getViewTreeObserver().removeOnGlobalLayoutListener(listener);
    }
}

For more details see my answer in similar question: https://stackoverflow.com/a/27672844/2707179

A: You cant get the OverflowIcon within the onCreateOptionsMenu, but you can still change the appearance of it at runtime so instead of applying a filter on it programatically you can create your own OverflowIcon image instead.
sample:
You can change the overflow icon within the style of your activity
<style name="YOUR_THEME" parent="android:style/Theme.Holo.Light">
 <item name="android:actionOverflowButtonStyle">@style/CustomOverflow</item>
</style>

<style name="CustomOverflow" parent="android:style/Widget.Holo.ActionButton.Overflow">
   <item name="android:src">@drawable/your_custom_overflow_image</item>
</style>


text:
Q: HTTPRIO connecting to webservice "error : HTTP/1.1 401 Unauthorized" on OS, while working in Win32 I have a simple project that uses the checkVatService.wsdl to chek the vality of european VAT numbers.
When running the project on MACOS I the following error : "error : HTTP/1.1 401 Unauthorized".
When running on Win32 the project returns "valid"
procedure TForm1.ControleVat;
var
  cv  : checkVatApprox;
  cvs : checkVatApproxResponse;
  HTTPRIO1: THTTPRIO;
begin

  HTTPRIO1 := THTTPRIO.Create(nil);

  HTTPRIO1.WSDLLocation := 'checkVatservice.WSDL';
  HTTPRIO1.Service := 'checkVatService';
  HTTPRIO1.Port := 'checkVatPort';

  cvs:=nil;
  cv:=checkVatApprox.Create;
  try
    cv.countryCode := 'BE';
    cv.vatNumber   := '0000000097';
    try
      cvs:= ( HTTPRIO1 as checkVatPortType ).checkVatApprox(cv);
      if cvs.valid then begin
        showmessage('valid');
      end else begin
        showmessage('invalid');
      end;
    except
      on e:exception do begin
        showmessage('error : ' + e.Message);
      end;
    end;

  finally
    cv.Free;
    freeandnil(cvs);
  end;
end;

The service does not require autohorisation and both in Win32 and OS the username/password are blank.
What is causing this error? What is the difference in connection?

A: i have same problem, in android.  in windows it's all ok;
it seems related to some strange server issue, if client retrive ipv6 instead ipv4..
i suggest you to use : https://www.isvat.eu/