text:
Q: Building .Net Core 3.0 app using Nix on macOS fails with permissions error I'm trying to build FVim on macOS using Nix. Because the version of the SDK available in Nixpkgs is 2.2.401 I wrote an overlay which successfully installs .Net Core 3.0 on my system:
self: super: {
  dotnet-sdk = super.dotnet-sdk.overrideAttrs (oldAttrs: rec {
    version = "3.0.101";
    netCoreVersion = "3.0.1";
    system = "x86_64-darwin";
    src = super.fetchurl {
      url = "https://dotnetcli.azureedge.net/dotnet/Sdk/${version}/${super.dotnet-sdk.pname}-${version}-osx-x64.tar.gz";
      sha512 = "3d01a586ab92f9386b13796a2307d77e35ec6932c0f97e0c8bfd87f4198890a302722f1e49d68a39d8b51e626eb5c4b3cbffd9ac8fbaf330b40d043c0a4c9a3e";
    };
    meta.platforms = super.stdenv.lib.platforms.darwin;
    buildPhase = ''
      runHook preBuild
      echo -n "dotnet-sdk version: "
      ./dotnet --version
      runHook postBuild
    '';
  });
}

But when I try to build FVim it fails:
error MSB4018: The "CreateAppHost" task failed unexpectedly. [/Users/tae/Projects/fvim/fvim.fsproj]
error MSB4018: System.Unauthorized AccessException: Access to the path '/Users/tae/Projects/fvim/obj/Debug/netcoreapp3.0/FVim' is denied. [/Users/tae/Projects/fvim/fvim.fsproj]
error MSB4018:  ---> System.IO.IOException: Permission denied [/Users/tae/Projects/fvim/fvim.fsproj]
error MSB4018:    --- End of inner exception stack trace --- [/Users/tae/Projects/fvim/fvim.fsproj]
error MSB4018:    at Interop.ThrowExceptionForIoErrno(ErrorInfo errorInfo, String path, Boolean isDirectory, Func`2 error Rewriter) [/Users/tae/Projects/fvim/fvim.fsproj]
error MSB4018:    at Microsoft.Win 32.SafeHandles.SafeFileHandle.Open(String path, OpenFlags flags, Int32 mode) [/Users/tae/Projects/fvim/fvim.fsproj]
error MSB4018:    at System.IO.FileStream.OpenHandle(FileMode mode, FileShare share, FileOptions options) [/Users/tae/Projects/fvim/fvim.fsproj]
error MSB4018:    at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options) [/Users/tae/Projects/fvim/fvim.fsproj]
error MSB4018:    at System.IO.MemoryMappedFiles.MemoryMappedFile.CreateFromFile(String path, FileMode mode, String mapName, Int64 capacity, MemoryMappedFileAccess access) [/Users/tae/Projects/fvim/fvim.fspro j]
error MSB4018:    at System.IO.MemoryMappedFiles.MemoryMappedFile.CreateFromFile(String path) [/Users/tae/Projects/fvim/fvim.fsproj]
error MSB4018:    at Microsoft.NET.HostModel.AppHost.HostWriter.<>c__DisplayClass2_0.<CreateAppHost>g__RewriteAppHost|0() [/Users/tae/Projects/fvim/fvim.fsproj]
error MSB4018:    at Microsoft.NET.HostModel.RetryUtil.RetryOnIOError(Action func) [/Users/tae/Projects/fvim/fvim.fsproj]
error MSB4018:    at Microsoft.NET.HostModel.AppHost.HostWriter.CreateAppHost(String appHostSourceFilePath, String appHostDestinationFilePath, String appBinaryFilePath, Boolean windowsGraphicalUserInterface, String assemblyToCopyResorcesFrom) [/Users/tae/Projects/fvim/fvim.fsproj]
error MSB4018:    at Microsoft.NET.Build.Tasks.CreateAppHost.ExecuteCore() [/Users/tae/Projects/fvim/fvim.fsproj]
error MSB4018:    at Microsoft.NET.Build.Tasks.TaskBase.Execute() [/Users/tae/Projects/fvim/fvim.fsproj]
error MSB4018:    at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute() [/Users/tae/Projects/fvim/fvim.fsproj]
error MSB4018:    at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask(ITaskExecutionHost taskExecutionHost, TaskLoggingContext taskLoggingContext, TaskHost taskHost, ItemBucket bucket, TaskExecutionMode howToExecuteTask) [/Users/tae/Projects/fvim/fvim.fsproj]

I'm pretty sure I have access to /Users/tae/Projects/fvim/obj/Debug/netcoreapp3.0/FVim, so I thought the problem was related to BundleExtraction as pointed out here, but neither $TMPDIR nor $DOTNET_BUNDLE_EXTRACT_BASE_DIR has any effect. Any idea? Just to be sure that I can build other .Net Core apps on MacOS with Nix I wrote an overlay to install version 2.2.401 of the SDK:
self: super: {
  dotnet-sdk = super.dotnet-sdk.overrideAttrs (oldAttrs: rec {
    system = "x86_64-darwin";
    src = super.fetchurl {
      url = "https://dotnetcli.azureedge.net/dotnet/Sdk/${version}/${super.dotnet-sdk.pname}-${version}-osx-x64.tar.gz";
      sha512 = "905FC6FB47B515BEC7A5624DABD5012518792B84BA05BA4BEE48F856563D653AC1421C2434A48803018DA30029288BDD8ECE289964528B9B11515E14F9C7E068";
    };
    meta.platforms = super.stdenv.lib.platforms.darwin;
    buildPhase = ''
      runHook preBuild
      echo -n "dotnet-sdk version: "
      ./dotnet --version
      runHook postBuild
    '';
  });
}

I was able to build the F# language server without problems without setting any environment variable. Even more weird, I downloaded version 3.0.101 of the SDK from the website and I can build FVim without problems with it


text:
Q: Send word to background process c# without SendKeys I need to send world(keys) to background console program. I just found this:
    [DllImport("user32.dll")]
    public static extern IntPtr PostMessage(IntPtr hWnd, uint Msg, uint wParam, IntPtr lParam);

    [DllImport("user32.dll")]
    static extern uint MapVirtualKey(uint uCode, uint uMapType);

    [DllImport("user32.dll")]
    static extern void keybd_event(byte bVk, byte bScan, uint dwFlags, uint dwExtraInfo);

    const int WM_CHAR = 0x0102;
    const int VK_ALT = 0x12;

    //rest
    IntPtr h = b.Client.MainWindowHandle; // handle my process
    PostMessage(h, WM_CHAR, WM_CHAR, IntPtr.Zero); // send one uint char
    keybd_event(VK_ALT, (byte)MapVirtualKey(VK_ALT, 0), 0, 0);  // send alt key up

My question is: how can I get keys like Enter? And how to convert string "XYZ" to uint?

redpajama_set_name: RedPajamaStackExchange


text:
Q: ElasticSearch with Docker and Traefic When I will run elasticsearch with docker and traefic (With SSL encryption).
Than I can't connect to elasticsearch via domain.
When I remove all traefic things in the docker-compose by the elastic search tham it works over the IP and http.
Here is my docker-compose.yml:
`
version: "3.7"
networks:
traefik:
external: true
search:
services:
elasticsearch:
image: elasticsearch:7.16.2
container_name: elasticsearch
environment:
- xpack.security.enabled=false
- discovery.type=single-node
- ELASTICSEARCH_USERNAME=elastic
- ELASTICSEARCH_PASSWORD=XXXXXX
volumes:
- elasticsearch-data:/usr/share/elasticsearch/data
labels:
- "traefik.enable=true"
- "traefik.http.routers.elastic_search.rule=Host(se.mydomain.xyz)"
- "traefik.http.routers.elastic_search.entrypoints.websecure"
- "traefik.http.services.elastic_search.loadbalancer.server.port=9200"
ports:
- 9200:9200
- 9300:9300
networks:
- search
kibana:
image: kibana:7.16.2
container_name: kibana
labels:
- "traefik.enable=true"
- "traefik.http.routers.kibana_search.rule=Host(kibana.mydomain.xyz)"
- "traefik.http.routers.kibana_search.entrypoints.websecure"
- "traefik.http.services.kibana_search.loadbalancer.server.port=5601"
#ports:
#- 5601:5601
environment:
ELASTICSEARCH_URL: http://XXX.XXX.XXX.XXX:9200
ELASTICSEARCH_HOSTS: '["http://XXX.XXX.XXX.XXX:9200"]'
networks:
- search
- traefik
volumes:
elasticsearch-data:
driver: local
`
Has anyone a idea for a solution?


text:
Q: neo4j: simple exampel throws java.lang.NoClassDefFoundError: scala/Function0 I try to build up a very simple neo4j db for practicing:
public static void main(String[] args) {
    Map<String, String> config = new HashMap<String, String>();
    config.put( "neostore.nodestore.db.mapped_memory", "10M" );
    config.put( "string_block_size", "60" );
    config.put( "array_block_size", "300" );
    GraphDatabaseService graphDb = new GraphDatabaseFactory()
        .newEmbeddedDatabaseBuilder( "db" )
        .setConfig( config )
        .newGraphDatabase();

    ExecutionEngine engine = new ExecutionEngine(graphDb, StringLogger.DEV_NULL);
}

I get the following exception while executing it:
Exception in thread "main" java.lang.NoClassDefFoundError: scala/Function0
Do you have any idea how to get it working?

A: Questions about this error is listed among the common Java questions on the 'java' tag wiki, and for a general answer you can begin by reading about it here. To know why the class definition cannot be found in your specific case it would be helpful first to know exactly what definition it is that cannot be found, so please edit your question to include the full stack trace. Maybe someone else will recognize your exact error, all I can see from that one line is that the JVM is unable to load some Scala definition, and that probably you need to include some missing dependency or clean up conflicting versions in your dependency tree.

A: Our solution was to add scala support into our IDE.


text:
Q: Yum, How to install package in other directory? According to our systemadmins, all the package I need for my work will have to be installed in /appl.
Is it possible, using 'yum' as packagemanager, to install packages into another directory as defaulted by the package?

A: As for rpm, it has --relocate OLDPATH=NEWPATH and --prefix NEWPATH which will allow you to change the install path for rpms marked as relocatable which will not apply to all packages. In general, it is not considered a good idea.


text:
Q: Firebase database structure with UID and database rules Github repo https://github.com/JesseSoldat/Around-The-World-NG2-Firebase
Firebase JSON data exported to a file is in the repo FIREBASE_DATA.json
I have been trying to figure out the firebase database rule. I have read many articles and they all say that I need to do something like this

{
  "rules": {
   "locations": {
     "$uid": {
    ".read": "true",
       ".write": "$uid === auth.uid"
      }
    },
    "users": {
      "$uid": {
        ".read": "$uid === auth.uid",
     ".write": "$uid === auth.uid"
      }
    }
  }
}

I have structured my data with two directories
locations   READ - all users  WRITE - only the user that owns this data
users  READ /  WRITE - only the user that owns this data
When I set these rules my currently logged in user does not see their data anymore.
DATABASE
my format for saving users/${this.uid}/stories
I was using the UID as a way to make each user unique in the database.
ERROR MESSAGE from Firebase

Error: permission_denied at /users/HBTaJt057Bf63oS771gah1allYe2/stories: Client doesn't have permission to access the desired data.

I am not sure if I don't understand the concept or if I am missing some minor detail.  Any ideas would be truly appreciated.
Regards,
Jesse


text:
Q: Use create an record with Active Storage without ActionParameters I try to create a record, with image, directyl with create, and in model
Banner.create(
  start_at: Time.now,
  location: 'site',
  image_fr: File.new("#{Rails.root}/db/seeds/images/banners/pdfs/gift_voucher_bottom.png", 'r'),
  image_de: File.new("#{Rails.root}/db/seeds/images/banners/pdfs/gift_voucher_bottom.png", 'r'),
  width: 595,
  height: nil
)
I must do at creation moment, not with .attach after, because of validation. Can we do this ?

A: You can pass a block to create. It'll be called with the new record before it's saved:
Banner.create(start_at: Time.now, location: 'site', width: 595, height: nil) do |banner|
  Rails.root.join('db/seeds/images/banners/pdfs/gift_voucher_bottom.png').open('rb') do |io|
    banner.image_fr.attach(io: io, filename: 'banner.png', content_type: 'image/png')
  end

  # ...
end


text:
Q: Все нулевые элементы размещены на местах с нечетными индексами строк и столбцов static int NN;
static int SIZE;
static int *m_addr;
static int lin(int, int);
static char ch_coord(int, int);
int L2_RESULT;

int creat_matr(int N)
{
    m_addr = new int[SIZE];
    NN = N;
    SIZE = (N * N) / 2;
    if (!m_addr)
        return L2_RESULT = -1;
    else
        return L2_RESULT = 0;
}

int close_matr(void)
{
    if (m_addr)
    {
        delete m_addr;
        return L2_RESULT = 0;
    }
    else
        return L2_RESULT = -1;
}

int read_matr(int x, int y, int m_size)
{
    if (ch_coord(x, y))
        return 0;
    if (x >= m_size / 2)
        return 0;
    else
        return m_addr[lin(x, y)];
}

int write_matr(int x, int y, int m_size, int value)

{
    if (ch_coord(x, y))
        return 0;
    if (x >= m_size / 2)
        return 0;
    else
        return m_addr[lin(x, y)] = value;
}

static int lin(int x, int y)
{
    int n;
    n = NN - x;
    return SIZE - n * NN + y;
}

static char ch_coord(int x, int y)
{
    if ((!m_addr) || (x > SIZE) || (y > SIZE) || (x < 0) || (y < 0))
        return L2_RESULT = -1;
    return L2_RESULT = 0;
}

Есть такой код, при генерации матрицы, он мне заменяет правую часть матрицы на нули, как изменить его, чтобы у меня нули были в местах нечетными индексами строк и столбцов ?


text:
Q: I can't use the bios on an external monitor I have Samsung npc300esc and my screen is broken. I have connected it to a external monitor but the bios doesn't connect to it. I tried all FN+FKEY but nothing happen.
What can I do?

A: Could you try fn+ F4 button on your lap (settings button for displaying in external display).


text:
Q: Does a nested inner class automatically inherit from superclass of outer class in java? Say I have an Outer class A and it's nested Inner Class B. A is subclass of C. Then is B also a subclass of C? Since B can access all private members of A and thus that(public and protected) of it's superclass, so I think B becomes a subclass of C.
Is my line of thinking right?
Any help is highly appreciated.

A: Here's what you seem to be describing:
class C {}
class A extends C {
    static class B {}
}

Being a nested class in A does not make B a subclass of C. Access to members is not the defining characteristic of being a subclass.
Suppose you try to assign an object of type B to a variable of type C.
C c1 = new A(); // OK -- A is a subclass of C
C c2 = new A.B(); // Not OK

If B were a subclass of C, the latter would be a legal assignment. But it is not.

A: I don't think so. If you want B to extend C, you may explicitly say:
class C {}

class A extends C {

    static class B extends C {
        //Todo...
    }
}

The nested class B is just a (static) member of A just like any other member of it. You can access public and protected or even package access methods and variables of C within B because A has inherited those members from C. Since B is a nested class of A, You can access (static) members of A which can be inherited from other class or not.


text:
Q: knockout the "check" binding not working I am new to knockout, I have found an example of checkbox binding which could be very useful in my website.
Link to the example: http://knockoutjs.com/documentation/checked-binding.html
I tried to apply it to my page but it didn't work, then I tried to copy this example without changing anything but still it didn't work. I tried it on different browser(Chrome, Firefox, IE) and including different version of knockout libraries, but still it didn't work.
I have no other idea what I am doing wrong, please help!
Here is the code of this example:
<!DOCTYPE html>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Dokument bez tytułu</title>

Send me spam: <input type="checkbox" data-bind="checked: wantsSpam" />

Preferred flavors of spam:

<input type="checkbox" value="cherry" data-bind="checked: spamFlavors" /> Cherry

<input type="checkbox" value="almond" data-bind="checked: spamFlavors" /> Almond

<input type="checkbox" value="msg" data-bind="checked: spamFlavors" /> Monosodium Glutamate

A: What you are looking at is a fragment, not a fully working example. You need to do a couple of things.
You need to applyBindings:
ko.applyBindings(viewModel);

And you need to do that after the DOM has loaded (or knockout will get very upset).
Here's an example
I've updated my example a little to make it easier to see that the checkboxes are, in fact, bound. There's a list of the spamFlavors under the list of checkboxes that will change as you check and uncheck the checkboxes.


text:
Q: Kill children when the parent is killed Is there an easy way for Perl to kill child processes when the parent is killed? When I run kill on a parent PID the children stay alive.
Test script:
#!/usr/bin/perl

@sleeps = qw( 60 70 80 );
@pids   = ();

foreach $sleeptime (@sleeps) {

    my $pid = fork();

    if ( not defined $pid ) {
        die;
    }
    elsif ( $pid == 0 ) {

        #child
        system("sleep $sleeptime");
        exit;
    }
    else {

        #parent
        push @pids, $pid;
    }
}

foreach $pid (@pids) {
    waitpid( $pid, 0 );
}

A: Note   The second example, using END block, is more complete.
Note   Discussion of how to use the process group for this is at the end.

Most of the time chances are that you are dealing with SIGTERM signal. For this you can arrange to clean up child processes, via a handler. There are signals that cannot be trapped, notably SIGKILL and SIGSTOP. For those you'd have to go to the OS, per answer by Kaz.  Here is a sketch for others. Also see other code below it, comments below that, and process group use at the end.
use warnings;
use strict;
use feature qw(say);
say "Parent pid: $$";

$SIG{TERM} = \&handle_signal;  # Same for others that can (and should) be handled

END { say "In END block ..." }

my @kids;
for (1..4) {
    push @kids, fork;
    if ($kids[-1] == 0) { exec 'sleep 20' }
}
say "Started processes: @kids";
sleep 30;

sub handle_signal {
    my $signame = shift;
    say "Got $signame. Clean up child processes.";
    clean_up_kids(@kids);
    die "Die-ing for $signame signal";
};

sub clean_up_kids {
    say "\tSending TERM to processes @_";
    my $cnt = kill 'TERM', @_;
    say "\tNumber of processes signaled: $cnt";
    waitpid $_, 0 for @_;  # blocking
}

When I run this as signals.pl & and then kill it, it prints

[13] 4974
Parent pid: 4974
Started processes: 4978 4979 4980 4982
prompt> kill 4974
Got TERM. Clean up child processes.
        Sending TERM to processes 4978 4979 4980 4982
        Number of processes signaled: 4
Die-ing for TERM signal at signals.pl line 25.
In END block ...

[13]   Exit 4                        signals.pl

The processes do get killed, checked by ps aux | egrep '[s]leep' before and after kill.
By courtesy of die the END block gets executed orderly so you can clean up child processes there. That way you are also protected against uncaught die.  So you'd use the handler merely to ensure that the END block cleanup happens.
use POSIX "sys_wait_h";
$SIG{CHLD} = sub { while (waitpid(-1, WNOHANG) > 0) { } };  # non-blocking
$SIG{TERM} = \&handle_signal;

END {
    clean_up_kids(@kids);
    my @live = grep { kill 0, $_ } @kids;
    warn "Processes @live still running" if @live;
}

sub clean_up_kids {
    my $cnt = kill 'TERM', @_;
    say "Signaled $cnt processes.";
}
sub handle_signal { die "Die-ing for " . shift }

Here we reap (all) terminated child processes in a SIGCHLD handler, see Signals in perlipc and waitpid. We also check in the end whether they are all gone (and reaped).
The kill 0, $pid returns true even if the child is a zombie (exited but not reaped), and this may happen in tests as the parent checks right after. Add sleep 1 after clean_up_kids() if needed.
Some notes. This is nowhere near to a full list of things to consider. Along with mentioned (and other) Perl docs also see UNIX and C documentation as Perl's ipc is built directly over UNIX system tools.

*

*Practically all error checking is omitted here. Please add

*Waiting for particular processes is blocking so if some weren't terminated the program will hang. The non-blocking waitpid has another caveat, see linked perlipc docs

*Child processes may have exited before the parent was killed. The kill 'TERM' sends SIGTERM but this doesn't ensure that the child terminates. Processes may or may not be there

*Signal handlers may get invalidated in the END phase, see this post. In my tests the CHLD is still handled here but if this is a problem re-install the handler, as in the linked answer

*There are modules for various aspects of this. See sigtrap pragma for example

*One is well advised to not do much in signal handlers

*There is a lot going on and errors can have unexpected and far ranging consequences

If you kill the process group you won't have any of these issues, since all children are then terminated as well.  On my system this can be done at the terminal by

prompt> kill -s TERM -pid

You may have to use a numeric signal, generally 15 for TERM, see man kill on your system. The -pid stands for the process group, signified by the minus sign. The number is the same as the process ID, but add say getpgrp; to the code to see. If this process has not been simply launched by the shell, but say from another script, it will belong to its parent's process group, and so will its children. Then you need to set its own process group first, which its children will inherit, and then you can kill that process group. See setpgrp and getpgrp.

A: This is something that has to be done at the operating system in order to be reliable. Linux has a prctl (process control) system call which multiplexes numerous functions, similarly to ioctl. One of the functions (opcode PR_SET_PDEATHSIG) arranges for a process to receive a specific signal (passed as the second argument) when its parent dies.
There is a CPAN module wrapping up prctl where this appears as a set_pdeathsig function which takes the signal number.
Without prctl, a child process (which wasn't spawned by the init process and thus has a parent process ID other than 1, initially) can periodically test the value of getppid(). If that changes to 1, that means its original parent died.
Processes which manage children can also implement graceful shutdown logic: catch their termination signal and terminate their children as part of the cleanup. Of course, that is impossible for signals that can't be handled.

A: How about the following:
kill( -1 * getpgid(), 9 );

(9 is SIGKILL: no need for macros.)


text:
Q: Sum array values there key is the same I am extracting some data from MySQL, then I am trying to sum up the values of the resulting array where the keys are the same. I have done this before just fine in this piece of code:
$q = "SELECT * FROM comenzi";
        $result = $odb->query($q);

        $sumArr = array();
        while($row = $result->fetch(PDO::FETCH_ASSOC)) {
            if ( !isset($sumArr[ $row['meniu_name'] ]) ) {
                $sumArr[ $row['meniu_name'] ] = $row['meniu_name'];
            }
            $sumArr[ $row['meniu_name'] ] += $row['cantitate'];
        }
        arsort($sumArr);
        $rowCount = 1;
        echo "

#	produs	cantitate
";
        foreach ($sumArr as $key => $value) {
            echo "
" . $rowCount . "	" . $key . "	" . $value . "
";
            $rowCount++;
        }
        echo "
";

That is my working example, which brings us to my next one that is somewhat similar, yet for some reason it does not yield the required results:
$q = "SELECT * FROM comenzi";
        $result = $odb->query($q);

        $sumArr = array();
        while($row = $result->fetch(PDO::FETCH_ASSOC)) {
            if ( !isset($sumArr[ $row['utilizator'] ]) ) {
                // $sumArr[ $row['utilizator'] ] = $row['utilizator'];
            }
            $sumArr[ $row['utilizator'] ] += $row['cantitate'];
        }
        arsort($sumArr);
        print_r($sumArr);
        $rowCount = 1;
        echo "

#	utilizator	cantitate produse
";
        foreach ($sumArr as $k => $v) {

            $odb                =           new PDO("mysql:host=".$host.";dbname=".$db, $user, $pass);

            $stmtCheck  =       $odb->prepare('SELECT nume, prenume, email, telefon FROM utilizatori WHERE id=?');
            $stmtCheck->execute(array($k));
            $r = $stmtCheck->fetch();

            echo "
" . $rowCount . "	" . "nume: " . $r[0] . " prenume: " . $r[1] . " email: " . $r[2] . " telefon: " . $r[3] . "	" . $v . "
";
            $rowCount++;
        }
        echo "
";

What happens here, is quite dubious: the commented line // $sumArr[ $row['utilizator'] ] = $row['utilizator'];, if it is commented out I get the expected results, however having it commented out I get the errors:

Notice: Undefined offset

If I do not comment that line I do not get the Undefined offset errors, but my values are ridiculous.
Correct values: Array ( [22] => 19 [32] => 11 )
Values with that line not commented out: Array ( [32] => 43 [22] => 41 )
I cannot even understand a mathematical way it gets to those values, can't find anything that could throw me the right direction, therefore I'm baffled.

A: You just have to initialize your entry to 0 :
while($row = $result->fetch(PDO::FETCH_ASSOC)) {
    if(!isset($sumArr[ $row['utilizator'] ])) $sumArr[ $row['utilizator'] ] = 0;
    $sumArr[ $row['utilizator'] ] += $row['cantitate'];
}

The if line will create the $row['utilizator'] entry in the $sumArr array and will initialize its value to 0.
The problem you had is that you initialized it with a string I think :
$sumArr[ $row['meniu_name'] ] = $row['meniu_name'];

IMO $row['meniu_name'] is a string. Then, when you do addition on a string, PHP tends to convert this string into integer, which gives you weird results you noticed.

A: You need to learn SQL first: as the listing below illustrates, you can do all of this in one query, which is both simpler and more efficient than trying to drag down all of the data and then process it.
SELECT nume, prenume, email, telefon, utilizator, sum(cantitate)
FROM comenzi, utilizatori WHERE id = utilizator GROUP BY utilizator


text:
Q: Error message linking a C++ Builder 10.1 Berlin project [ilink32 Error] Error: Unresolved external '__fastcall System::Variant::Exec(System::AutoCmd&, int) const' referenced from
I am getting the above error message when I am trying to use the new 32-bit compiler in C++ Builder 10.1 Berlin instead of the classic compiler.
This same piece of code compiles successfully using the classic compiler.
I know something is probably missing (a lib?), but what?
Any idea?


text:
Q: Will a DDR2 2 GB RAM module be compatible with my existing DDR2 1 GB? I use an old system with a G31D-M7 motherboard with 2 DDR2 memory banks. The module I plan to use is a 2GB DDR2-667 type. I'm sure my existing module is a 1GB DDR2-667 too. The Brands are not same.
I understand maybe having two identical 2 GB modules and possibly upgrading my motherboard would be the optimal solution but in my scenario, that's not possible. So kindly tell me if these two modules will get along in my motherboard.
Also, do those need to be slotted correctly or can be slotted in any order I desire?

A: That will work without problems. (If you're sure both sticks have the same frequency capabilities)
You just won't be able to use the "dual channel" which is just a performance enhancement. See
Wikipedia page about dual channel for more details.


text: Q: Differential equation system (coupled) I have a system with some differential equations. The equations are coupled, in this way: $f'_n(x)=Af_{n-1}(x)+Bf_{n+1}(x)+Cf_n$. I would like to solve the system. I am a beginner in Mathematica. Could someone help me?


text:
Q: what is the best way for loading assets (images) into memory using opengl? This question is not regarding a specific platform and is related to OpenGL ES.
My brother and I are creating a simple 2d adventure game but we are both new to pure OpenGL programming and are probably missing something obvious.
We are loading a simple PNG texture that will be the game background. That texture is a full HD (1920x1080) png file has a size on the disk of 2.7MB. Once loaded in memory that same file now holds nearly 9MB in memory.
Here is a sample of the code in charge of loading a file.
int
texture_gl_create(texture_t* texture)
{
    int err;

    if (texture->id) {
        err = texture_gl_delete(texture);
        if (err) {
            return err;
        }
    }

    GL_CHECK(glGenTextures, 1, &texture->id);
    LOGD("Texture has id: %d", texture->id);

    GL_CHECK(glBindTexture, texture->target, texture->id);

    switch (texture->byte) {
        case 1:
            glPixelStorei(GL_PACK_ALIGNMENT, 1);
            break;
        case 2:
            glPixelStorei(GL_PACK_ALIGNMENT, 2);
            break;
        case 3:
        case 4:
            glPixelStorei(GL_PACK_ALIGNMENT, 4);
            break;
    }

    GL_CHECK(glTexParameteri, texture->target,
             GL_TEXTURE_MIN_FILTER, GL_LINEAR);
    GL_CHECK(glTexParameteri, texture->target,
             GL_TEXTURE_MAG_FILTER, GL_LINEAR);
    GL_CHECK(glTexParameteri, texture->target,
             GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
    GL_CHECK(glTexParameteri, texture->target,
             GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);

    GL_CHECK(glTexImage2D, texture->target, 0,
             texture->iformat,
             texture->width, texture->height, 0,
             texture->format, texture->type,
             texture->pixels);

    GL_CHECK(glBindTexture, texture->target, 0);

    return 0;
}

A simple look at the memory allocation shows that the call to glTextImage2D loads 8MB into memory !
From our understanding this is because the call to glTexImage2D loads a RAW file from the texture-target data into memory. Therefore there's roughly 4 bytes per pixel (RGBA) x 1920 x 1080 = 8.1 MB.
I can hardly believe that this is how the video game industry handles the problem, there must be a much better way to load images into memory.
My question is therefore, what's the best way to load images in OpenGL (ES) so that we use as little memory as possible ?

A: Use texture compression. These special compression algorithms like PVRTC allow fast on-the-fly decompression in the image pipeline, reducing video memory consumption and texture upload times.
When using glCompressedTexImage2D you need to specify the type of compression (internal format) used, and you will need to figure out which compression is supported by the GPU by checking the extensions.


text:
Q: How to use DIR-842 as an access point? I have a D-Link DIR-842 that I'd like to use as an access point as I already have a wireless router my ISP sent me.
Browsing the Web GUI I can find any setting that'd make it an access point.
How do turn a DIR-842 to a wireless access point?

A: It's easy, but you'll not get 4 LAN ports from it, only 3.
The thing is that the WAN port cant be used for anything else than WAN.
To setup DIR-842 as an access point

*

*Login to the routers web GUI (dlinkrouter.local)

*Give it a static LAN IP not available in your ISP routers DHCP pool so that you can access it later

*Disable the DHCP server in the DIR-842.

*Connect a cable from your ISP router to one of the LAN ports of the 842.

*Login to the router and disable pretty much everything not needed and setup wireless.

You've now turned it into an access point. You can use the other 3 Gbps ports for connecting other stuff.


text:
Q: How to navigate through
* elements using arrow keys - jQuery? I'm trying to navigate between list items with the following structure using keyboard arrow keys - help appreciated
I rather not paste my own code here as it has a lot of attributes that is not have anything to do with the problem. I could possibly add a class on each selected item?

Card Item1

Card Item2

Card Item3

Card Item3

Card Item4

Card Item5

A: Place all the li elements into a collection and set up a tracking variable.
Then set up a keydown event handler for the document that alters the tracker variable based on which key was pressed and apply styling to the element that has an index in its collect that matches the tracking variable.
See comments inline below for details:

// Get all the
 elements into a collection
var listItems = document.querySelectorAll(".card-list li");

// Set up a counter to keep track of which
 is selected
var currentLI = 0;

// Initialize first li as the selected (focused) one:
listItems[currentLI].classList.add("highlight");

// Set up a key event handler for the document
document.addEventListener("keydown", function(event){
  // Check for up/down key presses
  switch(event.keyCode){
    case 38: // Up arrow
      // Remove the highlighting from the previous element
      listItems[currentLI].classList.remove("highlight");

      currentLI = currentLI > 0 ? --currentLI : 0;     // Decrease the counter
      listItems[currentLI].classList.add("highlight"); // Highlight the new element
      break;
    case 40: // Down arrow
      // Remove the highlighting from the previous element
      listItems[currentLI].classList.remove("highlight");

      currentLI = currentLI < listItems.length-1 ? ++currentLI : listItems.length-1; // Increase counter
      listItems[currentLI].classList.add("highlight");       // Highlight the new element
      break;
  }
});
.highlight { background-color:#ff0; }

Card Item1

Card Item2

Card Item3

Card Item3

Card Item4

Card Item5

A: Your question is quite vague, without seeing what you have done I can only recommend that you should look into the use of Javascript and the onkeypress() event handler.
You can get a list of your  tags by giving them all a class, lets call it "cardATags".
var aList = document.querySelectorAll(".cardATags");

We will start the page at an index of 0.
var index = 0;

and set them to the currently focused item with something like
aList[index].focus();

Now in your onkeypress() event handler you can increment the index and set the next focused item.
Good luck.
A bit of clarification, add classes to your code like so:

Card Item1

Card Item2

Card Item3

Card Item3

Card Item4

Card Item5

A:

$('li').eq(0).addClass('active')
$('.cardATags').eq(0).focus();

$(document).keydown(function(e) {
   var li_count=$('li').length;
   var curent_active=0;

   var each_counter=0;
   $('li').each(function(){
        if( $(this).hasClass('active')){
            curent_active=each_counter;
        }
        each_counter++;
   });

  if(e.keyCode == 37) { // left
    curent_active-=1;
  }else if(e.keyCode == 39) { // right
     curent_active+=1;
  }if(e.keyCode == 38) {  // top
    curent_active-=1;
  }if(e.keyCode == 40) {  // bott
    curent_active+=1;
  }

  if(curent_active==li_count){
     curent_active=0;
  }

  $('li').removeClass('active');
  $('li').eq(curent_active).addClass('active');

});
   .active{
      background-color:gray;
   }

Press UP or DOWN or LEFT or RIGHT arrows...

Card Item1

Card Item2

Card Item3

Card Item3

Card Item4

Card Item5

A: This may not be what you are looking for, but someone else may find my solution helpful. Given the following list:

  Project 1

  Project 2

  Project 3

There were 2 things I needed to do to get this working:

*

*add tabindex="0" to each of the
 - this allows the list element to be focusable (and thus allowing you to use the arrow keys to navigate)

*I used jQuery on a down arrow event to move the focus on to the first  tag of the first
 of the wrapper
 e.g. jQuery("#my_ul > li > a").first().focus(); (where my_ul is the id of the wrapper
). In my case, unlike yours, I put the  tags inside the
 - not sure if that makes a difference, but thought it worth mentioning.


text:
Q: MIPS fetch address not aligned on word boundary, used .align 4, still no go any ideas? Why I am getting:
Runtime exception at 0x00400020: fetch address not aligned on word boundary 0x00000007
Problem line is: lw $s1,0($a1)  #copy arg2 = size of array
.data
    .align 4 #added this, didnt work
    size:   .word   7
    .align 4 #added this, didnt work
    search: .word   30
    .align 4 #added this,didnt work
    array:  .word 10,20,30,40,50,60,70
    .align 4

.text

main:

            la  $a0,array   #$a0 = address of array
            lw  $a1,size    #a1 = size of array
            lw  $a2,search  #$a2 = search key

COUNT:
            lw $s0,0($a0)   #copy arg1 = address array
            addi $s1,$zero,7
            lw $s1,0($a1)   #copy arg2 = size of array
            lw $s2,0($a2)   #copy arg3 = search key (n)
            addi $s2,$zero,30
            COUNTLOOP:
            add $v0,$zero,$zero #v0 = res
            add $t0,$zero,$zero #$t0 = init i to 0
            slt $t1,$t0,$s1     #check if i > size of array
            beq $t1,$zero,DONECOUNT #i is n so end
            sll $t2,$s0,2       #$t2 = get off set for a[i]
            lw  $t3,0($t2)      #$t3 = get value of a[i]
            bne $t3,$s2,CLOOPBTM #check if a[i] == seach key
            addi $v0,$v0,1      #if above then increment res
            CLOOPBTM:
            addi $t0,$t0,1
            j COUNTLOOP
            DONECOUNT:

A: The problem with the code is, that you're not using the address where the size is stored but the size itself:
Here you load the address into A0 and the size (7) into A1:
        la  $a0,array
        lw  $a1,size    #a1 = size of array

Here you load the first word stored at your array (that will load a 10). This is not what you've intended.
        lw $s0,0($a0)   #copy arg1 = address array
        addi $s1,$zero,7

Here you load the first word stored at location 0x000007. (your size). This
is probably also not intended and will cause an exception because the address is not aligned:
        lw $s1,0($a1)   #copy arg2 = size of array

and so on.
It seems to me, that you have a misunderstanding what the LW instruction does. It reads a memory location into a register. What you want in the prolog of your loop is to make copies of a register.
To do so you can use the move pseudo instruction if your assembler supports it. Otherwise use the OR instruction to copy registers like this:
COUNT:
            or    $s0, $a0, $a0   #copy arg1 = address array
            addi  $s1, $zero,7
            or    $s1, $a1, $a1   #copy arg2 = size of array
            or    $s2, $a2, $a2   #copy arg3 = search key (n)
            addi  $s2, $zero,30
            COUNTLOOP:

            ...

for a complete example of a linear search loop try this (untested and expects that the assembler cares about the delay slots)
main:

            la  $a0,array            # $a0 = address of array
            lw  $a1,size             # $a1  = size of array
            lw  $a2,search           # $a2 = search key

            beq $a1, $zero, NOTFOUND # handle the size==0 case..
            or  $v0, $zero, $zero    # init counter to zero

LOOP:
            lw  $s0, 0($a0)          # load element
            beq $s0, $a2, FOUND      # branch if key found:

            addiu $a0, $a0, 4        # increment array pointer
            addiu $v0, $v0, 1        # increment loop counter
            bne   $v0, $a1, LOOP     # repeat until we've processed the array.

NOTFOUND:
            # --------------------------------------
            # if you reach this, key does not exist:
            # --------------------------------------
            li  $v0, -1              # load a -1 to signal key not found.
            jr  $lr                  # return to caller

FOUND:
            # -----------------------------------------
            # v0 now contains the position of the key.
            # -----------------------------------------
            jr  $lr


text:
Q: FFMPEG question - FFMPEG no convert to the same extension I have a question how can I do if the file has the same extension in case it is gif to gif. ffmpeg no convert to the same extension. Make ffmpeg just ignore the file?
I'm currently using
-ss 5 -i filename.gif -t 10 -pix_fmt rgb24 filename.gif 2> & 1 ";
In my project there are other extensions, but it would not be necessary to convert a file that is already in the desired extension.
Every help is welcome.
Thanks in advance.

A: I think I understand your doubt, ffmpeg will not ignore if the file has the same extension you are the one who must define this in your code.
But maybe it helps this string greatly reduces the size of the gif file, because I believe that your biggest problem is gifs in the output with size larger than in the input.
Try this. ->
-i file.gif -pix_fmt rgb24 -r 4 -vf scale=540:-1 file.gif 2>&1


text:
Q: VF page for System Admin to list details of all apps in the organization is it possible to create a VF page visible to System Admin which will list and provide links for all the apps present in the organization?
please provide pointers on how to proceed with it

A: You can take help from Object AppMenuItem . In which you will get complete details and you can use read-only object to view an entry in the Force.com App Menu. You can create a SOQL query to retrieve all items, even those a user does not see from the user interface.


text:
Q: Cursor jumps in the beginning of the input line after each letter in 1 millisecond in browsers on some sites (e.g.Youtube comments field) AS I typing a letter in the field in 1 millisecond cursor jumps in the beginning of the line of typing field so that text is typed invert-(I only can send some message on particular sites(you tube comments and https://translate.yandex.com/ for example after typing it in notebook, copying and pasting in youtube comments). I try to understand it hard and up to this moment I've learnt that it relates to CSS and particular line appears while it stops (). Please help me to understand on my low level of knowledge how can I stop this problem. Where I can reset settings on my win 10 system to stop my two browsers to act this way. (It started to occur after I deleted cookies of a couple of sites and win defender says no viruses..).
I tried to learn how to implement (or encode) a script that some people put forth on some sites into in-built system but I failed up to this moment and it disturbes me. 1) what code or script 2)where or how to paste it or type in as I imagine it should be to solve the issue. I've learnt how to read scripts in browsers (shift+ctrl+I) and they call it css in js and I compared to pages where issue stop to occur when I deleted some lines with div(many tries and I understood by comparing) and reloaded and the problem disappeared when div was set typing settings to default(). Sorry for being so prolix as I'm from the opposite hemisphere, lerned English and not quite sure wheather to be understood. As this drilling my mind I can't do anything but finding solution. Thank you, hope you understand.

A: If you only use Chromium-based browsers, then you should see if the problem also occurs in a Gecko-based browser. If the error only occurs in Chromium based browsers, then it must be a Chromium bug. Otherwise it can only be the system.
Chromium based browsers are e.g.:

*

*Google Chrome

*Opera

*Edge

*brave

Gecko based browsers are e.g.:

*

*Firefox

*Goal

You can find more information on how to report a bug in the Google Chrome Help Center here.

A: So, I have just managed this problem cause my mind coldn't set still.. I noticed that when I used the Linguist translator extension that was installed on both of my browsers Edge and Chrome for translation of from native language it just couldn't stop translating changing letters and the pattern was some bold letters in the beginning of sentences which also occured in typing on site input fields and youtube auto-generated subtitles. I removed extensions and the problem ceased to manifest itself.


text:
Q: In common lisp, is there any difference to create a vector using '#(...) or just #(...)? In Common Lisp (SBCL), it is possible to create vectors (arrays) using ' before the # or not:
CL-USER> '#(a b c)
#(A B C)

CL-USER> #(a b c)
#(A B C)

Apparently, they seem to generate the same object. After using type-of and describe on these expressions, they return identical information:
CL-USER> (type-of #(a b c))
(SIMPLE-VECTOR 3)
CL-USER> (type-of '#(a b c))
(SIMPLE-VECTOR 3)
CL-USER> (describe #(a b c))
#(A B C)
  [simple-vector]

Element-type: T
Length: 3
; No value
CL-USER> (describe '#(a b c))
#(A B C)
  [simple-vector]

Element-type: T
Length: 3
; No value

Equality is also the same (with equalp):
CL-USER> (equalp '#(a b c) #(a b c))
T

But differs wit equal:
CL-USER> (equal '#(a b c) #(a b c))
NIL

The ' is not the responsible for the above result being NIL:
CL-USER> (equal '#(a b c) '#(a b c))
NIL

Is there any practical consequences of using one approach instead of the other when creating arrays?
Thanks.

A: quoting
To clear any confusion, '#(a b c) starts with an apostrophe, which quotes a value; this is the same as having (quote #(a b c)). Quoting evaluates as the literal value being quoted.
CL-USER> '3
3
CL-USER> 'a
A
CL-USER> '#(a b c)
#(a b c)

literals
Generally, quoting an expression and evaluating it does not give the same value. For example:
CL-USER> (equalp '(vector 1) (vector 1))
NIL

Above, '(vector 1) evaluates as a list of two values (a symbol and a number), but (vector 1) as a vector of one element.
For literal values, however, they have the same value whether they are quoted or not:
CL-USER> (= '3 3)
T

The literal vector #(a b c) behaves the same, it is self-evaluating. When the form is read, the reader creates a vector object. Such an object evaluates as itself:
CL-USER> (eval #(a b c))
#(a b c)

equal
The use of equal can be surprising here, but the result is consistent with the definition:

Two arrays are equal only if they are eq, with one exception: strings and bit vectors are compared element-by-element (using eql).

Here you don't manipulate strings or bit-vectors, so you only test for identity, as-if you used EQ. But you have two different instances of the vector, once quoted, once not quoted, and they are likely to be two distinct vectors (but EQ (and so, EQUAL too) could be T with a different compiler).
conclusion

Is there any practical consequences of using one approach instead of the other when creating arrays?

I don't think so, you generally don't quote numbers, the same goes for array literals.
NB. as for all literal values, you should not mutate them, they are constant values.


text:
Q: Python: problem with reading csv-file on Mac When I use the following code, the data extracted from file.csv is not comma-separated, but separated with ";". I don't know why this happens, is it something with special with Mac? What can I do about it?
import pandas as pd
data = pd.read_csv("file.csv")

A: You can define which separator to use -
data = pd.read_csv("file.csv", sep=";")

A: Try this
import pandas as pd
data = pd.read_csv("file.csv", sep=','))
return data

A: You should be able to specify the separator like this:
import pandas as pd
data = pd.read_csv('file.csv', sep=';')


text:
Q: For loop statement in batch program repeats 5 times But I'm still having an issue with regards to the program I posted previously. I think there is a problem in my for loop statement because after I opened the file "passwords.csv", I noticed that the loop repeated 5 times.
The first record R_000100.pdf was initially assigned the password 8337, but repeated in other rows and reassigned with other random passwords. And when I tried to open the PDF file, it seems that the last random password assigned (which is 13429) was really its password, and not 8337.
What should I do to correct the program wherein after the all the PDF files have been combined and assigned with passwords, the program will already stop the loop and exit? Thus having only one entry in the output file "passwords.csv" and won't repeat 5 times.
Below is the complete batch program I accomplished, with the help of Peter Wright.
@echo off
SETLOCAL ENABLEDELAYEDEXPANSION

for /f "tokens=1,2 delims=ABCDEF_." %%i in ('dir *.txt *.pdf /b') do (

TXTtoPDF A_%%i.txt A_%%i.pdf -pps4 -pfs10.9
TXTtoPDF B_%%i.txt B_%%i.pdf -pps4 -pfs8.9
TXTtoPDF C_%%i.txt C_%%i.pdf -pps4 -plm50 -prm50 -pfs7.9
TXTtoPDF D_%%i.txt D_%%i.pdf -pps4 -plm60 -prm60 -pfs8.9
TXTtoPDF E_%%i.txt E_%%i.pdf -pps5 -pot -pfs10
TXTtoPDF F_%%i.txt F_%%i.pdf -pps5 -pot -pfs12

set pass=!random!
pdftk *%%i.pdf cat output PDF\R_%%i.pdf user_pw !pass!
echo %%i R_%%i.pdf !pass! >> passwords.csv

)

echo                ***************************************************
echo                *                                                 *
echo                *       PDF REPORTS SUCCESSFULLY GENERATED.       *
echo                *       PLEASE TYPE EXIT AT COMMAND PROMPT.       *
echo                *                                                 *
echo                ***************************************************
pause
exit

A: Easy, what you have to do is give the batch file the logic to realise which line it is up to.
Replace :
for /f "tokens=1,2 delims=ABCDEF_." %%i in ('dir *.txt *.pdf /b') do (

With :
set /a count=0
for /f "tokens=1,2 delims=ABCDEF_." %%i in ('dir *.txt *.pdf /b') do (
set /a count+=1
if !count! equ 1 (

Note : add an extra bracket when closing the for-loop for the if-loop
This way, it will count each line the for-loop parse's. If you want to set your password for the second or fifth line, replace if !count! equ 1 ( with if !count! equ 2 ( or if !count! equ 5 ( respectively.
It is useful to do this in all batch files when using for-loops. It is done by default when using an actual programming language.
Hope this helped.
Yours Mona


text:
Q: A faithful positive Radon measure Let $X$ be a locally comapct and Hausdorff space. We say a positive Radon Measure on $X$ is faithful if
$$0\leq f ~~~,~~~\int fd\mu=0\rightarrow f(x)=0 ~~\forall x\in X$$
Q: True or false: If there is a faithful positive Radon measure on $X$ then $X$ has a countable dense subset ?!

A: Let $\Gamma$ be a set of cardinality greater than the continuum. Consider the product measures on $\{0,1\}^\Gamma$ or $[0,1]^\Gamma$. Then they are both faithful even though the underlying compact spaces are non-separable.
Under some extra set-theoretic assumptions, it is even possible to construct a compactification $\alpha \mathbb{N}$ of $\mathbb{N}$ with $\alpha \mathbb{N}\setminus \mathbb{N}$ non-separable having a faithful Radon measure.


text:
Q: Replicating Script Behavior in Templates I am currently trying to build a website using a header.html template included in an index.html file.
I currently have the template working. I had been using jQuery Rotate (http://jqueryrotate.com/) to make the logo flip upside down on a mouseover.
Since Angular won't allow <script> tags in templates for security reasons I was wondering what the standard practice is to replicate script behaviors. I can still use ng-mouseover and ng-mouseleave. Is there a convenient way to call the jQuery Rotate functions from my controller?


text:
Q: How to do Windows 8.1 "Now Playing" global audio playback I'm working on a Windows 8.1 store app, and I am using the Hub Control for the base.
While I've successfully figured out how to do global audio playback using the MediaElement control, what I can't figure out is how to have a "now playing" system similar to Audible's app.
I would like for the main hub control page to have a larger "now playing" control, and on the individual item pages have some kind of smaller control at the top-right of the screen.
I've read through all the documentation and tutorials I could find on media playback, but I can't seem to find anything about how to do this.
Could anyone point me in the right direction?
Thanks!

A: Create a custom UserControl that fits your needs.
Create two VisualStates for it, small and large.
Then hook into your HubControl's SectionsInViewChanged event.
On the removal of your main page, go to the smaller VisualState, then on adding it back in, go back to the larger VisualState. You can also use a VisualTransition to make a nice animation between the two.


text:
Q: Using TPTP to profile an Eclipse Plugin I'm currently trying to profile an Eclipse Plugin using the TPTP tools.  However, I have run into issues when trying to profile an plugin.  I can profile a Java application fine, however when I try to profile an plugin, the runtime workbench fails to load and the profiling terminates after a few seconds.
I'm at a lost to what I'm doing wrong; I'm using Eclipse 3.4.0 and have the following TPTP features installed.  Is there something I'm missing?
org.eclipse.tptp.platform.analysis (4.4.101.v200901090956-7F7_EC6_kE77g7A7g7A77) "TPTP Analysis"
org.eclipse.tptp.platform.analysis.codereview.java (4.4.201.v200901090956-7877_98s733K353K3533) "Java Code Review Plug-in"
org.eclipse.tptp.platform.analysis.engine (4.3.300.v200901090956-784CE8s733J464H3533) "TPTP Analysis Engine"
org.eclipse.tptp.platform.core (4.5.2.v200901090956-8Z8DF8kELRXmqCoI2oujyq) "TPTP Platform"
org.eclipse.tptp.platform.core.doc.user (4.3.301.v200901090956-7B6EC49oA55U697O5855) "TPTP Platform Project Documentation"
org.eclipse.tptp.platform.doc.user (4.3.301.v200901090956-7B77EC58_JLz0Y3HuPJBbBLAT9B6) "TPTP Platform Project Documentation"
org.eclipse.tptp.platform.instrumentation.ui (4.2.200.v200901090956-78778a8s733K353K3533) "TPTP Instrumentation UI Core"
org.eclipse.tptp.platform.integration.pde (4.4.100.v200901090956-438Y7w311_121_1211) "TPTP Platform Integration PDE"
org.eclipse.tptp.platform.jvmti (4.3.201.v200901090956-7877CF8s733K364J3533) "TPTP JVMTI Profiler Client"
org.eclipse.tptp.platform.la.core (4.3.200.v200812160100-42_77w311923271211) "Log Analysis Core backward compatibility"
org.eclipse.tptp.platform.lta (4.3.300.v200901090956-783Dp8s733J464H3533) "TPTP Log and Trace Analyzer"
org.eclipse.tptp.platform.probekit (4.3.301.v200901090956-7F5ELS_kE77g7A9g7A77) "TPTP ProbeKit"
org.eclipse.tptp.platform.probekit.doc.user (4.3.300.v200901090956-41Ag7w311_121_1211) "Probekit User Documentation"
org.eclipse.tptp.platform.report (4.2.300.v200901090956-7B5EAU9oA55V585V5855) "TPTP Charting Service"
org.eclipse.tptp.platform.samples (4.3.300.v200901090956-7B4EDc9oA55V586R5855) "TPTP Platform Samples"
org.eclipse.tptp.platform.statistical.ui (4.1.500.v200901090956-783CE8s733J365H3533) "TPTP Statistical UI"
org.eclipse.tptp.platform.trace (4.3.301.v200901090956-7J7EEFFAgI99r9EAh9D99) "TPTP Platform Trace"
org.eclipse.tptp.trace (4.2.201.v200901090956-781EDf8s733K353K3KCE) "TPTP Trace"
org.eclipse.tptp.trace.arm (4.2.200.v200901090956-782CE8s733K353K3KCE) "TPTP ARM Monitoring "
org.eclipse.tptp.trace.arm.ui (4.3.200.v200901090956-785Ag8s733K353K3KCE) "Instrument ARM UI"
org.eclipse.tptp.trace.jvmti (4.2.201.v200901090956-43_87w311_12211211) "TPTP Trace JVMTI Client"


text:
Q: Certain Tkinter options not available when in IDLE I am trying to create a button that when the widget is active in changes color (I am using python-idle3).
I tried importing tkinter as follows:
from tkinter import *
from tkinter import ttk

My button creation codes are as follows but does not work when I included the activebackground option
start_button=Button(window_frame,text="START",width=70,height=2).grid(row=8,column=0,stick="E",activebackground="black")

Error message when using activebackground:
Traceback (most recent call last):   File "/root/Desktop/GUi #1.py",
line 37, in <module>
   Button_expirement()   File "/root/Desktop/GUi #1.py", line 26, in Button_expirement
   start_button=Button(window_frame,text="START",width=70,height=2).grid(row=8,column=0,stick="E",activebackground="black")
File "/usr/lib/python3.2/tkinter/__init__.py", line 1914, in
grid_configure
    + self._options(cnf, kw))
**_tkinter.TclError: bad option "-activebackground": must be -column, -columnspan, -in, -ipadx, -ipady, -padx, -pady, -row, -rowspan, or -sticky**

I noticed that some other widget features are also limited. Any solution to this?

A: activebackground isn't part of the function call to grid. See http://effbot.org/tkinterbook/grid.htm
But it is in the function call to Button. See http://effbot.org/tkinterbook/button.htm
So perhaps you meant to write this?
start_button=Button(window_frame,text="START",width=70,height=2,activebackground="black").grid(row=8,column=0,stick="E")

...or if you meant to set the background to black, you can set it in the Tk variable (see
Python Tkinter how to color a window using grid).
root = Tk()
root.configure(bg='black')


text:
Q: About this Javascript Code Construct I am currently debugging some code right now but I cant get myself around this concept in javascript.
I have this code construct.
if(!COMPANY)
    COMPANY = {};

COMPANY.Billing = (function(COMPANY){
    //More code
})(COMPANY);

As, i understand, it creates an object called "COMPANY" and then adds a new property called "Billing"
but I dont understand the idea of passing the same "COMPANY" into the arguments of the function and at the
same time renaming it to "COMPANY" again.  What I mean is what is the difference between the code above
and the  code below.
COMPANY.Billing = (function(COMPANY){
    //More code
})();

My javascript is not that deep so I would like to understand what the code construct above means.  This might be some javascript design pattern but I dont know what it is

A: It isn't renaming COMPANY; it's using it. Annotated version of your code:
if(!COMPANY)            // if COMPANY doesn't exist...
    COMPANY = {};       // initialize it to a blank object

COMPANY.Billing =       // initialize a property
    (function(COMPANY){ // this defines a function
        //More code
    })(COMPANY);        // this executes the function with COMPANY as the parameter
// COMPANY.Billing now contains the result of executing the anonymous function

This is called a closure. Example:
foo = (function(x) {
    return ++x;
})(4);

This defines a function, then executes with parameter x = 4. So, it returns ++x, which is 5. Therefore, foo is assigned the value 5.
When you do this:
COMPANY.Billing = (function(COMPANY){
    //More code
})();

You are defining a closure and executing it, but you are passing nothing as a parameter. So, COMPANY is undefined inside the closure.


text:
Q: Given a string, how do I use JQuery to add a class to it? var s = '<button class="add_friend_action btn success">abc</button>';

How do I add a class "mini" to this?
$(s).addClass('mini') does not work...when I console.log(s), it returns back to normal.

A: I assure you, $(s).addClass('mini') works just fine. Try this:
var s = '<button class="add_friend_action btn success">abc</button>';
var $temp = $(s).addClass('mini');
console.log($temp);

A:
$(s).addClass('mini') does not work...when I console.log(s), it returns back to normal

That's because strings are immutable, you need to output the html of $(s) to a new string to get the added class.
$('<div>').append($(s).addClass('mini')).html();

A: jQuery in this sense is used to manipulate elements after they are already a part of the DOM, and since 's' is, at this point just a string, jQuery won't see it as something that can have a class.
So there are a couple of different way you can accomplish this, the easiest might be to give you string up there an attribute that you can use to target it (or just use the one that is there) and in your doc ready ( or after this element has been created if it isn't on the initial DOM completion) for example:
$('elementTargetName').addClass('mini');

Hope this helps!

A: If you want to change the string itself, this would be a way: http://jsfiddle.net/AHH5G/1/.
var s = '<button class="add_friend_action btn success">abc</button>';

s = $(s).addClass("mini").wrap("<div>").parent().html();

Basically, you parse it, add a class, then get the "outer" HTML by wrapping it and calling .html() on the wrapper element.

A: Try this:
var bt = $("<button/>").addClass("add_friend_action btn success mini").text("abc");


text:
Q: GNOME Shell Theme css documentation Where can I find documentation about the GNOME Shell theme css elements?
For instance, if I want to change the style of the "Activites" which css class/id do I have to tweak?
More in general I'm looking for somethings that maps each gnome shell element to its class / id in the css
Thanks!

A: Well I still cannot find documentation, however by looking into other themes I could finally find what I was looking for this specific case.
#panelActivities

is the style to tweak

A: This might be a little dated, but I was able to track down a somewhat authoratiative source. Starting with the documentation that turns up for developing on gnome shell:
https://wiki.gnome.org/Projects/GnomeShell/Development
The CSS section mentions that the theme stuff is located in gnome-shell/source/gnome-shell/data/theme/gnome-shell.css. Of course, it doesn't give a link or anything. From there, I googled for the source code, picked a reasonably recent version and hoped that I could browse the code using the path in the documentation. Lo and behold, the CSS!
https://git.gnome.org/browse/gnome-shell/tree/data/theme/gnome-shell.css?h=gnome-3-18
In my case, I wanted to make all of the font smaller but I didn't know what the root element was. I was able to determine that stage is what I should target with something like font-size: 0.8em in my custom theme in ~/.themes/Naddeo/gnome-shell/gnome-shell.css. This is my entire CSS file in case someone else is trying a real theme but they want to override one or two things. To use it, just pick it in the gnome tweak tool as your shell theme.
@import url("/usr/share/gnome-shell/theme/gnome-shell.css");

stage {
    font-size: 0.8em;
    height: 1.50em;
}


text:
Q: Redis doesn't return WRONGTYPE as an error in a transaction Appologies if this was already asked. First, let me show how to reproduce my problem:

*

*Run Redis in a docker container

*Connect to Redis and execute the following command:

> SET test 10

*In Go, run this code:

func main() {
    redisClient := getConnection() // Abstracting get connection for simplicity

    r, err := redisClient.Do("HSET", "test", "f1", "v1", "f2", "v2")
    fmt.Printf("%+v e: %+v\n")
}

Fair enough, in this step the following error is shown (this means err != nil):
WRONGTYPE Operation against a key holding the wrong kind of value e: WRONGTYPE Operation against a key holding the wrong kind of value

*In comparison, execute the following code:

func main() {
    redisClient := getConnection()

    redisClient.Send("MULTI")

    redisClient.Send("HSET", "test", "f1", "v1", "f2", "v2")

    r, err := redisClient.Do("EXEC")
    fmt.Printf("%+v e: %+v\n")
}

The line being printed is:
WRONGTYPE Operation against a key holding the wrong kind of value e: <nil>

This seems inconsistent to me as I would expect MULTI to return the WRONGTYPE in the error variable as well.
Is this an intended behavior or am I missing something?

A: There are two results for each command in a Redis transaction.  One is the result for adding the command to the transaction and the other is the result for executing the command in the transaction.
The Do method returns the result for adding the command to the transaction.
The Redis EXEC command returns an array where each element is the result of executing the command in the transaction.  Examine each element to check individual command errors:
values, err := redis.Values(redisClient.Do("EXEC"))
if err != nil {
    // Handle error
}
if err, ok := values[0].(redis.Error); ok {
    // Handle error for command 0.
    // Adjust the index to match the actual index of
    // of the HMSET command in the transaction.
}

A helper function for testing transaction command errors may be useful:
func execValues(reply interface{}, err error) ([]interface{}, error) {
    if err != nil {
        return nil, err
    }
    values, ok := reply.([]interface{})
    if !ok {
        return nil, fmt.Errorf("unexpected type for EXEC reply, got type %T", reply)
    }
    for _, v := range values {
        if err, ok := v.(redis.Error); ok {
            return values, err
        }
    }
    return values, nil
}

Use it like this:
values, err := execValues(redisClient.Do("EXEC"))
if err != nil {
    // Handle error.
}


text:
Q: How do I find required sample size for my survey given the data I have from my pilot survey? I have a data set which has a boolean variable (the question being 'Have you been the recipient of a blood transfusion?') it has either yes or no as the output.
I currently have 118 replies to this question (about .0518 of the respondents have said yes) and want to find out how many more people I should ask this question before I have a 95% confidence interval on the true proportion of people in the whole population.
I have used the formula (3) from the paper Modern Methods in the Sampling of Human by JEROME CORNFIELD but I'm not fully sure if it's correct.
I have also used the formula (Z_(α/2)std.dev)/(αμ) and got smaller value for sample size as compared to the previous formula.
I would really thankful is someone could walk me through how I should go about doing this. Thanks you so much in advance!


text:
Q: Load a secure page for API front-end website I'm completing an unfinished project someone else worked on and trying work out how to create a secure page for an API driven front-end.
When a user logs in successfully, a local storage variable is being created that contains user information, including user token and user secret.
I require a secure dashboard page that calls secure API's.
Am I correct in the following approach :

*

*When secure page loads, a JS routine is executed which checks local storage for user token. Can this be a simple check for user token existence ?

*If token present then the secure API's are called using the secret key. The api then returns sensitive data to populate table.

Will this work?
UPDATE:
Both server and client will run under https. As data in encrypted, secret token can be stored on client.  Front-End is static html/JS making API calls for sensitive data using secret (only available to authenticated user). None of the user data is hardcoded to F/E but instead is referenced from local storage. Then tokens can be used securely to make further API calls as required for sensitive data. So basically, no-one else should be able to get to sensitive data as cookie/storage is limited to client machine and will expire anyway.
I was looking for a blog/tutorial to confirm my understanding as above.
Thanks

A: This approach seems OK. I don't know your exact requirements, but I would suggest using a cookie instead of localstorage, given that the token is sensitive information and should not be stored for a long time if it doesn't have to.
If the user has it's personal permanent access token go with localstorage. If the token is fetched from an auth-server upon login, use cookies instead.


text:
Q: Get selected value of TCombobox in Delphi RAD Studio 10 How to get the selected value from a TComboBox?
The TCombobox name is comboTest
vaue_is := comboTest ???

A: You can use ItemIndex:
if comboTest.ItemIndex >= 0 then
  vaue_is := comboTest.Items[comboTest.ItemIndex];

This should work equally well for VCL and FireMonkey (FMX).


text:
Q: Improve geojson performance in leaflet (postgres database query) I am trying to return some tables from my database as geo JSON to the leaflet. There are about 4000 rows in each, but rendering the geo JSON on my leaflet map is so slow. Am I running the query the wrong way? is there a way to improve performance
def layers():

    conn = psycopg2.connect( host=hostname, user=username, password=password, dbname=database )

    c = conn.cursor()
    c.execute("select layer, type, st_AsGeoJSON(geom4326) FROM eng_floodzone2 ")
    rows = c.fetchall()
    objects_list = []
    for row in rows:
        #geo_json={
            varcons = collections.OrderedDict()
            varcons["type"]= "Feature"
            varcons["name"]= row[0]
            varcons["properties"]= {"name": row[0]}
            varcons["geometry"]= json.loads(row[2])
            objects_list.append(varcons)

    getfloodzone2 = json.dumps(objects_list)

    c.execute("select sac_name, st_AsGeoJSON(geom4326) FROM eng_sac_pg ")
    rows = c.fetchall()
    objects_list = []
    for row in rows:
            varcons = collections.OrderedDict()
            varcons["type"]= "Feature"
            varcons["name"]= row[0]
            varcons["properties"]= {"SAC_NAME": row[0]}
            varcons["geometry"]= json.loads(row[1])
            objects_list.append(varcons)
    getsac = json.dumps(objects_list)
        with app.app_context():
        return render_template('index2.html',
                               floodzone2 = getfloodzone2,
                               sac = getsac
                                )
    c.close()

if __name__ == '__main__':
    app.run( debug= True, use_reloader=False,  threaded=True)


text:
Q: Plotting multiple time series on the same plot using ggplot() I am fairly new to R and am attempting to plot two time series lines simultaneously (using different colors, of course) making use of ggplot2.
I have 2 data frames. the first one has 'Percent change for X' and 'Date' columns.  The second one has 'Percent change for Y' and 'Date' columns as well, i.e., both have a 'Date' column with the same values whereas the 'Percent Change' columns have different values.
I would like to plot the 'Percent Change' columns against 'Date' (common to both) using ggplot2 on a single plot.
The examples that I found online made use of the same data frame with different variables to achieve this, I have not been able to find anything that makes use of 2 data frames to get to the plot. I do not want to bind the two data frames together, I want to keep them separate. Here is the code that I am using:
ggplot(jobsAFAM, aes(x=jobsAFAM$data_date, y=jobsAFAM$Percent.Change)) + geom_line() +
  xlab("") + ylab("")

But this code produces only one line and I would like to add another line on top of it.
Any help would be much appreciated.
TIA.

A: I prefer using the ggfortify library. It is a ggplot2 wrapper that recognizes the type of object inside the autoplot function and chooses the best ggplot methods to plot. At least I don't have to remember the syntax of ggplot2.
library(ggfortify)
ts1 <- 1:100
ts2 <- 1:100*0.8
autoplot(ts( cbind(ts1, ts2)  , start = c(2010,5), frequency = 12 ),
         facets = FALSE)

A: I know this is old but it is still relevant. You can take advantage of reshape2::melt to change the dataframe into a more friendly structure for ggplot2.
Advantages:

*

*allows you plot any number of lines

*each line with a different color

*adds a legend for each line

*with only one call to ggplot/geom_line

Disadvantage:

*

*an extra package(reshape2) required

*melting is not so intuitive at first

For example:
jobsAFAM1 <- data.frame(
  data_date = seq.Date(from = as.Date('2017-01-01'),by = 'day', length.out = 100),
  Percent.Change = runif(5,1,100)
)

jobsAFAM2 <- data.frame(
  data_date = seq.Date(from = as.Date('2017-01-01'),by = 'day', length.out = 100),
  Percent.Change = runif(5,1,100)
)

jobsAFAM <- merge(jobsAFAM1, jobsAFAM2, by="data_date")

jobsAFAMMelted <- reshape2::melt(jobsAFAM, id.var='data_date')

ggplot(jobsAFAMMelted, aes(x=data_date, y=value, col=variable)) + geom_line()

A: If both data frames have the same column names then you should add one data frame inside ggplot() call and also name x and y values inside aes() of ggplot() call. Then add first geom_line() for the first line and add second geom_line() call with data=df2 (where df2 is your second data frame). If you need to have lines in different colors then add color= and name for eahc line inside aes() of each geom_line().
df1<-data.frame(x=1:10,y=rnorm(10))
df2<-data.frame(x=1:10,y=rnorm(10))

ggplot(df1,aes(x,y))+geom_line(aes(color="First line"))+
  geom_line(data=df2,aes(color="Second line"))+
  labs(color="Legend text")

A: This is old, just update new tidyverse workflow not mentioned above.
library(tidyverse)

jobsAFAM1 <- tibble(
    date = seq.Date(from = as.Date('2017-01-01'),by = 'day', length.out = 5),
    Percent.Change = runif(5, 0,1)
    ) %>%
    mutate(serial='jobsAFAM1')
jobsAFAM2 <- tibble(
    date = seq.Date(from = as.Date('2017-01-01'),by = 'day', length.out = 5),
    Percent.Change = runif(5, 0,1)
    ) %>%
    mutate(serial='jobsAFAM2')
jobsAFAM <- bind_rows(jobsAFAM1, jobsAFAM2)

ggplot(jobsAFAM, aes(x=date, y=Percent.Change, col=serial)) + geom_line()

@Chris Njuguna
tidyr::gather() is the one in tidyverse workflow to turn wide dataframe to long tidy layout, then ggplot could plot multiple serials.

A: ggplot allows you to have multiple layers, and that is what you should take advantage of here.
In the plot created below, you can see that there are two geom_line statements hitting each of your datasets and plotting them together on one plot. You can extend that logic if you wish to add any other dataset, plot, or even features of the chart such as the axis labels.
library(ggplot2)

jobsAFAM1 <- data.frame(
  data_date = runif(5,1,100),
  Percent.Change = runif(5,1,100)
)

jobsAFAM2 <- data.frame(
  data_date = runif(5,1,100),
  Percent.Change = runif(5,1,100)
)

ggplot() +
  geom_line(data = jobsAFAM1, aes(x = data_date, y = Percent.Change), color = "red") +
  geom_line(data = jobsAFAM2, aes(x = data_date, y = Percent.Change), color = "blue") +
  xlab('data_date') +
  ylab('percent.change')

A: An alternative is to bind the dataframes, and assign them the type of variable they represent. This will let you use the full dataset in a tidier way
library(ggplot2)
library(dplyr)

df1 <- data.frame(dates = 1:10,Variable = rnorm(mean = 0.5,10))
df2 <- data.frame(dates = 1:10,Variable = rnorm(mean = -0.5,10))

df3 <- df1 %>%
  mutate(Type = 'a') %>%
  bind_rows(df2 %>%
              mutate(Type = 'b'))

ggplot(df3,aes(y = Variable,x = dates,color = Type)) +
  geom_line()


text:
Q: To what extent is '$x$' an indeterminate in a generating function? In every source I've read about generating functions if $A(x)$ is a generating function, we treat $x$ as an indeterminate, in particular, it is treated as a placeholder. And if one goes on with what Wikipedia says about an indeterminate variable, https://en.wikipedia.org/wiki/Indeterminate_(variable), one can not treat $x$ as a number, for instance (i might be misunderstanding).
I am having the confusion about why in some cases we can assign a value to $x$. I'll appreciate if someone clarifies my misunderstanding.
Example, in Stanley's Enumerative Combinatorics he makes x=1 when trying to prove that
$$n2^{n-1} = \sum_{k\geq0}k\binom{n}{k} $$

A: Every formal power series $f(x)=\sum_{n\ge 0} a_nx^n$ has a radius of convergence, $R$, which is can be found via
$$
1/R = \limsup_{n\to\infty} \sqrt[n]{a_n}.
$$
If the $\limsup$ is zero, then $R$ is defined to be $\infty$. Now, the rule is this:

You are allowed to substitute a particular number $x_0$ for $x$ in $f(x)$ as long as $|x_0|<R$.

In particular, if $f(x)$ is a polynomial, then the $R$ is always $\infty$, so you can substitute anything for $x$. This is the case for the Stanley example in your post, the polynomial being $n(1+x)^{n-1}$.


text:
Q: xrandr fails to change screen resolution on Arch Linux I have a dual-monitor setup in my notebook, which is running Arch Linux with Gnome 3 as Desktop Environment.
My graphic card is Intel HD Graphics 3000 and my external monitor (VGA1) is a Philips 202EL, which best resolution is 1600x900.
I've tried to run the following commands:
$ cvt 1600 900
$ xrandr --newmode "1600x900_60.00"  118.25  1600 1696 1856 2112  900 903 908 934 -hsync +vsync
$ xrandr --addmode VGA1 1600x900_60.00
$ xrandr --output VGA1 --mode 1600x900_60.00

As result, the external monitor screen blinks, but the resolution is not changed. I've tried to run with gtf instead of cvt as well, but with no luck.
Is there something I am missing? Is there any alternative way to fix my monitor screen resolution?

A: You can directly edit the xorg.conf after you generate one. Take a look at this thread: http://bbs.archbang.org/viewtopic.php?id=14

A: I think that your xrandr calls are not effective since you are not running
them as elevated root.
You should run the calls as:
sudo xrandr ...

A very detailed tutorial with screenshots on using xrandr can be found
in the Ubuntu Handbook article:
How to Set A Custom Screen Resolution in Ubuntu Desktop.


text:
Q: Excel quits on Worksheet_Change Event Can someone please point out what's wrong with this snippet of code? Every time a value is changed in the specified range (A1:B6), Excel simply quits with Microsoft Error Reporting dialogue. I am not allowed to uncheck 'Error Checking (Turn on background error checking)' in Excel Preferences.
Private Sub Worksheet_Change(ByVal Target As Range)
    Dim KeyCells As Range
    Set KeyCells = Range("A1:B6")

    If Not Application.Intersect(KeyCells, Range(Target.Address)) Is Nothing Then
        Call Macro1
        MsgBox "Test"
    End If
End Sub

Macro1:
Sub Macro1()

    Dim wb As Workbook
    Dim wsData As Worksheet
    Dim wsDest As Worksheet
    Dim rInterestCell As Range
    Dim rDest As Range

    Set wb = ActiveWorkbook
    Set wsData = wb.Sheets("Sheet1")
    Set wsDest = wb.Sheets("Formula Results")

    For Each rInterestCell In Range("Interest_Range").Cells
        wsData.Range("A7").Value = rInterestCell.Value
        wsData.Calculate
        Set rDest = wsDest.Cells(wsDest.Rows.Count, "A").End(xlUp).Offset(1)
        If rDest.Row < 6 Then Set rDest = wsDest.Range("A6")
        rDest.Value = wsData.Range("A6").Value
    Next rInterestCell

End Sub

Second Macro
  Sub Macro2()
Dim FLrange As Range
Set FLrange = Range("Initial_Rate")

For Each cell In FLrange
cell.Offset(0, 5).Formula = "=SUM(B3/100*A7)"

Next cell
End Sub

A: You'd better turn off events with Application.EnableEvents = False before doing so much calculation in Macro1.
If this works, just comment MsgBox "Before Macro1" and MsgBox "After Macro1"
Private Sub Worksheet_Change(ByVal Target As Range)
    Dim KeyCells As Range
    Set KeyCells = Me.Range("A1:B6")

    If Not Application.Intersect(KeyCells, Target) Is Nothing Then
        MsgBox "Before Macro1"
        Macro1
        MsgBox "After Macro1"
    End If
End Sub

Macro1:
Sub Macro1()
    Dim wB As Workbook
    Dim wsData As Worksheet
    Dim wsDest As Worksheet
    Dim rInterestCell As Range
    Dim rDest As Range

    Set wB = ActiveWorkbook
    Set wsData = wB.Sheets("Sheet1")
    Set wsDest = wB.Sheets("Formula Results")

    Application.EnableEvents = False

    For Each rInterestCell In Range("Interest_Range").Cells
        wsData.Range("A7").Value = rInterestCell.Value
        wsData.Calculate
        DoEvents
        Set rDest = wsDest.Cells(wsDest.Rows.Count, "A").End(xlUp).Offset(1)
        If rDest.Row < 6 Then Set rDest = wsDest.Range("A6")
        rDest.Value = wsData.Range("A6").Value
    Next rInterestCell

    Application.EnableEvents = True
End Sub


text:
Q: Are there infinite many prime-"tuples", for which $p_{n+1}+p_{n+2}−{p_n}=p_{n+3}$ I found this interesting sequence for primes:
$2+3=5 $
$7+11-5 = 13$
17 + 19 - 13 = 23
29 + 31 - 23 = 37
41 + 43 - 37 = 47
Unfornutaley, now the pattern breaks, but comes back:
primes = []
c = 0
for possiblePrime in range(2, 20000):

# Assume number is prime until shown it is not.
isPrime = True
for num in range(2, possiblePrime):
    if possiblePrime % num == 0:
        isPrime = False
        break
if isPrime:
    primes.append(possiblePrime)
for i in range(5, 1000, 3):
  a = primes[i-2] + primes[i-1]
  a = a - primes[i-3]
  if a != primes[i]:
    c = c+1
    print (""+repr(primes[i-2]) + " + " + repr(primes[i-1]) +" - "+
    repr(primes[i-3]) + " != " + repr(primes[i]))
  else:
    print("" + repr(primes[i - 2]) + " + " + repr(primes[i - 1]) + " - " + repr(primes[i - 3]) + " = " + repr(
        primes[i]))

Are the infinitifly many of these tuples, for which $p_{n+1}+p_{n+2}−{p_n}=p_{n+3}$?
Kind regards

A: Your question, I believe, is whether or not there are an infinite number of values of $n$ where
$$p_{n + 1} + p_{n + 2} - p_n = p_{n + 3} \Rightarrow p_{n + 1} - p_n = p_{n + 3} - p_{n + 2} \tag{1}\label{eq1}$$
where $n \in \mathbb{N}$ and $p_n$ is the $n$'th prime.  Let
$$g_n = p_{n + 1} - p_n \tag{2}\label{eq2}$$
where $g_n$ is the $n$'th prime gap. Then \eqref{eq1} becomes
$$g_n = g_{n + 2} \tag{3}\label{eq3}$$
In other words, the prime gap between $2$ primes is the same as that for $2$ primes higher. You can see this, for example, in your $7 + 11 − 5 = 13$ equation where $7 - 5 = 13 - 11 = 2$.
The prime gaps, on average, do increase as primes get larger, but it is a very slow increase (the Prime Number Theorem shows the average gap at $m$ is about $\log m$). Also, the prime gap values fluctuate a lot, with there not being any particular pattern that anybody has ever found, apart from very basic ones like they are all even except for the first one of $3 - 2 = 1$.
Although I am quite certain nobody has proven that \eqref{eq3} is true for an infinite number of $n$, nor do I think it would be easy to do, I believe it's true. Otherwise, it would be a rather unusual property of primes for this relation to only hold for a finite number of times.

A: It is believed that there are infinitely many $n$ such that $n$, $n+2$, $n+6$, and $n+8$ are all prime. If that's true, it solves your problem in the affirmative. But no one knows how to prove the belief is justified.


text:
Q: Translating Obj-C RGBtoHSV() function to Swift. min = MIN( r, MIN(g, b )); etc Could someone please help me with this function? This function is inside of a camera app that uses a filter algorithm to detect differences in colour variants etc. The syntax is very difficult for me. I don't know how to deal with the pointers in the arguments, the min and max variable syntax, what is delta etc? Could someone please translate for me? Much appreciated.
Also should I be doing something with UIColor? Someone mentioned it below. I have no idea how to convert though.
// r,g,b values are from 0 to 1 // h = [0,360], s = [0,1], v = [0,1]
//  if s == 0, then h = -1 (undefined)

void RGBtoHSV( float r, float g, float b, float *h, float *s, float *v ) {
float min, max, delta;
min = MIN( r, MIN(g, b ));
max = MAX( r, MAX(g, b ));
*v = max;
delta = max - min;
if( max != 0 )
    *s = delta / max;
else {
    // r = g = b = 0
    *s = 0;
    *h = -1;
    return;
}
if( r == max )
    *h = ( g - b ) / delta;
else if( g == max )
    *h=2+(b-r)/delta;
else
    *h=4+(r-g)/delta;
*h *= 60;
if( *h < 0 )
    *h += 360;
}

Swift translation attempt
// r,g,b values are from 0 to 1 // h = [0,360], s = [0,1], v = [0,1]
    //  if s == 0, then h = -1 (undefined)

    func RGBtoHSV(r:Float, g:Float, b:Float, h:Float, s:Float, v:Float) {
        var min:Float = 0.0
        var max:Float = 0.0
        var delta:Float = 0.0

        min = MIN(r, MIN(g, b))
        max = MAX(r, MAX(g, b))

        var v = max
        delta = max - min

        if max != 0 {
           var s = delta / max
        }
        else{
            // r = g = b = 0
            var s = 0
            var h = -1
            return
        }

        if r == max {
            var h = (g - b) / delta
        }
        else if (g == max) {
            var h = 2 + (b - r ) / delta
        }
        else{
            var h = 4 + (r - g) / delta
            var h = 60
        }
        if (h < 0) {
            var h += 360    // how to deal with all of these pointers here in the original Obj-C function above?
        }
    }

A: The Swift equivalent of passing a pointer (the address of a variable)
is an "inout parameter":
func RGBtoHSV(r : Float, g : Float, b : Float, inout h : Float, inout s : Float, inout v : Float) {
    let rgbMin = min(r, g, b)
    let rgbMax = max(r, g, b)
    let delta = rgbMax - rgbMin

    v = rgbMax
    s = delta/rgbMax
    h = Float(0.0) // Replace by your actual calculation
}

This would be called as
let r : Float = 0.3
let g : Float = 0.5
let b : Float = 0.7

var h : Float = 0.0
var s : Float = 0.0
var v : Float = 0.0

RGBtoHSV(r, g, b, &h, &s, &v)
println([h, s, v])

But in Swift there is a better way to return multiple values:
You can return a tuple:
func RGBtoHSV(r : Float, g : Float, b : Float) -> (h : Float, s : Float, v : Float) {
    let rgbMin = min(r, g, b)
    let rgbMax = max(r, g, b)
    let delta = rgbMax - rgbMin

    let v = rgbMax
    let s = delta/rgbMax
    let h = Float(0.0)  // Replace by your actual calculation

    return (h, s, v)
}

And this would be called as
let r : Float = 0.3
let g : Float = 0.5
let b : Float = 0.7
let (h, s, v) = RGBtoHSV(r, g, b)
println([h, s, v])

Note that on iOS you can simply use the UIColor class to convert
between RGB and HSV (== HSB):
func RGBtoHSV(r : CGFloat, g : CGFloat, b : CGFloat) -> (h : CGFloat, s : CGFloat, v : CGFloat) {
    var h : CGFloat = 0.0
    var s : CGFloat = 0.0
    var v : CGFloat = 0.0
    let col = UIColor(red: r, green: g, blue: b, alpha: 1.0)
    col.getHue(&h, saturation: &s, brightness: &v, alpha: nil)
    return (h, s, v)
}

(or use the various extension/convenience methods from
What is the best/shortest way to convert a UIColor to hex (web color) in Swift?)


text:
Q: Redownload traded in game via PS store I purchased a game through a retailer, finished the game, then traded the game in, I then tried downloading the game through the PS store around a year later when it was super cheap  and it wouldn't let me download it, can anyone tell me why? Cheers

A: 2 cases here:

*

*If you have bought the game again on the PS store but it won't let you download it, I suggest contacting PlayStation Support to fix the issue. It's probably rare for players to buy a physical copy of a game, trade it in, and then re-buy on the PS store.

*If you haven't bought the game again and are just trying to download it (I'm assuming it is still marked as owned as you used to own it), then you'd need to purchase the game from the PS store before downloading it again.


text:
Q: On proving $\lim \frac{n^2}{n^2+n+1} = 1$
Prove that $\lim \frac{n^2}{n^2+n+1} = 1$

Let $\varepsilon > 0$ and let $N = \frac{1}{\varepsilon}.$ Then $n > N$ implies $n > \frac{1}{\varepsilon} \implies \frac{1}{n} < \varepsilon.$
But $\displaystyle \frac{1}{n} = \frac{n+1}{n(n+1)} = \frac{n+1}{n^2+n} > \frac{n+1}{n^2+n+1} = \bigg|\frac{n^2}{n^2+n+1}-1\bigg|.$
Therefore $\bigg|\frac{n^2}{n^2+n+1}-1\bigg| < \varepsilon$, hence $\displaystyle \lim \frac{n^2}{n^2+n+1} = 1.$
Could someone please verify whether the above is correct.

A: Your stream of thought is right; just notice that $1/\varepsilon$ is not necessarily an integer, which matters if we are talking about a sequence, which is a map defined on a subset of the set of all integers. Instead, you may write $N := \lceil 1/\varepsilon \rceil + 1$, by which you can ensure the choice of $N$ to be an integer. However, this depends on how one defines convergence of sequence; and it is really not a big deal as long as you are consistent in what you are talking about.

A: if $\forall n.a_n \gt 0$
$$
\lim_{n\to\infty} a_n = 1 \Leftrightarrow \lim_{n\to\infty} \frac1{a_n} = 1
$$
set
$$
a_n = \frac{n^2+n+1}{n^2} = 1+\frac1{n}+\frac1{n^2}
$$
so for $n \gt 1$
$$
0 \lt a_n-1 \lt \frac2n
$$


text:
Q: Token based Custom authentication WSo2 I am currently working on a product based on WSO2  and need to customized the Authentication. Actually We have Users, who has hyphen (-) in the User Id which has to be authenticated through WSO2 BPS server while WSO2 doesn't allow them because of hyphen(-). These User names are created from outside system so we do not have any control over naming convention but We want to login with those User names.
So we want to pass only User ID and it should return a session id so that we can intiatie Human Task services and invoke WSO2 services.
I have got a sample Custom Authenticator :
http://hasini-gunasinghe.blogspot.in/2011/08/carbon-authentication-framework.html
We archive above project and place in "repository\components\dropins".This is working fine But this is not a token based authentication.so no use foe us.
Could you please provide us any sample for Token based Custom Authentication which should be pluggable to WSo2 carbon server 4.X.X.


text:
Q: windows 2003 server folder redirect problem i have installed windows 2003 server as a domain controller.
its working fine. i have also configured home directory for each user its also working fine.
in the group policy i have applied the folder redirection basic--> create folder in root path but its not working..?
thanks

A: Start here.  It sounds like your group policy is not being deployed correctly.  Go through the following steps to figure out what exact problems you are having with group policy and report back here.

To help determine what kind of Group Policy problems you have, do the following:

*

*Generate a Group Policy Results report using GPMC.

*Examine the results of the report to find the answers to three questions that are used in navigating the flowchart:

*

*Does Group Policy Results list the GPO as applied?

*Is the setting listed in Group Policy Results Report?

*Is the GPO listed in the Denied List?

*Compare the results of the report to the flowchart in Figure 1.

*Most of the results in the report map to core Group Policy problems in the flowchart. Investigate the core Group Policy problems first, even if the results of your report point to a specific CSE.

*If the problem persists, assess whether a CSE is involved.

*If you still haven't located the problem, you might need to look at log files to determine the cause.

*If you experience a component failure, check the userenv log and see if the Local Security Authority has logged any events.


text:
Q: url routing from root with index.php and htaccess in sub-directory I'd like to know if it is possible to do this:
To keep the root clean of all files, I want to put everything under a sub-directory (index.php, .htaccess,...). Is it possible to configure a rule in .htaccess which resides in this sub-directory to redirect from root directory to index.php which also resides in the sub-directory ?
Then what would be the syntax for .htaccess ?

A: No. The rules in the subdirectory will only be used if a request is mapped to a path that includes said subdirectory.
To achieve this, you would have to put a rewrite rule either in httpd.conf or in the parent directory.

A: A .htaccess file has effect only in/on :

*

*The directory that contains it

*The sub-directories of that directory.

So, no, you cannot have a .htaccess in a directory, that will impact what's in it's parent directory : Apache will not even see that .htaccess file.

If you want something like that, you'll have to put it at a higher-level ; either :

*

*In a .htaccess file in the parent-directory (which you don't want to do, it seems)

*Or directly in Apache's configuration -- in the configuration of your VirtualHost, for example.

A: Just change your DocumentRoot to the different directory in httpd.conf, or /etc/apache2/sites-available/your-site, or similar


text:
Q: I/O error when using mail, activation and additional jar files in android stdio I used the mail, activation and additional jar files in my application to send emails programmatically. The code to accomplish this has worked fine before, but as of late it has simply just stopped working. I am getting the following I/O errors when trying to send a mail from my app:
06-06 09:41:33.596 19502-20337/neurosys.tgotracker W/art: Failed to open zip archive '/system/framework/qcom.fmradio.jar': I/O Error

                                                      [ 06-06 09:41:33.596 19502:20337 W/         ]
                                                      Unable to open '/system/framework/oem-services.jar': No such file or directory
06-06 09:41:33.596 19502-20337/neurosys.tgotracker W/art: Failed to open zip archive '/system/framework/oem-services.jar': I/O Error
06-06 09:41:33.621 19502-20337/neurosys.tgotracker W/art: Failed to open zip archive '/system/framework/qcom.fmradio.jar': I/O Error

                                                      [ 06-06 09:41:33.622 19502:20337 W/         ]
                                                      Unable to open '/system/framework/oem-services.jar': No such file or directory
06-06 09:41:33.622 19502-20337/neurosys.tgotracker W/art: Failed to open zip archive '/system/framework/oem-services.jar': I/O Error
06-06 09:41:33.624 19502-20337/neurosys.tgotracker W/art: Failed to open zip archive '/system/framework/qcom.fmradio.jar': I/O Error

                                                      [ 06-06 09:41:33.624 19502:20337 W/         ]
                                                      Unable to open '/system/framework/oem-services.jar': No such file or directory
06-06 09:41:33.624 19502-20337/neurosys.tgotracker W/art: Failed to open zip archive '/system/framework/oem-services.jar': I/O Error
06-06 09:41:33.631 19502-20337/neurosys.tgotracker W/art: Failed to open zip archive '/system/framework/qcom.fmradio.jar': I/O Error

                                                      [ 06-06 09:41:33.631 19502:20337 W/         ]
                                                      Unable to open '/system/framework/oem-services.jar': No such file or directory
06-06 09:41:33.631 19502-20337/neurosys.tgotracker W/art: Failed to open zip archive '/system/framework/oem-services.jar': I/O Error

                                                      [ 06-06 09:41:33.633 19502:20337 W/         ]
                                                      Unable to open '/system/framework/qcom.fmradio.jar': No such file or directory
06-06 09:41:33.633 19502-20337/neurosys.tgotracker W/art: Failed to open zip archive '/system/framework/qcom.fmradio.jar': I/O Error
06-06 09:41:33.633 19502-20337/neurosys.tgotracker W/art: Failed to open zip archive '/system/framework/oem-services.jar': I/O Error

                                                      [ 06-06 09:41:33.636 19502:20337 W/         ]
                                                      Unable to open '/system/framework/qcom.fmradio.jar': No such file or directory
06-06 09:41:33.636 19502-20337/neurosys.tgotracker W/art: Failed to open zip archive '/system/framework/qcom.fmradio.jar': I/O Error

                                                      [ 06-06 09:41:33.636 19502:20337 W/         ]
                                                      Unable to open '/system/framework/oem-services.jar': No such file or directory
06-06 09:41:33.636 19502-20337/neurosys.tgotracker W/art: Failed to open zip archive '/system/framework/oem-services.jar': I/O Error

I have the jar files in the libs directory in my application, and I use the following in my gradle file to be able to use the jars: compile fileTree(dir: 'libs', include: ['*.jar']).
As I said, this has always worked perfectly, but for some reason it just started throwing these errors.
I have deleted and re-installed Android Studio. I have also cleaned the project, restarted the IDE and rebuild the project several times. And I have tried to add the JAR files as modules instead of just directly using the libs folder. There are no errors in the code, so the JAR files are being detected by the IDE, but it's as if the files go missing right after I run the project (not really sure whats happening :().
1- Can you help me figure out what the problem is and how to fix it?
(or)
2- Are there any alternatives that I can use to send emails programmatically in android that do not require the use of JAR files?
If you require any additional information, please let me know.
Thank you in advance :)


text:
Q: ( onPress) TouchableOpacity not working(nothing appears) I click the Touchable and ABSOLUTYLY nothing appears on screen, nothing...
I hope that al least a error appear, but litteraly nothing happens when I click the TouchbleOpacity.
Im stuck in this error for 2 days... Im dyingggg
My code:
const auth = getAuth();

const SignUpScreen: React.FC<StackScreenProps<any>> = ({ navigation }) => {

    const [value, setValue] = React.useState({
        email: '',
        password: '',
        error: ''
      })

      async function signUp() {
        if (value.email === '' || value.password === '') {
            setValue({
              ...value,
              error: 'Email and password are mandatory.'
            })
            return;
          }

          try {
            await createUserWithEmailAndPassword(auth, value.email, value.password);
            navigation.navigate('Sign In');
          } catch (error) {
            setValue({
              ...value,
              error: error.message,
            })
          }
      }

    return (
        <View style={styles.mainView}>
            <View style={styles.TopView}>
                <Image style={styles.ImageStyle}source={require('../assets/logo.png')}  ></Image>
            </View>

            <ScrollView style={styles.BottomView}>
                <Text style={styles.Heading}>
                    Primeira vez{'\n'}
                    por aqui?
                </Text>

            <View style={styles.FormView}>

                <TextInput onChangeText={(text) => setValue({ ...value, email: text })} placeholder={"Não te enganes no email♂"} placeholderTextColor={"#fff"} style={styles.TextInput} />
                <TextInput onChangeText={(text) => setValue({ ...value, password: text })} placeholder={"Password JÁ"} secureTextEntry={true} placeholderTextColor={"#fff"} style={styles.TextInput} />
                    <TouchableOpacity style={styles.Button} onPress={signUp}>
                            <Text style={styles.ButtonText}>Regista-te</Text>
                        </TouchableOpacity>
                    </View>

                    <TouchableOpacity style={styles.TextButton} onPress={() => navigation.navigate('Sign In')}>
                <Text style={styles.SignUpText}>
                    Já tens uma conta?
                </Text>
                </TouchableOpacity>
            </ScrollView>

    </View>
    )
}