text:
Q: php- MySQL to JSON data redundancy I'm trying to json_encode some MySQL rows. The json seems to have record twice.
JSON looks like this:
{
    "0": "15",
    "1": "dfgdfg",
    "2": "fgdfg",
    "3": "MyApp",
    "4": "0",
    "5": "2015-09-16 13:09:48",
    "6": "0000-00-00 00:00:00",
    "RequestId": "15",
    "RequestEmail": "dfgdfg",
    "RequestName": "fgdfg",
    "RequestApp": "MyApp",
    "RequestGranted": "0",
    "RequestTime": "2015-09-16 13:09:48",
    "RequestGrantedTime": "0000-00-00 00:00:00"
},
{
    "0": "16",
    "1": "dfghfg",
    "2": "sdfsfg",
    "3": "MyApp",
    "4": "0",
    "5": "2015-09-16 13:10:43",
    "6": "0000-00-00 00:00:00",
    "RequestId": "16",
    "RequestEmail": "dfghfg",
    "RequestName": "sdfsfg",
    "RequestApp": "MyApp",
    "RequestGranted": "0",
    "RequestTime": "2015-09-16 13:10:43",
    "RequestGrantedTime": "0000-00-00 00:00:00"
}

I don't need first 0-6 nodes for each field.
I've tried several ways to convert data row to json in my PHP file to no avail. these records with "0" : "15" still show up.
I'm using phpMyAdmin for MySQL database. Any way I can fix this? Right now its ok because data is less. But thats 100% overload to read for my clients.
Php code:
    function fetchDataForUser($userString){
             $selectQuery = "SELECT * FROM  `Invitations`";
             $result = mysql_query($selectQuery);
             if($result == FALSE){
                echo mysql_error();
             }

             echo "[";
             if(mysql_num_rows($result)){
                 $first = true;
                 $data = array();
                 while ($row = mysql_fetch_array($result))
                 {
                     $data[] = $row;
                     if($first) {
                         $first = false;
                     } else {
                         echo ',';
                     }

                     echo json_encode($row);
                     //echo $row[0]. $row[1]. $row[2]. $row[3]. "\r";
                     //echo "{\"".$row[3][0]."\", \"".$row[1]."\", \"".$row[2] ."\"}";
                  }
                  echo "]";
              } else {
                  echo '[]';
              }
    }

A: According to the mysql_fetch_array docs, $row will contain both number indices and associative indices by default.
Try using $row =mysql_fetch_assoc($result) instead.


text:
Q: Can we have "don't abuse the spam/offensive flag" options on the decline flag dialog Following on from my previous question I have a request that specific, predefined "please don't abuse the spam/offensive flag" options be added to the moderator decline flag dialog.
This would be useful whether or not that feature is implemented or not and would make the declining of bad spam/offensive flags that much easier.
It would also be an important first step on that process.

redpajama_set_name: RedPajamaStackExchange


text:
Q: I want to display some data in the popup (popup should not be the ajax control). I was trying to do it by placing a grid within grid I have a gridview and I want to display some data in the popup (popup should not be the ajax control).I was trying to do it by placing a gridview within gridview like:
<asp:GridView ID="grdInspectionApprovel" runat="server" Width="99%" EmptyDataText="<%$ Resources:Captions,grdEmptyPeriods%>"
    AutoGenerateColumns="False" ShowFooter="true" Style="margin-bottom: 1px" CssClass="grdviewbrd"
    OnRowDataBound="grdInspectionApprovel_RowDataBound" OnRowCommand="grdInspectionApprovel_RowCommand"
    OnRowCreated="grdInspectionApprovel_RowCreated" OnRowEditing="grdInspectionApprovel_RowEditing">
    <RowStyle CssClass="RowStyle" />
    <EmptyDataRowStyle CssClass="emptyRow1" />
    <PagerSettings Visible="false" />
    <AlternatingRowStyle CssClass="AtlernatingRowStyle" />
    <Columns>
        <asp:TemplateField HeaderText="POPUP" ItemStyle-HorizontalAlign="Center">
            <ItemTemplate>

                                <input type="image" src="~/App_Themes/MyWebTheme/images/imgError.gif" id="imageButton"
                                    onclick="Popup.hide('simplediv');return false;" />

                                <asp:GridView ID="grdInspectionApprovelPOPUP" runat="server" Width="98%" EmptyDataText="<%$ Resources:Captions,grdEmptyPeriods%>"
                                    AutoGenerateColumns="False" ShowFooter="true" Style="margin-bottom: 1px" CssClass="grdviewbrd">
                                    <RowStyle CssClass="RowStyle" />
                                    <EmptyDataRowStyle CssClass="emptyRow1" />
                                    <PagerSettings Visible="false" />
                                    <AlternatingRowStyle CssClass="AtlernatingRowStyle" />
                                    <Columns>
                                        <asp:TemplateField HeaderText="<%$ Resources:Captions,lblSupplierSINo%>" ItemStyle-HorizontalAlign="Left">
                                            <ItemTemplate>
                                                <asp:TextBox ID="txtSupplierSINo" runat="server" Text='<%# Eval("SupplierSerialNo") %>'
                                                    Width="150px"></asp:TextBox>
                                                <headerstyle cssclass="gridtophead" />
                                                <itemstyle horizontalalign="Center"></itemstyle>
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                    </Columns>
                                    <HeaderStyle CssClass="grid_title" />
                                </asp:GridView>

                                <asp:ImageButton runat="server" ID="deletebtn1" CommandName="btnSave" ImageUrl="<%$ Resources:Paths,imgBtnSave%>" />
                                <asp:LinkButton runat="server" ID="deletebtn" CommandName="btnSave" Text="Save"></asp:LinkButton>
                                <asp:Button ID="Button1" runat="server" Text="<%$ Resources:Captions,btnReset%>"
                                    CssClass="btnStyle" />

                +
                <asp:LinkButton runat="server" ID="linkbtnPopup" CommandName="callPopup" Text="++"
                    CommandArgument='<%# Eval("WOID")  %>'></asp:LinkButton>
            </ItemTemplate>
            <FooterStyle HorizontalAlign="Center"></FooterStyle>
            <HeaderStyle CssClass="gridtophead" />
            <ItemStyle HorizontalAlign="Right" Width="2%"></ItemStyle>
        </asp:TemplateField>
        <asp:TemplateField HeaderText="<%$ Resources:Captions,lblSrNo%>" ItemStyle-HorizontalAlign="Center">
            <ItemTemplate>
                <asp:Label ID="lblWO" Text='<%# Eval("WOID") %>' runat="server" Style="display: none;"></asp:Label>
                <asp:Label ID="lblAssetID" Text='<%# Eval("AssetID") %>' runat="server" Style="display: none;"></asp:Label>
                <%#(Convert.ToInt32(hfPageIndex.Value) * grdInspectionApprovel.PageSize) + Container.DataItemIndex + 1%>
            </ItemTemplate>
            <FooterStyle HorizontalAlign="Center"></FooterStyle>
            <HeaderStyle CssClass="gridtophead" />
            <ItemStyle HorizontalAlign="Right" Width="2%"></ItemStyle>
        </asp:TemplateField>
    </Columns>
    <HeaderStyle CssClass="grid_title" />
</asp:GridView>

and Popup.show('simplediv') this function is from javascript file. I want to bind the chield gridview on each rowCommand of parent gridview and want to display this gridview on popup div.


text: Q: How to compute for standard deviation in this problem? The local administration installed 3500 Incandescent bulbs as part of a new lighting system project. According to them, the bulbs are produced by several companies and have a burn time of 1060 hours on average. The distribution of the burning lives is close to normal. They discovered that the 350th light bulb had burned out after 822 hours of observation. What is the standard deviation of the burning lives of this set of lightbulbs?


text:
Q: C# Script Block Register Any one can help me because i'm Trying to register a script first and bind a function called "DoClick()" into button using C# but some error is occurred during runtime. please see my code below. so that when button was click they call the function "DoClick(). Thanks Guys
public void regiterAdsScript(int loc)
{
    string adsLink = ads_link(loc);
    // Define the name and type of the client script on the page.
    String csName = "ButtonClickScript";
    Type csType = this.GetType();
    // Get a ClientScriptManager reference from the Page class.
    ClientScriptManager cs = Page.ClientScript;
    // Check to see if the client script is already registered.
    if (!cs.IsClientScriptBlockRegistered(csType, csName))
    {
        StringBuilder csText = new StringBuilder();
        csText.Append("<script type=\"text/javascript\"> \n");
        csText.Append("function DoClick() { <script type='text/javascript' src='//abcd.site?id=123'></script> }  \n");
        csText.Append("</script>");
        cs.RegisterClientScriptBlock(csType, csName, csText.ToString());
        Button1.Attributes.Add("onClick", "return DoClick()");

    }
}

A: Your script registration code should be like this
Button1.Attributes.Add("onClick", "javascript:DoClick();");

Also, your script looks wrong. Whatever you want your script to do should be followed by function declaration. Like if you want to put an alert it should be like this
csText.Append("function DoClick() { alert('MK'); }  \n");

You also need to call the function regiterAdsScript() before the Button1_Click is called. I've called it in the Page_load itself. Below is sample program for you:
protected void Page_Load(object sender, EventArgs e)
{
    regiterAdsScript();
}
protected void Button1_Click(object sender, EventArgs e)
{
    //functionality to be implemented
}
public void regiterAdsScript()
{
    string adsLink = ads_link(loc);
    // Define the name and type of the client script on the page.
    String csName = "ButtonClickScript";
    Type csType = this.GetType();
    // Get a ClientScriptManager reference from the Page class.
    ClientScriptManager cs = Page.ClientScript;
    // Check to see if the client script is already registered.
    if (!cs.IsClientScriptBlockRegistered(csType, csName))
    {
        StringBuilder csText = new StringBuilder();
        csText.Append("<script type=\"text/javascript\"> \n");
        csText.Append("function DoClick() { alert('MK'); }  \n");
        csText.Append("</script>");
        cs.RegisterClientScriptBlock(csType, csName, csText.ToString());
        Button1.Attributes.Add("onClick", "javascript:DoClick();");
    }
}


text:
Q: Collapsable list optimisation in pure js I am building a collapsable list and in my attempt to optimize my code, I find myself making something that spits errors, but for a reason still works somehow.
old code: http://jsfiddle.net/3pmcrqmj/
function addEvent(element, myEvent, fnc) {
return ((element.attachEvent) ? element.attachEvent('on' + myEvent, fnc) : element.addEventListener(myEvent, fnc, false));
}

var list = document.getElementById('list');
var items = list.getElementsByTagName('ul');
var items2 = list.getElementsByTagName('li');

for(var i = 0; len = items.length, i < len ; i++){

    items[i].parentNode.setAttribute('class','collapse');

    addEvent(items[i].parentNode, 'click', function(event) {

        event = event || window.event;

        event.stopPropagation ? event.stopPropagation() : (event.cancelBubble=true);

        if(this.getAttribute('class')==='collapse'){
            this.setAttribute('class','expand');
        } else {
            this.removeAttribute('class');
            var temp = this;
            setTimeout(function(){
                temp.setAttribute('class','collapse');
            },200);
        }

    });
}

