Home Repair of Refrigerator Waterline

Question: I have an 10 year old LG refrigerator (model LRFD25850ST). The white polyethylene waterline running from the refrigerator water pump up the back of the refrigerator is leaking about half-way up. It feeds both the ice maker and in-door water dispenser, but it runs through the foam insulation first, so a complete replacement is not practical at this time.
I would like to see if I can repair or splice it.

That writing on the tube reads:

DMT PE TUBE 0.D5/16"XI.DO.216" 70F 170P= NSF-51 & NSF-61 04EH10 05-1

What is the best way to repair this waterline?
Comment: The writing on the tube says that the material is polyethylene (PE) with an outside diameter of 5/16" (O.D5/16), and an inside diameter of 0.216" (I.D0.216"). It is rated for up to 170PSI (170P=) at 70°F (70F). It meets the requirements for plastic used with food (NSF-51) as well as drinking water (NSF-61). I believe that DMT is the manufacture.
Comment: 5/16" OD compression coupling- any decent plumbing shop. 1/4" is the "standard" for the house supply, but this sounds like an OEM tube that is "part" of the refrigerator; ("... it runs through the foam insulation first..."), so not uncommon.
Comment: Possible duplicate: [How to install a new pvc line on a fridge to an existing small plastic line?](http://diy.stackexchange.com/questions/49846/how-to-install-a-new-pvc-line-on-a-fridge-to-an-existing-small-plastic-line). If yours is leaking in a non-accessible area somewhere inside the fridge then it's not one but this shows the parts you might need.
Comment: Is this tube part that came with the fridge or is it the water line that connects the fridge to your domestic water? I ask because the 5/16 seems like an odd size. Have you looked at this: http://www.appliancepartspros.com/lg-tube-pe-5210ja3004k-ap4445606.html
Answer: You need a plastic quick coupling.  Go to a professional plumbing supplier and buy a 5/16 x 5/16 Parker fitting. These are similar to Sharkbite fittings, but plastic and about half the size of the smallest Sharkbite. They come in 1/4, 5/16, 3/8 and 7/16.  A number of companies such as Celcon and John Guest make them, but Parker invented them so like Hoover for a vacuum, they are called 'Parkers'.
Simply cut your pipe right at the leak with a very sharp craft knife then fit each end into the straight fitting.
Comment: Beautiful. I bought a Watts "Quick-Connect coupling" for refrigerator, 5/16  OD, cut the existing line just above and below the crack, pushed the two ends into the coupler, and gave it a little tug to seat it. Voila; instant repair. Total time: 2 minutes.
Answer: A trip to the local hardware or home center should provide you with the tubing and fittings you need. If you shut off the valve you can cut out a section to bring with you. You'll need a couple of fittings to connect the new to the old. Bear in mind I would consider this a temporary repair. What ever caused the section to fail be it age or vibration likely effected all the tubing so total replacement is what I would recommend.
Comment: The tube label says that the outside dimension is 5/16 which seems like an odd size. Most hardware centres would carry 1/4 or 3/8 outside dimension fittings, not sure how available 5/16 fittings will be.
Comment: @pdd - The hard part might be finding 5/16" with the sleeve inserts you need for plastic so that it doesn't squish. 5/16" is usually metallic automotive brake line which doesn't need them.
Comment: @Mazura - Completely agree. I think this portion of tube is part of the fridge. I've asked this in the question comments as well as provided a link to what might be the replacement tube part.
Answer: The tube comes in through the fridge into the filter system pull the filter and one screw and the hole tube can be removed.
Answer: I know this is an older link but I've had the same situation with my lg refrigerator.  it is a line that comes from the solenoid up the back of the fridge into the filter you might as will just replace the whole thing is I have splice mine a few times and it is continually sprung a leak and other places.   I think it is ridiculous that LG put a line in the back of the refrigerator that is rated for 70°F .   It's not a hard fix

Home Repair of Refrigerator Waterline


jquery populate nested dynamic list

Question: I think this is easy, but I'm beating my head up against a wall.
I have a nested dynamic list like this:
Volume 1
    Chapter 1
    Chapter 2
    +Add chapter
+Add volume

if one clicks on +Add volume, it should copy the minimum structure (only one chapter with button to add more)
like this:
Volume 1
    Chapter 1
    Chapter 2
    +Add chapter
Volume 2
    Chapter 1
    +Add Chapter
+Add volume

is this hard to do in jquery?
right now I managed to do this only for a single level using a table.

    <input type="button" id="btn-add-row_mbp" value="+Add 1 Chapter">

the add chapter button is bound like this:
$( document ).ready(function() {
  $("#btn-add-row_mbp").click(function () {
    add_new_row_mbp();
  });
});
function add_new_row_mbp() {
  // When adding a row, bump the row count.
  $("#NumRows_mbp").val(++numrows_mbp);
  // And get a new rowid.
  newrowid_mbp++;
  var row_cnt_mbp = $('#mbp_ray_main_table tr').length + 1;

  var newrow_mbp='
'
    +'
'
    +'
Chapter'+newrowid_mbp
    +'
'
    +'
	'
     +'
';

  $("#mbp_ray_main_table").append(newrow_mbp);
}

Comment: Nope, it should be very easy to do this. Especially on jQuery. Show us a sample of what you've done (preferably a fiddle). And we'll see where we can help.
Comment: I've only succeeded in doing this for a single level. i.e. chapter (no volume). dont know where to start for a two level version.
Comment: Show us your code so that it'll be easier to help.
Comment: @rgin ok. here's what I have
Answer: $('button').on('click', function () {
    var cnt = $('#test > li').length + 1;
    $('#test').append('
Volume ' + cnt + '

Chapter1

+ chapter

');
});
$('#test').on('click', '.addChap', function () {
    var cnt = $(this).siblings().length + 1;
    $('
Chapter ' + cnt + '
').insertBefore(this);
});

DEMO
Comment: according to this setup, is there a function to easily delete a chapter or a volume by clicking?
Answer: just a brief demo, can help you if you post your question in fiddle with nice html formatted structure.
//Considering your first "+Add volume" id is addvolume_1
        $('#addvolume_1').on('click', function(){
    $(this).parent().after('

Volume 2

Chapter 1

+Add Chapter
');
    });

//When clicked on +Add Chapter
$('<some unique id>').on('click', function(){
...
});

jquery populate nested dynamic list


A/B Testing vs Cohort Analysis

Question: I had a few questions about A/B Testing vs Cohort Analysis (dividing users based on registration time).
1.) Is A/B testing mainly used for UX design changes (such as change in Sign Up button Color) or can be used to split test features (such as conversion rate on freemium vs free trial)
2.) What conclusions can I draw from results received from A/B Testing vs Cohort Analysis? Example: A/B Testing helps to tell us that this feature improves conversion in general irrespective of the user Vs Cohort Analysis tell us that conversion of users joining in month 2 is better than in month 1 gives us overall direction a site is going in (conversion rate may or may not be because of new feature implemented between month 1 and 2).
3.) Is it true that A/B testing can be used to test hypothesis faster and Cohort Analysis takes more time?
4.) Should we run A/B testing on a new feature to see if conversion rate has improved and then use Cohort Analysis to see long term effect of new feature? (if Cohort Analysis shows improvement in conversion month over month how strongly can we attribute it to the new feature implemented if no other changes are made to site)
Answer: The point of doing A/B testing rather than cohort is that it eliminates the conflating variable of time.  The data you gather is only valid if there aren't ulterior explanations for why two groups behave differently, and groups doing things at different times will often behave differently.
For example: if you're an e-commerce site and you compare user behaviors between people who registered in December vs. people who registered in January, you're going to get wildly different results due to the Christmas shopping season.  This would totally invalidate a cohort analysis, unless your goal is to observe how these two groups behave differently.
In short, A/B testing is for testing how two features are different.  Cohort analysis is for testing how two groups of users are different.

You can A/B test anything you want!  The only requirements are that the two sides (a) happen simultaneously and (b) are randomly assigned.
Again, A/B tells you how features differ in effectiveness and cohort analysis tells you how groups of users differ in behavior.
A/B is faster if your cohort analysis requires you to wait for new people to sign up.  But if you're just breaking existing users into blocks, it should take the same amount of time.
This is a reasonable approach, but remember that at the end of the day, the research method you apply needs to be based on the kind of information you're looking to gather.

A/B Testing vs Cohort Analysis


GDB breakpoint when executing external program through system()

Question: I have the function system() call a separate script that has already been compiled. But I'd like to be able to set a breakpoint in functions within THAT specific file.
So:
File A:
system("./fileB");

File B:
void main() {
 /* etc */
}

I'd like to be able to set a breakpoint at main after the system command is called.
Any help would be appreciated!
Answer: Newer versions of GDB (7.1+) can debug multiple programs at once and can indeed support this:
run-program.c
#include <stdlib.h>

int main()
{
    system("./program-i-want-to-debug");
    return 0;
}

program-i-want-to-debug.c
#include <stdio.h>

int main()
{
    printf("Hello, World\n");
    return 0;
}

run-program.gdb
set detach-on-fork off
set target-async on
set pagination off
set non-stop on

add-inferior -exec program-i-want-to-debug
break program-i-want-to-debug.c:5
file run-program
run

inferior 3
backtrace

Sample session
$ gdb -q -x run-program.gdb
Added inferior 2
Breakpoint 1 at 0x400441: file program-i-want-to-debug.c, line 5.
[New process 20297]
process 20297 is executing new program: /usr/bin/bash
process 20297 is executing new program: /home/scottt/Dropbox/stackoverflow/program-i-want-to-debug
Reading symbols from /home/scottt/Dropbox/stackoverflow/program-i-want-to-debug...done.

Breakpoint 1, main () at program-i-want-to-debug.c:5
5       printf("Hello, World\n");
[Switching to inferior 3 [process 20297] (/home/scottt/Dropbox/stackoverflow/program-i-want-to-debug)]
[Switching to thread 2 (process 20297)]
#0  main () at program-i-want-to-debug.c:5
5       printf("Hello, World\n");
#0  main () at program-i-want-to-debug.c:5

Obviously you'd want to compile the programs with debug info (gcc -g).
Answer: Maybe I do not catch your point. It seems that starting gdb debug on File A and setting a breakpoint on "FileB:line of main"  resolve your problem.


How to improve a for loop that will go through the values in my_dictionary as well as a list

Question: I am writing a for loop that will go through the values in  my_dictionary as well as the values in the list. If a word from the list "words" is in the my_dictionary then append the list of values where the word was found once. The code below ran the code but the list look larger than I expected.
my_dictionary = {1: ['apple','dog','cat','bird'],
                 2: ['mouse','rat','elephant','donkey'],
                 3: ['tiger','lion','bear','tortoise']}

words = ['apple', 'dog', 'mouse', 'bear','tortoise']

def cen_lst(my_dict, words):
    new_lst = []
    for key, value in my_dict.items():
        for word in words:
            if word in value:
                new_lst.append(value)
    return new_lst

output I expected:
['apple','dog','cat','bird', 'mouse','rat','elephant','donkey', 'tiger','lion','bear','tortoise' ]

Instead the output I am getting is:
[['apple', 'dog', 'cat', 'bird'],
 ['apple', 'dog', 'cat', 'bird'],
 ['mouse', 'rat', 'elephant', 'donkey'],
 ['tiger', 'lion', 'bear', 'tortoise'],
 ['tiger', 'lion', 'bear', 'tortoise']]

Answer: Every time it found a matching word it appends the entire list because of this line:
    new_lst.append(value)

The value for each iteration was the entire list at that key. That's why you got a list of lists. Simply replace value with word. This causes it to just append the matching word, not the list that the word is inside.
    new_list.append(word)

Answer: According to your description, you should use list.extend instead of list.append (you can refer to this for their differences), and do not extend every time the retrieval is successful:
>>> def cen_lst(my_dict, words):
...     new_lst = []
...     for value in my_dict.values():
...         if any(word in value for word in words):
...             new_lst.extend(value)
...     return new_lst
...
>>> cen_lst(my_dictionary, words)
['apple',
 'dog',
 'cat',
 'bird',
 'mouse',
 'rat',
 'elephant',
 'donkey',
 'tiger',
 'lion',
 'bear',
 'tortoise']


I found this pic of a game on an advertisement, does anyone know what it's called?

Question:
I was on the web just searching and I came across this character, and it reminded me of the endless fun I had with this game. I kept searching for the game with no success.
Does anyone know what it's called?
Answer: The game is called Sling, it is a Flash based game by the Edis Brothers,
A playable version can be found here:
http://www.miniclip.com/games/sling/en/
Comment: ezone made the best games back in the day


Weak convergence, $\displaystyle f\in L^p(\Bbb R^d) $ and $g\in L^q(\Bbb R^d) $ then, $\lim_{j\to\infty} \int_{\Bbb R^d}f_j(x)g(x)dx = 0$

Question: Assume $f\in L^p(\Bbb R^d) $ and  $g\in L^q(\Bbb R^d) $
Where, $1<p<\infty$ and $1<q<\infty$ are dual ecxponents namely, $$\frac1p+\frac1q =1$$
Then for every $s\in\Bbb R$ such that, $sp\le d$ show that,
$$\lim_{j\to\infty} \int_{\Bbb R^d}f_j(\mathbf{x})g(\mathbf{x})\mathrm{d}\mathbf{x} = 0$$
Where, $$f_j(\mathbf{x}) = j^sf(j\mathbf{x})~~~$$
My attempt,
I Applied Holder inequality, and use the change of variables $\mathbf{u} =j\mathbf{x}$ to get the following,
\begin{align}\left|\int_{\Bbb R^d}f_j(\mathbf{x})g(\mathbf{x})\mathrm{d}\mathbf{x}\right| &\le \left(\int_{\Bbb R^d}|f_j(\mathbf{x})|^p\mathrm{d}\mathbf{x}\right)^{1/p} \left(\int_{\Bbb R^d}|g(\mathbf{x})|^q\mathrm{d}\mathbf{x}\right)^{1/q}\\&=\frac{1}{j^{\frac dp-s}}\left(\int_{\Bbb R^d}|f(\mathbf{x})|^p\mathrm{d}\mathbf{x}\right)^{1/p} \left(\int_{\Bbb R^d}|g(\mathbf{x})|^q\mathrm{d}\mathbf{x}\right)^{1/q} \\&=\frac{1}{j^{\frac dp-s}}\|f\|_{p}\|f\|_{q}\end{align}
If I suppose that, $\color{blue}{d>sp}$ then $\frac{1}{j^{\frac dp-s}}\to 0$
and the result follows.

Question: How do I prove the case where $sp= d$?
Answer: Note it's not true for $p=1$. Assume $p>1$. Come to think of it, it's also false for $p=\infty$. Assume $p<\infty$.
Let $\epsilon>0$. Choose $A>0$ so that $$\left(\int_{|x|\le A}|g(x)|^q\right)^{1/q}<\epsilon.$$(This is where $q<\infty$ is needed.)
An explicit calculation shows that $$\left(\int_{|x|>A}|f_j(x)|^p\right)^{1/p}\to0.$$(This uses $p<\infty$.)
Edit: What's above will look like a solution to many readers. Others may be wondering how those two lines prove what's asserted. The (standard) argument goes like so: Assume $\epsilon$ and $A$ are as above. Choose $N$ so that $$\left(\int_{|x|>A}|f_j(x)|^p\right)^{1/p}<\epsilon\quad(j>N).$$
Noting that $||f_j||_p=||f||_p$ (since $sp=d$), for $j>N$ we have $$\left|\int f_jg\right|\le\left|\int_{|x\le A}f_jg\right|+\left|\int_{|x|>A}f_jg\right|\le||f||_p\epsilon+\epsilon||g||_q.$$
Comment: Sorry but I don't get the first inequality souldn't be $|x|>A$ as in the second case?
Comment: In fact your idea is $$\lim_{A\to \infty}\left(\int_{|x|> A}|g(x)|^q\right)^{1/q}=0$$
Comment: I have seen the edit. Also this is not true:$ ||f_j||_p=||f||_p$ , $f_j $ is not necessary  a mollifier
Comment: How do you obtain this: $$\lim_{A\to \infty}\left(\int_{|x|\le A}|g(x)|^q\right)^{1/q}=0$$
Comment: Sorry I don't how your convergence works out
Comment: @GuyFsone No. See the edit - that may clarify things.
Comment: The main point is to be able to prove that $$\left|\int_{|x|\le A}f_jg\right|\to 0$$ which I can find it out
Comment: I didn't say anything about mollifiers. The assumption that $sp=d$ shows that $||f_j||_p=||f||_p$. The fact that $\lim_{A\to0}\int_{|x|\le A}|g(x)|^p=0$ is clear from dominated convergence.
Comment: How the convergence works out: I've shown that for every $\epsilon>0$ there exists $N$ so that $|\int f_jg|N$. What more do you want?
Comment: It is clear now thtanks
Comment: alright it is ok now
Comment: One more utterly trivial detail that I left out: Why is $\lim_j\int_{|x|\ge A}|f_j|^p=0$? Since $sp=d$, it follows that $\int_{|x|\ge A}|f_j|^p=\int_{|x|\ge jA}|f|^p$, which tends to zero, again by dominated convergence.
Comment: @GuyFsone It's ok now? It was ok all along - I didn't make any changes. (Except for mentioning that $sp=d$, which _was_ already assumed in the _question_.)
Comment: Yes with your explanations I got it
Answer: This is just a reminiscent of the this:
How to prove that, $\lim\limits_{k \rightarrow \infty} \int_{\Bbb{R}} f_k(x) g(x) dm(x) = 0$.
If $sp =d$ then, Proceed as follows:
For,  $\varepsilon>0$ we know that there exist $g_\varepsilon\in C_c(\Bbb R)$ a continuous function of compact support such that,
$$ \|g-g_\varepsilon\|_q\le \varepsilon \|f\|_p^{-1} $$
and for this choice of $g_\varepsilon$ we can also find $f_\varepsilon\in C_c(\Bbb R)$  such that
$$ \|f-f_\varepsilon\|_p\le \varepsilon \|g_\varepsilon\|_q^{-1}$$
Proceeding like here with   Cauchy Schwartz inequality replaced by Holder inequality, with $d=sp$, one easily arrives at
$$\left|\int_\mathbb R f_j(x) g(x) dx\right| \le\left[\varepsilon+\varepsilon j^{s-d}+ j^{s-d}\left|\int_{\text{supp }f_\varepsilon}f_\varepsilon(x) g_\varepsilon(\frac{x}{j}) dm(x)\right| \right]\\
= \left[\varepsilon+\varepsilon j^{s(1-p)}+ j^{s(1-p)}\left|\int_{\text{supp }f_\varepsilon}f_\varepsilon(x) g_\varepsilon(\frac{x}{j}) dm(x)\right| \right]$$
Moreover, $f_\varepsilon, g_\varepsilon$ are continuous functions  with compact support, we get
$$\color{blue}{\lim_{j\to \infty}\int_{\text{supp }f_\varepsilon}f_\varepsilon(x) g_\varepsilon(\frac{x}{j}) dx=\int_{\text{supp }f_\varepsilon}f_\varepsilon(x) g_\varepsilon(0) dx}$$
Whence,
$$ \limsup_{j\to \infty} \left|\int_\mathbb R f_j(x) g(x) dx\right| \\
\le \limsup_{j\to \infty} \left[\varepsilon+\varepsilon j^{s(1-p)}+ j^{s(1-p)}\left|\int_{\text{supp }f_\varepsilon}f_\varepsilon(x) g_\varepsilon(\frac{x}{j}) dm(x)\right| \right]=\varepsilon $$
Thus, for all $\varepsilon>0,$ we have, $$ \limsup_{j\to \infty} \left|\int_\mathbb R f_j(x) g(x) dx\right| \le \varepsilon $$
letting  $\varepsilon\to 0$  yields the require result.
$$ \color{red}{\lim_{j\to \infty}  \int_\mathbb R f_j(x) g(x) dx =0.} $$
Comment: You say a certain limit is less than $\epsilon$ at a point where we don't yet know the limit _exists_. Cleaner to say $\limsup<\epsilon$ for every $\epsilon>0$, hence $\lim=0$. (This is why, it seems to me, "$\limsup$" and "$\liminf$" exist - we can talk about them before we know anything about the existence of the limit.)
Comment: ??? I don't see any downvotes. The problem I mention appears in a few places. For example, when you say $\lim_{j\to \infty} \left|\int_\mathbb R f_j(x) g(x) dx\right| \le \varepsilon$ we don't yet know that that limit exists.
Comment: I'm right "in a logic sense"? What other sense might be relevant? You can't talk about limits until you know they exist!
Comment: Say we know $\lim1/n=0$ and we want to use ST to show that $\lim1/(2n+1)=0$. A correct application of ST: "Since $0\le1/(2n+1)\le1/n$ and blah blah, $\lim1/(2n+1)=0$." Something reading "Since $0\le\lim1/(2n+1)\le\lim1/n$,..." is _not_ a correct application of ST.
Comment: @DavidC.Ullrich   Which limit is uncertain? please I don't see it? Is that why you down voted? But do have this $$\lim_{j\to \infty}\int_{\text{supp }f_\varepsilon}f_\varepsilon(x) g_\varepsilon(\frac{x}{j}) dx=\int_{\text{supp }f_\varepsilon}f_\varepsilon(x) g_\varepsilon(0) dx$$ right?
Comment: In a logic sense you are right. It because the righ side. you should be a very strong as corrector teacher :) thanks you are fully right
Comment: I am doing analysis. Any way wil you apply squeeze theorem? I think it is similar like here?
Comment: Of course it's the "squeeze theorem". That theorem doesn't allow you to talk about limits if you don't know they exist.
Comment: Why does someone down vote this post?


