text:
Q: Wordpress Issues renaming IMG folder i have a problem with a Wordpress update. I have a /blog/ folder in my /public.html folder where is laying also my wordpress install.
I have posts with a category "blog" and when i update my wordpress my site breaks.
There is a confrontation between the two i guess.
I've fixed the problem with my .htaccess file but on a WP Update the .htaccess gets overwriten and the problem comes up again.
I need to find a way to rename my /blog/ folder without loosing my links or having to re-upload everything again. As the /blog/ folder contains mainly img uploads used for posts in my blog.
TLDR: I have a folder named Blog in my WP directory and a category Blog both dont get along well. I need to rename Blog (folder) without having to re-upload all my images. 5 years worth of img uploading.


text:
Q: Why the client cann't receive message from server with NetMQ framework? Recently, I use the NetMQ to send or receive message between server and client.
Server codes like:
    void Main()
    {
      CreatePullAndPushSocket();
      Task.Factory.StartNew(()=> {
            while (true)
            {
                Thread.Sleep(1);
                if (Pull != null)
                {
                    var message = Pull.ReceiveFrameString();
                }
            }
        });
    }
    PullSocket Pull;
    PushSocket Push;
    private void CreatePullAndPushSocket()
    {
        Pull = new PullSocket("tcp://ip1:port1");
        Push = new PushSocket("tcp://ip2:port2");
    }
    public void SendMessageToClient(string message)
    {
        if (Push != null)
        {
            Push.SendFrame(message);
        }
    }

The client codes like:
   void Main()
    {
      new Thread(()=> {
            while (true)
            {
                Thread.Sleep(1);
                if (Pull != null)
                {
                    var message = Pull.ReceiveFrameString();
                }
            }
        }).Start();
    }
    PullSocket Pull;
    PushSocket Push;
    private void CreatePullAndPushSocket()
    {
        Pull = new PullSocket("tcp://ip2:port2");
        Push = new PushSocket("tcp://ip1:port1");
    }
    public void SendMessageToClient(string message)
    {
        if (Push != null)
        {
            Push.SendFrame(message);
        }
    }

When I run two application, which is server app, another is client app.

*

*1:Client send a message to Server

*2:Server can receive the message from the client

*3:Server send another message to client

*4:The client cann't receive the message!!!

So strange, I have followed the guidance https://netmq.readthedocs.io/en/latest/push-pull/!

A: In NetMQ very important thing is threading model. Really important is that, You shouldn't use socket in multiple threads. So if Thread#1 created socket than it should use it. If You want to send message from other thread (lets say Thread#2) by using the same socket just forget about this. You should somehow send messgae from Thread#2 to Thread#1 and then it should send it trough socket to client.
So basicly CreatePullAndPushSocket is wrong and strange things can happend than. You are creating sockets in one thread and using in other. Its simply wrong.
The other thing is Your Thread.Sleep. You shouldn't use Thread.Sleep, because Your thread is sleeping 1s and then is checking socket once, than sleep and check once. NetMQ has function TryReceive, with timeout. So it can check socket for 1 second and exits to check if You call cancel/stop or whatever. Or even better there is a poller, which will listen on socket all the time, and allow us to call stop from other Thread.
Lets look at this code:
private Poller _poller;

public void Start()
{
  Task.Factory.StartNew(()=> {
     using(var pullSocket = new PullSocket("tcp://ip1:port1"))
     using(_poller = new Poller())
     {
        pullSocket.ReceiveReady += (object sender, NetMQSocketEventArgsnetMqSocketEventArgs) =>
        {
            var message = netMqSocketEventArgs.Socket.ReceiveMultipartMessage();
        }
        _poller.Add(pullSocket);
        _poller.Run();
     }
    });
}
public void Stop()
{
   _poller?.Stop();
}

or if You would like to use code without poller with while loop:
private readonly CancellationTokenSource _cts;
public void Start()
{
   _cts = new CancellationTokenSource();
   var token = _cts.Token;

  Task.Factory.StartNew(()=> {
     using(var pullSocket = new PullSocket("tcp://ip1:port1"))
     {
        while (cancellationToken.IsCancellationRequested == false)
        {
            NetMQMessage message = new NetMQMessage();
            bool success = workerSocket.TryReceiveMultipartMessage(TimeSpan.FromSeconds(5), ref message);

            if (success == false)
            {
                continue;
            }

            //if You reach this line, than You have a message
        }
     }
    },
    token,
    TaskCreationOptions.LongRunning,
    TaskScheduler.Default);
}
public void Stop()
{
    _cts.Cancel();
    _cts.Token.WaitHandle.WaitOne();//if You want wait until service will stop
}

So going back to Your question, You should use socket only from inside its thread where You created it. Good thing is to use socket always in using statement to always release it in the end.
I cant see SendMessageToClient method usage, but I assumed that You are calling it from some button or something. You can do that if a constructor of a socket was called from that thread. If you could show me where You are calling this method I could say something about this.

redpajama_set_name: RedPajamaStackExchange


text:
Q: How to get mysql result with rounded decimal place to 2 I have the following query..
SELECT p.product_id,p.description,sum(sl.qty*sl.factor) as qty
FROM sale_line as sl
LEFT JOIN sale as s ON(sl.sale_id=s.sale_id)
LEFT JOIN product as p ON(p.product_id=sl.product_id)
ORDER BY sl.product_id DESC;

I want to get "sum(sl.qty*sl.factor) as qty" field to round into two decimal places.
Eg. if the result get '13.170000484884', I want to round into '13.17' to the result.

A: Use ROUND() funtion:
ROUND(sum(sl.qty*sl.factor),2) as qty

Query:
SELECT p.product_id,p.description,ROUND(sum(sl.qty*sl.factor),2) as qty
FROM sale_line as sl
LEFT JOIN sale as s ON(sl.sale_id=s.sale_id)
LEFT JOIN product as p ON(p.product_id=sl.product_id)
ORDER BY sl.product_id DESC;


text:
Q: Is applying _Atomic type qualifier to an incomplete type valid? Is applying _Atomic type qualifier to an incomplete type valid?
Example:
_Atomic void* p;
_Atomic struct S* p1;
_Atomic struct S x;
struct S { int i; };

Invocations:
$ gcc t0.c -std=c11 -pedantic -Wall -Wextra -c
<nothing>

$ clang t0.c -std=c11 -pedantic -Wall -Wextra -c
<source>:1:1: error: _Atomic cannot be applied to incomplete type 'void'
<source>:2:1: error: _Atomic cannot be applied to incomplete type 'struct S'
<source>:3:1: error: _Atomic cannot be applied to incomplete type 'struct S'

In the C11 standard (as well as in the C2x draft n2596.pdf) I couldn't find any constraints / semantics, which forbid / restrict applying _Atomic to an incomplete type.

A: From https://github.com/llvm/llvm-project/issues/36585:

it does appear to be valid


text:
Q: SQL to LEFT JOIN with COUNT() I' working on SQL but having an issue with the error below:

Windowed functions can only appear in the SELECT or ORDER BY clauses

Error occurs because I have COUNT()  in my code. I know this is a nasty code but kinda works...
So it tries to join the tblAmpReport table by tblAmpReport.WEB_ID with WEB_ID. WEB_IB is calculated with this nasty code below. However, COUNT() seems to be causing an issue. Does anyone know a better way of overcoming this?
left join tblAmplianceReport
    on ISNULL(tblWebIDLegacy.WebProductStyleID,
                case
                when count(tblCrystalBeauty.STOCK_ON_HAND) over(partition by tblCrystalBeauty.ITEM_PARENT) > 1
                    then case
                        when count(tblCrystalBeauty.STOCK_ON_HAND) over(partition by tblCrystalBeauty.ITEM_PARENT+'_'+cast(tblCrystalBeauty.RETAIL_PRICE as varchar(10))) = count(tblCrystalBeauty.STOCK_ON_HAND) over(partition by tblCrystalBeauty.ITEM_PARENT)
                            then tblCrystalBeauty.ITEM_PARENT+'_'+tblCrystalBeauty.ITEM
                        else case
                                when count(tblCrystalBeauty.STOCK_ON_HAND) over(partition by tblCrystalBeauty.ITEM_PARENT) > 4
                                    then tblCrystalBeauty.ITEM_PARENT+'_'+tblCrystalBeauty.ITEM
                                else tblCrystalBeauty.ITEM_PARENT
                                end
                        end
                else tblCrystalBeauty.ITEM_PARENT
                end) = tblAmplianceReport.WEB_ID