My fixing attempt: http://jsfiddle.net/3pmcrqmj/1/
function addEvent(element, myEvent, fnc) {
return ((element.attachEvent) ? element.attachEvent('on' + myEvent, fnc) : element.addEventListener(myEvent, fnc, false));
}

var list = document.getElementById('list');
var items = list.getElementsByTagName('ul');
var items2 = list.getElementsByTagName('li');

for(var i = 0; len = items.length, i < len ; i++){
    items[i].parentNode.setAttribute('class','collapse');
}

addEvent(list, 'click', function(event) {
    for(var i = 0; len = items.length, i < len ; i++){
        event = event || window.event;

        event.stopPropagation ? event.stopPropagation() : (event.cancelBubble=true);

        if(event.target.getAttribute('class')==='collapse'){
            event.target.setAttribute('class','expand');
            target.setAttribute('class','expand');
        } else {
            event.target.setAttribute('class','collapse');
            target.setAttribute('class','collapse');
        }
    }
});

How do I bubble this properly so that I don't have to insert an event listener on every single list item?

A: Rewrite the handler with a check for the nodeName of the clicked element ( == li) and the existence of sub <li>-elements, so it acts only on those elements:
addEvent(list, 'click', function (e) {
     e = e || window.event;
     var from = e.target || e.srcElement;
     if (!/^li$/i.test(from.nodeName) ||
         !from.querySelectorAll('li').length) {return true;}
     var expand = /collapse/i.test(from.className || '');
     from.setAttribute('class', expand ? 'expand' : 'collapse');
});

Here's your rewritten jsFiddle


text:
Q: FFMPEG : overlay image on video and retain size I'm trying to overlay an image (transparent background with shape in the middle) "on top" of the video and get the image back. The image size is bigger then the video. Here is the command that I'm using:
"-i", video.mp4, "-i", image.mp4, "-filter_complex", "[1:v][0:v]scale2ref=iw:ih[ovr][base];[ovr]colorchannelmixer=aa=1.0[ovrl];[base][ovrl]overlay[v]", "-map", "[v]", "-q:v", "2", directoryToStore + "/" + ImageName + ".jpeg"

The above scales the image to the size of the video.
I want the image and the video to retain their size and output an image of the 2 overlaid.
Can someone please give me advice on how I can do this?

A: Skip the scale2ref.
"-i", video.mp4, "-i", image.mp4, "-filter_complex", "[0:v]pad=iw:2*trunc(iw*16/9/2):(ow-iw)/2:(oh-ih)/2[v0];[1:v][v0]scale2ref[v1][v0];[v0][v1]overlay=x=(W-w)/2:y=(H-h)/2[v]", "-map", "[v]", "-q:v", "2", directoryToStore + "/" + ImageName + ".jpeg"


text:
Q: Syncing branches in svn I am working on two branches concurrently. If a change is made to the trunk then I sync the two branches with the trunk.
What strategies do developers use syncing branches e.g. If I commit five changes to branch 1 and two changes to branch 2 during the week then should I sync branch 1 with 2 and branch 2 with branch 1. Historically I would wait until the branch is complete and then sync it with the trunk ie I would not usuAlly sync branches. Should I be syncing branches?

A: Svn doesn't really understand relationships between branches. when you make a branch svn just makes a copy and then forgets about it.
More modern version control systems like git and tfs (and many others) actually understand that when you make a branch,  the two places in versioncontrol are connected. that way, when you merge, the version control system understand what changes to take from each branch.
There are a variety of branching strategies you can employ. check out this page (its old, but still relevant)
http://msdn.microsoft.com/en-us/library/bb668955.aspx
Here are some newer pages on the subject
http://msdn.microsoft.com/en-us/library/ee782536.aspx
http://vsarbranchingguide.codeplex.com/
And a great SO thread
Branching Strategies
You can still use svn though, but merging will just be a lot more work. for that reason you'll probably want to minimize the amount of merges you have to do (but if you have to do it, you have to:))


text:
Q: What is the version and library support on cloudant server? Cloudant use javascript for design document on server. Which is map+reduce and update handler. But I have not seen it mention what version it could be used on current server
Is it support ES6? What library we could called on that? Can we call Math and Date?
Can we do http call? Is it compatible with node js?
I want to call http in updatehandler, suppose I use facebook auth and have user send access token to my db so I could get userID from it. Is it possible?

A: Have sent this to support@cloudant.com (actually I sent question to cloudant before posted here, but just got answer)

Cloudant uses the SpiderMonkey 1.8.5 engine for Javascript
  https://developer.mozilla.org/en-US/docs/Mozilla/Projects/SpiderMonkey/Releases/1.8.5
It implements ES-5 (ECMA 262 5th Edition), not ES 6.
The Cloudant view server cannot make outbound HTTP requests (or indeed
  do any kind of file or socket activity).

A: This is something only cloudant are going to be able to give a definitive answer on, you should email support@cloudant.com or open a ticket through the dashboard.


text:
Q: How to chain groups of observables that previously were each one in a forkjoin() operation I have an orders table in mysql, each order has a number of documents associated to it, whether they are quotes, invoices, etc.  There is therefore a second table called "documents", which has a "document_id" primary key and a "order_id" foreign key; In a similar fashion, I have another case for the different checks that technicians do to every vehicle, then another table for vehicle pictures.  I am creating a web service using Node and Express that needs to return a json that similar to this...
[
  {
    "order_id": 1003,
    "customer_id": 8000,
    "csi": 90,
    "date_admitted": "2016-10-28T05:00:00.000Z",
    "plates": "YZG-5125",
    ...
    documents: {
       "type": "invoice",
       "number": "1234",
       ...
    },
    checks: {
       "scanner": "good",
       "battery": "average",
       ...
    },
    vehicle_pictures: {
       "title": "a title...",
       "path": "the file path"
       ...
    }
  },
  {
    ...
  },
  ...
]

As you can see, it is necessary to do three queries for each order, one for checks, another for documents and a third for pictures, then I need to add these sub results to the order for finally return the array in the response.
This would be a very easy task to do in the old world of synchronous programming, however due to the asynchronous nature of the query() method in the connection object of the mysql library, this threats to become a real hell.
In a situation where I would have to process a single order, using RxJS library on the server with a forkJoin() would suffice to process all three results at once, what I am not sure is how to "chain" every order (with a forkJoin for managing the 3 queries), so everything gets process and at the end I can call res.json(result) with everything neatly assembled.
Note: I want to solve this with RxJS instead of using a sync library package like node-mysql-libmysqlclient. The reason basically is that the "right" way to do this in an async language like Node JS is go async. Also I want to use RxJS and not async, q promises, or any other library since Observables seem to be the absolute winner in the async solutions contest and also want to be consistent in all the solutions I develop, so this question is mostly oriented for RxJS masters.
Also every single question I have found in so similar to this has the classical "purist" reply saying that if you are using Node you "should" use asynchronous and don't think in synchronous solutions. So this is a challenge for those that defend that position, since this (I think) is one of those cases where sync in Node makes sense, however I really want to learn how to do this with RxJS instead of thinking that this is impossible, which I am sure is not.

A: If I understood things correctly, you have some data that you want to to use to gather additional data from the database via async operations. You want to build a combined dataset consisting of the original data and the additional information that the subsequent queries have returned.
As you have mentioned, you can use forkJoin to wait for multiple operations to complete before proceeding. You have to do this for each item in the data sequence and then use switchMap to merge the result back into the original stream.
Have a look at the following example jsbin that demonstrate how this can be done:
const data = [
  { id: 1, init: 'a' },
  { id: 2, init: 'b' },
  { id: 3, init: 'c' }
]

function getA(id) {
  return Rx.Observable.timer(1000)
    .map(() => {
      return { id, a: 'abc' }
    })
    .toPromise();
}

function getB(id) {
  return Rx.Observable.timer(1500)
    .map(() => {
      return { id, b: 'def' }
    })
    .toPromise();
}

Rx.Observable.interval(5000)
  .take(data.length)
  .map(id => data[id])
  .do(data => { console.log(`query id ${data.id}`)})
  .switchMap((data) => {
    return Rx.Observable.forkJoin(getA(data.id), getB(data.id), (a, b) => {
      console.log(`got results for id ${data.id}`);
      return Object.assign({}, data, a, b);
    });
  })
  .subscribe(x => console.log(x));


text:
Q: FingerPrint API isHardwareDetected always returns false I am using my Samsung S5 G900F(API 23, ANDROID 6.0.1) to test the latest Android Fingerprint API.
I tried to build Google Sample project
https://github.com/googlesamples/android-FingerprintDialog
But I am facing some problems
mFingerprintManager.hasEnrolledFingerprints()
This always returns false. I have double checked on Settings that I have enrolled my fingerprint and I am using Fingerprint to unlock my device.
I had also tried this function
mFingerprintManager.isHardwareDetected()

which also returns false.
Does this mean my Samsung S5 (which got its offical 6.0.1 update) is not supported or I am missing something?

A: I ran into this issue as well for Samsung Galaxy S5 running Android 6.0.1.
The Native Android SDK API for detecting the Device's Fingerprint reader always returns false:
fingerprintManager.isHardwareDetected()

After surfing around looking for solutions it appears that the Galaxy S5 is not compatible with Android's native SDK Api FingerprintManager:
http://developer.samsung.com/forum/board/thread/view.do?boardName=SDK&messageId=294791&startId=zzzzz~&searchSubId=0000000030
The solution would appear to be installing the Samsung library for support if you wanted this ability:
Android M FingerprintManager.isHardwareDetected() returns false on a Samsung Galaxy S5

A: Even Samsung S5 has fingerprint with 6.0, Samsung didn't implement Android Fingerprint APIs(standards) in this device. Still they are using their own PASS Sdk in this device.
I remember Note 4 also still uses PASS sdk even it has 6.0.


text:
Q: Why wont this javascript work? I'm trying to detect the existence of a specific cookie "abc". The code that I'm using for this is
var iterations = 0;
var interval = setInterval(checkCookie, 1000);
var cookie=getCookie("abc");
function checkCookie() {
    iterations++;
    if (iterations >= 3 || cookie !=null || cookie !="")
        clearInterval(interval);
    alert("Iteration " + iterations );
}

The only problem with this code is that it doesn't detect the existence of a cookie.
Even when I change the cookie name to one that already exists.You can check it out here http://jsfiddle.net/aMZj3/

A: You're only calling GetCookie once before your loop, you want to move it into the checkCookie function to check it on each iteration.

A: Just a Note: As per my knowledge if you are working under domain D1 then you wont be able to read the cookies set by another domain D2. That means you will be able to read cookie "abc" if it is set by the same domain under which you are working.


text:
Q: Get file name and file extension in linux distribution using powershell I used the following script on CentOS to get a file extension and file name without extension and full file name and it worked well on Windows, but when I use it on ubuntu it did not work and it showed me plenty of errors:

Method invocation failed because [System.IO.DirectoryInfo] does not contain a
    method named 'LastIndexOf'.
Method invocation failed because [System.IO.DirectoryInfo] does not contain a method named 'Substring'.

