text:
Q: php--glob for searching directories and .jpg only What if I want to search for a only subdirectories AND certain file types.
Ex. I have a folder named "stuff" where random stuff is uploaded. And say I want to search for just subfolders AND .jpg files within "stuff" and nothing more. I know to search for only .jpg is…
$array = glob('stuff/{*.jpg}', GLOB_BRACE);
and to search for only subdirectories is…
$array = glob('stuff/*', GLOB_ONLYDIR);
…but how do I combine the two without getting any other unwanted files? Is there a pattern for subirectories for GLOB_BRACE?

A: This recursive function should do the trick:
function recursiveGlob($dir, $ext) {
    $globFiles = glob("$dir/*.$ext");
    $globDirs  = glob("$dir/*", GLOB_ONLYDIR);

    foreach ($globDirs as $dir) {
        recursiveGlob($dir, $ext);
    }

    foreach ($globFiles as $file) {
        print "$file\n"; // Replace '\n' with '
' if outputting to browser
    }
}

Usage: recursiveGlob('C:\Some\Dir', 'jpg');
If you want it to do other things to the individual file, just replace the print "$file\n" part.
The function can be more specific in its glob searches and only match directories as well as files with the specified file extension, but I made it this way for simplicity and transparency.

A: I'm not sure I am following exactly because with one you are looking for a specific file type, and with the other you are looking for subdirectories. Those are completely different patterns!
That being said, a way to have an array containing all *.jpg files in stuff/ and also subdirectories in stuff/ would be to take your code a step further:
$jpg_array = glob('stuff/{*.jpg}', GLOB_BRACE);
$subdir_array = glob('stuff/*', GLOB_ONLYDIR);

// Combine arrays
$items = array_merge($jpg_array,$subdir_array);

