text:
Q: Simply-connected manifold of constant sectional curvature can be isometrically immersed in model space
Let $(M, g)$ be a simply-connected $n$-dimensional Riemannian manifold with constant sectional curvature equal to $k$ (note that $M$ need not be complete). I would like to show that there is an isometric immersion from $M$ into the $n$-dimensional model space of constant sectional curvature.

I do not how to start proving this. I know that if $M$ is complete, then $M$ is actually isometric to the corresponding model space, and I also know that manifolds with equal sectional curvature are locally isometric, but I do not how to use these to construct an immersion of $M$ into the corresponding model space.


text:
Q: Neo4J - Cypher example I got a bit of interest in graph databases, but I have some doubts. I did some superficial research (reading) which did not cleared things (I am familiar with graphs and graphs algorithms). Please excuse my laziness...but if you have time please give a shot to this question. How can the following SQL query be translated to Neo4J Cypher:
Give all customers which have orders where each order amount exceeds $100 and the number of products per order is grater than 3.
Can such scenario be modeled in Neo4J?

A: Some 2.0 Cypher for a hypothetical model:
match c:Customer-[:ordered]->o:Order-[:contains]->p:Product
where o.total > 100.00
with c, o, count(p) as pcount
where pcount > 3
return distinct c;

redpajama_set_name: RedPajamaStackExchange


text:
Q: Any advice for a developer given the task of enhancing & refactoring a business critical application? Recently I inherited a business critical project at work to "enhance".  The code has been worked on and passed through many hands over the past five years.  Consultants and full-time employees who are no longer with the company have butchered this very delicate and overly sensitive application.  Most of us have to deal with legacy code or this type of project... its part of being a developer... but...
There are zero units and zero system tests.  Logic is inter-mingled (and sometimes duplicated for no reason) between stored procedures, views (yes, I said views) and code.  Documentation?  Yeah, right.
I am scared.  Yes, very sacred to make even the most minimal of "tweak" or refactor.  One little mishap, and there would be major income loss and potential legal issues for my employer.
So, any advice?  My first thought would be to begin writing assertions/unit tests against the existing code.  However, that can only go so far because there is a lot of logic embedded in stored procedures.  (I know its possible to test stored procedures, but historically its much more difficult compared to unit testing source code logic).
Another or additional approach would be to compare the database state before and after the application has performed a function, make some code changes, then do database state compare.

A: I just rewrote thousands of lines of the most complex subsystem of an enterprise filesystem to make it multi-threaded, so all of this comes from experience. If the rewrite is justified (it is if the rewrite is being done to significantly enhance capabilities, or if existing code is coming in the way of putting in more enhancements), then here are the pointers:

*

*You need to be confident in your own abilities first of all to do this. That comes only if you have enough prior experience with the technologies involved.

*Communicate, communicate, communicate. Let all involved stake-holders know, this is a mess, this is risky, this cannot be done in a hurry, this will need to be done piece-meal - attack one area at a time.

*Understand the system inside out. Document every nuance, trick and hack. Document the overall design. Ask any old-timers about historical reasons for the existence of any code you cannot justify. These are the mines you don't want to step on - you might think those are useless pieces of code and then regret later after getting rid of them.

*Unit test. Work the system through any test-suite which already exists, otherwise first write the tests for existing code, if they don't exist.

*Spew debugging code all over the place during the rewrite - asserts, logging, console prints (you should have the ability to turn them on and off, as well specify different levels of output i.e. control verbosity). This is a must in my experience, and helps tremendously during a rewrite.

*When going through the code, make a list of all things that need to be done - things you need to find out, things you need to write tests for, things you need to ask questions about, notes to remind you how to refactor some piece of code, anything that can affect your rewrite... you cannot afford to forget anything! I do this using Outlook Tasks (just make sure whatever you use is always in front of you - this is the first app I open as soon as I sit down on the desk). If I get interrupted, I write down anything that I have been thinking about and hints about where to continue after coming back to the task.

*Try avoiding hacks in your rewrite (that's one of the reasons you are rewriting it). Think about tough problems you encounter. Discuss them with other people and bounce off your ideas against them (nothing beats this), and put in clean solutions. Look at all the tasks you put into the todo list - make a 10,000 feet picture of existing design, then decide how the new rewrite would look like (in terms of modules, sub-modules, how they fit together etc.).

*Tackle the toughest problems before any other. That'll save you from running into problems you cannot solve near the end of tunnel, and save you from taking any steps backward. Of course, you need to know what the toughest problems will be - so again, better document everything first during your forays into existing code.

A: *

*Get a very firm list of requirements.

*Make sure you have implicit requirements as well as explicit ones - i.e. what programs it has to work with, and how.

*Write all scenarios and use cases for how it is currently being used.

*Write a lot of unit tests.

*Write a lot of integration tests to test the integration of the program with existing programs it has to work with.

*Talk to everyone who uses the program to find out more implicit requirements.

*Test, test, test changes before moving into production.

*CYA :)

A: Two things, beyond @Sudhanshu's great list (and, to some extent, disagreeing with his #8):
First, be aware that untested code is buggy code - what you are starting with almost certainly does not work correctly, for any definition of "correct" other than "works just like the unmodified code".  That is, be prepared to find unexpected behavior in the system, to ask experts in the system about that behavior, and for them to conclude that it's not working the way it should.  Prepare them for it to - warn them that without tests or other documentation, there's no reason to think it works they way they think it's working.
Next: Refactor The Low-Hanging Fruit  Take it easy, take it slow, take it very careful.  Notice something easy in the code - duplication, say - and test the hell out of whatever methods contain the duplication, then eliminate it.  Lather, rinse, repeat.  Don't write tests for everything before making changes, but write tests for whatever you're changing.  This way, it stays releasable at every stage and you are continuously adding value, continuously improving the code base.
I said "two things", but I guess I'll add a third: Manage expectations.  Let your customer know how scared you are of this task; let them know how bad what they've got is.  Let them know how slow progress will be, and let them know you'll keep them informed of that progress (and, of course, do it).  Your customer may think s/he's asking for "just a little fix" - and the functionality may indeed change only a little - but that doesn't mean it's not going to be a lot of work and a lot of time.  You understand that; your customer needs to, too.

A: I've had this problem before and I've asked around (before the days of stack overflow) and this book has always been recommended to me. http://www.amazon.com/Working-Effectively-Legacy-Michael-Feathers/dp/0131177052

A: Ask yourself this: what are you trying to achieve? What is your mission? How much time do you have? What is the measurement for success? What risks are there? How do you mitigate and deal with them?
Don't touch anything unless you know what it is you're trying to achieve.
The code might be "bad" but what does that mean? The code works right? So if you rewrite the code so it does the same thing you'll have spent a lot of time rewriting something introducing bugs along the way so the code does the same thing? To what end?
The simplest thing you can do is document what the system does. And I don't mean write mind-numbing Word documents no one will ever read. I mean writing tests on key functionality, refactoring the code if necessary to allow such tests to be written.

A: You said you are scared to touch the code because of legal, income loss and that there is zero documentation.  So do you understand the code?  The first thing you should do is document it and make sure you understand it before you even think about refactoring. Once you have done that and identified the problem areas make a list of your refactoring proposals in the order of maximum benefit with minimum changes and attack it incrementally. Refactoring makes additional sense if: the expected lifespan of the code will be long, new features will be added, bug fixes are numerous. As for testing the database state - I worked on a project recently where that is exactly what we did with success.

A: Is it possible to get a separation of the DB and non-DB parts, so that a DBA can take on the challenge of the stored procedures and databases themselves freeing you up to work on the other parts of the system?  This also presumes that there is a DBA who can step up and take that part of the application.
If that isn't possible, then I'd make the suggestion of seeing how big is the codebase and if it is possible to get some assistance so it isn't all on you.  While this could be seen as side-stepping responsibility, the point would be that things shouldn't be in just one person's hands usually as they can disappear at times.
Good luck!


text:
Q: Flask - how to read request.files['image'] as base64? I'm using Python Flask as my backend and faced a little problem.
In the frontend application I have a form that contains an image upload feature.
In the backend I refer a variable to the image with
image = request.files['image']
That exports a FileStorage object.
I want to convert the image to base64 format in order to insert it to my DB.
I tried a lot of things but nothing worked.
Anyone knows?

A: Basically you need to read it as a stream and then convert it to base64 format.
Check the following answer:
Encoding an image file with base64
The solution shoud look like this:
import base64

...

image = request.files['image']
image_string = base64.b64encode(image.read())


text:
Q: Pandas remove lambdas when using apply method Within a pandas pipeline, the best way I know to create a new column row-wise, given a dataframe df would be like:
(df
 . (...)
 .assign(new_col = lambda df_: df_.apply(lambda row: my_function(row), axis=1)
)

assign requires a pd.Series, that is itself built row-wise through apply.
I feel like this strategy is too verbose (two lambda within a single line of code). Is there a simpler and/or more efficient way to reach the same result?
I am thinking about a syntax similar to:
 .assign(new_col = lambda row: my_function(row), axis=1)

Thanks.

A: As you discovered, pd.DataFrame.apply accepts a function. Applying lambda row: my_function(row) to each row is an obfuscated way of applying my_function to each row, as lambda is just an anonymous function. Therefore, just feed my_function directly:
df.(...)\
  .assign(new_col=lambda df_: df_.apply(my_function, axis=1))

Note your logic can be simplified if the columns used in my_function are unchanged and your dataframe index is maintained throughout the prior logic:
df.(...)\
  .assign(new_col=df.apply(my_function, axis=1))


text:
Q: Configuração gitlabCe no Docker Instalei o container do gilab no docker entretanto apareceram dois problemas:
1 - Se configurar a external_url o sistema não reinicia.
2 - Se olhar o caminho do projeto o SSH fica [git@x.x.x.x]:/caminhoDaPasta
Se for http fica http://7c38db0766c9/caminho da pasta.
Quais os parâmetros que devem ser alterados no arquivo .rb para sanar tais problemas.
Conteiner está sendo criado a partir do código abaixo:
docker run --detach \
    --publish 4430:443 --publish 8083:80 --publish 2222:22 \
    --name gitlabCe \
    --restart always \
    --volume $PWD/../src/gitlab/config:/etc/gitlab \
    --volume $PWD/../src/gitlab/logs:/var/log/gitlab \
    --volume $PWD/../src/gitlab/data:/var/opt/gitlab \
    -e GITLAB_SIGNUP_ENABLED=false \

Sem modificações da imagem original.
As modificações que tentei realizar no external_url foi diretamente no arquivo .rb após o container estar em execução.


text:
Q: Angularjs $stateProvider issue I have those 2 states for my page :
$stateProvider
    .state("page", {
        url: "/:pageId/:pageType",
        template: pageTemplate,
        controller: "contentCtrl",
        resolve: {
            ...
            }
        },
        params: {reload: true}
    })

and
.state("schedule", {
        url: "/Schedule/:scheduleId/:pageId/:pageType",
        template: pageTemplate,
        controller: "contentCtrl",
        resolve: {
            ...
            }
        },
        params: {
            pageId: { squash: true, value: null},
            pageType: { squash: true, value: null},
            reload:true
        }
    })

SOMETIMES, for link's like this :
http://localhost:8182/index.html#/Schedule/691d6981b8dd47e0a158d67cb02b1fee/
the 'page' state is loading instead of the 'schedule' one.
What should I do to fix this?
PS: I'm using  AngularJS v1.7.6 and ui-router v0.2.18