FULL SQL:
select tblCrystalBeauty.GROUP_NO
      ,tblCrystalBeauty.GROUP_NAME
      ,tblCrystalBeauty.DEPT_NAME
      ,tblCrystalBeauty.CLASS_NAME
      ,tblCrystalBeauty.BRAND
      ,tblCrystalBeauty.MAIN_SEASON
      ,tblCrystalBeauty.SUB_SEASON
      ,tblCrystalBeauty.SUB_NAME
      ,tblCrystalBeauty.PRODUCT_TYPE
      ,tblCrystalBeauty.PL_CYCLE
      ,tblCrystalBeauty.ITEM as ITEM
      ,cast(tblCrystalBeauty.ITEM as int) as ITEM_VALUE
      ,tblCrystalBeauty.ITEM_DESC
      ,tblCrystalBeauty.ITEM_PARENT as ITEM_PARENT
      ,cast(tblCrystalBeauty.ITEM_PARENT as int) as ITEM_PARENT_VALUE
      ,tblCrystalBeauty.VPN
      ,tblCrystalBeauty.SUPP_COLOUR
      ,tblCrystalBeauty._COLOUR
      ,tblCrystalBeauty.SIZE_1
      ,tblCrystalBeauty.SIZE_2
      ,tblCrystalBeauty.RETAIL_PRICE
      ,tblCrystalBeauty.EAN as EAN
      ,cast(tblCrystalBeauty.EAN as bigint) as EAN_VALUE
      ,tblCrystalBeauty.WH_SOH
      ,tblCrystalBeauty.STOCK_ON_HAND
      ,tblCrystalBeauty.CREATE_DATETIME
      ,ISNULL(tblWebIDLegacy.WebProductStyleID,
                             case
                               when count(tblCrystalBeauty.STOCK_ON_HAND) over(partition by tblCrystalBeauty.ITEM_PARENT) > 1
                                 then case
                                        when count(tblCrystalBeauty.STOCK_ON_HAND) over(partition by tblCrystalBeauty.ITEM_PARENT+'_'+cast(tblCrystalBeauty.RETAIL_PRICE as varchar(10))) = count(tblCrystalBeauty.STOCK_ON_HAND) over(partition by tblCrystalBeauty.ITEM_PARENT)
                                          then tblCrystalBeauty.ITEM_PARENT+'_'+tblCrystalBeauty.ITEM
                                        else case
                                               when count(tblCrystalBeauty.STOCK_ON_HAND) over(partition by tblCrystalBeauty.ITEM_PARENT) > 4
                                                 then tblCrystalBeauty.ITEM_PARENT+'_'+tblCrystalBeauty.ITEM
                                               else tblCrystalBeauty.ITEM_PARENT
                                             end
                                      end
                               else tblCrystalBeauty.ITEM_PARENT
                             end) as "WEB_ID"
      ,case
         when row_number() over(partition by ISNULL(ISNULL(tblODIPublished.WEB_PROD_STYLE_ID,tblWebIDLegacy.WebProductStyleID),tblCrystalBeauty.ITEM_PARENT) order by
              (
                                                                                select 1
              )) > 1
           then 0
         else 1
       end as OPTION_COUNT
      ,case
         when sum(tblCrystalBeauty.STOCK_ON_HAND) over(partition by tblCrystalBeauty.ITEM_PARENT) > 0
           then 'YES'
         else 'NO'
       end as IN_STOCK
      ,sum(tblCrystalBeauty.STOCK_ON_HAND) over(partition by tblCrystalBeauty.ITEM_PARENT) as STYLE_SOH
      ,case
         when case
                when tblCrystalBeauty.PL_CYCLE = 'Discontinued'
                     or tblCrystalBeauty.PL_CYCLE = 'Discontinued'
                  then 'NO'
                else 'YES'
              end = 'YES'
              and case
                    when charindex('Dum',tblCrystalBeauty.CLASS_NAME) > 0
                      then 'NO'
                    else 'YES'
                  end = 'YES'
              and tblBrands.WEB_ALLOWED = 'Yes'
           then 1
         else 0
       end as CONGRUENCY
      ,ISNULL(tblBrands.CUTOUTS,'DN') as USE_COUTOUTS
      ,'' as MARKED_FOR_WEB_WEB_ID
      ,case
         when tblMarkedForWeb.CREATE_DATETIME is not null
           then 'YES'
         else 'NO'
       end as MARKED_FOR_WEB_SKU
      ,cast(tblMarkedForWeb.CREATE_DATETIME as datetime) as MFWD
      ,case
         when tblODIPublished.SKU_B4N_UPLOAD_MODIFIED_DATE is not null
           then 'YES'
         else 'NO'
       end as PUBLISHED
      ,cast(tblODIPublished.SKU_B4N_UPLOAD_MODIFIED_DATE as datetime) as PD
      ,case
         when tblODIPublished.SKU_B4N_UPLOAD_MODIFIED_DATE is not null
           then 1
         else 0
       end as PUBLISHED_COUNT
      ,case
         when case
                when tblBeautyCopy.COPY_COMPLETE_DATE is not null
                  then 'YES'
                else 'NO'
              end = 'YES'
              and case
                    when tblAmplianceReport.IMAGE_DATE_UPLOADED is not null
                      then 'YES'
                    else 'NO'
                  end = 'YES'
              and case
                    when tblODIPublished.SKU_B4N_UPLOAD_MODIFIED_DATE is not null
                      then 'YES'
                    else 'NO'
                  end = 'NO'
           then 'YES'
         else 'NO'
       end as READY_TO_UPLOAD
      ,case
         when tblAmplianceReport.IMAGE_DATE_UPLOADED is not null
           then 'YES'
         else 'NO'
       end as IMG_UPLOADED
      ,tblAmplianceReport.IMAGE_DATE_UPLOADED as IUD
      ,tblBeautyCopy.COPY_COMPLETE_DATE
      ,case
         when tblBeautyCopy.COPY_COMPLETE_DATE is not null
           then 'YES'
         else 'NO'
       end as COPY_COMP
      ,tblBeautyCopy.COPY_COMPLETE_DATE as CACD
      ,case
         when tblBeautyCopy.COPY_COMPLETE_DATE is not null
           then 'YES'
         else 'NO'
       end as CAT_COMP
      ,case
         when tblTransfers.CREATE_DATE is not null
           then 'YES'
         else 'NO'
       end as TRANSFERRED_TO_PACKSHOT
      ,tblTransfers.CREATE_DATE as TTPD
      ,case
         when tblImageOrder.DATE is not null
           then 'YES'
         else 'NO'
       end as IMAGE_ORDER
      ,tblImageOrder.DATE as IOD
      ,MV_REP_PUBLISHED_WCID_LEVEL.ONLINE_FLAG as DW_ONLINE_FLAG_WCID
      ,MV_REP_PUBLISHED_WCID_LEVEL.PUBLISHED as DW_PUBLISHED_FLAG_WCID
      ,MV_REP_PUBLISHED_SKU_LEVEL.ONLINE_FLAG as DW_ONLINE_FLAG_SKU
      ,MV_REP_PUBLISHED_SKU_LEVEL.PUBLISHED as DW_PUBLISHED_FLAG_SKU
      ,ISNULL(tblDepartment.DEPARTMENT,'DN') as DEPARTMENT
from tblCrystalBeauty
    left join tblODIPublished
        on tblCrystalBeauty.ITEM = tblODIPublished.SKU
    left join tblWebIDLegacy
        on tblCrystalBeauty.ITEM = tblWebIDLegacy.SkuId
    left join tblAmplianceReport
        on ISNULL(tblWebIDLegacy.WebProductStyleID,
                                 case
                                   when count(tblCrystalBeauty.STOCK_ON_HAND) over(partition by tblCrystalBeauty.ITEM_PARENT) > 1
                                     then case
                                            when count(tblCrystalBeauty.STOCK_ON_HAND) over(partition by tblCrystalBeauty.ITEM_PARENT+'_'+cast(tblCrystalBeauty.RETAIL_PRICE as varchar(10))) = count(tblCrystalBeauty.STOCK_ON_HAND) over(partition by tblCrystalBeauty.ITEM_PARENT)
                                              then tblCrystalBeauty.ITEM_PARENT+'_'+tblCrystalBeauty.ITEM
                                            else case
                                                   when count(tblCrystalBeauty.STOCK_ON_HAND) over(partition by tblCrystalBeauty.ITEM_PARENT) > 4
                                                     then tblCrystalBeauty.ITEM_PARENT+'_'+tblCrystalBeauty.ITEM
                                                   else tblCrystalBeauty.ITEM_PARENT
                                                 end
                                          end
                                   else tblCrystalBeauty.ITEM_PARENT
                                 end) = tblAmplianceReport.WEB_ID
    left join tblBeautyCopy
        on tblCrystalBeauty.ITEM_PARENT = tblBeautyCopy.RETEK_PARENT
    left join tblMarkedForWeb
        on tblCrystalBeauty.ITEM = tblMarkedForWeb.ITEM
    left join tblImageOrder
        on tblCrystalBeauty.ITEM_PARENT = tblImageOrder.ITEM_PARENT
    left join tblBrands
        on cast(tblCrystalBeauty.GROUP_NO as varchar(10))+'_'+tblCrystalBeauty.BRAND = tblBrands.PRIMARY_KEY
    left join MV_REP_PUBLISHED_SKU_LEVEL
        on tblCrystalBeauty.ITEM = MV_REP_PUBLISHED_SKU_LEVEL.SKU
    left join MV_REP_PUBLISHED_WCID_LEVEL
        on ISNULL(ISNULL(tblODIPublished.WEB_PROD_STYLE_ID,tblWebIDLegacy.WebProductStyleID),
                                                                                case
                                                                                when charindex('Oxfo',tblCrystalBeauty.SIZE_1) = 1
                                                                                then cast(tblCrystalBeauty.ITEM_PARENT as varchar(10))+'OX'
                                                                                else tblCrystalBeauty.ITEM_PARENT
                                                                                end) = MV_REP_PUBLISHED_WCID_LEVEL.PRODUCT_ID
    left join tblTransfers
        on tblCrystalBeauty.ITEM = tblTransfers.ITEM
    left join tblDepartment
        on cast(tblCrystalBeauty.GROUP_NO as varchar(10))+'_'+tblCrystalBeauty.GROUP_NAME = tblDepartment.GROUP_NAME
where tblCrystalBeauty.ITEM_PARENT is not null
      and tblCrystalBeauty.PL_CYCLE != 'Discontinued'
order by WEB_ID desc;

A: I believe you can solve this by using the APPLY operator. Here you can refer your other tables and simply move your "join on" part to the where clause.
In your case it should look something like:
cross apply (

        select ISNULL(tblWebIDLegacy.WebProductStyleID,
                                 case
                                   when count(tblCrystalBeauty.STOCK_ON_HAND) over(partition by tblCrystalBeauty.ITEM_PARENT) > 1
                                     then case
                                            when count(tblCrystalBeauty.STOCK_ON_HAND) over(partition by tblCrystalBeauty.ITEM_PARENT+'_'+cast(tblCrystalBeauty.RETAIL_PRICE as varchar(10))) = count(tblCrystalBeauty.STOCK_ON_HAND) over(partition by tblCrystalBeauty.ITEM_PARENT)
                                              then tblCrystalBeauty.ITEM_PARENT+'_'+tblCrystalBeauty.ITEM
                                            else case
                                                   when count(tblCrystalBeauty.STOCK_ON_HAND) over(partition by tblCrystalBeauty.ITEM_PARENT) > 4
                                                     then tblCrystalBeauty.ITEM_PARENT+'_'+tblCrystalBeauty.ITEM
                                                   else tblCrystalBeauty.ITEM_PARENT
                                                 end
                                          end
                                   else tblCrystalBeauty.ITEM_PARENT
                                 end) as joincolumn
                                 --Add columns you need at the main select
                                 from tblAmplianceReport)

                                 -- add this to your where clause at the end
                                 where joincolumn = tblAmplianceReport.WEB_ID


text:
Q: Can an instance initializer throw exception? I have been very clear that instance initializer cannot throw exception because it is part of object initialization and developer has no control over this process. This post has the same idea.
However, I have read an article by Bill Venners about the object initialization in java, and there is one paragraph quoted as below:

The code inside an instance initializer may not return. Except in the case of anonymous inner classes, an instance initializer may throw checked exceptions only if the checked exceptions are explicitly declared in the throws clause of every constructor in the class. Instance initializers in anonymous inner classes, on the other hand, can throw any exception.
  Please click here for original post.

It seems to say that an instance initializer can throw exception. Could anyone here explain this to me or correct me if my understanding is not correct.

A: Instance initializers can throw checked exceptions, but if they do, the class constructor has to declare them. For example, this code is legal:
import java.io.*;

public class MyClass {

    PrintStream stream;

    {
        stream = new PrintStream("/tmp/file.txt");
    }

    public MyClass() throws FileNotFoundException {
    }

}

If, however, the throws clause was omitted from the constructor, or if another constructor was added that didn't also have the clause this would not compile, because the PrintStream constructor throws FileNotFoundException.


text:
Q: How to start internet explorer without any add-ons except flash? I know there is a mode for IE called No-Addons but is it possible to start internet explorer with autoit or similiar tools or in any way with only adobe flash or reversed how to disable spammy toolbars with autoit ?
I know i can create automatizing scripts but the solution should work with windows 7, xp, vista and IE7-8-9.

A: Go to options in IE and disable whatever you want....

A: Here is the autoit code:
    ; Toolbar Kontrolü Başla

  ; 64 bit başla

if $mimari == 64 Then

For $i = 1 to 100
$var = RegEnumVal("HKLM64\SOFTWARE\Microsoft\Internet Explorer\Toolbar", $i)
If @error <> 0 Then ExitLoop
$read = RegRead("HKLM64\SOFTWARE\Microsoft\Internet Explorer\Toolbar", $var)
$result_no = StringInStr($var, "Locked")
$result_yes = StringInStr($var, "-")
if $result_no == 0 and $result_yes > 0 Then
$result = RegDelete("HKLM64\SOFTWARE\Microsoft\Internet Explorer\Toolbar", $var)
$i = $i-1
EndIf
Next

EndIf

  ; 64 bit bitir

For $i = 1 to 100
$var = RegEnumVal("HKLM\SOFTWARE\Microsoft\Internet Explorer\Toolbar", $i)
If @error <> 0 Then ExitLoop
$read = RegRead("HKLM\SOFTWARE\Microsoft\Internet Explorer\Toolbar", $var)
$result_no = StringInStr($var, "Locked")
$result_yes = StringInStr($var, "-")
if $result_no == 0 and $result_yes > 0 Then
$result = RegDelete("HKLM\SOFTWARE\Microsoft\Internet Explorer\Toolbar", $var)
$i = $i-1
EndIf
Next