How to have the screen scroll when dragging items from a scrollable/sortable to another, outside the screen?

Question: I'm trying to achieve a Trello like functionality for dragging items from one list (phase) to another. When there are too many lists/phases, I'd like the screen to scroll automatically when dragging from the leftmost list to the right most one, which would probably be "off screen".
Currently, I have two levels of sortables which are both scrollable (see jsFiddle);
The first level scrolls horizontally and the second vertically. That is, I can move the lists around horizontally and each element in the list vertically only.
On the second level, I have:
$('.phase-block').sortable({
    scroll: true,
    connectWith: '.phase-block',
    appendTo: '.phase-scroll',
    helper: 'clone'
});

which puts the helper in the container and allows me to drag onto the list on the far right, but doesn't allow vertical scrolling within the list.
Is there a way to keep both kinds of scrollability without sacrificing one for the other?
Comment: you could detect helper leaving parent by using various properties of the arguments of the out and over methods it looks like.  so you end goal is to have horizontal scroll work and scroll within the item lists?
Comment: `appendTo:body` seems to do the trick
Comment: I've updated the question (and Fiddle) to make it easier to understand what I'm trying to achieve.
Comment: add `overflow-y: scroll` to body. it seems to work !
Comment: @OnlyMAJ - That doesn't fix anything. It allows the body to scroll vertically, but that's not what the OP wants.
Comment: @Zahymaka Have any feedback on my latest update?
Comment: What do you mean keep both kinds of scroll-ability? It works already. http://jsfiddle.net/421ovuz5/10/
Answer: Update
I modified the on scroll function so that it will behave more like a traditional scroll (before I had it so that any time your moved up or down it would attempt to scroll).  It was also primarily built to work with the given example and not with a broader range of box sizes etc..
Now I am attempting to only have it scroll up or down when the box you are dragging reaches the top or bottom of the scroll bar. The only tricky part is depending on the size of box you are dragging the offset of the box where you would want to start scrolling is different depending on size.
I am sure there is a way to figure out when the box you are dragging is more than halfway below or above the bottom/top of the scroll box and then scroll accordingly, but the solution is not something I have been able to come up with at this point.
Another thought that would make this easier, is if you knew all the possible sizes of the boxes that were going to be draggable via this scenario.  You could set up an object with a reference to all the box sizes linked to individual values which you could use to modify when the scroll starts for that particular size of box. If this is something viable for you I can show you how I would do it.
But Here is an updated example with your latest fiddle that has the different block heights.  I kind of worked with the code a little bit to make it so that no matter what size of block (of the ones you have specified) the scrolling will start around the same time.
$('.phase-block').sortable({
        scroll: true,
        connectWith: '.phase-block',
        appendTo: '.phase-scroll',
        helper: 'clone',
        sort: function(event, ui){
            if(ui.offset.top >= activePhaseBlock.height()+(90 -ui.item.height() > 0 ? 65-ui.item.height() : 10))
                activePhaseBlock.scrollTop(activePhaseBlock.scrollTop()+ui.item.height());
            else if(ui.offset.top <= 0+(ui.item.height() > 25 ? 20 : 40))
                activePhaseBlock.scrollTop(activePhaseBlock.scrollTop()-ui.item.height());
        },
        over: function(event, ui){
            activePhaseBlock = $(this);
        }
    });