A: The routes are matched in the order they are defined. However, exact matches take precedence over parameterized matches.
I would at first try to change the order of the states.
then I would try to do something like
$stateProvider.state('foo.bar', {url: '/foo/:bar'});
$stateProvider.state('foo.baz', {url: '/foo/baz'});
$urlRouterProvider.when( '/foo/baz', function($state){ $state.go('foo.baz'); } );

Also I see two problems:

*

*what's with that uppercase in /Schedule/

*what's with  params: {reload: true}"


text:
Q: Building WebRTC for Android I am trying to get started with WebRTC for Android.
I found couple of solutions on doing this with older version of WebRTC. Now the libjingle API is part of WebRTC.
I looked into http://www.webrtc.org/reference/getting-started Can any one please point me to a resource which explains the steps?
Thanks.


text:
Q: how to pass a variable to a layout page PHP Hello im using two files 1. layout.html.php(for all the HTML code) 2.layout.php(for all the PHP code)
Im trying to send a variable from the layout.php to layout.html.php file
The variable is equal to a list of all jobs from a database table
See code below
I want to use this list of jobs in a unordered list as links in layout.html.php file
I would appreciate any help i can get with this
CODE FOR LAYOUT.HTML.PHP

Jobs

<?php
    foreach ($jobs as $job){?>

<a href= "/<?= $job['name']?>?id=<?=$job['id']?>"><?= $job['name']?>

            <?php }?>

CODE FOR LAYOUT.PHP
<?php
require '../loadTemplate.php';

    $stmt = $pdo->prepare('SELECT * FROM job');
    $stmt->execute();
    $jobs= $stmt->fetchAll();

    $templateVars = ['stmt' => $jobs];

    $output = loadTemplate('../templates/layout.html.php',['stmt' => $jobs]);

    require  '../templates/layout.html.php';

    ?>

A: If in a file A you got the variable X:
<?php
    $frase = "abcdef";
?>

Then if you want to use the same variable in another file you can use:
<?php
    include('A.php');
    echo $frase;
?>

There is other ways to do that. You can also use the Session, cookies, or just pass in the url.
In my case, I like to do in that way:
I have a page home.php. In that page I represents a consult. So, in home.php I got:
<?php
     include 'php/db.php'
     $result = BuscaDados();
     while($row = $result->fetch_assoc()){
         // here you get all lines
     }

?>

In db.php I got a implementation of my functions that return the consult. Try it out.


text:
Q: Conditions for the existence of solutions to a peculiar Diophantine equation If $a$ and $b$ are even natural numbers, how can I determine when the equation $$a+kb =2^n$$ has at least one solution where $k$ and $n$ are natural numbers? It's necessary for $a$ and $b$ to not have any common prime factors other than $2$. Is that sufficient as well? Any direction pointing would be much appreciated!

A: Note $a$ and $b$ just not having any common prime factors other than $2$ is insufficient. For example, $a = 6$ and $b = 14$ gives
$$6 + 14k = 2^n \iff 3 + 7k = 2^{n-1} \tag{1}\label{eq1A}$$
However, $2^n$ modulo $7$ (i.e., when divided by $7$) has only values $1$, $2$ or $4$, so there's no integral solution to \eqref{eq1A}.
There are $2$ main things to check to determine if there's at least one solution for a particular $a$ and $b$. The first is with the number of factors of $2$ of $a$ (call this $i$) and of $b$ (call this $j$). If $i \lt j$, then normally there's no solution since dividing both sides by $2^{i}$ leaves an odd number, with this only being $1$ if $0$ is included in your definition of natural numbers (plus you assign it to $k$) and there's no odd prime factors in $a$, so there's then a solution of $k = 0$ and $n = i$. Otherwise, there's no solution (a basic example of this is given in coffeemath's answer).
With $i \ge j$ instead, the next check starts with dividing both sides by $2^{j}$ to get
$$a_1 = \frac{a}{2^{j}}, \; b_1 = \frac{b}{2^{j}} \tag{2}\label{eq2A}$$
Since $b_1$ is odd, Euler's theorem states $2^{\varphi(b_1)} \equiv 1 \pmod{b_1}$, where $\varphi$ is Euler's totient function. As $2^{0} \equiv 2^{\varphi(b_1)} \equiv 1 \pmod{b_1}$, the remainders repeat for larger powers than $\varphi(b_1)$. Thus, we need only to check the powers of $2$ up to $\varphi(b_1)$ to determine which one, if any, is congruent to $a_1$ modulo $b_1$. If there are none, like with my example of $7$ above, then there is no solution. Otherwise, with this power, call it $m$ (so $2^{m} \equiv a_1 \pmod{b_1}$), use
$$n_1 = q(\varphi(b_1)) + m \tag{3}\label{eq3A}$$
where $q$ is a positive integer large enough for $2^{n_1} \gt a_1$. Since $2^{n_1} \equiv \left(2^{\varphi(b_1)}\right)^{q}2^{m} \equiv 2^{m} \equiv a_1 \pmod{b_1}$, this means $2^{n_1} - a_1$ is a positive integer which is a multiple of $b_1$, so
$$k = \frac{2^{n_1} - a_1}{b_1}, \; n = n_1 + j \tag{4}\label{eq4A}$$
is a solution. Note increasing $q$ in \eqref{eq3A} shows there are an actually an infinite number of solutions in this case.
Checking the powers of $2$ up to $\varphi(b_1)$ may not be simple, or even very easy, for very large values of $b_1$, especially cases where it's required to rule out a solution if $a_1$ doesn't match any congruence. However, I offhand don't know of any easy way to simplify or speed up that process, at least not in general.

A: Consider the case of $a=2,b=4.$ Here  $a$ and $b$ are even and not divisible by primes other than $2.$ However:
$2+k \cdot 4$ is $2$ mod $4.$ If we require as you do that $k \ge 1$ then note there are no powers of $2$ which are greater than $2$ but are $2$ mod $4.$


text:
Q: Bootstrap Multiselect - Single Checkbox with Options Is it possible to build a Bootstrap Multiselect where the list functions like normal, BUT I have the ability to add a checkbox at the end?
I have a list I want to build where there are two versions of every option in the list. I would like the checkbox to serve as a toggle for the data.
HTML:
<select class="form-control" id="accompany">
     <option>None</option>
     <option>Metronome</option>
     <option>Piano</option>
     <option>Rock</option>
     <option>Pop</option>
     <option>Blues</option>
     <option>Latin</option>
     <option>Classical</option>
     <option><label><input type="checkbox" value="Melody">Melody</label></option>
</select>

JS:
<script type="text/javascript">
     $(document).ready(function() {
          $('#accompany').multiselect();
     });
</script>

I know this is not the proper syntax nor init values, but you can at least see what I'm trying to do from the HTML snippit


text:
Q: Graphical Bug In Minecraft I am experiencing this graphical bug ( Lines between blocks) in my game.
My GPU : GeForce 940MX

A: The problem occurred because my Anti Aliasing was turned to 4x on Nvidia Control Panel. It had to be change to Application control and now the textures are smooth without any lines. Bingo!


text:
Q: Why does SQLite give a "database is locked" for a second query in a transaction when using Perl's DBD::SQLite? Is there a known problem with SQLite giving a "database is locked" error for a second query in a single transaction when using Perl DBD::SQLite? Scenario: Linux, Perl DBI, AutoCommit => 0, a subroutine with two code blocks (using the blocks to localize variable names). In the first code block a query handle is created by prepare() on a select statement, it is executed() and the block closed. The second code block another query handle is created by prepare for an update statement, and frequently (30% of the time) SQLite/DBI gives a database locked error at this stage. I think the error happens during prepare() and not during the execute().
My work around is to commit after the first query. ( Calling finish on the first query did not help). I prefer not to commit for several reasons relating to elegance and performance. The original code has worked fine for many years with Postgres as the database. I tried sqlite_use_immediate_transaction with no effect.
In all other situations, I've found SQLite to perform very well, so I suspect this is an oversight in the DBD driver, rather than an issue with SQLite. Sadly, my current code is a big pile of scripts and modules, so I don't have a short, single file test case.

A: Not related to this in anyway is it: Transaction and Database Locking from the DBD::SQLite perldoc?

Transaction by AutoCommit or begin_work is nice and handy, but sometimes you may get an annoying "database is locked" error. This typically happens when someone begins a transaction, and tries to write to a database while other person is reading from the database (in another transaction). You might be surprised but SQLite doesn't lock a database when you just begin a normal (deferred) transaction to maximize concurrency. It reserves a lock when you issue a statement to write, but until you actually try to write with a commit statement, it allows other people to read from the database. However, reading from the database also requires shared lock, and that prevents to give you the exclusive lock you reserved, thus you get the "database is locked" error, and other people will get the same error if they try to write afterwards, as you still have a pending lock. busy_timeout doesn't help in this case.
To avoid this, set a transaction type explicitly. You can issue a begin immediate transaction (or begin exclusive transaction) for each transaction, or set sqlite_use_immediate_transaction database handle attribute to true (since 1.30_02) to always use an immediate transaction (even when you simply use begin_work or turn off the AutoCommit.).

my $dbh = DBI->connect("dbi:SQLite::memory:", "", "", {
  sqlite_use_immediate_transaction => 1,
});

Note that this works only when all of the connections use the same (non-deferred) transaction. See http://sqlite.org/lockingv3.html for locking details.


text:
Q: Symfony2 and zclip: apostrophe turn into & # 0 3 9 ; I'm using jquery.zclip and Symfony2 framework to copy text to the client's clipboard. It works fine but for the fact that the apostrophe's transform into & # 0 3 9 ; (without the spaces)
The problem apparently comes from Twig templating engine that transforms my apostrophes into their html entities.
I would like to find a solution to prevent Twig doing this. Or maybe turn them back to apostrophes before calling zclip?
How would you do that?
Here is my jquery/twig code:
<script>
    $(document).ready(function(){
        $('img#copy-description').zclip({
            path:"{{ asset('bundles/yopyourownpoet/flash/ZeroClipboard.swf') }}",
            copy:"{{ introLine1 }}{{ introLine2 }}{{ introLine3 }}{{ introLine4 }}{{ introLine5 }}",
            afterCopy:function(){
                alert('The poem has been copied to the clipboard.');
            },
        });
    });

</script>