// Do something with values
foreach($items as $item)
{
   echo($item . "
");
}


text:
Q: Resolve hostnames with NetBIOS instead of mDNS on Linux Immediately after installing Debian 9 Stretch, the avahi-daemon has already been installed, so it is working to send a ping between Linux with avahi-daemon installed on each of them.
For example, when there is a named 'alice', $ ping alice.local returns a normal response.
I want to do the following things:

*

*I want to resolve names of Windows from Linux, but I do not want to install the Bonjour or something like that on Windows.

*I want to resolve names with NetBIOS (WINS) instead of mDNS.

*I do not want to add a suffix such as .local in the name.

So I deleted avahi-daemon and installed winbind.
# dpkg --purge avahi-daemon libnss-mdns
# apt-get install winbind libnss-winbind

And, added setting to use 'wins' in /etc/nsswitch.conf. e.g. hosts: files dns wins
With the above setting, $ ping mywindows will not respond. However, $ nmblookup mywindows can successfully get the IP address.
Previously, when I was using Debian 8 Jessie, it should have been successful, but using Debian 9 Stretch will not be my expectation.
Is there something missing?

redpajama_set_name: RedPajamaStackExchange


text:
Q: Animation does not work on Safari and mobile I have a bit of animation which works perfectly in chrome but doesn't on safari. Weird isn't it? Ok here's my code:

Ok this doesn't work in Safari and mobile as I said, there's no movement whatsoever.
Also, still and only in Safari and mobile, on safari its become border squere
What am I doing wrong?
here is my css
header{
  min-height: 100vh;
  background-color: #42A5F5;
  position: relative;
  overflow: hidden;
}

.ripple-1,
.ripple-2,
.ripple-3,
.ripple-4,
.ripple-5{
   height: 1px;
    width: 1px;
    position: absolute;
    left: 50%;
    bottom: 50%;
    background: dodgerblue;
    border-radius: 50%;
    transform: translate3d(-50%, 50%, 0);
    animation-name: ripple;
    animation-duration: 8s;
    animation-iteration-count: infinite;
    animation-timing-function: ease-out;
    will-change: transform, opacity;
}

.ripple-1{
  animation-delay: 0;
}

.ripple-2{
  animation-delay: 1s;
}

.ripple-3{
  animation-delay: 2s;
}

.ripple-4{
  animation-delay: 3s;
}

.ripple-4{
  animation-delay: 4s;
}

.ripple-5{
  animation-delay: 5s;
}

main{
  height: 4000px;
  background-color: #f7f7f7;
}

@keyframes ripple{
  0%{
    transform: translate3d(-50%, 50%, 0) scale(0);
    opacity: .33;
  }
  100%{
    transform: translate3d(-50%, 50%, 0) scale(2000);
    opacity: 0;
  }
}

I tried -webkit-, but didnt work :(

A: use the below css it will work fine on safari as well.
header{
  min-height: 100vh;
  background-color: #42A5F5;
  position: relative;
  overflow: hidden;
}

.ripple-1,
.ripple-2,
.ripple-3,
.ripple-4,
.ripple-5{
   height: 1px;
    width: 1px;
    position: absolute;
    left: 50%;
    top: 50%;
    background: dodgerblue;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    animation-name: ripple;
    animation-duration: 8s;
    animation-iteration-count: infinite;
    animation-timing-function: ease-out;
    will-change: transform, opacity, width;
    r
}

.ripple-1{
  animation-delay: 0;
}

.ripple-2{
  animation-delay: 1s;
}

.ripple-3{
  animation-delay: 2s;
}

.ripple-4{
  animation-delay: 3s;
}

.ripple-4{
  animation-delay: 4s;
}

.ripple-5{
  animation-delay: 5s;
}

main{
  height: 4000px;
  background-color: #f7f7f7;
}

@keyframes ripple{
  0%{
    opacity: .33;
  }
  100%{
    opacity: 0;
     height: 2000px;
    width: 2000px;
  }
}


text:
Q: Could you teach me a word which means do not change and stay as before? Would you kindly teach me a word for the meaning below?
I am planning to replace a system consist of some computers and electrical devices connected by wires.
As some of the components are not so old, so we do not change those components.
Do you recomend me what to say to keep a part of  the system as before inspite of the other part is changed?

A: You are going to retain those components.

*to hold in position

A: I would use 'retain' as suggested above, eg:
We will be retaining some parts of the system, replacing older elements with new equipment.
Or,
We will be updating older elements of our system with new equipment.
To explain that you are keeping only the newer parts you can say:
We will be retaining some newer parts of the system, replacing older elements with new equipment.
You can also use 'augment' meaning 'to add to':
We will be augmenting our existing system with some newer parts, replacing older elements with new equipment.
You can also say 'extend the life of'
We will be extending the life of our existing system by replacing some of the old parts with new.
Or 'renew'
We are renewing our existing system by replacing some old parts with new.
Or 'optimise'
We are optimising our existing system, renewing some older parts and adding some completely new elements.

A: You could stay to keep it static

A: How about refresh?
MW:
refresh: To update or renew (something, such as an image, a display screen, or the contents of a computer memory) especially by sending a new signal.
Refresh can apply to both software and hardware, and it need not apply to all components at the same time.


text:
Q: Struct. pack error in python 3 - struct.error: argument for 's' must be a bytes object I know this question has been asked before, and some of the suggestions seem to be about needing a b to make the string a byte literal. However, im passing hex code to the function as 0x414243 to save it as ABC.
def _pack(_data, size):
    numofbytes = size/8
    print("Chars Expected: " + str(numofbytes))
    formatString = "{}s".format(int(numofbytes))
    print("Formatted String:" + formatString)
    struct.pack(formatString,_data)

_pack(0x414243,24)

I'm not sure what to change here,  im wondering if its a problem with how im using formatstring variable. I want the function to be able to work out how many chars are in the passed data from the size and in this case 24 bits = 3 bytes so it formats 3s  and passes 0x414243 to convert to ABC.
Can anyone advise how to get past the error.

A: As the error message says, struct.pack() wants a group of bytes and you're giving it an integer.
If you want to be able to pass the data in as an integer, convert it to bytes before packing it:
_data = _data.to_bytes(numofbytes, "big")   # or "little", depending on endianness

Or just pass the data in as bytes when you call it:
_pack(b"0x410x420x43", 24)

If you have a string containing hexadecimal, such as "0x414243", you can convert it to an integer, then on to bytes:
_data = int(_data, 16).to_bytes(numofbytes, "big")

You might use isinstance() to allow your function to accept any of these formats:
if isinstance(_data, str):
    _data = int(_data, 16)
if isinstance(_data, int):
    _data = _data.to_bytes(numofbytes, "big")

By the way, your calculation of the number of bytes will produce a floating-point answer if size is not a multiple of 8. A fractional number of bytes is an error. To address this:
numofbytes = size // 8 + bool(size % 8)

The + bool(size % 8) bit adds one to the result of the integer division if there are any bits left over.


text:
Q: Can I use alias field names in django templates? I'm new to django and python...
I have a model which includes 10 generic fields attrib_00 through attrib_09.
I pass these fields as a context to a django template string.
I would like to use more meaningful names in the template.
The template strings are fetched from another model and I have in mind adding a field containing a comma delimited list of associated alias names. The idea being the first alias in list maps to attrib_00, the second to attrib_01...
I'm thinking I need to modify the context before rendering so the generic keys are replaced with the alias's.
Am I on the right track here?
Is there a better way?
Thanks,
Ed
P.S.
(add comment button not working for me?)
I don't really have any code yet. Maybe I should explain what I'm trying to acheive...
I have an existing application written in delphi that helps me maintain a large number of ebay listings and I would like to emulate this as a django/python web application.
Each product/listing belongs to a category and each category has a set of attributes. So for example trousers might have color, waist_size and leg_length. The number and type of attributes for each category varies but never exceeds 10.
I can see how for example attrib_00 could be used for size in one category and say metal in another but then would be stuck with using the generic field names in the template.
Just for info:- I guess I would be doing any looping in the view with multiple calls to the rendering process before returning a response?

A: I would say to make your aliases in the context before passing from the view to the template.  Something along the lines of:
c = Context({'foo': attrib_01, 'bar': attrib_02, ...})

You can plug this into a new function so that you don't break DRY and you're good to go.
Update:
As far as actually mapping this within the template, not so much.  The template is, after all, just a template.  The only thing coming close to working like you're thinking is a {% with %} block:
{% with attrib_01 as foo %}

{{ foo }}

{% endwith %}

It would likely work, but I fear it could get rather ugly.

A: How about using translations?
attrib_00 = models.TextField(_('attrib_00'), blank=True, null=True)

And then have different translations for attrib_00 as required.


text:
Q: how can I copy the content of popup box in javascript or jquery I want to open a URL (of another domain) in a popup box and then want to copy the whole content of that web page's contents either into the clipboard or in a variable. So that I can use it in my web application.
My code is like
function openWin()
{
    myWindow=window.open("http://www.abcxyz.com","","width=400,height=200");

    //some code for copy content
    myWindow.close();
}

This function displays the webpage that i want to access. What I need is to copy that content.
NOTE:

*

*I can't use AJAX to copy the contents of the URL (it produces an error because of the same origin policy).

*I can't use cross domain AJAX: the web url replies only after authentication and cookies are stored in my browser, so the request must be initiated by the browser, not from any server.

A: Maybe you can try this:
function openWin(){
   m = window.open("some.url.here");
   m.addEventListener("load", function(){func(m);});
}

function func(v){
   var c = v.document.body.innerHTML;
   v.close();
}


text:
Q: Let $X_t=\int_0^t f(X_s)ds+W_t$ where $f$ is continuous. Why $X\in W^{1,2}$? Let $W^{1,2}=\{X\in L^2([0,T]\times \Omega ), X'\in L^2([0,T]\times \Omega ) \}$.
Let $$X_t=\int_0^t f(X_s)ds+W_t,$$
where $f$ is Lipschitz continuous with linear growth and $W$ is a Brownian motion. We set $Z_t=X_t-W_t$. Then, in my exercise they claim that $X$ and $Z$ are in $W^{1,2}$. So, I agree that $Z\in W^{1,2}$ since $Z_t'=f(X_t)$. But why $X\in W^{1,2}$ ? What is the signification of $X_t'$ ?


text:
Q: Executing a command before starting a systemd service I want to execute a script before starting a service every time the service is started.
I know that I can use ExecStartPre inside the service definition file, but I wonder if it's possible to achieve without editing a file which comes from the service's package.
The script is a simple command which exits when it's done, it creates files which are used by the main service (it fetches TLS certificates and keys from secure storage).

A: Sure. You can use specific independant includes:
mkdir /etc/systemd/service/<servicename>.service.d
echo /etc/systemd/service/<servicename>.service.d/<anything>.conf << EOF
[Service]
ExecStartPre=<path to script>
EOF
systemctl daemon-reload

et voila.
Reference: Search for "drop-in" in systemd.unit — Unit configuration


text:
Q: JavaFX Execute operation every X ms while Window is open For my application I designed a simple log-window controlled by ShopLogController.java.

This window takes the log information from the ShopLog (not to be confused with ShopLogController) class and displays it. However, the ShopLog itself is possibly modified by every Object in existance. So a way to check if the content changed is needed, in order to keep the contents of the log-window consistent with the text-log inside the ShopLog class.
The options I explored to far:

*

*Implement a public update() function in ShopLogController that is called whenever the log changes.
This works fine, but IMO violates the strict seperation of GUI/logic/persistence layers, as the logic layer explicitly calls the GUI in order to prompt it to update.
(Should you believe that this is not a violation of the layer-seperation, please explain why)

*Implement some kind of updater object that runs in its own thread and calls update() from above every X miliseconds. Not allowed by JavaFX as this produces a java.lang.IllegalStateException: Not on FX application thread; currentThread = Thread-#

*Start a thread inside the corresponding controller. This also works fineish. The only problem is that the update would be sitting in an while(true) loop that never quits. A workable on-close method would be required to terminate this loop. I am not aware of such a solution for single windows, rather than whole applications. (See stop() )
How can I make my log (and other) window(s) update without explicitly prompting it to do so from outside; while still making the controller terminate on closing its window only?
As requested the code of the relevant objects:

The structure is as basic as it gets here. There's a String in ShopLog, and when it changes I would like the update() in ShopLogController to be called. I would also like to avoid explicitly calling any controller functions from ShopLog, as it cannot be guaranteed that one exists (e.g. the log window was not opened yet).
PS: This is not really about finding any workable solution, but about finding an elegant one.

A: You can implement your log (model) like this:
public class ShopLog {

    private final ReadOnlyStringWrapper logText = new ReadOnlyStringWrapper();

    public ReadOnlyStringProperty textProperty() {
        return logText.getReadOnlyProperty();
    }
    public final String getText() {
        return textProperty().get();
    }

    // Implement as many methods like this as your API needs:
    public void log(String logMessage) {
        logText.set(logText.get() + "\n" + logMessage);
    }
}

Clearly this class has no knowledge of the view (or the view's controllers/presenters), so does not violate the separation of view and model.
Your controller can look like this:
public class ShopLogController {

    private ShopLog log ;

    @FXML
    private TextArea logDisplay ;

    public void setShopLog(ShopLog log) {
        logDisplay.textProperty().bind(log.textProperty());
    }
}

So now when the log(...) method is called on the ShopLog, the text area in the view is automatically notified (via the binding), and will update the text displayed. The binding is managed from the controller, not the model, which preserves the appropriate separation of concerns. There is no need at all for any polling (with its arbitrary polling intervals and threading to manage).
As an aside, this is not a particularly scalable solution, because you are storing the data as one monolithic string and updating via string concatenation, with the display using a text area. I showed this implementation as it seems to be the one you are using (based on your comments and the screenshot). You might consider using other general implementations, such as the model using an ObservableList<String> logMessages instead.


text:
Q: Create a parent -> children hierarchy from two collections I have two separate collections instances filled with data
List<Parent> parents;
List<Child> children;

two collections can be connected through Child.ParentId, and Parent.Children.
parents collection does not have Children property populated, so how can I link Parent objects with Children?

A: Try this:
var result = from d in parents
             join s in children
             on d.ParentID equals s.ParentID into g
             select new
             {
                 ParentName = d.ParentName,
                 ChildList = g
             };

foreach (var item in result)
{
    Console.WriteLine("Parent: {0}", item.ParentName);
    foreach (var Child in item.ChildList)
    {
        Console.WriteLine(Child.Name);
    }
    Console.WriteLine();
}

A:  children.Join(parents,
                c => c.ParentId,
                p => p.ParentId,
                (c, p) => new { children = c, parents = p })
                .Select(x => x.parents).ToList();

Update
var result = parents.Join(children,
                     p => p.ParentId,
                     c => c.ParentId,
                     (p,c) => new { parents = p,children = c  })
                     .Select(x => new
                     {
                         ParentName = x.parents.ParentName,
                         ChildList= x.children
                     })
                     //.GroupBy(x=>x.ParentName )
                     .ToList();


text:
Q: javascript reference in xslt I have a javascript file.
how can i reference that file from within XSLT.

A: <script type="text/javascript" src="yourfile.js"></script>

however if you are finding that it is self closing you need to add a space in like this
<script type="text/javascript" src="yourfile.js"> </script>


text:
Q: Stored procedure : query optimization The system had a stored procedure with 7 selects and uniting this using UNION. I have optimized but the query is still slow.
Is there any way to do it faster?
I tried do it faster using CASE, but is still slow. The time to execute is one minute.
Which indexes should I create, according to the query below?
CODE
ALTER PROCEDURE [dbo].[USP_DEN_S_CONTROLE_DIARIO]
(
    @CLI_N_CODIGO NUMERIC(18),
    @DATA_CONSULTA DATETIME
)
AS

DECLARE @DATA AS DATE = DBO.FUN_DEN_DATA_SEM_HORA(@DATA_CONSULTA)

SELECT DISTINCT
    PAC.PAC_N_CODIGO,
    PAC.PAC_C_NOME,
    PAC.PAC_C_MATRICULA,
    PAC.PAC_D_ULTIMA_VISITA,
    CASE ODO.ODO_PTR_N_CODIGO
        WHEN 2 THEN 'S'
        WHEN 1 THEN 'N'
        ELSE 'N'
    END AS ORCAMENTO,
    CTR.CTR_C_CODINTELIGENTE,
    CTR.CTR_N_VALOR_RECEBIDO,
    (SELECT SUM(VIN_N_VALOR) FROM DEN_VIN_VINCULO_TRATAMENTO WHERE VIN_OXD_ODO_N_CODIGO = ODO_N_CODIGO) AS VALOR_ORC,

    CASE WHEN CTR.CTR_DET_N_CODIGO IS NULL THEN
        (SELECT DET_C_NOME FROM DEN_DET_DENTISTA WHERE DET_N_CODIGO = PAC.PAC_DET_N_CODIGO AND DET_CLI_N_CODIGO = @CLI_N_CODIGO)
    ELSE
        (SELECT DET_C_NOME FROM DEN_DET_DENTISTA WHERE DET_N_CODIGO = CTR.CTR_DET_N_CODIGO AND DET_CLI_N_CODIGO = @CLI_N_CODIGO)
    END AS DENTISTA,

    CASE WHEN ODO.ODO_PTR_N_CODIGO IS NULL AND CTR.CTR_N_VALOR_RECEBIDO IS NULL
    THEN
        CASE WHEN
        (
        SELECT COUNT(*) FROM
            DEN_VIN_VINCULO_TRATAMENTO INNER JOIN DEN_ODO_ODONTOGRAMA ON VIN_OXD_ODO_N_CODIGO = ODO_N_CODIGO
        WHERE
            ODO_PAC_N_CODIGO = PAC_N_CODIGO AND ODO_B_ATIVO = 1
        AND
            (
                DBO.FUN_DEN_DATA_SEM_HORA(ODO_D_DATA_CADASTRO) = @DATA
            OR
                DBO.FUN_DEN_DATA_SEM_HORA(VIN_D_DATA_REALIZADO) = @DATA
            OR
                DBO.FUN_DEN_DATA_SEM_HORA(VIN_D_DATA_CADASTRO) = @DATA
            )
        ) = 0
        THEN
            '1'
        ELSE
            '0'
        END
    ELSE
        '0'
    END AS SEM_AGENDAMENTO
FROM
    DEN_PAC_PACIENTE PAC
LEFT JOIN
    DEN_CTR_CONTA_RECEBER CTR ON (CTR.CTR_PAC_N_CODIGO = PAC.PAC_N_CODIGO)
                              AND CTR.CTR_B_ATIVO = 1
                              AND (DBO.FUN_DEN_DATA_SEM_HORA(CTR.CTR_D_DATA_RECEBIMENTO) = @DATA)
LEFT JOIN
    DEN_ODO_ODONTOGRAMA ODO ON (ODO.ODO_N_CODIGO = CTR.CTR_ODO_N_CODIGO
                                OR
                                (ODO.ODO_PAC_N_CODIGO = PAC.PAC_N_CODIGO
                                 AND
                                 (ODO_B_APROVADO = 0 OR ODO_B_APROVADO IS NULL))
                                )
                            AND DBO.FUN_DEN_DATA_SEM_HORA(ODO.ODO_D_DATA_CADASTRO) = @DATA
WHERE
    PAC.PAC_B_ATIVO = 1
    AND DBO.FUN_DEN_DATA_SEM_HORA(PAC.PAC_D_ULTIMA_VISITA) = @DATA
    AND PAC.PAC_CLI_N_CODIGO = @CLI_N_CODIGO
ORDER BY
    PAC.PAC_D_ULTIMA_VISITA

A: You can create a #temp table and insert all the records into it. I assume that since you are using Union, all of your select queries must return same number of coulmns with same data type. Do not use union while inserting records into temp table. At the end, select * from temp table.
Inserting records into temp table through separate select queries will be faster than 7 union select queries.


text:
Q: Refreshing page Am having a problem with my script
i want to refresh the page every 30 seconds,
But ONLY when you are NOT typing into textbox
OTHER IMPORTANT THING
page should refresh if am typing into textbox and i stop without clicking send button for 1 minute (Idle)
<!DOCTYPE html>

<input type="text" id="inputbox">
<button type="button">Click Me!</button>

A: Rather than check for "isTyping", you can cancel the setTimeout and create a new one each time the user does something.

*

*Cancel/start a new timer (60s) on focus/input.

*Cancel/start a new timer (30s) on blur.

*Start the timeout when the page loads.

Here's the implementation (timeout changed to x100 ms instead of x1000 just for testing and some output to see what's happening)

var timerId;

function restartTimer(s) {
  clearInterval(timerId);
  timerId = setTimeout(() => {
    //window.location.reload()
    $("#out").text("times up");
  }, s * 100  /* * 1000, 100 for testing */);

  $("#out").text("timer restarted: " + s + "s " + timerId);
}

$("input").on("focus input", () => restartTimer(60));
$("input").on("blur", () => restartTimer(30));

// "technically" startTimer, but it's the same
restartTimer(30);

// optionally only if "idle"
//$("document").on("mousemove click", () => restartTimer(30));

<input type="text" id="inputbox">
<button type="button">Click Me!</button>


text:
Q: Performance penalty for jQuery's live() function For certain elements, whenever hovering over them I want the elements to get larger and then shrink back down when unhovering.  So I simply use $('.elementClass').hover(function() { enlarge(this); }, function() { shrink(this); });.  I put this in the $(function() { }); area of all webpages as many webpages have these kinds of elements.
Sometimes I need to create new dynamic elements and they have these elements above.  Of course, I have to call the above hover function again for them because they didn't exist at first.
What seems to be most convenient is to simply have a whole battery of $('.variousClasses').live('variousEvents', function() { }); calls in every webpage for all possible functionality like the above.
So the question is if there's a performance penalty for calling live() so many times even on elements that won't ever fire those events or elements which will never exist?  Is it important that I be careful about only calling hover() or live('hover') (and other events) only when needed?

A: As a general answer to your question, you should attempt to minimize extraneous function calls--maybe more so in a dynamic content situation.
In particular, live() is a good example to use for this question because it does carry with it some (potentially) significant performance complications. When you call live(), jQuery binds the event you have selected to the document object. This means that every time the event is fired, it bubbles up from the origin element to the document object. Depending on your site structure (and just in general), this can be costly.
A much better alternative with delegate()
It's better to use jQuery's delegate() function, especially if you have a pre-defined parent container element that all of your events will be firing within. When you use delegate(), you're basically using a restricted version of live() such that the event only propagates to the specified parent element. As a result, you avoid many potentially costly event fires on elements you do not care about.
In your case, since you are working with dynamically generated content, you either have to use the aforementioned functions or setup your code such that when the element is inserted into the DOM, it also binds the event handler to it. The former is likely easier, but the latter could offer marginally (likely indiscernible) better performance.


text:
Q: PostgreSQL: What is the best way to cast from from text to point[]? I'm looking for a way to cast from a text value:
'(180,90),(-180,-90)'

into a point[] value:
{"(180,90)","(-180,-90)"}
What is the best way to do this?
One possibility that I can think of is to manipulate the string to be of this form:
'{"(180, 90)", "(-180,-90)"}'

Which I can then cast to point[] like so:
select '{"(180, 90)", "(-180,-90)"}'::point[];

Surely there's a better way? The solution I currently have is this:
select concat('{', replace(replace(<text>, '(', '"('), ')', ')"'), '}')::point[]

A: Not any better than what you already got, but:
select string_to_array(replace('(180,90),(-180,-90)','),(',');('), ';')::point[];

If the separator token in the array would have been something else (say ";"), it would have been sufficient with:
select string_to_array('(180,90);(-180,-90)', ';')::point[];

EDIT:
If I get it right you have a foreign table like:
create table mytbl (p point[]);
insert into mytbl (p)
values ( '{"(180, 90)", "(-180,-90)"}'::point[] );

which you access through a dblink. Would the following work ( I cant use DBLink at the moment )?
select string_to_array(array_to_string(p,';'),';') from mytbl;


text:
Q: error 80020101 during downloading a javascript file using $.ajax in IE8 I've got this Knockout custom binding, all alone in one file (allowing to bind to a jQuery widget):
(function ($, ko, undefined) {
    ko.bindingHandlers.switch = {
        init: function (element, valueAccessor, allBindings, viewModel, bindingContext) {
            $(element).switch(valueAccessor());
        }
    };
}(jQuery, ko));

The project This file is downloaded at some point using the jQuery._evalUrl function. I could describe the whole process, but I'm not sure it would be relevant.
The problem is that in IE8, I get the good old error 80020101 during the $.ajax from the function.
I looked around and found that this error can happen for almost any reason ( see these questions that sum up some of them).
I didn't find any JS error in the file (but I'm not a JS guru), and eventually looked at the jQuery._evalUrl function. Here is the source in jQuery 1.11.1:
jQuery._evalUrl = function( url ) {
    return jQuery.ajax({
        url: url,
        type: "GET",
        dataType: "script",
        async: false,
        global: false,
        "throws": true
    });
};

Out of despair, I changed
dataType: "script",

to
dataType: "text/javascript",

and... that worked.
But in fact, writing
dataType: "dummy",

worked as well. But removing the entire dataType line didn't.
I'm not sure I get why. Is the code evaluated when dataType="script" and not otherwise ?
So I tried to rewrite the custom binding step by step, testing all the way down, to track a potential code problem using the original dataType: "script".
This doesn't raise an error:
(function ($, ko, undefined) {
}(jQuery, ko));

This does:
(function ($, ko, undefined) {
    ko.bindingHandlers.switch = {
    };
}(jQuery, ko));

In fact, those two also fail:
(function ($, ko, undefined) {
    ko.bindingHandlers.switch = 1;

}(jQuery, ko));

(function ($, ko, undefined) {
    ko.bindingHandlers.switch = "a";
}(jQuery, ko));

Any ideas what the hell could be happening ?


text:
Q: Scala: Turn Array into DataFrame or RDD I am currently working on IntelliJ in Maven.
Is there a way to turn an array into a dataframe or RDD with the first portion of the array as a header?
I'm fine with turning the array into a List, as long as it can be converted into a dataframe or RDD.
Example:
input
val input = Array("Name, Number", "John, 9070", "Sara, 8041")

output
+----+------+
|Name|Number|
+----+------+
|John| 9070 |
|Sara| 8041 |
+----+------+

A: import org.apache.spark.sql.SparkSession

val ss = SparkSession
  .builder
  .master("local[*]")
  .appName("test")
  .getOrCreate()

val input = Array("Name, Number", "John, 9070", "Sara, 8041")

val header = input.head.split(", ")
val data = input.tail
val rdd = ss.sparkContext.parallelize(data)
val df = rdd.map(x => (x.split(",")(0),x.split(",")(1))).toDF(header: _*)
df.show(false)

+----+------+
|Name|Number|
+----+------+
|John| 9070 |
|Sara| 8041 |
+----+------+


text:
Q: How can I get W3 Total Cache to recognise Amazon ElastiCache? What I did (on my EC2 instance):
a) Followed Amazon's instructions here to install their special PHP Memcached Extension for ElastiCache.
b) Confirmed it was installed and restarted apache
$ php -i | grep memcached
/etc/php5/cli/conf.d/memcached.ini,
memcached
memcached support => enabled
libmemcached version => 1.0.4
memcached.compression_factor => 1.3 => 1.3
memcached.compression_threshold => 2000 => 2000
memcached.compression_type => fastlz => fastlz
memcached.serializer => php => php
memcached.sess_binary => 0 => 0
memcached.sess_consistent_hash => 0 => 0
memcached.sess_lock_wait => 150000 => 150000
memcached.sess_locking => 1 => 1
memcached.sess_number_of_replicas => 0 => 0
memcached.sess_prefix => memc.sess.key. => memc.sess.key.
memcached.sess_randomize_replica_read => 0 => 0
Registered save handlers => files user memcached