If you are planning to have random heights of blocks then this method probably won't be the most viable and you'll have to find a universal way to determine when the offset is high enough or low enough to start scroll regardless of block size.
Let me know if you need any clarification.
Fiddle Example
Comment: @Zahymaka - He's comparing the position of the top of the scroll bar of the 'phase' you're currently hovering over, during the drag, with that of the element you're dragging. He's handling the scrolling manually, by setting the scrollTop (top of vertical scroll bar) for each phase and offsetting it accordingly i.e., if you're moving up/down. Here's the updated fiddle with the comments and break up of the source code: http://jsfiddle.net/nupul/2dyLtkmb/4/
Comment: Unfortunately, it doesn't scroll horizontally on your Fiddle.
Comment: @Zahymaka Can you expound on that?  How are you expecting it to scroll horizontally?  What browser are you using?  I can grab a list container and move it to the right and have it scroll right while I'm dragging.  I'm using Chrome so maybe it works different in your browser?
Comment: I'm using Chrome as well. I can't drag an item into anything on the right.
Comment: @Zahymaka ahh I finally see what you mean, your talking about dragging an item to the far right containers.. Not dragging the containers to the right.
Comment: Thanks. This is an awesome solution. Could you explain what you're doing in the scrollTop() calculation? Changing the phase height or making the item heights variable seems to break the scroll.
Comment: @PhD, I understand that part. In your fiddle, for example, dragging an item to the bottom doesn't work due to the difference in height. A more extreme example with items of varying height: http://jsfiddle.net/2dyLtkmb/5/ doesn't either.


PHP variable used in SQL

Question: My code checks if there is $GET value, if not then assign ALL values of array.
Seems like simple thing,not sure why its not working.
if(isset($_GET["smonth"])) {$smonth= $_GET["smonth"];
}
else {$smonth =12;}  working , but not what I want
else {$smonth =array (1,2,3,4,5,6,7,8,9,10,11) ;}

After that I would like to use it in SQL :
and d.month_of_year = '".$smonth."%'

That would be something like
 and month_of_year = (all values of array) or 1 value)

My Question:
What would be best solution to check, if active month is available? If not, assign All months to query.Thank You
Comment: do you want to query by the current month of the year
Answer: The built-in PHP functions of in_array and implode should solve your issue:
in_array('1', $_GET["smonth"]); // checks if January is in $_GET["smonth"]
implode("," , $_GET["smonth"]); // Pull all of the values out of $_GET["smonth"] as a A STRING

Answer: Try in your statement and d.month_of_year IN (" . implode(',', $smonth) . ")
Comment: Yes, because implode concatenates an array. So if you have an single month, you have to store it also in an array.
Answer: = operator checks for single value. If you want to check multiple values, use in.
and d.month_of_year in (".$smonth.")

You also have a % there, which works with LIKE queries.
Answer: <?php

    if(isset($_GET['month'])){
    $month =  date('m');  //This would give you the index of the current month.

    $array = array('01','02','02');

    $query = "select * from table where month = ";
    if(in_array($month,$array)){
        $query = "select * from table where month = '".$month."'";

        //Then query here
    }
    else
    {
    $query = "select * from table";
        $where = "";
        foreach($month as $m){
            $where .= ' month = "'.$m.'" and ';
        }

        //There would be a ending and pls just try remove it

        $query .= $where;

        // then query here
        }

    }
?>

PHP variable used in SQL


Connecting lenskit 3.0 data access model to jdbc

Question: I am building a recommender engine for our ecommerce application. The easiest way is to deploy the recommender system to java web server and implement a REST API for it.
I am trying to get the data from the database directly, but I didn't find any documentation that can help me to connect lenskit 3.0 to JDBC.
Can anyone please explain how to connect the lenskit to database and how to customize Rating.class, User.class and Item.class so it can contain the user country and city, and show whether the item is in stock or not ?
Answer: In LensKit 3, the way to work with custom data is to directly use Entity objects.  Users, items, and ratings, are just entities; the User, Item, and Rating classes are view classes that provide convenience access to common attributes, but the base Entity interface allows you to use arbitrary attributes. The data model is documented at https://lenskit.gitbooks.io/lenskit-manual/basics/data-model.html; it is also possible to create your own view classes, but this is not currently documented.
To use JDBC, you will need to reimplement the DataAccessObject interface on top of JDBC. Building a reference implementation of this functionality is on the TODO list, but has not yet been done.


How to use reflection for accessing object from its name as a string

Question: Ive a folder monitoring application where around 25 filewatchers monitoring 25 folders. Each of the filewatchers named fsw1,fsw2 ....
bCreateFileCheck = True
fsw1 = New FileSystemWatcher(My.Settings.UserRootFolder1)
fsw1.IncludeSubdirectories = True
fsw1.EnableRaisingEvents = True
fsw1.NotifyFilter = (NotifyFilters.LastAccess Or NotifyFilters.LastWrite Or NotifyFilters.FileName)

So this is repeating for the 25 folders, but only difference is name changing of fsw1 to fsw2,fsw3 etc. and also My.Settings.UserRootFolder1 to My.Settings.UserRootFolder2,My.Settings.UserRootFolder3 etc.
So how can we achieve this using for loop without writing individual code blocks for every filewatchers. I guess using some reflection techniques it can be achieved.
Answer: Don't make your life harder than it needed to be. Use an array (or List(Of T) if you need something flexible):
Dim watchers(24) As FileSystemWatcher
For i As Integer = 0 To watchers.GetUpperBound(0)
    Dim path = CStr(My.Settings.Item("UserRootFolder" & (i + 1)))
    watchers(i) = New FileSystemWatcher(path)
    'Do further initialization...
Next

If the structure is fixed and you cannot really change it, you can set the variables to the objects that you created in the For loop. So change the loop as follows:
'...
Dim watcher = New FileSystemWatcher(...)
Me.GetType().GetField("fsw" & (i + 1)).SetValue(Me, watcher)

This gets the field with the appropriate name and sets its value to the object that you just created (I assume that it is a field based on its naming).
Comment: Sorry friend, actually its an existing code on the project been runnning for 3  4 years i guess. So there is lots of places where its using. So any possibility with that way other than array?
Comment: Then I would strongly recommend refactoring the code. If that is not an option, I have added some more information to my answer.
Comment: Thats really nice my friend.. Thanks for that.. Made my day


iphone tcp/ip via accessory port?

Question: I'd love to be able to mod the iPhone tcp/ip stack to route packets over the accessory port either serial or better yet USB or Firewire...
The applications I'm researching wouldn't be able to use WiFi, 3G or bluetooth...
Custom apps could be written to use the serial port available via the accessory port, but it would be nice to support generic apps that need network access.
I haven't tracked down much info relating to this, anyone have thoughts??
Answer: About the only way this could work would be to Jailbreak the device, and do some quite low level hacking. OS X supports NKEs (Network Kernel Extensions) that would allow you to introduce a new network interface. I don't know if the iPhone OS has these (as there's obviously not much information on it - it's supposed to be a black box). Even if it did, you'd have to make your KE lie and claim to be e.g. the Wifi device, as many applications will probe for network availability by searching for the Wifi interface.
Basically, I think this is an untenable idea. You can use the External Accessory APIs to allow your custom apps to use your dongle as a network service provider, but you can't use it to provide a new network interface. If you want this kind of open, extensible platform, then the iPhone is not really the right platform.
Comment: I agree, it is a far fetched idea... but I did learn one thing:  NKE's... never heard of them before... I have some reading to do tonight! :)  thanks

iphone tcp/ip via accessory port?


Solving equation values

Question: With the equations:

$7i_1 - 4i_2 = 50$
$12i_2 - 4i_1 = 20$

what is the method finding the values of $i_1$ and $i_2$? Both are integers.
The answers are $i_1 = 10$ and $i_2 = 5$, how was it achieved.
Comment: What are $i_1$ and $i_2$? Real numbers? Integers? You need to provide more information about the problem.
Comment: Yes, they are integers.
Comment: @Redsam121,i1=10 and i2=5
Comment: Yes, I already have the answer. But I want to know how the answer was achieved.
Answer: Apply standard elementary algebra methods of elimination. You can divide the second equation by $4$ to get
$$
i_1=3i_2-5.
$$
Then insert into the first equation
$$
50=7(3i_2-5)-4i_2=17i_2-35.
$$
By a lucky coincidence the solution of this is actually an integer.

Solving equation values


drupal redirect language url alias

Question: I would like to redirect urls that are using the wrong url alias.
Example, in my site I have:
English -> /prices/high-school -> node/112
Spanish -> (/es)/precios/high-school -> node/115
When a person or search engine reaches /es/prices/high-school a 404 is returned. What I would like is to redirect /es/prices/high-school to node/115.
I would like to do this in a general form, writing a module or using an existing one if possbile.
Thanks.
Answer: I already figured it out.
In the preprocess hook I need to check the page, strip the prefix and get the node id from the original id.
See code below:
<code>  if(current_path()=="search404")
{
    $url = request_path();
    if (startsWith($url,'es/') ||
        startsWith($url,'de/') ||
        startsWith($url,'it/') ||
        startsWith($url,'fr/') )
    {
        $originalPath = substr($url,3,strlen($url)-3);
        $path = drupal_lookup_path("source", $originalPath,"en");
        if (isset($path))
        {
            $node = menu_get_object("node", 1, $path);
            if (isset($node))
            {
                $prefix = substr($url,0,2);
                $translated_paths = translation_path_get_translations('node/' . $node->nid);
                if (isset($translated_paths) && array_key_exists ($prefix,$translated_paths))
                {
                    if (isset($_GET['destination'])) {
                        unset($_GET['destination']);
                    }
                    $new_path = $translated_paths[$prefix];
                    drupal_goto($new_path, array(),301);
                }

            }
        }
    }
}
</code>
Answer: It won't be a solution to add different url aliases for the language versions? I mean:
node/112 -> /prices/high-school
node/115 -> /es/precios/escuela-secundaria
i18n module handles language based paths and redirects too.
Comment: Thanks for your answer. That is probably a good solution. However I already found a solution myself. I will post the solution some time later as the system does not allow me to answer my own question just yet.

drupal redirect language url alias


Change relative URL to absolute within a PHP include