; Toolbar Kontrolü Bitir


text:
Q: Modifying a jQuery infinite carousel - manual navigation I'm trying to modify a carousel with some manual navigation between "slides". I've followed this guide.
This is my result.
Can anyone explain to me how I can make so it's possible to:

*

*Choose the second slider (with the manual navigation)

*Step right using the arrow that points to right

Without being redirected back to the first "slide". I understand that it's in the } else if (page > pages) {-case, and it's resetting the page-variable. But how can I avoid it? I thought the goto-method was supposed to take care of the current page association.
I've been doing this for hours and I'm just more confused.
(I know my workaround for the manual navigation is fugly ;) )
Thanks in advance!

A: The problem is in line 92 of jquery-lol.js:
jQuery('#splash-splash').trigger("goto", [ navVal ]);

Change it to:
jQuery('#splash-splash').trigger("goto", parseInt(navVal));

The goto event assumes that the page parameter is numeric. Alternatively, in case you don't want to worry about it in the future, insert this after line 39 (making it the first line of the gotoPage function):
page = parseInt(page);


text:
Q: Is there a way to update config files once build is done in jenkins I am new to jenkins, I am working on .NET Project.
Right now we are using CC.NET with combination of NANT for our CI. We are  building one build and updating Config files using Xmlpoke as required by environment (qa,prod) .
I am able to compile my code in jenkins with MS build and Sln file combination , But stuck at config files update before deploy?
For example , I have to update below portion of webconfig file :
From :
<endpoint address="http://cmwebservice/CreditWebService.svc/Get/"
    behaviorConfiguration="WebBehavior" binding="webHttpBinding"
    contract="Credit.WebServiceHost.ICreditWebService">
</endpoint>

To
<endpoint address="http://somewebserver/CreditWebService.svc/"
    behaviorConfiguration="WebBehavior" binding="webHttpBinding"
    contract="Credit.WebServiceHost.ICreditWebService">
</endpoint>

A: Make your config file into a template:
<endpoint address="ENDPOINT_ADDRESS"

Then you can use a pre-build or post-build "Execute shell" command to perform the replacement:
sed -i 's/replaceThis/withThis/g' $WORKSPACE/path.to.file


text:
Q: NodeJs + PhantomJs page content doesn't have all the elements Hi I am trying to parse a website which has live football scores. Using NodeJS and PhantomJS together (phantomjs-node). The thing is I am not able to run JQuery in page.evaluate on an element because I assume page content doesn't have the element I want to parse. Here I have a simple example and the element I can't see is called "resultsList". If I run $("#resultsList").html() on the console of a web browser I can get the inner html though.
var phantom = require('phantom');

async function getHtml() {
    const instance = await phantom.create([
        "--load-images=false"
    ]);
    const page = await instance.createPage();

    await page.on("onResourceRequested", function(requestData) {
        console.info('Requesting', requestData.url)
    });

    const status = await page.open('http://www.mackolik.com/canli-sonuclar');
    console.log("STATUS: " + status);

    const content = await page.property('content');
    //console.log(content);

    const result = await page.evaluate(function() {
                        return $("#resultsList").html();
                   });

    console.log("Result : " + result);
    await instance.exit();
};

getHtml();

And the latest lines of the output is
Requesting http://track.adform.net/Serving/TrackPoint/?pm=775868&ADFPageName=Master%20tag&ADFdivider=%7C&ord=192742255982&Set1=en-US%7Cen-US%7C1024x768%7C32&ADFtpmode=3&loc=http%3A%2F%2Fwww.mackolik.com%2FGoogleBanner.htm%3Fv%3D1.150&atdt=.Wa44j1e3NlY5BSo9z4ofjb75PaK4Vpjt3Q9cUVlOrXTAxw63UYOKES5jfyEwHXXTSHCSPxQEt05oaYAhrcpMxE6DBUrizAjVlpSnGmfDnxf7_OLjLnidPZW2AUMnGWVQdgMVQdgGgeVjrkRGjftckcKyAd65hz7YOK2w5ADwIlUjVsYwQ9dvcpxUlzXJJIneGffMfOz77qZoOSix5ezdstlYyxrtSw5DfiPDKOqUhO3f9puqSySy.aPjgnYVuxISg0QirQjEKZtlGqfstpBSKxUC56MnGWpwoNSUC550ial.rIN96h1P38Z_..hw6LzSIrwyMSu_djmVzgzH_y3EjNrjOxCRg9Vr_0p5DtQWug0Jl5mQeQzJQSuX3jtFTL4z1dyJjjNrjOxCUciL4FQmVurNW5BNlYiJ.lY5BqNAE.lTjV..G1
Requesting http://cdn.dimml.io/static/0025b42fc3958ae34c902ccc8164863b1d4b6019.js
STATUS: success
Requesting http://baltar.dimml.io/flow/oiod/0025b42fc3958ae34c902ccc8164863b1d4b6019.js?clientId=2&dom=www.mackolik.com&url=http%3A%2F%2Fwww.mackolik.com%2Fcanli-sonuclar&gemius_sent_once=1
Result : null

As you can see "Result" prints null.
I run with the command >node --harmony-async-await phantomTest.js
EDIT: webpage has JQuery library. So, I dont need to use includeJs() for adding JQuery.
Requesting http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js
Requesting http://cm.cdn.md/js5/jquery-ui-1.8.23.custom/js/jquery-ui-1.8.23.custom.min.js
Requesting http://cm.cdn.md/js5/jquery-ui-1.8.20.custom/css/custom-theme/jquery-ui-1.8.20.custom.css
Requesting http://cm.cdn.md/js5/jquery.jsonp-2.1.4.js
Requesting http://cm.cdn.md/js5/jquery-ui-1.8.20.custom/development-bundle/ui/i18n/jquery.ui.datepicker-tr.js
Requesting http://cm.cdn.md/js5/jquery-ui-1.8.20.custom/development-bundle/themes/custom-theme/jquery.ui.datepicker.css
Requesting http://cm.cdn.md/js5/jquery-autocomplete/jquery.autocomplete.min.js

A: There are 2 possibilities

*

*the website dont have jQuery inside
Solution: injectJs("/absolute path of jQuery in your system/");

*the website have JQuery
Solution: Cannot find the particular element.
Open Chrome execute the same query and paste inside the evaluate.


text:
Q: Inductor DOT for RF I recently looked at a reference design for an 433MHz transmitter and noticed that inductor orientation was specified (using the DOT).
On the pcb layout the inductors are placed close, so they will probably couple electrically and magnetic.
But is the orientation mainly to cancel EMC (magnetic) or voltage induced?

A: Most of the magnetic field lines exit the inductor along the axis  of the cylinder, so inductors will couple more strongly when parrallel one after another.
Likely to be more weakly coupled:

Likely to be more strongly coupled:

A: A dot on a single inductor makes no sense.  Dots are used to specify the orientation of the magnetic coupling between two or more windings.  If your schematic had a dot by one inductor, then there is probably another inductor or winding in the same package.  There is no standard way to specify relative orientation of two discrete inductors on a schematic.  This would need to be done with a special note for that purpose on the schematic or a separate document given to whoever does the layout.  Ultimately the layout defines the relative placement and orientation of discrete parts.
If you want to minimize inductive coupling between two discrete inductors, then you either put them far enough apart so that the external fields are attenuated enough to ignore, or you put the two in a "T" arrangement.  A T is only possible if the axis of the coils are parallel to the board.  If they are vertical, then this is not a option.
Shielded inductors help in this regard because the "shield" provides a nice path for the magnetic flux lines to return so that very little of the external field will return thru the air.


text:
Q: Bluetooth serial devices won't reconnect without removing/re-adding in macOS Monterey I'm working on remote operated camera pan/tilt device that uses a HC-05 Bluetooth module to connect a GUI written in Processing and running on a Mac to an Arduino. Everything works great when I first pair the HC-05, but if either the HC-05 or the Mac Bluetooth gets power cycled, they won't reconnect automatically. If I choose the device in the Bluetooth menu or right-click and choose Connect in System Preferences, it spins for a moment and says "connected," but the LED on the HC-05 still blinks "disconnected" and no data is transmitted.
The problem appears to be a change in the way MacOS (or newer Apple hardware?) handles Bluetooth serial. On a Mac running Catalina, if the HC-05 is power cycled, as long as I also close and re-open the process connected to it (eg Serial Monitor in the Arduino app), the HC-05 reconnects. For some reason, the same device appears in /dev/ as "DeviceName-DevB," but on Monterey it just appears as "DeviceName" in Catalina, which suggests to me that there's some under the hood change, but I can't figure out how to get it to reconnect without removing and re-pairing it in System Preferences each time.
Any ideas?


text:
Q: Login using Facebook login button and start a new activity I want to start a new activity after facebook login.
I want an application that have a facebook login button and after login enter in other activity, in this tutorial after I click on login button the logout button appears and I don't want the logout button appear.
This is my code. I am using facebook-android-sdk 4.1.2
Test is the new activity class.I want to open it after facebook login.
TextView info;
private LoginButton loginButton;
private CallbackManager callbackManager;
String name;

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    FacebookSdk.sdkInitialize(getApplicationContext());
    callbackManager = CallbackManager.Factory.create();
    setContentView(R.layout.fb_button);
    info = (TextView)findViewById(R.id.info);
    loginButton = (LoginButton)findViewById(R.id.login_button);
    loginButton.setReadPermissions(Arrays.asList("public_profile, email, user_birthday, user_friends"));

    loginButton.registerCallback(callbackManager, new FacebookCallback<LoginResult>() {
        @Override
        public void onSuccess(LoginResult loginResult) {
          GraphRequest request = GraphRequest.newMeRequest(
                    loginResult.getAccessToken(),
                    new GraphRequest.GraphJSONObjectCallback() {
                        @Override
                        public void onCompleted(
                                JSONObject object,
                                GraphResponse response) {
                            // Application code

                            try {
                           // URL image_value = new URL("http://graph.facebook.com/"+id+"/picture" );
                                name = object.getString("email");
                            } catch (JSONException e) {
                                e.printStackTrace();
                            }
                            // getting email of the use
                           info.setText(name);

                            Log.v("LoginActivity", response.toString());
                        }
                    });
            Bundle parameters = new Bundle();
            parameters.putString("fields", "id,name,email,gender, birthday");
            request.setParameters(parameters);
            request.executeAsync();
            Intent intent = new Intent(FbActivity.this, Test.class);
            FbActivity.this.startActivity(intent);

        }

        @Override
        public void onCancel() {

            info.setText("Login attempt canceled.");

        }

        @Override
        public void onError(FacebookException e) {

            info.setText("Login attempt failed.");

        }
    });

    // Execute DownloadJSON AsyncTask

}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    callbackManager.onActivityResult(requestCode, resultCode, data);
   Intent intent = new Intent(FbActivity.this, Test.class);
            FbActivity.this.startActivity(intent);
}

A: Write -
Bundle parameters = new Bundle();
    parameters.putString("fields", "id,name,email,gender, birthday");
    request.setParameters(parameters);
    request.executeAsync();
    Intent intent = new Intent(FbActivity.this, Test.class);
    FbActivity.this.startActivity(intent);