c) Confirmed I could send and retrieve objects using the script here (I could).
d) Updated wp-content/w3tc-config/master.php with the full address and port of my ElastiCache instance wherever it was pointing to 127.0.0.1:11211.
e) Tried and failed to figure out why I still can't select Memcached from the w3tc dropdown.


text:
Q: Is it possible to do string concatenation in a ColdFusion Query of Queries? I'm familiar with this sort of syntax in SQL Server, to concatenate strings in my result set:
SELECT 'foo' + bar AS SomeCol
FROM SomeTable

I would like to do something similar inside a ColdFusion Query of Queries:
<cfquery name="qOptimize" dbtype="query">
    select
        image_id AS imageId,
        '#variables.img_root#' + image_id + '.' + image_ext AS fullImage,
        '#variables.img_root#' + image_id + 't.' + image_ext AS thumbnailImage,
    from qLookup
    order by imageId asc
</cfquery>

This is part of a service consumed by a Flex application, so I'm optimizing the result of a stored procedure used elsewhere in the application before returning to the client -- stripping out unused columns, and compiling image URLs from some dynamic path information.
I could write a new stored procedure that takes the image root as a parameter and does all of this, and I probably will for performance reasons, but the question is still nagging me. I haven't found a syntax that works yet, so I wonder if it's possible.
When I try the above, I get the following error:

Query Of Queries syntax error.
  Encountered "from. Incorrect Select List, Incorrect select column,

Has anyone done this? Is it possible, perhaps with another syntax?

A: I think the error you mention is due to the comma at the last concatenation, at the end of thumbnailImage.
Just my $0.002

A: Yes this is possible. I think the problem is that image_id is most likely a numeric value. If you cast it as an varchar then it should be fine.
<cfquery name="qOptimize" dbtype="query">
    select
        image_id AS imageId,
        '#variables.img_root#' + cast(image_id as varchar) + '.' + image_ext AS fullImage,
        '#variables.img_root#' + cast(image_id as varchar) + 't.' + image_ext AS thumbnailImage
    from qLookup
    order by imageId asc
</cfquery>

A: or even when you need the concatenate not on coldfusion level but in the query itself:
in my example, I have already a query result object which I want to dig into with query of queries. the query resul tobject has 10 columns of data and 1000 rows, the column names are c1, c2, c3, c4, c5, ...
    <cfset dbzeilerest = "2 4 - 3"><!--- beg qoq to concatenate those columns --->
    <cfset sqlcodehere = "(">
    <cfloop list="#dbzeilerest#" delimiters="," index="t">
        <cfif val(t) GT 0>
            <cfset sqlcodehere = sqlcodehere & "C" & val(t) & " || ">
        <cfelse>
            <cfset sqlcodehere = sqlcodehere & "'" & t & "' || ">
        </cfif>
    <!--- concat in coldfusion sql qoq:
          ( C2 || ' ' || C4 || ' ' || '-' || ' ' || C3 ) as combii --->
    </cfloop>
    <cfset sqlcodehere = sqlcodehere & " '') as combii">
    <cfquery name="dbtexttemp2" dbtype="query">
    SELECT DISTINCT #PreserveSingleQuotes(sqlcodehere )# FROM dbtexttemplistequery
    </cfquery>


text:
Q: putting text before the nth occurence in each line in Vim I have a situation like
something 'text' something 'moretext'

I forgot to add more spacing the first time I created this file and now on each line I should put some whitespace before the 2nd occurence of ' .
Now I can't build a regex for this.
I know that:

*

*my command should begin with :%s because I want it to be executed on all lines

*I should use the {2} operator to pick the 2nd occurence ?

*If my regex will match something I can put stuff before the match with &
The main problem for me is how to build a regex to match the second ' using the {} notation, it's frustrating because I don't where it's supposed to be inserted or if I should use the magic or non-magic regex in vim.
The result I'm looking for
something 'text ' something 'moretext'