Below you can find the code that I wrote
$files = get-childitem /etc/ssl/certs
foreach ($file in $Files)
{
# Nom du fichier avec extension
$pos_last_anti_slash = $file.LastIndexOf("\")
$fullname = $files.Substring($pos_last_anti_slash+1)
# Extension du fichier
$pos_last_point = $file.LastIndexOf(".")
$extension = $file.Substring($pos_last_point+1)
Write-Host $extension

# Nom du fichier sans extension
$filename = $file.Substring($pos_last_anti_slash+1)
$pos_last_points = $filename.LastIndexOf(".")
$filename = $filename.Substring(0,  $pos_last_points)
Write-Host $filename
if($filextension == "p7b")
{
openssl x509 -inform p7b -in /etc/ssl/certs/$fullname -out
/etc/ssl/certs/$filename.pem
$var = ((& openssl x509 -in $file -dates -noout) -match 'notAfter')

}
}

A: Use the Get-Member cmdlet to see what fields the file object has. I think that FullName, BaseName, Extension, and Name may be of interest.
Get-ChildItem -File -Path '/etc/ssl/certs' | Get-Member

I have not tested this, but it might be close to what you are seeking. I did replace == with -eq.
$certsdir = '/etc/ssl/certs'
$files = Get-ChildItem -File -Path $certsdir
foreach ($file in $files) {
    # Nom du fichier avec extension
    $fullname = $_.Name

    # Extension du fichier
    $extension = $_.Extension
    Write-Host $extension

    # Nom du fichier sans extension
    $filename = $_.BaseName
    Write-Host $filename

    if ($filextension -eq ".p7b") {
        openssl x509 -inform p7b -in $_.FullName -out $(Join-Path -Path $certsdir -ChildPath "$filename.pem")
        $var = ((& openssl x509 -in $file -dates -noout) -match 'notAfter')
    }
}


text:
Q: substitute a regex in a string in batch I need to delete everything starting with a word from a string in a windows batch script.
For example if I have the string:
This is my line delete from here.

I want to delete everything starting with the word delete and I need to obtain:
This is my line.

I have tryed this:
set line="This is my line delete from here"
set word="delete"
set delete="!word!*";
set line=!line:%delete%=!

It doesn't work what I have tryed, I have activated delayed expansion, and I am not sure if this: "set line=!line:%delete%=!" works. I have tryed this too "set line=!line:!delete!=!" but doesn't work either. I am new with batch scripting.
UPDATE:
In a loop I can only do delayed expansion, and this code doesn't work:
@ECHO OFF

setlocal
for /F "delims= " %%A in (temp.txt) do (
    set "line=This is my line delete from here"
    ECHO original:%line%:
    set "word=delete"
    CALL set "delete=%%line:*%word%=%%"
    ECHO delete the "%word%%delete%" part
    CALL set "line=%%line:%word%%delete%=%%"
    ECHO final   :%line%:
)
endlocal

Output:
original::
=%" was unexpected at this time.
delete the "" part
=%" was unexpected at this time.
final   ::

But if I remove the for from the code above, the output is:
original:This is my line delete from here:
delete the "delete from here" part
final   :This is my line :

My question is how can I do the same thing in a loop, with delayed expansion, as with normal expansion. I need in other words late expansion for both variables in the substitution expression the inner and the outer (set "delete=!line:*!word!=!", doesn't work). I can not find any documentation on that.
Thanks.

A: @ECHO OFF
SETLOCAL
set "line=This is my line delete from here"
ECHO original:%line%:
set "word=delete"
CALL set "delete=%%line:*%word%=%%"
ECHO delete the "%word%%delete%" part
CALL set "line=%%line:%word%%delete%=%%"
ECHO final   :%line%:

GOTO :EOF

This should show you the steps.
First, delete the part up to and including the word. Then delete the word and the rest-of-line (in delete)
Note the placement of the quotes - to control the set not the value assigned.

A: I have read this and the updated code based on Magoo's answer:
@ECHO OFF

setlocal
for /F "delims= " %%A in (temp.txt) do (
    set "line=This is my line delete from here"
    set "word=delete"
    echo line is: !line!
    for /f "delims=" %%a in ("!word!") do set delete=!line:*%%a=!
    echo delete is: !delete!
    for /f "delims=" %%a in ("!word!!delete!") do set line=!line:%%a=!
    echo line is: !line!
)
endlocal


text:
Q: IIS 8 configuration of handlers without verifying file exists I am migrating an ASP.NET 2 website from Windows Server 2003 to Windows Server 2012.
This means going from IIS 5 to IIS 8.
In IIS 5 I used to map all xml requests to be handled by asp.net (they needed to be served from a dynamic different location), but when trying to set that up using the handlers in IIS
8, I just get a 404 not found error.
I have verified that my handler is the first in the order and that it's for "unspecified" path types.
How can I set this up so it works in IIS 8 too?


text:
Q: Help loading images into Galleria dynamically I am building a site with the gallery as the main feature, and I need the gallery to have "categories". I am going to load in the images via AJAX but at the moment just getting the Galleria gallery to load in different images is proving challenging. My code is as follows:
function swap_gallery() {
    var new_slideshow = [
        { image: '../images/slideshow/architecture_3.jpg' },
        { image: '../images/slideshow/report_1.jpg' }
    ];
    Galleria.get(0).load({
        data_source: new_slideshow
    });
}

When I run this function I get this error in Firebug:

Error: Load failed: no data found.

For the life of me I can't work this one out.

A: Just push the new values as you would do for an array.
Galleria.get(0).push({image: '../images/slideshow/architecture_3.jpg'});
Galleria API #Manipulation http://galleria.aino.se/docs/1.2/api/methods/

A: This works for me in Galleria 1.2.9.
Galleria.get(0).load([
        { image: '/foo/bar/image1.jpg' },
        { image: 'image2.jpg' },
        { image: 'bacon/eggs/image3.jpg' }
    ]);

A: Try dataSource: new_slideshow instead of data_source: new_slideshow

A: Galleria.get(0).load(new_slideshow);

which is, in fact, the same as mhenrys answer


text:
Q: DynamoDB table seed works in cli but not AWS-SDK I have a table that has more than 25 items and wrote a basic script to break them into sub arrays of 25 items each then loops thru that collection of sub arrays to run a batch write item command in the AWS DynamoDB Client.  The issue I am getting is a returned validation error.  When I run the same seed file via the aws-cli it seeds the table perfectly.  This makes me think it has something to do with my script.  See anything I am missing?  Thanks in advance!
var { DynamoDB } = require('aws-sdk');
var db = new DynamoDB.DocumentClient({
  region: 'localhost',
  endpoint: 'http://localhost:8000',
});
const allItems = require('./allItems.json');
const tableName = 'some-table-name';
console.log({ tableName, allItems });
var batches = [];
var currentBatch = [];
var count = 0;
for (let i = 0; i < allItems.length; i++) {
  //push item to the current batch
  count++;
  currentBatch.push(allItems[i]);
  if (count === 25) {
    batches.push(currentBatch);
    currentBatch = [];
  }
}
//if there are still items left in the curr batch, add to the collection of batches
if (currentBatch.length > 0 && currentBatch.length !== 25) {
  batches.push(currentBatch);
}

var completedRequests = 0;
var errors = false;
//request handler for DynamoDB
function requestHandler(err, data) {
  console.log('In the request handler...');
  return function (err, data) {
    completedRequests++;
    errors = errors ? true : err;
    //log error
    if (errors) {
      console.error('Request caused a DB error.');
      console.error('ERROR: ' + err);
      console.error(JSON.stringify(err, null, 2));
    } else {
      var res = {
        statusCode: 200,
        headers: {
          'Content-Type': 'application/json',
          'Access-Control-Allow-Methods': 'GET,POST,OPTIONS',
          'Access-Control-Allow-Origin': '*',
          'Access-Control-Allow-Credentials': true,
        },
        body: JSON.stringify(data),
        isBase64Encoded: false,
      };
      console.log(`Success: returned ${data}`);
      return res;
    }
    if (completedRequests == batches.length) {
      return errors;
    }
  };
}

//Make request
var params;
for (let j = 0; j < batches.length; j++) {
  //items go in params.RequestedItems.id array
  //format for the items is {PutRequest : {Item: ITEM_OBJECT}}
  params = '{"RequestItems": {"' + tableName + '": []}}';
  params = JSON.parse(params);
  params.RequestItems[tableName] = batches[j];

  console.log('before db.batchWriteItem: ', params);

    try {
        //send to db
        db.batchWrite(params, requestHandler(params));
    } catch{
        console.error(err)
    }
}

Here is the formatted request object and the error:
before db.batchWriteItem:
{ RequestItems:
   { 'some-table-name': [ [Object], [Object], [Object], [Object] ] }
}
In the request handler...
Request caused a DB error.
ERROR: ValidationException: Invalid attribute value type
{
  "message": "Invalid attribute value type",
  "code": "ValidationException",
  "time": "2020-08-04T10:51:13.751Z",
  "requestId": "dd49628c-6ee9-4275-9349-6edca29636fd",
  "statusCode": 400,
  "retryable": false,
  "retryDelay": 47.94198279972915
}

A: You are using the DocumentClient in the nodejs code. This will automatically convert the data format used by DynamoDB to a more easily consumable format.
e.g.
  {
     "id": {
       "S": "A string value"
     }
  }

would become
  {
     "id": "A string value"
  }

The CLI does not perform this data conversion.
You can use the regular DynamoDB client to not perform this conversion in Nodejs. e.g. const db = new Dynamodb()


text:
Q: How can i set the value of dynamic fields in React? I have dynamic fields for a CRUD and i need update data from there, for that i have to set the data values that comes by API. The submit function is working, the form is updating, the problem is set the values to the inputs. At first i was thinking on jquery function($document.ready), after that i used useEffect hook but both options don't work, any help?, there is my code below.
export default function Pros(){

const [pros, setPro] = useState([
    {pro: ''}
])

const changePro = e => {

    let proArr = [];
    let prosObject = [...pros]
        prosObject.map(x => {
        proArr.push(Object.values(x));
    })

    setPro({
        pro: proArr
    })

}

const submitPro = e => {
    const {pro} = pros;
}

const handleChangePro = (index, event) => {
    const values = [...pros];
    values[index][event.target.name] = event.target.value;
    setPro(values);
}

const handleAddPro = () => {
    setPro([...pros, {pro: ''}])
}

const handleRemovePro = () => {
    const values = [...pros];
    let index = values.length-1;
    values.splice(index, 1);
    setPro(values);
}

useEffect(() => {
    return () => {
        $("#createPro").val('pro number 1'); <------ that was the way what im doing it, but doesn't work
    };
}, [])

return(

            {
                pros.map((pro,index) => (

                        <input id="createPro" onChange={event => handleChangePro(index, event)} type="text" className="form-control" name="pro" placeholder="set pro"/>

                ))
            }

                <IconButton className="mb-1 justify-content-center" onClick={() => handleRemovePro()}>
                    <RemoveIcon/>
                </IconButton>
                <IconButton onClick={() => handleAddPro()}>
                    <AddIcon/>
                </IconButton>

);

}

A: Simply, you need a value property for your input element that gets value from a variable in your component
assuming you have a variable
let inputVal = 'some value'

you can have:
<input value={inputVal} />

note that, having this variable using useState hook will help you to refresh the value when updated dynamically
ex:
const [inputVal, setInputVal] = useState('some value')


text:
Q: Why does adding a Header view to a MvxListView derivative disrupt the binding process? I'm currently using MvvmCross for new app projects, and I'm trying to display a header view with a MvxListView. Reading discussions such as this has led me to understand that a headerview cannot be added after the adapter has been set, so the constructor must be overridden so that the header is added before the MvxAdapter is set. This has led me to implement the following class:
public class HeaderListView : MvxListView
{
    public FrameLayout HeaderFrame { get; set; }

    public HeaderListView(Context context, IAttributeSet attrs)
        : this(context, attrs, new MvxAdapter(context))
    {
    }

    public HeaderListView(Context context, IAttributeSet attrs, IMvxAdapter adapter)
        : base(context, attrs, null)
    {
        InitializeHeader(context);
        // Note: Any calling derived class passing a null adapter is responsible for setting
        // it's own itemTemplateId
        if (adapter == null)
            return;

        var itemTemplateId = MvxAttributeHelpers.ReadListItemTemplateId(context, attrs);
        adapter.ItemTemplateId = itemTemplateId;
        Adapter = adapter;
    }

    private void InitializeHeader(Context context)
    {
        HeaderFrame = new FrameLayout(context);
        AddHeaderView(HeaderFrame);
    }
}

Pay particular attention to the InitializeHeader call in the second constructor. When I comment this line out, the test application starts up fine and this HeaderListView behaves indistinguishably from a standard MvxListView. However, uncomment that line and you are greeted with a blank ListView and a number of binding errors:
MvxBind:Error: 10.86 Problem seen during binding execution for binding ItemsSource for Names - problem TargetInvocationException: Exception has been thrown by the target of an invocation.
02-02 23:33:01.948 I/mono-stdout( 2323): MvxBind:Error: 10.86 Problem seen during binding execution for binding ItemsSource for Names - problem TargetInvocationException: Exception has been thrown by the target of an invocation.
      at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in <filename unknown>:0
  at System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) [0x00000] in <filename unknown>:0
  at Cirrious.MvvmCross.Binding.Bindings.Target.MvxPropertyInfoTargetBinding.SetValueImpl (System.Object target, System.Object value) [0x00000] in <filename unknown>:0
02-02 23:33:01.948 I/mono-stdout( 2323):      at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in <filename unknown>:0
02-02 23:33:01.948 I/mono-stdout( 2323):   at System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) [0x00000] in <filename unknown>:0
02-02 23:33:01.958 I/mono-stdout( 2323):   at Cirrious.MvvmCross.Binding.Bindings.Target.MvxPropertyInfoTargetBinding.SetValueImpl (System.Object target, System.Object value) [0x00000] in <filename unknown>:0
  at Cirrious.MvvmCross.Binding.Bindings.Target.MvxConvertingTargetBinding.SetValue (System.Object value) [0x00000] in <filename unknown>:0
  at Cirrious.MvvmCross.Binding.Bindings.MvxFullBinding.UpdateTargetFromSource (System.Object value) [0x00000] in <filename unknown>:0
