Tuesday, 1 October 2013

Configure FTP on Ubuntu to default to a certain directory

Configure FTP on Ubuntu to default to a certain directory

I am trying to configure an FTP server on my 12.04.3 LTS machine. I am
hosting a website from /home/webuser/public/mywebsite.com/public. Now, I
want to configure the FTP server in such a way where, when an FTP user
logs in, they arrive in the /home/webuser/public/mywebsite.com/public
directory (and that's the ONLY directory that they should be able to
access).
I've tried vsftpd and pure-ftp, and I haven't had much luck. It seems that
most processes involve creating a new, FTP specific user account, and the
home directory is used to publish files to. I can do that, but I need the
uploaded files to go into the webuser's public folder.
Does anyone know how I can accomplish this?

Question about mapping onto the unit circle.

Question about mapping onto the unit circle.

Let $K$ be a positive integer and let $x$ be an angle in $(0,2ð)$.
Consider the map $g: {0,1,..K-1,K}$ onto the unit circle, given by
$g(n)=n*x (mod 2ð)$. Prove the image of $g$ divides the circle into arcs
of one, two, or three different lengths.
I can see that the arc lengths are equal whenever $x$ is of the form
$\dfrac{ð}{b}$, where $b$ is an integer, but I'm confused on how to go
about the rest. Any hints would be greatly appreciated.

Monday, 30 September 2013

Connecting a Linux client to an IPSec VPN (Vyatta)

Connecting a Linux client to an IPSec VPN (Vyatta)

I have just setup an IPSec on a Vyatta server and now I am trying to
connect a Linux client to this router. What I basically am trying to do is
to be able to make that Vyatta machine a physically connected router on
that Linux machine(the connection should also be persistent). I would like
to be able have a virtual interface which will have the Vyatta router as
it's gateway and packets originating from this Linux client will be going
to other end of IPSec VPN which again is another Vyatta machine. How this
can be done? What is the best approach?

Polite alternative word to the term "bitch" when referring to a female dog, and similar for a male dog – english.stackexchange.com

Polite alternative word to the term "bitch" when referring to a female
dog, and similar for a male dog – english.stackexchange.com

I'm not sure if this is the right site, but it seems appropriate. I'm
writing an example of constructing logic, and I need to differentiate
between an adult female dog, an adult male dog and a puppy …

Passing a variable from one php document to another

Passing a variable from one php document to another

I have this PHP code:
poster.php:
<?php
$field_password = 1;
if (empty($_POST['password'])) {
$field_password = 0;
}
?>
I want the "$field_password" variable passed to another page that is
called register.php without using code like this:
include 'poster.php';
required_once 'poster.php';
And so on, I only need the $field_password variable passed. Any ideas how
to do that? oh and btw, the more secure it is, the better.

Suggestions to improve JavaScript code to performance?

Suggestions to improve JavaScript code to performance?

I took a JavaScript challenge to finish a task related to logo of
"Breaking Bad" where letters in your first name and last name are spotted
with elements of periodic table and its respective atomic number. I wrote
the below code, any suggestions to improve performance or any best coding
practices
function Process() {
var ellist = {
"h": "1",
"he": "2",
"li": "3",
"be": "4",
"b": "5",
"c": "6",
.
.
.
"Lv":"116",
"Uus":"117",
"Uuo":"118"
};
var fname = document.getElementById("firstname");
var lname = document.getElementById("lastname");
var splits = fname.split("");
var value;
for (var i = 0; i < splits.length; i++) {
var onevalue = fname.indexOf(splits[i]);
var singlev = fname.substring(onevalue, onevalue + 1);
var doublev = fname.substring(onevalue, onevalue + 2);
var triplev = fname.substring(onevalue, onevalue + 3);
if (ellist[splits[i]] || ellist[doublev] || ellist[triplev]) {
value = splits[i];
if (ellist[doublev] || ellist[triplev]) {
value = ellist[doublev];
if (ellist[triplev]) {
value = ellist[triplev];
// some code here
}
// some code here
}
// some code here
}
}
Using the Process() function which contains the logic. The object ellist
contains the list of elements of periodic table with its atomic number.
First name is taken from textbox on webpage and stored in fname and
similarly the last name in lname and in the for loop it contains the code
which checks whether the firstname contains the string which matches the
elemetns of periodic table. Any suggestions?

Sunday, 29 September 2013

How to make WPF input control show virtual Keyboard when it got focus in touch screen

How to make WPF input control show virtual Keyboard when it got focus in
touch screen

For our WPF application, when it runs on touch screen(Surface Pro .etc),
the TextBox/Password control cannot show virtual keyboard when they get
focused.
Any good way to implement this feature in WPF?