on completion, for ex. -
   @Override
        public void onSuccess(LoginResult loginResult) {
          GraphRequest request = GraphRequest.newMeRequest(
                    loginResult.getAccessToken(),
                    new GraphRequest.GraphJSONObjectCallback() {
                        @Override
                        public void onCompleted(
                                JSONObject object,
                                GraphResponse response) {
                            // Application code

                            try {
                           // URL image_value = new URL("http://graph.facebook.com/"+id+"/picture" );
                                name = object.getString("email");
                            } catch (JSONException e) {
                                e.printStackTrace();
                            }
                            // getting email of the use
                           info.setText(name);

                 Bundle parameters = new Bundle();
                 parameters.putString("fields", "id,name,email,gender, birthday");
                 request.setParameters(parameters);
                 request.executeAsync();
                 Intent intent = new Intent(FbActivity.this, Test.class);
                 FbActivity.this.startActivity(intent);

                 Log.v("LoginActivity", response.toString());
                        }
                    });

A: You have to add this line to your code after login.
loginButton.setVisibility(View.INVISIBLE);

Remember after logout to show button with
loginButton.setVisibility(View.VISIBLE);


text:
Q: Find nucleotide subsequence within fasta sequences I have to write a function with input a FASTA file containing dna sequences with ambiguous symbols (IUPAC). Given the name of the FASTA file and an unambiguous DNA string, I want to write out the identifiers of the sequences ('>' headers) of which the given sequence could be a subsequence. I would like to implement this without generating all possible sequences and the subsequence can have ambiguous symbols as well as the sequences in the FASTA file. Example: the sequence "ACC" could be a subsequence of "CGMBHTW".
Can someone help me with it?

A: You could try defining a "generalized" nucleotide as a set of letters that it represents, then convert your sequences in lists of such sets and scan one sequence for the presence of a compatible position with the other.
Here is something that may not be the most efficient code, but seems to work (double-check I got the looping indices right, though...).
A = {"A"}
C = {"C"}
G = {"G"}
T = {"T"}
R = A | G
Y = C | T
S = G | C
W = A | T
K = G | T
M = A | C
B = C | G | T
D = A | G | T
H = A | C | T
V = A | C | G
N = {"A", "C", "G", "T"}

letter2nucl = {
    "A" : A,
    "C" : C,
    "G" : G,
    "T" : T,
    "R" : R,
    "Y" : Y,
    "S" : S,
    "W" : W,
    "K" : K,
    "M" : M,
    "B" : B,
    "D" : D,
    "H" : H,
    "V" : V,
    "N" : N}

def is_subseq(seq1, seq2):
    l1 = len(seq1)
    l2 = len(seq2)
    nucls1 = [letter2nucl[letter] for letter in seq1]
    nucls2 = [letter2nucl[letter] for letter in seq2]
    i = 0
    while i < 1 + l2 - l1:
        subseq = True
        for j, nucl in enumerate(nucls1):
            if not (nucls2[i+j] & nucl):
                # empty set intersection
                subseq = False
                break
        if subseq:
            return True
        i += 1
    return False

seq1 = "ACC"
seq2 = "CGMBHTW"

if is_subseq(seq1, seq2):
    print("%s is subsequence of %s" % (seq1, seq2))

seq1 = "GRT"
seq2 = "AATCBAT"

if is_subseq(seq1, seq2):
    print("%s is subsequence of %s" % (seq1, seq2))

Results are:
ACC is subsequence of CGMBHTW
GRT is subsequence of AATCBAT

Then, you can use this on sequences read using Biopython's SeqIO functions.


text:
Q: Running backwards on a carousel Let's suppose I'm on a carousel rotating with a speed $\omega$ and start running on it in the opposite direction with a speed $v$ such that $\omega r=-v$ where $r$ is the distance between me and the center of the carousel.
What are the forces that act on me? Do I feel Coriolis force?
Intuitively I'm "still" so no force should act on me, but also intuitively this explanation seems too easy to be the real one.

A: As viewed in an inertial frame, no force acts on you.  This makes sense, because you are at rest in that frame.
As viewed in the rotating reference frame attached to the carousel, two forces are acting on you:  the Coriolis force and the centrifugal force.  The Coriolis force has magnitude $2 m \omega v = 2 m \omega^2 r$ inwards.  The centrifugal force has magnitude $m \omega^2 r$ outwards.  Thus, in the rotating reference frame there is a net force of $m \omega^2 r$ inwards.  This is completely in line with your motion in the rotating reference frame, since in that frame you are executing uniform circular motion about the origin with radius $r$ and angular frequency $\omega$.

A: I assume you mean that you remain stationary while the carousel spins underneath you. This means that the net force acting on you must be zero, or that you would only feel the reaction to your weight from your feet.
If you closed your eyes it would feel like you are running on a straight line, except because your feet are a certain distance apart, and the carousel has different speeds under each foot, it would feel like running on two treadmills, (one per foot) each with a different speed.


text:
Q: How to change text in a p tag in a navigation to title when user is in a specific section? I need JavaScript code to help me change text in navigation to the title of each of my sections when the user enters the section. (it will be a mobile app)
The following is a skeleton of my code. I have a header and footer so it always shows on the user's screen. The header tag is where I want my text to display screen title of each page. "home" will change to "specials" in section 2, "reservations" in section 3.

 home

I have three sections, with class home, specials, reservation.

 //I have code here

A: It's not that hard actually. First of all, you need to use the $(window).scroll(function () {}); from JQuery to find out where your current scroll position is.
Then you will have to compare all the sections offsets with your current scroll offset. The closest will be stored in a variable called result. Then just set the text of your
 with the result value.
$(window).scroll(function () {
        //Current Scroll offset, You might need to change the number 0 to something else because of paddings & stuff.
        var scroll = $(window).scrollTop() + 0;
        //Closest offset
        var closest = 0;
        //Result will be the Class of the closest section. This class will be used to set the subnav a text.
        var result;
        $("section").each(function () {
            var offset = $(this).offset().top;
            if (scroll - offset > 0) {
                closest = offset;
                result = $(this).attr("class");
            }
        });
        //Now set the value "result" as text of your  tag.
        $("#topnav p").text(result);
    });

Please note this code has not been fully tested but it should work in theory. I hope you can work with this.


text:
Q: Diode circuit analysis with two diodes in series

simulate this circuit – Schematic created using CircuitLab
In the above schematic the CVD model is being used, with a voltage drop of 0.6 V, for all three diodes. The input voltage sweeps from -10 V, to +10 V. In this homework assignment my task is to sketch a current vs input voltage diagram for all three diodes. In my analysis, I started from the -10V input and did a circuit approximation for that single voltage and tried to find when one of the parameters defining either the voltage or the current for any diode changes its sign, or more precisely, one of the diodes turns off or on. This is my diagram for that specific scenario:

simulate this circuit
The expression for the current is I=(4.4V - Vin)/R1. This current is always >0 for all input voltages that satisfy the inequality Vin<4.4 Volts. However a simulation I performed in LTspice revealed that the diode D1 actually stops conducting much earlier, at Vin=0.6V.
This inevitably led me to seek another analytical way to obtain the same result as above. This is the equation according 3,to KVL:Ud3+Ud2-0.6-Vin=0. Both Ud3 and Ud2 are <0.6V. Rearrangin the previous equation I got Ud2=Vin+0.6-Ud3<0.6, and thus Vin


text:
Q: Cannot break out the foreach loop I am using a collection to add a list of employees with add and display function like below:
class Collection<T>
{
    static List<T> list = new List<T>();
    public Collection()
    {

    }

    public bool Add(T obj, ref T u)
    {
        list.Add(obj);
        return true;
    }

    public void Display()
    {
        bool s = false;
        foreach (T u in list)
        {
            Console.WriteLine(u.ToString());
            s = true;
            break;
        }
    }

And a class that contains a menu :
public class EmployeeManagement : Employee
{
    Collection<Employee> emp = new Collection<Employee>();
    public void MainMenu()

    {
        Console.WriteLine("1. Import Employee");
        Console.WriteLine("2. Display Employee Information");
        Console.WriteLine("3. Search Employee");
        Console.WriteLine("4. Exit");
        Console.WriteLine("Enter Menu Option Number: ");
        int choice = Convert.ToInt32(Console.ReadLine());
        do
        {
            switch(choice)
            {
            case 1:
                ImportEmployee();
                break;
            case 2:
                emp.Display();
                break;
            }
        } while (true);

    }

    public void AddEmployee(Employee u)
    {
        u.InputEmployee();
        if (!emp.Add(u))
        {
            Console.WriteLine("88");
        }
    }

    public void ImportEmployee()
    {

        while (true)
        {

            Console.WriteLine("================== Import Employee ============");
            Console.WriteLine("1. Salaried Employee");
            Console.WriteLine("2. Hourly Employee");
            Console.WriteLine("3. Main Menu");
            int choice = Convert.ToInt32(Console.ReadLine());
            if (choice == 1)
            {
                SalariedEmployee salEmployee = new SalariedEmployee();
                AddEmployee(salEmployee);
            }
            else if (choice == 2)
            {
                HourlyEmployee hourlyEmployee = new HourlyEmployee();
                AddEmployee(hourlyEmployee);
            }
            else
            {
                MainMenu();
                break;
            }
            Console.ReadKey();
        }

    }
}

I have added a new employee and it's has been added to my list. After that, I hit option 3 to go back to the main menu and choose display employee, it kept printing my list employee and cannot break out the loop. How can I fix this problem, I have tried to display in importemployee() menu and it worked without a problem.

A: The break in the foreach loop in Display() is OK, nothing wrong there.
"break;" breaks out of the closest loop or a switch statement.
Your issue is that you can't break out of the do-while in MainMenu() and that your choice will remain 2 because you are not reading the input in the do-while.
In other words, you will break out of the foreach in Display(), you'll end up in the switch in MainMenu(), you'll break out of the switch, you'll start the do-while over again and then you will enter the Display() because your choice will still be 2. This will keep repeating itself.
I've written some comments for your code so that you can follow the flow a bit easier and added some suggestions.
    public void Display()
    {
        bool s = false;
        foreach (T u in list)
        {
            Console.WriteLine(u.ToString());
            s = true;

            //Breaks out of this loop, nothing wrong here. I would use return though, if I don't have to perform any code afterwards.
            break;
        }
    }

   public void MainMenu()
   {
        .
        .
        .

        //Only reading choice once. Would need to handle exception
        int choice = Convert.ToInt32(Console.ReadLine());
        do
        {
            //Choice will always be what you initially selected since you are not reading it inside the do-while. If you selected two it will always be two.
            switch(choice)
            {
            case 1:
                ImportEmployee();

                //Breaks out of switch statement
                break;
            case 2:
                emp.Display();

                //Breaks out of switch statement
                break;
            }

        //Infinity loop since you have no breaks for the do-while or a condition to exit it
        } while (true);
   }

My suggestion for your do-while, if you want to use do-while, would be to have it like this.
        public void MainMenu()
        {
            Console.WriteLine("1. Import Employee");
            Console.WriteLine("2. Display Employee Information");
            Console.WriteLine("3. Search Employee");
            Console.WriteLine("4. Exit");
            Console.WriteLine("Enter Menu Option Number: ");

            //Default value 0
            int choice;
            do
            {
                //Use TryParse, it safely tries to interpret a string as a number. For string "s" it would return false, for string -1 it would return -1.
                //If an invalid string is entered, it will display a message, set choice to 0, go to the end of the loop then start over reading a key.
                //The entered string needs to be between the value of 1 and 4
                if (!int.TryParse(Console.ReadLine(), out choice) || choice > 4 || choice < 1)
                {
                    //We do not want to automatically trigger our switch with our previous value
                    choice = 0;

                    Console.WriteLine("Invalid menu selection, select 1-4");
                }

                switch (choice)
                {
                    case 1:
                        ImportEmployee();
                        break;
                    case 2:
                        emp.Display();
                        break;
                    case 3:
                        Console.WriteLine("Not implemented");
                        break;
                }
            } while (choice != 4); //Only stop the loop if we selected 4
        }

There are a lot of different ways to do this but this feels like a school assignment so I'm kind of just answering your question and not suggesting other improvements.
You also have quite a big issue in your "ImportEmployee()" that will be apparent when you fix the main menu loop. If you need a hint later I'll post in comments but try to find it yourself.
GL


text:
Q: C++ Python Swig Compability with Scons and/or dynamic libraries So what I want to do is fairly straight forward, I want to access a C++ class in Python using swig. I've managed to do this for stand alone applications but that's not enough.
What I have: a fairly huge C++ library which is compiled using SCons. This generates a static (lib---.a) library. I also have a small C++ class using some of the library functionality.
What I tried to do was letting SCons compile everything, including my custom class, and then do the swig magic. I defined an swig interface file including the structure of my header file which I also included in the swig interface file.
In the header file there are dependencies to the library, but since these already have been compiled (into the static lib) swig can't find it. Replacing SCons is not an option. However, I can make a dynamic library instead of a static one.
So my question boils down to this: is there a proper way of using Swig inside SCons, or, can you somehow include the library dependency as an existing dynamic library? Furthermore, I can (using SCons) either compile my custom class into an object (.o) file or a dynamic library (.so) as well.
Regarding the dynamic library, this is where things get messy since this is also what swig generates (?), or at least generated by someone.
Does this even make sense? I'm clearly on thin ice and don't necessarily know what I'm talking about.
Below are the c++ header and swig interface, I excluded c++ source since it felt redundant.
My Header File:
#include "../include/LogCabin/Client.h"
#include "../include/LogCabin/Debug.h"
#include "../include/LogCabin/Util.h"

class Ops{
private:
    void dumpTree(std::string);
    void dumpTreeLocal(std::string);
public:
    Ops(std::string, uint64_t, std::string);
   ~Ops();
    ...
    void makeLeader();
    void getLeader();
    int reconfigure(std::vector<std::string>);
};

My corresponding swig interface file:
%module Ops

%{
#include "Ops.h"
%}
%include "Ops.h"

class Ops{
public:
    Ops(std::string, uint64_t, std::string);
    ~Ops();
    ...
    void makeLeader();
    void getLeader();
};

Commands used:
swig -c++ -python Ops.i;
g++ -std=c++11 -c -fPIC Ops_wrap.cxx  -I/usr/include/python2.7 -I/usr/lib/python2.7;
g++ -std=c++11 -shared -Wl,-soname,_Ops.so -o _Ops.so Ops.o Ops_wrap.o;

Thanks. #swig
EDIT:
I include the SConscript called by SConstruct.
Import('env', 'object_files')

libs = [ "pthread", "protobuf", "rt", "cryptopp" ]

src = [
    "Ops.cc",
    "Ops.i"
]
/*object_files['Impl'] = env.StaticObject(src)*/

env.Default([
    env.SharedLibrary("Ops", src,
            LIBS = libs)
])

Edit2:
I updated the SContruct env declaration to set some parameters for swig.
env = Environment(options = opts,
              SWIGFLAGS=['-c++','-python'],
              CPPPATH=["/usr/include/python2.7"]),
              LIBPATH=["/usr/lib/python2.7"]),
              SHLIBPREFIX="",
              tools = ['default', 'protoc', 'packaging'],
              ENV = os.environ)