InnerException was NullReferenceException: Object reference not set to an instance of an object
      at Cirrious.MvvmCross.Binding.Droid.Views.MvxListView.set_ItemsSource (IEnumerable value) [0x00000] in <filename unknown>:0
  at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (System.Reflection.MonoMethod,object,object[],System.Exception&)
02-02 23:33:01.958 I/mono-stdout( 2323):   at Cirrious.MvvmCross.Binding.Bindings.Target.MvxConvertingTargetBinding.SetValue (System.Object value) [0x00000] in <filename unknown>:0
02-02 23:33:01.968 I/mono-stdout( 2323):   at Cirrious.MvvmCross.Binding.Bindings.MvxFullBinding.UpdateTargetFromSource (System.Object value) [0x00000] in <filename unknown>:0
02-02 23:33:01.968 I/mono-stdout( 2323): InnerException was NullReferenceException: Object reference not set to an instance of an object
02-02 23:33:01.968 I/mono-stdout( 2323):      at Cirrious.MvvmCross.Binding.Droid.Views.MvxListView.set_ItemsSource (IEnumerable value) [0x00000] in <filename unknown>:0
02-02 23:33:01.968 I/mono-stdout( 2323):   at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (System.Reflection.MonoMethod,object,object[],System.Exception&)
  at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in <filename unknown>:0

I can't make any sense at all of this error, because the only difference that causes its appearance is that I assign a header view before assigning the adapter, but that has nothing whatsoever to do with the adapter. What is the source of this error, and how can I work around it?
The full source of my sample project demonstrating this problem is available on github.

A: The reason has to do with the hacky way that headers and footers were added to ListView. When you add a header or footer to a ListView, when you set the adapter for the list view, it wraps your adapter in a HeaderViewListAdapter that returns the headers and footers as though they were just rows before and after the actual rows your adapter returns.
The reason this fails with MvxListView is its Adpater property which looks like this:
    public new IMvxAdapter Adapter
    {
        get { return base.Adapter as IMvxAdapter; }
        set
        {
            // Code to copy ItemsSource and template ID

            base.Adapter = value;
        }
    }

It does not store the IMvxAdapter instance you give it. It just sets it in the base.Adapter and expects when it gets base.Adapter later it will be the same value it set earlier. But that is not true when headers and footers are added to the list. The class you get back from base.Adapter will be a HeaderViewListAdapter that wraps the instance of IMvxAdapter that was set earlier.
There is no good way to work around this as a user of MvxList (other than copy and change MvxList). The fix for Stuart would be to not rely on base.Adapter for the getter, but instead store the value into a field in the setter and return that from the getter.

A: By adding ItemsSource in the .axml file causes the List to set an Adapter and you can not add a header/footer to a listview when an Adapter is set.
I had a similar issue and ended using
MvxListWithHeader - It allows you to add a header and footer to a MvxListView.

A: I can't see any obvious reason behind the error.
It doesn't look like the "binding process" is being disrupted from your trace. Instead it looks like the Adapter is somehow being stuck at null.
One suggestion to help debug further - if you add a new ItemsSource to your custom list view, then this will be used for binding - and will give you a place to put a breakpoint so that you can investigate the state of the ListView control during the set_ItemsSource  null reference problem.
    [MvxSetToNullAfterBinding]
    public new IEnumerable ItemsSource
    {
        get { return Adapter.ItemsSource; }
        set {
            // here is where null is being reported
            // add a breakpoint and examine Adapter and ((ListView)this).Adapter in the watch window
            Adapter.ItemsSource = value;
        }
    }

Beyond this, you could try copying all the MvxListView code into your view to see if that helps identify the issue.


text:
Q: AS3: Loading SWFs in a for loop I'm trying to load external SWFs in a for loop, and I have this problem that is really eating me: In the event handler I need to know the filename of the SWF that was loaded, but I can't obtain this. The code below shows what I'm trying to do.
Does anybody have any idea?
function loadManySWFs(arrayOfFileNames:Array)
{
    for(var i=0; i<arrayOfFileNames; i++)
    {
        var mLoader:Loader = new Loader();
        var mRequest:URLRequest = new URLRequest(arrayOfFileNames[i]));
        mLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, onLoadComplete);
        mLoader.load(mRequest);
    }

}

function onLoadComplete(e:Event)
{
    // Here I need to know the filename of the SWF that was loaded. How can I do this?

}

Thanks for any help!

A: event.target would contain the relevant LoaderInfo object, you can retrieve the url from that.
function onLoadComplete(e:Event):void {
    trace(LoaderInfo(e.target).url);
}


text:
Q: Request Ajax in Live Server doesn't work for printing my cashier project build in laravel. i need print receipt from web browser via mobile bluetooth.
i use mike42/escpos and RawBT package.
my program is working fine when running in localhost. but, doesn't work in live server
this is my VIEW :
<button
   onclick="ajax_print('{{url('/cashier/pay',[$id])}}',this)"
   class="btn btn-sm btn-warning">Pay
</button>

this is my AJAX
function ajax_print(url, btn) {
    b = $(btn);
    b.attr('data-old', b.text());
    b.text('wait');
    $.get(url, function (data) {
        window.location.href = data;  // main action
    }).fail(function () {
        alert("ajax error");
    }).always(function () {
        b.text(b.attr('data-old'));
    })
}

and this is my Controller :
try{
    $profile = CapabilityProfile::load("POS-5890");
    $connector = new RawbtPrintConnector();
    $printer = new Printer($connector, $profile);

    // Content
    $printer->setJustification(Printer::JUSTIFY_CENTER);
    $printer->selectPrintMode(Printer::MODE_DOUBLE_WIDTH);
    $printer->text("Hello World.\n");

    //Print
    $printer->cut();
    $printer->pulse();
  } catch (Exception $e) {
      return redirect()->route('cashierindex')->with('error','Something Error');
  } finally {
      $printer->close();
  }

Can you help me, why this code doesn't work in live server, but working fine in localhost ?

A: I think this is a little bit of problem..
in mike42 you should activate the requirement php extension in your server. in my case, i forgot activating intl extension

A: I assume that is a touch little bit of problem..
in mike42 you have to spark off the requirement personal home page extension to your server. in your case, you forgot activating required extension


text:
Q: Can I grab the project output app.config file in the XML file Changes area of InstallShield 2012? I need to change a couple paths from the debug/testing App.config files to their final home on the end user's machine.  I see the XML File Changes option when editing the Installer project through Visual studio, and the help indicates I should Import the xml file to be changed.
BUT...
Is there any way to import the  output of the project for the XML file?  If I browse directly to the file itself I have to use the Debug or Release config file, which seems like it would be annoying.  Otherwise I could use the base App.config but if any transformations are applied when building they'd be lost.
So am I stuck with just browsing to a file, or can I grab the "Project Output" somehow like I can for the .exe file?

A: XML File Changes is pretty weak tea.
To do what you are looking for your going to have to create a custom action that loads the .config file and updates it outside of InstallShield.
If you are using 2012 C# Wizard project type an option should be to create a .rul that catches the OnEnd() event in After Move Data. From the .rul call into a dll via UseDLL and invoke a method that accepts the target path to the config and the value to update the value to.

The following is code I'm testing so...
Using a C# Wizard project type I added the following InstallScript rule to call into a C# dll:
function OnEnd()
string basePath;
BOOL bResult;
string dllPath;
OBJECT oAppConfig;
begin

dllPath = TARGETDIR ^ APPCONFIG_DLL;
try
    set oAppConfig = DotNetCoCreateObject(dllPath, "AppConfig.ConfigMgr", "");
catch
    MessageBox("Error Loading" + dllPath + ": "  + Err.Description, INFORMATION);
    abort;
endcatch;

try
    basePath = "C:\\Program Files (x86)\\MyCompany\\Config Test\\";
    bResult = oAppConfig.ConfigureSettings(basePath + "appsettings.xml", basePath + "app.config", "someAppSection");
catch
    MessageBox("Error calling ConfigureSettings " + dllPath + " " + Err.Number + " " + Err.Description, INFORMATION);
endcatch;

end;

