Thursday, 3 October 2013

How to copy only the newest sub directory to a destination linux shell script

How to copy only the newest sub directory to a destination linux shell script

I have a parent folder where every day a new subdirectory is automatically
created. The subdirectory naming format is '2013-10-02T1430+0000'. Later
on today the new subdirectory created will be named
''2013-10-03T1430+0000'.
I need a script which will on a schedule automatically copy only the
contents of the latest subdirectory created to another folder.
I have the cp command down ok but I need to somehow subsitute in the cp
source the latest subdirectory name. After doing some research I found the
following command will return the latest or newest subdirectory. ls -tr
ParentFolder | tail -1. How do I get the result of this command to be
placed into the cp command? Is there an easier way of doing this?
Many thanks to all in advance.

Wednesday, 2 October 2013

ruby refactor redundant code block

ruby refactor redundant code block

I have some pretty straight-forward ruby logic below. I was wondering if
there was any way to make it more DRY, or perhaps if there was a more ruby
way to do this.
if @status == :status1
text.each_slice(3) do |x|
x.flatten!
row = Array.new
row << x[0...num].join(' ')
num.upto(-1) { |i| row << x[i] }
table << row
end
elsif @status == :status2
text.each do |x|
row = Array.new
row << x[0...num].join(' ')
num.upto(-1) { |i| row << x[i] }
table << row
end
end

WiX 3.7: How to add or update a dialog during uninstall?

WiX 3.7: How to add or update a dialog during uninstall?

I need to add a dialog box that would pop up during complete uninstall
(not major upgrade) right after the confirmation ("Are you sure you want
to uninstall this product?") dialog. This dialog would prompt the user to
answer a question and based on the response, set up a property that would
be used in the condition for the RemoveRegistryKey element (i.e. it will
remove a registry key only if the user selects an option to delete the
key).
I have an idea how to add a dialog to the install sequence (I am using a
modified WixUI_InstalLDir sequence to which I added a custom dialog I need
during installation), but I can't find any references that would explain
how to add a custom dialog to an uninstall sequence. It would be even
better if I could modify the uninstall confirmation dialog, so the user
would see one dialog instead of two. An the key thing would be to be able
to set up a property that could be used in the component condition.
Is this possible? Are there any examples how to do this?

Can't modify Site.Master in asp.net

Can't modify Site.Master in asp.net

I am new to .net technology and I have got one project to update some
minor changes.
I just need to add some links to site.Master page and I am not able to
change its code. It seems like I can add a new link if I change the page
to design view but the change does not reflect in source view.
I am using visual studio 2010
Please help and let me know if you need more information

how to virtualize an application (not desktop) in a cloud

how to virtualize an application (not desktop) in a cloud

How can I build a system that runs an application in a cloud so that I see
the application front-end (not the desktop) in a browser?
In other words, I am aware that Vmware or Virtualbox virtualize a complete
SO. But what technology exists to lauch in the virtualized SO an
application, and view the application from a browser? Notice that only the
application must be been in the browser, not the desktop.
(in case this question is more appropiate in another stack site, please
let me know)

Tuesday, 1 October 2013

For transverse maps, $T_x(f^{-1}(Z)=df^{-1}_x(T_{f(x)}(Z))$

For transverse maps, $T_x(f^{-1}(Z)=df^{-1}_x(T_{f(x)}(Z))$

Let $f: X \to Y$ be a map transversal to a submanifold $Z$ in $Y$. Then $W
= f^{-1}(Z)$ is a submanifold of $X$. Prove that $T_x(W)$ is the preimage
of $T_{f(x)}(Z)$ under the linear map $df_x:T_x(X) \to T_{f(x)}(Y)$. the
linear map $df_x:T_x(X)¨T_{f(x)}(Y)$.
My approach to the problem was to create parametrizations, $\phi$ and
$\psi$ of neighborhoods of $f(x)$ and $x$ (choosing all of Euclidean space
as the domain. We then take $y\in T_x(f^{-1}(Z)$ and note that there is
$v$ such that $y=d\psi_x(v)$. Now let $\pi$ as either the submersion or
embedding of the two Euclidean spaces we are mapping from. Then
$df^{-1}_x(d\phi_{f(x)}(d\pi(v))=d\psi_x(v)=y$ by the chain rule so $y\in
df^{-1}_x(T_{f(x)}(Z))$.
I do the other side mutatis mutandis.
Does this actually work, or have I made a critical error? (I'm personally
leaning toward the second)
If anyone could give some tips, I would appreciate it.

iOS 6 Modal Segue as Form Sheet Close Previous Modal

iOS 6 Modal Segue as Form Sheet Close Previous Modal

I'm working on iOS6 with storyboards.
I have a button and on tapping it, there's a Modal Segue (with
Presentation as Form Sheet). The problem I'm facing is the ViewController
where we have the button is also a Modal (again presentation as Form
Sheet). When I dismiss the last Modal the previous one is still being
shown.
I'm attempting to dismiss all using:
[self dismissViewControllerAnimated:YES completion:nil];
which clearly doesn't work. Any advice please.
Thanks.

Exit vim more quickly – unix.stackexchange.com

Exit vim more quickly – unix.stackexchange.com

I use Vim mainly for quick edits rather than long work sessions. In that
sense, I find the keyboard sequence for quitting especially laborious:
Esc, Shift: wq Enter. How to quit Vim (possibly saving …

Issues installing MySQL server on Ubuntu 13.04

Issues installing MySQL server on Ubuntu 13.04

I'm currently trying to install a MySQL server on my Ubuntu 13.04 machine.
The problem is, when I try to install it, I get error messages indicating
that not all packages could be downloaded. When I run sudo apt-get install
mysql-server, and after hanging for a while at reading headers, the
console reads as follows:
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
libaio1 libdbd-mysql-perl libdbi-perl libhtml-template-perl
libmysqlclient18 libnet-daemon-perl libplrpc-perl mysql-client-5.5
mysql-common mysql-server-5.5 mysql-server-core-5.5
Suggested packages:
libipc-sharedcache-perl tinyca mailx
The following NEW packages will be installed:
libaio1 libdbd-mysql-perl libdbi-perl libhtml-template-perl
libmysqlclient18 libnet-daemon-perl libplrpc-perl mysql-client-5.5
mysql-common mysql-server mysql-server-5.5 mysql-server-core-5.5
0 upgraded, 12 newly installed, 0 to remove and 3 not upgraded.
Need to get 8,077 kB/24.5 MB of archives.
After this operation, 84.9 MB of additional disk space will be used.
Do you want to continue [Y/n]? y
Err http://us.archive.ubuntu.com/ubuntu/ raring-updates/main
mysql-client-5.5 i386 5.5.32-0ubuntu0.13.04.1
Connection failed [IP: 91.189.91.13 80]
Err http://security.ubuntu.com/ubuntu/ raring-security/main
mysql-client-5.5 i386 5.5.32-0ubuntu0.13.04.1
Connection failed [IP: 91.189.92.190 80]
Failed to fetch
http://security.ubuntu.com/ubuntu/pool/main/m/mysql-5.5/mysql-client-5.5_5.5.32-0ubuntu0.13.04.1_i386.deb
Connection failed [IP: 91.189.92.190 80]
E: Unable to fetch some archives, maybe run apt-get update or try with
--fix-missing?
I've tried the suggested fix or running apt-get update and such, I've made
sure I have no connections blocked, I've restarted, uninstalled,
reinstalled, etc, all to no avail. I've been searching the web all day for
solutions I haven't yet tried, but most people with this issue are running
an older version of Ubuntu. (By the way, I did try the solution here)
Suggestions?