This code then becomes:
$(document).ready(function(){
    $('img#copy-description').zclip({
    path:"/yourownpoet/web/bundles/yopyourownpoet/flash/ZeroClipboard.swf",
    copy:"Franz, hope Boston treats you wellDaddy, I have a story to tellIf you do not mindI'll promise it's kindLike the sweet ringing of a bell",
    afterCopy:function(){
    alert('The poem has been copied to the clipboard.');
    },
});

EDIT: I tried something more which doesn't work neither:
    function escape(string)
    {
        return string.replace("'", "'");
    }

        $('img#copy-description').zclip({
            path:"{{ asset('bundles/yopyourownpoet/flash/ZeroClipboard.swf') }}",
            copy: escape("{{ introLine1 }}")+"\n"+escape("{{ introLine2 }}")+"\n"+escape("{{ introLine3 }}")+"\n"+escape("{{ introLine4 }}")+"\n"+escape("{{ introLine5 }}"),
            afterCopy:function(){
                alert('The poem has been copied to the clipboard.');
            },
        });

But I still get the code instead of apostrophe...

A: Use raw filter if you consider your variable safe:
{{ var|raw }}

You can also change the autoescaping strategy to javascript (probably better option):
{% autoescape true js %}
<script>
    $(document).ready(function(){
        $('img#copy-description').zclip({
            path:"{{ asset('bundles/yopyourownpoet/flash/ZeroClipboard.swf') }}",
            copy:"{{ introLine1 }}{{ introLine2 }}{{ introLine3 }}{{ introLine4 }}{{ introLine5 }}",
            afterCopy:function(){
                alert('The poem has been copied to the clipboard.');
            },
        });
    });
</script>
{% endautoescape %}

http://twig.sensiolabs.org/doc/api.html#escaper-extension

A: Another way
string_name = '{{ string_name|e('js')|raw }}';


text:
Q: Split/extract street name from street number I have some addresses.csv in this formats
Street 1
Street 10
Street 100
Street 1000
Straße 1b
Straße1b
Street 1 B
Street, 1B
The Street 1B
The-Street 1B
The'Street 1B
The&Street 1B
The Str. 1B
Street 1-3
Street 1 - 3
Street 1A-3B
Street 1A -3 B
Super's Street-Str., 1 - 1000B

Is there a way to seperate/extract all street names and street numbers?
output-names.csv
Street
Street
Street
Street
Straße
Straße
Street
Street
The Street
The-Street
The'Street
The&Street
The Str.
Street
Street
Street
Street
Super's Street-Str.

output-numbers.csv
1
10
100
1000
1b
1b
1 B
1B
1B
1B
1B
1B
1B
1-3
1 - 3
1A-3B
1A -3 B
1 - 1000B

I have found a solution that I want to share here:

A: My solution is

*

*checking if the address-format is valid

if [[ ${var_street_and_number} =~ ^[[:alpha:][:space:]\.\'\&\-]+[,]?[[:space:]]?[0-9]{1,4}[[:space:]]?[a-zA-Z]?[[:space:]]?[-]?[[:space:]]?[0-9]{0,4}[[:space:]]?[a-zA-Z]?$ ]];
    then
    echo "Adress is format is valid :)";
else
    echo "Adress is format is invalid \!";
fi;

The variable var_street_and_number should be one line with the street name + number
If you have a file with many streets and numbers (= many lines) you can use :
while read line; do
    if [[ ${line} =...
done < addresses.csv

*If the adress format is valid you can use sed
sed 's/[,]\{0,1\}[[:space:]]\{0,1\}[[:digit:]].*$//' address.csv > output-name.csv
sed 's/^[^[:digit:]]*//' address.csv > output-number.csv


text:
Q: Fastest, cleanest way in linq to exclude elements from other type (+ef) Assume we have these two classes:
class GenericFoo
{
   public Guid ID;
   ...
}

class SpecialFoo
{
   public Guid ID;
   public Guid GenericFooID;
   ...
}

GenericFoo is a kind of template class, that SpecialFoos can be created from.
Now, I have a DbSet<GenericFoo> g and a DbSet<SpecialFoo> s.
Any SpecialFoo.GenericFooID may exist in g, but may also be missing. (The GenericFoo may e.g. have been deleted). The opposite is true as well, of course.
What I would like is a call to get the ones that lacks matching GenericFooID, something like:
missing = s.Except(g)

That doesn't work, since Except only works for same classes. For now I've solved this by using a rather contrived solution:
ExistingIds = g.Select(f=>f.ID);
missing = s.Where(f => !ExistingIds.Contains(s.GenericFooID));

One major downside here is that we lose type safety (if someone mistype g and specifies a similar class, there would be no way to check this).
I would prefer having something like an IComparer<type1, type2> so that the Except call would work.
The other options I've found is

*

*to make a "fake left join" using group join, and just keeping the non matching

*to convert the first one into a dictionary, hash table etc. just to speed it up

*attempting to create a Generic->Special converter, and then a IComparer just for the sake of using Except
My questions are:

*

*Are there any nicer way to solve this, just talking about linq to objects?

*What is the fastest way to solve this, in the context of entity framework?

A: Now, this is a long shot because it's quite esoteric, but you want an outer join filtered by those without actual relationship. You could try:
from specialFoo in context.SpecialFoos
join genericFoo in context.GenericFoos
     on specialFoo.GenericFooID equals genericFoo.ID
     into gj
where !gj.Any()
select specialFoo;

A: This may work well for both cases:
var missing = s.Where(a => !g.Any(b => b.ID == a.GenericFooID));


text:
Q: Delphi & C++ POS communication with DLL I'm trying to make my fiscal printer work without "driver" which is written in c++, and communicate with files. I want to avoid that and to make direct communication using dll file for fiscal printer.
After I send command "F0"(printer status), in c++ app answer is:
060052000001000000018400000003AE5145202020524D20333330393833322020202031352E30382E323031332031343A3330
After I send command "F0"(printer status), in delphi app answer is:
䁘
c++ code:
extern "C" __declspec(dllimport) char* __stdcall TransmitPrinterCommand(int IPCom, char* Port, int BaudRateNr, char* Command);
cprt = TransmitPrinterCommand(0, cp.c_str(), StrToInt(Baud), EditCommand->Text.c_str());

if (cprt.Length() == 2)
    { ... error

delphi code:
function TransmitPrinterCommand(IPCom:integer; Port:AnsiString; BaudRateNr:integer; Command:AnsiString):WideChar;
     stdcall; external 'QPrintFM.dll';
...
procedure TForm1.Button1Click(Sender: TObject);
var
  cprt:WideChar;
begin
  cprt:=TransmitPrinterCommand(0,AnsiString('COM2'), 9600, AnsiString(txtKomanda.Text));
  txtRez.Text:=cprt;
end;

EDIT 3
As Re0sless suggested I changed code in:
function TransmitPrinterCommand(IPCom:integer; Port:AnsiString; BaudRateNr:integer; Command:AnsiString):PAnsiChar;
stdcall; external 'QPrintFM.dll';

cprt:=TransmitPrinterCommand(0,AnsiString('COM2'), 9600, AnsiString(txtKomanda.Text))

Now all works wine.
Thanks in advance!

A: The Delphi translation of the C++ function is wrong. You cannot use managed Delphi strings across a DLL boundary. The Delphi equivalent of a char*, pointer to null-terminated array of char is PAnsiChar.
You need:
function TransmitPrinterCommand(
  IPCom: Integer;
  Port: PAnsiChar;
  BaudRateNr: Integer;
  Command: PAnsiChar
): PAnsiChar; stdcall; external 'QPrintFM.dll';

Call it like this:
cprt := TransmitPrinterCommand(
  0,
  'COM2',
  9600,
  PAnsiChar(AnsiString(txtKomanda.Text))
);

I'm not sure what the protocol is for deallocating the return value of the function. That's something that you should check carefully. There's no way that you can deallocate it, so either the DLL exports a deallocator, or the memory is statically allocated.


text:
Q: Use subquery after AS alias I am trying to use subquery after alias AS in SQL server 2019, here is my sql query:
select concat(sum(labst),' kg') as (select distinct name1 from mb52 where werks='1202') from mb52 where werks='1202';

but this query giving this error:

Msg 102, Level 15, State 1, Line 1
Incorrect syntax near '('.

Msg 156, Level 15, State 1, Line 1
Incorrect syntax near the keyword 'from'.

I want to get the result like this:
1202
--------------------------------------------
343979.535 kg

instead of using select concat(sum(labst),' kg') as "1202",
because I get the value of werks from a variable $werks and my final SQL query look like this:
select concat(sum(labst),' kg') as (select distinct name1 from mb52 where werks in ($werks)) from mb52 where werks in ($werks);

Can anyone help me on this problem,please?

A: you should use dynamic sql to get this working
DECLARE @S NVARCHAR(MAX)
SELECT distinct @S = 'select concat(sum(labst),'' kg'') as '+ name1 +' from mb52 where werks=''1202''' from mb52 where werks='1202'
EXEC (@S)

A: To do this, you need to use a dynamic query
like this:
DECLARE @query NVARCHAR(MAX) = 'select concat(sum(t1.labst),'' kg'') as '+  (SELECT DISTINCT
t1.name1  FROM dbo.mb52 t1  WHERE t1.werks = '1202') + ' from dbo.mb52 t1 where    t1.werks=''1202'''
EXEC sp_executesql @query

A: You can use dynamic sql like this
declare @sql varchar(1000)
declare @name varchar(100)
declare @werks varchar(1000) = '1202, 1200'

select distinct
       @name = name1
from   mb52
where  werks = 1202

set @sql = 'select concat(sum(labst), '' kg'') as ''' + @name + ''' from mb52 where werks in (' + @werks + ')'

exec (@sql)

See this DBFiddle where you can try it yourself
However, there is a major problem with your query, as you write
as (select distinct name1 from mb52 where werks in ($werks))

This can return more than one value for name1 if there are more then one value in $werks
So I changed it to = 1202 like the other answer also did
Your query probably needs to more like this
set @sql2 = 'select concat(sum(labst), '' kg'') as ''' + @name + ''' from mb52 where werks = 1202'

where again I changed the in $werks into = 1202 because I think it will produce wrong results, but that is up to you.
Look at the dbfiddle and play with it until it does what you need.
EDIT
As requested in the comments, here is how the query looks like with just one value in $werks
set @sql2 = 'select concat(sum(labst), '' kg'') as ''' + @name + ''' from mb52 where werks = ' + @werks

The DBFiddle is also altered


text:
Q: StandardOutput with CLI application in C# is always empty I'm trying to interact with an old CLI application written in Fortran.
Problem is, I can't even read the output of the program. Reading various SO questions I tried the following code:
// Start a new process
Process p = new Process();

// Redirect output and error
p.StartInfo.UseShellExecute = false;
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.RedirectStandardError = true;

// Exe path
p.StartInfo.FileName = @"C:\path\to\exe";

// Hook received events
p.OutputDataReceived += (sender, e) => Console.WriteLine(e.Data);
p.ErrorDataReceived += (sender, e) => Console.WriteLine(e.Data);

p.Start();

p.BeginOutputReadLine();
p.BeginErrorReadLine();

But.. nothing happens. Replacing the Fortran exe with a generic ipconfig.exe in the System32 folder actually works and I can read the output.
Update: while testing back and forth in VS I noticed that when I close the window the correct Output appears for a fraction of a second. It seems that the output is there but isn't displayed until I close the window.
Am I missing something?

A: Process.BeginOutputReadline() is probably blocking until it receives an new line char.  I would try reading byte-by-byte directly off of the OutputStream object.


text:
Q: while loop not working? Can someone find why this loop isn't working?  I'm new to C#.
while (move == "r" || move == "s" || move == "f")
            {
                Console.Write("\nEnter your move: ");
                move = Console.ReadLine();

                switch (move)
                {
                    case "r":
                        Console.Write("\nYou have reloaded, press enter for Genius");
                        Console.ReadLine();
                        break;
                    case "s":
                        Console.Write("\nYou have shielded, press enter for Genius");
                        Console.ReadLine();
                        break;
                    case "f":
                        Console.Write("\nYou have fired, press enter for Genius");
                        Console.ReadLine();
                        break;
                    default:
                        Console.Write("\nInvalid move, try again\n\n");
                        break;
                }

            }

A: Probably because move is initialized inside the loop and is probably null or an empty string since I can't see the code before the loop I'm assuming its not initialized.
My suggestion is to use a boolean flag that is set as such
bool done = false;
while (!done)
{
    // do work
    if (move == finalMove) // or whatever your finish condition is
        done = true; // you could also put this as a case inside your switch
}

A: Jesus is right, suggest you accept his answer.  Here's how you can rewrite the code.
do
            {
                Console.Write("\nEnter your move: ");
                move = Console.ReadLine();

                switch (move)
                {
                    case "r":
                        Console.Write("\nYou have reloaded, press enter for Genius");
                        Console.ReadLine();
                        break;
                    case "s":
                        Console.Write("\nYou have shielded, press enter for Genius");
                        Console.ReadLine();
                        break;
                    case "f":
                        Console.Write("\nYou have fired, press enter for Genius");
                        Console.ReadLine();
                        break;
                    default:
                        Console.Write("\nInvalid move, try again\n\n");
                        break;
                }

            }
 while (move == "r" || move == "s" || move == "f");

Note however that if you get something besides "r", "s", or "f" you will print Invalid move, try again and then exit your loop (they can't try again).  You might instead want to assign a key (maybe "q" for quit) that does terminate the loop and change your while condition to something like
while (move != "q");


text:
Q: Suppress HTML name of a character (like quotes or &) in ColdFusion form I have a ColdFusion form that I need to scrub some offending code from and still keep some basic punctuation.
In my development I've set up a function with ReReplaceNoCase() and a pile of RegEx to clean just about everything and leave me with 3 different variables. one is used to rename a photo, the other ecomes the alt ad title and the third becomes the headline for the product in an <h1> tag
But I've encountered a strange problem. In my input I get the HTML name for some things like " for double quotes but not for single quotes.
For example, when I have a string like ""Great" leather harnesses & More!" I get back 3 strings useable for my project:
_Great_leather_harnesses_and_more_ - which concats with .jpg to become the file name
Great leather harnesses and more - which become alt and title attributes
and Great leather harnesses and more! - becomes my <h1>
The trouble is my form submits " for the double quotes and & for the & but ! for the exclamation point.
What can I do to force my form to post ONLY the character to my function so I don't have to go through every character with an HTML name and zap it? By the way, I'm getting the same results with either <input type="text"... and <textarea>.
Here's my scrubing bubles of RegEx:
<cfset string = #form.product_name#>
    <cfset replaceQuotes = ReReplaceNoCase(string, "(&quo;)", "", "all")>
    <cfset replaceAnd = ReReplaceNoCase(replaceQuotes, "(&)|(&)|(amp;)", " and ", "all")>
    <cfset replacePercent = ReReplaceNoCase(replaceAnd, "\%", " Percent ", "all")>
    <cfset scrubName = ReReplaceNoCase(replacePercent, "[^a-zA-Z0-9]", "_", "all")>
    <cfset cleanFileName = ReReplaceNoCase(scrubName, "[_]{2,}", "_", "all")>
    <cfset cleanAlt = ReReplaceNoCase(scrubName, "[_]", " ", "all")>
    <cfset headlinetoClean = ReReplaceNoCase(replacePercent, "[^a-zA-Z0-9.,!'\-\+]", " ", "all")>
    <cfset cleanHeadline = ReReplaceNoCase(headlinetoClean, "[\s]{2,}", " ", "all")>

If it matters I'm declaring <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> in the head of the page...
Edit - Added form and validation code -
And my form:
<cfform name="newProduct" id="newProduct" >
<label for="product_name">Product Name: </label><cfinput name="product_name" id="product_name" style="width:300px;"/>
<cfinput name="submit" id="submit" type="submit" value="Create Page" />
</cfform>

Some validation - I suspect this may be the issue? :
<cfif not len(trim(form.product_name))>
    <cfset arrayAppend( errors, "You forgot to name the product")>
<cfelse>
    <cfset form.product_name = htmlEditFormat(trim(form.product_name))>
</cfif>

I'm pretty fresh at this RegEx so I'm sure there's a smarter way to go about this. But, this mechanism does seem to work, mostly.

A: Your suspicion is correct, HTMLEditFormat() is the problem - http://help.adobe.com/en_US/ColdFusion/9.0/CFMLRef/WSc3ff6d0ea77859461172e0811cbec22c24-7847.html - it escapes <>&".


text:
Q: How can I customize Bootstrap with Sass if I use it via CDN? The Bootstrap 5.3 doc on Sass customization explains how to override Bootstrap settings using the Sass custom.scss script. I understand that, when Bootstrap was downloaded either manually or via the package manager, the custom.scss script needs to refer to these downloaded files, with something like @import "../node_modules/bootstrap/scss/bootstrap";.
However, suppose I did not download Bootstrap, but instead I want to import Bootstrap via CDN, like so:
<!doctype html>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Bootstrap demo</title>
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-GLhlTQ8iRABdZLl6O3oVMWSktQOp6b7In1Zl3/Jr59b6EGGoI1aFkw7cmDA6j6gD" crossorigin="anonymous">

Hello, world!

Can I still use the same approach? If so, what path should I specify in the @import command?

A: You can import external files to your custom.scss like this:
@import url(https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/css/bootstrap.min.css);

But I would recommend downloading Bootstrap via package manager or manually instead.


text:
Q: Need Font Awesome 5 Support for SVG with JS in DHTMLX We have many sites whose Internet Explorer will not show web fonts (they are locked down by group policies). So they cannot see any font awesome icons in our DHTMLX app. This is a major issue for us. We have been waiting for Font Awesome 5 to be released because we have verified that their new SVG with JS approach works. FA5 is now released so we are trying to figure out how to incorporate it into DHTMLX.
This is what I've tried so far...

*

*I placed the new font awesome 5 file fontawesome-all.js into the /dhtmlx/codebase/fonts/font_awesome/ folder.

*Then I updated the reference to it in the page: <script defer src="/dhtmlx/codebase/fonts/font_awesome/fontawesome-all.js"></script>
Now the new font awesome 5 icons appear but I see double (2) of each for some reason. Any ideas?  Thanks!

UPDATE: The bug appears to be in DHTMLX in the dhtmlXMenu.addNewSibling() method.  If I remove the disabled image property (imgDis) then I only see one font awesome icon, great, but if I make that menu item disabled then I don't see any image.  So it seems DHTMLX need to tweak their enabled/disabled functionality for FA5 icons.

A: I have the same problem.
But I refused to set the property:
myToolbar.setIconset ("awesome");

I set the icon through the "text" property:
"text": "<i class = 'fas fa-plus'> </ i>"

and I define css for dhx_toolbar_btn, for example so:
.dhx_toolbar_btn {
     color: # 557BA6;
     font-size: 1.6em;
}

In this case, "disabled" works properly.
I hope this helps.


text:
Q: Bounding a double sequence
Suppose that $a_{n,m}$ are non-negative real numbers such that
  $$
\sum_{n\ge1}a_{n,m}<\infty
$$
  for each $m\ge1$ and
  $$
\lim_{m\to\infty}\sum_{n\ge1}a_{n,m}
$$
  exists. Does that imply that there exist real numbers $b_n$ such that $a_{n,m}\le b_n$ and $\sum_{n\ge1} b_n<\infty$?

I am not sure if the answer is positive or negative. There are examples when we can find real numbers $b_n$: if $a_{n,m}$ does not depend on $m$ (i.e. $a_{n,m}=a_n$), we can choose $b_n=a_n$; if $a_{n,m}=c^{nm}$ with some $0<c<1$, then $c^{nm}\le c^{n}=b_n$.  However, I cannot find a counterexample.
Any help is much appreciated!

A: Counterexample:
Let $a_{n,m}=\frac{1}{m}\frac{(-1)^{n}}{n}$
Then $\sum_{n\ge1}a_{n,m}<\infty$ and
$\lim_{m\to\infty}\sum_{n\ge1}a_{n,m}=\lim_{m\to\infty} \frac{\ln 2}{m}=0$.
If there exists $(b_n)$ such that $a_{n,m}\le b_n$ then we have:
$a_{2n,1}=\frac{1}{2n} \le b_{2n}$ so $\sum b_{2n}$ diverges to $+\infty$.
Besides, we have $a_{2n+1,m} \le b_{2n+1}$ i.e $b_{2n+1}+\frac{1}{m(2n+1)}\ge0$ for all $m$. This implies $b_{2n+1} \ge 0$.
Hence $\sum b_{2n+1}$ either converges or goes to $+\infty$.
In both cases, $\sum b_{n}=\sum b_{2n}+\sum b_{2n+1}$ diverges.
Hence such a sequence does not exist.
Edit: counterexample if $a_{n,m}>0$:
Let $a_{n,m}$ defined by:
$a_{n,m}=\frac{1}{m}$ if $m\ge n$
$a_{n,m}=0$ otherwise.
Then for all $m$, $\sum_{n\ge1}a_{n,m}=1<\infty$.
But the sequence $(b_n)$ cannot exist as if that was the case, we would have $b_n \ge \frac{1}{n}$ for all $n$ so $\sum b_n$ would diverge.

A: Let
$$a_{n,m}=\begin{cases}
2^{-m},&\text{if }n=1\\
2^{-1},&\text{if }n=m\\
2^{-n},&\text{otherwise}\;.
\end{cases}$$
Then
$$\sum_{n\ge 1}a_{n,m}=\sum_{n\ge 1}2^{-n}=1$$
for each $m\in\Bbb Z^+$, so
$$\lim_{m\to\infty}\sum_{n\ge 1}a_{n,m}=1\;.$$
For each $n\in\Bbb Z^+$ we have $\max_{m\in\Bbb Z^+}a_{n,m}=\frac12$, so the bounds $b_n$ have to be at least $\frac12$, and therefore $\sum_{n\ge 1}b_n=\infty$.

A: Counterexample: Let $a_{n,m} = 1$ if $n=m,$ $a_{n,m} = 0$ otherwise. The hypotheses are then satisfied. If $a_{n,m}\le b_n$ for all $n,m,$ then $1 = a_{n,n}\le b_n$ for all $n.$ Thus $\sum b_n \ge 1 + 1 + \cdots = \infty.$


text:
Q: Android and iOS inconsistencies for text in labels - appcelerator I'm trying to lay out elements for a user profile using the appcelerator api.  On iOS it automatically sets the height so all of the text is shown.  The same code in android seems to cut off the bottom of the text, and I have to set a static height for it all to appear.  I feel that this is somewhat backwards.  Has anyone else had a similar problem?

A: If you set the height to "auto" for the parent element, it should be just fine. In both Android and iOS.
And of course, the height for the label needs to be also "auto". Make sure to use quotes though, it doesn't know the variable auto


text:
Q: different font for combo box in Java I would make a little rft text editor in Java and I would have that the different kind of fonts are show in my combo box in that font. The reason is because the user can see that font.
I know that you can use a combo box item for C#. But I didn't know for Java.
Can anyone help me?
Edit:

A: Sounds like you need to implement a custom renderer for your combo box.
See the java tutorial here: http://docs.oracle.com/javase/tutorial/uiswing/components/combobox.html#renderer
i.e. Something like this (assuming the Objects in your combo box are Fonts):
class CustomRenderer implements ListCellRenderer
{

    @Override
    public Component getListCellRendererComponent(JList list, Object value,
            int index, boolean isSelected, boolean cellHasFocus) {

        JLabel label = new JLabel();
        label.setFont(((Font) value).deriveFont(12f));
        label.setText(((Font) value).getFontName());
        return label;
    }

}

A: Custom Combo box for font selection in java
Here is code :
package stack;

import java.awt.Component;
import java.awt.FlowLayout;
import java.awt.Font;
import java.awt.GraphicsEnvironment;

import javax.swing.ImageIcon;
import javax.swing.JComboBox;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JList;
import javax.swing.ListCellRenderer;

public class CustomComboBox {
  JComboBox fontComboBox;
  JFrame frame;
  String fontName[];
  Integer array[];

  public CustomComboBox() {
    JFrame.setDefaultLookAndFeelDecorated(true);

    frame = new JFrame();
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
    fontName = ge.getAvailableFontFamilyNames();
    array = new Integer[fontName.length];
    for(int i=1;i<=fontName.length;i++) {
      array[i-1] = i;
    }

    fontComboBox = new JComboBox(array);
    ComboBoxRenderar renderar = new ComboBoxRenderar();
    fontComboBox.setRenderer(renderar);

    frame.getContentPane().setLayout(new FlowLayout());
    frame.getContentPane().add(fontComboBox);

    frame.pack();
    frame.setVisible(true);
  }

  public class ComboBoxRenderar extends JLabel implements ListCellRenderer {

    @Override
    public Component getListCellRendererComponent(JList list,
                                                  Object value,
                                                  int index,
                                                  boolean isSelected,
                                                  boolean cellHasFocus) {
      int offset = ((Integer)value).intValue() - 1 ;
      String name = fontName[offset];
      setText(name);
      setFont(new Font(name,Font.PLAIN,20));
      return this;
    }
 }
  public static void main(String args[]) {
    new CustomComboBox();
  }
}

and preview of the code see the Image
:


text:
Q: Can I set multiple SSL certificates for virtual hosts with Lighttpd? Can I set multiple SSL certificates for virtual hosts using Lighttpd web server?
I have several webshops on my server (each webshop has its own domain) and I need to setup a SSL certificate for each of them.
thanks
Patrick

A: Using SNI is the way to do it. Here is a quick example:
$HTTP["host"] == "www.domain1.com" {
     server.document-root = "/home/www/domain1.com/public"
     server.errorlog = "/var/log/lighttpd/domain1.com/error.log"
     accesslog.filename = "/var/log/lighttpd/domain1.com/access.log"

     server.error-handler-404 = "/index.php"

     ssl.pemfile = "/etc/lighttpd/certs/www.domain1.com.pem"
}

and if you want to add an other domain with its own SSL,
$HTTP["host"] == "www.domain2.com" {
         server.document-root = "/home/www/domain2.com/public"
         server.errorlog = "/var/log/lighttpd/domain2.com/error.log"
         accesslog.filename = "/var/log/lighttpd/domain2.com/access.log"

         server.error-handler-404 = "/index.php"

         ssl.pemfile = "/etc/lighttpd/certs/www.domain2.com.pem"
}

Keep in mind that not all browsers support this.

A: Please look at Lighttpd SNI,
Server Name Indication is supported by Lighttpd since 1.4.24, which will allow more than one vhost per ip for SSL as pointed out by jae. Browser support is limited though including IE on XP.
Old answer:
You can only setup one SSL certificate per ip/port pair that you use. If you have one IP address and multiple virtual hosts on the same ip address it will not work except if you get a SAN certificate with all the virtual host/domain contained in the SAN certificate. This will get expensive.
The reason for this limitation is that the web server needs to decrypt the SSL request to see which host the client is trying to access. This will be done using the SSL cert bound to that port. The client will then get a different certificate which will not match the host/domain the client is expecting.
This will cause all sorts of security warnings on the client side.


text:
Q: GNU Time Field Expanation What exactly do all the fields mean with the gnu time program invoked with /usr/bin/time -v pipeline?
Command being timed: "xmllint config/locations/test1.xml"
User time (seconds): 0.00
System time (seconds): 0.00
Percent of CPU this job got: 50%
Elapsed (wall clock) time (h:mm:ss or m:ss): 0:00.00
Average shared text size (kbytes): 0
Average unshared data size (kbytes): 0
Average stack size (kbytes): 0
Average total size (kbytes): 0
Maximum resident set size (kbytes): 3160
Average resident set size (kbytes): 0
Major (requiring I/O) page faults: 0
Minor (reclaiming a frame) page faults: 139
Voluntary context switches: 1
Involuntary context switches: 2
Swaps: 0
File system inputs: 0
File system outputs: 0
Socket messages sent: 0
Socket messages received: 0
Signals delivered: 0
Page size (bytes): 4096
Exit status: 0

I've searched and searched but found on details on a lot of the fields like file system inputs and outputs.


text:
Q: Windows 10 bluescreens and freezes So I constantly get bluescreens while working with the pc and sometimes the pc also just freezes. I have
Windows 10 64bit
Intel Core i5-2500K, 4x 3.3Ghz
8GB (4x 2GB) RAM DDR3 Frequency 1333 MHz
NVIDIA GeForce GTX 660
Asus P8H67-M EVO Motherboard

All drivers should be up to date - I checked them ;)
My PC is not likely to crash if I play video games. That's why I disabled power saving mode in the bios, but it didn't help at all
I collected the Bluescreens and I hope I post enough information here -
this is a table with the crash information created by using BlueScreenView - just open it in your browser.
Unfortunatelly I cant post a table or even a html table here on superuser >.>...
Thanks for your help and I will add any information if needed!


text:
Q: Inserting data into table using COPY causes constraint violation I have an SQL file that contains the schema of the database (creating of tables and some functions to check the constraints). One of the functions has different actions to do for the first entered value and for the rest. What I mean is, that in the function I am firstly counting the number of elements in a table:
CREATE TABLE table_name(
    column1 INT,
    column2 INT CHECK(func())
);

CREATE OR REPLACE FUNCTION func1()
    returns BOOLEAN
    LANGUAGE plpgsql
    AS
    $$
         BEGIN
              SELECT COUNT(*) INTO var1 FROM table_name;
              RAISE NOTICE 'count: %', var1;
              IF var1 = 0 THEN
                 ...
                 return true;
              ELSE
                 ...
                 return true;
              END IF;
              return false;
         END;
    $$;
...

and if it is 0, then it does some checks for the first element, and else it does a bit different checks. Then to insert the data I am using COPY(in another SQL file):
COPY table_name(column1, column2) FROM stdin;
5 2
8 7
\.

but I am getting an error:
ERROR:  new row for relation "table_name" violates check constraint "table_name_check"

for the second row. So, I have added RAISE NOTICE to print the count in my schema(as shown in the first block of code above):
RAISE NOTICE 'count: %', var1;

and for the first insert, it gives me count = 0, but for the second I also get count = 0. That is why the function treats the second insert as if it is first and it causes errors. What could be the reason for this problem? It looks like even if the first row has been inserted, there are still no rows on the table after the first insertion.


text:
Q: iTunes Connect - Strange refund in Sales & Trends in I have app with subscriptions (week, month & year). Yesterday in my stats appears strange refund.
In Subscription -> Summary I see 1 refund
sub
In Sales -> Units I see "-8" in graphics and -4 in stats if I fltered by territoty.
unit1
unit2
I don't understand what this mean. Is it correct ?
Thanks


text:
Q: Unable to alter database table I want to add a new column in table so i am running following mysql command.
alter table student add doe datetime not null default curdate();

But it says I have error in mysql statement near curdate();

A: Modify your query as below.
ALTER TABLE `student` ADD `doe` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ;

it should solve your answer.
Thanks
Amit

A: The error occurs because you can't use function as default value.

A: It is available from MySQL version 5.6.5. Check this:
http://optimize-this.blogspot.co.uk/2012/04/datetime-default-now-finally-available.html
Previous versions can deal with timestamp type:
ALTER TABLE student ADD doe TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP;

A: You should use this:
alter table student add doe datetime not null default now();


text:
Q: expanding an inline-block jumps to above row I have a series of articles

1

2

3

....

999

arranged in a grid of three per row
section {
  position: relative
}
article {
  display: inline-block;
  width: 33%;
}

and I want that they expand horizontally to fully occupy its row when clicked.
so I create an expanded class
.expanded {
  position:absolute;
  left:0px;
  width: 100%;
}

and apply it on click
$("article").click(function(){
  $(this).toggleClass("expanded");
});

I am almost there, as you can see in the fiddle here http://jsfiddle.net/aqw339r0/1/
When I click on any of the articles they expand to the full width of the row; but the problem is that when I click the first article of a row (except the first row) it "jumps" to the row immediately above.
I have tried changing the position and display attributes of both article and .expanded but I cannot get the behavior I need. For example: When I change the position:absolute of .expanded, the blocks 5 and 6, "jump" to the row below. Similar when I remove display:inline-block and change to float:left.
Do you have any ideas of why this happens and how to correct it?

A: Using the solution from @Rick (minus the css top edit) and then toggling an additional element to keep other elements in place, this should do what is needed: Fiddle
  $("article").click(function() {
        $(this).toggleClass("expanded");
        if ($(this).hasClass("expanded"))
        {
            $(this).before("

");
        }
        else
        {
            $(this).prevAll('.blank').first().remove();
        }
  });

To explain further, when the element is clicked:
if ADDING the class 'expanded', then this will also add a blank article element (before) as a placeholder to keep the flow consistent.  This is important because when the element with class 'expanded' becomes position: absolute it is removed from the normal flow of the content.
if REMOVING the class 'expanded', then this will also remove the blank article placeholder element.  The prevAll function looks through all previous elements with the class 'blank' and then takes the first() one and removes it.  Because it was inserted 'before', this is guaranteed to remove the correct blank article placeholder.

A: When position:absolute is set on an
 element, that takes it out of the normal content flow, and causes the offset. We can correct it by adding an empty
 as a placeholder when the click triggers, and removing it when click again.
var open = false;

jQuery("article").click(function () {
    open = !open;

    if (open) {
        $(this).addClass("expanded");
        $(this).before("

");
    } else {
        $("article").removeClass("expanded");
        $(".holder").remove();
    }
});

p.s. I'm not that good at jQuery, any suggestions are welcome.
jsfiddle

A: I can't think of a pure CSS solution, but since you're using jQuery anyway, simply hard-code the expanded element's top:
$("article").click(function() {
  $(this).css('top', $(this).position().top);
  $(this).toggleClass("expanded");
});

Fiddle
The top style will be ignored once the expanded class is removed.

A: Try this

1

2

3

4

5

6

7

8

9

    section {
        position:relative;
    }

    article {
        width: 30%;
        min-width: 200px;
        min-height: 200px;
        display: inline-block;
        border: 1px solid black;
    }

    .expanded {
        width: 100%;
        background-color:#eef;
        left:0px;
        top:0;
        position:absolute;
        transition: 0.2s linear;
    }

    // if you want others to close while expanding
    $("article").click(function(){
       $('article').removeClass("expanded");
        $(this).toggleClass("expanded");
    });

// esle if you want everything to be expanded
   $("article").click(function(){
        $(this).toggleClass("expanded");
    });


text:
Q: load another page while ajax still running / lock page? I have problem about ajax jquery and CI.
The problem is, for example, like I have 2 menu:

*

*profile

*add new profile

First time when I open page profile, Ajax loads the data, while Ajax status is still pending I hit the menu "add new profile" to open in new tab. And the result is the 2nd page "add new profile" has already opened but the page is not loaded (blank white page).
After the Ajax loaded in menu 1, the 2nd page just started to load the page.
So is there any solution to load the page without waiting the Ajax jQuery done?

A: your $ajax call is calling asynchronously ..try async:false of $ajax call.


text:
Q: proper way of sending values between classes i've asked a question before but sounds that i didn't explain it in good way so here is the codes of the buggest part
class packet handler (receive information from packet and store them at x,y and there is struct which accept 2 ushort ref so once i define an object it change the value of the variables i send)
public class PacketHandler : GUI
    {
        GameUser role;
        public PacketHandler(GameUser who)
        {
            role = who;
        }
        ushort Actualx, Actualy;
        public PacketHandler(ref ushort x ,ref ushort y)
        {
            x = Actualx; y = Actualy;
        }
        public unsafe void HandleServer(byte[] data)
        {
.
.
.
                        case 10010:
                            {
                                if (BitConverter.ToUInt16(data, 8) == 1002)
                                {
                                    Actualx = BitConverter.ToUInt16(data, 24);
                                    Actualy = BitConverter.ToUInt16(data, 26);
                                }
                                break;
                            }

this get the value from packets , store them at actualx , actualy preparing to give them to any ushort ref come at the defining object parameter
here is other class
public class ClientBase
{
    GameUser role2;
    public ClientBase(GameUser role)
    {
        role2 = role;
        Thread T = new Thread(HuntThread) { Name = "Hunt Thread" };
        T.Start(this);
    }
.
.
.
    public void HuntThread(object Sender)
    {
        ClientBase Client = Sender as ClientBase;
        while (true)
        {
            Monster Target = GetNextkill();
            if (Target != null)
            {
                Thread.Sleep(1000);
                ProxyParadise.Network.Packets.PacketHandler getxandy = new ProxyParadise.Network.Packets.PacketHandler(ref X, ref Y);
                ProxyParadise.Network.Packets.PacketStructure ps = new ProxyParadise.Network.Packets.PacketStructure();
.
.
.

and the real problem is i find zero at x and y , when i trace it i find zero at actualx,actualy however im sure they got a value , so i think im doing something stupid
so all in all , if u can't help me at this code or figure out what i mean then please tell me a proper way to get values from another class while using threading , thanks everyone , please some mod delete my old question , i rephrase it now in better way

A: Here we go:
    ushort Actualx, Actualy;
    public PacketHandler(ref ushort x ,ref ushort y)
    {
        x = Actualx; y = Actualy;
    }

You are assigning the values from the fields (which are initially zero) to the parameters, rather than the values from the parameters to the fields:
    ushort Actualx, Actualy;
    public PacketHandler(ushort x , ushort y)
    {
        Actualx = x;
        Actualy = y
    }

Note I removed the ref too; that would have had the nasty side-effect (in your original code) of wiping the by-ref variables you passed in, since the fields are zero initially.
However, what you can't do is store a "reference to a ushort" as a field. If you need that, the best thing to do is to drop the value onto a class, and refer to the object:
class Foo {
    public ushort Value {get;set;}
}

then any number of callers can have references to the same Foo object, and therefore updating one is updating all. Frankly, your PacketHandler would already serve in place of this Foo; the trick would be for multiple pieces of code to have a reference to the handler, and get their .ActualX / .ActualY from the object.


text:
Q: "Could not find the main class" when double-clicking .jar file First: I realize that this issue should be quite simple and lots of people seem to have experienced it. However, it appears my issue may be slightly different from existing posts.
I'm using NetBeans to compile a Java application. When it's done building, the output goes into the dist\ folder correctly. The jar file is present there. If I go to the command line, navigate to that folder, and call the following:
java -jar Prosperity.jar
everything works fine. Obviously the name of the application is Prosperity. The following command also works fine:
javaw -jar Prosperity.jar
However, double-clicking the .jar file gives the message: "Could not find the main class:", and then gives the path to the .jar file. I've checked a hundred times that the META-INF folder exists inside the .jar file, and that within it there exists a MANIFEST.MF with the correct main class name. I have also checked that the main class (App.class) .class file exists inside the .jar file.
So the question is: what's the difference between double-clicking a file and running javaw on it? It's getting really frustrating that it won't just run!
Thanks for any direction you can give me, I'm tearin' my hair out here!

A: Perhaps your file associations got messed up. At the command prompt, try running
ftype | find "jarfile"

On my 64-bit Windows 7 computer, that shows
jarfile="C:\Program Files (x86)\Java\jre6\bin\javaw.exe" -jar "%1" %*

You can also change it with ftype:
ftype jarfile="C:\Program Files (x86)\Java\jre6\bin\javaw.exe" -jar "%1" %*

A: Just found this post...
If you have the problem only when double clicking the jar file and not at cmd launch, it's probably because the version of the JRE is wrong (6 in place of 7).
Just change the value in regedit at :
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\jarfile\shell\open\command]
"C:\Program Files (x86)\Java\jre6\bin\javaw.exe" -jar "%1" %*
to :
"C:\Program Files\Java\jre7\bin\javaw.exe" -jar "%1" %*
There should be no problem if this value is updated.

Note : Switching between 32 and 64 bits versions on Windows :
-> "C:\Program Files\Java\jre7\bin\javaw.exe" -jar "%1" %* will use the 64 bits version of the JRE
-> "C:\Program Files (x86)\Java\jre7\bin\javaw.exe" -jar "%1" %* will use the 32 bits version of the JRE

A: search your regedit and check follow item
Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\Applications\javaw.exe\shell\open\command]
@="\"C:\\Program Files (x86)\\Java\\jre6\\bin\\javaw.exe\" -jar \"%1\""

[HKEY_CLASSES_ROOT\jarfile\shell\open\command]
@="\"C:\\Program Files (x86)\\Java\\jre6\\bin\\javaw.exe\" -jar \"%1\""

[HKEY_CURRENT_USER\Software\Classes\Applications\javaw.exe\shell\open\command]
@="\"C:\\Program Files (x86)\\Java\\jre6\\bin\\javaw.exe\" -jar \"%1\""

A: I came across this error as well. I checked the file association using command prompt and  all was correct. It wasn't until I tried running the .jar from the command line using java -jar MyProgram.jar that it actually showed me the root of the problem.
It turns out the .jar was compiled under JDK 7 whereas I was only running JRE 6. This was error given to me in the prompt which lead me to the real solution:
Exception in thread "main" java.lang.UnsupportedClassVersionError: MyProgram/Program : Unsupported major.minor version 51.0
        at java.lang.ClassLoader.defineClass1(Native Method)
        at java.lang.ClassLoader.defineClassCond(Unknown Source)
        at java.lang.ClassLoader.defineClass(Unknown Source)
        at java.security.SecureClassLoader.defineClass(Unknown Source)
        at java.net.URLClassLoader.defineClass(Unknown Source)
        at java.net.URLClassLoader.access$000(Unknown Source)
        at java.net.URLClassLoader$1.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
Could not find the main class: MyProgram.Program. Program will ex
it.

A: I just had the exact same problem, fixed the same way. I had to completely delete the association, not just the user customisation, and reinstall the JRE.
The association before the fix was still:
jarfile="C:\Program Files (x86)\Java\jre6\bin\javaw.exe" -jar "%1" %*

And after (the same):
jarfile="C:\Program Files (x86)\Java\jre6\bin\javaw.exe" -jar "%1" %*

A: If the methods above cannot solve the problem, try deleting the .jar file type from your pc (you can google a software called Unassoc.exe and delete the file type), and then the problem is fixed! (At least, this is my case!)


text:
Q: How to predict several unlabelled attributes at once using WEKA and NaiveBayes? I have a binary array that has 96 elements, it could look someting like this:
[false, true, true, false, true, true, false, false, false, true.....]

Each element represents a time interval in 15 minutes starting from 00.00. The first element is 00.15, the second is 00.30, the third 00.45 etc. The boolean tells whether a house has been occupied in that time interval.
I want to train a classifier, so that it can predict the rest of a day, when only some part of the day is known. Let's say I have observations for the past 100 days, and I only know the the first 20 elements of the current day.
How can I use classification to predict the rest of the day?
I tried creating a ARFF file that looks like this:
@RELATION OccupancyDetection

@ATTRIBUTE Slot1 {true, false}
@ATTRIBUTE Slot2 {true, false}
@ATTRIBUTE Slot3 {true, false}
...
@ATTRIBUTE Slot96 {true, false}

@DATA
false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,true,true,true,true,true,true,true,false,true,true,true,false,true,false,false,false,false,false,false,true,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false
false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,true,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,true,true,true,true,true,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,true,true,true,true,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false
.....

And did a Naive Bayes classification on it. The problem is, that the results only show the success of one attribute (the last one, for instance).
A "real" sample taken on a given day might look like this:
true,true,true,true,true,true,true,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?

How can i predict all the unlabelled attributes at once?
I made this based on the WekaManual-3-7-11, and it works, but only for a single attribute:
    ..
    Instances unlabeled = DataSource.read("testWEKA1.arff");
    unlabeled.setClassIndex(unlabeled.numAttributes() - 1);
    // create copy
    Instances labeled = new Instances(unlabeled);
    // label instances
    for (int i = 0; i < unlabeled.numInstances(); i++) {
    double clsLabel = classifier.classifyInstance(unlabeled.instance(i));
    labeled.instance(i).setClassValue(clsLabel);
    DataSink.write("labeled.arff", labeled);

A: I can't tell if there's something wrong with your arff file.
However, here's one idea: you can add a NominalToBinary unsupervised-Attribute-filter to make sure that the attributes slot1-slot96 are recognized as binary.

A: Sorry, but I don't believe that you can predict multiple attributes using Naive Bayes in Weka.
What you could do as an alternative, if running Weka through Java code, is loop through all of the attributes that need to be filled.  This could be done by building classifiers with n attributes and filling in the next blank until all of the missing data is entered.
It also appears that what you have is time-based as well.  Perhaps if the model was somewhat restructured, it may be able to all fit within a single model.  For example, you could have attributes for prediction time, day of week and presence over the last few hours as well as attributes that describe historical presence in the house.  It might be going over the top for your problem, but could also eliminate the need for multiple classifiers.
Hope this Helps!
Update!
As per your request, I have taken a couple of minutes to think about the problem at hand.  The thing about this time-based prediction is that you want to be able to predict the rest of the day, and the amount of data available for your classifier is dynamic depending on the time of day.  This would mean that, given the current structure, you would need a classifier to predict values for each 15 minute time-slot, where earlier timeslots contain far less input data than the later timeslots.
If it is possible, you could instead use a different approach where you could use an equal amount of historical information for each time slot and possibly share the same classifier for all cases.  One possible set of information could be as outlined below:

*

*The Time Slot to be estimated

*The Day of Week

*The Previous hour or two of activity

*Other Activity for the previous 24 Hours

*Historical Information about the general timeslot

If you obtain your information on a daily basis, it may be possible to quantify each of these factors and then us it to predict any time slot.  Then, if you wanted to predict it for a whole day, you could keep feeding it the previous predictions until you have completed the predictions for the day.
I have done a similar problem for predicting time of arrival based on similar factors (previous behavior, public holidays, day of week, etc.) and the estimates were usually reasonable, though as accurate as you could expect for human process.

A: There two frameworks which provide multi-label learning and work on top of WEKA:
MULAN: http://mulan.sourceforge.net/

MEKA: http://meka.sourceforge.net/
I only tried MULAN and it works very good. To get the latest release you need to clone their git repository and build the project.


text:
Q: Unable to parse matching results in sphinx/php How to parse below array returned by sphinx in php
php code
if ( $result === false ) {
      echo "Query failed: " . $cl->GetLastError() . ".\n";
  }
  else {
      if ( $cl->GetLastWarning() ) {
          echo "WARNING: " . $cl->GetLastWarning() . "
";
      }

        if ($result['0'] > 0) {
            // print_r($result['0']['attrs']);
            $words[] = $result['0']['matches'];
            foreach ($words as $val) {
                echo "=> " . $val['keyword'] . $val['ref'];
            }
        } else {
                echo 'No results found';
        }
  }

Array
(
    [0] => Array
        (
            [error] =>
            [warning] =>
            [status] => 0
            [fields] => Array
                (
                    [0] => keyword
                    [1] => ref
                )

            [attrs] => Array
                (
                    [keyword] => 7
                    [ref] => 7
                )

            [matches] => Array
                (
                    [25367434949034415] => Array
                        (
                            [weight] => 1643
                            [attrs] => Array
                                (
                                    [keyword] => hunting
                                    [ref] => activity
                                )

                        )

                )

            [total] => 1
            [total_found] => 1
            [time] => 0.000
            [words] => Array
                (
                    [hunt] => Array
                        (
                            [docs] => 1
                            [hits] => 1
                        )

                )

        )

)

I want to parse 'matches' array and it's subarray values like keyword, ref etc.

A: Lets concentrate on this bit
    if ($result['0'] > 0) {
        $words[] = $result['0']['matches'];
        foreach ($words as $val) {
            echo "=> " . $val['keyword'] . $val['ref'];
        }
    }

Firstly, the result isnt an integer, so shouldnt really be compared as one (although guess it might work)
Personally would recommend checking the actual matches - and using empty, which works fine on arrays...
    if (!empty($result['0']['matches'])) {

Then you for some reason add the matches to an array (thats what $arry[] = does, its effectively 'push')
... but also no point assigned to a variable, as only use it once (in the foreach)
... Plus generally the document_id is the index of the matches array, so expose that.
        foreach ($result['0']['matches'] as $doc_id => $val) {

finally, now have the matches, want the attribute in the attors array. so something like
            $a = $val['attrs'];
            echo $doc_id." => ".$a['keyword'].", ".$a['ref']."
\n";

putting it all together...
    if (!empty($result['0']['matches'])) {
        foreach ($result['0']['matches'] as $doc_id => $val) {
            $a = $val['attrs'];
            echo $doc_id." => ".$a['keyword'].", ".$a['ref']."
\n";
        }
    }


text:
Q: Why is the YouTube api search returning different results from different servers? We've noticed the search results returned from the v3 search api are different depending on the location of the server.  I've confirmed the code is exactly the same and when I run a test using the try-it section of the api documentary website on the different server the results are different as well.  Does anyone know why?
https://developers.google.com/youtube/v3/docs/search/list#try-it

A: That's normal, just as you'd expect from YouTube's web search, depending on your login and location, it will find most relevant videos.

A: I was having the same problem. In my own computer (I'm in Brazil) the call would return 10 videos. When executed on Azure server (East-US) it would return no videos at all.
So I added the param regionCode=BR and it worked properly.

A: Though its very old thread, let me share my learning for others who face this.
So to keep api request generic within all servers you need to set few request parameters of youtubeapi.
RegionCode -- region to filter videos for that channel/user.
And sort result if desired.


text:
Q: Vue Apollo refetch query on event I have a query in my Component instance:
@Component({
  apollo: {
    cartProducts: {
      query: GET_CART_PRODUCTS,
      loadingKey: "loading",
    },
  }
})

It's loading my data correctly. Then I change data in my DB and want to refetch them on click, which call that function:
  refresh() {
    this.$apollo
      .query({
        query: GET_CART_PRODUCTS,
      })
      .then((res: any) => (this.cartProducts = res.data.cartProducts))
      .catch((err: any) => console.log(err));
  }

But it doesn't update cartProducts property, and doesn't give me any error. Although If I refresh my page new data are there. In my Apollo config I have such property fetchPolicy: "network-only". What could be the reson of such behaviour? Thanx in advance!

A: The answer is quite simple, sorry to bother, I had to google it more.
   this.$apollo.queries.cartProducts.refetch()


text:
Q: Firebase show posts if value equals true I am using FirebaseRecyclerAdapter and I need to show post for uses ids equals true, here's my firebase database:

{
  "Following" : {
    "ORBBKfZAAUhqI1h7ojQDzYOjgkp1" : {
      "z2SNUlLd6mQM8nnlkU2VUws5Ggl2" : {
        "UID" : "z2SNUlLd6mQM8nnlkU2VUws5Ggl2"
      }
    },
    "pypD1SYZkbcYesk09WuMUY1AkTf1" : {
      "ORBBKfZAAUhqI1h7ojQDzYOjgkp1" : {
        "UID" : "ORBBKfZAAUhqI1h7ojQDzYOjgkp1",
        "Username" : "Ali"
      },
      "z2SNUlLd6mQM8nnlkU2VUws5Ggl2" : {
        "UID" : "z2SNUlLd6mQM8nnlkU2VUws5Ggl2",
        "Username" : "Ali"
      }
    },
    "z2SNUlLd6mQM8nnlkU2VUws5Ggl2" : {
      "ORBBKfZAAUhqI1h7ojQDzYOjgkp1" : true,
      "pypD1SYZkbcYesk09WuMUY1AkTf1" : true
    }
  },
  "Posts" : {
    "-KduqnVVczZf5uibQiZ-" : {
      "Describe" : "gg",
      "Profile" : "https://twitter.com/2Top/profile_image?size=original",
      "Time" : 14881230655,
      "UID" : "pypD1SYZkbcYesk09WuMUY1AkTf1",
      "Username" : "Mike",
      "Wallpaper" : "https://firebasestorage.googleapis.com/v0/b/test-3f4c5.appspot.com/o/Posts%2Fcropped906285501.jpg?alt=media&token=0c1a3a3d-6e48-4c4e-ba59-f5646bf8965f"
    },
    "-Ke5gJ00CxbjhOuhzLIx" : {
      "Describe" : "hajj",
      "Time" : 1488318465,
      "UID" : "z2SNUlLd6mQM8nnlkU2VUws5Ggl2",
      "Username" : "Mike",
      "Wallpaper" : "https://firebasestorage.googleapis.com/v0/b/test-3f4c5.appspot.com/o/Posts%2Fcropped1717103943.jpg?alt=media&token=a85b2488-5ac7-49a7-9ad0-dbf4e6f29389"
    },
    "-KeCuiFmUCpN19zwsTsR" : {
      "Describe" : "a",
      "Profile" : "https://lh4.googleusercontent.com/-suB77riNoX8/AAAAAAAAAAI/AAAAAAAAAAA/ADPlhfKMzINn-Ki538Sqf6SRGaXC81-WuQ/s200-c/photo.jpg",
      "Time" : 1488439652,
      "UID" : "ORBBKfZAAUhqI1h7ojQDzYOjgkp1",
      "Username" : "2top",
      "Wallpaper" : "https://firebasestorage.googleapis.com/v0/b/test-3f4c5.appspot.com/o/Posts%2Fcropped1913886685.jpg?alt=media&token=c8ad26b2-8f09-453b-b48a-aad9e4d8b5c3"
    },
    "-KeD2fBUQ09HVMrvAneb" : {
      "Describe" : "ee",
      "Profile" : "https://lh4.googleusercontent.com/-suB77riNoX8/AAAAAAAAAAI/AAAAAAAAAAA/ADPlhfKMzINn-Ki538Sqf6SRGaXC81-WuQ/s200-c/photo.jpg",
      "Time" : 1488441999,
      "UID" : "ORBBKfZAAUhqI1h7ojQDzYOjgkp1",
      "Username" : "2to7p",
      "Wallpaper" : "https://firebasestorage.googleapis.com/v0/b/test-3f4c5.appspot.com/o/Posts%2Fcropped1904338270.jpg?alt=media&token=d200b7fc-15e7-4dc4-9913-59c377929e9e"
    },
    "-KeDfnMWiB7k_4J3FBgZ" : {
      "Describe" : "f12g",
      "Profile" : "https://lh4.googleusercontent.com/-suB77riNoX8/AAAAAAAAAAI/AAAAAAAAAAA/ADPlhfKMzINn-Ki538Sqf6SRGaXC81-WuQ/s200-c/photo.jpg",
      "Time" : 1488452517,
      "UID" : "z2SNUlLd6mQM8nnlkU2VUws5Ggl2",
      "Username" : "2top",
      "Wallpaper" : "https://firebasestorage.googleapis.com/v0/b/test-3f4c5.appspot.com/o/Posts%2Fcropped1872832638.jpg?alt=media&token=80239844-a872-47e2-9689-92d368dd9452"
    },
    "-KeDfrw4inUQFtIDXJHp" : {
      "Describe" : "fg",
      "Profile" : "https://lh4.googleusercontent.com/-suB77riNoX8/AAAAAAAAAAI/AAAAAAAAAAA/ADPlhfKMzINn-Ki538Sqf6SRGaXC81-WuQ/s200-c/photo.jpg",
      "Time" : 1488452536,
      "UID" : "z2SNUlLd6mQM8nnlkU2VUws5Ggl2",
      "Username" : "2top",
      "Wallpaper" : "https://firebasestorage.googleapis.com/v0/b/test-3f4c5.appspot.com/o/Posts%2Fcropped1872832638.jpg?alt=media&token=80239844-a872-47e2-9689-92d368dd9452"
    }
  },
  "Users" : {
    "1DUK1pHEEoaImX8iOOspEMEWCPm2" : {
      "Username" : "Tom"
    },
    "BQOwNdGAeRXiBnVj7ijY1EkFiDC3" : {
      "Username" : "7uthaifah"
    },
    "ECWHIksxJ0Q5SUlIrev4BjnjmrJ3" : {
      "Profile" : "https://lh3.googleusercontent.com/-p1mB5WbUN2s/AAAAAAAAAAI/AAAAAAAAAAo/r3Z4o-VSODQ/s200-c/photo.jpg",
      "Username" : "Jice"
    },
    "I5o3JMpYHwZXQD0t2ogWHCQbrZv1" : {
      "Profile" : "https://lh3.googleusercontent.com/-p1mB5WbUN2s/AAAAAAAAAAI/AAAAAAAAAAo/r3Z4o-VSODQ/s200-c/photo.jpg",
      "Username" : "Mike"
    },
    "ORBBKfZAAUhqI1h7ojQDzYOjgkp1" : {
      "Cover" : "http://lucascontabil.com/home/wp-content/uploads/2015/05/city-wallpaper-7-400x200.jpg",
      "Profile" : "https://lh5.googleusercontent.com/--IAMp28UlmE/AAAAAAAAAAI/AAAAAAAAAAA/AAomvV2EM8Ut2nW9j0YE2vRZhJyQBHMsrA/s200-c/photo.jpg",
      "UID" : "ORBBKfZAAUhqI1h7ojQDzYOjgkp1",
      "Username" : "Dom"
    },
    "ZxqBgLq4ekUJii05AvV86z0i3mH2" : {
      "Profile" : "https://lh3.googleusercontent.com/-p1mB5WbUN2s/AAAAAAAAAAI/AAAAAAAAAAo/r3Z4o-VSODQ/s200-c/photo.jpg",
      "Username" : "Jone"
    },
    "mZ5jjPNLlcc8OguVzWJLAYhavmg1" : {
      "Profile" : "https://twitter.com/2Top/profile_image?size=original",
      "Username" : "Twitter"
    },
    "pypD1SYZkbcYesk09WuMUY1AkTf1" : {
      "Profile" : "https://lh3.googleusercontent.com/-p1mB5WbUN2s/AAAAAAAAAAI/AAAAAAAAAAo/r3Z4o-VSODQ/s200-c/photo.jpg",
      "Username" : "Mike"
    },
    "z2SNUlLd6mQM8nnlkU2VUws5Ggl2" : {
      "Cover" : "http://lucascontabil.com/home/wp-content/uploads/2015/05/city-wallpaper-7-400x200.jpg",
      "Email" : "@dd",
      "Profile" : "https://lh4.googleusercontent.com/-suB77riNoX8/AAAAAAAAAAI/AAAAAAAAAAA/ADPlhfKMzINn-Ki538Sqf6SRGaXC81-WuQ/s200-c/photo.jpg",
      "UID" : "z2SNUlLd6mQM8nnlkU2VUws5Ggl2",
      "Username" : "2277top"
    }
  }
}

I have used this method but it doesn't work:
mDatabase = FirebaseDatabase.getInstance().getReference().child("Posts");

    mAuth = FirebaseAuth.getInstance();
    mCurrentUser = mAuth.getCurrentUser();

    mDatabaseFriends = FirebaseDatabase.getInstance().getReference().child("Following").child(mCurrentUser.getUid());

    Query q = mDatabaseFriends.orderByKey().equalTo(true);
    mQuery = mDatabase.orderByChild("UID").equalTo(q.toString());

    @Override
    public void onStart() {
        super.onStart();

        FirebaseRecyclerAdapter<Getting_Posts, PostViewHolder> firebaseRecyclerAdapter = new FirebaseRecyclerAdapter<Getting_Posts, PostViewHolder>(
                Getting_Posts.class, R.layout.post_card_design, PostViewHolder.class, mQuery) {
            @Override
            protected void populateViewHolder(final PostViewHolder viewHolder, final Getting_Posts model, int position) {}};

I need the query that I use it to show posts if ids = true
Here's my method that I used it but it show the only the first following user:
mDatabaseFriends.addValueEventListener(new ValueEventListener() {
        @Override
        public void onDataChange(DataSnapshot dataSnapshot) {
            for(DataSnapshot following : dataSnapshot.getChildren()) {

                Query X = mDatabase.orderByChild("UID").equalTo(following.getKey());

                FirebaseRecyclerAdapter<Getting_Posts, PostViewHolder> firebaseRecyclerAdapter = new FirebaseRecyclerAdapter<Getting_Posts, PostViewHolder>(
                        Getting_Posts.class, R.layout.post_card_design, PostViewHolder.class, X ) {}});

A: You can achieve what you want by using a regular RecyclerAdapter. With your current database design you won't be able to translate what you want into a single firebase query, so the FirebaseRecyclerAdapter is out.
mDatabaseFriends.addValueEventListener(new ValueEventListener() {
        @Override
        public void onDataChange(DataSnapshot dataSnapshot) {
            for(DataSnapshot following : dataSnapshot.getChildren()) {
                mDatabase.orderByChild("UID").equalTo(following.getKey()).addValueEventListener(new ValueEventListener() {
                    @Override
                    public void onDataChange(DataSnapshot dataSnapshot) {
                        Getting_Posts model = dataSnapshot.getValue(Getting_Posts.class);
                        // Here you can add your 'post' to a dataset that you can use to initialize a new RecyclerAdapter
                    }

                    @Override
                    public void onCancelled(DatabaseError databaseError) {

                    }
                });
            }
        }

        @Override
        public void onCancelled(DatabaseError databaseError) {

        }
    });

Another option is to simply change your database design to allow for the use of a FirebaseRecyclerAdapter or a FirebaseIndexRecyclerAdapter (which is more likely). I think you'll need to use Client-side fan-out to achieve this though.
These links should be relevant to what you're trying to achieve.
The Firebase Blog: Client-side fan-out
Firefeed
Edit: Added code specific to this situation
It's been a while and I can't test the code right now, but let me know if this is working for you.
First the adapter
public class RecyclerAdapter extends RecyclerView.Adapter<RecyclerAdapter.PostViewHolder> {
    private ArrayList<Getting_Posts> mdataSet;

    public RecyclerAdapter(ArrayList<Getting_Posts> dataSet) {
        mdataSet = dataSet;
    }

    @Override
    public RecyclerAdapter.PostViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        View inflatedView = LayoutInflater.from(parent.getContext()).inflate(R.layout.post_card_design, parent, false);
        return new PostViewHolder(inflatedView);
    }

    @Override
    public void onBindViewHolder(RecyclerAdapter.PostViewHolder holder, int position) {
        Gettings_Posts post = mdataSet.get(position);
        // Set the properties of the holder
        // I don't know what properties you used in the viewholder so I'll just give an example
        // example: holder.Name.setText(post.getName());
    }

    @Override
    public int getItemCount() {
        return mdataSet.size();
    }

    public void add(int position, Getting_Posts post) {
        mdataset.add(position, post);
        notifyItemInserted(position);
    }
}

Use it in the following way.
Declare the following properties in your activity/fragment.
ArrayList<Getting_Posts> posts;
private RecyclerAdapter mAdapter;
private RecyclerView mRecycler;

In the onCreate initialize them like this.
mRecyclerView = (RecyclerView) findViewById(R.id.my_recycler_view); // Replace this with the ID of your recyclerView
mRecyclerView.setHasFixedSize(true);
LinearLayoutManager mLayoutManager = new LinearLayoutManager(this);
mRecyclerView.setLayoutManager(mLayoutManager);
mAdapter = new RecyclerAdapter(posts);
mRecycler.setAdapter(mAdapter);

Then add my original solution just replace the following line
Getting_Posts model = dataSnapshot.getValue(Getting_Posts.class);

with this
mAdapter.add(mAdapter.mdataSet.size(), dataSnapshot.getValue(Getting_Posts.class));
mAdapter.notifyDataSetChanged();

Like I said, I didn't get any time to test it so there might be some errors, but I wanted to give you something to work with. You should be able to find plenty of documentation on RecyclerView and RecyclerAdapter online to help you with solving this.


text:
Q: Javascript - Add images I have some images (image1, image2, image3 ..etc. ) and I will add those images to each cell seperately. I found a code to insert the images.
document.getElementById("cell1").innerHTML = "";

Now, Can someone help me to put above code in a  loop in order to avoid to write same code for each image ?
I have tried below code but it does not work. Probably there is a problem with quotes. Or is there a better way to insert multiple images to each cells ?
for (x=0; x=10; x++) {
document.getElementById("'cell" + x + "'").innerHTML = ""; }

A: for (x=0; x=10; x++) {
    document.getElementById("cell" + x).innerHTML = "";
}

A: for (x=0; x=10; x++) {
    var img = new Image();
    img.src = 'image' + x + '.png';
    document.getElementById('cell' + x).appendChild(img);
}

A: As you may have noticed creating elements from html strings can get really messy really quick.
Its often a a better idea to use document.createElement to create the elements and then manipulate the properties of the element.
img = document.createElement("img");
img.src = "image" + i + ".png"; // image1.png ... etc

Another very useful technique is using document fragments to create ad-hoc collections of elements before we actually attach them to the real document or elements.
frag = document.createDocumentFragment();
frag.appendChild(img);
targetNode.appendChild(fragment); // attach all the images in the fragment

This is good for performance since actually touching the DOM is slow - we don't want to do it over and over in a loop.
Lets take these two techniques and create a function which creates img elements
function createImages(n){
    var i, frag, img;
    frag = document.createDocumentFragment();
    for (i = 0; i < n; i ++) {
        img = document.createElement("img");
        img.src = "image" + i + ".png"; // image1.png ... etc
        frag.appendChild(img);
    }
    return frag;
}

We could use this function to attach images to each cell in table
var table = document.getElementById('test'),
    cells = table.getElementsByTagName('td');

(function(){
    var i,
        len = cells.length,
        images = createImages(3);

    for (i = 0; i < len; i++) {
        cells[i].appendChild( images.cloneNode(true) );
    }
}());


text:
Q: Windows service not able to hit network drive path asp.net I have one windows service which used to place files on network drive. It is working fine on some machines but on some machines it is not working fine. Although when i am trying to do with Window application it is working fine.
Please suggest me how i can solve this issue. As there are more than 100 of systems where this service installed but I am getting this issue random basis.

A: Thanks all for your valuable comments.
I found one more thing and this is definitely missing from Networking team. They had provided the access only on child folder not on the root folder that's why service was not able to hit mapped directory.
After provide the full permission to root directory, service is able to place files.
All possible scenarios which provided in comments will also be helpful for me to solve issues related with same domain.


text:
Q: FCM: Is the order in which messages are sent preserved? If I send to a client message msg1 and then I send another message msg2, can I be absolutely sure that the client will receive first msg1 and only after that msg2 ?

A: From documentation is clear that FCM does not guarantee message order.
That means that you might receive msg1 before msg2, but there is no guarantee that messages will be received in that order. You might as well receive msg2 before msg1.
You should not code your application logic to expect msg1 will always appear before mgs2.
About FCM Messages


text:
Q: Tooltip still showing for "comments disabled" text on deleted/locked posts Recently when we can't post new comment, text describing it was added which is good and dandy.
However, the tooltip is still there lurking in the darkness awaiting mouse hover:

Can it please be removed?

A: This is fixed now. Shadow Wizard, your long wait is over.


text:
Q: Unable to access lib.rs file from binary I am unable to access a library from my binary.
Here is what my cargo.toml looks like
[package]
name = "app"
version = "0.1.0"
edition = "2021"

[dependencies]
<--snip-->
[lib]
path = "src/lib.rs"
[[bin]]
path = "src/main.rs"
name = "realio"

the application root
.
├── Cargo.toml
├── src
│   ├── lib.rs
│   └── main.rs
└── test
    └── integration.rs`

and my main.rs
#![crate_name = "realio"]

use env_logger::Env;
use realio::run;
use std::net::TcpListener;

#[tokio::main]
async fn main() -> std::io::Result<()> {
    env_logger::Builder::from_env(Env::default().default_filter_or("info")).init();
    let listener = TcpListener::bind("127.0.0.1:8000").expect("failed to bind port");
    run(listener)?.await
}

However , I get the following error
error[E0432]: unresolved import `realio`
 --> app/src/main.rs:4:5
  |
4 | use realio::run;
  |     ^^^^^^^^^^^^^^^^^^^^^ use of undeclared crate or module `realio`

I would appreciate pointers on this

A: You're missing the name for the lib.
This would be right:
[dependencies]
[lib]
name = "realio"
path = "src/lib.rs"
[[bin]]
name = "realio"
path = "src/main.rs"

But you don't need to manually declare it there if you stick with the main.rs and lib.rs naming convention. Also keep in mind to change the Package name (line 2 in your Cargo.toml) to "realio", so your code still works.
You can find more infos for that in the Cargo Book: https://doc.rust-lang.org/cargo/guide/project-layout.html


text:
Q: Add Reference VS 2008 strange issue with paths I have VS 2008 Team Suite, and use TFS.
I have references in 2 folders in TFS:
path in TFS: $Arquitectura\Main\ReferenciasFrk\Release\
mapped to: C:\Trabajo\Arquitectura\Main\ReferenciasFrk\Release\
path in TFS: $Arquitectura\Main\Referencias Externas\
mapped to: C:\Trabajo\Arquitectura\Main\Referencias Externas\
I have project csproj, and I try Add Reference in project, and use Browse Tab for select the file dll. (right click on References and click Add Reference, go to the Browse tab )
The file dll that I want use is:
....\ReferenciasFrk\Release\Frk.Nsi.OracleDto.dll
Reale.Frk.Nsi.OracleDto, Version=2.0.0.1
When I have added the reference, in VS, window Properties, Reference Properties , the value of Path is:
C:\Trabajo\Arquitectura\Main\Referencias Externas\Frk.Nsi.OracleDto.dll
Version: 2.0.0.0
the reference has other path and version !!!
I edit csproj file using notepad, and has this lines:
<Reference Include="Frk.Nsi.OracleDto, Version=2.0.0.1, Culture=neutral, PublicKeyToken=7090723f76dac05b, processorArchitecture=MSIL">
  <SpecificVersion>False</SpecificVersion>
  <HintPath>..\..\ReferenciasFrk\Release\Frk.Nsi.OracleDto.dll</HintPath>
</Reference>

The path is right, but VS shows in Reference Properties  another path.
Now, I clean, build (rebuild) Project, it generate Frk.Nsi.OracleDto.dll in bin\Release but the version is 2.0.0.0.
There aren't any version of Frk.Nsi.OracleDto.dll in GAC - no versions in GAC-
i don't understand anything; Any suggestions ?

A: Set the SpecificVersion element to True.