C# test code:
        public bool ConfigureSettings(string configFilePath, string targetAppConfigPath, string targetAppName)
        {
            bool completed = true;
        try
        {
            XmlDocument configFileDoc = new XmlDocument();
            configFileDoc.Load(configFilePath);

            string installerTargetFileDoc = targetAppConfigPath; // InstallShield's build process for Visual Studio solutions does not rename the app.config file - Awesome!
            System.IO.FileInfo fi = new System.IO.FileInfo(installerTargetFileDoc);
            if (fi.Exists == false) installerTargetFileDoc = "app.config";
            XmlDocument targetAppConfigDoc = new XmlDocument();
            targetAppConfigDoc.Load(installerTargetFileDoc);

            // ensure all required keys exist in the target .config file
            AddRequiredKeys(configFileDoc.SelectSingleNode("configuration/" + targetAppName + "/requiredKeys"), ref targetAppConfigDoc);

            // loop through each key in the common section of the configuration file
            AddKeyValues(configFileDoc.SelectSingleNode("configuration/common/appSettings"), ref targetAppConfigDoc);

            // loop through each key in the app specific section of the configuration file - it will override the standard configuration
            AddKeyValues(configFileDoc.SelectSingleNode("configuration/" + targetAppName + "/appSettings"), ref targetAppConfigDoc);

            // save it off
            targetAppConfigDoc.Save(targetAppConfigPath);
        }
        catch (Exception ex)
        {
            completed = false;
            throw ex;
        }
        return completed;
    }
    private void AddKeyValues(XmlNode configAppNodeSet, ref XmlDocument targetAppConfigDoc)
    {
        foreach (XmlNode configNode in configAppNodeSet.SelectNodes("add"))
        {
            XmlNode targetNode = targetAppConfigDoc.SelectSingleNode("configuration/appSettings/add[@key='" + configNode.Attributes["key"].Value + "']");
            if (targetNode != null)
            {
                targetNode.Attributes["value"].Value = configNode.Attributes["value"].Value;
            }
        }
    }
    private void AddRequiredKeys(XmlNode targetAppNodeSet, ref XmlDocument targetAppConfigDoc)
    {
        foreach (XmlNode targetNode in targetAppNodeSet.SelectNodes("key"))
        {
            // add the key if it doesn't already exist
            XmlNode appNode = targetAppConfigDoc.SelectSingleNode("configuration/appSettings/add[@key='" + targetNode.Attributes["value"].Value + "']");
            if (appNode == null)
            {
                appNode = targetAppConfigDoc.SelectSingleNode("configuration/appSettings");
                XmlNode newAddNode = targetAppConfigDoc.CreateNode(XmlNodeType.Element, "add", null);
                XmlAttribute newAddNodeKey = targetAppConfigDoc.CreateAttribute("key");
                newAddNodeKey.Value = targetNode.Attributes["value"].Value;
                XmlAttribute newAddNodeValue = targetAppConfigDoc.CreateAttribute("value");
                newAddNodeValue.Value = "NotSet";
                newAddNode.Attributes.Append(newAddNodeKey);
                newAddNode.Attributes.Append(newAddNodeValue);
                appNode.AppendChild(newAddNode);
            }
        }
    }

A: While it seems like it should work, Installshield is unable to grok project output correctly (dependencies are missed often, merge modules are duplicated even when they dont apply), or give you a way to deal with individual files in project output.
I have no less than 5 bugs open with them about problems using project output and their workaround is always "Add the files manually".
If you are just getting started with install shield, I suggest you try another alternative. If you have to use it, either complain about this not working to their support team and use the suggested workaround until they get it together.
This may not be the "answer" to your question, but hopefully helps your sanity when dealing with the broken feature set in this product.

A: You can import any file you want (by browsing), and make changes to it in any run-time location you like. I suggest just putting the minimal amount you need to make your changes; after all it's the XML File Changes view. That way most updates to the file won't cause or require any changes to your XML File Changes settings, no matter how it's included.


text:
Q: iOS Crashlytics not logged in firebase dashboard I have configured it for firebase in app delegate.
Change Debug Information Format to DWARF with dSYM
I write the necessary run scripts.
"${PODS_ROOT}/FirebaseCrashlytics/run"

${DWARF_DSYM_FOLDER_PATH}/${DWARF_DSYM_FILE_NAME}/Contents/Resources/DWARF/${TARGET_NAME}
$(SRCROOT)/$(BUILT_PRODUCTS_DIR)/$(INFOPLIST_PATH)

But test crashes not showing in crashlytics dashboard
Finally, when I run Crashlytics/run manually, it gives an Could not get GOOGLE_APP_ID in Google Services file from build environment error, but GoogleService-Info.plist is attached to the project and I'm sure. I deleted the GoogleService-Info.plist and added it again. Could it be related to
Could you please tell me why or idea?
Thanks in advance

A: I assume it's "GoogleService-Info.plist" problem
because it's the only file that has GOOGLE_APP_ID property.
first, check google plist path. put it under your project folder, and then update your script with a specific path of file:
Xcode path: build phases -> Run Script
"${PODS_ROOT}/FirebaseCrashlytics/run" -gsp "${PROJECT_DIR}/[project folder name]/GoogleService-Info.plist" -p ios

second: make sure Xcode used your script succeesfully. to check that navigate to:
Xcode path : report navigator
then select a recent ended build and from center log scroll to the end and find this:
image link
as you see in image the validation should be succesfull

*

*if you didn't find any related log to shell in the build log make sure you unchecked this
image link

A: Script succeeds in report navigator but still doesn't show my test crashes in crashlytics. imageLink
And I followed these steps of firebase

*

*In Xcode, select Product > Scheme > Edit scheme.

*Select Run from the left menu, then select the Arguments tab.

*In the Arguments Passed on Launch section, add -FIRDebugEnabled.
But Completed report submission did not print logs

A: I had a very silly problem.I solved my problem. After you build with Xcode, you have to stop xcode and open the app manually.

A: I was missing a most important step mentioned in the documentation
While testing for crash please build and detach the Xcode's debugger using square button right before the run button in Xcode
Please refer to this part in documentation


text:
Q: How to trigger onPress event of TouchableOpacity?
Using jQuery in html:
$("input:button").on("click",function(){alert(1)}).click()

It can trigger click event.
I want to do the similar thing to onPress event of TouchableOpacity in react-native.
<TouchableOpacity activeOpacity={0.75} key={id} onPress={() => {onChangeAttribute(key)}}>
    {<Text>{value.name}</Text>}
</TouchableOpacity>

I don't know how to do this. I google it but found nothing.
I just want to trigger onPress event in code not by user's tapping.
Thanks in advance.

A: You should make your code like this:
render () {
  <TouchableOpacity activeOpacity={0.75} key={id} onPress={onChangeAttribute(key)}>
    { <Text>{value.name}</Text> }
  </TouchableOpacity>
}


text:
Q: Selenium with IEWebDriver not recognizing input values entered I am using IE Driver in Selenium with C#.
I have a form with required input elements. In spite of values being entered, there is a required field validator and the Save button is not getting enabled or clicked.


text:
Q: Cannot read microsoft access database in R under Windows 10 (x64) I am trying to read a Microsoft access db.accd database from R using the following function took from this other question:
require(DBI)
library(RODBC)
db_file_path="db.accd"
dbq_string <- paste0("DBQ=", db_file_path)
driver_string <- "Driver={Microsoft Access Driver (*.mdb, *.accdb)};"
db_connect_string <- paste0(driver_string, dbq_string)

con <- odbcDriverConnect(db_connect_string, rows_at_time = 1)
table <- sqlQuery(con, "select * from TABLE", stringsAsFactors = FALSE)

odbcClose(con)

However I get the error:
Warning messages:
1: In odbcDriverConnect(db_connect_string, rows_at_time = 1) :
  [RODBC] ERROR: state HY000, code 63, message [Microsoft][Controller ODBC Microsoft Access]Error general cannot open the key 'Temporary (volatile) Ace DSN for process 0x66c Thread 0xff0 DBC 0x26d3098                                                              Jet' of Registry.
2: In odbcDriverConnect(db_connect_string, rows_at_time = 1) :
  [RODBC] ERROR: state HY000, code 63, message [Microsoft][Controller ODBC Microsoft Access]Error general cannot open the key 'Temporary (volatile) Ace DSN for process 0x66c Thread 0xff0 DBC 0x26d3098                                                              Jet' of Registry.
3: In odbcDriverConnect(db_connect_string, rows_at_time = 1) :
  [RODBC] ERROR: state HY000, code -1811, message [Microsoft][Controller ODBC Microsoft Access] cannot find the file '(unknow)'.
4: In odbcDriverConnect(db_connect_string, rows_at_time = 1) :
  ODBC connection failed

I am using R 3.5.1 x64 on 64 bits Windows. I have installed the drivers for Microsoft Access and created the database file using the data origin (ODBC):

But still cannot read the database.
Any hints?

A: Try using odbcConnectAccess2007, for example:
library(RODBC)

# This will be your access database filename
db <- "db.accdb"
con <- odbcConnectAccess2007(db)

# Replace Table1 with the name of the table that you have in your access db
df <- sqlQuery(con, "SELECT * from Table1", as.is = TRUE)

odbcClose(con)


text:
Q: Populate dropdownlistbox items from SQL table in PowerBuilder Classic 12.5 I have been working on Vb.net but i switched to PowerBuilder 12.5 Classic, I am finding my way around. I need to know the equivalent PowerBuilder script;

*

*to clear a control "textbox1.clear()"

*to focus "textbox1.focus()"

*to insert SQL database items to drop-down listbox

    While dr.Read
       ComboBox1.Items.Add(dr("itemname"))
    end while

A: To answer while completely ignoring your questions...
Keep in mind that the power of PowerBuilder is in the DataWindow. Loading a dropdown from the database is as simple as setting some attributes on a DataWindow column by making the column a DropDownDataWindow edit style. Depending on what you need, after the DDDW attributes are set, the DDDW values will be loaded when the primary DataWindow is retrieved, no code required (beyond that to set up the database connection with the primary DataWindow and to retrieve the primary DataWindow). In fact, the DDDW gives additional power over a combo box, as its dropdown is another DataWindow, so it can have multiple columns, headers, graphics, row-based expressions, conditional colouring, item "rows" that are multiple text lines tall, etc.... You leave yourself open to more opportunities by going with the DataWindow. (I know. I walked out of my Intro to PB course, thought DWs were overblown, and tried to program without them. Learned an appreciation for all they do very quickly. Gave up my non-DW approach on the next project.)
Good luck,
Terry

A: *

*textbox1.Reset()

*textbox1.SetFocus()

*example (untested, but it shows the idea):

    string ls_sql, ls_syntax, ls_errors

    ls_sql = "select name from users"
    ls_syntax = sqlca.SyntaxFromSql(ls_sql, "", ls_errors)
    if len(ls_errors) > 0 then return

    datastore ds
    ds = create datastore
    ds.create(ls_syntax, ls_errors)
    if len(ls_errors) = 0 then
        ds.SetTransObject(sqlca)
        ds.Retrieve()

        long ll_row,ll_rows
        string ls_val
        ll_rows = ds.RowCount()
        for ll_row = 1 to ll_rows
            ls_val = ds.GetItemString(ll_row, "name")
            Combobox1.AddItem(ls_val)
        next

    end if

    destroy ds

Edit some comments: as Terry says in its answer, the Datawindow and the DataStore are the key controls of Powerbuilder. Consider the DataStore as a VB recordset and the DW is a kind of visual recordset (that can show the data in the way of a form, a grid, ...).
I answered you question by using a DS to retrieve the data and to easily iterate on it (it is easier to manipulate than a cursor) and I translated the filling of the combobox. But as Terry said, you should study how to use a DropDownDataWindow that is way more powerful and evolutive.


