text:
Q: Subgroups of the reals of finite index. I'm studying profinite groups, and I know that every group can be endowed with the profinite topology, whose basis consists of the cosets of subgrous with finite index. Moreover this topology is Hausdorff if and only if the group is residually finite.
Up to these things everything is clear in my mind.
Then I wonder what this topology is on the group of real numbers $(\mathbb{R}, +)$. So my question is: what are the subgroups of $\mathbb{R}$ of finite index? Does it admit any? Is $\mathbb{R}$ residually finite?
(I know these are many questions: my aim is to understand the profinite topology on $\mathbb{R}$)

A: The reals (or any field of characteristic $0$) does not have any subgroups of finite index.
For if $H $ was such a subgroup, say of index $n > 0$, then we would have $n\mathbb {R}\subseteq H $. But when $n\neq 0$ we have $n\mathbb {R} = \mathbb {R} $ contradicting the assumption.


text:
Q: Assert\Regex and TypeGuessing I have following entity field:
/**
* @Assert\Regex(
*   pattern = "/^d+\.(jpg|png|gif)$/",
*   htmlPattern = "/^d+\.(jpg|png|gif)$/"
* )
**/

protected $src;

The form is created by something like this:
$builder
   ->add('src', TextareaType::class, array( //neither is TextType::class working
      'attr' => array('class' => 'mysrc'),
)); //pattern will not be rendered

The problem is, as soon as I provide the field type class TextareaType::class the regex pattern isn't rendered as constraint to the form. Or in other words: The regex pattern is only rendered, if the field type is guessed:
$builder
   ->add('src', null, array(
      'attr' => array('class' => 'mysrc'),
)); //pattern will be rendered

Any workaround? I want to have the regex patterns in one place, i.e. in my entity, not in a controller or a form.

A: Yepp, this is how it should work. Not only the field type is guessed, but some options too and if the type is not guessed the options neither.
BTW the textarea element does not support the pattern attribute, but if you want to you can add one: 'attr' => array('pattern' => '/jsregex/'), you should use a different pattern for the client side than the server side anyway. If you want to give the pattern in one place use a constant.

A: Maybe this one could help you:
FormType
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Validator\Validator\ValidatorInterface;
use Symfony\Component\Validator\Constraints\Regex;
use YourBundle\Entity\YourEntity;

public function __construct(ValidatorInterface $validator)
{
    $this->validator = $validator;
}

public function getRegexPattern($property)
{
    $pattern = null;
    $metadata = $this->validator->getMetadataFor(new YourEntity());
    $propertyMetadata = $metadata->getPropertyMetadata($property);
    $constraints = $propertyMetadata[0]->constraints;

    foreach($constraints as $constraint) {
        if ($constraint instanceof Regex) {
            $pattern = $constraint->pattern;
        }
    }

    return $pattern;
}

public function buildForm(FormBuilderInterface $builder, array $options)
{
    $builder->add('src', TextType::class, array(
        'attr' => array(
            'class' => 'mysrc',
            'pattern' => $this->getRegexPattern('src')
        ),
    ));
}

services.yml (Needed to inject validator in type)
services:
    app.form.type.your_entity_type:
        class: YourBundle\Form\YourEntityType
        arguments:
            validator: "@validator"
        tags:
            - { name: form.type }

Rendered
<input type="text" pattern="/^d+\.(jpg|png|gif)$/" class="src"/>

Like this, even if the TextType in manually set, you get the html validation through pattern retrieved from the constraints of the property.

redpajama_set_name: RedPajamaStackExchange


text:
Q: SubSonic - AllStruct.cs looks wrong Using SubSonic 2.2, after DAL generation with sonic.exe, the AllStruct.cs content looks wrong:
// <auto-generated />
namespace ...DAL
{
  #region Tables Struct
  public partial struct Tables
  { ... }

  #endregion

    #region Schemas
    public partial class Schemas
    { ... }
    #endregion

    #region View Struct
    public partial struct Views
    { ... }
    #endregion

    #region Query Factories
  public static partial class DB
  { ... }
    #endregion

}
#region Databases
public partial struct Databases
{ ... }
#endregion