When compiling the generated Ops_wrap.cc file it gives me a lot of type cast warnings but still finish the compilation, e.g.
build/Impl/Ops_wrap.cc:654:23: warning: conversion to 'unsigned char' from 'int' may alter its value [-Wconversion]
       uu = ((d - '0') << 4);

When trying to access the Ops class via the generated Ops.py file it gives me error when importing Ops:
Traceback (most recent call last):
  File "test.py", line 3, in <module>
    import Ops
ImportError: /home/erneborg/Applications/coherent/logcabin/build/Impl/Ops.so: undefined symbol: _ZNK8LogCabin6Client4Tree6readExERKSs

The undefined symbol corresponds to a function in the library "LogCabin::Client::Tree::readEx()". Thoughts?


text:
Q: Unable to launch the Chrome headless browser in Windows 7 using Selenium  **Sinppet**

 if (os.contains("win")) {
                    System.out.println("OS: WINDOWS");
                    System.setProperty("webdriver.chrome.driver", localPath+"chromedriver.exe");
                    ChromeOptions chromeOptions = new ChromeOptions();
                    chromeOptions.addArguments("headless");
                    return new ChromeDriver(chromeOptions);
                } else if (os.contains("mac")) {
                    System.out.println("OS: MAC");
                    System.setProperty("webdriver.chrome.driver", localPath+"chromedriver_mac64");
                    return new ChromeDriver();
                }

Error I am facing
org.openqa.selenium.TimeoutException: Expected condition failed: waiting for visibility of element located by By.xpath: //input[@id='user_id'] (tried for 180 second(s) with 500 MILLISECONDS interval)
    at org.openqa.selenium.support.ui.WebDriverWait.timeoutException(WebDriverWait.java:80)
    at org.openqa.selenium.support.ui.FluentWait.until(FluentWait.java:232)
    at com.adp.marketplace.frwk.selenium.SeleniumFunctions.waitForVisibilityByXpath(SeleniumFunctions.java:510)
    at com.adp.marketplace.prm.SSOTestInPRMSteps.The_user_logged_into_PRM_with_valid_cred(SSOTestInPRMSteps.java:28)
    at ?.Given the user logged into PRM with valid creds(com/adp/marketplace/prm/SSOTestsInPRM.feature:7)

A: The argument for headless is wrong, should be :
chromeOptions.addArguments("--headless");

With -- before headless , just like you are adding arguments from shortcut :


text:
Q: TypeError: s[p].shape is undefined in firefox  model = tf.sequential();

 a = tf.layers.input({shape: [127,]});
 b = tf.layers.dense({units:64, inputShape: [127,], activation: 'relu' }).apply(a)
 c = tf.layers.dropout(0.5).apply(b)
 d = tf.layers.dense({units:64, activation: 'relu'}).apply(c)
 e = tf.layers.dropout(0.5).apply(d)
 f = tf.layers.dense({units:12, activation: 'sigmoid'}).apply(e)

 model = tf.model({inputs: a, outputs: f});

 model.compile({
    optimizer: 'rmsprop',
    loss: 'meanSquaredError',
    metrics: 'accuracy'
 });

 console.log(model.summary());

 await model.fit(input1:XS[1].split(','), {main_output:YS[1].split(',')}, {epochs: 50});

Here the shape of XS[1] is (127,) and YS[1] has the shape (12,), I have made the splits based on '\n' and ',' , still the error remains. Any help will be appreciated!

A: I fixed it by wrapping the input and output in a way
{input1:tf.tensor(Array(XS[1].split(',')))},{main_output:tf.tensor(Array(YS[1].split(',')))}


text:
Q: weighted sum of values VS sum of weighted values, I studied Neural Network, and there occurs following formula.
S = Sum ( weight of N * value of N )

In the text book and other references, they indicate S as 'an weighted sum of values'.
I have some confusion on it, because it looks like 'Sum' Of 'weighted values', which is exactly the same as the way I read the formula.
Could you let me know what I am missing here?
Thank you,

A: In this particular case, because the formula uses the phrase "weight of N", your proposed phrasing of "sum of weighted values" is perhaps more appropriate. This is because the weight is (apparently, by the phrase "weight of N") an inherent property of the value itself, and not a function of the particular summing operation.
However, in general, the phrase "weighted sum of values" is more commonly used, and is indeed more appropriate, because the weights are not inherent to the values themselves; they are not "weighted values", they are simply values, and the weighting is applied by nature of the summing, not by nature of the values themselves.
In light of this, I think it is more natural (if only by precedent) to use "weighted sum of values", although if you were to write "sum of weighted values" nobody would find it odd.

A: In math, a weighted sum of variables x_i generally means
S = Sum_i ( w_i * x_i ).
So the parsing is (weighted sum) of values, and not weighted (sum of values), which is how you're parsing it.

A: The simple fact is that natural languages are less precise than structured languages. English is a natural language. Math is a structured language. There are domain specific languages that are precise and sound like English. One of the things that you learn when flying an airplane is how to talk to the tower. I can't tell you how many times my sister told My brother and I to talk english when we were discussing time travel theory. Jargon is a unique blend of structured and natural language that gains in specificity but looses  in communicability outside the group. in math jargon a weighted sum is exactly defined as the formula you give, but the english meaning of the words disagree.

A: For what it's worth, I understood that "sum of weighted values" meant a "weighted sum of values", but the former didn't it ring quite right to me.
The reason is, "sum of weighted values" seemed inconsistent with other expressions used in mathematics and statistics: weighted average, weighted arithmetic mean, weighted geometric mean, weighted harmonic mean, and so forth.


text:
Q: Force autoloading of a specific class This previous question shows how to force autoloading of all classes.
However I need to force autoloading of just one class on its own. How could I do that?
It mustn't:

*

*Involve changing the class's source code

*Rely on any part of the class's source code (methods, variables, modifiers e.g. it must be free to change from concrete to abstract without affecting this).

Also, preferably it would not involve coding the class's name as a string. (To help with IDE refactoring and so on).
The best option I have found so far would be to just use spl_autoload_call():
spl_autoload_call("Jodes\\MyClass");

or for non-namespaced classes:
spl_autoload_call("MyClass");

A: I had the same need recently. Doing require_once was not an option because the class really needed to be located by the autoloader because of some more complex rules, there was no way to know exactly the path to the file with the class.
Although the function spl_autoload_call($classname) is designed to do precisely this, it suffers from a fundamental flaw: it will throw a FATAL ERROR in case you call it twice for the same classname or even if some of the child classes of that class were already loaded. This happens because it's not possible to redeclare classes in PHP:
<?php

spl_autoload_call('TheClass');
// no problem

spl_autoload_call('TheClass');
// PHP Fatal error:  Cannot declare class TheClass, because the name is already in use in ... on line ...

My solution for this problem is no rely on the side-effect of class_exists($classname) which was not designed for this purpose, but is more configurable and, therefor, offers more control about triggering the autoloader.
Even better, it has absolutely no problem on multiple calls or if something was already loaded in the inheritance chain. It simply has the side-effect (if you want) of requiring the file, if the class is not there yet!
<?php

class_exists('TheClass');
// no problem

class_exists('TheClass');
// already exists. No need to autoload it and no fatal errors!

With this you have a safe and idempotent way to load the class through the autoloader.
And, if you don't want to hard-code the string with the classname in there, from PHP version 5.5 onward, you can use the ::class pseudo constant, which is resolved at compile time to the string with the fully qualified classname (including namespaces):
<?php

class_exists(TheClass::class);

A: I had exactly the same problem and tried different autoload functions. On a Windows PHP 8.1.5 version I had these two different autoloaders:
set_include_path(get_include_path() . PATH_SEPARATOR . 'class/');
spl_autoload_extensions('.class.php');
spl_autoload_register();

or
$autoloader = function( string $class_name )
{
  $filename = $_SERVER["DOCUMENT_ROOT"].'/class/' . str_replace( '\\', '/', $class_name)    . '.class.php';
  require_once $filename;
};

// our class loader
spl_autoload_register( $autoloader );

which seemingly do the same thing.
As one class file in my application also create some supporting global function variables that can be used during construction of the said class I needed to force the class file loading before accessing said functions variables and construction. I did this with the class_exist() on the specific class.
Using the spl_auoload_extenions version this worked fine; using the spl_autoload_register($autoloader) version causes an undefined variable when using the function variables.