text:
Q: How to write a chrome extension that displays the countdown from a webpage in a pop-up? I've never posted on here before so I apologize if I'm doing something wrong.
I wanted to know if anyone had any tips on how I should go about creating this chrome extension.
There's an online game I play that has a page where users can collect items when it's "open". When it's closed, there's text on the page that tells you how many minutes are left until it opens again.
I'd like to write an extension that "looks" at the page and basically copies over that text to display so that you can see how many minutes are left without having to visit the page itself. What's the simplest way to do that? I'd like it to be quick enough to eventually work as a kind of alarm when the timer reaches 1 minute so that users know to go to the page & get there right when it opens.
When looking this question up I only really find information about web scrapers which doesn't seem like what I'm looking for. Any help is appreciated, thanks!

A: That's a pretty cool thing to do! I did it a while back for the MU Away game (don't know if it still exists).
I did it using Python actually, everytime I had an event on their website, it'd send me an email with what I wanted (i.e. Reset time was 0 so I could reset my character and start griding again)
You could use Python 3.8, selenium webdriver and SMTP Lib.
Let me know if you need more specific information.
web scrapers would be the easiest and fastest way of doing it.
1-2h in python or a week with chrome extension, but that might be me though, I'm kinda new to chrome extensions


text:
Q: Teradata CLOB and JDBC : The Locator is invalid because it has been changed ERROR I'm trying to copy CLOB from one database to another. However I get The Locator is invalid because it has been changed error.
This article says this can happen because ResultSet, PreparedStamenent are closed. However all my objects are open. And the error is thrown when I try to executeBatch()
 Statement select = connectionDB1.createStatement();
 ResultSet rs = select.executeQuery("SELECT TOP 1 myClob FROM myTab");
 rs.next();
 PreparedStatement ps = connectionDB2.prepareStatement("INSERT INTO myTab2 SELECT ? ");
 ps.setClob(1, rs.getClob(1));
 System.out.println("CLOB inserted");
 ps.addBatch();
 ps.executeBatch(); // ERROR is thrown here before I close any objects WHY?
                   // java.sql.BatchUpdateException

Why does this happen? How to prevent this?

PS: The above code runs well with any other data type: VARCHAR, DECIMAL

A: The article says that the CLOB is a locator that is valid in the same session.
But when you try to apply it to another connection,  you are using it in a different session,  so the error occurs.
What you need to do is to read the actual CLOB content from the source database and write it into the target database.


text:
Q: Multiple update using GORM in Golang I am trying to make APIs using GIN and GORM. Now i have stucked in one of the APIs. This API will create multiple entries in the DB.
I have the json body like this. The size of array will vary.
{
 "key" : [1,2]
}

With this, I have some other parameter that i am getting from the url-
key1 := c.Param("value1")
key2 := c.Param("value2")

Now i want to create multiple entries [1,2] on DB with data of key1 and key2 like-

Key1
Key2
key

value1
value2
1

value1
value2
2

I am stuck at the point where i dont know how to read this json and save the data in my schema (struct) to create multiple entries like-
var users = []User{{key1: "value1", "key2": "value2, "key" :1}, {key1: "value1", "key2": "value2, "key" :2}}
db.Create(&users)

Please guide me to a possible solution as i am new to Go.
Let me know for more clarifications. Thanks

A: Structs needed

*

*Request json

type BodyJson struct {
    Key []int `json:key`
}

*User table struct for gorm

type User struct {
    Key  int    `gorm:"column:key"`
    Key1 string `gorm:"column:key1"`
    Key2 string `gorm:"column:key2"`
}

Unmarshal body json to BodyJson struct var
var bodyJson BodyJson
err := json.Unmarshal([]byte(body_json_string), &bodyJson)

loop over bodyJson.Key array and populate an [] of User with this key, key1 and key2.
Then save the users with
db.Create(&users)

Hope this helps.


text:
Q: django - what's the proper way of passing the "request" parameter to a custom template tag I created a custom template tag that I want to use on every page on my web site.  I have a function get_ip inside the custom template tag that needs the request parameter in order to get the IP address from the user. See below:
myapp/templatetags/header_tags.py

from django import template
register = template.Library()
...
from django.http import HttpResponse
from django.template import RequestContext
from django.shortcuts import render_to_response
from django.http import HttpResponseRedirect

@register.inclusion_tag('template.html', takes_context = True)
def user_ip(context):
    request = context['request']
    ip = get_ip(request)
    return render_to_response('template.html',locals(), context_instance=RequestContext(request))

template.html

   {{ ip }}

my_main_template.html

{% load header_tags %}
{% user_ip %}

For some reason my the ip is not sowing on my main template. My function get_ip works if used the regular way on views.py page a template but for some reason is not showing when is used from the custom template tag above. Any ideas?

A: You're not supposed to actually render the template in an inclusion tag - the decorator does that for you. You just return the context that should be used to render the template you've specified.

A: Try somenting like this.
@register.inclusion_tag('template.html', takes_context = True)
def user_ip(context):
    return {'ip': get_ip(context['request'])}

A: Your inclusion tag should return a context to be rendered to a template, not render_to_response. Might look like this:
def user_ip(context):
    my_context = {}
    request = context['request']
    my_context['ip'] = get_ip(request)
    return my_context

register.inclusion_tag('template.html', takes_context = True)(user_ip)


text:
Q: Book series with 4/5 elements I have been trying to find this book series that I read around the mid-2000s.
It contains people being sent to a college or some such to learn how to use magic.
There are possibly 5 elements, one of which is fire and another is something like emotions.
There was a trial that the people have to go through, with a scene where they had to cross a bridge while being barraged by strong thoughts of fear or something like that.
Possible conflation, but I seem to recall one of the characters talking about how to cope with the hot weather, to take a warm bath instead of a cold one so that the body will heat up and make the surrounding air seem relatively cooler.
Another detail was that one of the characters worked really hard at their magic and improved, but the other people in the school all thought he figured out some trick, and were trying to get him to explain it to them, which made him really annoyed.
The last line of the first book was something about how, instead of writing the story years after it had happened, they are writing it as it occurs.


text:
Q: HTTP 503 Service is unavailable when trying to browse signalr/hubs I have a windows hosted SignalR hub created in VS2012:
public class Startup
{
    public void Configuration(IAppBuilder app)
    {
        app.UseCors(CorsOptions.AllowAll);
        app.MapSignalR();
    }
}

public static class SignalR
{
    public static void Start()
    {
        const string url = "http://*:8080";
        WebApp.Start<Startup>(url);
    }
}

 public class Broadcaster : Hub
    {

        public void SendDownloadResult(bool result, string device, string description, string connectionId, string task)
        {
            var context = GlobalHost.ConnectionManager.GetHubContext<Broadcaster>();
            context.Clients.Client(connectionId).sendDownloadResult(result, device, description, task);
        }
    }

I have deployed this windows service on 3 different PCs, it works fine on two PCs, but on the other, I get HTTP 503 Service is unavailable when I try to browse http://localhost:8080/signalr/hubs
No exception thrown when the code is executed on all 3 PCs.
I have checked IIS's features in add/remove windows features, they're all the same.
What am I missing?

A: I was able to reproduce this locally with the following setup:

*

*Use NetSh.exe or similar tool to reserve http://localhost:8080/

*Call WebApp.Start<Startup>("http://*:8080")

*Browse to http://localhost:8080/
What happens is that Http.Sys accepts the incoming request, examines the host header, decides that there is a reservation for localhost:8080, but realizes that no application is listening to localhost:8080, only *:8080. Http.Sys then returns the 503.
Solutions:

*

*Try WebApp.Start<Startup>("http://+:8080")

*Remove the Http.Sys/NetSh registration

A: I also had same issue. I rectified it by changing
 const string url = "http://*:8080";

TO
 const string url = "http://+:8080"; // * replaced by +

A: I also realised, that in one of the PCs, port 8080 was in use.
Changing the port from
const string url = "http://*:8080";

to
const string url = "http://*:8088";

solved the issue


text:
Q: Regularity of solution to first order time dependent variational problem Consider the following first order evolution problem over some regular bounded domain $\Omega\subset\Bbb R^d$
$$\frac{\partial\phi}{\partial t}(\mathbf{x},t) +\vec V(\mathbf{x},t)\cdot \nabla\phi(\mathbf{x},t)=f(\mathbf{x},t),\;\;\;\;(\mathbf{x},t)\in \Omega\times [0,T),\;\;\;T\in\mathbb{R},\tag{1}\label{1}$$
where we are given $$\phi(\mathbf{x},0)=\phi_0\in H^1(\Omega),\;\; f\in L^2(0,T;H^1(\Omega)),\;\; \text{ and }\;\;\vec{V}\in L^2(0,T;H^1(\Omega))^2.$$
If we fix $s\in [0,T)$, the variational form of the above equation at time $s$ reads as
$$ \int\limits_\Omega \frac{\partial \phi(s)}{\partial t}v+\int\limits_\Omega (\vec V(s)\cdot \nabla\phi(s))v = \int\limits_\Omega f(s)v,\;\;\;\forall v\in H^1(\Omega).$$
For any $t<T$, we can integrate the above equation from 0 to $t$ to get
$$\int\limits_\Omega(\phi(t)-\phi_0)v=-\int\limits_0^t\int\limits_\Omega (\vec V(s)\cdot \nabla\phi(s))v +\int\limits_0^t\int\limits_\Omega f(s)v,\;\;\;\forall v\in H^1(\Omega).\tag{2}\label{2}$$
Suppose that we are given $\phi\in L^2(0,T;H^1(\Omega))$ which satisfies \eqref{2} for almost all $t\in[0,T)$. The question is: under the above assumptions, can we hope to show that $\phi\in H^1(0,T;L^2(\Omega))$ also, and try to recover a classical solution of \eqref{1}? If not, what conditions on $f$, $\vec{V}$ and $\phi_0$ are needed to recover a classical solution?


text:
Q: Tomcat7 not load welcome page in my Java Web app I have simple JavaWeb app.
For debuging i am using jetty on my laptop (in netbeans). If i run the app - Normally it works - welcome page run perfect. I can go to localhost:8080 for my "index" page.
When i run the app on my tomcat vehicle. Tomtcat not open "welcome index page".
Why? Where can be a problem?
In my web.xml is:
.
.
<display-name>MYAPP</display-name>
<description>basic application.</description>
<welcome-file-list>
    <welcome-file>WEB-INF/pages/home/index.html</welcome-file>
</welcome-file-list>
.
.

Other pages on tomcat work normaly. For example www.mypage.com/about run perfect. I think, its problem in web.xml.
Thank you for your advice!
Error in tomcat:
HTTP Status 404 -

type Status report

message

description The requested resource () is not available.

Apache Tomcat/7.0.26

A: Try by inserting this /WEB-INF/pages/home/index.html
in place of WEB-INF/pages/home/index.html


text:
Q: MySQL query running slow what is the bottleneck I have a MySQL query which ran for 22 seconds, I have added the index for all the select and where condition. the usage table has about 79000 records. The labels table has 602173 records. I tried to optimized it by adding index. Is that the join statements that make it slow. Or any index I should implemented to increase the speed of the stored procedure. But it still running slow. May I know where is the bottleneck and how I can improve it?
CREATE  PROCEDURE `SelectUsage2`(
      IN p_ids MEDIUMTEXT
    , IN p_locationIDs MEDIUMTEXT
    , IN p_indicatorIDs MEDIUMTEXT
    )