Question: I have a calendar application where the calendar will show one month per page, with navigation for each month.
I want to include this calendar in our templates. I can easily do so with a PHP include.
However, within the iframe, the calendar uses relative links to get to the other months. I need to set these to absolute links.
I am wondering if I can use JavaScript, or perhaps a PHP function to replace the links, but within the include?
The calendar itself is written in Perl, and runs from our cgi-bin. It is included using
<?php include('http://pps.servername.edu/cgi-bin/calendarappname/calendar.pl?Op=ShowIt&CalendarName=thename'); ?>

the links on the calendar that I wish to change appear like this
2014

I was thinking of doing a string replace or preg_replace, but I wasn't sure what would work, given that the URLs to be changed appear in a PHP include.
Comment: You need to change the links inside the calendar application not the path in the include. You need to reword your question.
Comment: I cant change the paths in the calendar app, at least not natively. I was hoping to dynamically change the links when I loaded the include.
Comment: @LisaH I think it's relevant to ask why you want to change all the hrefs to be absolute urls instead of relative?  maybe this is an [`XY Problem`](http://www.perlmonks.org/?node_id=542341)
Comment: @Miller- thanks for asking. Each calendar displays the current month. To view the upcoming months, users can click a link to view that month. Right now, the links result in a 404 error, because the calendar links are relative to the position of the including page, and they need to be within the calendar app itself, which is in the cgi-bin.
Answer: Don't include() the calendar; fopen() it and read it into a string. (Or use file_get_contents() which does the open, read, and close in one step.)
Once you have a string, you can manipulate it however you like, and then print() it.
Comment: can you give me a code example. I like this approach
Comment: That is, I get the file_get_contents() part... I can do that, but how would I ask to change urls?
Comment: Using `preg_replace` or `str_replace` like you said in your question. It's a string, so you can apply arbitrary string manipulation.


How do I prove that $\prod\limits_{n=1}^{\infty} (1-x^n)$ is absolutely convergent for $0 \leq x < 1$?

Question: Consider the infinite product

$$\prod_{n=1}^{\infty} (1-x^n).$$

Prove that the above infinite product is absolutely convergent for $0 \leq x < 1.$
I have considered the sequence of partial products $\{F_m(x) \}$ where $$F_m (x) = \prod_{n=1}^{m} (1-x^n).$$ Then I have observed that $F_{m+1} (x) = (1 - x^{m+1}) F_m (x).$ If $0 \leq x <1$ then $F_{m+1} (x) \leq F_m (x).$ So the sequence of partial products is monotone decreasing and bounded below by $0.$ So for every $0 \leq x < 1$ the sequence $\{F_m(x) \}$ is monotone decreasing and bounded below by $0$ and therefore it is convergent. Since for $0 \leq x < 1$  the sequence $\{F_m (x) \}$ is a sequence of positive terms (as each term is the product of finitely many positive terms) so we can conclude that the sequence $\{F_m (x) \}$ is absolutely convergent for each $0 \leq x < 1.$ Therefore for each $0 \leq x <1$ the infinite product $\prod_{n=1}^{\infty} (1-x^n)$ is absolutely convergent as well.
Is the above argument ok? Please verify it.
Thank you very much for your valuable time.
Comment: Do you know the definition of an absolute convergence of a product?
Comment: If you multiply two numbers, both in the interval $(0,1]$, in what interval does the end-result sit? Do you know what induction is?
Comment: I don't know if this would help but you can use pentagonal number theorem to simplify the product
Comment: @Darkai I haven't studied Euler's pentagonal number theorem. But yes I am now studying the subject partition theory.
Comment: @Wojowu I don't know that. Perhaps that was the problem when I did the solution. That is why I post my solution here as I was bit unsure about my solution. Can you tell me what is meant by absolute convergence of products? Is it different from what we know about the sums?
Comment: @user334732 I know that if we multiply two numbers in $(0,1]$ the end result sits also in $(0,1].$ It's pretty easy. The answer to your second question is also in the affirmative direction. **"YES" I DO KNOW INDUCTION.**
Comment: By definition, a product $\prod_{n=1}^\infty(1+a_n)$ is convergent if the product $\prod_{n=1}^\infty(1+|x_n|)$ is convergent.
Comment: Where do I find that? Can you share me some notes available online for free which I can be able to download and study it on my own?
Comment: I am studying the topics "Partition theory" from the book Analytic Number Theory written by Tom M. Apostol.  There I first found such infinite products. But I don't have any formal intro to that infinite product stuff in real analysis before. So It seems troublesome for me at some stage to understand the reasoning given in this book. So any help regarding that will be highly appreciated. Thank you very much.
Comment: Also note that by the convention I've learned, if the sequence of partial products has limit 0, then that's considered to be a divergent product.  So, under this convention, your proof would be incomplete since it doesn't show the limit is nonzero (which it does turn out to be).
Comment: Can you explain why is it so @Daniel Schepler?
Comment: Take the log of the partial products to convert to a series convergence question, then use limit comparison test of $\log(1-x^n)$ with $-x^n$.
Comment: @mathmaniac. do you already have that $[0,1]$ is compact?
Answer: According to the definition, the infinite product $\prod\limits_{n=1}^{\infty} (1+a_n)$ is absolutely convergent if $\prod\limits_{n=1}^{\infty} (1 + |a_n|)$ is convergent. Now observe that $\prod\limits_{n=1}^{\infty} (1 + |a_n|)$ is convergent iff $\sum\limits_{n=1}^{\infty} \log (1 + |a_n|)$ is convergent. Also observe that $\log (1 + |a_n|) \leq |a_n|,$ for all $n \in \Bbb N.$ Therefore we can conclude that the infinite product $\prod\limits_{n=1}^{\infty} (1 + a_n)$ is absolutely convergent iff the infinite series $\sum\limits_{n=1}^{\infty} a_n$ is absolutely convergent.
In this case $a_n = - x^n,$ for all $n \in \Bbb N.$ So in order to show that the given infinite product $\prod\limits_{n=1}^{\infty} (1-x^n)$ is absolutely convergent for each $0 \leq x < 1$ we need only to show that the infinite series $\sum\limits_{n=1}^{\infty} x^n$ is convergent for each $0 \leq x <1.$ Which is a very well known result and I leave the details for you to verify.
Answer: May be this can help:

$$\prod_{n=1}^{m}{(1-x^n)}=\exp\left(\sum_{n=1}^{m}{\ln(1-x^n)}\right)$$
$$= \exp\left(-\sum_{n=1}^{m}{\sum_{\sigma=1}^{\infty}{\frac{x^{\sigma n}}{\sigma}}}\right)=\exp\left(-\sum_{\sigma=1}^{\infty}{\frac{1}{\sigma}}\sum_{n=1}^{m}{x^{\sigma n}}\right) $$
Comment: Now $$\begin{align} \exp \left (- \sum\limits_{\sigma = 1}^{\infty} \frac {1} {\sigma} \sum\limits_{n=1}^{m} x^{\sigma n} \right ) & = \exp \left ( -\sum\limits_{\sigma = 1}^{\infty} \frac {1} {\sigma} \cdot \frac {x^{\sigma} (1 -  x^{\sigma m})} {1 - x^{\sigma}} \right ).\end{align}$$ What can be done then @HAMIDINE SOUMARE?
Comment: Can you say what was wrong in my steps @HAMIDINE SOUMARE in the body of the question?


How to dd from smaller SD to bigger?

Question: I run out of memory (8GB) in one system, and I need to move the existing system to bigger memory (16GB).
Details

/dev/disk4s1 is the input i.e. from where I want to get the data
/dev/disk2s1 is the sd-card where I want write

I unmount disk2s1, and run
sudo dd bs=1m if=/dev/disk4s1 of=/dev/disk2s1

but I get
dd: /dev/disk4s1: Resource busy

I unmount also /dev/disk2s1 but I get dd: /dev/disk4s1: No such file or directory. So I should not unmount the input.
Keeping both SD-cards unmounted, I run XtrmJosh's proposal sudo dd if=/dev/disk4s1 of=/dev/disk2s1 but get dd: /dev/disk4s1: No such file or directory.
System report of OSX (Sorry, my Ubuntu is upgrading slowly itself now)  where I am uncertain if I dding right things.
Command sudo dd if=/dev/disk4s2 of=/dev/disk2s1 is not correct also.
USB 3.0 Bus:

  Capacity: 8,02 GB (8 017 412 096 bytes)
  Removable Media:  Yes
  BSD Name: disk4
  Partition Map Type:   MBR (Master Boot Record)
  PCI Device ID:    0x9c31
  PCI Revision ID:  0x0004
  PCI Vendor ID:    0x8086
  Volumes:
boot:
  Capacity: 62,9 MB (62 914 560 bytes)
  Available:    42 MB (41 951 232 bytes)
  Writable: Yes
  File System:  MS-DOS FAT16
  BSD Name: disk4s1
  Mount Point:  /Volumes/boot
  Content:  Windows_FAT_32
  Volume UUID:  B39523D8-BEFC-3910-95CD-08A0C8F472AF
disk4s2:
  Capacity: 3,96 GB (3 962 568 704 bytes)
  BSD Name: disk4s2
  Content:  Linux

Card Reader:

  ...
  Current Available (mA):   1800
  Current Required (mA):    224
  Extra Operating Current (mA): 0
  Capacity: 15,93 GB (15 931 539 456 bytes)
  Removable Media:  Yes
  Detachable Drive: Yes
  BSD Name: disk2
  Built-In: Yes
  Partition Map Type:   MBR (Master Boot Record)
  Volumes:
NO NAME:
  Capacity: 1,98 GB (1 975 546 368 bytes)
  Available:    1,97 GB (1 972 600 832 bytes)
  Writable: Yes
  File System:  MS-DOS FAT16
  BSD Name: disk2s1
  Mount Point:  /Volumes/NO NAME
  Content:  DOS_FAT_16
  Volume UUID:  2AE73D94-DEE9-3B80-A4DA-0AF2B6449863

Mass Storage Device:

  Product ID:   0x125c
  Vendor ID:    0x14cd  (MOAI ELECTRONICS CORPORATION)
  Version:  3.00
  Serial Number:    125C20100726
  Speed:    Up to 480 Mb/sec
  Manufacturer: Generic
  Location ID:  0x14200000 / 11
  Current Available (mA):   1000
  Current Required (mA):    248
  Extra Operating Current (mA): 0
  Capacity: 8,02 GB (8 017 412 096 bytes)
  Removable Media:  Yes
  Detachable Drive: Yes
  BSD Name: disk4
  Partition Map Type:   MBR (Master Boot Record)
  Volumes:
boot:
  Capacity: 62,9 MB (62 914 560 bytes)
  Available:    42 MB (41 951 232 bytes)
  Writable: Yes
  File System:  MS-DOS FAT16
  BSD Name: disk4s1
  Mount Point:  /Volumes/boot
  Content:  Windows_FAT_32
  Volume UUID:  B39523D8-BEFC-3910-95CD-08A0C8F472AF
disk4s2:
  Capacity: 3,96 GB (3 962 568 704 bytes)
  BSD Name: disk4s2
  Content:  Linux