text:
Q: Pointwise limit of $f_N(x)=\frac{1}{N(x^2+1)}\cdot\sum_{n=1}^N\cos(nx)$ I want to show that the following pointwise limit holds:
$$\frac{\sum_{n=1}^N\cos(nx)}{N(x^2+1)}\to\begin{cases} 1, & x=0 \\ 0 & x\neq0 \end{cases}$$
The case $x=0$ is easy: we have, for any $\varepsilon>0$:
$$\frac{1}{N}\left\vert\sum_{n=1}^N\cos(nx)-N\right\vert=\left\vert\frac{N}{N}-1\right\vert=0<\varepsilon$$
for any $N$. However, I'm more troubled by the case where $x\neq0$. One issue is that we might have that $x$ is a multiple of $2\pi$, in which case we would have:
$$\frac{1}{N(x^2+1)}\left\vert\sum_{n=1}^N\cos(nx)\right\vert=\frac{N}{N(x^2+1)}=\frac{1}{x^2+1}$$
for any $N$, in which case we can't make the above arbitrarily small for $x$ fixed.
Graphically, the pointwise limit seems to hold, but I could be mistaken. Any thoughts?

A: It doesn't converge to zero for $x=2\pi$ for example:
$\frac{1}{N((2\pi)^2+1)}\cdot \sum\limits_{n=1}^N\cos(n\cdot 2\pi)=
\frac{1}{N((2\pi)^2+1)}\cdot \sum\limits_{n=1}^N1=\frac{1}{(2\pi)^2+1}$

A: Half of the Dirichlet Kernel
$$\newcommand{\Re}{\operatorname{Re}}
\begin{align}
\sum_{n=1}^N\cos(nx)
&=\Re\left(\sum_{n=1}^Ne^{inx}\right)\tag1\\
&=\Re\left(\frac{e^{ix}-e^{i(N+1)x}}{1-e^{ix}}\right)\tag2\\
&=\frac{\Re\left(e^{ix}-1-e^{i(N+1)x}+e^{iNx}\right)}{2-2\cos(x)}\tag3\\
&=-\frac12+\frac{\cos(Nx)-\cos((N+1)x)}{2-2\cos(x)}\tag4\\
&=\frac{\sin\left(\left(N+\frac12\right)x\right)}{2\sin\left(\frac12x\right)}-\frac12\tag5
\end{align}
$$
Explanation:
$(1)$: $\cos(x)=\Re\left(e^{ix}\right)$
$(2)$: sum of a geometric series
$(3)$: multiply by $\frac{1-e^{-ix}}{1-e^{-ix}}$
$(4)$: $\cos(x)=\Re\left(e^{ix}\right)$
$(5)$: $\cos(Nx)-\cos((N+1)x)=2\sin\left(\left(N+\frac12\right)x\right)\sin\left(\frac12x\right)$
Note that $(5)$ also follows from the Dirichlet Kernel:
$$
\sum_{n=-N}^N\cos(nx)=\frac{\sin\left(\left(N+\frac12\right)x\right)}{\sin\left(\frac12x\right)}\tag6
$$

Application to the Limit
If $\sin\left(\frac12x\right)\ne0$, then, since $\left|\sin\left(\left(N+\frac12\right)x\right)\right|\le1$,
$$
\begin{align}
\lim_{N\to\infty}\frac1{N\left(x^2+1\right)}\sum_{n=1}^N\cos(nx)
&=\lim_{N\to\infty}\frac1{N\left(x^2+1\right)}\left(\frac{\sin\left(\left(N+\frac12\right)x\right)}{2\sin\left(\frac12x\right)}-\frac12\right)\\[6pt]
&=0\tag6
\end{align}
$$
If $\sin\left(\frac12x\right)=0$, then $x=2\pi k$ for some $k\in\mathbb{Z}$; and thus, $\cos(nx)=1$. Therefore,
$$
\begin{align}
\lim_{N\to\infty}\frac1{N\left(x^2+1\right)}\sum_{n=1}^N\cos(nx)
&=\lim_{N\to\infty}\frac1{N\left(x^2+1\right)}\,N\\[6pt]
&=\frac1{x^2+1}\tag7
\end{align}
$$


text:
Q: Symmetrical Difference (Understanding the scope of this function) I was completing a task of FCC which was to get the symmetrical difference of a varied number of arrays. Part of the reason I got stuck was because of my placement of the results array where I would push the unique elements to.I had it outside the function makeSym and I needed to have it inside which i discovered when checking out the hints page. But I dont know why.
function sym() {

    var results = []; // I had the results array here rather than inside function makeSym

    var allArrays = [];
    for (var i = 0; i < arguments.length; i++) {
        allArrays.push(arguments[i]);
    }

    function makeSym(arrOne, arrTwo) {

        // when the results array was placed here, it worked

        arrOne.forEach(function (a) {
            if (arrTwo.indexOf(a) === -1 && results.indexOf(a) === -1) {
                results.push(a);
            }
        });

        arrTwo.forEach(function (a) {
            if (arrOne.indexOf(a) === -1 && results.indexOf(a) === -1) {
                results.push(a);
            }
        });

        return results;
    }

    return allArrays.reduce(makeSym);

}

sym([1, 1, 2, 5], [2, 2, 3, 5], [3, 4, 5, 5]);

My question is why does this change my result, why don't I get the correct symmetrical difference. What is happening in the mechanics that I was missing.
the difference between these two placements was a return of 1,4,5 and a result of 1,3,4,5 (the correct answer should be 1,4,5)
I am assuming this has something to do with scope and closure and this is something I really want to understand more, any information would be helpful.
The second part of my question for anyone still with me, is why does the reduce work in this, what is the reduce doing. I understand its reducing to a single array my multiple arrays but how come the function makeSym doesnt do this alone, in my mind I should be able to execute the function with allArrays as a parameter then return results and complete the challenge this way, but this doesnt work and the reason why it doesnt work isnt obvious to me at all. Again any elucidation would help me understand this more and move forward. Cheers


text:
Q: AFrame / Three.js : why so many (JS)Strings in memory, when loading complex .obj files? we have a pretty complex webscene where we dynamically load pretty complex .obj- and .mtl-files.
After comparing the scene without any of these objects with the one that has multiple objects inside we noticed a weird behaviour:
firefox memory heap shows that most of the memory (>100MB for 5 Objects) is used for JSStrings. the rest of the memory is used for Objects which is self-explaining when we have complex object files in there.
But how come the high amount of Strings and are we able to reduce it?  Does AFrame convert the content of the .obj-files into strings?
We thought about minimizing the .obj files itself and reducing vertices. Maybe someone of you made similar experiences and / or can give us suggestions how to solve this problem.
Thank you in advance :-)

A: OBJ files are text-based, and unfortunately not a particularly efficient way to transfer 3D data. A-Frame has to parse that text to get your data uploaded to the GPU.
If you need to avoid that, I'd suggest trying to convert your OBJ files to a binary format like glTF (.glb). You can do that conversion with obj2gltf (CLI) or https://cesiumjs.org/convertmodel.html (web). A glTF file will load more quickly.


text:
Q: Difference between explicit default destructor and none What is the difference between explicitly declaring a default destructor (using = default), and not declaring anything ? Are there cases when it is required to explicitely define at least a default destructor ?
Please note that I am not speaking about needing to free some allocated memory, I'm asking about destructors that do nothing but the default
I could not came across a case where the former has a different behaviour than the latter. In both cases the compiler seems to generate a call to parents destructor or members destructors.
In those two cases, both behaviours (with or without explicitly defaulted destructor) seem equivalent :
// 1
struct A {
    ~A() { std::cout << "~A()\n"; }
};

struct B : public A {
    // Comment this line out
    ~B() = default;
};

// 2
struct C {
    ~C() { std::cout << "~C()\n"; }
};

struct D {
    // Comment this line out
    ~D() = default;
    C c;
};

int main() {
    B b;
    D d;
    return 0;
}


text:
Q: Mifare Ultralight C Authentication on Android I have some Mifare Ultralight C tags for testing authentication.
The first time I read it with the app NXP TagInfo, I could see the following info:

(...)
Page 04 - Page 27: FULL OF 0s **(empty tag)**
Page 28: 00 00 -- --
Page 29: 00 00 -- --
Page 2A: 30 -- -- --
Page 2B: 00 -- -- --
Page 2C: 42 52 45 41
PAGE 2D: 4B 4D 45 49
PAGE 2E: 46 59 4F 55
PAGE 2F: 43 41 4E 21

The page 2C - 2F means that it had the default key "BREAKMEIFYOUCAN!" (425245414b4d454946594f5543414e21).
Then I ran my Android app which basically did this:

*

*Write 49454D4B41455242214E4143554F5946 starting from page 2C till page 2F (for authenticating).

*Write 0x04 at page 2A (42); meaning all the pages from 2A on need authentication.

*Write 0x00 at page 2B (43); meaning authentication is needed both for reading and writing.

//Start authenticating
byte[] result1 = mifare.transceive(new byte[] {
                (byte)0xA2,  /* CMD = WRITE */
                (byte)0x2C,  /* PAGE = 44    */
                (byte)0x49, (byte)0x45, (byte)0x4D, (byte)0x4B  /* 49 45 4D 4B */
        });

byte[] result2 = mifare.transceive(new byte[] {
                (byte)0xA2,  /* CMD = WRITE */
                (byte)0x2D,  /* PAGE = 45    */
                (byte)0x41, (byte)0x45, (byte)0x52, (byte)0x42  /* 41 45 52 42 */
        });

byte[] result3 = mifare.transceive(new byte[] {
                (byte)0xA2,  /* CMD = WRITE */
                (byte)0x2E,  /* PAGE = 46    */
                (byte)0x21, (byte)0x4E, (byte)0X41, (byte)0X43  /* 21 4E 41 43 */
        });

byte[] result4 = mifare.transceive(new byte[] {
                (byte)0xA2,  /* CMD = WRITE */
                (byte)0x2F,  /* PAGE = 47    */
                (byte)0X55, (byte)0X4F, (byte)0X59, (byte)0X46  /* 55 4F 59 46 */
        });
//Finish authenticating

//Say the pages the card needs authentication
byte[] result5 = mifare.transceive(new byte[] {
                (byte)0xA2,  /* CMD = WRITE */
                (byte)0x2A,  /* PAGE = 42    */
                (byte)0x04, (byte)0x00, (byte)0x00, (byte)0x00  /* Message = All pages after 04 needs authentication */
        });