BEGIN
    select
        , case when (select count(lbl.id) from `labels` as lbl where lbl.ObjectID = i.id and lbl.ObjectName = 'indicators' and lbl.ColumnName = 'IndicatorName' and lbl.LanguageCode = p_language) > 0 then
            (select content from `labels` as lbl where lbl.ObjectID = i.id and lbl.ObjectName = 'indicators' and lbl.ColumnName = 'IndicatorName' and lbl.LanguageCode = p_language limit 1)
        else
            i.IndicatorName
        end as IndicatorName
        u.*
    from
        `usage` as u
        left join `locations` as l on u.LocationID = l.id
        left join `Indicators` as i on u.IndicatorID = i.id
        left join `Indicators` as i2 on i.ParentID = i2.id
    where
        and (p_ids is null or FIND_IN_SET(u.id, p_ids))
        and (p_locationIDs is null or FIND_IN_SET(u.LocationID, p_locationIDs))
        and (p_indicatorIDs is null or FIND_IN_SET(u.IndicatorID, p_indicatorIDs))
    order by
        i.IndicatorName, l.LocationName
;
END


text:
Q: What should be image size in PWA ( Android Chrome ) compared to desktop chrome browser We are developing a PWA, which shows quite a few images. I've checked another website as PWA well. On chrome I could check the images size, but how to check it on Android Chrome browser?
Will the image size be same or different?

A: Chrome will expect two image sizes in your manifest.json:
icons": [
    {
      "src": "/images/icons-192.png",
      "type": "image/png",
      "sizes": "192x192"
    },
    {
      "src": "/images/icons-512.png",
      "type": "image/png",
      "sizes": "512x512"
    }

It will then take into account to scale them according to the target device. However it is good practice in order to provide the best experience, to include also pixel perfect resolutions, according to the target/expected clients devices.
From the docs:

Success: include a 192x192 pixel icon and a 512x512 pixel icon. Chrome will automatically scale the icon for the device. If you'd prefer to scale your own icons and adjust them for pixel-perfection, provide icons in increments of 48dp.


text:
Q: How to Block Spam Referrers like darodar.com from Accessing Website? I have several websites that get daily around 5% of visits from spam referrers. There is one strange things I noticed about this referrers: they show in Google Analytics, but I cannot see them in my custom designed table where I insert all the visitors to the site, so I think that they only manipulate the GA code, never reaching the site itself.
If you follow their link, they redirect you to some affiliates link.
I don't know whether they have impact on my SEO/SERP, but I would like to get rid of them. May I do that via htaccess file?
One peculiar aspect is that I get visitors from different forum like pages. E.g.: forum.topic221122.darodar.com, forum.topic125512.darodar.com etc., so I would like to block the full darodar.com domain.
Besides darodar.com, there are also econom.co and iloveitaly.co that are bothering my stats. Can I block them all from htaccess?

A: Yes you can block with .htaccess and actually you should do it.
Your .htaccess file could look like this:
<IfModule mod_setenvif.c>
# Set spammers referral as spambot
SetEnvIfNoCase Referer darodar.com spambot=yes
SetEnvIfNoCase Referer 7makemoneyonline.com spambot=yes
## add as many as you find

Order allow,deny
Allow from all
Deny from env=spambot
</IfModule>

When traffic comes from these sites, they are blocked with this .htaccess, so the HTML is never loaded and therefore GA script is not fired up (from these sites).
They try to collect traffic from you, once you see the incoming traffic in Google Analytics then trying to find out what is the source you go to that URL. It is harmless to your site, except your statistics are full of junk data.
Google Analytics should prevent this, the same way GMail prevents spam email.

A: Most of the Spam in Google Analytics never access your site so you can't block them using any server-side solution.
Ghost Spam hits directly GA and usually shows up only for a few days and then disappear, that's why some people think they blocked them from the .htaccess file but is just coincidence.
This type of Spam is easy to spot since they use either a fake hostname or is not set. (See image below)
The other type, Crawlers like semalt, actually access your site and can be blocked from the .htaccess file, however, there are just a few of them.
So in summary, to stop spam in Google Analytics:

*

*Crawlers: server-side solutions or filters in GA

*Ghosts: ONLY filters in GA

The only efficient solution to prevent being hit by ghost spam is by making an include filter with all your valid hostnames.
First you need to make a REGEX with all the valid hostnames, something like this (you can find them on the network report)
yoursite\.com|shoppingcart\.com|translateservice\.net

These are some examples; you might have more or fewer hostnames. Once you have the REGEX, follow the same steps as above and change this:

*

*Go to the admin tab in Google Analytics

*Select FILTER under the View Column > New Filter

*Filter type Custom > Include > Filter Field Hostname

*File Pattern Copy the hostname expression you built

For Crawlers you will have to create a different filter building an expression with all spammers
spammer1|spammer2|spammer3|spammer4|spammer5

*

*Filter type Custom > Exclude > Filter Field Campaign source

*File Pattern Copy the referral expression

Everytime you work with filters it is important that you keep an unfiltered view.
If you need detailed steps for this solutions you can check this complete guide about Spam in Google Analytics.
Guide to stop and remove All the spam in Google Analytics
Hope it helps.
Hostname report Example

A: According to this entry, they are never visiting your site, they are faking HTTP request to GA using your UA-code. So, it seems it's pointless to block them using .htaccess or any other method, because they never actually enter to your site, they are only sending fake "visit" data to Google.

A: We have found that using htaccess is a good way to stop these spams. I have implemented below solution on my clients site which is working really well so far.
Best way is to stop them by contains clause, e.g. spam priceg.com check for priceg in referrer url.
Because many of these sites are creating sub domains and re hitting and when they tweak the url, hard coded conditions fail

RewriteCond %{HTTP_REFERER} (priceg) [NC,OR]
   RewriteCond %{HTTP_REFERER} (darodar) [NC,OR]

It is explained in detail here

A: This blog post suggests that the spam referrers manipulate Google Analytics and never actually visit your site, so blocking them is pointless. Google Analytics offers filtering if you want to mitigate fake site hits.

A: apparently, this is done by a spammer by communicating directly with google analytics using your website's account ID.  So they effectively tell google analytics they visited your page while in fact they never did.  They identify themselves to analytics by means of an URL which THEY WANT YOU TO VISIT.  So you see their traffic in google analytics and go check them out.  They will have an amazon affiliate account hooked up and so they attempt to get a commission from your amazon purchases, for example.
so .htaccess did nothing for me when I was fighting this one; you need to create a filter which filters out things like (.*)/.darodar/.com
the real bad effect I have found from this is it invalidates my website statistics

A: You can restrict access use .htaccess or by filtering ALL robot visits from being tracked by Google Analytics. If that doesn't work, setup Google Analytics filtering. More details on how to do that can be found here: http://www.wiyre.com/google-analytics-darodar-forum-spam-what-is-it/
They are Russian based but routing their spiders through China and the Philippines. Maybe it would be best to block the whole IP address at this point, they have multiple sub-domains.

A: I used these mod_rewrite methods for semalt:
RewriteCond %{HTTP_REFERER} ^http(s)?://(www\.)?semalt\.com.*$ [NC]
RewriteCond %{HTTP_REFERER} ^http(s)?://(.*\.)?semalt\.*$ [NC,OR]
RewriteCond %{HTTP_REFERER} ^https?://([^.]+\.)*semalt\.com\ [NC,OR]

or with the .htaccess module mod_setenvif
SetEnvIfNoCase Referer semalt.com spambot=yes
SetEnvIfNoCase REMOTE_ADDR "217\.23\.11\.15" spambot=yes
SetEnvIfNoCase REMOTE_ADDR "217\.23\.7\.144" spambot=yes

Order allow,deny
Allow from all
Deny from env=spambot

I even created an Apache, Nginx & Varnish blacklist plus Google Analytics segment to prevent referrer spam traffic, you can find it here:
https://github.com/Stevie-Ray/referrer-spam-blocker/

A: Filter future and historical ga spam of all types with the link provided. Hostname filtering is particularly easy.
https://www.ohow.co/ultimate-guide-to-removing-irrelevant-traffic-in-google-analytics/

A: Blocking any bots at your web server level makes no sense - spammers are sending fake requests to Google Analytics web server. All they have to know is website domain name and Google Analytics ID linked to it.
So you have to mask your Google Analytics ID at website code. For example, you can do like this at Google Analytics JS code:
ga('create', 'UA-X' + 'XXXXX' + 'XX-X', 'auto');

Spammer's bot should be able to execute JS code to parse your Google Analytics ID after this change (and not so many bots will be able to do it).
https://nobodyonsecurity.com/security/fighting-google-analytics-referrer-spam

A: .htaccess is not the best way. In my site I use GA, The option tracking information and then Reference exclusion list.
Regards!

A: Lunametrics posted a nice article to solve this issue using Google Tag Manager:
http://www.lunametrics.com/blog/2014/03/11/goodbye-to-exclude-filters-google-analytics/

A: I think that the most effective way to avoid ghost spam is to add a custom dimension that let you know the site was indeed visited, because as we know they never visit the site.

ga('set', 'dimension1', "Hey I'm really here!!");
ga('send', 'pageview');

You should simply add this lines in your pages and then add a filter to "include" only when the dimension has the expected value ("Hey I'm really here!!") in this case

A: 2019 update
I may have a solution to this problem as I find none of the other solutions to be effective.
Let me address the problems of the existing solutions first

*

*Add a filter for each referrer spam domain.

*How many domains will you add?

*Most of these referrer spam domains exist for sometime and
then disappear

*Maintain a blacklist of referrer spam domains.

*This gets even more complicated as they are basically endless in numbers.

*You would have to keep updating the blacklist.

*Also bigger the blacklist, the more time you need to scan it

*Anything else such as maintaining a manual htaccess or something will require manual intervention which will not scale as your site becomes more popular

*Anything automatic such as using AI to determine patterns in how referrer spam domains appear will have a hit/miss thing

How do these bots work?
First, it is crucial to understand how these bots work

*

*They use regex patterns at the least such as /UA-\d{6}/ to load tracking ids which they visit recursively after starting at a seed website

I believe I have a solution that offers the following advantages

*

*No need to maintain whitelists and blacklist

*Will work against 99% of them easily and can always be modified to take it to 100%

*Requires almost NO manual intervention

*The idea is to NOT have a tracking ID at all in the script
Here is an example
script.
      //- Google Analytics ID
      var a = [85, 65, 45, 49, 49, 49, 49, 49, 49, 49, 49, 49, 45, 50];

      var newScript = document.createElement("script");
      newScript.type = "text/javascript";
      newScript.setAttribute("async", "true");
      newScript.setAttribute("src", "https://www.googletagmanager.com/gtag/js?id=" + a.map(i => String.fromCharCode(i)).join(""));
      document.documentElement.firstChild.appendChild(newScript);

      window.dataLayer = window.dataLayer || [];
      function gtag(){dataLayer.push(arguments);}
      gtag('js', new Date());
      gtag('config', a.map(i => String.fromCharCode(i)).join(""), { 'send_page_view': false });
      // Feature detects Navigation Timing API support.
      if (window.performance) {
        // Gets the number of milliseconds since page load
        // (and rounds the result since the value must be an integer).
        var timeSincePageLoad = Math.round(performance.now());
        console.log(timeSincePageLoad)
        // Sends the timing event to Google Analytics.
        gtag('event', 'timing_complete', {
          'name': 'load',
          'value': timeSincePageLoad,
          'event_category': '#{title}'
        });
      }