A: You can use
:%s:\v(^[^']*'[^']*)':\1 ':

*

*[^'] means everything except '

*\1 is a backreference to the first captured group (...)
Basically what your doing here is capturing everything up to the second quote, and replacing the line up to (and including) this quote with what you've captured, a space, and a quote.

A: {2} doesn't mean "the second match", it means "two matches" so it's completely useless for the task.
You could use a substitution like this one or the one in Robin's answer:
:%s/[^']*'[^']*\zs'/ '

Or you could use something like this:
:g/ '[^']*' /norm 2f'i<space>

A: Yet another way to do it:
:%s/\v%([^']*\zs\ze'){2}/ /

Note: I am using very magic, \v, to reduce amount of escaping.
This approach uses \zs and \ze to set the start and end of the match . The \zs and \ze get set multiple times because of the quantifier, {2} but each occurrence of the group will change the \zs and \ze positions.
For more help see:
:h /\zs
:h /\v

Of course there is always sed, but the trick is getting the quote escaped correctly.
:%!sed -e 's/'\''/ &/2'


text:
Q: Android admin UploadinG Image To Server And The Client Can See It Basically
My idea Is uploading image to server.
And At The Same Time Every Client THose Who Download App Should Recieve It.
So What Should I Do So As To Implement This
Basic Requirements
All Should Be DOne in Android Studio


text:
Q: Rails 4: Using ActiveRecord object from one thread in another I have two threads. In one thread I fetch a record from the database as an ActiveRecord object. I then access this object from another thread.
Is there a problem with this usage?
If the two threads use separate connections to the DB, which connection will be used if needed to access the AR object's associations, etc?
I have seen some questions on StackOverflow that speak about the pitfalls of connecting to the DB via ActiveRecord from different threads and the need for manually checking-in such connections. Does that have an impact on this issue?

A: You've heard correctly. When using AR, you may find that you'll need to tiptoe around threads in weird ways to keep things stable... If you have a guarantee that you'll only ever have 2 threads, then you're probably safe at least as far as AR is concerned. (Of course, all the other pitfalls of concurrency–e.g. deadlocks, thread starvation, etc–still apply, so make sure to account for these.)
One thing to keep in mind is that each thread will use it's AR connection, so the pool field in database.yml must be high enough to accommodate all threads. If you're using a thread based webserver like Puma, then this can get even more complicated... If you're newer to rails, I would urge caution when dealing with threads and AR. It can be quite a rabbit-hole.
What's the purpose of having one thread fetch the object, and another access it? If you expect real speed benefits then it may be worth it, but since the activity of the second thread (operations on the AR record) is contingent on the result of the first thread, (loading of the AR record) then you may not see speed improvements since you'll need to wait for the first thread to finish to even begin using the second one. If your scenario doesn't do anything with the first thread after it's loaded up the object, I would absolutely recommend against this since you wouldn't see any speed improvements, but I don't know the whole scenario, and using threads may still make sense for your situation.
So in short, there's nothing stopping you from using threads with AR, but it is risky, and you can expect bugs to crop up in weird places unless your thread usage is conservative. It may still make sense for your app, but look into other solutions first and proceed with caution if you do go with threads.
Re "If the two threads use separate connections to the DB, which connection will be used if needed to access the AR object's associations": Each thread acquires its own AR connection, so the thread accessing the AR associations will use its own connection, irrespective of the thread that originally loaded the AR record.
What's the motivation for using threads in your app? There may be a better way of handling things.


text:
Q: JOOQ throws DataTypeException when fetching table meta Getting an error when trying to fetch table meta data.
Using:
JOOQ 3.14.0,
PostgeSQL 12,
PostgreSQL driver 42.2.10
Example:
@RestController
@ApiVersion("v2")
public class TypeResource {
    private final DSLContext ctx;

    @GetMapping(value = "/test")
    public void test(@RequestParam String table) {
        ctx.meta().getTables(table);
    }
}

Error (This is not the whole error but the rest is similar):
17:16:44.808 [http-nio-8181-exec-5] [WARN ] org.jooq.impl.MetaImpl - Default value            : Could not load default value: '{}'::character varying[] for type: varchar ([Ljava.lang.String;)
org.jooq.exception.DataTypeException: Cannot convert from '{}'::character varying[] (class java.lang.String) to class [Ljava.lang.String;
    at org.jooq.tools.Convert$ConvertAll.fail(Convert.java:1303)
    at org.jooq.tools.Convert$ConvertAll.from(Convert.java:1192)
    at org.jooq.tools.Convert.convert0(Convert.java:392)
    at org.jooq.tools.Convert.convert(Convert.java:384)
    at org.jooq.tools.Convert.convert(Convert.java:458)
    at org.jooq.impl.AbstractDataType.convert(AbstractDataType.java:534)
    at org.jooq.impl.DefaultDataType.convert(DefaultDataType.java:86)
    at org.jooq.impl.DSL.val(DSL.java:24373)
    at org.jooq.impl.DSL.inline(DSL.java:23891)
    at org.jooq.impl.MetaImpl$MetaTable.init(MetaImpl.java:910)
    at org.jooq.impl.MetaImpl$MetaTable.<init>(MetaImpl.java:560)
    at org.jooq.impl.MetaImpl$MetaSchema.getTables(MetaImpl.java:421)
    at org.jooq.impl.MetaImpl.getTables0(MetaImpl.java:217)
    at org.jooq.impl.AbstractMeta$4.iterator(AbstractMeta.java:194)
    at org.jooq.impl.AbstractMeta.get(AbstractMeta.java:340)
    at org.jooq.impl.AbstractMeta.initTables(AbstractMeta.java:191)
    at org.jooq.impl.AbstractMeta.getTables(AbstractMeta.java:172)
    at org.jooq.impl.AbstractMeta.getTables(AbstractMeta.java:167)
17:16:44.843 [http-nio-8181-exec-5] [WARN ] org.jooq.impl.MetaImpl - Default value            : Could not load default value: '{{0,0}}'::numeric[] for type: numeric ([Ljava.math.BigDecimal;)
org.jooq.exception.DataTypeException: Cannot convert from '{{0,0}}'::numeric[] (class java.lang.String) to class [Ljava.math.BigDecimal;
    at org.jooq.tools.Convert$ConvertAll.fail(Convert.java:1303)
    at org.jooq.tools.Convert$ConvertAll.from(Convert.java:1192)
    at org.jooq.tools.Convert.convert0(Convert.java:392)
    at org.jooq.tools.Convert.convert(Convert.java:384)
    at org.jooq.tools.Convert.convert(Convert.java:458)
    at org.jooq.impl.AbstractDataType.convert(AbstractDataType.java:534)
    at org.jooq.impl.DefaultDataType.convert(DefaultDataType.java:86)
    at org.jooq.impl.DSL.val(DSL.java:24373)
    at org.jooq.impl.DSL.inline(DSL.java:23891)
    at org.jooq.impl.MetaImpl$MetaTable.init(MetaImpl.java:910)
    at org.jooq.impl.MetaImpl$MetaTable.<init>(MetaImpl.java:560)
    at org.jooq.impl.MetaImpl$MetaSchema.getTables(MetaImpl.java:421)
    at org.jooq.impl.MetaImpl.getTables0(MetaImpl.java:217)
    at org.jooq.impl.AbstractMeta$4.iterator(AbstractMeta.java:194)
    at org.jooq.impl.AbstractMeta.get(AbstractMeta.java:340)
    at org.jooq.impl.AbstractMeta.initTables(AbstractMeta.java:191)
    at org.jooq.impl.AbstractMeta.getTables(AbstractMeta.java:172)
    at org.jooq.impl.AbstractMeta.getTables(AbstractMeta.java:167)

Example table create script :
CREATE TABLE public.user_role
(
    id bigint NOT NULL DEFAULT nextval('user_role_id_seq'::regclass),
    user_id bigint NOT NULL,
    role_id bigint NOT NULL,
    ts_created timestamp without time zone NOT NULL DEFAULT CURRENT_TIMESTAMP,
    ts_updated timestamp without time zone NOT NULL DEFAULT CURRENT_TIMESTAMP,
    updated_by_user character varying(256) COLLATE pg_catalog."default" NOT NULL DEFAULT 'n/a'::character varying,
    updated_by_process character varying(64) COLLATE pg_catalog."default" NOT NULL DEFAULT 'n/a'::character varying,
    CONSTRAINT user_role_pkey PRIMARY KEY (id),
    CONSTRAINT x_role_id_fk FOREIGN KEY (role_id)
        REFERENCES public.role (id) MATCH FULL
        ON UPDATE NO ACTION
        ON DELETE NO ACTION,
    CONSTRAINT x_user_id_fk FOREIGN KEY (user_id)
        REFERENCES public."user" (id) MATCH FULL
        ON UPDATE NO ACTION
        ON DELETE NO ACTION
)

TABLESPACE pg_default;

ALTER TABLE public.user_role
    OWNER to postgres;

CREATE UNIQUE INDEX x_role_user_id_role_id_uq
    ON public.user_role USING btree
    (user_id ASC NULLS LAST, role_id ASC NULLS LAST)
    TABLESPACE pg_default;

Initially my goal was to get the table indexes and this is working fine.
I tried to update JOOQ from 3.13.1 to 3.14.0 and tested with different tables in the database but without any luck.

A: This is a bug which will be fixed in jOOQ 3.15 via https://github.com/jOOQ/jOOQ/issues/8469. jOOQ currently assumes that DatabaseMetaData column descriptions produce values for DEFAULT expressions, instead of expressions.
The bug is "cosmetic", as it only affects your logs. The field is still produced correctly (without any DEFAULT expression). You can mute the message in your logger configuration until the above bug is fixed.


text:
Q: Android 10 : /proc/net/arp: open failed: EACCES (Permission denied) I'am trying to list neighbor wifi in my android application.
I'am using Android Q. I'am facing to this error :

/proc/net/arp: open failed: EACCES (Permission denied)

This is my code :
br = new BufferedReader(new FileReader(ARP_TABLE));
String line;
while ((line = br.readLine()) != null) {
    String[] splitted = line.split(" +");
    if (splitted != null && splitted.length >= 4) {
        String mac = splitted[3];
        if (mac.matches("..:..:..:..:..:..")) {
            // IP and connected
            // SOME CODE
        }
    }
}

Anybody is facing to this error ?
Thanks

A: Did you try android:requestLegacyExternalStorage attribute in AndroidManifest.xml? If you didn't try this, you can use this attribute like this in Android Manifest file;
<manifest ... >
   <application android:requestLegacyExternalStorage="true" ... >
   ...
   </application>
</manifest>


text:
Q: Is it possible to construct a field larger than the complex numbers? Can we extend the complex numbers in any way such that $\mathbb{C} \subset\mathbb{C}[a]$ ? Or is $\mathbb{C}$ the extension to end all extensions?

A: If $K$ is any field, the ring of rational functions over $x$ is also a field as is the ring of formal Laurent series over $K$.  So there is no field to end all fields.

A: Given any field, we can always construct bigger fields. If our field isn't algebraically closed, we can adjoin new roots of polynomials, otherwise we can adjoin transcendental elements (which is equivalent to forming a field of rational functions). In fact, every field extension is an algebraic extension of a purely transcendental extension.
(As $\Bbb C$ is algebraically closed, it has no algebraic extensions, so no finite ones.)
In particular, $\Bbb C(T)$ (the field of rational functions in the variable $T$ with complex coefficients) is bigger than $\Bbb C$ in the sense of set-theoretic inclusion. However, the algebraic closure has the same cardinality as $\Bbb C$ itself, and therefore is abstractly isomorphic to $\Bbb C$, which means there exists a way to embed $\Bbb C(T)$ inside $\Bbb C$. If we want to go bigger in the sense of cardinality, we can form the field of complex-coefficient rational functions in $\kappa$-many variables, where $\kappa$ is a cardinal number bigger than the continuum $\mathfrak{c}=|\mathbb{C}|$. This is certainly bigger!
Note that there is no subring of the polynomial ring $\mathbb{C}[T]$ that is a field and which strictly contained $\Bbb C$ itself, for if there were then it would contain some nonconstant $f(T)$, hence contain the nonpolynomial element $f(T)^{-1}$, which is impossible inside $\Bbb C[T]$.
Note also that fields of different characteristic are incompatible: fields of different characteristic can never be contained inside a common field. So not only is there not a field to end all fields, but the "class of all fields" juts out in different, mutually exclusive directions (one for each prime, and zero).

A: Yet another form: ultraproducts.
The cartesian product of fields
$$P = {\Bbb C}\times{\Bbb C}\times\cdots$$
isn't a field because has zero divisors:
$$(0,1,0,1,\cdots)(1,0,1,0\cdots)=(0,0,0,0,\cdots).$$
But a quotient will be a field. Let be $\mathcal U$a nonprincipal ultrafilter on $\Bbb N$. Define
$$(a_1,a_2,\cdots)\sim(b_1,b_2,\cdots)$$
when
$$\{n\in\Bbb N\,\vert\, a_n=b_n\}\in\mathcal U.$$
The quotient $F = P/\sim$ is a field strictly bigger (in the sense of cardinality) than $\Bbb C$
 and the inclusion $\Bbb C\longrightarrow F$ is...


text:
Q: Estilizando html5 datepicker Sei que é possível estilizar o input date do html5.

::-webkit-datetime-edit { padding: 1em; }
::-webkit-datetime-edit-fields-wrapper { background: silver; }
::-webkit-datetime-edit-text { color: red; padding: 0 0.3em; }
::-webkit-datetime-edit-month-field { color: blue; }
::-webkit-datetime-edit-day-field { color: green; }
::-webkit-datetime-edit-year-field { color: purple; }
::-webkit-inner-spin-button { display: none; }
::-webkit-calendar-picker-indicator { background: orange; }
<input type="date" min='2019-10-12'>

Porém, como eu estilizo os dias que estão bloqueados pelo atributo min ?
Gostaria de deixar em vermelho os dias bloqueados.

A: Qualquer forma de estilização deste datepicker gerado pelo navegador não passaria de uma mera gambiarra.
A forma mais estável e que garante a compatibilidade entre todos os navegadores é usar um input comum e criar um datepicker nele.
Essa forma é mais trabalhosa, mas calma! Têm pessoas que já resolveram seu problema, segue o link dos plugins de datepicker que eu costumo usar.
Bootstrap:
https://bootstrap-datepicker.readthedocs.io/en/latest/
Materialize CSS:
https://materializecss.com/pickers.html
Espero ter ajudado, boa sorte!


text:
Q: TimerTask and setting Views on UI Thread I'm trying to detect a user long click using a TimerTask. The code isnide the runnable should be executed whenthe user holds the button for longer than the LONG_PRESS_TIMEOUT variable. The short click event works, however when executing the below code, when the TimerTask is invoked, I get the error Only the original thread that created a view hierarchy can touch its views.
 View.OnTouchListener detectClickAndHoldListener = new View.OnTouchListener() {

        private Timer timer = new Timer();
        private long LONG_PRESS_TIMEOUT = 1337; // TODO: your timeout here
        private boolean wasLong = false;

        @Override
        public boolean onTouch(View v, MotionEvent event) {
            Log.d(getClass().getName(), "touch event: " + event.toString());

            if (event.getAction() == MotionEvent.ACTION_DOWN) {
                // touch & hold started
                timer.schedule(new TimerTask() {
                    @Override
                    public void run() {
                        wasLong = true;
                        snap.setBackgroundResource(R.drawable.cam_rec);
                        try {
                            initRecorder(mCameraView.getHolder().getSurface());
                            mMediaRecorder.start();

                        } catch (IOException e) {
                            e.printStackTrace();
                        }
                        // touch & hold was long
                    }
                }, LONG_PRESS_TIMEOUT);
                return true;
            }

            if (event.getAction() == MotionEvent.ACTION_UP) {
                // touch & hold stopped
                timer.cancel();
                if(!wasLong){
                    mCamera.takePicture(shutterCallback, rawCallback, jpegCallback);
                    snap.setBackgroundResource(R.drawable.filled_cam);
                }
                else {
                    mMediaRecorder.stop();
                    mMediaRecorder.reset();
                }
                timer = new Timer();
                return true;
            }

            return false;
        }
    };

A: YourActivity.this.runOnUiThread(new Runnable(){
@Override
public void run(){
    try {
             initRecorder(mCameraView.getHolder().getSurface());
             mMediaRecorder.start();
    } catch (IOException e) {
         e.printStackTrace();
    }
}
);


text:
Q: Use vue-cli-service to build a library, how to transpile? I'm trying to build a library (mostly some .vue components) to reuse in different projects (no public npm) with vue-cli-service. Apparently everything its already setup, and I can confirm that the build is fine (js, and css). However, I'm unable to use it in a separate project as an external module because it uses the spread operator (and probably more ES20XX features no yet parsed).
Module parse failed: Unexpected token (2683:8)
You may need an appropriate loader to handle this file type.
|     params() {
|       const queryParams = {
|         ...this.filters,
|         ...this.sorting,
|         ...this.config.params,

This is the standard command I'm using to build the library
vue-cli-service build --target lib --name [mylibname] ./src/components/index.js
By default the bundle should be already polyfilled but it seems to me that it's not the case.
I've read that I might change the webpack configuration on the project I'm using into, but I'm against parsing the whole node_module folder and also I would love to just have the simplest workflow possible (like import a module and its css).
So my question is, how to polyfill my bundle to be perfectly usable in no matter what Vue project without any hassle ?

A: Ok, it seems that reinitializing the project with vue-cli without typescript and with separated configuration files instead of into package.json was a good idea, as now is transpiled as needed.
var queryParams = _objectSpread({}, this.filters, {}, this.sorting, {}, this.config.params);

Unfortunately the hidden configuration of vue-cli webpack can't help to see what has changed.


text:
Q: MS Excel VBA - Filtering by dates (excluding an entire year) I am looking for code that will be able to include all dates within a column except for an enire year (2016)
GRBReportSheet.Range("A" & IHRISFILTERFR & ":L" & IHRISFILTERLR).AutoFilter Field:=4, Operator:= _
xlFilterValues, Criteria2:=Array(0, "12/31/2016")       'Filter by Start Date within 2016

The following code is filtering my report for all instances of 2016 but in a proceeding section I want to filter by all dates not in 2016. I know when filtering with other items I would use:
Criteria2:=">< Something"

Not sure how I can use this in a date array. Thank you greatly for your time!!

A: You can use two criteria in the AutoFilter:
.AutoFilter Field:=1,
  Criteria1:="<01/01/16",
  Operator:=xlOr,
  Criteria2:=">12/31/16"

Here's an example of usage - may need tweaking to fit with your circumstances:

Sheet1.Range("A1").AutoFilter Field:=1, Criteria1:="<01/01/16", Operator:=xlOr, Criteria2:=">12/31/16"


text:
Q: Top 5 and bottom 5 in r using Group_by I am looking for a code or feature that assigns a value to the 5 highest values and 5 lowest values. This could, for example, be from a dataset similar to this:
df <- data.frame(
   Date = c(rep("2010-01-31",16), rep("2010-02-28", 14)),
   Value=c(rep(c(1,2,3,4,5,6,7,8,9,NA,NA,NA,NA,NA,15),2))
)

Edit: This is just a sample data. The data I use is more complex and the code should, therefore, allow for varying lengths of the column Date and also for multiple values that are missing (NAs).
I would then like a value assigned to the five lowest equal to "5w" and "5b" to the 5 highest values The data should then be wrapped in a group_by based on the date so that the process is repeated at each period. I have tried using percentile but this method does not maintain a constant number of values in each bracket. I am therefore looking for a method that allows the number of values in each bracket to be constant. If it is possible it would be nice to put all firms into 5% brackets. By this, I mean to have 20 brackets with all firms distributed. This means that the best bracket would consist of 5% of total firms with the highest value. The values could be 0:19. I.e meaning that the expected output of a firm in the highest value bracket would be 19 and a firm in the lowest bracket would receive a value of 0.
Thanks In advance

A: Heads up: while I suspect that this is just sample data, you have two 1s in 2010-01-31. This code accounts for that, but when unsorted the output looks odd. For that, I'm adding arrange to show them.
I use min_rank here, assuming that you do not want ties and always want top/bottom 5. An alternative is dense_rank, which would label the top six from 2010-01-31 due to tie for 1.
library(dpyr)
dat %>%
  group_by(Date) %>%
  mutate(
    R = min_rank(Value),
    Quux = case_when(
      R < 6       ~ "5w",
      R > n() - 5 ~ "5b",
      TRUE        ~ NA_character_)
    ) %>%
  ungroup() %>%
  arrange(Date, Value) %>%
  print(n=99)
# # A tibble: 30 x 4
#    Date       Value     R Quux
#    <fct>      <int> <int> <chr>
#  1 2010-01-31     1     1 5w
#  2 2010-01-31     1     1 5w
#  3 2010-01-31     2     3 5w
#  4 2010-01-31     3     4 5w
#  5 2010-01-31     4     5 5w
#  6 2010-01-31     5     6 <NA>
#  7 2010-01-31     6     7 <NA>
#  8 2010-01-31     7     8 <NA>
#  9 2010-01-31     8     9 <NA>
# 10 2010-01-31     9    10 <NA>
# 11 2010-01-31    10    11 <NA>
# 12 2010-01-31    11    12 5b
# 13 2010-01-31    12    13 5b
# 14 2010-01-31    13    14 5b
# 15 2010-01-31    14    15 5b
# 16 2010-01-31    15    16 5b
# 17 2010-02-28     2     1 5w
# 18 2010-02-28     3     2 5w
# 19 2010-02-28     4     3 5w
# 20 2010-02-28     5     4 5w
# 21 2010-02-28     6     5 5w
# 22 2010-02-28     7     6 <NA>
# 23 2010-02-28     8     7 <NA>
# 24 2010-02-28     9     8 <NA>
# 25 2010-02-28    10     9 <NA>
# 26 2010-02-28    11    10 5b
# 27 2010-02-28    12    11 5b
# 28 2010-02-28    13    12 5b
# 29 2010-02-28    14    13 5b
# 30 2010-02-28    15    14 5b

Edit using newly-discovered data. I'm inferring that the NA values should be ignored, and only the ranked ones should be considered. This shows a condition where there are not 10 total valued rows, as 2010-02-28 only provides 4 5b.
dat %>%
  group_by(Date) %>%
  mutate(
    R = min_rank(Value),
    Quux = case_when(
      R < 6                        ~ "5w",
      R > max(R, na.rm = TRUE) - 5 ~ "5b",
      TRUE                         ~ NA_character_)
    ) %>%
  ungroup() %>%
  arrange(Date, Value) %>%
  print(n=99)

# # A tibble: 30 x 4
#    Date       Value     R Quux
#    <fct>      <dbl> <int> <chr>
#  1 2010-01-31     1     1 5w
#  2 2010-01-31     1     1 5w
#  3 2010-01-31     2     3 5w
#  4 2010-01-31     3     4 5w
#  5 2010-01-31     4     5 5w
#  6 2010-01-31     5     6 <NA>
#  7 2010-01-31     6     7 5b
#  8 2010-01-31     7     8 5b
#  9 2010-01-31     8     9 5b
# 10 2010-01-31     9    10 5b
# 11 2010-01-31    15    11 5b
# 12 2010-01-31    NA    NA <NA>
# 13 2010-01-31    NA    NA <NA>
# 14 2010-01-31    NA    NA <NA>
# 15 2010-01-31    NA    NA <NA>
# 16 2010-01-31    NA    NA <NA>
# 17 2010-02-28     2     1 5w
# 18 2010-02-28     3     2 5w
# 19 2010-02-28     4     3 5w
# 20 2010-02-28     5     4 5w
# 21 2010-02-28     6     5 5w
# 22 2010-02-28     7     6 5b
# 23 2010-02-28     8     7 5b
# 24 2010-02-28     9     8 5b
# 25 2010-02-28    15     9 5b
# 26 2010-02-28    NA    NA <NA>
# 27 2010-02-28    NA    NA <NA>
# 28 2010-02-28    NA    NA <NA>
# 29 2010-02-28    NA    NA <NA>
# 30 2010-02-28    NA    NA <NA>

A: Try this
library(dplyr)

DF <- data.frame(Date = c(rep("2010-01-31",16), rep("2010-02-28", 14)), Value=c(rep(1:15,2)))

DF %>%
  group_by(Date) %>%
  mutate(n = row_number(),
         nn = 1 + max(n) - n) %>%
  ungroup() %>%
  filter(n <= 5 | nn <= 5) %>%
  mutate(v1 = if_else(n <= 5, "5b", "5w")) %>%
  select(-n, -nn)

Output
# A tibble: 20 x 3
   Date       Value v1
   <fct>      <int> <chr>
 1 2010-01-31     1 5b
 2 2010-01-31     2 5b
 3 2010-01-31     3 5b
 4 2010-01-31     4 5b
 5 2010-01-31     5 5b
 6 2010-01-31    12 5w
 7 2010-01-31    13 5w
 8 2010-01-31    14 5w
 9 2010-01-31    15 5w
10 2010-01-31     1 5w
11 2010-02-28     2 5b
12 2010-02-28     3 5b
13 2010-02-28     4 5b
14 2010-02-28     5 5b
15 2010-02-28     6 5b
16 2010-02-28    11 5w
17 2010-02-28    12 5w
18 2010-02-28    13 5w
19 2010-02-28    14 5w
20 2010-02-28    15 5w


text:
Q: Inline runnable with constructor? I'm looking to use a thread to process something in the background. Since this code isn't used anywhere else & is not complex I'd like to use an inline function. However the function needs a copy of an attribute at the time the thread was created i.e.: I'd like it if the output from the following example 'true' instead of 'false'
public class InlineThreadTest {
    boolean value;

    public static void main(String[] args) {
        new InlineThreadTest();
    }

    InlineThreadTest() {
        value = true;
         java.util.concurrent.Executors.newSingleThreadExecutor().execute(new Runnable() {
            @Override
            public void run() {
                try {
                    Thread.sleep(100);
                } catch (InterruptedException e) {}
                System.out.println(value);
            }
        });
        value = false;
    }
}

... I can do what I'm looking to do by creating a separate class that implements Runnable, but having this inline seems like something that might be good.
I had a look @ https://stackoverflow.com/a/362443/64696 , but cannot figure out how to mold this to my use case.

A: Runnable implementation is a thread and thread won't return any value. The ExecutorService.execute method just runs the thread and you have no way to get the state of the thread whether it was executed or not.
If you want to check for the task (not thread) executed by ExecutorService you should use Callable and work with sumbit(). Your modified example:
public class InlineThreadTest {
boolean value;

public static void main(String[] args) {
    new InlineThreadTest();
}

InlineThreadTest() {
    value = true;
    java.util.concurrent.Future<Boolean> f =
     java.util.concurrent.Executors.newSingleThreadExecutor().submit(new Callable<Boolean>() {
         public Boolean call() {
           System.out.println(value);
            try {
                Thread.sleep(100);
            } catch (InterruptedException e) {}
            value = false;
            return value;
        }
    });
    try {
      System.out.println(f.get()+" or value="+value);
    } catch (Exception ex) { }
}

}
You'll get 2 lines
true
false or value=false


text:
Q: Why does a Bound Textbox not modify its associated property is the Text value is set programmatically? I have a Windows Form with a number of Textboxes. I bind them to a DataSource as the Form Loads.
public partial class FormSettings : Form
{
    private readonly DbContext _context = new DbContext();

    public FormSettings()
    {
        InitializeComponent();
    }

    protected override void OnLoad(EventArgs e)
    {
        _context.OrderEntrySettings.Load();

        SettingsBindingSource.DataSource = _context.OrderEntrySettings.Local.ToBindingList();

        Binding saNbinding = new Binding("Text", SettingsBindingSource, "InvoiceNumber");

        InvoiceNumberTextBox.DataBindings.Add(saNbinding);

        Binding pthNbinding = new Binding("Text", SettingsBindingSource, "SalesOrderExportPath");

        PathTextBox.DataBindings.Add(pthNbinding);

    <snip>
    …
    </snip>
}

One of the Textboxes is bound to a Directory Path (string) Property.
If I type in a new directory in the Path Textbox and hit my save button, The path saves just fine.
But, If I change the Text Property on the Textbox to the SelectedPath from a FolderBrowserDialog dialog and then hit save, the Textbox Text shows the directory I selected but the Entity is not modified and nothing gets saved back to the database.
As a workaround, I set both the Path Textbox Text and set the Property from the context to the SelectedPath.
Why does a Bound Textbox not modify its associated property if the Text value is set programmatically?

A: Here is the reason. Binding class has a property called DataSourceUpdateMode with 3 options - Never, OnPropertyChanged and OnValidation, the last being a default. When you set the Text property programatically, there is no validating/validated events because they fire only when the control is on focus and has been edited, so the binding does not update the data source.
That being said, here are the options you have:
(A) Do not set the control property programatically, set the data source property instead.
(B) Change the binding DataSourceUpdateMode to OnPropertyChanged. This however will cause the data source property to be updated on every char that the user is typing.
(C) Use the following snippet:
yourTextBox.Text = ...;
yourTextBox.DataBindings["Text"].WriteValue();

A: If memory serves, data binding in WinForms (and possibly WebForms) uses the changes in control focus to detect when the data in the field has changed.
When you are modifying the values of the controls in the code-behind, you generally aren't changing the control focus. Consequently, there isn't anything that pokes the data-binding engine in the ribs and clues it in to the fact that it needs to re-evaluate the data.


text:
Q: jquery toggle hover items with hide delay I put this code together from a snippet from somewhere else, so I may not be doing this very well.
I have multiple div's that looks like this:

...

service

service description

...

I want the
 to slideDown when the services div is hovered over. It needs a delay so that it doesn't vanish if the user mistakenly mouseout. BUT if they mouse over another services div then the visible one needs to go away immediately to make room for the new serviceList Here is what I have now:
$('.services').each(function () {
            var time = 800;
            var hideDelay = 1000;

            var hideDelayTimer = null;

            var beingShown = false;
            var shown = false;
            var trigger = $(this);
            var info = $('.serviceList', this);

            $([trigger.get(0),info.get(0)]).mouseover(function () {

                if (hideDelayTimer) clearTimeout(hideDelayTimer);
                if (beingShown || shown) {
                    // don't trigger the animation again

                    return;
                } else {

            info.addClass('active');

                    // reset position of info box
                    beingShown = true;

                    info.css('zindex','2')
                    .slideDown(time, function() {
                        beingShown = false;
                        shown = true;
                    });
                }

                return false;
            }).mouseout(function () {

                if (hideDelayTimer) clearTimeout(hideDelayTimer);
                hideDelayTimer = setTimeout(function () {
                    hideDelayTimer = null;

                    info.css('zindex','0')
                    .fadeOut( hideDelay, function () {
                        shown = false;
                        info.removeClass('active');
                    });

                }, hideDelay);

                return false;
            });

        });

I have a poor understanding of scope so I don't know what the get(0) stuff is about. I've been trying to have an event on mouseover that checks if any other "serviceList" is .active and then hide it. That works, unless you switch between "services" too fast. Am even close to doing this right?
Thanks

A: You should try using the hoverIntent plugin.  This is what it is designed for.
$('.services').hoverIntent(
     function() { // over
        $(this).find('.serviceList:first').slideDown();
     },
     function() { // out
        $(this).find('.serviceList:first').slideUp();
     }
);

Note that this is basically the same as the hover() method, but it includes the delay that you are looking for.


text:
Q: Django - application specific middleware I am aware of the following methods for adding middlewares
1) Adding custom middleware component to django using MIDDLEWARE_CLASSES
MIDDLEWARE_CLASSES = (
     '......'
    'path.to.custom.middlware',)

2) Adding view specific middleware using decorate_from_middlware
cache_page = decorator_from_middleware(CacheMiddleware)

@cache_page(3600)
def my_view(request):
    pass

My request is how to create application specific middleware class like
APPSPECIFIC_MIDDLEWARE_CLASSES = ( 'path.to.middlwareclass1',
 'path.to.middlwareclass2',
 'path.to.middlwareclass3', )

middlwareclass is either function or class ?
Is there any to do this using url or any other method,. Or 2nd method is the only way and to add all middleware classes separately to the view ?
Update :
http://python-social-auth.readthedocs.org/en/latest/pipeline.html
As in the about application, the SOCIAL_AUTH_PIPELINE is working for the social app alone. which differs from the global project settings..
Thanks in Advance

A: This is probably not possible in way that you want it, because django does not track what view comes from what application. But you can create some middleware with condition inside process_view, you can check here what view is being called and do something if view is matching your criteria (in that case, view comes from particular app).
Another approach, if you're using class-based views is to create some view mixin or base view in your application, decorate it with your middleware and use it in each view from your application.


text:
Q: How to align text columns in file imported from a spreadsheet Have this issue where I need to import data from a spreadsheet into plain text however once it's imported into notepadd++ the columns are no longer aligned.
I'm taking it from a file that looks like this

and once it's imported it looks like this

I want it to look like this

Is there anyway to do this without going through each line and fixing it manually?


text:
Q: Logical disjunction OR between two independent random variables Consider the Bernouilli experiment of tossing a coin $2$ consecutive times, with the probability of getting "heads" of $p=0,8$
The base space can be described as follows $\Omega=\{HH,TT,HT,TH\}$
And the two random variables $X_1$ and $X_2$ can be assigned the following values:
$$   X_1(HH) = 0
$$$$X_1(HT) = 0
$$
$$X_1(TT) = 1
$$
$$X_1(TH) = 1
$$
$$X_2(TT) = 1$$
$$X_2(HT) = 1$$
$$X_2(HH) = 0$$
$$X_2(TH) = 0$$
While it is well documented what is the probability of $\mathbb P(X_1=i ,X_2=j)$ , the comma meaning a logical conjunction $AND$, I am having a hard time finding what would be the probability of $\mathbb P (X_1=1\lor X_2=j)$ . Does it correspond to a set union? Does it has to do with the independence of the two random variables?

A: Did you mean to write $\cup$ rather than $\lor$? The latter is typically used for logical propositions (e.g: $P \lor Q$), and the former for set unions. They're not exactly the same thing. Similarly, for $P(X_1 = i, X_2 = j)$ we're talking about $P(X_1 =i \cap X_2 =j)$.
So $P(X_1 = 1 \cup X_2 = j)$ refers to the probability that $X_1 = 1$ or $X_2 = j$. Generally, this is the same thing as adding up their individual probabilities and then taking away $P(X_1 \cap X_2 )$ (since we're overcounting by that amount when we add the individual probabilities): $P(X_1 = 1 \cup X_2 = j) = P(X_1 = 1) + P(X_2 = j) - P(X_1 = 1 \cap X_2 = j)$
In this case, you are correct that $X_1$ and $X_2$ are independent, since knowing something about one doesn't tell us anything about the other. So this further becomes $P(X_1 = 1 \cup X_2 = j) = P(X_1 = 1) + P(X_2 = j) - P(X_1 = 1) P (X_2 = j)$
So if $j=1$, we have $P(X_1 = 1 \cup X_2 = 1)$ which is $0.8 + 0.2 - 0.16 = 0.84$. Does that make sense?


text:
Q: PHP Form / Upload de arquivo e envio de outros campos de uma vez Como realizar o upload de um arquivo e enviar os demais dados do form em uma unica ação?
Tenho (como exemplo) o seguinte formulário:
<form method="POST" name="form" action="ccd.php">
    <input value="" type="text" id="nome" name="nome"/>
    <input value="" type="text" id="modelo" name="modelo"/>
    <input type="file" id="foto" name="foto"/>
</form>

Porém quando adiciono o enctype de "multipart/form-data", para passar os dados do arquivo para o ccd.php, ele não envia os dados de nome e modelo.
<form enctype="multipart/form-data" method="POST" name="form">

Quando removo o enctype de "multipart/form-data", ele passa os dados de nome e modelo, porém não passa os dados do arquivo.
$uploaddir = "../fotos";

if (isset($_POST['foto'])){
    $uploadfile = $uploaddir . basename($_FILES['foto']['name']);
    if(move_uploaded_file($_FILES['foto']['tmp_name'], $uploadfile){}
}

E recebo o erro:
Notice: Undefined index: foto in /media/[...]/ccd.php on line 31

A: Reparei que falta fechar um parêntesis nesta linha
if(move_uploaded_file($_FILES['foto']['tmp_name'], $uploadfile)) {}

Além disso o conteúdo do ficheiro é colocado no array $_FILES. Como fazes if (isset($_POST['foto'])){ nunca irá executar.
O enctype="multipart/form-data" é obrigatório neste caso.


text:
Q: CRM 2016: Save and Route Incident CRM 2016 introduces a new feature: Save and Route (an Incident). The new Save & Route button combines the multiple steps required in earlier versions of CRM.
Now I want to perform programatically this action (for an incident also) either in js or in custom activity based on some conditions.
Any pointers to show me how can I do that?


text:
Q: How do I make shuffle playlist button and repeat button in android studio I dont know how to convert this code to android studio i am stuck on it for 2 days and cant figure it out Plz help me
btnRepeat.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View arg0) {
            if(isRepeat){
                isRepeat = false;
                Toast.makeText(getApplicationContext(), "Repeat is OFF", Toast.LENGTH_SHORT).show();
                btnRepeat.setImageResource(R.drawable.btn_repeat);
            }else{
                // make repeat to true
                isRepeat = true;
                Toast.makeText(getApplicationContext(), "Repeat is ON", Toast.LENGTH_SHORT).show();
                // make shuffle to false
                isShuffle = false;
                btnRepeat.setImageResource(R.drawable.btn_repeat_focused);
                btnShuffle.setImageResource(R.drawable.btn_shuffle);
            }
        }
    });

and another one
btnShuffle.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View arg0) {
            if(isShuffle){
                isShuffle = false;
                Toast.makeText(getApplicationContext(), "Shuffle is OFF", Toast.LENGTH_SHORT).show();
                btnShuffle.setImageResource(R.drawable.btn_shuffle);
            }else{
                // make repeat to true
                isShuffle= true;
                Toast.makeText(getApplicationContext(), "Shuffle is ON", Toast.LENGTH_SHORT).show();
                // make shuffle to false
                isRepeat = false;
                btnShuffle.setImageResource(R.drawable.btn_shuffle_focused);
                btnRepeat.setImageResource(R.drawable.btn_repeat);
            }
        }
    });

this is last pice of code
@Override
    public void onCompletion(MediaPlayer arg0) {
    // check for repeat is ON or OFF
    if(isRepeat){
        // repeat is on play same song again
        playSong(currentSongIndex);
    } else if(isShuffle){
        // shuffle is on - play a random song
        Random rand = new Random();
        currentSongIndex = rand.nextInt((songsList.size() - 1) - 0 + 1) + 0;
        playSong(currentSongIndex);
    } else{
        // no repeat or shuffle ON - play next song
        if(currentSongIndex < (songsList.size() - 1)){
            playSong(currentSongIndex + 1);
            currentSongIndex = currentSongIndex + 1;
        }else{
            // play first song
            playSong(0);
            currentSongIndex = 0;
        }
    }
}

A: You should use something like a toggle button! Instead of a normal button so you don't have to care what is switched on and off! Here the JavaDoc:
http://developer.android.com/reference/android/widget/ToggleButton.html
And this link contains a nice tutorial on how to use it within your code:
http://www.mkyong.com/android/android-togglebutton-example/


text:
Q: What are the claims supported by SharePoint? I am passing Claims from a custom STS to SharePoint. It seems that some of the Claims are coming through OK to SharePoint, but not all. For example I am passing in the GivenName and Surname claims, but in the SharePoint "My Settings" page, I do not see a First Name or Surname populated.
My claim mappings are as follows:
PS C:\Users\tom.haigh> $sts.ClaimTypeInformation

DisplayName                    : WebUsername
InputClaimType                 : http://schemas.xmlsoap.org/ws/2005/05/identity/claims/authentication
MappedClaimType                : http://schemas.xmlsoap.org/ws/2005/05/identity/claims/authentication
IsIdentityClaim                : True
AcceptOnlyKnownClaimValues     : False
ClaimValueModificationAction   : None
ClaimValueModificationArgument :
KnownClaimValues               : {}
UpgradedPersistedProperties    : {}

DisplayName                    : Email
InputClaimType                 : http://schemas.xmlsoap.org/ws/2005/05/identity/claims/email
MappedClaimType                : http://schemas.xmlsoap.org/ws/2005/05/identity/claims/mail
IsIdentityClaim                : False
AcceptOnlyKnownClaimValues     : False
ClaimValueModificationAction   : None
ClaimValueModificationArgument :
KnownClaimValues               : {}
UpgradedPersistedProperties    : {}

DisplayName                    : Windows Account Name
InputClaimType                 : http://schemas.xmlsoap.org/ws/2005/05/identity/claims/windowsaccountname
MappedClaimType                : http://schemas.xmlsoap.org/ws/2005/05/identity/claims/windowsaccountname
IsIdentityClaim                : False
AcceptOnlyKnownClaimValues     : False
ClaimValueModificationAction   : None
ClaimValueModificationArgument :
KnownClaimValues               : {}
UpgradedPersistedProperties    : {}

DisplayName                    : Given Name
InputClaimType                 : http://schemas.xmlsoap.org/ws/2005/05/identity/claims/givenname
MappedClaimType                : http://schemas.xmlsoap.org/ws/2005/05/identity/claims/givenname
IsIdentityClaim                : False
AcceptOnlyKnownClaimValues     : False
ClaimValueModificationAction   : None
ClaimValueModificationArgument :
KnownClaimValues               : {}
UpgradedPersistedProperties    : {}

DisplayName                    : Surname
InputClaimType                 : http://schemas.xmlsoap.org/ws/2005/05/identity/claims/surname
MappedClaimType                : http://schemas.xmlsoap.org/ws/2005/05/identity/claims/surname
IsIdentityClaim                : False
AcceptOnlyKnownClaimValues     : False
ClaimValueModificationAction   : None
ClaimValueModificationArgument :
KnownClaimValues               : {}
UpgradedPersistedProperties    : {}

I am interested to find out what claim types are supported, and how to make them work as expected.

A: AFAIK, there is no automatic mapping between claims and the My Settings page. For instance, providing an "email" claim does not populate the "email" field.
Update: actually, it seems that IF your identity claim is of type http://schema.microsoft.com/.../emailaddress AND your identity claim value looks like an email, then your email gets populated (I found that recently while using reflector on the SPTrustedClaimProvider class; the rest of the post is still valid, i.e. you must configure the UPS).
You can pass as many claims to Sharepoint as you want, but the only claim that Sharepoint is interested in is the Identity claim; it is used as a unique identifier (similar to the UPN in Windows-classic authentication) and as a "display name" (the Name field on the My Settings page). All other claims pass through Sharepoint without being used.
The only place where you can see and use all your claims is when you specify authorizations through the People Picker; here you will see all of them, and you can grant access to content using the claim you want.

If you want a mapping to occur, you must configure the User Profile Sync Service.
So to summarize:

*

*The identity claim is used to uniquely identify a user and as a default "display name".

*All other claims may be used for authorization.
Note: some claim types are reserved by Sharepoint and cannot be mapped, such as Name and NameIdentifier. You will receive an error if you try to use them, when you setup your mappings.
Update: as stated by Nathan below, actually in your mapping you can have an incoming claim of type NameIdentifier. However you can't use it inside Sharepoint with the "sameAsIncoming" parameter; you must map this input claim to a different local claim in Sharepoint.

*If you want to populate the email, display name, etc, in My Settings, configure the User Profile Sync service.
Note: there are some additional steps to perform when you use claims-based auth, such as setting the "Claim User Identifier" property.

PS. If you want to see your claims, the code accompanying the following article has a really nice web part that shows all claims with their values:
http://msdn.microsoft.com/en-us/library/ff953202.aspx

A: I must admit that I haven't had much experience with claims but I'll have a stab at this one in the absence of any other responses.
User profile properties (located within the "My Settings" page) are simply name/value pairs that are imported from a directory such as AD.
At a guess I would say that the user profile properties that appear to match the users claims are the default ones that are imported by the User Profile Service from Active Directory.
It sounds as though you are augmenting claims and expecting them to appear within the user's profile, whereas the solution might be to add custom properties within the Manage Profile Service page.

A: if you want to set the information of given name, email, Department, and other properties user can see on "My Settings" page, you need to implement a custom claims provider, and in FillResolve method set the PickerEntity
        pe.EntityData[PeopleEditorEntityDataKeys.DisplayName] = "GivenName";
        pe.EntityData[PeopleEditorEntityDataKeys.Email] = "someone@domain.com";

checkout all properties you can set


text:
Q: Audio is pitched down by 40Hz i have a weird problem. Whenever I'm lounching Age of Empires 2 Definitiv Edition out of Steam (via Steam Play / Proton) the audio output of my Computer pitched down by 40 Hz (I can tell it's 40, because I checked with a Tuner and a 500Hz Sound). This Problem occurs everytime I lounch the game and can just be fixed by forcing ALSA to reload.
Is there a nicer Way to Fix that? I dont wanne hear my Music pitched 40Hz down when playing AOE2 and reloading ALSA ends up in having normal Sound for my Music but no Sound in AOE2.
I have Ubuntu 20.04.
Edit:
This Problem occurs on other times, but launching AOE2 doest it every time.
Edit:
My Setup is the following:

*

*MSI B450m PRO-VHD MAX

*RYZEN 5 2600

*Radeon RX580 (Due to Problems with the Graphics I'm using amdgpu.dc=0 in the GRUB_CMDLINE_LINUX_DEFAULT)

*As an Audio Interface: focusrite scarlette 2i4

*Ubuntu 20.04.1 LTS

*Linux version 5.4.0-54-generic

Hope I got all the Information needed.


text:
Q: pass in table name to sqlalchemy query through url in flask In short, how do i
 var="TableName"
 models.var.query.all()

explanation
My goal is to allow the user to change the order of list of items.
I set up an ajax call that sends an array of id's to the api below.
It works if i hard code the query, and make a api view per table.
my problem is that i want "table" to fill in this line
 models.table.query.filter_by(id=item).first()

to complete the query.
here is the view api which gives me an error "no attribute 'table'"
@app.route('/order/<table>')
def order(table):
    # import pdb;pdb.set_trace()
    sortedItems = request.args.listvalues()[0]
    o=1
    import pdb;pdb.set_trace()
    for item in sortedItems:
        grab = models.table.query.filter_by(id=item).first()
        grab.order=o
        o=o+1
    db.session.commit()
    return jsonify(result=sortedItems)

A: You can use getattr():
>>> var = 'table_name'
>>> table = getattr(models, var)
>>> table.query.filter_by(id=item).first()

getattr() will raise an AttributeError if the attribute your trying to get does not exist.
Example for your order()-function:
@app.route('/order/<table>')
def order(table):
    sortedItems = request.args.listvalues()[0]
    o=1
    table = getattr(models, table)
    for item in sortedItems:
        grab = table.query.filter_by(id=item).first()
        grab.order=o
        o=o+1
    db.session.commit()
    return jsonify(result=sortedItems)


text:
Q: Windows boot camp icon greyed out I have used Windows on my MacBooks for several years and rarely boot up into Mac. Maybe once every two or three years. So, I know nothing about Mac. I just booted into Mac and now can't get back to Windows. The icon is greyed out. How can I get back. I didn't change anything.

A: An easy fix is to power off the macOS and then hold option / alt when you power on and choose Windows.
Once you're back in your preferred OS you can fix the boot order from the control panel.
Apple has details on most recent macOS versions here: https://support.apple.com/guide/bootcamp-control-panel/start-up-your-mac-in-windows-or-macos-bcmp29b8ac66/mac


text:
Q: Back out, reverse out, get out If someone had double parked his car behind another car,  what's a natural phrase to be used:

How am I supposed to get out? (of the parking spot)
How am I supposed to reverse out?(of the parking spot)
How am I supposed to back out? (of the parking spot)

The person whose exit was blocked says this. Do the three sentences above sound natural?
There are two cars flanking the parked car and there is a curb in front of it.  And then another car comes and parks behind that car,  thus blocking it in.

A: I agree with Jasper that the common use of double-park is more like this.
In the situation you describe we would say

Someone has parked behind me.

The common response would be:

I can't get out
I can't back out

"Reverse out" works, although to my American ears it sounds like it's from another English dialect, or from a non-native speaker.


text:
Q: Automatically edit a php table I have a coins table in phpMyAdmin and I need it to be automatically updated when a user completes a purchase via PayPal. The way it is setup is that PayPal will automatically redirect them to a link I choose.
So, how can I run a script that takes the parameters from the URL and adds a new record to the table?
Thank you for all your help.

A: So that link would need to be a page called something like payment_success.php
On that page you would need to have a script that looks like this:
<?php
include 'credentials.php'; /*this is a file that will contain your database connection info

Then here you will establish the connection and enter the data into the desired table*/

$var1 = 'some information collected from paypal that you want to update';
$id = 'some identifiable information about your user that can connect them to the correct row in your table';

I won't hold your hand through all this but the SQL query you would need would be:

UPDATE table_name SET column_1 = '$var1' WHERE ID = '$id'

A: Set the confirmation PayPal link to increment the number of coins value in the MySQL table for the particular user....!!!
I hope that will work out..... If I could get a idea of your table or some more info, I could give you a clear idea about that.


text:
Q: Newly created packages only show up after manual refresh I am creating new packages using the Object Model and C#.
I am creating packages with subpackages recursively, and that works fine. However, my changes don't show up in EA after the script is done working unless I manually refresh the project with ctrlshiftF11, after which my created packages show up as intended.
I am updating the newly created package newPackage.Update();, aswell as refreshing the packages of the parent package parentPackage.Packages.Refresh();.
After recursively creating all the packages I additionally call Model.Update(), Repository.Models.Refresh();, Model.Packages.Refresh(); aswell as Repository.Exit().
EA seems to redraw the view, but doesn't show the newly created packages.
Am I missing any call at the end that updates the view?
I'm using this code:
eaApplication = new EA.App(); // Create interface to EA
eaRepository = eaApplication.Repository;
eaRepository.EnableUIUpdates = true;
eaRepository.OpenFile(pathToEAPfile)
EA.Package eaModel = eaRepository.Models.GetAt(0);
EA.Package testModelPackage = (getting it via for loop);
EA.Package newPack = testModelPackage.Packages.AddNew("foopackage", "System.__ComObject");
newPack.Update();
testModelPackage.Packages.Refresh();

eaRepository.RefreshModelView(0);
eaRepository.Exit();

A: I suppose you call this from an external application. Any EA client does not receive notice of underlying database updates. Only when the user explicitly reads the appropriate parts.
You either need to run the above code inside EA as add-in or refresh manually.
Answer to initial question: The following was a reply to the initial vague question. I leave that for reference by others.

Call
Repository.RefreshModelView(0)

to reload the whole view from root on. Or pass the PackageId of the package you want to refresh.
N.B. All your additional calls are superfluous. Call Update() only for objects that have changed. The Refresh() calls are only needed if you traverse a changed collection afterwards (after addition or deletion of objects).


text:
Q: How to pg_restore I am dumping my database 'mydatabase' into a text file 'mydatabase.sql' through command line.
"C:/Program Files (x86)/PostgreSQL/9.1/bin/pg_dump.exe " --host localhost --port 5432 --username "postgres" --no-password --verbose --file "C:\Users\User 1\Desktop\mydatabase.sql" "mydatabase"

Thas' going nice.
But after many tries I can't do a pg_restore those file back to database with data.
But if I delete all tables in this database I can do it with:
psql -f "C:\Users\User 1\Desktop\mydatabase.sql" "mydatabase" "postgres"

This recover's all data.
Problem is that I can't run pgsl through VBNET/shell so I would rather need pg_restore.exe
This is my try:
"C:/Program Files (x86)/PostgreSQL/9.1/bin/pg_restore.exe " -i -h localhost -p 5432 -U postgres -d "mydatabase" -v "C:\Users\User 1\Desktop\mydatabase.sql"

...where I get message:

C:\Users\User 1>"C:/Program Files (x86)/PostgreSQL/9.1/bin/pg_restore.exe " -i -h
  localhost -p 5432 -U postgres -d "mydatabase" -v "C:\Users\User 1\Desktop\mydatabase.sql"
  invalid binary "C:/Program Files (x86)/PostgreSQL/9.1/bin/pg_restore.exe "
  pg_restore.exe : [archiver] input file does not appear to be a valid archive

Before trying to restore I have empty database 'mydatabase' on server (without tables).
Please any help to get pg_restore working with 'mydatabase.sql' which is dumped with pg_dump and which obviously contains a proper data so I can use it through pure command line or VBNET/shell.

A: In your pg_dump, specify the -F t flag.  This tells pg_dump to create the backup in tar format, which is suitable for restore via pg_restore.
"C:/Program Files (x86)/PostgreSQL/9.1/bin/pg_dump.exe " --host localhost --port 5432 --username "postgres" --no-password --verbose -F t --file "C:\Users\User 1\Desktop\mydatabase.sql" "mydatabase"


text:
Q: Trying to printing the dictionary values by taking a list of strings and given user input I am trying to print the values as a dictionary (like as key and value) with output like {0: 'Rama', 1: 'Sita', 2: 'Ravana'}.
Tried Code:
def details():
  Stu_Rec = {}
  Names = list()
  print("Enter the Id :\n")
  Id = int(input())
  for i in range(0,Id):
    print("\nEnter the Name ")
    Name = input()
    Names.append(Name)
  for i in range(0,Id):
    for x in Names:
       Stu_Rec[i] = x
  return Stu_Rec

if __name__ == "__main__":
  Details = details()
  print(Details)**

When i am executing the code , the output is mentioned above and below is the snippet
~/Python-3$ python details.py
Enter the Id :

3

Enter the Name
rama

Enter the Name
sita

Enter the Name
Ravana
{0: 'Ravana', 1: 'Ravana', 2: 'Ravana'}**

Suggest what's wrong with the code I'm trying ?

A: Try this.
def details():
Stu_Rec = {}
Names = list()
print("Enter the Id :\n")
Id = int(input())
for i in range(0,Id):
    print("\nEnter the Name ")
    Name = input()
    Names.append(Name)
for i in range(0,Id):
    Stu_Rec[i] = Names[i]
return Stu_Rec

if __name__ == "__main__":
    Details = details()
    print(Details)


text:
Q: datatables search column I am using the datatables plugin and I have a problem when you scan intentto. the search conducted by the columns as it says on this page:
http://jquery-datatables-column-filter.googlecode.com/svn/trunk/external.html
The problem is that I want to filter the data have not only text numbers so I had thought to create a hidden column with the numbers but I only works something like this:
tablalistaproductos = $('#tablalistaproductos').dataTable( {
    "bJQueryUI": true,
    "sScrollY": "450px",
    "bPaginate": false,
    "bScrollCollapse": true,
    "oLanguage": espanol,
    "aoColumns": [null,null,null,{ "bVisible":false},null,null,null,null,null,null,null,null]
    })

            Id
            Descripcion
            Stock
            Stockoculto
            Stockreservado
            Precio venta
            Precio compra
            Marca
            Iva
            Familia
            Proveedor
            Acciones

      {% for entity in entities %}

            {{ entity.id }}
            {{ entity.descripcion }}
            {{ entity.stock }} unidades
            {{ entity.stock }}
            {{ entity.stockreservado }} Unidad/es
            {{ entity.pventa }} €
            {{ entity.pcompra }} €
            {{ entity.marca }}
            {{ entity.iva }} %
            {{ entity.familia }}
             {{ entity.proveedor}}

Editar

  {% endfor %}

A: i solved this problem oculting columns. i used colvis() :
tablalistaproductos = $('#tablalistaproductos').dataTable( {
    "bJQueryUI": true,
    "sScrollY": "450px",
    "bPaginate": false,
    "bScrollCollapse": true,
    "aoColumns": [null,null,null,{ "bVisible": false },null,null,{ "bVisible": false },null,null,null,null,null,null],
    "oLanguage": espanol
                })

    tablalistaproductos.columnFilter({"bUseColVis": true,"aoColumns": [null,null,null,{sSelector: "#numeros1", type:"number-range" },null,null,{sSelector: "#numeros", type:"number-range" },null,null,null,{ sSelector: "#mostrarproductofamilia", type:"select" },{ sSelector: "#mostrarproductoproveedor", type:"select" },null]});

thanks


text:
Q: After changing System.Data.OracleClient to Oracle.DataAccess.Client I get error that "Not all variables bound" All had worked correctly before I did that.
May be it a common problem? Which associated with ODP namespace changing?

A: OracleClient Binds by name by default. ODP.NET binds by position. You will need to set OracleCommand.Bindbyname.


text:
Q: Performant way to check page's NUMA region, is move_page the most performant I know that you are able to use move_page to find the NUMA region that a particular page is located.
What is the performance of move_page when NULL is passed in to get the NUMA region? Is it any better than move_page when it is actually moving pages.
I was wondering if there is a faster way to find the NUMA region of a memory address.


text:
Q: JSON with irregular x axis highcharts Error 13 For 10 hours, i'm trying to display data from a SQL database with highgraph. I've read some tutorials, so i can now produce a JSON file with my data like:
[{"name":"Temperature","data":[[1596642102000,-127],[1596642118000,-127],[1596642133000,-127]]},{"name":"Pres","data":[[1596642102000,214748364],[1596642118000,214748364],[1596642133000,214748364]]}]

But i can't put the data on highcharts
UPDATE:
I had to download the scripts, otherwise mozilla gave an error about mixed active contents
EDIT:
Here is my code: I've got the error 13 when i run it
    <!DOCTYPE HTML>

        Basic line chart showing trends in a dataset. This chart includes the
        series-label module, which adds a label to each line for
        enhanced readability.

Thank you for your help :)

A: You need to create series data array with x and y values:
data: [
    // x, y
    [0, 1],
    [1, 2],
    [2, 8]
]

So convert your data to the format required by Highcharts or produce before a properly JSON structure.
options.series.forEach(function(s){
    s.data = s.data.map((el, i) => [json[0].data[i], el])
});

Live demo: http://jsfiddle.net/BlackLabel/u8f0hs5g/
API Reference: https://api.highcharts.com/highcharts/series.line.data