Is there any reason for placing the Databases region outside the namespace? If not, how can I correct it (I didn't find any templates for the generated code)?

A: SubSonic Databases are analagous to providers. Each provider generates it's own namespace, so it's fitting that the Databases struct is outside of any generated namespace. If you configure multiple providers, your AllStructs.cs file will have multiple namespaces, each with it's own set of structs like the ones you posted.
The template generation file can be found here


text:
Q: Segmentation fault in "end program" statement in Fortran I have some Fortran code consisting of a subroutine and a call to it. It's supposed to calculate the mean of the elements in a matrix using a defined window size. For example, calling the subroutine on a (10,10) array using winsize=2 would return a (5,5) array.
The code is as shown:
SUBROUTINE avgwin(ts, sizelat,sizelon,winsize,size2,size3,ts_new)
implicit none
double precision, dimension(10,sizelat,sizelon) :: ts
double precision, dimension(winsize,winsize) :: store
double precision, dimension(10,size2,size3) :: ts_new
double precision :: par,ave
integer :: sizelat, sizelon,i,j,k,winsize,size2,size3
integer :: A, B,p,m,numb
A=0
B=0
par = 11 !Hypothetical value to be excluded
do i=1,10 !Looping through time
    do j=1,sizelat !Looping through latitude
        if ((j+winsize) > sizelat) then !Checks if it will exceed bounds
            exit !If it'll exceed, discard remaining cells
        end if
        do k=1,sizelon !Looping through longitude
            if ((k+winsize)>sizelon) then
               exit
            end if
            store = ts(i,j:j+winsize,k:k+winsize) !Gets the values for that window
            where (store == par) store = -99 !Replaces masked with -99
            ave = 0
            numb = 0 !Variable to count
            do p=1,winsize
                do m=1,winsize
                    if (store(p,m)==-99) then !Evaluates if it's masked, i.e., =-99
                        ave = ave
                    else
                        ave = ave + store(p,m) !Sum of existent values
                        numb = numb +1 !Updates counting variable
                    end if
                end do
            end do
            ave = ave/numb !Calculates the mean
            ts_new(i,A,B) = ave
            B=B+1
        end do
        B=0
        A=A+1
    end do
A=0
B=0
end do
END SUBROUTINE

program testefor
implicit none
double precision, dimension(10,10,10) :: teste
double precision, dimension(10,5,5) :: oi
integer :: i,j,k

do i=1,10
   do j=1,10
      do k=1,10
         teste(i,j,k)=i
      end do
   end do
 end do

CALL avgwin(teste,10,10,2,5,5,oi)
print*, oi(1,5,5)

end program testefor

When I'm running it, however, I get a Segmentation Fault. I tried debugging it with GDB and, to my surprise, it returns a correct result but segfaults when exiting the program. What I get from gdb can be found below:
Breakpoint 1, testefor () at testefor.f90:56
56      do i=1,10
(gdb) cont
Continuing.
   1.0000000000000000

Program received signal SIGSEGV, Segmentation fault.
0x0000000000400f73 in testefor () at testefor.f90:67
67  end program testefor

So the program is returning the correct (1,5,5) element = 1.0 but faulting somewhere else.
Can someone help me identify the problem? Thanks

A: One thing that can help is to compile the program in debug mode, and activate many debug switches.
In my case I compiled with gfortran, and I used:

*

*-g to include debug symbols

*-fbacktrace for a better stack trace

*-Wall to enable all compiler warnings

*-fcheck=all to enable run time checks (make the program slower, but are really useful during debugging).

These runtime checks found the error immediately:
At line 21 of file teste.F
Fortran runtime error: Array bound mismatch for dimension 1 of array 'store' (2/3)

The size of store is (winsize, winsize) but you copy an array into it of size (windsize+1, winsize+1). If you slice an array in Fortran, it includes both the start and end index: (1:10) is from 1 to 10. If you have (1:1+10) it goes from 1 to 11, which means that its size is 11.
Without run time array bounds checks (in this case activated by -fcheck=all) this is really hard to debug and can cause all sorts of unexpected behaviour.
If you use a different compiler than gfortran, you need to read up on how to switch on such tests on your compiler, as the switches are not standardised.

A: This is not meant as the answer to your question (I've already answered that), but a few hints that should help you.

*

*If you loop over a multi-dimensional array, you should always have the inner-most loop over the first index, and so forth, so
! Inefficient way to do it:
do i = 1, 10
    do j = 1, 10
        do k = 1, 10
            a(i, j, k) = i*j+k
        end do
    end do
end do

!Efficient way to do it:
do k = 1, 10                   !  <-+
    do j = 1, 10               !    | swapped
        do i = 1, 10           !  <-+
            a(i, j, k) = i*j+k
        end do
    end do
end do

The way Fortran stores multi-dimensional arrays is with the first index changing fastest. The efficient method therefore reads successive elements, whereas the inefficient method needs to jump around in memory quite a bit.

*Instead of this convoluted loop, you could just as easily use SUM and COUNT:

*

*COUNT counts the instances of .TRUE. in an array, so your value of numb could just as easily be calculated as numb=COUNT(store/=-99)

*SUM has the optional argument MASK that you can use to omit certain values. To sum up all the values that are not -99, you can use: s = SUM(store, MASK=(store /= -99))
So you could replace about 15 lines of your code with just:
ave = sum(store, MASK=(store/=par)) / count(store/=par)

*Both store and par are double precision, and comparing floating point variables for absolute equality is tricky


text:
Q: Disable \tabulinesep for some rows with tabu package The \tabulinesep parameter with tabu package provide good paddings for tables with variant heights. But when using it with diagbox package, the paddings cause problem.
\documentclass{article}
\usepackage{amsmath,diagbox,tabu}
\begin{document}
tabulinesep
{\setlength{\tabulinesep}{3pt}
\begin{tabu}{|c|c|c|}
\hline
\diagbox{X}{Y} & Z & Z\\
\hline
$\dfrac12$ & $\dfrac34$ & $\dfrac56$ \\
\hline
$A$ & $B$ & $C$ \\
\hline
\end{tabu}}
%
extrarowsep
{\setlength{\extrarowsep}{3pt}
\begin{tabu}{|c|c|c|}
\hline
\diagbox{X}{Y} & Z & Z\\
\hline
$\dfrac12$ & $\dfrac34$ & $\dfrac56$ \\
\hline
$A$ & $B$ & $C$ \\
\hline
\end{tabu}}
\end{document}

How could I disable \tabulinesep padding for only the first row of the table?
As you could see in the above example, \extrarowsep doesn't give the desired paddings. Therefore I would like to stick to \tabulinesep solution.

A: As an alternative, I propose \addstackgap of the stackengine package, which only needs to be applied to the tallest cell in an oversized row.  Here I use it in conjunction with \extrarowsep, but depending on what look the OP seeks, that is not necessary.
\documentclass{article}
\usepackage{amsmath,diagbox,tabu,stackengine}
\begin{document}
tabulinesep
{\setlength{\tabulinesep}{3pt}
\begin{tabu}{|c|c|c|}
\hline
\diagbox{X}{Y} & Z & Z\\
\hline
$\dfrac12$ & $\dfrac34$ & $\dfrac56$ \\
\hline
$A$ & $B$ & $C$ \\
\hline
\end{tabu}}
%
\Centerstack{addstackgap + extrarowsep}
{\setlength{\extrarowsep}{1pt}
\begin{tabu}{|c|c|c|}
\hline
\diagbox{X}{Y} & Z & Z\\
\hline
\addstackgap[4pt]{$\dfrac12$} & $\dfrac34$ & $\dfrac56$ \\
\hline
$A$ & $B$ & $C$ \\
\hline
\end{tabu}}
\end{document}

A: One way is to enlarge \extrarowsep, for example to 8pt:
\setlength{\extrarowsep}{8pt}
\begin{tabu}{|c|c|c|}
\hline
\diagbox{X}{Y} & Z & Z\\
\hline
$\dfrac{1}{2}$ & $\dfrac{3}{4}$ & $\dfrac{5}{6}$ \\
\hline
$A$ & $B$ & $C$ \\
\hline
\end{tabu}

In this case are all rows higher, but look similar as you show in right picture ...
Edit:
Another way for enlarge on row's height (for your particular problem) is to put rule in one row cell:
\begin{tabu}{|c|c|c|}
\hline
\diagbox{X}{Y} & Z & Z\\
\hline
$\dfrac12$\rule[-2.4ex]{0pt}{6ex} & $\dfrac34$ & $\dfrac56$ \\
\hline
$A$ & $B$ & $C$ \\
\hline
\end{tabu}

Of course, this is not general solution.


text:
Q: How should duplicate answers be handled? What should I do when I see an unanswered question (or not well answered) which solution is the same of the answer to a different question?

*

*Should I refer to the answer of the different question with a link:

*

*in the comment section?

*as an answer?

*Should I copy the answer of the different question?

*Should I down-vote it?

*Should I flag it for moderator attention?

Notice I tried to use the same wording as the meta-question How should duplicate questions be handled? as it is easier to find it.

Note: To clarify a bit this issue, I will illustrate it with a real example.
I wrote this answer to the question, that involved a pretty long process.
I also found this other question, that seems completely different to the other one, but in reality, it is a question that emerges in the same process of the other question/answer. I decided to answer it with a link to my previous long answer. Should I do it that way or other way is preferred?

Edit: This question has been marked as a duplicate by 3 different questions... :-)
I did some searches before posting current question, and neither of the questions I found seemed clear to me. Now I realize, that the question Should I copy my answer to a duplicate question to the original question? may give part of the solution to this question, though my mind still gets confused, and does not find a definitive answer to the list of questions I ask here.
Moreover I think the wording of current question it is easier to find.


text:
Q: How to export all id's to barcodes in PDF using TCPDF, PHP and SQL I'm trying to print results from sql query to barcode and pdf using TCPDF.
How would i print all this to BARCODE in PDF using TCPDF? I tryed using examples but i always get headers already sent error when i try to include db connection class...

<?php
$entry = $db->odradi("SELECT * FROM customers ORDER BY id_number ASC");
if (!empty($entry)) {
    foreach($entry as $data=>$value){
        ?>

            <?php echo $entry[$data]['id_number'] ?>

    <?php } } ?>


text:
Q: How do I reference the -s flag for javac in an ant script? I am trying to compile the canonical metamodel classes for some JPA entities using an ant script.  I am using OpenJPA.  I would like the generated files to be located in a subdirectory which, according to the OpenJPA documentation, I can do by specifying the -s option for javac.  The way I am trying to do this right now is like this:
<compilerarg value="-s c:\buildfiles"/>

However, I keep getting an error that says:
javac: invalid flag: -s
Usage: javac <options> <source files>

If I do:
<compilerarg value="-version"/>

it tells me that I am using 1.6.  And if I do:
<compilerarg value="-help"/>

it lists -s as a valid option.  Does anybody have any advice on what I can do to accomplish what I'm trying to do?  Thank you!

A: You have two args in there, with a space between them.  You just need to separate them:
<compilerarg value="-s"/>
<compilerarg value="c:\buildfiles"/>

At the moment you're parsing the single arg "-s c:\buildfiles".  If you run
ant -verbose

you can verify this - you'll see something like:
  [javac] Compilation arguments:
    [javac] '-classpath'
    [javac] ''
    [javac] '-sourcepath'
    [javac] '/a/b/c'
    [javac] '-target'
    [javac] '1.5'
    [javac] '-g:none'
    [javac] '-s c:\buildfiles'    <-- here is the problem
    [javac] '-source'
    [javac] '1.5'
    [javac]
    [javac] The ' characters around the executable and arguments are
    [javac] not part of the command.


text:
Q: Break shell output to files I know I can output script output to a file using :
/path/to/script.sh >& path/to/output.log

The thing is, I'm making an infinite loop in Java that my shell will run, thus the output file will become extremely large.
Is there anyway using linux commands to break the output by max file size to split the logs or instead i have to change outputin Java instead to console to seperate files by max file size?

A: There is something called multilog, try this:
/path/to/script.sh |[multilog][2] s2000 ./logdir

will run the script capturing stdout to your output.log and rotating it when it is bigger than 2000 bytes.

A: Yes, use logrotate
logrotate is designed to ease administration of systems that generate large numbers of log files. It allows automatic rotation, compression, removal, and mailing of log files. Each log file may be handled daily, weekly, monthly, or when it grows too large.


text:
Q: Connecting elements using Jquery by user I have a block which contains a few buttons, I want a user to be able to connect element as he/she wishes. a connector can be svg, also assume elements can be draggable
I want something like this below

So far here is what I have, jsfidle demo
HTML

Div 1

Div 2

Div 3

Div 4

Div 5

Div 6

Div 7

Div 8

Div 9

JS
$(document).on("click", "div.elm", function(){
  if ($(this).hasClass("connected")) return;

  if ($(this).hasClass("highlight")) {
    $(this).removeClass("highlight");
    return;
  }

  if ($("div.highlight").length == 0) {
    $(this).addClass("highlight");
  } else if (!$(this).hasClass("connected")) {
    // there's one clicked already so lets connect em
    var div_1 = $("div.highlight")
    var pos_1 = div_1.position();
    var div_2 = $(this)
    var pos_2 = div_2.position();
    if (pos_1.top == pos_2.top) {
      // same row
      if (Math.abs(pos_1.left - pos_2.left) == 100) {
        // adjacent
          var bar = $("

").addClass("connectbar").css({ "top" : (pos_1.top - 2 + div_1.height() / 2) + "px", "height" : "5px", "width" : "50px", "left" : ((pos_1.left > pos_2.left ? pos_2.left : pos_1.left) + 50) + "px" });
          $("body").append(bar);
      } else {
        // same row not adjacent
          var bar1 = $("

").addClass("connectbar").css({ "top" : (pos_1.top + 50) + "px", "height" : "20px", "width" : "5px",  "left" : (pos_1.left - 2 + div_1.width() / 2) + "px"});
          var bar2 = bar1.clone().css({"left" : (pos_2.left - 2 + div_2.width() / 2) + "px"});
          var bar3 = $("

").addClass("connectbar").css({ "top" : (pos_1.top + 65) + "px", "left" : ((pos_1.left > pos_2.left ? pos_2.left : pos_1.left) + 25) + "px", "width" : "200px", "height" : "5px" });
          $("body").append(bar1).append(bar2).append(bar3);
      }
    } else if (pos_1.left == pos_2.left) {
      // same column
      if (Math.abs(pos_1.top - pos_2.top) == 100) {
        // adjacent
          var bar = $("

").addClass("connectbar").css({ "top" : ((pos_1.top > pos_2.top ? pos_2.top : pos_1.top) + 50) + "px", "height" : "50px", "width" : "5px", "left" : (pos_1.left - 2 + div_1.width() / 2) + "px" });
          $("body").append(bar);
      } else {
        // same column not adjacent
          var bar1 = $("

").addClass("connectbar").css({ "left" : (pos_1.left + 50) + "px", "height" : "5px", "width" : "20px",  "top" : (pos_1.top - 2 + div_1.height() / 2) + "px"});
          var bar2 = bar1.clone().css({"top" : (pos_2.top - 2 + div_2.height() / 2) + "px"});
          var bar3 = $("

").addClass("connectbar").css({ "left" : (pos_1.left + 65) + "px", "top" : ((pos_1.top > pos_2.top ? pos_2.top : pos_1.top) + 25) + "px", "width" : "5px", "height" : "200px" });
          $("body").append(bar1).append(bar2).append(bar3);
      }
    }
    div_1.removeClass("highlight").addClass("connected");
    div_2.addClass("connected");
  }
});

Css
div.elm {
    float:left;
    width:50px;
    height:50px;
    background-color:#9F9;
    margin-right:50px;
    margin-bottom:50px;
}

div.elm:nth-of-type(3n + 1) { clear:left; }
div.elm:nth-of-type(3n) { margin-right:0px; }
div.highlight { background-color:#F99; }
div.connected { background-color:#99F; }
div.connectbar {
    position : absolute;
    z-index : 10;
    background-color:#66C;
}

so far my demo is connecting the only element in the same row, I can't connect the way I want.
What do I need to change to get the result I want? or is there any plugin which can solve my problem?? any help or suggestions will be appreciated


text:
Q: Adding SPFieldType.File to a custom list When I try to add a File type field to a custom list I get
System.InvalidOperationException: Operation is not valid due to the current state of the object
Guid listGuid = adminWeb.Lists.Add(queueListName, "DotNetNuke Document Queue", SPListTemplateType.GenericList);

queueList = adminWeb.Lists[listGuid];
queueList.Fields.Add("Status", SPFieldType.File, false);

queueList.Update();

A: I don't believe that you can have a "File" field. If you look in the UI, there is no "File" field type for custom/generic list.
If you need 1 file per item and it is mandatory, then you should be using a document library.
If you need more than 1 file per list item, then file attachments is the way to go.


text:
Q: What's the status of CAT.NET? I'm trying to find Microsoft CAT.NET for VS2010 and it looks like there was a beta of their 2.0 version but every link to it in Microsoft Connect is now dead. This is the most recent reference I could find: http://blogs.msdn.com/securitytools/archive/2010/02/05/how-to-use-cat-net-2-0-beta.aspx
Some references suggest it may have been rolled into FxCop. Does anyone know the status of the project?

A: Unfortunately it looks like the answer to my question is "In a perpetual state of limbo". Back in June there was a last minute design issue right before it was intended to be released.
In answer to my question on MSDN about the status I was told the same thing and that was now almost five months ago. There are a series of impatient follow-ups by the community on that thread and not a single word from Microsoft nor is there any update on the MSDN Security Tools page.
Don't hold your breath folks!

A: Here us the Forum - http://social.msdn.microsoft.com/Forums/en-AU/catnet/threads
Here is where they make comments on Dev and QA - Link
Here is where you download it - http://www.microsoft.com/downloads/details.aspx?FamilyId=e0052bba-2d50-4214-b65b-37e5ef44f146&displaylang=en
That is the 64 bit version. I found it ran without throwing a 'Out of memory Exception' that i got from the 32 bit version, but only comes in cmd line form
The 32 bit version snaps into VS2008 but hasn't been made ready for integration into VS2010
Note: I've been trying to get the 2.0 Beta today and haven't had an luck, as you said the links are all broken and the email address for the team is bouncing.

A: Any news on this? The MSDN forums don't have any updates
It seems that the best option is to use the v1.x version (the 32bit is here: http://www.microsoft.com/downloads/details.aspx?familyid=0178E2EF-9DA8-445E-9348-C93F24CC9F9D&displaylang=en)

A: On the topic of Cat.Net, checkout my 15+ Cat.NET blogs posts: http://blog.diniscruz.com/search/label/CatNet
In there you will see that there is a lot happening on the Cat.NET front (outside Microsoft :)  )

A: While they haven't released the new version, the good news is you can still use the old Add-in for CAT.NET 1.1.1.9 in Visual Studio 2010. All that is required is editing the default AddIn file to tell it to support the new version.
The file is installed to: %APPDATA%\Microsoft\MSEnvShared\Addins\Microsoft.ACESec.CATNet.AddIn.  You can open it in a text editor and add a new node for <version>10.0</version>
After you edit the file, just restart Visual Studio and you should be all set.
If the AddIn file is not there, it should be in one of the locations specified in you VS Settings under Tools > Options > Environment > Add-ins / Macro Security.

A: Any further updates on this?  It appears that the CAT.Net development is dropped by Microsoft.  Few of the links that are available are broken.  Has Microsoft dropped this development in favor of some other tools, any information on this would be helpful.


text:
Q: Background image fit on screen IE10 I'm trying to set the background image in CSS to fit the screen. It's working fine with latest version of Chrome, however, I'm having issue with IE 10.
html {
border-top: 10px solid #8A85A5;
background: url("http://www.lifeintempe.com/gfx/photos/2008-11-28-tempe-sunset-56632.jpg") no-repeat center center fixed ;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;

}
This is how it's displaying in IE 10. There're so much white space...
Any suggestion on how I can resolve this?

I also tried adding...Didn't work.
min-height:100%;
min-width: 100%;

UPDATE:
The above is all I have in my CSS file.  Here's how my html looks like:
<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="Site.master.cs" Inherits="ScreenPop.Site" %>

<!DOCTYPE html>

<title></title>
<link rel ="stylesheet" type ="text/css" href="Style/MyStyle.css" />
<asp:ContentPlaceHolder ID="head" runat="server">
</asp:ContentPlaceHolder>

    <form id="form1" runat="server">
    <asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server"></asp:ContentPlaceHolder>
    </form>

A: This worked for me:
html {
border-top: 10px solid #8A85A5;
background-color: #d5d5d5;
background-image: url('http://www.lifeintempe.com/gfx/photos/2008-11-28-tempe-sunset-56632.jpg');
background-repeat: no-repeat;
background-position: top center;
background-size: 100%;
filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='http://www.lifeintempe.com/gfx/photos/2008-11-28-tempe-sunset-56632.jpg', sizingMethod='scale');
-ms-filter: "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='http://www.lifeintempe.com/gfx/photos/2008-11-28-tempe-sunset-56632.jpg', sizingMethod='scale')";
}

Solution 2:
Use a wrapper div like this:

#bg {
  position: fixed;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
}
#bg img {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  margin: auto;
  min-width: 50%;
  min-height: 50%;
}

DEMO
Update
After a bit of Googling found this one and yes it worked for me. I have tested it. Hope it works for you.

<form id="form1" runat="server">

</form>

html, body {
height: 100%;
margin: 0;
padding: 0;
}
img#bg {
position:fixed;
top:0;
left:0;
width:100%;
height:100%;
}


text:
Q: very basic ruby/sinatra/heroku/debugging question: how to see output of puts and p? I'm trying to build a very simple sinatra app deployed on heroku.
our app is not outputting stuff to a web browser, it's communicating with another computer via an API. so my usual trick of just printing a little extra debugging info to the browser while I'm using the app doesnt work.
the sample code I've seen for related apps show multiple 'puts' or 'p' statement used ot sort of see what's going on...
where does the output go that I can see that output as the program executes, or afterwards.
and in general, if you're flailing around with code hosted at Heroku that's just not doing what you want, what IS the easiest way to at various places in the code output messages like "foo equals 123" so you can see that output to figure out what's happening in the code?
p and puts dont output so the logs I can see when I type "heroku logs" for example...

A: According to http://docs.heroku.com/logging you should be able to have puts and p just go to your log if you add the basic logger (which has apparently been added by default to all apps created after February 2nd, 2011).
For non-Heroku basic log-to-file with Sinatra and Logger:
require 'logger'
Dir.mkdir('logs') unless File.exist?('logs')
$log = Logger.new('logs/output.log','weekly')

configure :production do
  $log.level = Logger::WARN
end
configure :development do
  $log.level = Logger::DEBUG
end

get "/" do
  $log.debug "Hello, World!"
end

A: This will work fine.  test_logging.rb
require 'sinatra'
require 'logger'

enable :logging

before do
  logger.level = Logger::DEBUG
end

get '/' do
  logger.debug "Handling 'hello world' request."
  logger.info "Hello world."

  return "
Hello World
"
end

A: If you use a cedar stack, try to put a line bellow in config.ru,
$stdout.sync = true

http://devcenter.heroku.com/articles/ruby#logging
Original post was in February 2011, and Cedar stack was introduced in May, so this doesn't seem to be help for original question, but some of you may find this could be help.
http://blog.heroku.com/archives/2011/5/31/celadon_cedar/

A: See here for tips on how to write to the Logger: http://mikenaberezny.com/2007/02/24/rails-logging-tips/
The example given is:
class HomeController < ActionController::Base
  def index
    logger.info 'informational message'
  end
end

A: This is the line that works for me:
# On config.ru, before run:
enable :logging, :dump_errors, :raise_errors


text:
Q: divide and conquer method for linker I have multiple files (>300 object files), whose need in linking with "ld" command.
Now, I waste a lot of time, while I wait linking process will be done (and this process not always will be successful).
I have next question: can I use "divide and conquer" method for linking, e.g. link every pair object files (for example objfile1.o and objfile2.o) in single object file (for example objfile1-2.o). After it apply this scheme for every pair of objects.
Further, link every pair objects, that were got on previous stage, and so on.
Finally, link a few objects (may be pair) in one result file.
Can I use this scheme for linking (with ld)?

A: The binary splitting is probably not a good idea, but you likely
can improve link times by breaking the application up into
several shared objects, and linking against those.  When linking
against a shared object, the linker doesn't have to actually
copy the data into the executable, but only check that the
shared object does define the needed symbols.
Still, 300 object files is not a lot, and shouldn't slow things
down that much, ad least with a modern system, at least if
they're on a local drive.  (Back in the old days, when
everything was on a remote drive, we used to set up our
makefiles so that the link phase would run on the file server,
rather than on our local machine.  This could speed things up by
a factor of 10 or more.)

A: No matter how you approach it, when linking the final executable, the linker has to peruse the whole list of contents. Any intermediate "staging" of the linking process will only increase the runtime.
Picture it:

*

*object1.o contains foo(), bar()

*object2.o contains fiddle(), lee()

*main.o contains main(), which calls the above functions

When you're linking, the linker will need to link the functions together, regardless of whether they are in one file or two files.

A: No, that's not a suggested way. However, you may create static or shared library for portions and link with the shared library for multiple executables, if any linked with the shared library. That will surely take some time less than monolithic linking for every executable without any overlap.


text:
Q: Break NSString using an NSString, get everything after the string that was used to break/separate I'm trying to get the DOE,JOHN from the below NSString:
IDCHK9898960101DL00300171DL1ZADOE,JOHN
I was trying to split the string on 1ZA, as that will be constant.
Here's what I've tried so far, but it's giving me the opposite of what I'm looking for:
 NSString *getTheNameOuttaHere = @"IDCHK9898960101DL00300171DL1ZADOE,JOHN";

 // scan for "1ZA"
 NSString *separatorString = @"1ZA";

 NSScanner *aScanner = [NSScanner scannerWithString:getTheNameOuttaHere];

 NSString *thingsScanned;

 [aScanner scanUpToString:separatorString intoString:&thingsScanned];

 NSLog(@"container: %@", thingsScanned);

Output:
container: IDCHK9898960101DL00300171DL

Any help would be great! Thanks!

A: I would try using componentsSeparatedByString:
NSArray* components = [getTheNameOuttaHere componentsSeparatedByString:separatorString];

NSString* namePart = [components lastObject];

NSLog(@"name = %@", namePart);

A: componentsSeparatedByString worked great, see below:
NSString *name = @"IDCHK9898960101DL00300171DL1ZADOE,JOHN";

// scan for "1ZA"
NSString *separatorString = @"1ZA";

NSArray *split = [name componentsSeparatedByString:separatorString];

for (NSString *element in split) {
    NSLog(@"element: %@", element);
}

Output:
2010-04-26 16:50:58.496 [25694:a0f] element: IDCHK9898960101DL00300171DL
2010-04-26 16:50:58.497 [25694:a0f] element: DOE,JOHN

A: Shorter:
[[getTheNameOuttaHere componentsSeparatedByString:@"1ZA"] lastObject];


text:
Q: Como setar valor padrão em um form através do javascript? Gostaria de setar um valor padrão em um determinado campo de um formulário através de javascript. Vamos supor que o id do campo seja #codigo.

A: Você pode chamar uma tag script no seu html;
<script>
    (function(){
        document.getElementById('idDoCampo').value = 'Valor Padrão';
    })();
</script>

isso funcionará para tags input do tipo text.
Ou simplesmente:
<input type="text" id="idDoCampo" value="Valor Padrão"/>

A:

// JS Puro
document.getElementById('codigo').value = "Teste"

// jQuery
$('#codigo').val('Teste 2');
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<input id="codigo" name="codigo" type="text" />

A: Você pode fazer desta forma:
<input type="text" value="" id="codigo" >
<script>
document.getElementById("codigo").value = "Meu código";
</script>

Ele pega o elemento utilizando o 'getElementById' e seta o seu 'value'.
Resultado


text:
Q: How to make a range of points on a graph i n r a different colour I have made a graph with the year on the x-axis and sea level rise on  the y-axis.
I am trying to make the data from 2025 (predictions) a different colour to that before 2025.
I have grouped and labeled the predicted data using this code and have also included the code for my graph

predictions=data[which(data$Year>2024 & data$Year<2121),]
plot(data$Sea.Level..cm.~data$Year,xlab="Year",ylab="Sea Level (cm)",pch=21,col=c("Blue"))

How do I go from here in making the predictions red but the previous data blue?
Thanks in advance

A: You can try something like this. Toy data used.
vec <- c( rep(2001,10), rep(2002, 3) )

tf <- (vec < 2002) + 1

barplot( 1:length(vec), vec, col=c("red","blue")[tf], names=vec )

A: You can provide a vector of colours to plot in the col argument. For example, following your existing syntax:
predictions <- rep("red", nrow(data))
predictions[which(data$Year>2024 & data$Year<2121)] <- "blue"
plot(data$Sea.Level..cm.~data$Year,xlab="Year",ylab="Sea Level (cm)",pch=21,col=predictions)


text:
Q: Blackberry browsing problem I was trying to open a browser session on a blackberry mobile using j2me. I searched the net and I found this solution:
Browser.getDefaultSession().displayPage("http://www.google.com");

But I had a little problem. The Browser word causes a compiler error, so I think there is a library that needs to be imported.
Does anyone know where I can get that library?

A: A quick Google for blackberry browser getdefaultsession yields: net.rim.blackberry.api.browser.Browser


text:
Q: How to deal with underflow in R? I want to compute this number :
0.34911191 ^ 1157
I am using R programming language and it returns me 0 (this is an underflow problem). How I can fix it? Thanks.

A: You can test the result using the Numerical Characteristics of the Machine (.Machine {base}), as shown below:
> 0.34911191 ^ 10 < .Machine$double.neg.eps
[1] FALSE
> 0.34911191 ^ 1157 < .Machine$double.neg.eps
[1] TRUE

double.neg.eps is a small positive floating-point number x such that 1 - x != 1.

A: Are you looking for something like this?
The CRAN package Brobdingnag has two vignettes explaining its use.
library(Brobdingnag)

x <- 1157 * log(0.34911191)
y <- as.brob(x)
exp(y)
#[1] +exp(-1217.6)
exp(y) < .Machine$double.neg.eps
#[1] TRUE


text:
Q: Saving scores to local storage I'm implementing a dice game, which will store the results of the 2 players.
I'm having an issue saving the scores, when I console.log I get the new scores only.
What is the issue here?
window.onload = (event) => {
  throw_dice();
};
var scores = { player1: 0, player2: 0 };

function throw_dice() {
  let x = Math.floor(Math.random() * 6) + 1;
  let img1 = document.getElementById("img1");
  let y = Math.floor(Math.random() * 6) + 1;
  let img2 = document.getElementById("img2");
  img1.src = "./images/dice" + x + ".png";
  img2.src = "./images/dice" + y + ".png";

  if (x > y) {
    document.getElementById("title").innerHTML = "PLAYER 1 WINS";
    scores.player1 = scores.player1 + 1;
  } else if (x == y) {
    document.getElementById("title").innerHTML = "DRAW";
  } else {
    document.getElementById("title").innerHTML = "PLAYER 2 WINS";
    scores.player2 = scores.player2 + 1;
  }

  saveScores();
  getScores();
}

function saveScores() {
  localStorage.setItem("score", JSON.stringify(scores));
}
function getScores() {
    var x = localStorage.getItem('score');

    console.log('x', JSON.parse(x));
}

A: On pageload, you're doing
var scores = { player1: 0, player2: 0 };

and then updating that object inside throw_dice and saving to storage. On that line, you need to retrieve the object from local storage on pageload instead, otherwise you'll be never reading (and thereby overwriting) the existing scores in storage in saveScores.
var scores = JSON.parse(
  localStorage.getItem('score') || '{ "player1": 0, "player2": 0 }')
);


text:
Q: regex - what is the pattern for floating point digit next to unit basically I want to match a simple thing in a str but only want to return the first part of this match.  This is what I want to look in.
Jo 4.5 Oz cold and flu stuff to drink.
and what I want to do is return the 4.5 but only when the match is followed with a variation of the once unit.
Here is my guess
/([0-9]*\.?[0-9])(?:[\s+][o(?<=\.)z(?<=\.)|ounce]?=\s)/i

on matching:
4.5oz
4.5 oz
4.5 o.z.
4.5 oz.
4.5         oz.
4.5ounce
4.5Ounce
4.5 Oz.

but I get when I run it as of yet.
$matches = null;
$returnValue = preg_match('/([0-9]*\.?[0-9])(?:[\s+][o(?<=\.)z(?<=\.)|ounce]?=\s)/i', 'Jo 4.5 Oz cold and flu stuff to drink.', $matches);

Any help would be great.  Thank you
Cheers -Jeremy

A: Then you need a less complex pattern like:
preg_match('/
      (\d+(\.\d+)?)              # float
      \s*                        # optional space
      ( ounce | o\.? z\.? )      # "ounce" or "o.z." or "oz"
   /ix',                         # make it case insensitive
   $string, $matches);

Then either look at result $matches[1] or make the remainder an assertion with by enclosing it in (?=...) or so.

A: I think it's probably a little more simple than what you're trying there. Give this expression a try:
\s[\d]+.{1}[\d]+\s*(oz|ounce|o.z.|oz.)

Or with full php:
$test_string = 'Jo 4.5 Oz cold and flu stuff to drink.';
$returnValue = preg_match('/\s[\d]+.{1}[\d]+\s*(oz|ounce|o.z.|oz.)/i', $test_string, $matches);

EDIT
If you want to check if they use a . or a , you could use:
\d+(.|,){1}\d+\s*(ounce|o\.?z\.?)

or
 $returnValue = preg_match('/\d+(.|,){1}\d+\s*(ounce|o\.?z\.?)/ix', $test_string, $matches);

EDIT 2
If you want named patterns try this:
$returnValue = preg_match('/(?P<amount>\d+(.|,){1}\d+)\s*(?P<unit>(ounce|o\.?z\.?))/ix', $test_string, $matches);

print_r($matches);

Output:
Array
(
    [0] => 4.5 Oz
    [amount] => 4.5
    [1] => 4.5
    [2] => .
    [unit] => Oz
    [3] => Oz
    [4] => Oz
)


text:
Q: System.Net.WebException: The server committed a protocol violation I have the following code to make a call that in turn returns xml:
private string Send(string url)
{
    try
    {
        HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);

        using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
        {
            using (Stream stream = response.GetResponseStream())
            {
                using (StreamReader reader = new StreamReader(stream))
                {
                    return reader.ReadToEnd();
                }
            }
        }
    }
    catch (WebException ex)
    {
        var _status = ex.Status.ToString();
        if (ex.Status == WebExceptionStatus.ProtocolError)
        {
            _status = ((HttpWebResponse)ex.Response).StatusCode.ToString();
        }
        Trace.WriteLine(_status.ToString());
    }

    return "error";
}

Most of the time (not always) I get

System.Net.WebException: The server committed a protocol violation.
Section=ResponseStatusLine at System.Net.HttpWebRequest.GetResponse()

exception thrown.
I have added this to my App.config directly in the <configuration> section:
<system.net>
  <settings>
    <httpWebRequest useUnsafeHeaderParsing="true"/>
  </settings>
</system.net>

But I continue to get the error.

A: Set
request.KeepAlive = false;

http://www.webmonkeys.org.uk/2012/09/c-the-server-committed-a-protocol-violation-sectionresponsestatusline/#comment-60
Also, the useUnsafeHeaderParsing config value that you pasted has it set as false, when you should be setting it to true, if you're attempting to get past this issue.

A: request.ServicePoint.Expect100Continue = true;


text:
Q: Access Database turn on aggregate type through VBA Can anyone review my code here and see where I did wrong. My objective is to turn on the Aggregate Type in the Datasheetview after creating the query. So far
    Function LoopQuery(ByVal tempProj As Double)
Dim strSQL As String
Dim qdfTemp As QueryDef
Dim ProjNumb As Double
ProjNumb = tempProj
strSQL = "sql code...."
With CurrentDb
Set qdfTemp = .CreateQueryDef(ProjNumb, strSQL)
   qdfTemp.Fields(21).Properties("AggregateType").Value = 0 'add the Aggregate Total on Total Hours
   qdfTemp.Fields(23).Properties("AggregateType").Value = 0   'add the Aggregate Total on Total Costs
   qdfTemp.Fields(24).Properties("AggregateType").Value = 0   'add the Aggregate Total on Total Discounted
End With

I know I am close, my problem is that
qdfTemp.Fields(21).Properties("AggregateType").Value = 0 'add the Aggregate Total on  Hours
qdfTemp.Fields(23).Properties("AggregateType").Value = 0 'add the Aggregate Total on Total Costs
qdfTemp.Fields(24).Properties("AggregateType").Value = 0 'add the Aggregate Total on Total Discounted

does not create the Sum Total row that I need.
I used this this on the msdn forum for the property reference, but it doesnt' seem to work on my query. Any help would be appreciated.
EDIT:
upon playing around, i realize the AggregateType.value = 0 did pass through, but the "Totals Row" wasnt visible. Once i clicked on the Totals Records under the Home ribbon, I was able to see that it did get summed for me. So now my question is.
How do I set visible the Totals row on the bottom of the datasheet view?  I tried
 currentdb.qdfTemp.Properties("TotalsRow") = True

but its returning an error

A: As you discovered, you must set the query's TotalsRow property to True before your field's totals can be displayed.
However the TotalsRow property does not exist when you first create the QueryDef.  So you must create the property ...
Set qdfTemp = .CreateQueryDef(ProjNumb, strSQL)
qdfTemp.Properties.Append _
    qdfTemp.CreateProperty("TotalsRow", dbBoolean, True)


text:
Q: Use data.table package in shiny app I want to use the data.table package in a Shiny App to improve speed.
However, it's not clear to me how to select the right columns based on the user input.
The following example works for the case when the data is in the data.frame format but not when it is in data.table format.
# load packages
library(data.table)
# global  ----------------------------------------
library(shiny)
# use cars dataset
data(cars)
# create datatable from cars data
cars <- as.data.table(cars)

# user interface ---------------------------------
ui <- fluidPage(

  sidebarLayout(
    selectInput(inputId = 'col',    label = 'column', choices = names(cars)),
    numericInput(inputId = 'filter',label = 'filter', value = 5)
  ),
    mainPanel(plotOutput("plot"))

)

# server ----------------------------------------
server <- function(input, output) {
   output$plot <- renderPlot({
     # filter example
      d1 <- cars[speed>input$filter,]
      x    <- d1[[input$col]]
      hist(x)
   })
}

# run app  --------------------------------------
shinyApp(ui = ui, server = server)


text:
Q: Jquery evento change llamado dos veces Tengo el siguiente código:
<input type="checkbox" id="paid_out" name="paid_out" onchange="change_payment_status(this.checked)">

    $('#paid_out').on('change', function(e){
        this.checked=!this.checked?!confirm('Esta acción va a anular la deuda documentada asociada a este egreso ¿Está seguro de eliminarla?'):true;

        if(this.checked) {
            e.preventDefault();
            e.stopPropagation();
            return false;
        }
    });

Cuando llamo el evento change y coloco cancelar en el confirm no ejecuta apropiadamente e.preventDefault() ni e.stopPropagation() sigue el flujo de change_payment_status y lo que quiero es detenerlo. Si saco el change_payment_status el change se detiene bien, es como si se solapara el evento onchange del checkbox con el on change.


text:
Q: syntax error: expecting keyword_then or ';' or '\n' what could possibly be the syntax error with this piece of code?
<%= if @post.comments != nil %>
<div id="comments">
    <%= render(:partial => "comments/comments", :object => @post_comments) %>
</div>
<%= end %>

it keeps on telling me this:
expecting keyword_then or ';' or '\n' ...nd=( if @post.comments != nil );@output_buffer.safe_append=' ...
 syntax error, unexpected keyword_end ';@output_buffer.append=( end );@output_buffer.safe_append='
 syntax error, unexpected keyword_end, expecting ')' end ^
 syntax error, unexpected keyword_ensure, expecting ')'
 syntax error, unexpected keyword_end, expecting ')'

and whenever I remove the block of code above, the code works with no errors, so I am sure the errror is in this part. Any Suggestions please?

A: <%= if @post.comments != nil %>
  ...
<%= end %>

should use the <% tag not <%= as they are control statements, not for output:
<% if @post.comments != nil %>
  ...
<% end %>

You can find more about the use of these tags in ERB here: http://guides.rubyonrails.org/action_view_overview.html#templates


text:
Q: Issue with Jama's Eigenvalue decomposition function I am getting a wrong eigen-vector (also checked by running multiple times to be sure) when i am using matrix.eig().  The matrix is:
1.2290 1.2168 2.8760 2.6370 2.2949 2.6402
1.2168 0.9476 2.5179 2.1737 1.9795 2.2828
2.8760 2.5179 8.8114 8.6530 7.3910 8.1058
2.6370 2.1737 8.6530 7.6366 6.9503 7.6743
2.2949 1.9795 7.3910 6.9503 6.2722 7.3441
2.6402 2.2828 8.1058 7.6743 7.3441 7.6870

The function returns the eigen vectors:
-0.1698  0.6764  0.1442 -0.6929 -0.1069  0.0365
-0.1460  0.6478  0.1926  0.6898  0.0483 -0.2094
-0.5239  0.0780 -0.5236  0.1621 -0.2244  0.6072
-0.4906 -0.0758 -0.4573 -0.1279  0.2842 -0.6688
-0.4428 -0.2770  0.4307  0.0226 -0.6959 -0.2383
-0.4884 -0.1852  0.5228 -0.0312  0.6089  0.2865

Matlab gives the following eigen-vector for the same input:
0.1698 -0.6762 -0.1439  0.6931  0.1069  0.0365
0.1460 -0.6481 -0.1926 -0.6895 -0.0483 -0.2094
0.5237 -0.0780  0.5233 -0.1622  0.2238  0.6077
0.4907  0.0758  0.4577  0.1278 -0.2840 -0.6686
0.4425  0.2766 -0.4298 -0.0227  0.6968 -0.2384
0.4888  0.1854 -0.5236  0.0313 -0.6082  0.2857

The eigen-values for matlab and jama are matching but eigen-vectors the first 5 columns are reversed in sign and only the last column is accurate.
Is there any issue on the kind of input that Jama.Matrix.EigenvalueDecomposition.eig()
accepts or any other problem with the same? Please tell me how i can fix the error. Thanks in advance.

A: There is no error here, both results are correct - as is any other scalar times the eigen vectors.
There are an infinite number of eigen vectors that work - its just convention that most software programs report the vectors that have length of one.  That Jama reports eigen vectors equal to -1 times those of Matlab is probably just an artifact of the algorithm they used.

A: For a given matrix, the eigenvalues are unique, whose number equals the dimension of the matrix if plurality is considered. While the corresponding eigenvalues might be different because the vectors can scale according to a certain direction. In your post results, both JAVA and Matlab versions are correct.
Also, you could check the D matrix, where the eigenvalues come from. You could find they are the same.


text:
Q: HTML Email and Lotus Notes - Content is repeating I have an HTML Email campaign that I have tested with EmailOnAcid.com. The email displays fine in almost all clients except Lotus Notes v6.5, v7, v8 :(
In Lotus Notes 6.5 & 7, at the end of the email, Lotus seems to repeat the email from the start again, so it looks like the same email has been put in twice, but it hasn't.
Is there a mimimum height for HTML emails in Lotus? (height of my email is around 474px).
I have specified height on all image elements and on  tags.
In Lotus Notes 8, there is a minor problem; the lower part of the footer image repeats itself?
Does anyone have ideas as to what is causing these problems??
Thanks in advance.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

  <title>Email</title>

                                            TEXT GOES HERE TEXT GOES HERE TEXT GOES HERE TEXT GOES HERE TEXT GOES HERE TEXT GOES HERE TEXT GOES HERE TEXT GOES HERE TEXT GOES HERE TEXT GOES HERE TEXT GOES HERE TEXT GOES HERE TEXT GOES HERE

                                            TEXT GOES HERE TEXT GOES HERE TEXT GOES HERE TEXT GOES HERE TEXT GOES HERE TEXT GOES HERE TEXT GOES HERE TEXT GOES HERE

A: It appears this might be an issue with the EmailsOnAcid testing system.


text:
Q: Nested routing in react I'm trying to implement nested routing in my react app
The routes in my root app.jsx file are defined like this.
    <>
      <Router>
        <DrawerContextProvider>
        <Appbar />
        <Switch>
          <Route exact path='/admin'>
            <Admin/>
          </Route>
          <Route path='/technician' component={Technician} />
          <Route path='/accountmanager' component={AccountManager} />
        </Switch>
        </DrawerContextProvider>
      </Router>
    </>

This is the code in my admin component
function Admin() {
    const classes = useStyles();
    const { open } = useContext(DrawerContext)
    const { url, path } = useRouteMatch();

    return (
        <>
            <SideMenu iconsandnames={iconsandnames} />

                    <Switch>
                        <Route exact path={path} >
                            <Dashboard />
                        </Route>
                        <Route  path={`${path}/:id`} >
                            <Outlet />
                        </Route>
                    </Switch>

        </>
    )
}

function Outlet() {
    const { id } = useParams();
    console.log(id);

    return (

{id}

      );

}

This is the code in my Side menu component
export default function MiniDrawer({ iconsandnames }, props) {
    const classes = useStyles();
    const theme = useTheme();
    const { url, path } = useRouteMatch();
    const { open, handleDrawerClose } = useContext(DrawerContext)

    return (

            <Drawer
                variant="permanent"
                className={clsx(classes.drawer, {
                    [classes.drawerOpen]: open,
                    [classes.drawerClose]: !open,
                })}
                classes={{
                    paper: clsx({
                        [classes.drawerOpen]: open,
                        [classes.drawerClose]: !open,
                    }),
                }}
            >

                    <IconButton onClick={handleDrawerClose}>
                        {theme.direction === 'rtl' ? <ChevronRightIcon /> : <ChevronLeftIcon />}
                    </IconButton>

                <Divider />
                <List>
                    {iconsandnames.map((data) => (
                        data.text == "Home" ? (
                            <Link to={url}>
                            <ListItem button key={data.text} >
                                <ListItemIcon><Icon>{data.iconname}</Icon></ListItemIcon>
                                <ListItemText primary={data.text} />
                            </ListItem>
                        </Link>):
(                        <Link to={`${url}/${data.route}`}>
                            <ListItem button key={data.text} >
                                <ListItemIcon><Icon>{data.iconname}</Icon></ListItemIcon>
                                <ListItemText primary={data.text} />
                            </ListItem>
                        </Link>)
                    ))}
                </List>
            </Drawer>

    );
}

this is the iconsandnames array I'm passing into the sidemenu
const iconsandnames = [
    {
        iconname: 'home',
        text: 'Home',
        route: 'home'
    },
    {
        iconname: 'rounded_corner',
        text: 'Projects',
        route: 'projects'
    },
    {
        iconname: 'account_box',
        text: 'Account managers',
        route: 'accountmanagers'
    },
    {
        iconname: 'build',
        text: 'Contractors',
        route: 'contractors'
    },
    {
        iconname: 'perm_identity',
        text: 'Clients',
        route: 'clients'
    },
    {
        iconname: 'work_outline',
        text: 'Work Orders',
        route: 'workorders'
    },
    {
        iconname: 'preview',
        text: 'Additional',
        route: 'additional'
    },
]

http://localhost:3000/admin shows me

http://localhost:3000/admin/projects shows me

ideally the sidemenu should not disappear when I switch the route but instead it is disappearing over here. Any ideas on what might be the problem and how can I solve it?

A: Issue
You are specifying the exact prop on the "/admin" path, so any nested routes can no longer be matched and rendered.
<Route exact path='/admin'>
  <Admin/>
</Route>

Admin
<Switch>
  <Route exact path={path} > // <-- can match
    <Dashboard />
  </Route>
  <Route  path={`${path}/:id`} > // <-- can't match
    <Outlet />
  </Route>
</Switch>

Solution
When rendering Route components into a Switch, path order and specificity matter. You will want to order your paths from more specific to less specific, in order to give the more specific paths a chance to be matched and rendered first before less specific paths.
Routes - remove the exact prop from the "/admin" route so any nested route can be matched.
<>
  <Router>
    <DrawerContextProvider>
    <Appbar />
    <Switch>
      <Route path='/admin'>
        <Admin/>
      </Route>
      <Route path='/technician' component={Technician} />
      <Route path='/accountmanager' component={AccountManager} />
    </Switch>
    </DrawerContextProvider>
  </Router>
</>

Admin - reorder the routes by specificity.
<Switch>
  <Route path={`${path}/:id`} >
    <Outlet />
  </Route>
  <Route path={path} >
    <Dashboard />
  </Route>
</Switch>


text:
Q: Limiting node.js's memory usage I am trying to limit a node.js application from using to much memory and I've found out about the --max-stack-size & --max_executable_size options that are available within V8 to pass when invoking the file, but how should I combine these and possible other arguments to limit max memory usage to 1GB?

A: https://github.com/joyent/node/wiki/FAQ

What is the memory limit on a node process?
Currently, by default v8 has a memory limit of 512mb on 32-bit
  systems, and 1gb on 64-bit systems. The limit can be raised by setting
  --max_old_space_size to a maximum of ~1gb (32-bit) and ~1.7gb (64-bit), but it is recommended that you split your single process
  into several workers if you are hitting memory limits.

Value is in megabytes, I believe.

A: It's now, --max-old-space-size no technology limits...
for example node --max-old-space-size=8192 ./app. We create limit in 8Gb


text:
Q: partial update via javascript I'm venturing in Ruby on Rails for a while but never did anything with js. I searched the internet some tutorials but nothing went right to what I wanted.
I have a rails application where in one view I have two partials, one form and another that shows a list of tasks that were created by the form. I want that when the submit button is clicked, the partial list is updated with the new newly created task, while also keeping the others that were created before.
Anyone have a better link to help me? Or a little time to explain to me?
Edit:
with the help of the answers below, I changed my code to:
_to_do_list.html.erb ( with the partial form, it should update the form below, list when pressed the button subit form.)
<%= form_for @todo_list, remote: true do |f| %>
....

      <%= f.label :name%>

      <%= f.text_field :name %>

      <%= f.label :description %>

      <%= f.text_area :description %>

      <%= f.label 'Público?'%>
      <%= f.check_box :is_public %>

      <%= f.submit %>

      <%= render 'show'  %>

And, partial show, not changed, which must be updated:

    Name
    Description
    is public?
    Add Tasks
    erase List

  <% @todo_lists.each do |f|%>

    <%=f.name %>
    <%=f.description%>
    <%=f.is_public  %>
    <%= link_to new_task_path :method => :get %>
     <%= link_to 'Destroy', f, confirm: 'Are you sure?', method: :delete%>

  <% end %>

And, new js file :
$("#todos").html('<%=j render partial: "to_do_lists/show", locals: { todo_lists: @todo_list } %>');

Controller:
def create
    @todo_list = ToDoList.new(params[:to_do_list])
    @todo_list.member_id = current_member.id

    respond_to do |format|
      if @todo_list.save
        format.js{}
        format.html { redirect_to @todo_list, notice: 'Lista ' +@todo_list.name+ ' foi criada com sucesso!' }
        format.json { render json: @todo_list, status: :created, location: @todo_list }
      else
        format.html { render action: "new" }
        format.json { render json: @todo_list.errors, status: :unprocessable_entity }
      end
    end
  end

The idea is to create a new row in the table with the new task created without leaving the page.
Thank you.
Edit

A: What you need is AJAX. If you look at docs it says
JavaScript can also make requests to the server, and parse the response. It also has the ability to update information on the page. Combining these two powers, a JavaScript writer can make a web page that can update just parts of itself, without needing to get the full page data from the server. This is a powerful technique that we call Ajax.
For this to work you first need to change your form to have remote: true option which basically allows your forms values to be submitted by js. Your form will look like
<%= form_for @todo_list, remote: true do |f| %>
  ...
  // form fields
<% end %>

 // to target this div to render your partial from js
  <%= render 'show'  %>  // it doesn't make sense to have your partial inside form and

it should be outside your form
In your create action you need to have a respond_to block
def create
  @todo = Todo.new(todo_params)
  respond_to do |format|
    if @todo.save
      format.js{}  # this will allow rails to look for create.js.erb in your views/controller directory where you can use your js to render your partial or append newly created todo
    else
      format.html{render "new"}
    end
  end
end

In your create.js.erb template use your js to render partial or append your newly created item
$("#some-id").html("<%=j render "show" %>");

OR
Instead of rendering whole partial again what you can do it just append your newly created todo in your table by js
$("#table-id").append("<%=j render partial: "todo", locals: {f: @todo} %>");

Here your _todo.html.erb will contain

  <%=f.name %>
  <%=f.description%>
  <%=f.is_public  %>

For details checkout Working with javascript in rails
UPDATE
If you look at your partial you have

  <% @todo_lists.each do |f|%> // your @todo_lists is a collection of todos

      <%=f.name %>
      <%=f.description%>
      <%= link_to new_task_path %>	 // you don't need to specify method here link_to by default uses a get request
       <%= link_to 'Destroy', f, confirm: 'Are you sure?', method: :delete%>

  <% end %>

Change your controller method to this:
def create
  @todo_list = ToDoList.new(params[:to_do_list])
  @todo_list.member_id = current_member.id
  respond_to do |format|
    if @todo_list.save
      @todo_lists = ToDoList.all // get a collection of todos to render in your partial
      format.js{}
      format.html { redirect_to @todo_list, notice: 'Lista ' +@todo_list.name+ ' foi criada com sucess!' }
      format.json { render json: @todo_list, status: :created, location: @todo_list }
    else
      format.html { render action: "new" }
      format.json { render json: @todo_list.errors, status: :unprocessable_entity }
    end
  end
end

And in your create.js.erb file
$("#show_list").html('<%=j render partial: "to_do_lists/show", locals: { todo_lists: @todo_lists } %>'); //You don't have an element with id = todos. You have it with show_lists so change that

Also render your partial after closing your form. It doesn't make sense to show todos inside a form

A:
I want that when the submit button is clicked, the partial list is
  updated with the new newly created task, while also keeping the others
  that were created before.

This would indeed be achieved with ajax
--
Ajax
Ajax (Asynchronous Javascript And XML) is basically a way to send pseudo-requests to your backend from JS.
Since you're new to Rails, let me explain the idea of it being stateless. Stateless applications (which constitutes most built using the HTTP protocol) treat each request as "new" - not storing any personalized details for use each time
This means that if you want to send a request to Rails without reloading your page, you'll need to both send and receive data, appending it to your already loaded page. This is what Ajax does.
--
Rails
What you're asking is relatively simple
You need to do the following:

*

*Send your form data to Rails using ajax

*On the Rails backend, capture the event, perform functionality & respond

*On your front-end, "listen" to the response & append to the page

There are a number of ways to achieve this. For simplicity's sake, I'll detail the most direct way to achieve it (this uses the Rails UJS driver):
#app/views/todo_lists/new.html.erb
<%= form_for(@todo_list), remote: true do |f| %>

This will capture your form's submit action & send the update to the required URL. This means you'll be able to capture the request in your controller & then handle it in the backend:
#app/controllers/todo_lists_controller.rb
Class TodoListsController < ApplicationController
   def create
      @todo_list = TodoList.new(todo_params)
      @todo.save

      respond_to do |format|
         format.js #-> loads /views/todo_lists/create.js.erb
         format.html
      end
   end
end

This will allow you to call the following:
#app/views/todo_lists/create.js.erb
$("#todos").html('<%=j render partial: "todo_lists/your_partial", locals: { todo_lists: @todo_lists }" %>');

This will call your JS for the user - appending the request to your view; making it appear like no refresh was needed :)


text:
Q: How to get in-order sorted array from binary search tree? (in C++) In C++, how do we implement a method that returns an inorder sorted array from ?
node * inorder(node *n, int a[], int *index){
//Implement this function to sort the given array in the main function
    if(n == NULL){
        return NULL;
    }
    inorder(n->left, a, index);
    cout << n->data << " ";
    inorder(n->right, a, index);
}

This auto prints the tree,
but I need this function to sort the array (given in main function).

A: You should use the following code for sorting
    void store-sorted(Node *root, int arr[], int &i){
    if (root != NULL)
    {
        store-sorted(root->left, arr, i);
        arr[i++] = root->key;
        store-sorted(root->right, arr, i);
    }}
    void tree-sort(int arr[], int n){
    struct Node *root = NULL;
    root = insert(root, arr[0]);
    for (int i=1; i<n; i++)
        root = insert(root, arr[i]);
    int i = 0;
    store-sorted(root, arr, i);
}


text:
Q: Pressing Enter on a  submits the wrong  (2 forms on 1 page) I have got two different forms on the same page.
<form action="" method="post" onsubmit="ajax_send('<?print $userid;?>',this.msg.value); return false;">
<input id="msg" autocomplete="off" type="text" name="msg" stlye="width: 80px;" autofocus="autofocus" placeholder="Chat here" />
<input type="submit" />
</form>

and
<form action="?page=about&id=0#comments" method="post">
<textarea class="editbox" id="exitbox" placeholder="Write a comment ..." name="newcomment"></textarea>
<input type="submit" id="submit1" name="submit1">

Now when I enter something in <input id="msg"..> and press enter, it submits the second form instead of the first one.
What am I missing?

A: Your second form isn't closed.

A: Your second form should by like that
<form action="?page=about&id=0#comments" method="post">
<textarea class="editbox" id="exitbox" placeholder="Write a comment ..." name="newcomment"></textarea>
<input type="submit" id="submit1" name="submit1">

</form>


text:
Q: tempt to perform arithmetic on a vector3 value fivem In F8 console I get error : attempt to perform arithmetic on a vector3 value.
And any marker and menu can pop. This error create some beug and the script doesn't work :(
local coords      = GetEntityCoords(PlayerPedId())
local isInMarker  = false
local currentZone = nil
for k,v in pairs(Config.Zones) do
            if(#(coords - v.Pos) < v.Size.x) then
                isInMarker  = true
                currentZone = k
            end
        end```

A: If this is one of the zones you're iterating over:

DMVSchool = {         Pos   = {x = 239.471, y = -1380.960, z = 32.741},
Size  = {x = 1.5, y = 1.5, z = 1.0},        Color = {r = 204, g = 204, b
= 0},         Type  = 1   }

v.Pos is a standard Lua table value, not a vector3.
You cannot do arrithmetics between a vector3 and a table.
You probably need to initialize field 'Pos' as Pos   = vector3(239.471,-1380.960,32.741).
See https://docs.fivem.net/docs/scripting-reference/runtimes/lua/functions/vector3/


text:
Q: Why is the Digital 0 not 0V in computer systems? I'm taking a computer system design course and my professor told us that in digital systems, the conventional voltages used to denote a digital 0 and a digital 1 have changed over the years.
Apparently, back in the 80s, 5 V was used as a 'high' and 1 V was used to denote a 'low'.
Nowadays, a 'high' is 0.75 V and a 'low' is around 0.23 V.
He added that in the near future, we may shift to a system where 0.4 V denotes a high, and 0.05 V, a low.
He argued that these values are getting smaller so that we can reduce our power consumption. If that's the case, why do we take the trouble to set the 'low' to any positive voltage at all? Why don't we just set it to the true 0 V (neutral from the power lines, I guess) voltage?

A: You are getting confused. Look at TTL for example: -

A low input level is between 0 volts and some small value above 0 volts (0.8 volts for the case of TTL).

why do we take the trouble to set the 'low' to any positive voltage at
  all?

We take the trouble to ensure it is below a certain small value.
Picture from here.

A: Additionally to the points that is made by the other answers, there is the issue of parasitic capacities at high switching speeds (the usually ignored capacitance of wires and other components). Wires usually also have a slight resistance. (A very simplified model!)

simulate this circuit – Schematic created using CircuitLab
Being an RC network, this results in an exponential falloff curve ( V ~ e^-kt ). If the receiver sets it threshold very low (near 0V) then it would have to wait a significant time for the output voltage drop enough to trigger the threshold. This time might seem insignificant, but for a device supposed to switch a million (billion even) times a second, this is a problem. A solution is to increase the "OFF" voltage, to avoid the long tail of the exponential function.

A: Because nothing is perfect and you need to provide for this with a margin of error. Those numbers are thresholds. If the lowest possible voltage in your system is 0V and your threshold is 0V, where does that leave you if ALL your components and wiring aren't perfect conductors (i.e. always have some voltage drop) and noiseless in a noiseless environment? It leaves you with a system that can never output 0V reliably, if it can even do it at all.

A: You are confusing the "ideal" value with the valid input range.
In usual logic, in ideal conditions, the logical zero would be precisely 0V. However, nothing is perfect in real world, and an electronic output has a certain tolerance. The real output voltage depends on the quality of wires, EMI noise, current it needs to supply etc. To accommodate these imperfections, the logic inputs treat a whole range of voltage as 0 (or 1). See the picture in Andy's answer.
What your lecturer probably meant by 0.75V is one of the points making the logical 0 range.
Note there is also an empty range between 0 and 1. If the input voltage falls here, the input circuit cannot guarantee proper operation, so this area is said to be forbidden.

A: In a 2 rail system (usually chips powered with just a single positive voltage plus ground), whatever switch or device is pulling the output capacitance down to a low signal level has finite resistance, and thus can't switch a signal wire to zero Volts in finite time.  (Ignoring superconductors). So some realistic lesser voltage swing is chosen which meets performance requirements (switching speed vs. power requirements and noise generation, etc.)
This is in addition to margins needed to cover ground noise (different ground or "zero" voltage levels between the source and destination circuits), other noise sources, tolerances, and etc.

A: It is impossible to produce true zero volts logic signalling. There must be some tolerance allowed for, as the circuitry is not infinitely perfect. Spending money trying to make it infinitely perfect would not be a good investment of design funds either. Digital circuitry has proliferated and advanced so fast because its uses huge numbers of copies of the very simple and tolerant circuits that are logic gates.
The binary states 1 and 0 are represented in digital logic circuits by logic high and logic low voltages respectively. The voltages representing logic high and logic low fall into pre-defined and pre-agreed ranges for the logic family in use.
The ability to work with voltages within these ranges is one of the primary advantages of digital logic circuitry - it's not a failing. Logic gate inputs can easily distinguish between logic high and logic low voltages. Logic gate outputs will produce valid logic high and low voltages. Small signal noise is removed as logic signals pass through gates. Each output is restoring the input signal to a good logic voltage.
With analogue circuits, it is between more difficult and practically impossible to distinguish noise from the signal of interest and to reject the noise entirely.

A: Contrary to some responses here I'm pretty sure that there has been such a thing as a pure 0V low in the past.  Relay logic!  I don't think we want to go back to that though!

A: The simplest answer is that all semiconductors used for digital logic outputs have some voltage drop across the two output electrodes, that there are practically always some stray currents, voltages and noise present on a line, in a circuit or at an input, and that waiting for an output or input to fall to absolute 0.00V makes a logic circuit slower.
Those issues have been steadily reduced as components and circuits got improved over the years, which has allowed decreasing the logic voltage levels and ranges while increasing speeds and decreasing power requirements, but they can't be completely eliminated, and thus some headroom needs to be allowed to counter them.
In an ideal world, a logic zero would be 0 volts, but an ideal and a practical/real world are not the same thing.
For BIPOLAR transistors like the NPN type used in the common emitter configuration, the voltage across the collector-emitter practically never reaches zero, and can be anywhere from 0.1V to 0.7V, possibly going higher in high speed and high current circuits.
With MOSFET transistors, the output voltage comes much closer to 0.0V but it still depends on:

*

*the MOSFET channel ON resistance (RDS(ON)), which in very small MOSFETS used in high-density ICs is higher than in high power discrete MOSFETS (which, in turn, are also slower)

*the current through the drain-source channel

*the speed of switching the MOSFET on and off

Since the higher speed circuits involve quickly changing the states of the individual elements of a digital circuit and charging and discharging parasitic capacitances, the very fast discharge of such a capacitance generates a high-current pulse which generates a higher voltage drop across a conducting element or a switch.
There is also some noise or voltage drops in the circuits or on the signal lines, which is never at an absolute zero volts, so allowing some level above 0.00V to be interpreted as 0 is necessary to make sure the digital logic circuit doesn't remain stuck at a logic 1 because the input never saw an absolute zero (of 0.00V).
Finally, an important thing that either you don't remember or your teacher didn't mention as a reason why we're going for even lower voltage levels range is that it also allows FASTER switching between the states (between 0 and 1), besides the lower power consumption.
Going from 0.2V to 2V will take longer than going from 0.2V to 1V, while also using more energy.
Even IF we can achieve 0.00V at a logic zero level AND properly interpret it, it will take a little longer than waiting for some level above 0.00V (like the 0.05V your teacher mentioned) which includes a "settling time" (the time required for the output to reach and steady within a given tolerance band), which will defeat the goal of increasing the logic circuit speeds.
As my practical advice, I recommend you try using a high resolution digital voltmeter (more than 4 digits) and you will see the further you go from the decimal point to the right, the more unsteady those digits become, and you can even measure a small voltage in a short-circuit, due to galvanic junction, stray induced currents or voltages and the inherent noise in the input of the voltmeter or any instrument for that matter.
Also, the neutral or zero in power lines is almost never 0.00V, due to circuit currents travelling through it, stray voltages and currents induced in it, or any other factors. Try sticking a piece of metal into the ground and measuring the AC voltage between the ground and the neutral wire, and you will see that it is not really at a zero compared to ground.
That will help you understand why an absolute zero is a very rare occurrence in practice.

A: From a Process Control Instrumentation angle, this BIAS above Zero, is to provide additional info about the integrity of the instrument.  If an instrument was calibrated 1V-5V = 0-400 gallons per minute (gpm), then, if 1V was measured by the instrument, you'd know that there was 0 gpm.  All would be normal.
However, if 0V were measured, then that would be some kind of alarm condition that the instrument has failed or shorted.  A properly programmed control system would throw its respective control loop into manual to prevent slamming the valve either closed or open.
In other words, this BIAS from Zero allows the control system an additional, indirect method to know the health of the measuring instrument (i.e., circuit hasn't Grounded or Failed).  If you didn't do this then you might not know if 0V were normal or an alarm condition.
Of course, in the old days, we didn't have all the smart instrumentation that communicates much more diagnostic info. :-)
Update:  @Transistor has provided some additional insight, which is much appreciated.  For what it's worth, I did realize that there was a digital vs analog conflict in my response (mainly due to the highly technical comments/answers).  What I was trying to do was make an 'analogy argument', similar to water pressure vs voltage, to impart a possible reason to not 'just use 0V' as a basis.  However, I still may have missed the point.  @Transistor, I don't have enough Reputation to Comment, so my question back to you: Should I delete my response?  I certainly don't want to mislead. Thanks.


text:
Q: Grails Spring Security UI MySQL all users disabled? I am using Grails 2.1.1 with Spring Security 1.2.7.1 and Spring Security UI 0.2.
When I create some test users in BootStrap.groovy using an in memory database I am able to log in and manage users--everything works fine. However, when I switch my data source to a MySQL database, the service states that the user account is disabled when I try to log in. I have checked and the password appears to be hashing correctly (i.e., it matches what's in the database). The only modification I made to a user is to include a Study ID. In attempting to debug the code I've found that org.codehaus.groovy.grails.plugins.springsecurity.GrailsUser indicates enabled=false.
Any help is greatly appreciated!
My DataSource:
    dataSource {
        driverClassName = "com.mysql.jdbc.Driver"
        dialect = org.hibernate.dialect.MySQL5InnoDBDialect
        url = "jdbc:mysql://localhost/users"
        username = "root"
        password = ""
        dbCreate = "create-drop"
    }

My BootStrap.groovy code:
    def adminRole = new Role(authority: 'ROLE_ADMIN').save(flush: true)
    def userRole = new Role(authority: 'ROLE_USER').save(flush: true)

    def testAdmin = new User(username: 'me', enabled: true, password: 'password', studyID: '0')
    testAdmin.save(flush: true)
    UserRole.create testAdmin, adminRole, true

    def testUser = new User(username: '100', enabled: true, password: 'test', studyID: '101')
    testUser.save(flush: true)
    UserRole.create testUser, userRole, true

    assert User.count() == 2
    assert Role.count() == 2
    assert UserRole.count() == 2

A row from my User.user table after starting the application. No matter how I change these values, login attempts state that the user is disabled:
id  version account_expired account_locked  enabled password    password_expired    studyid username
        1   0   1   1   1   5e884898da28047151d0e56f8dc6292773603d0d6aabbdd62a...   1   0   me

A: If making changes directly into the DB also gives the error and it works with the 'in memory DB', I think that MySQL might be the problem.
It can be that MySQL is storing the values using a type that Hibernate cannot use correctly as a boolean
You can test that by retrieving a user from the DB and manually check:
if( ! user.enabled ) println "not enabled"  // or something like that

The last 3 posts on this mail list give a solution to correctly map a boolean in MySQL:
You can use a custom dialect to change BIT(1) to boolean:
   import org.hibernate.dialect.MySQL5InnoDBDialect
   import java.sql.Types

   class MyCustomMySQL5InnoDBDialect extends MySQL5InnoDBDialect {
      MyCustomMySQL5InnoDBDialect() {
         registerColumnType(Types.BIT, 'boolean')
      }
   }

And use it specify the class in DataSource.groovy:
   dataSource {
      pooled = true
      driverClassName = 'com.mysql.jdbc.Driver'
      username = ...
      password = ...
      dialect = com.foo.bar.MyCustomMySQL5InnoDBDialect
   }


text:
Q: NSLocalizedString does not recognize Localizable.strings strings I'm trying to use the swift string localization system, but apparently it does not recognize the strings, for example instead of appearing the string inicio appears txtinicio, I'm trying to access the strings like this:
NSLocalizedString("txtinicio", comment: "")

My settings look like this:

My strings file is with the strings like this:
"txtinicio" = "Início";

String file configuration looks like this:
image2

image3

image 4

A: I was able to solve the problem definitively, what was happening and that in the framework that I was using it used localizable, and used the default file Localizable.strings, in my project the file of strings also had that name, the solution was to change the name of the strings file in my project, it worked


text:
Q: Identify self defined and declared functions I'm working with c++ in a classroom work and we were asked to identify in llvm code which functions were defined by the user and which ones only have name, arguments and data types available. These must be identify by a c++ code, and I couldn'f find any function in c++ which could help me to distinguish between this two type of functions.
Thank you.


text:
Q: Brightcove video player with custom carousel slides Sample Design -i want to create the video carousel with prev and next arrow slides along with vertical carousel thumbnail slides, I can able to create the video with thumbnail, but couldn't find the option for prev and next arrow. Please help me out.Sample code here.
Thanks in advance,

.template-container{
    width: 100%;
    height: 100%;
    display: block;
    position: relative;
    margin: 0;
    /*background-color: #1a1a1a;*/
    overflow-y: hidden;
}
.video-js {
    height: 430px;
    width: 710px;
    float: left;
    margin-right: 50px;
}
.myplayer {
    width: 70%;
    position: relative;
}
.playlist-wrapper {
    width: 31%;
    height: 100%;
    overflow-x: scroll;
}

.vjs-playlist .vjs-playlist-item {
    min-height: 130px;
    border-bottom: 1px solid #ccc;
    margin-bottom: 5px;
}
.vjs-playlist-item.vjs-selected {
    background: rgb(89, 44, 54);
}
.vjs-mouse.vjs-playlist .vjs-playlist-description {
    white-space: normal;
    min-height: 99px;
}
.vjs-mouse.vjs-playlist .vjs-playlist-thumbnail {
    height: 68px;
    font-size: 13px;
    margin-right: 17px;
    width: 121px;
}
.vjs-mouse.vjs-playlist {
    color: #000000; /* darker blue */
    background-color: #fff; /* gray */
}
.vjs-mouse.vjs-playlist .vjs-playlist-description {
      color: #466675; /* darker blue */
}
li.vjs-playlist-item {
      background-color: #ffffff; /* lighter blue */
}
li.vjs-playlist-item.vjs-selected {
    background-color: #FAC8BF; /* pink */
}
/*PLuggin Customiozed code*/
.vjs-playlist{
    font-family:"CernLight", Helvetica, Arial,Serif;
}
.vjs-playlist .vjs-selected, .vjs-playlist.vjs-mouse .vjs-selected {
    background-color: #e5e5e5;
}
.vjs-mouse.vjs-playlist .vjs-playlist-title-container{
    text-shadow: none;
}
.vjs-mouse.vjs-playlist .vjs-selected .vjs-playlist-thumbnail img {
    opacity: 1;
}
.vjs-playlist img, .vjs-mouse.vjs-playlist .vjs-selected .vjs-playlist-thumbnail img {
    margin-left: 12px;
    margin-top: 40px;
}
.vjs-playlist img {
    min-height: 77px;
}
.vjs-playlist-title-container{
    top: 0px;
}
.vjs-playlist .vjs-playlist-name{
    font-size: 18px;
}
.vjs-playlist-duration, .vjs-mouse.vjs-playlist .vjs-up-next .vjs-up-next-text{
    display: none;
}
.vjs-mouse.vjs-playlist .vjs-playlist-thumbnail .vjs-playlist-now-playing-text{
    top: 40px;
    left: 12px
}
<!DOCTYPE html>

 <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="">
    <meta name="author" content="">

    <title>Video Carousel</title>

    <link rel="stylesheet" href="css/bootstrap.min.css" type="text/css">
    <link rel="stylesheet" href="css/bootstrap.css" type="text/css">

    <link rel="stylesheet" type="text/css" href="css/videojs-bc-playlist-ui.css">
    <link rel="stylesheet" href="css/hi-videocarousel.css" type="text/css">

Video

                             <video id="myPlayerID"
                                data-playlist-id="5455901760001"
                                data-account="1507807800001"
                                data-player="SyMOsyA-W"
                                data-embed="default"
                                data-application-id
                                class="video-js"
                                controls></video>

Other Videos

Prabhu Shanmugamenter code here


text:
Q: Finding the velocity with parametric equations for the position of an object Suppose that an object in motion has the parametric equations $x(t)$ and $y(t)$.
Show that the speed of the object can be expressed as $$v(t) = \sqrt{\left(\frac{dx}{dt}\right)^2 + \left(\frac {dy}{dt} \right)^2} $$

A: If the object position is described by $p(t) = (x(t),y(t))$, then the object velocity is given by $\frac{d p(t)}{d t}  = (\frac{d x(t)}{d t} , \frac{d y(t)}{d t} )$, and hence the speed (not velocity!) is given by $\| \frac{d p(t)}{d t} \| = \sqrt{(\frac{d x(t)}{d t})^2 + (\frac{d y(t)}{d t})^2}$.


text:
Q: Bootstrap 4 - using  instead of tabs (
*) Is it possible to change look of bootstrap tabs to have dropdown select instead of standard tabs made with
 and

I have relatively small area (like col-3) where I need to display tabs with lot of tabs (like 7-10 tabs), but it looks ugly on small screens as it span to 3-4rows.
I would like to use select dropdown (maybe some jquery addons for slecet) where I would always use that dropdown to select tab.
It needs to be <select> as I want to show all the time selected tab (standard bootstrap dropdown, dont do it, it just offers options but not showing what is selected).

A: You might want to hide
 and
 and just trigger them by <select>
Here's an example:

Menu 1

Menu 2

Menu 3

<select onchange="selectTab(this.value)">
  <option value="1">Menu 1</option>
  <option value="2">Menu 2</option>
  <option value="3">Menu 3</option>
</select>

And example JavaScript:
    function selectTab(e){
      switch(e){
        case 1:
            $('#a1').click();
        break;
        case 2:
            $('#a2').click();
        break;
        case 3:
            $('#a3').click();
        break;
        default:

      }
    }

here's the jsfiddle


text:
Q: Scala: Take List[People] and Convert it to a Map[String, List[People]] I'm very new to Scala and am trying to figure out how to work with Collections. If I have a List[People], all of whom have names, is there a way to turn this into a Map[Person.getName, List[People]].
I tried
list map (t => t.getName() -> t) toMap,

but that only returns a Map[Name, People]. How do I do this?
Thanks in advance.

A: groupBy will take a List[People] and transfrom it to a Map[String, List[People]] based on the "discriminator function" you provide which in this case is to select the name from Person.
scala> case class Person(name: String, age:Int)
defined class Person

scala> val people = List(Person("Alice", 42), Person("Bob", 42))
people: List[Person] = List(Person(Alice,42), Person(Bob,42))

scala> people.groupBy(p => p.name)
res0: scala.collection.immutable.Map[String,List[Person]] = Map(Bob -> List(Person(Bob,42)), Alice -> List(Person(Alice,42)))

A: If you want to do it yourself and learn how it works, you can try this:
scala> case class Person(name: String, surname: String, age:Int)
defined class Person

scala> val people = List(Person("Alice", "Wonderland", 42), Person("Bob", "Father", 42), Person("Bob", "Son", 20))
people: List[Person] = List(Person(Alice,Wonderland,42), Person(Bob,Father,42), Person(Bob,Son,20))

scala> val names = people.map(_.name).distinct
names: List[String] = List(Alice, Bob)

scala> names.map(n => n -> people.filter(_.name == n)).toMap
res0: scala.collection.immutable.Map[String,List[Person]] = Map(Alice -> List(Person(Alice,Wonderland,42)), Bob -> List(Person(Bob,Father,42), Person(Bob,Son,20)))

Cheers


text:
Q: Animating slider handle when altering the jQuery UI slider value option? I'm using the jQuery UI (1.8) slider widget to enable the user to slide/scroll a series of icons horizontally. Sometimes I want to move the slider programatically and the correct way to do that is by altering the option "value", like this:
$("#content-slider").slider("option", "value", 37);

The motion of the slider handle is instant though. I'd like the motion to be animated. This can be done on a lower level, by animating the "left" CSS property of the handle, like this:
$(".ui-slider-handle").animate({ left: position, easing: 'swing' }, 450);

...but if I do this, I just set the left property of the CSS for the handle. The actual value of the slider is not affected. So I thought of adding a callback at the end of the animation where the value is set, something like this:
$(".ui-slider-handle").animate({ left: position, easing: 'swing' }, 450, function() {
    // Callback - set the new slider value
    $("#content-slider").slider("option", "value", position);
});

When I try the code above (with the callback) I get a jQuery error about too much recursion, so I think that this is not a good way to accomplish what I want (ugly code).
Is there a better way to animate the slider handle when the value of the slider is altered programatically?
Thanks in advance!
/Thomas Kahn

A: In case you are trying to do this with a range slider:
var slider = $("#slider").slider({
    animate: true,
    range : true,
    values: [10,40]
});

$('#move').click(function(){
    slider.slider('values', [0,60]);
    return false;
});

*

*forked fiddle

A: You simply enable the animate option on the slider to accomplish this. From the documentation:

Whether to slide handle smoothly when user click outside handle on the bar. Will also accept a string representing one of the three predefined speeds ("slow", "normal", or "fast") or the number of milliseconds to run the animation (e.g. 1000).

Therefore your code will look something like this:
$("#content-slider").slider({
    animate: true
});

Here's a live demo of this: http://www.jsfiddle.net/VVHGx/

I think I know what you're doing wrong - you need to change the value of the slider via the .slider('value') method instead of the .slider('option', 'value)` method:
$('#content-slider').slider('value', 42);


text:
Q: Solving a floored input linear recurrence relation Need help solving:
$$T(n) = T(n-1) + \binom{n-1}{\lfloor\frac{n-1}{2}\rfloor + 1}$$
for $n \geq 3$ and $T(1) = 1$, $T(2) = 2$
I believe the answer is $T(n) = \binom{n}{\lfloor\frac{n}{2}\rfloor}$, but do not know how to show this algebraically.

A: We unroll the recursion to get
$$T(n) = 1+ \sum_{k=0}^{n-1} {k\choose \lfloor k/2\rfloor + 1}.$$
Induction is the  method of choice here.  The claim  $T(n) = {n\choose
\lfloor n/2\rfloor}$ holds for $n=1$ by inspection. Supposing it holds
for $n-1$ we get for $T(n):$
$${n-1\choose \lfloor (n-1)/2\rfloor}
+ {n-1\choose \lfloor (n-1)/2\rfloor + 1}
= {n \choose \lfloor (n-1)/2\rfloor + 1}.$$
Now when $n=2q$ this is
$${2q\choose q-1+1} = {2q\choose q} =
{n\choose \lfloor n/2 \rfloor}.$$
On the other hand when $n=2q+1$ it becomes
$${2q+1\choose q+1} = {2q+1\choose q} =
{n\choose \lfloor n/2 \rfloor}.$$
This concludes the proof by  induction. We present an additional proof
using formal power series, by way of enrichment.
Starting from the closed form we have
$$1 + \sum_{k=0}^{\lfloor (n-1)/2\rfloor} {2k\choose k + 1}
+ \sum_{k=0}^{\lfloor n/2\rfloor-1} {2k+1\choose k + 1}.$$
Evaluating the first sum we obtain
$$\sum_{k=0}^m {2k\choose k + 1} = \sum_{k=1}^m {2k\choose k - 1}
= \sum_{k=0}^{m-1} {2m -2k \choose m-k - 1}
= \sum_{k=0}^{m-1} [z^{m-1-k}] (1+z)^{2m-2k}
\\ = [z^{m-1}] (1+z)^{2m} \sum_{k=0}^{m-1} z^k (1+z)^{-2k}
= [z^{m-1}] (1+z)^{2m} \sum_{k\ge 0} z^k (1+z)^{-2k}
\\ = [z^{m-1}] (1+z)^{2m} \frac{1}{1-z/(1+z)^2}
\\ = [z^{m-1}] (1+z)^{2m+2} \frac{1}{1+z+z^2}.$$
By a very similar calculation we find
$$\sum_{k=0}^m {2k+1\choose k + 1}
= \sum_{k=0}^m {2m -2k +1 \choose m-k + 1}
= \sum_{k=0}^m [z^{m+1-k}] (1+z)^{2m-2k+1}
\\ = [z^{m+1}] (1+z)^{2m+1} \sum_{k=0}^m z^k (1+z)^{-2k}
 = -1 + [z^{m+1}] (1+z)^{2m+1} \sum_{k=0}^{m+1} z^k (1+z)^{-2k}
\\ = -1 + [z^{m+1}] (1+z)^{2m+1} \sum_{k\ge 0} z^k (1+z)^{-2k}
\\  = -1 + [z^{m+1}] (1+z)^{2m+1} \frac{1}{1-z/(1+z)^2}
\\ = -1 + [z^{m+1}] (1+z)^{2m+3} \frac{1}{1+z+z^2}.$$
Collecting the  three pieces from  the closed  form of $T(n)$  we have
cancelation of the minus one term. There are two cases. When $n=2q$ we
get for the upper limits $q-1$ and $q-1$ for a contribution of
$$[z^{q-2}] (1+z)^{2q} \frac{1}{1+z+z^2}
+ [z^q] (1+z)^{2q+1} \frac{1}{1+z+z^2}
\\ = [z^q] (1+z)^{2q} \frac{z^2}{1+z+z^2}
+ [z^q] (1+z)^{2q} \frac{1+z}{1+z+z^2}
\\ = [z^q] (1+z)^{2q} = {2q\choose q}.$$
This is the desired value. When $n=2q+1$ the upper limits become $q$ and
$q-1$ and we obtain
$$[z^{q-1}] (1+z)^{2q+2} \frac{1}{1+z+z^2}
+ [z^q] (1+z)^{2q+1} \frac{1}{1+z+z^2}
\\ = [z^q] (1+z)^{2q+1} \frac{z+z^2}{1+z+z^2}
+ [z^q] (1+z)^{2q+1} \frac{1}{1+z+z^2}
\\ = [z^q] (1+z)^{2q+1} = {2q+1\choose q}.$$
We have shown the closed form
$$\bbox[5px,border:2px solid #00A000]{
{n\choose \lfloor n/2 \rfloor}.}$$
This  may  illustrate  certain  aspects of  the  formal  power  series
technique.


text:
Q: Opengl в Visual C++: ссылка на неразрешенный внешний символ #include<glglut.h>

void Draw()
{
}

void Initialize()
{
}

int main(int argc, char **argv)
{
    glutInit(&argc, argv);
    glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
    glutInitWindowSize(400, 400);
    glutInitWindowPosition(100, 200);
    glutCreateWindow("gg");
    glutDisplayFunc(Draw);
    Initialize();
    glutMainLoop();
    return 0;
}

Выдаются ошибки

1>ррпо.obj : error LNK2019: ссылка на неразрешенный внешний символ __imp____glutInitWithExit@12 в функции _glutInit_ATEXIT_HACK@8
1>ррпо.obj : error LNK2019: ссылка на неразрешенный внешний символ __imp____glutCreateWindowWithExit@8 в функции _glutCreateWindow_ATEXIT_HACK@4
error LNK1120: 2 неразрешенных внешних элемента

Все библиотеки для работы с OpenGL подключены.
A: Нужно добавить.
#include <windows.h>
#include <gl\gl.h>

Русифицированные сообщения об ошибках это абсолютное зло, их переводили люди которые не знают как работает компилятор. Unresolved external symbol гуглите.
Можно еще так попробовать:
#pragma comment (lib, "opengl32.lib")
#pragma comment (lib, "glu32.lib")
#pragma comment(lib,"glut32.lib")


text:
Q: Creating a Wordpress Template From Scratch - Sidebar Placement I'm creating a Wordpress template from scratch and I am already in the process of adding sidebars. But I'm having a few problems with the sidebar positioning/placements.
What I want vs What I have
I'm not sure if I'm doing something wrong with the sidebar.php or with the container blocks.
But here's my css code:
/* Sidebar modules for boxing content */
.sdbrcont {
float: left;
background-color: black;
}

My sidebar.php code:

<?php if ( is_active_sidebar( 'left_sdbr' ) ) : ?>

    <?php dynamic_sidebar( 'left_sdbr' ); ?>

<?php endif; ?>

and if the problem is on my index.php, here's the code:

<?php get_sidebar( 'left-sdbr' ); ?>

PAKU SQUAD

        BLOG

        <?php
        if ( have_posts() ) : while ( have_posts() ) : the_post();

            get_template_part( 'content', get_post_format() );

        endwhile;?>

 <?php next_posts_link( 'Older Posts >>>' ); ?>

 <?php previous_posts_link( '<<< Newer Posts' ); ?>

        <?php
        endif;
        ?>

This is my firt time creating a wordpress template and I would really appreciate all the help I can get. Thank you in advance.

A: You need to pay attention to Layout grid system in bootstrap: http://getbootstrap.com/docs/4.0/layout/overview/

Because you need to determine the width of the container, else will be all the body.

      Sidebar

      Content


text:
Q: I could not download specific page via perl get, bash command GET and wget I have an issue with downloading a page,
my $url='http://www.ncbi.nlm.nih.gov/nuccore?linkname=pcassay_nucleotide&from_aid=504934,1806,1805,1674';

I can browse following with a browser but when I run bash command in perl or linux shell,
GET $url >OUTPUT1;  # Even it does not write anything to file "OUPUT1"

When I try wget, It downloads but not correct ,I mean with --> <title>Error - Nucleotide - NCBI</title>. I want the page with items , but it returns me a page without items.
my $html = qx{wget --quiet --output-document=OUTPUT1 $url};

**Note: I noticed a few minutes ago, url is ok with Mozilla firefox, but it can not be browsed via google chrome. it is weird, probably my issue related with this too. Any idea?
Code from link:
my $url='http://www.ncbi.nlm.nih.gov/nuccore?linkname=pcassay_nucleotide&from_aid=504934,1806,1805,1674';

my $html = qx{wget --quiet --output-document=OUTPUT11 $url};

# wget get something, but it does not get items, it gets what I get via google chrome

`GET $url2 >OUTPUT11`; # it does not write anything to file,

A: OK, given your code - the problem is almost certainly one of interpolation. Because the & in your URL is going to be interpreted by the shell you're spawning as 'background this process'.
That's almost certainly not what you want. Why not just use LWP natively?
#!/usr/bin/perl
use strict;
use warnings;
use LWP::Simple;

my $url='http://www.ncbi.nlm.nih.gov/nuccore?linkname=pcassay_nucleotide&from_aid=504934,1806,1805,1674';

my $content = get $url;

print $content;

open ( my $output_fh, '>', 'output.html' ) or die $!;
print {$output_fh} $content;
close ( $output_fh );