How can you dd from smaller SD-card to Bigger?
Comment: You're trying to copy a specific partition, not the whole disk so I think it does need to be mounted. As per the other answer, you want to format the new SD card and copy all the files over. Alternatively, you could use dd and just run `dd if=/dev/disk4 of=/dev/disk2` which would copy the entire disk. After that, open the disk in gparted and see if you can expand the partition.
Comment: I prefer a new clean install. And then use rsync or cp with parameters to preserve ownership & permissions to copy /home over. That is almost all your settings. If you manually edited some hardware settings, those would be in /etc. Only if a server with apache or databases may you have other system folders to copy.
Comment: Forgot to mention, for my command above you should run with both disks unmounted. If it still claims one of them is busy, I'm not sure what's going on. Do you have gparted open? Are you trying to do this on a virtual machine? Nothing should be using the device if its not mounted or open in something like gparted.
Comment: Again, you are including s1 on the end, which suggests a subdevice (mac term, I don't entirely understand this one), if you run lsblk, do you get a tree where disk2 and disk4 are the "roots"? or do you get one where disk2s1 and disk4s1 are the roots? If the former, you should be able to run the command as I posted it above.
Comment: Good example here. But you only need the copy commands. To move /home uses rsync- Be sure to use parameters to preserve ownership & permissions
https://help.ubuntu.com/community/Partitioning/Home/Moving But if a regular backup of /home you should create an excludes file and exclude a lot of temporary files. http://askubuntu.com/questions/545655/backup-your-home-directory-with-rsync-and-skip-useless-folders
Answer: You can "dd from smaller SD-card to Bigger" but you will end up with the same partitions, e.g. disk space, as on the smaller SD card. Eventually you can create a new partition on the bigger SD card ending up with two partitions.
What you should do is to format the bigger SD card with full capacity and copy over the files form the smaller SD card.
Comment: Which will lead to an unbootable system, if I understood the OP correctly and these are system partitions.
Comment: @Masi Did you try dd if=/dev/disk4 of=/dev/disk2 as XtrmJosh wrote? Than you could try resizing the partitions. If the target system is raspbian there is a script to do that. Otherwise maybe gparted? But first you need to make the copy.....
Comment: @Masi the option provided here is maybe the best option, still you would have to change the 'boot' flag on the drives accordingly and run  `sudo update-grub` and make sure you're chrooted into the drive you want to update grub and install grub onto the MBR
Comment: @Masi sudo raspi-config, then it is the first menu point.
Comment: @Bruni Write done now successfully with `dd`. Some mistakes as described in comments of spyderdyne's answer. Yes, the target system is Raspian. What is the script called for the disk enlargement? I can do it also by gparted if in live system if it does not exists there easily.
Answer: This appears to be an OS X question due to the disk names, but here is what you need to do:
diskutil unmountDisk /dev/disk4
diskutil unmountDisk /dev/disk2
sudo dd if=/dev/disk4 of=/dev/disk2 bs=1m

The last line should work on Ubuntu and probably works on OS X as well.  I just did something similar a couple weeks ago on a Raspberry Pi running Ubuntu Mate to rescue a buddy's Windows HDD data to a new drive.  I don't recall having to unmount on Ubuntu, but it took forever to transfer about 150GB.
You can then follow the instructions here to resize your new partition to take advantage of the extra space.
Let me know if this works for you.
Comment: My previous command assumed this was just data on a specific partition and not a bootable OS install.  Just copy the entire disk and it should work.  Drop the (s1) partition names.
Comment: Your commands work. My mistakes were that 1) I confused `unmount` with `eject`, and 2) heterogenous SDs (some SDs were FAT16, extFat and with different allocation sizes). So simply do `sudo dd bs=1m if=/dev/disk4 of=/dev/disk2`.
Comment: Im glad I could help.  :)

How to dd from smaller SD to bigger?


No sound: main.c: pa_pid_file_create() failed

Question: I'm not able to use pulseaudio so no sound at all in Ubuntu 19.04 and my laptop is Lambda Tensorbook. Anyone could help me to fix this "headache"? Thanks at advance.
x@x:~$ pulseaudio -vvv
I: [pulseaudio] main.c: setrlimit(RLIMIT_NICE, (31, 31)) failed: Operation not permitted
I: [pulseaudio] main.c: setrlimit(RLIMIT_RTPRIO, (9, 9)) failed: Operation not permitted
D: [pulseaudio] core-rtclock.c: Timer slack is set to 50 us.
D: [pulseaudio] core-util.c: RealtimeKit worked.
I: [pulseaudio] core-util.c: Successfully gained nice level -11.
I: [pulseaudio] main.c: This is PulseAudio 12.0-378-g02fc89
D: [pulseaudio] main.c: Compilation host: x86_64-pc-linux-gnu
D: [pulseaudio] main.c: Compilation CFLAGS:  -g -O0 -Wall -W -Wextra -pipe -Wno-long-long -Wno-overlength-strings -Wunsafe-loop-optimizations -Wundef -Wformat=2 -Wlogical-op -Wsign-compare -Wformat-security -Wmissing-include-dirs -Wformat-nonliteral -Wpointer-arith -Winit-self -Wdeclaration-after-statement -Wfloat-equal -Wmissing-prototypes -Wredundant-decls -Wmissing-declarations -Wmissing-noreturn -Wshadow -Wendif-labels -Wcast-align -Wstrict-aliasing -Wwrite-strings -Wno-unused-parameter -fno-common -fdiagnostics-show-option -fdiagnostics-color=auto
D: [pulseaudio] main.c: Running on host: Linux x86_64 5.0.0-20-generic #21-Ubuntu SMP Mon Jun 24 09:32:09 UTC 2019
D: [pulseaudio] main.c: Found 12 CPUs.
I: [pulseaudio] main.c: Page size is 4096 bytes
D: [pulseaudio] main.c: Compiled with Valgrind support: yes
D: [pulseaudio] main.c: Running in valgrind mode: no
D: [pulseaudio] main.c: Running in VM: no
D: [pulseaudio] main.c: Running from build tree: no
D: [pulseaudio] main.c: Optimized build: no
D: [pulseaudio] main.c: All asserts enabled.
I: [pulseaudio] main.c: Machine ID is a780a212b2e84b5f8f2f3abe253cfbbb.
I: [pulseaudio] main.c: Session ID is 2.
I: [pulseaudio] main.c: Using runtime directory /run/user/1000/pulse.
I: [pulseaudio] main.c: Using state directory /home/x/.pulse.
I: [pulseaudio] main.c: Using modules directory /usr/local/lib/pulse-12.0/modules.
I: [pulseaudio] main.c: Running in system mode: no
E: [pulseaudio] pid.c: Daemon already running.
E: [pulseaudio] main.c: pa_pid_file_create() failed.

x@x:~$ ps -ef | grep pulse
x         2089  1604  0 6月30 ?       00:00:00 /usr/bin/pulseaudio --daemonize=no
x         2318  2089  0 6月30 ?       00:00:00 /usr/lib/x86_64-linux-gnu/pulse/gsettings-helper
x        31671 31664  0 09:11 pts/2    00:00:00 grep --color=auto pulse

x@x:~$ snap list
Name  Version    Rev   Tracking  Publisher   Notes
core  16-2.39.2  7169  stable    canonical✓  core
vlc   3.0.7      1049  stable    videolan✓   -