byte[] result6 = mifare.transceive(new byte[] {
                (byte)0xA2,  /* CMD = WRITE */
                (byte)0x2B,  /* PAGE = 43    */
                (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00  /* Message = authentication is required both for reading and writing */
        });
//Finish "card activition"

After doing this, I read the tag again using the NXP TagInfo app, and as expected, I couldn't see the tag info anymore. Instead of that, it indicated .p XX XX XX XX on all fields (from 04 on), which indicates it needs password for reading the data.
After that (and here is where I can't see my mistake) I tried to authenticate the tag again (by writing to pages 2C - 2F), but I get this error at the beginning of the authentication part:

System.err: java.io.IOException: Transceive failed
System.err:     at android.nfc.TransceiveResult.getResponseOrThrow(TransceiveResult.java:52)
        at android.nfc.tech.BasicTagTechnology.transceive(BasicTagTechnology.java:151)
        at android.nfc.tech.MifareUltralight.transceive(MifareUltralight.java:215)**

I can't see what I'm doing wrong...

A: What you are doing wrong is that you did not actually implement the MIFARE Ultralight C authentication. On MIFARE Ultralight C tags, writing to pages 0x2C..0x2F does exactly what the command says: It writes to that pages, but it does not perform any authentication.
Instead, MIFARE Ultralight C implements a three-way mutual challenge-response authentication protocol. This protocol is started by sending an AUTHENTICATE command:
byte[] result1 = mifare.transceive(new byte[] {
            (byte)0xA1,  /* CMD = AUTHENTICATE */
            (byte)0x00
});

In response to that command, you will get a challenge that you need to decrypt using the authentication key, manipulate, encrypt and send back to the tag to proof that you actually posess the authentication key. You can find some code that implements MIFARE Ultralight C authentication in this Q/A: Android: Authenticating with NXP MiFare Ultralight C.


text:
Q: Rails - change column name in model for MS SQL server I have to use Rails with an existing MSSQL DB.
I have created two models - Order and Items and created association between them (1 to many)
class Order < ActiveRecord::Base
  self.table_name  = 'mobile_orders'
  has_many :items
end

class Item < ActiveRecord::Base
  self.table_name  = 'mobile_items'
  belongs_to :order
end

In mobile_items table I have a column named 'order_no'.
I tried to check the association in Rails but when I do this:
order = Order.last
order.items

the adapter is running query looking for 'order_id' (when my column name is 'order_no'), e.g:
EXEC sp_executesql N'SELECT [mobile_items].* FROM [mobile_items] WHERE [mobile_items].[order_id] = @0', N'@0 int', @0 = 9  [["order_id", 9]]

Is there a way to to use 'order_no' for this query?
I have tried this in Order model but no luck:
alias_attribute :order_id, :order_no

A: Sure, you can specify the foreign_key option:
belongs_to :order, foreign_key: :order_no

Look for foreign_key option in Giudes on belongs_to and Associations docs.


text:
Q: Removing badge from button in sencha touch How can I remove the button badge based on condition like if badgetext is less than 0.

A: Hi u can get the badgetext value using var badge  = getBadgeText( ); it will return a string check if its equal to 0 if condition true hide it as simple as that...

A: Though it is an old one, I found this question while searching for the answer to similar problem. I sorted it out like :
        switch(myStore.getCount()){
            case 0:
                view.down('#someButton').setBadgeText('');
                break;
            case 1:
                view.down('#someButton').setBadgeText('1 Image');
                break;
            default:
                view.down('#someButton').setBadgeText(myStore.getCount() + ' Images');
        }

So I guess, just using the view.down('#someButton').getBadgeText() and comparing it to length you desire can be done.


text:
Q: SQL Query required where we should not used the group by and data count based on dep_id Need your help in getting the SQL Query.
1. I have one table which is having following columns
Name         Null?    Type
------------ -------- ------------
EMP_ID       NOT NULL NUMBER(2)
DEP_ID                NUMBER(2)
SALARY                NUMBER(14,3)
NAME1                 VARCHAR2(50)
NAME2                 VARCHAR2(50)
JOINING_DATE          DATE

Now I want the result - COUNT(1) based on DEP_ID without using GROUP BY .
EXAMPLE :
select DEP_ID,COUNT(1) from unipartemp group by DEP_ID;

DEP_ID COUNT(1)
1       2
2       2
3       1

What is the Query where we should get the same result but we should not use group by ...
Please suggest .

A: I am assuming that the result u r looking for is the count of the distinct dept_id. Try using the distinct(dept_id) to get the result.


text:
Q: Copy image and paste to OCR Running Win 7. Is there OCR freeware that easily allows copy of a picture and paste into the conversion program. I have no scanner at this time. Want to convert stored images.

A: Google docs will run OCR on images uploaded as files or pdfs. It's not copy paste but it's free and pretty good.
If you don't have a pdf creator program, install PDF Creator from sourceforge to create the pdfs that you'll then upload to google docs.

A: Any chance you have Office installed?  OneNote will do this.


text:
Q: Can I manage to change the font of tmux status line, making it different from the terminal? As the title says:
Can I manage to change the font of tmux status line, making it different from the terminal?
I'm using iTerm2 on macOs High Sierra, and I want to change the font of my tmux status line, making it different from the terminal's font. Is there any config I can use to make it?

A: No, Tmux has no ability to use a different font than the parent terminal.


text:
Q: If else statement for javascript click event I have two statements. What I am trying to do is when someone clicks on #area_a then hide then entire #area_b div without activating the focusout for the #area_b_textbox.  But I've tried different code (which I am not including here because it is incorrect and want to get your suggestions) and what is happening is it is activating the focusout everytime I click on the #area_a div.
JQuery base actions
$("#area_a").click(function() { $("#area_b").hide(); });

$("#area_b_textbox").focusout(function() {$("#area_b_error").show();});

HTML:

  <input id="area_b_textbox">

Thanks!

A: this is not possible since you loose the focus automatically when you click somewhere else...
What you need to do is to unbind the focusout event on hover of the #area_a and rebind it later on...
$("#area_a").click(function() {
   $("#area_b").hide()
}),hover(
  function(){
    $("#area_b_textbox").unbind("focusout")
  },
  function(){
    $("#area_b_textbox").focusout(function() {$("#area_b_error").show();});
  }
)

PS: what is your ultimate goal here?

A: Why not just add a flag to ignore next focusout (blur?) event.
ignoreNextFocus = false;
$("#area_a").click(function() { ignoreNextFocus=true; $("#area_b").hide(); });
$("#area_b_textbox").focusout(function() { if(!ignoreNextFocus)$("#area_b_error").show();ignoreNextFocus=false;});

On that note setting the flag on click event might be too late. If it is the case, try mousedown event.

A: You could hack around the problem with a timer. Timers usually smell bad but I think it is your safest bet here. If you try using hover or other mouse events you might run into trouble with keyboard navigation and activation or the lack of "hoverish" events on touch interfaces (and we can't pretend those don't exist anymore).
Something like this:
var timer_kludge = {
    start: function(fn) {
        this.id = setTimeout(fn, 200);
    },
    stop: function() {
        if(this.id)
            clearTimeout(this.id);
        this.id = null;
    },
    id: null
};

$('#area_a').click(function() {
    timer_kludge.stop();
    $('#out').append('
click
');
});
$('#area_b_textbox').focusout(function() {
    timer_kludge.start(function() {
        $('#out').append('
textarea focusout
');
    });
});
$('#area_b_textbox').focusin(function() {
    timer_kludge.stop();
});

Demo: http://jsfiddle.net/ambiguous/s8kw8/1/
You'd want to play with the 200 timeout a bit to see what works best in your circumstances.

A: I'm not sure this is possible since by definition the focus has to leave the #area_b_textbox if the user is going to click a button.


text:
Q: Are there any scenario where VMM will fail to inject an interrupt into a guest on Interrupt window exit? I am working on a custom Type 2 Hypervisor. My question is related to interrupt injection of emulated devices in the guest.
Scenario:
The guest did some vmexit, before the next vmresume VMM found out that there is a pending interrupt present in the emulated interrupt controller. VMM requests for Interrupt Window Exit(IWE) on the subsequent vmresume.
Once we get an IWE VMM writes the interrupt info into VM-entry interruption-information field 4016H and resumes guest execution.
Question:
Is it guaranteed that the interrupt will be injected in the guest and handled through the guest IDT?
Are there cases where interrupt injection can fail?
I am seeing a scenario where instead of going into the corresponding guest IDT entry, the guest resumes and starts executing something else in the guest kernel.
Details:
Windows 64 bit guest, Intel VTx

A: There are reasons that an interrupt cannot be injected, but they will cause vm entry failure; it will never just ignore the injected interrupt. Examples are if IF is clear or if the previous instruction loaded SS, so interrupts are blocked for one instruction. However, when those cases apply, you wouldn't have gotten an interrupt window exit.
Probably  the interrupt wasn't injected. One reason I can think of that that could happen is if  the vm-entry interrupt information field was set up to deliver a fault, so an interrupt can't be delivered at the same time.


text:
Q: Convert 2D planes to 3D model We have a multiple 2D planar image of an object scanned from a fan-beam perspective. An example is in Fig 5 below. We have multiple grainy dotted planes to scan the whole image.

The issue with these images is that they cannot be directly mapped to a 3D plane due to the fan beam deformation.
Is there correction algorithms/methods that can be recommended so that these planes can be correctly mapped to 3D plane and an object can be reconstructed properly?

A: Depending on how you store your data, there might be various approaches. Guessing that you store the data as points ("grainy dotted planes"), you can do an interpolation of the corresponding points in the consecutive planes and thereby get the scan of the entire object. It does require the points to be in the same frame, so you might have to do some kind of transformation to find the parameters of each plane to a global framework.
Another procedure might be use of a least square fitting of each plane which can then be used to map together the object. You might find some helpful approaches of scanning 3d objects using 2d methods. Hope this helps.


text:
Q: jQuery mobile youtube video black I embedded a youtube video into a tabview and it works fine. The fact is that if I changed a tab I stopped the video via javascipt, but if I came back to the youtube video tab, the video frame is all in black. It is not possible to press start or anything.
I use this code to stop the video because I have a lot of pages with tab videos:
$('.byngitek').click(function () {
       var i = 0;
       $(".youtubeplayer").each(function () {
           $(this).attr("id", "youtubeplayer" + i);
           callPlayer("youtubeplayer" + i, "stopVideo");
           i++;
       });
   });

I grab some code for example here: http://jsfiddle.net/iruindegi/t3suE/
1-. Play de video
2-. Click on "Materiales" tab (it will stop the video and change tab)
3-. If you click again in the first tab (sorry I know that the code is not complete, but I´m in a rush)
4-. In Chrome, Firefox... works, I can see the video controllers and everything, but on the iPad is not working. Look screen captures.
before: http://imageshack.us/photo/my-images/856/img0034v.png/
after: http://imageshack.us/photo/my-images/46/img0035k.png/
any help?
thanks in advance

A: pauseVideo instead of stopVideo

player.pauseVideo():Void
Pauses the currently playing video. The final player state after this
  function executes will be paused (2) unless the player is in the ended
  (0) state when the function is called, in which case the player state
  will not change.
player.stopVideo():Void
Stops and cancels loading of the current video. This function should
  be reserved for rare situations when you know that the user will not
  be watching additional video in the player. If your intent is to pause
  the video, you should just call the pauseVideo function. If you want
  to change the video that the player is playing, you can call one of
  the queueing functions without calling stopVideo first.

Source: Playback controls guide.
Click me!


text:
Q: Pass argument from a constructor to a constructor of a different class May be a silly question, but I could not find any info on this on the web. How can I pass an argument from the body of the constructor to a constructor of a different class? For example, if I have two classes, A and B:
        class A   {
        private Object ob;
        public A(String str)   {
            ob = new Object();
         }
       }

     class B   {
        String str;
        public B(Object object)   {
          // pass Object argument from constructor of class A here.
        }
       }

I need to pass variable ob initialized in constructor of class A into the constructor of class B. Thank you in advance!

A: You can have a private B b in the A class, then just like any other object, you can make a new B(str), and assign it to the field


text:
Q: Debug as root in VSCode under linux The project I am developing needs to use one of linux real-time schedulers, for priority scheduling.
Since it needs root permission to change the scheduler to a real-time one, I changed the owner of the compiled program with root and set the SUID bit, so that when I try to execute it I gain the right permission to change the scheduler.
However, running it in debug mode under VSCode (using the gdb debugger) seems to ignore the SUID of the file, executing it with my underprivileged user.
How can I set up VSCode in order to execute gdb with root privileges?
Is there any other way than executing the whole VSCode as root to gain privileges only when debugging?


text:
Q: select row based on what a substring in a column might contain I'm looking to select the primary key of a row and I've only got a column that contains info (in a substring) that I need to select the row.
E.g. MyTable

ID | Label

------------
11 | 1593:#:#:RE: test
12 | 1239#:#:#some more random text
13 | 12415#:#:#some more random text about the weather
14 | 369#:#:#some more random text about the StackOverflow

The label column has always a delimiter of :#:#:
So really I guess,  I'd need to be able to split this row by the delimiter, grab the first part of the label column (i.e. the number I'm looking) to get the id I wanted.
So, If I wanted row with ID of 14, then I'd be:
Select ID from MyTable
where *something* = '369'

Any ideas on how to construct something ..or how best to go about this:)
I'm completely stumped and haven't been able to find how to do this.
Thanks,

A: How about:
WHERE label LIKE '369#%'?

No reason to get fancy.
Although.. if you are going to do this search often, then maybe pre-split that value out to another column as part of your ETL process and index it.


text:
Q: HTML Table Stuck So far, I have got several things going well until my table will not go below my lists.
It is stuck at the top, and when I try and table { margin-top: 100px} it moves the table down from the top, but also moves everything below it down, I am wanting it below everything.

<!DOCTYPE html>

  <title>HTML Project</title>

My favorite games

Arma 3 -  HERE

World of Tanks -  HERE

Grand Theft Auto V -  HERE

Counter Strike: Global Offense -  HERE

Digital Combat Simulator World -  HERE

My favorite movies

Ant-Man -  HERE

Deadpool -  HERE

Jurassic Park -  HERE

Jurassic World -  HERE

Curious George -  HERE

          Game
          Publisher(s)
          Realese Date
          Platform(s)

          Arma 3
          Bohemia Interactive
          September 12, 2013
          Microsoft Windows | macOS

A: there is an issue with positions wrappers I have fixed the issue

<!DOCTYPE html>

    <title>HTML Project</title>

My favorite games

            Arma 3 -  HERE

            World of Tanks -
             HERE

            Grand Theft Auto V -
             HERE

            Counter Strike: Global Offense -

              HERE

            Digital Combat Simulator World -

              HERE

My favorite movies

Ant-Man -  HERE

Deadpool -  HERE

Jurassic Park -  HERE

Jurassic World -  HERE

Curious George -  HERE

          Game
          Publisher(s)
          Realese Date
          Platform(s)

          Arma 3
          Bohemia Interactive
          September 12, 2013
          Microsoft Windows | macOS

output can be seen here in full screen: https://4rrmg.csb.app/
with sandbox : https://codesandbox.io/s/cool-mayer-4rrmg?file=/index.html:0-3450


text:
Q: Can I move an existing iPhoto library to a location on a network-drive so I can use it from multiple apple computers? How do I do that? (including what I need to do to iPhoto on all my apple computers)
Are there any disadvantages?

A: You can do it, but do it with caution. I've run network home directories before, which is essentially what you're describing, and iPhoto supports it fine. On your standard Desktop OS, simply create alias to the iPhoto library on your network share in your User home directory photos folder. You can also set iPhoto to use a new library in a new location by opening iPhoto with Option (Alt) held down, where it will then prompt you to locate the new library (which would be on your network share).
The biggest issue you'll have to address is ensuring it's not open and being edited by two iPhoto instances at the same time. I'm not 100% sure how it will behave, but you can bet not well. You could get situations where photos become orphaned, etc.

A: You should note that iPhoto needs to have the Library sitting on disk formatted Mac OS Extended (Journaled). Users with the Library sitting on disks otherwise formatted regularly report issues including, but not limited to, importing, saving edits and sharing the photos.
Recent versions of iPhoto will not allow you to move or create a library on a NAS.
Workaround: Put the library on a Disk Image formatted Mac OS Extended (Journaled) and store that on the NAS

A: To answer your question:~ You should be able to drag the iPhoto Library from the pictures folder in your home directory straight to the networked drive. If it's refusing to do that then you might have to re-check ur permissions from GET INFO.
It will be easier for you to share your library by going into iPhoto preferences and and sharing tab, assuming you are using 10.6 Snow Leopard.


text:
Q: How to prevent Parallel.For to unlock the UI thread? Yes, if you call do a Parallel.For from main thread of a WinForms application you'll see that the message pump starts processing WM_ messages while the Parallel.For is crunching.
Is there a way to avoid this? I mean, to do the work in parallel and freeze the UI completely?
Thanks.


text:
Q: How to use a custom installed font? I downloaded a few fonts from the following website(https://www.fontspace.com/category/tech) to use in my own project, however I'm not sure how to use the fonts in vsCode
I've done the following in an attempt
css file
@font-face {
  font-family: myFirstFont;
  src: url(a-Astro-Space.ttf);
}

  font-family: myFirstFont;
}

a-Astro-Space.ttf is the name of the file, however I installed it using the typical font installer
html file
<header>
<div>
    Geoff's Computer Service
</div>
</header>

When I do this, the header is set to the default font and nothing changes

A:
a-Astro-Space.ttf is the name of the file, however I installed it using the typical font installer

The src for @font-face needs to be the URL to the font file. If you want to use @font-face, then it doesn't matter if the font is installed on the end user's system or not.
(Note that font loading is subject to the Same Origin Policy so you'll need to load the website over HTTP and not from a file: scheme URL).
If you want to depend on the font being installed on the end user's system, then don't use @font-face, just use the font name (as it is installed under on the end user's system, not the file name) in font-family.

  font-family: myFirstFont;
}

You're missing the selector here.

A: Save your fonts to a folder, for example "fonts".I have saved my fonts as astro-space.ttf into my new folder called "fonts"
In your css write the following code:
@font-face {
    font-family: 'myFirstFont';
    src: url('fonts/astro-space.ttf') ;
}
h1 {
    font-family: 'myFirstFont';
}

Make sure that your src path is correct and dont forget to put "" into the url() so it looks like this src: url("yourFile");


text:
Q: FabricTransportServiceRemotingClientFactory TraceId -- how to access it on the service side? I have a service fabric project - there is an APIGateway (Facade) that hosts the public webapi layer. It talks to a few different microservices (not exposed publicly) via Fabric Remoting v2.
Now, I want to pass a TraceId (basically HttpContext.TraceIdentifier) from the APIGateway service to the Microservice(s) for tracing/logging purposes. I see that the FabricTransportServiceRemotingClientFactory object (which is the client side svc proxy) takes a TraceId, which is great. However, how do I access this traceId on the listener side so that the logger can emit that traceid so I can eventually search for all logs across multiple services for that same Http request using the same traceId.
APIGateway (client) code
    public MyController()
    {
        // explicitly create V2 remoting client (as listener is V2)
        var proxyFactory = new ServiceProxyFactory((c) =>
        {
            return new FabricTransportServiceRemotingClientFactory(
                traceId: traceIdentifier // <--- from HttpContext, for logging
                );
        });

        _svcProxy = proxyFactory.CreateServiceProxy<IMyService>(
            ServiceUri,
            listenerName: MyMicroservice.Models.Constants.ListenerName);
    }

A: The ServiceContext has a property TraceId  you can use. See the docs
Example:
public sealed class Stateless1 : StatelessService, IStateless1
{
    public Stateless1(StatelessServiceContext context)
        : base(context)
    { }

    public string SayHello()
    {
        return $"Hello World (traceid: {Context.TraceId}";
    }

    protected override IEnumerable<ServiceInstanceListener> CreateServiceInstanceListeners()
    {
        return new[]
        {
            new ServiceInstanceListener((c) => new FabricTransportServiceRemotingListener(c, this))
        };
    }
}


text:
Q: Is using temporary placeholders for CSV special characters a bad practice? I'm working with a lot of CSV files with many different formats and usually written by hand by common users, so there are a lot of ; , \n and \t and such inside the fields, this kind of characters usually cause trouble when parsing the data or generating new CSV files, and i usually remove such characters beforehand, but today i found the following code in an old program :
It reads data from a resultSet and concatenates each value into a String to form a row, and to deal with separators (we usually use ;), this code first used a temporary flag like #TempSeparator# to divide each field, then, when the row is complete, applies a replaceAll(";","") to remove the fake separators, and after that, a replaceAll("#TempSeparator#", ";") to form a valid row
I actually thought that was a clever way to avoid unnecessary calls for each field, and doing the replacements only to the full line, but I don't think its the best or even optimal way to do so.
Is this really a bad practice?

A: It is not very bad, but also not the best approach.
Use standard libraries wherever possible. Here is a list of fine libraries, of which SuperCSV is particularly strong in supporting CSV variants. These libraries follow best practices: Special characters are escaped when used inside a field, or the field is wrapped (usually with quotes).
If the CSV is already malformed so that special characters appear inside the fields without proper escaping or wrapping, then you have a data-cleaning problem on your hands, to be solved in some other way. Replacing the character with your temporary placeholder will not fix that, as the placeholder will likewise appear both inside the fields and between them.

A: This approach doesn't sound very elegant to me. You describe:

*

*Per input field, concatenate it onto a single string using #TempSeparator#

*Eliminate all ; from the resulting string

*Replace all occurrences of #TempSeparator# with ;
That's 3 steps. How about instead:

*

*Per input field, strip out all ;

*Then, concatenate it onto a single string using ;
It's a step less. Therefore, better.
Some example code to show off why this is simpler:
stream-style:
collection.stream().collect(Collectors.joining("#TempSeparator#"))
    .replace(";", "").replace("#TempSeparator#", ";");

vs.
collection.stream().map(x -> x.replace(";", ""))
    .collect(Collectors.joining(";"));

A: It is overdesigned, an unnecessary artifact.
At least use a constant char:
private static final char TEMP_SEPARATOR = '\u001f';

*

*Often the tab does not occur in text \t and it is an ideal separator.

*Otherwise a control character would do: Unit Separator \u001f. Possibly a Unicode one.

*An almost otherwise unusable char is \u0000.

The advantage is its efficiency:
s = s.replace(';', ',').replace('\u0000', ';');

The best solution still being replacing the separator of the cell value itself.
As probably has to be done for newlines.
Concerning the final separator: IMHO tab is a better choice than semicolon, because replacing tabs with spaces does change the text only w.r.t. whitespace. That is: no requirement can arise. Like the room number must be floor ";" number.


text:
Q: Android FUNF open sensing framework v0.4 - how to change probe schedule at runtime I would like to be able to start/stop probes dynamically - similar to the FUNF Journal app - and also to alter the configuration of the probes (interval, duration) at runtime. I managed to start/stop the probes, as shown in the Funf Wifi scanner tutorial. To change the configuration I tried to hand over a JSON object containing the schedule and type of the probe but the schedule seems to be ignored.
JsonObject config = new JsonObject();

        Schedule.BasicSchedule schedule = new BasicSchedule();
        schedule.setDuration(new BigDecimal(duration));
        schedule.setInterval(new BigDecimal(period));

        JsonObject scheduleJsonObject = mFunfManager.getGson().toJsonTree(schedule).getAsJsonObject();
        scheduleJsonObject.remove(TYPE);

        config.add("@schedule", scheduleJsonObject);
        config.addProperty("@type", "edu.mit.media.funf.probe.builtin.AccelerometerSensorProbe");

        AccelerometerSensorProbe accelerometerProbe = mFunfManager.getGson().fromJson(config, AccelerometerSensorProbe.class);
        accelerometerProbe.registerPassiveListener(MainActivity.this);

Thanks for your help!