*We take a very simple approach, break the tracking ID of the form 'UA-1111111-1'  into a char code array

*Now we construct the tracking ID dynamically from the char code array at any point we need a reference to the tracking ID

*The approach can be made infinitely more complex by turning it into encrypted bunch of numbers, base 8 , hexadecimal, adding a fixed offset, a random offset during each run, RSA encrypting the tracking ID with a private key on the server and decrypting it with a public key but the basic approach is REALLY fast, as arrays in JS are really fast, can easily beat 99% of the bots


text:
Q: Unable to mount a partition of external 3TB hard drive..GPT warning My external HDD has five partitions and I am able to mount 4 partitions except one (labeled office) which is of 1TB and has all my backups. I am providing more information below
fdisk -l
Disk /dev/sda: 750.2 GB, 750156374016 bytes
255 heads, 63 sectors/track, 91201 cylinders, total 1465149168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0xda73e482

   Device Boot      Start         End      Blocks   Id  System
/dev/sda2   *        2048      409599      203776   42  SFS
/dev/sda3          409600  1227823103   613706752   42  SFS
/dev/sda4      1227825150  1465147391   118661121    5  Extended
Partition 4 does not start on physical sector boundary.
/dev/sda5      1227825152  1432625933   102400391   83  Linux
/dev/sda6      1432627200  1465147391    16260096   82  Linux swap / Solaris

WARNING: GPT (GUID Partition Table) detected on '/dev/sdb'!
  The util fdisk doesn't support GPT. Use GNU Parted.

Disk /dev/sdb: 3000.6 GB, 3000558944256 bytes
255 heads, 63 sectors/track, 364797 cylinders, total 5860466688 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x00000000

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1  4294967295  2147483647+  ee  GPT
Partition 1 does not start on physical sector boundary.

GParted for the 3 TB external drive outputs the following:
/dev/sdb2: LABEL="New Volume" UUID="BA5EC1045EC0BA81" TYPE="ntfs"
/dev/sdb3: LABEL="Rashmi" UUID="5822A0F722A0DB70" TYPE="ntfs"
/dev/sdb4: LABEL="Legal" UUID="D6E048D5E048BD8D" TYPE="ntfs"
/dev/sdb5: LABEL="Entertainment" UUID="C65E11415E112C25" TYPE="ntfs"
/dev/sdb6: LABEL="Photos" UUID="CA1ADB271ADB0F77" TYPE="ntfs"
/dev/sdb7: LABEL="Office" UUID="32588F11588ED2D1" TYPE="ntfs"

I cannot mount /dev/sdb7, that is, the partition labeled "Office".

A: Many USB enclosures and USB/ATA adapters can't handle disks with more than 2^32 sectors. This works out to 2TiB, so disks larger than that often fail on such enclosures and adapters. If this is your problem, the only solution is to use the disk internally or via another adapter/enclosure -- perhaps an eSATA one rather than a USB one. (I've even heard of one enclosure that has both USB and eSATA connectors but that works differently depending on how it's connected -- a design that's sure to cause hair-pulling!)
If you need more help, post the exact error message you get when you try to access the failing partition, ideally from the command line. Also, post details about your enclosure or adapter -- its type (USB, FireWire, USB, eSATA, etc.), brand, model, etc.


text:
Q: How can I Fix incompatibility between device and application on Google Play? I've andorid appplication that has minSdkVersion 15 and targetSdkVersion 28 but when publish on Google Play it gives message "Your Device isn't compatible with this version" on Android 4.4.2 which shall have API 19 – 20 according to Android version history. Now what I do need to know is how to analyze the reason and how to approach to fix this situation.
My application works fine on debug and release editions on that Android 4.4.2 device
Edit:
I've found the FEATURE_CONNECTION_SERVICE is available only on API 21, How do I find the exact feature that is not work, is it a package I use inside my app or a permission tag, my manifest has theses permissions
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.READ_PHONE_STATE" />
    <uses-permission android:name="android.permission.READ_SMS" />
    <uses-permission android:name="android.permission.READ_PHONE_NUMBERS" />
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <uses-permission android:name="android.permission.READ_PROFILE" />

A: READ_PHONE_NUMBERS is only available in API 26.
You can find all the API levels here: https://developer.android.com/reference/android/Manifest.permission


text:
Q: Finding parameters with NMinimize doesn't do any steps To find the best fit for an SVM, I have to constantly re-train my classifier with different parameters based on the result of the test set.
I created a helper function which trains the SVM with the given parameters p1 and p2 then classifies the test set and gives back the HammingDistance from the original one (as an accuracy measure):
SVMError[X_, y_, testY_, p1_?NumericQ, p2_?NumericQ] := Block[
  {prediction, trainedSVM},
    trainedSVM = ...;
    prediction = ...;
    Return[HammingDistance[prediction, testY]];
];

The returned Hamming distance is between [0..70] with lower being better.
When I run NMinimize with constrains (p1, p2) ∈ [0.01..30] and write out both the evaluations and the steps, "Step taken" is written out only once, although the function evaluates many times.
NMinimize[
  {SVMError[X, y, testY, p1, p2], 0.01 <= p1 <= 30, 0.01 <= p2 <= 30},
  {p1, p2},
  StepMonitor -> Print["Step taken"], EvaluationMonitor -> Print["Evaluated"]
]

My problem is that NMinimize doesn't want to converge. It outputs Hamming distance sequence like this one: 30, 31, 29, 31, 25, 20, 12, 32, 29, 31, etc. when I stop it after 100 iterations.
I've tried the followings so far:

*

*Different methods: DifferentialEvolution, MeshSearch, RandomSearch, SimulatedAnnelaing, and NelderMead.

*Setting MaxIterations, but it has no use (at least with DifferentialEvolution). When I set it to 5, I have to stop the algorithm manually after 30.

*FindMinimum and Minimize without ?NumericQ. They stalled for an hour doing nothing.

*Setting AccuracyGoal between [1..30].

*Returning a fraction of the Hamming distance.

*Debugging with Optimization`NMinimizeDump`$DiagnosticLevel = 6;. This showed that after each evaluation a numericCheck[{HD}{{p1, p2}}] gets called with the returned Hamming distance and the two given parameters (but I don't know its function body).

My questions are:

*

*How can I make NMinimize to "step" into a direction?

*Is it a better (faster) approach to find the best fitting parameters?

A: After doing a few test runs where I varied either p1 or p2 while keeping the other fixed, the Hamming distance did not seem to fluctuate wildly, so a grid-based approach may be viable here. Note however that the evaluation time for SVMError is so large in your example ZIP file that any kind of search will require patience :P
The idea is to first evaluate the function over an evenly spaced grid with numGridPoints in both the p1 and p2 directions, from about 0.01 to 30, that is, centered in the "middle", close to {p1,p2}={15,15}. From this grid we pick out either all the n points {p1,p2} that shared the lowest Hamming distance, or the keep points that were among the lowest, if keep>n. Now for each of these points, we make new grids centered at each of them, with smaller widths, to "zoom" in on good candidate points. We can either keep doing this until we are stuck at some minimum value one or more iterations, or until we have made new grids a set number of times. This is the basic setup, with which we can then try lots of things, like changing the amount of "zooming" for each step in the iteration, changing the number of gridpoints etc.
Here is the code:
gridMinimize[centersList_, numGridPoints_, width1_, width2_, keep_,
  bestval_] :=
 Block[{tab, vals, candidates, min},
  tab = Join @@ (gridding[#, numGridPoints, width1, width2] & /@
      centersList);
  vals = tab[[All, 2]];
  min = Min[vals];
  candidates = MinimalBy[tab, Last, Max[Count[vals, min], keep]];

  If[min < bestval,
   gridMinimize[candidates[[All, 1]], numGridPoints, 0.3*width1,
    0.3*width2, keep, min],
   candidates
   ]
  ]

gridding[{p1center_, p2center_}, numGridPoints_, width1_, width2_] :=

  Block[{w1, w2, r1, r2, window},
  w1 = Min[width1, p1center - 0.01, 30 - p1center];
  w2 = Min[width2, p2center - 0.01, 30 - p2center];
  r1 = If[w1 == 0., {0.}, Range[-w1, w1, 2 w1/(numGridPoints - 1)]];
  r2 = If[w2 == 0., {0.}, Range[-w2, w2, 2 w2/(numGridPoints - 1)]];

  Flatten[
   Table[{{p1, p2},
     SVMError[dataSet3X, dataSet3y, dataSet3CrossValX,
      dataSet3CrossValy, p1, p2]}, {p1, p1center + r1}, {p2,
     p2center + r1}
    ], 1]
  ]

The stuff happening in the start of gridding just ensures that our grids don't take us outside the allowed ranges for p1,p2.
As an example run, I ran
gridMinimize[{{15, 15}}, 3, 14.5, 14.5, 2, 70]

and got
{{{1.5785, 14.51}, 13}, {{1.97, 14.51}, 13}, {{2.3615, 14.1185},
13}, {{2.3615, 14.51}, 13}, {{1.5785, 14.51}, 13}, {{1.97, 14.51},
13}, {{2.3615, 14.1185}, 13}, {{2.3615, 14.51}, 13}}

That is, 8 points close to one another, all with Hamming distance 13. The next step could be to input this set of points (or a subset of them) as the first argument again, and much smaller widths etc. and see if we can go even lower. Or one might start in another region and use widths that exclude the already discovered region, but now with more gridpoints.


text:
Q: How to calculate a value times another value? I'm trying to convert the value of an invoice so that value times another amount for an AMEX calculation as below. Something is missing as the answer being calculated is 0.
Sub AMEX()
Dim Number_1 As Integer
Dim Number_2 As Integer
Dim Answer As Integer
Dim strBillAmt As Integer

Dim intNumLines As Integer

'Get the Bill amount from the doc
strBillAmt = GetValue("[BillAmt]")

Do
    Selection.HomeKey Unit:=wdStory
    Selection.Find.ClearFormatting
    With Selection.Find
        .Text = "[AMEX]"
        .Replacement.Text = ""
        .Wrap = wdFindContinue
    End With
    If Selection.Find.Execute = True Then
        Selection.Delete Unit:=wdCharacter, Count:=1
            Number_1 = 1.0175
            Number_2 = strBillAmt
            Answer = Number_1 * Number_2

        Selection.InsertFormula Formula:="Answer"

     Else
        Exit Do
    End If
Loop

End Sub

A: I was able to get this working as below:
Sub AMEX()
Dim Number_1 As Integer, Number_2 As Integer
Dim Answer As Integer, strBillAmt As Integer
Dim strAMEXAmt As String

'Get the bill amount from the document
strBillAmt = GetValue("[BillAmt]")

    If Selection.Find.Execute("[AMEX]", Forward:=True, Wrap:=wdFindStop) Then
        AMEXAmt = strBillAmt * 1.0175
        Selection.TypeText Format(AMEXAmt, "$#,##0.00")
    End If

End Sub