Comment: @HabibRehman I remeber I've sent an email to `Lambda Labs, Inc.`, and the client service sent me a command: `echo "options snd_hda_intel probe_mask=1" | sudo tee /etc/modprobe.d/tensorbook.conf
sudo update-initramfs -u -k all` then reboot, I remeber it worked out (not sure for your case it will works out or not, hope it helps). However, I reinstall another system named `pop_os` later.
Comment: @ahbon, thanks i'll check this out
Comment: `ps -ef | grep pulse` and `snap list` please
Comment: I have updated the output of your command. Please check.
Comment: Hi, were you able to solve this problem? it's been 5 days i can't fix it
Answer: If you have updated pulseaudio recently or restored old home directory or configuration files, you could try:
rm  ~/.config/pulse/*

This should remove your current defaults for pulseaudio which are apparently not working.
After this, please reboot your system to build new pulseaudio configuration files.
Comment: Thank you very much. I remove `x@x:~/.pulse$ locate default-sink
/home/x/.config/pulse/a780a212b2e84b5f8f2f3abe253cfbbb-default-sink
/home/x/.pulse/a780a212b2e84b5f8f2f3abe253cfbbb-default-sink`, then should I reboot?
Comment: Yes, please reboot
Comment: OK, I try with that and let you know what happens. BTW, just wonder why there two `.pulse` path for `*default-sink`, it's confusing, should I remove one?
Comment: better to remove all files in that directory and reboot. They will be rebuilt after reboot. run    `rm  ~/.config/pulse/*`  and reboot
Comment: In your case. Please delete all the files in `/home/x/.config/pulse/` only.
Comment: fixed it for me.
Just deleting the files and then a restart did it.
Comment: For me as Raffa I did as said above, but I had to reboot it fast, dunno why maybe for some reason it was creating the files before I reboot it
So rm ~/.config/pulse/* && reboot Did it for me
Answer:
I: [pulseaudio] main.c: Using modules directory /usr/local/lib/pulse-12.0/modules.

It seems you compiled something related to  pulseaudio on your own.
comment in the files under /etc/ld.so.conf.d/ the entries that points to /usr/local/lib/ out. With sudo ldconfig -v update/create the links and cache for your libraries new.
Comment: `x@x:/etc/ld.so.conf.d$ ls
cuda-10-1.conf  fakeroot-x86_64-linux-gnu.conf  i386-linux-gnu.conf  libc.conf  x86_64-linux-gnu.conf`


Installer for ubuntu 16.04 64 bit not starting on Notebook HP - 15-ba085nl

Question: I'm trying to install Ubuntu 16.04 on my Notebook HP - 15-ba085nl but I'm facing a few issues:
- when I try to install Ubuntu 16.04 amd64 bit the installer freezes while starting (the issue is not related to the version the boot usb that I'm trying to use, I've checked and file  is correct. I also trying with Kubuntu 16.04 amd64bit but the installer doesn't start either
-I've successfully installed Ubuntu 16.04 i386 (32 bit)  but GPU is not working: the screen often blinks and there are a lot of black rows appearing, I've tried to install the driver AMDGPU-PRO but installation fails due to the fact that i'm using i386 version.
Any Idea?  I probably can make the 32 bit work properly but how can I solve the issue with the 64 bit installer? Is there any way to try debug that?
Thanks
Comment: The problem is that the system is not able to use the AMD video card. How can I solve this?
Answer: I've been able to solve the problem thanks to this question Ubuntu installer hangs on start
In order to start the installer correctly I clicked 'e' while on the grub page and edited the command by deleting "quiet splash" and adding "nomodeset".
Too bad that later on I doscovered there is no support yet for AMDGPU-PRO in Ubuntu 16.04.3
http://support.amd.com/en-us/kb-articles/Pages/AMDGPU-PRO-Install.aspx
Comment: UPDATE: support for Ubuntu 16.04.3 is now available!


Python Error : ImportError: No module named 'xml.etree'

Question: I am simply trying to parse an XML file:
import xml.etree.ElementTree as ET
tree = ET.parse('country_data.xml')
root = tree.getroot()

but this gives me:
import xml.etree.ElementTree as ET
ImportError: No module named 'xml.etree'

I am using Python 3.5. I have tried to same code with Python 2.7 and 3.4 but I always get this error. I thought that the XML libraries come as standard. Also, I can see that in my Lib folder:

So why can't it pick up the module? I am really confused. Do I have to make some change in an environment variable somewhere?
Please help.
Comment: never mind, false alarm. my dev package was named xml. i changed the name and now it works
Answer: Remove the file xml.py or a directory xml with a file __init__.py in it from your current directory and try again. Python will search the current directory first when importing modules. A file named xml.py or a package named xml in the current directory shadows the standard library package with the same name.
As pointed out in a comment by KeshV, you also need to remove the file xml.pyc, if it exists. In Python 2 it will be in the same directory as xml.py. In Python 3 it will be in the sub directory __pycache__. In General, as long as the *.py file is around, you can savely delete the corresponding *.pyc file because Python will re-create it upon import of the *.py file.
Comment: yes, my package was named xml. now i changed the name and it works :) thanks
Comment: also remove xml.pyc , just removing xml.py is not enough
Comment: i dont have a file of that name
Comment: my file is called parse.py
Comment: Do you have a  sub-directory `xml` in there?
Comment: @KeshV Thanks for the comment. Added a section to my answer mentioning this.
Comment: Thank you! Now I understand a little more about how python works.
Comment: is there an alternative, if i want to keep my name?
Answer: Your script name is: xml.py?
Change it and it should work.
Answer: A local .py file overwrites the pre-defined module. Remove all the files that named xml in the current folder.
Answer: In addition to the answers that already point to local Python modules: In case you have added other directories to your path, also make sure to check those for modules called xml.py or packages called xml.
For me that was the issue when calling Sphinx with a conf.py file that added several directories to the path.


How to project $x_2$ onto $u_1$

Question: I'm following a solution from here (the first problem), I don't understand how to "project $x_2$ onto $u_1$"

1) how does:$\begin{bmatrix}0\\\frac{1}{\sqrt{2}}\\\frac{1}{\sqrt{2}}\end{bmatrix}$ turn into $\begin{bmatrix}0\\2\\2\end{bmatrix}$?
2) how does: $x_1 - proj = \begin{bmatrix}1\\2\\-2\end{bmatrix}$ ?? Shouldn't it be $\begin{bmatrix}0\\-1\\-1\end{bmatrix}$??
Answer: I suppose the answer you'd benefit from here is a description of how the Gram-Schmidt process works.

Orthogonal Projection
To understand that we need to understand orthogonal projection.  First we consider the orthogonal projection of a vector $\vec v$ onto the one-dimensional subspace $\operatorname{span}(\vec u)$.  It is defined to be the unique component -- denoted $\vec v_\|$ or $\operatorname{proj}_{\vec u}(\vec v)$ -- of $\vec v$ parallel to $\vec u$ such that $$\vec v = \vec v_\| + \vec v_\bot,\quad \vec v_\bot \cdot \vec u = 0$$

Before I give the formula, I'll give a geometric definition of the dot product that should make it much easier to understand where the formula comes from: the dot product $\vec v \cdot \vec u$ is the signed length of the projection of $\vec v$ onto $\operatorname{span}(\vec u)$ times the length of $\vec u$ where the sign is determined by the equation $\operatorname{proj}_{\vec u}(\vec v) = \lambda \vec u$ -- if $\lambda >0$, then the sign is $+$, otherwise it is $-$.  For slightly more on this you can see this answer.
Then it should be easy to convince yourself that $$\operatorname{proj}_{\vec u}(\vec v) = \frac{\vec v\cdot \vec u}{\|\vec u\|^2}\vec u$$
(Note: don't take this as the definition of $\operatorname{proj}_{\vec u}(\vec v)$ or else we just get a circular set of definitions.  The definition is in the first paragraph of this section -- this is just a formula for how to calculate $\operatorname{proj}_{\vec u}(\vec v)$)
But we don't only want to project a vector onto a one-dimensional subspace -- often we want to project a vector onto an arbitrary-dimensional subspace $U$.

Once we have the one-dimensional orthogonal projection down, it's not too hard to extend it.  Say we have an orthonormal basis $\{\vec u_1, \dots, \vec u_k\}$ for the subspace $U$.  Then the orthogonal projection of $\vec v$ onto $U$ will simply be the sum of the projections onto each $\operatorname{proj}_{\vec u_i}(\vec v)$:
$$\operatorname{proj}_{U}(\vec v) = \sum_{i=1}^k \operatorname{proj}_{\vec u_i}(\vec v) = \sum_{i=1}^k \frac{\vec v\cdot \vec u_i}{\|\vec u_i\|^2}\vec u_i$$
Now ask yourself: why is this formula correct?  Does the basis $\{\vec u_i\}$ really need to be orthonormal? (Hint for the second one: the answer is not quite, we can relax that restriction a little.  Why?)
Now we have all the tools we need to describe the Gram-Schmidt process.

The Gram-Schmidt Process
Let's say we have a basis $\{\vec b_1, \dots, \vec b_k\}$ of some $k$-dimensional subspace.  That's great, but sometimes what we really want is an orthonormal basis.  So that begs the question "is there some way of turning an arbitrary basis $\{\vec b_i\}$ into an orthonormal basis {\hat e_i}$?"  The answer is yes.  Here's the procedure:
First we're going to create an intermediate basis $\{\vec f_i\}$ which is orthogonal, but not necessarily orthonormal.  We do so via a recurrence relation:
$$\begin{align}\vec f_1 &:= \vec b_1 \\ \vec f_i &:= \vec b_i - \operatorname{proj}_{U_{i-1}}(\vec b_i),\quad \text{for }1\lt i\le k\end{align}$$
where $U_{i-1} = \operatorname{span}(f_1, \dots, f_{i-1})$.
So what's happening here?  Well first we just take the vector $\vec b_1$ and set $\vec f_1$ equal to it.  Then for $\vec f_2$ we take $\vec b_2$ and subtract its projection onto $\vec f_1$.  So what's left is just the component of $\vec b_2$ which is orthogonal to $\vec f_1$.  Then for $\vec f_3$ we take $\vec b_3$ and subtract off its projection onto $\vec f_1$ and $\vec f_2$ to get just the part orthogonal to both.  We continue in this way until we have an orthogonal basis $\{\vec f_i\}$.
But we didn't just want an orthogonal set, we wanted an orthonormal set.  But now the normalization part is easy.  We just set $\hat e_i := \frac{\vec f_i}{\|\vec f_i\|}$ for all $i$.
Then we're done.  We've created an orthonormal basis $\{\hat e_i\}$ from an arbitrary basis $\{\vec b_i\}$ which necessarily describes the same subspace.  Success!

How to project $x_2$ onto $u_1$


timeout in javascript showing one div straight away and another after 3 seconds?

Question: ok so im using timeout to try and get this javascript load after a 3 second delay.
there's two divs being loaded through this javascript;
dialog and cover.
At the moment though the dialog is showing straight away on page load and only the cover is waiting 3 seconds to load/show. but this shouldnt be the case i want both divs to show together after 3 seconds.
Please can someone show me where to fix this.

Comment: Please post your HTML and CSS.
Comment: your code is not nice at all o.O, what are you trying to do??? to hide an element use `display:none` and what is this: `100%`??
Answer: The reason could be, dialog may be having display:block property at the load time. Try change that to 'none' at the very first through css. Another thing is gave a look at that if statement, you are assigning rather than comparing.u shd be using this '==' operator right.. ?
Cheers .. ;)
Answer: Your "dlg" element must not be hidden on page load. Check your HTML and CSS, and add display:none as needed.


What format of file is .vimrc?

Question: .vimrc is the configuration file for vim, but I have a doubt..
What kind of file is? what is the language inside of it?
Comment: See `:help vimrc-intro` for a nice introduction.
Answer: It's just Vim commands in a text file.
http://vimdoc.sourceforge.net/htmldoc/starting.html#initialization
Answer: Please refer the article: http://vim.wikia.com/wiki/Open_vimrc_file

The vimrc file contains optional runtime configuration settings to
  initialize Vim when it starts.
Answer: .vimrc is a file which is used for pre configuration of our scripting code. If we want to set some pre configurations we can declare in that file. The language used in it is generally a scripting language (shell scripting).

What format of file is .vimrc?


Error - NgFor only supports binding to Iterables such as Arrays

Question: I am trying to display an array as options in a menu drop down but I am getting the error:

ERROR Error: Cannot find a differ supporting object '[object Object]' of type 'object'. NgFor only supports binding to Iterables such as Arrays.

HTML code:
<mat-option *ngFor="let type of exportTemplates" value="{{ type.id }}">
    {{ type.label }}
 </mat-option>

And the array looks likes this:

TS code:
exportTemplates = [];
const subs = this.configService.state$.subscribe((config: any) => {
            this.exportTemplates = config.templates.types;
        });
        this.subscription.push(subs);

Comment: That is not an array.
Answer: How about merging all the items in an array
list.map(item => Object.keys(item).map(key => item[key]))[0]

Have created a Stackblitz Demo for your reference


Recommendations for SIP-logfile viewer

Question: I am searching for a viewer for SIP protocol logfiles.
I've stumbled about various tools, and would very much like to have a graphical display like this one:

https://sipfoundry.atlassian.net/wiki/display/sipXecs/Display+SIP+message+flow+using+Sipviewer
https://sipfoundry.atlassian.net/wiki/download/attachments/491578/Sipviewer.png?version=1&modificationDate=1263129773000&api=v2

Only downside of that tool is that it requires java, which I am not allowed to install / use due to security concerns.
Does anyone have a recommendation for a SIP-logviewer that does not use or depend on java?
I'm running Kubuntu 16.04.
Answer: It will depend on where your logfiles are coming from. There is no standard 'SIP Protocol logfile'.
If you need to trace SIP calls, my first recommendation would be Wireshark. This is a network trace tool that can trace pretty much any IP protocol you can think of. It has a lot of SIP features, including producing the kind of ladder diagrams you want (Go to the Telephony->VOIP calls menu item). It can also play back audio.
It is available for most Operating Systems.
When debugging SIP calls it is worth realising that your problem may be at a different level - IP may be firewalled, the TCP (or UDP) socket may not be open, the DNS queries might not be working. All of these can be diagnosed from a Wireshark trace.
Wireshark can also read files saved by other programs, such as the Linux tcpdump program. I often take traces on SIP servers using tcpdump, and then debug them on my laptop.

Recommendations for SIP-logfile viewer


How complex is too complex for modals?

Question: We're in the process of developing an application that makes use of modals to provide the user with extra functionality without having to go to a separate page. I have two questions related to this:
1) How complex is too complex? At what point do you decide that the modal really should be a separate page after all?
2) Should modals be new functionality or extensions of the current page contents? (like editing a record on the page verus a whole new action)
Answer: I feel strongly that modals make best sense when there is a need for context. In other words, use modal windows when the user needs to see the rest of the application to understand the content and options of the modal window in reference to the base screen. So, to answer your second question, modal windows should include extensions and supplementary info, not new functionality or content entirely.
As for complexity, I'd say a good rule of thumb is to think about actual pixel space available. Will the content of the modal window fit comfortable without completely obscuring the background window? Then it is not too complex. But if the modal takes over the entire window, and/or requires sub-navigation or scrolling, then it is indeed too complicated.
Comment: So, based on your comments, can I assume that even something as simple as a two-tab layout of "basic" and "advanced" would be a bad idea?
Comment: enygma: as is so often the case, the answer is it depends :)
But in general, I would avoid an advanced tab in a modal, definitely. In the case that the advanced options are only to be used rarely, I would just include a link to the advanced options that does indeed open in a new tab or window.
Answer: Personally, I think of modals as a way to slap the viewer in the face with an important action or information.
Dialogs, photo/video viewers, notifications, help tips, contact forms, etc. all are common use cases for modals and they all are purposed for a single task.  Usually solving something that doesn't make sense to require a page load, or something important enough that needs to be noticed before a page load happens.
When the user clicks a sign-in link, for example, all they care about at that point getting to the place where they can sign-in or register for your site/service.  They do not care at that moment about any other "important" elements on the page.  A center modal login box that grays out the rest of the screen puts the form directly in front of the user, without the need for a page refresh or having a login form on every page.  But, you need to make it easy and obvious for the user to "escape" or exit the modal logically.
tl;dr - Modals are understood/designed to be simple, don't add complexity to them.
Great article here from Smashing Magazine on modals - lays out use cases and examples as well as all the different types of modals and what works for what.
Also, although it's a bit older, this thread touches on similar issues you discussed in your question.

How complex is too complex for modals?


With help of Application.InputBox() method let user to select multiple cells

Question: I have a code in VBA, where with help of inputBox method user is able to select a cell, a range. But I need to have an inputBox where user is able to select multiple cell ranges, ( not with help of Selection method!!) then to split each cell value.
code is below
Set Group = Application.InputBox(prompt:="Select a cell to be expanded", Left:=100, Type:=8)

Dim str_group As String

Debug.Print Split(str_group, ":")(0)

type:=8 give ability to select only a cell, Mcrsteven if user selects multiple cells, it only reads first cell range(address) I need to see after : and to be able to read it.
Comment: `Application.InputBox` with its `Type` argument's parameter set to `8` captures the selected range even if it is discontinuous no matter what you say. Could you share what you are trying to accomplish by sharing a scenario using real values e.g. if I select cells `A1` and `C2` I want their contents split by a colon returned in an array i.e. if `A1` contains `dog:cat` and `C2` `wolf:Leppard`, I need an array with these 4 words, or I want to return them in column A of `Sheet2` starting with A2... Maybe a screenshot of your data would help. Also, what does *"Select a cell to be expanded"* mean?
Comment: Dealing with cell addresses is a horrible idea and will give you only headaches. `Group` is a range containing all those cells. To loop through them, use e.g. `Dim cell As Range: For Each cell in Group.Cells: Debug.Print cell.Address, cell.Value: Next cell` (where each colon denotes a new line), and in the Immediate window (`Ctrl+G`) see the result.
Comment: I shared a picture but do not know, if it is helpful or not? I bypassed the situation by taking `Address` of input value then splitting it up
Answer: Try this article by Microsoft official website.
https://learn.microsoft.com/en-us/office/vba/api/excel.application.inputbox

In my case the below code worked just fine.
Sub test()
    Dim myRange As Variant
    Set myRange = Application.InputBox(prompt:="Select a cell to be expanded", Type:=8)
    Debug.Print myRange.Address
End Sub

Debug output was $A$4:$C$11 as I selected those cells. Hope this is helpful ...


Why does the maven eclipse plugin break the maven jetty plugin?

Question: I would like to have the maven eclipse plugin regenerate my .classpath whenever a build is run, and I did so by using the following configuration:
<code>    <!--
        Generate a new .classpath each time the build is run, but don't try
        to download sources or javadocs
    -->
    <profile>
        <id>elipse-update</id>
        <activation>
            <file>
                <exists>.classpath</exists>
            </file>
        </activation>
        <build>
            <plugins>
                <plugin>
                    <artifactId>maven-eclipse-plugin</artifactId>
                    <executions>
                        <execution>
                            <phase>generate-sources</phase>
                            <goals>
                                <goal>eclipse</goal>
                            </goals>
                            <configuration>
                                <downloadSources>false</downloadSources>
                                <downloadJavadocs>false</downloadJavadocs>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>
            </plugins>
        </build>
    </profile>
</code>
For some reason, this causes the maven jetty plugin to fail with ClassNotFoundException errors (it complains about all sorts of Spring classes not being there). Of course, it worked without a hit when I didn't have the maven eclipse plugin installed. Here's an example of what I'm talking about:
<code>$ mvn jetty:run
[INFO] Scanning for projects...
...
[INFO] Starting jetty 6.1.22 ...
2010-02-11 20:53:08.984:INFO::jetty-6.1.22
2010-02-11 20:53:09.109:WARN::Could not instantiate listener org.springframework.web.context.ContextLoaderListener
java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener
        at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
        at org.codehaus.classworlds.RealmClassLoader.loadClassDirect(RealmClassLoader.java:195)
        at org.codehaus.classworlds.DefaultClassRealm.loadClass(DefaultClassRealm.java:255)
        at org.codehaus.classworlds.DefaultClassRealm.loadClass(DefaultClassRealm.java:274)
        at org.codehaus.classworlds.RealmClassLoader.loadClass(RealmClassLoader.java:214)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
</code>
Of course, if I delete that eclipse plugin section, I can run jetty as expected:
<code>$ mvn jetty:run
[INFO] Scanning for projects...
...
Feb 11, 2010 8:55:28 PM org.springframework.web.context.ContextLoader initWebApplicationContext
INFO: Root WebApplicationContext: initialization completed in 1672 ms
2010-02-11 20:55:28.687:INFO::Started firstname.lastname@example.com:8080
[INFO] Started Jetty Server
[INFO] Starting scanner at interval of 5 seconds.
</code>
Some things I know:

Yes, I only activate this profile if the .classpath is present. This seems counter-intuitive, but I have a reason: I have another profile that activates when the .classpath is absent which runs the eclipse plugin with the options for downloading source code and javadocs set to true. I don't want this to happen each build, so I created a separate plugin config for when the classpath is already there.
Yes, I could simply create properties that held the values of the options I wish to change instead of specifying the entire plugin config again. In that case, I would just set a eclipse.downloadSources property to true or false depending on the presence of the classpath and have a single plugin definition in the regular build section.

Any advice? This is a strange problem.
Thanks,
LES
Answer: I suspect the Maven Eclipse Plugin to mess do some classpath woodo that affects the jetty plugin later.
But to be honest, this is not a very common way to use the Eclipse plugin, at least not to my knowledge. Most people don't include it in their build, they just run it when the POM has changed and this generally doesn't happen every build. Moreover, touching the <code>.classpath</code> confuses Eclipse if I remember well and forces a clean rebuild of the project which is pretty annoying.
So at the end, and I'm sorry for that, this seems to introduce more annoyances than benefits. You can try to open a Jira issue though.
Comment: i have included a plugin config that will run eclipse:eclipse only if .classpath is missing. that way i can tell people to check out the source, run mvn install and their classpath will be there for them. i have disabled the always on config for now since it doesn't work. it is kind of a pain to have to remember to run eclipse:eclipse whenever i change the pom file - i would like for this to happen automatically with maven (i don't have the .classpath under version control since it's derrived from maven)
Comment: @LES2 I understand but, sadly, it doesn't work (and you'll remember to run it on pom changes, especially after a few mistakes of this kind). Another option would be to use the m2eclipse plugin, this would solve this problem (having to run anything before to import the project). I've been a user of the maven-eclipse-plugin for a long time but swapped some months ago and I'm happy with it so far.
Comment: i've tried the eclipse plugin and wasn't impressed with it: slowed eclipse down and flaky. maybe i didn't have it configured properly. :/ i think i'll just log a JIRA just in case someone wants to fix it :(
Comment: @LES2 No doubts about this, m2eclipse can't be as lightweight as the maven-eclipse-plugin. And while I agree that it was not very reactive (which is why I wasn't using it as I don't need fancy pom editor or wizards), I find that things are better now. But I can't say it speeds up Eclipse indeed. I guess it's the price to pay to get better integration (I needed filtering support). I still frequently get StackOverflowError though, very annoying.
Comment: thought i would point out that nowadays the M2E plugin is pretty good and shouldn't slow Eclipse down. eclipse:eclipse is obsolete now, IMO.
Answer: You really don't want to run the maven-eclipse-plugin on every build when there's a .classpath present. I can't tell you exactly what it does to the classpaths, but this is not how it's intended to be used. The assumption is that when you run it you only run eclipse:eclipse (or some other goal).
Why do you want to keep re-running it?
Comment: i just wanted to make it easy for other devs when i change the pom file; currently, i have to tell them to run mvn eclipse:eclipse when i change something; otherwise, they get all sorts of red errors in eclipse and they wont' bother figuring them out since the maven build works; this causes them to ignore all of the really good warnings - e.g., null pointer access, etc. if i can make eclipse always up to date i'm hoping that people will pay more attention to the elcipse warnings; automation helps this. :)
Comment: A Jira, as per @Pascal Thivent, might be your best bet. Or, see if you can rig profile activations to make sure it's off when the jetty plugin is on?
Comment: it also breaks cobertura instrumentation if i'm not mistaking ... so i'd have to keep excluding plugins as more problems are found ... i guess i could log a JIRA so at least the devs are aware of it (in case they aren't already)


Do I have to check with Lyle to get Happy Room Academy rewards?

Question: In New Leaf you get your HRA score by talking to Lyle instead of in the mail. Thus far I haven't gotten any rewards, so I'm wondering: Do I have to check with Lyle when I hit a thresh hold to get a reward, or will I get it by mail automatically?
Answer: No, you do not have to talk to Lyle to receive your rewards. I hit the 10,000 point benchmark in the game last week, and when I checked my mail (which I do immediately upon loading the game if I have any), I had a letter from the HHA with the 10k tier reward attached to it. So it'll automatically be sent out without needing to check in with him.


How i display image in pdf file using dompdf in cakephp 2

Question: i using dompdf for cakephp to convert html to pdf, but the problem all image dosen't display, how i display image?
this is the
Router::parseExtensions('pdf');

and this is the AppController
public $components = array('RequestHandler');

this is app/View/Layouts/pdf/admin.ctp :
<?php
    require_once(APP . 'Vendor' . DS . 'dompdf' . DS . 'dompdf_config.inc.php');
    spl_autoload_register('DOMPDF_autoload');
    $dompdf = new DOMPDF();
    $dompdf->set_paper = 'A4';
    $dompdf->load_html(utf8_decode($content_for_layout), Configure::read('App.encoding'));
    $dompdf->render();
    echo $dompdf->output();

and this app/Controller/LocationsController :
public function admin_view_pdf($id = null) {
    $this->Location->id = $id;
    if (!$this->Location->exists()) {
        throw new NotFoundException(__('Invalid post'));
    }
    // increase memory limit in PHP
    ini_set('memory_limit', '512M');
    $this->set('post', $this->Location->read(null, $id));

    $options = array('conditions' => array('Location.' . $this->Location->primaryKey => $id));
    $location=$this->Location->find('first', $options);
    $this->set('location', $location);

    $country=new Country();
    $options2 = array('conditions' => array('Country.' . $country->primaryKey => $location['User']['country_id']));
    $this->set('country',$country->find('first',$options2));

    $city=new City();
    $options3 = array('conditions' => array('City.' . $city->primaryKey => $location['User']['city_id']));
    $this->set('city',$city->find('first',$options3));

    $permit=new Permit();
    $options4 = array('conditions' => array('Permit.' . $permit->primaryKey => $location['User']['permit_id']));
    $this->set('permit',$permit->find('first',$options4));

    $category=new Category();
    $options5 = array('conditions' => array('Category.' . $category->primaryKey => $location['Car']['category_id']));
    $this->set('category',$category->find('first',$options5));

    $subcategory=new Subcategory();
    $options6 = array('conditions' => array('Subcategory.' . $subcategory->primaryKey => $location['Car']['subcategory_id']));
    $this->set('subcategory',$subcategory->find('first',$options6));

    $country2=new Country();
    $options7 = array('conditions' => array('Country.' . $country2->primaryKey => $location['Agency']['country_id']));
    $this->set('country2',$country2->find('first',$options7));

    $city2=new City();
    $options8 = array('conditions' => array('City.' . $city2->primaryKey => $location['Agency']['city_id']));
    $this->set('city2',$city2->find('first',$options8));
}

and this is app/View/Locations/admin_view.ctp :
<?php echo $this->Html->link(__('PDF'), array('action' => 'admin_view_pdf', 'ext' => 'pdf', $location['Location']['id'])); ?>

and this app/View/Locations/pdf/admin_view_pdf.ctp :

<?php echo $this->Html->link('Location','/');?>

<?php echo $location['User']['first_name'];?>

        Primary Panel

    <?php echo $this->Html->image($location['Car']['avatar'], array('alt'=>$location['Car']['id'],'width'=>'250'));?>

<?php echo $category['Category']['name'];?>

<?php echo $subcategory['Subcategory']['name'];?>

 Car pseudo  <?php echo $location['Car']['title'];?>

 Color  <?php echo $location['Car']['color'];?>

 Serial  <?php echo $location['Car']['serial'];?>

 Model  <?php echo $location['Car']['model'];?>

 Price  <?php echo $location['Car']['price'];?>

<?php echo $this->Html->image($location['User']['picture'], array('alt'=>$location['User']['first_name'],'width'=>'150'));?>

<?php echo $location['User']['last_name'];?>

 First name <?php echo $location['User']['first_name'];?>

Id <?php echo $location['User']['id'];?>

Username <?php echo $location['User']['username'];?>

Birthday <?php echo $location['User']['birthday'];?>

Created  <?php echo $location['User']['created'];?>

Modified  <?php echo $location['User']['modified'];?>

Email <?php echo $location['User']['email'];?>

CIN  <?php echo $location['User']['cin'];?>

Role  <?php echo $location['User']['role'];?>

Status  <?php echo $location['User']['status'];?>

Permit  <?php echo $location['User']['permit'];?>

Phone  <?php echo $location['User']['phone'];?>

Country  <?php echo $country['Country']['country'];?>

City  <?php echo $city['City']['city'];?>

Permit Type  <?php echo $permit['Permit']['category'];?>

<?php echo $this->Html->image('logo.png', array('width' => '100', 'height'=>'60')); ?>

 First name <?php echo $location['Agency']['id'];?>

 First name <?php echo $location['Agency']['name'];?>

Country  <?php echo $country2['Country']['country'];?>

City  <?php echo $city2['City']['city'];?>

Panel Footer

some one can help me!
PS : all work in Locations/admin_view.ctp and is the same code in admin_view_pdf.ctp
Comment: This is unrelated, but fairly important. Get rid of `uff8_decode()` ... it's destructive to your content.
Answer: You are loading your document with $dompdf->load_html(). Because of this dompdf does not know where your document lives and assumes all paths that do not include a domain are referencing files on the local file system. Absolute paths are from the root of the file system; relative paths are relative to the location of the PHP script using dompdf.
With the above in mind ... your images are included using the image function (e.g. $this->Html->image('logo.png'); ?> which outputs a path similar to /images/logo.png. dompdf sees this path and looks for the file from the file system root (instead of, for example, /inet/www/siteroot/images/logo.png).
The easiest method of resolving the issue would be to tell CakePHP to include the domain, e.g. $this->Html->image("logo.png", array('fullBase' => true));.


Draw image in activity android

Question: I have a activity where I have two imageViews. In onTouch I recognize which imageView was clicked. Now I have a question. How I can draw new very small image in place where I clicked. I know that onTouch i have getX() and getY() and I save this position when I touch the screen, but I don't know how I can draw image in place where I clicked. My image is in drawable resources. I need to use canvas or is better way. I need draw this picture and after that I need run animation this image.
edit1: How can I set positionX and positionY my image. I have position where I click but I don't know how I can set image in this coordinates.
Answer: you should have a image view with visible attribute of FALSE and after touch (or any event you want)  set three attribute : visible = true; x = getX() and y = getY();
is it enough or explain more?
Comment: I set visibility but I don't know how i can set position this image. I know that getX() and getY() returns place where I click but how I can set this coordinates in images?
Comment: developers.android.com
go to reference tab
Answer: I see the following approach.

Replace the ImageView by a custom view derived from ImageView.
Override onDraw.
call super.onDraw to draw the image
paint your image using onDraw's canvas at the last touch position.
each time you get a touch, you need to invalidate the custom view

Draw image in activity android


Multiple websites vs single website when client's businesses overlap

Question: I work for a company that has many hotels in the country and a website where it is possible to check information about them and book a room.
The hotels have many good restaurants (2 or 3 per hotel in some cases), some of them with Michelin stars, but at the moment there is no content about them on the web nor the possibility to book a table or check the menu.
I've been asked to design the information pages and booking process for these restaurants (about 50) with these 2 targets in mind:

Customers just interested in eating, not in staying.
Customers interested in staying at the hotel (and potentially eating at the restaurants).

Should I create a different website for the restaurant side of the business or integrate the content of the restaurants into the existing website?
Thank you in advance
Comment: "...different website ... or integrate..." Do you have reasons not to do both?
Comment: There's a very significant number of considerations that go into a decision like that. This question may not be of a narrow enough scope for this forum.
Comment: @Sean Maybe you're right, but just knowing some considerations that I might not be taking into account would be helpful
Answer: There are likely some hotel and hospitality folks on this site who will give highly informed opinions. I'm not one of them, but my thought is that you should incorporate the restaurant information into the hotel websites. Here's why:

It's still useful for customers who are only eating, not staying, to know that the restaurant is located inside of a hotel. This will help them with wayfinding, parking, and other location considerations.

It's helpful for the customers who are staying in the hotel to browse the restaurant options on the hotel's website, vs. having to go out to separate websites for each restaurant.

Having Michelin starred restaurants, or other high-quality restaurants, can boost the overall brand perception of the hotel. The hotel might like to keep brand awareness on each page.

On-site search gets a whole lot easier when everything is on one site.

Customers are used to seeing all bookable amenities (such as spas) in one place when they are connected to a hotel. It's part of their decision-making process.

There might be more integrated data opportunities for cross-selling and up-selling customers who stay but don't dine, or dine but don't stay.

This isn't to say that if your hotel has a Starbucks, you now need to copy the Starbucks website on your hotel site. You can always reference the well-known chains with a simple landing page and link out to their main sites. But for independent restaurants that are operating in your facility, I think giving them space on the main site is your best bet. (Happy to hear contradictory opinions, though!)
Comment: Thanks. I'm still waiting for the hotel and hospitality folks but your comment was really helpful.


Directx const wchar_t to const char*

Question: i have a very specific coding problem with my engine. i've been following a book on how to programm an engine but now i wrote down the code(not the whole code, but only the necessary parts for it to start working.). but now i have to concert something really wierd, could anybody help me?
Note: that this a directx 11 game engine i'm talking about.
Thanks already.
The error is:   1   IntelliSense: argument of type "const wchar_t *" is incompatible with parameter of type "const char *"
and my code is:
Header file:
 #ifndef ERROR_CHECKER_H
   #define ERROR_CHECKER_H
   #include "main.cpp"

   #if defined(DEBUG) ||defined (_DEBUG)
   #define _CRTDBG_MAP_ALLOC
   #include <crtdbg.h>
   #endif

   #if defined(DEBUG) | defined(_DEBUG)
          #ifndef HR
          #define HR(x)                                         \
          {                                                     \
              HRESULT hr = (x);                                 \
              if (FAILED(hr))                                   \
              {                                                 \
              DXTrace(__FILE__, (DWORD)__LINE__, hr, L#x, true);\
              }                                                 \
          }
          #endif
          #else
          #ifndef HR
          #define HR(x) (x)
    #endif
    #endif

   #endif ERROR_CHECKER_H

The main.cpp file:
    #include <windows.h>
#include <windowsx.h>
#include <d3d11.h>
#include <d3dx11.h>
#include <d3dx10.h>
#include <DXErr.h>
#include <xnamath.h>
#include <iostream>
#include <string>
#include <cassert>
#include <ctime>
#include <algorithm>
#include <sstream>
#include <fstream>
#include <vector>
#include "Tools.h"
#include "GameTimerClass.h"
#include "Error checker.h"

And the code where the problem is:
    void Framework_App::OnResize()
{
    assert(MainDevContext);
    assert(MainD3DDevice);
    assert(mSwapChain);

    ReleaseCOM(mRenderTargetView);
    ReleaseCOM(mDepthStencilView);
    ReleaseCOM(mDepthStencilBuffer);

    HR(mSwapChain->ResizeBuffers(1, mClientWitdh, mClientHeight, DXGI_FORMAT_R8G8B8A8_UNORM, 0));
}

}

I've build the same class to do resizes and other functions but up until this function there was no problem.
This string of the code is the problem:
HR(mSwapChain->ResizeBuffers(1, mClientWitdh, mClientHeight, DXGI_FORMAT_R8G8B8A8_UNORM, 0));

Comment: The error message is pretty self-explanatory. Something takes a `char const*` but you're actually passing it a `wchar_t const*`. `DXTrace(__FILE__, (DWORD)__LINE__, hr, L#x, true);` looks like the problem. Change that `L#x` to `#x`.
Comment: http://stackoverflow.com/questions/3227270/how-to-convert-wchar-t-to-char
Answer: The definition of your HR macro is assuming you are using UNICODE rather than ASCII, but the legacy DirectX SDK (June 2010) version of DXERR.H has defined DXTrace as the ASCII version (DXTraceA) because you don't have UNICODE defined in your project.
HRESULT WINAPI DXTraceA( __in_z const char* strFile, __in DWORD dwLine, __in HRESULT hr, __in_z_opt const char* strMsg, __in BOOL bPopMsgBox );
HRESULT WINAPI DXTraceW( __in_z const char* strFile, __in DWORD dwLine, __in HRESULT hr, __in_z_opt const WCHAR* strMsg, __in BOOL bPopMsgBox );

#ifdef UNICODE
#define DXTrace DXTraceW
#else
#define DXTrace DXTraceA
#endif

To make your HR macro robust for both cases you'd either have two versions of your HR macro, or you can explicitly call DXTraceW in your HR implementation with "L#x" or DXTraceA with "#x". Preferring the UNICODE version is better.
DXTraceW(__FILE__, (DWORD)__LINE__, hr, L#x, true);\

BTW, all new applications are strongly recommended to use UNICODE only and not ASCII. The various "modern" Microsoft platforms do not support ASCII Win32 APIs.
Comment: The DXERR you are using is the old version from the legacy DirectX SDK (June 2010). You should be sure to read this [blog](http://blogs.msdn.com/b/chuckw/archive/2012/03/22/where-is-the-directx-sdk.aspx) post about the status of the DirectX SDK and the recommended newer Windows 8.x SDK. I have a new version of DXERR with source available (UNICODE only) [here](http://blogs.msdn.com/b/chuckw/archive/2012/04/24/where-s-dxerr-lib.aspx).

Directx const wchar_t to const char*


How can I add C++ Libraries (e.g. libjpeg-dev) into Windows Docker Image so that CMake can detect them?

Question: I'm setting up a Windows docker container in order to be able to compile a CMake C++ project. The CMake files grab the packages using the find_package() CMake command. For example:
find_package(JPEG CONFIG REQUIRED)
find_package(OpenSSL REQUIRED)
find_package(PNG CONFIG REQUIRED)
find_package(ZLIB CONFIG REQUIRED)

Now installing these libraries on a linux docker container was pretty simple, I just had to add a line to the 'CORE_PACKAGES'. Here's an example of what my linux dockerfile looks like.
ENV LANG=C.UTF-8 \
    PYTHONIOENCODING=UTF-8 \
    CORE_PACKAGES="\
        # ... other trivial packages omitted
        libjpeg-dev \
        libpng-dev \
        libssl-dev \
        zlib1g-dev \
    "

# Install core dependencies & updates
RUN apt-get update && \
    apt-get upgrade && \
    apt-get install -y $CORE_PACKAGES && \
    update-ca-certificates

I'm trying to create the equivalent of this snippet in a Windows dockerfile.
In my Windows dockerfile, I'm using a windows package manager called 'Choco' to install some things on windows, but Choco doesn't have things like 'libpng-dev' and 'libjpeg-dev'. So my question is, what is the standard practice for adding C++ Dev libraries on a Windows Docker container?
Answer: After doing a lot more research on different C++ Package Managers that are compatible on Windows and Linux, I came across VcPkg and highly recommend it to others who are looking for a c++ package manager.
Here are some features that I found particularly useful

CMake compatible
Easy installation via script, making it very easy to add to a docker container
Compatible with Windows, Linux, and Mac
Tons of C++ packages, and if one doesn't exist, you can open an issue to have it be added, or you can implement it yourself and open a pull request
Open source

The only downside to using Vcpkg is that there's no native way to choose an older version of a certain package.