Copy latest created directory
I would like to make a second backup from the latest created backup. So I
tried the shell command:
last='ls -tr | tail -1'
cp -r /path/.../"$last" /path/.../backup/
but it copies a randome backup.
It is working perfect with .zip and .tar files but not with folders as I
need it here.
I googled for a solution but couldn´t find anything related to this, I
hope you can help me.
It would also be possible to use the name of directory which is for example:
2013-09-27-05-22-45
Tuesday, 1 October 2013
Monday, 30 September 2013
How to get virtualized SR-IOV Infiniband interface UP?
How to get virtualized SR-IOV Infiniband interface UP?
I've spent several days on this now and I've managed to get SR-IOV working
with the Mellanox Infiniband card using the latest firmware.
The Virtual Functions appear in Dom0 as
06:00.1 Network controller: Mellanox Technologies MT27500 Family
[ConnectX-3 Virtual Function] 06:00.2 Network controller: Mellanox
Technologies MT27500 Family [ConnectX-3 Virtual Function] 06:00.3 Network
controller: Mellanox Technologies MT27500 Family [ConnectX-3 Virtual
Function] 06:00.4 Network controller: Mellanox Technologies MT27500 Family
[ConnectX-3 Virtual Function]
I've then detached 06:00.1 from Dom0 and assigned it to xen-pciback.
I've passed this into a Xen test domain.
lspci inside the test DomU shows:
00:01.1 Network controller: Mellanox Technologies MT27500 Family
[ConnectX-3 Virtual Function]
I have the following modules loaded in DomU
mlx4_ib
rdma_ucm
ib_umad
ib_uverbs
ib_ipoib
dmesg output for mlx4 drivers shows:
[ 11.956787] mlx4_core: Mellanox ConnectX core driver v1.1 (Dec, 2011)
[ 11.956789] mlx4_core: Initializing 0000:00:01.1
[ 11.956859] mlx4_core 0000:00:01.1: enabling device (0000 -> 0002)
[ 11.957242] mlx4_core 0000:00:01.1: Xen PCI mapped GSI0 to IRQ30
[ 11.957581] mlx4_core 0000:00:01.1: Detected virtual function - running
in slave mode
[ 11.957606] mlx4_core 0000:00:01.1: Sending reset
[ 11.957699] mlx4_core 0000:00:01.1: Sending vhcr0
[ 11.976090] mlx4_core 0000:00:01.1: HCA minimum page size:512
[ 11.976672] mlx4_core 0000:00:01.1: Timestamping is not supported in
slave mode.
[ 12.068079] <mlx4_ib> mlx4_ib_add: mlx4_ib: Mellanox ConnectX
InfiniBand driver v1.0 (April 4, 2008)
[ 12.184072] mlx4_core 0000:00:01.1: mlx4_ib: multi-function enabled
[ 12.184075] mlx4_core 0000:00:01.1: mlx4_ib: operating in qp1 tunnel mode
I've even got the ib0 device appearing.
ib0 Link encap:UNSPEC HWaddr
80-00-05-49-FE-80-00-00-00-00-00-00-00-00-00-00
inet addr:10.10.10.10 Bcast:10.10.10.255 Mask:255.255.255.0
UP BROADCAST MULTICAST MTU:2044 Metric:1
RX packets:117303 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:256
RX bytes:6576132 (6.5 MB) TX bytes:0 (0.0 B)
I can even locally ping 10.10.10.10.
However, those pings aren't sent out on the infiniband fabric.
It appears to be because the link is down. ibstat shows:
CA 'mlx4_0'
CA type: MT4100
Number of ports: 1
Firmware version: 2.30.3000
Hardware version: 0
Node GUID: 0x001405005ef41f25
System image GUID: 0x002590ffff175727
Port 1:
State: Down
Physical state: LinkUp
Rate: 10
Base lid: 9
LMC: 0
SM lid: 1
Capability mask: 0x02514868
Port GUID: 0x0000000000000000
How do I get it UP? the domU link is UP but not the VF one?
I've spent several days on this now and I've managed to get SR-IOV working
with the Mellanox Infiniband card using the latest firmware.
The Virtual Functions appear in Dom0 as
06:00.1 Network controller: Mellanox Technologies MT27500 Family
[ConnectX-3 Virtual Function] 06:00.2 Network controller: Mellanox
Technologies MT27500 Family [ConnectX-3 Virtual Function] 06:00.3 Network
controller: Mellanox Technologies MT27500 Family [ConnectX-3 Virtual
Function] 06:00.4 Network controller: Mellanox Technologies MT27500 Family
[ConnectX-3 Virtual Function]
I've then detached 06:00.1 from Dom0 and assigned it to xen-pciback.
I've passed this into a Xen test domain.
lspci inside the test DomU shows:
00:01.1 Network controller: Mellanox Technologies MT27500 Family
[ConnectX-3 Virtual Function]
I have the following modules loaded in DomU
mlx4_ib
rdma_ucm
ib_umad
ib_uverbs
ib_ipoib
dmesg output for mlx4 drivers shows:
[ 11.956787] mlx4_core: Mellanox ConnectX core driver v1.1 (Dec, 2011)
[ 11.956789] mlx4_core: Initializing 0000:00:01.1
[ 11.956859] mlx4_core 0000:00:01.1: enabling device (0000 -> 0002)
[ 11.957242] mlx4_core 0000:00:01.1: Xen PCI mapped GSI0 to IRQ30
[ 11.957581] mlx4_core 0000:00:01.1: Detected virtual function - running
in slave mode
[ 11.957606] mlx4_core 0000:00:01.1: Sending reset
[ 11.957699] mlx4_core 0000:00:01.1: Sending vhcr0
[ 11.976090] mlx4_core 0000:00:01.1: HCA minimum page size:512
[ 11.976672] mlx4_core 0000:00:01.1: Timestamping is not supported in
slave mode.
[ 12.068079] <mlx4_ib> mlx4_ib_add: mlx4_ib: Mellanox ConnectX
InfiniBand driver v1.0 (April 4, 2008)
[ 12.184072] mlx4_core 0000:00:01.1: mlx4_ib: multi-function enabled
[ 12.184075] mlx4_core 0000:00:01.1: mlx4_ib: operating in qp1 tunnel mode
I've even got the ib0 device appearing.
ib0 Link encap:UNSPEC HWaddr
80-00-05-49-FE-80-00-00-00-00-00-00-00-00-00-00
inet addr:10.10.10.10 Bcast:10.10.10.255 Mask:255.255.255.0
UP BROADCAST MULTICAST MTU:2044 Metric:1
RX packets:117303 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:256
RX bytes:6576132 (6.5 MB) TX bytes:0 (0.0 B)
I can even locally ping 10.10.10.10.
However, those pings aren't sent out on the infiniband fabric.
It appears to be because the link is down. ibstat shows:
CA 'mlx4_0'
CA type: MT4100
Number of ports: 1
Firmware version: 2.30.3000
Hardware version: 0
Node GUID: 0x001405005ef41f25
System image GUID: 0x002590ffff175727
Port 1:
State: Down
Physical state: LinkUp
Rate: 10
Base lid: 9
LMC: 0
SM lid: 1
Capability mask: 0x02514868
Port GUID: 0x0000000000000000
How do I get it UP? the domU link is UP but not the VF one?
Weird consistent EC2 CPU spikes
Weird consistent EC2 CPU spikes
One of our m1.small EC2 instances, running a Node.js web server, regularly
gets some CPU spikes. It doesn't seem to matter what the peak CPU reaches,
but whenever our traffic approaches the max for the day, it spikes, and
the same happens when it starts to decline.
This happens when it approaches 80% on a weekday, or even if it appraoches
40% at the weekend.
Does anyone have any idea what could be causing this? Or how I could debug
this and stop it from happening? I've checked the cron jobs and theres
nothing that would cause this.
I've attached a graph to help me explain the scenario.
Thanks.
One of our m1.small EC2 instances, running a Node.js web server, regularly
gets some CPU spikes. It doesn't seem to matter what the peak CPU reaches,
but whenever our traffic approaches the max for the day, it spikes, and
the same happens when it starts to decline.
This happens when it approaches 80% on a weekday, or even if it appraoches
40% at the weekend.
Does anyone have any idea what could be causing this? Or how I could debug
this and stop it from happening? I've checked the cron jobs and theres
nothing that would cause this.
I've attached a graph to help me explain the scenario.
Thanks.
Users in hawt.io in an standalone java app
Users in hawt.io in an standalone java app
I would like to know how can I have users for hawt.io when using it in an
standalone java app. I believe that you need to define a realm like
containers do, but is there any guide or easy way to do this? I just want
to protect my hawt.io instance with user and password.
I would like to know how can I have users for hawt.io when using it in an
standalone java app. I believe that you need to define a realm like
containers do, but is there any guide or easy way to do this? I just want
to protect my hawt.io instance with user and password.
XSLT string replace, multiple variables
XSLT string replace, multiple variables
I know there is already a question out there about replacing strings in
XSLT, but I need a conditional statement to replace one string with
multiple variables.
Here is my code:
<xsl:template name="section-01">
<xsl:call-template name="table-open"/>
<xsl:text disable-output-escaping="yes"><table
style="text-align=center;"></xsl:text>
<xsl:call-template name="display-gen">
<xsl:with-param name="value" select="./z30-collection"/>
<xsl:with-param name="width" select="'30%'"/>
</xsl:call-template>
<xsl:call-template name="display-gen">
<xsl:with-param name="value" select="./call-no-piece-01"/>
<xsl:with-param name="width" select="'30%'"/>
</xsl:call-template>
<xsl:call-template name="table-close"/>
</xsl:template>
I need a statement to replace "./z30-collection"
If ./z30-collection = "Deposit" replace with "DEP"
if ./z30-collection = "General" replace with "GEN"
if ./z30-collection = "Storage" replace with "STORE"
etc...
Any help would be greatly appreciated!
I know there is already a question out there about replacing strings in
XSLT, but I need a conditional statement to replace one string with
multiple variables.
Here is my code:
<xsl:template name="section-01">
<xsl:call-template name="table-open"/>
<xsl:text disable-output-escaping="yes"><table
style="text-align=center;"></xsl:text>
<xsl:call-template name="display-gen">
<xsl:with-param name="value" select="./z30-collection"/>
<xsl:with-param name="width" select="'30%'"/>
</xsl:call-template>
<xsl:call-template name="display-gen">
<xsl:with-param name="value" select="./call-no-piece-01"/>
<xsl:with-param name="width" select="'30%'"/>
</xsl:call-template>
<xsl:call-template name="table-close"/>
</xsl:template>
I need a statement to replace "./z30-collection"
If ./z30-collection = "Deposit" replace with "DEP"
if ./z30-collection = "General" replace with "GEN"
if ./z30-collection = "Storage" replace with "STORE"
etc...
Any help would be greatly appreciated!
Sunday, 29 September 2013
PageViewer NullPointer on Adding views
PageViewer NullPointer on Adding views
Hello fellow programmers.
Just a glitch here as I am new to these Pageviewer.
Im following this tutorial Android View Pager
and having quite issue
Ive change the required parameters of the Adapter and just past the cursor
(which im quite sure that has 14 counts)
Code are as follows for my Adapter:
public class PagerAdapterInVenue extends PagerAdapter{
private LayoutInflater inflater;
private Context context;
private Cursor cursorFeatured;
public PagerAdapterInVenue(Cursor cursorFeatured, Context context) {
this.cursorFeatured = cursorFeatured;
this.context = context;
}
@Override
public int getCount() {
return cursorFeatured.getCount();
}
@Override
public boolean isViewFromObject(View view, Object object) {
return view == ((RelativeLayout) object);
}
@Override
public Object instantiateItem(ViewGroup container, int position) {
// Declare Variables
inflater = (LayoutInflater) context
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View itemView = inflater.inflate(R.layout.viewpager_item, container,
false);
cursorFeatured.moveToNext();
ImageView fullImage = (ImageView) itemView.findViewById(R.id.imageFull);
if (cursorFeatured.getString(7).toString().equals("")){
}
else
{
ImageLoaderUtil.getInstance(context).displayImage(cursorFeatured.getString(7).toString(),
fullImage);
}
((ViewPager) container).addView(itemView);
return itemView;
}
@Override
public void destroyItem(ViewGroup container, int position, Object object) {
// Remove viewpager_item.xml from ViewPager
((ViewPager) container).removeView((RelativeLayout) object);
}
}
binding it to my activity was
pagerAdapter = new PagerAdapterInVenue(cursorFeatured, MainPage.this);
pagerFeatured.setAdapter(pagerAdapter);
But still Im getting a weird error saying on my Logcat
09-30 09:53:24.650: E/AndroidRuntime(2268): FATAL EXCEPTION: main
09-30 09:53:24.650: E/AndroidRuntime(2268): java.lang.NullPointerException
09-30 09:53:24.650: E/AndroidRuntime(2268): at
com.example.androidinvenue.PagerAdapterInVenue.instantiateItem(PagerAdapterInVenue.java:48)
09-30 09:53:24.650: E/AndroidRuntime(2268): at
android.support.v4.view.ViewPager.addNewItem(ViewPager.java:829)
09-30 09:53:24.650: E/AndroidRuntime(2268): at
android.support.v4.view.ViewPager.populate(ViewPager.java:1044)
09-30 09:53:24.650: E/AndroidRuntime(2268): at
android.support.v4.view.ViewPager.populate(ViewPager.java:911)
09-30 09:53:24.650: E/AndroidRuntime(2268): at
android.support.v4.view.ViewPager.onMeasure(ViewPager.java:1432)
09-30 09:53:24.650: E/AndroidRuntime(2268): at
android.view.View.measure(View.java:15518)
09-30 09:53:24.650: E/AndroidRuntime(2268): at
android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4825)
09-30 09:53:24.650: E/AndroidRuntime(2268): at
android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1404)
09-30 09:53:24.650: E/AndroidRuntime(2268): at
android.widget.LinearLayout.measureVertical(LinearLayout.java:695)
09-30 09:53:24.650: E/AndroidRuntime(2268): at
android.widget.LinearLayout.onMeasure(LinearLayout.java:588)
09-30 09:53:24.650: E/AndroidRuntime(2268): at
android.view.View.measure(View.java:15518)
09-30 09:53:24.650: E/AndroidRuntime(2268): at
android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4825)
My XML is
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:gravity="center"
android:padding="10dp" >
<ImageView
android:id="@+id/imageFull"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentRight="true"
android:background="#000000"
android:padding="1dp" />
</RelativeLayout>
Sorry for posting long codes
Thanks in advance
Hello fellow programmers.
Just a glitch here as I am new to these Pageviewer.
Im following this tutorial Android View Pager
and having quite issue
Ive change the required parameters of the Adapter and just past the cursor
(which im quite sure that has 14 counts)
Code are as follows for my Adapter:
public class PagerAdapterInVenue extends PagerAdapter{
private LayoutInflater inflater;
private Context context;
private Cursor cursorFeatured;
public PagerAdapterInVenue(Cursor cursorFeatured, Context context) {
this.cursorFeatured = cursorFeatured;
this.context = context;
}
@Override
public int getCount() {
return cursorFeatured.getCount();
}
@Override
public boolean isViewFromObject(View view, Object object) {
return view == ((RelativeLayout) object);
}
@Override
public Object instantiateItem(ViewGroup container, int position) {
// Declare Variables
inflater = (LayoutInflater) context
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View itemView = inflater.inflate(R.layout.viewpager_item, container,
false);
cursorFeatured.moveToNext();
ImageView fullImage = (ImageView) itemView.findViewById(R.id.imageFull);
if (cursorFeatured.getString(7).toString().equals("")){
}
else
{
ImageLoaderUtil.getInstance(context).displayImage(cursorFeatured.getString(7).toString(),
fullImage);
}
((ViewPager) container).addView(itemView);
return itemView;
}
@Override
public void destroyItem(ViewGroup container, int position, Object object) {
// Remove viewpager_item.xml from ViewPager
((ViewPager) container).removeView((RelativeLayout) object);
}
}
binding it to my activity was
pagerAdapter = new PagerAdapterInVenue(cursorFeatured, MainPage.this);
pagerFeatured.setAdapter(pagerAdapter);
But still Im getting a weird error saying on my Logcat
09-30 09:53:24.650: E/AndroidRuntime(2268): FATAL EXCEPTION: main
09-30 09:53:24.650: E/AndroidRuntime(2268): java.lang.NullPointerException
09-30 09:53:24.650: E/AndroidRuntime(2268): at
com.example.androidinvenue.PagerAdapterInVenue.instantiateItem(PagerAdapterInVenue.java:48)
09-30 09:53:24.650: E/AndroidRuntime(2268): at
android.support.v4.view.ViewPager.addNewItem(ViewPager.java:829)
09-30 09:53:24.650: E/AndroidRuntime(2268): at
android.support.v4.view.ViewPager.populate(ViewPager.java:1044)
09-30 09:53:24.650: E/AndroidRuntime(2268): at
android.support.v4.view.ViewPager.populate(ViewPager.java:911)
09-30 09:53:24.650: E/AndroidRuntime(2268): at
android.support.v4.view.ViewPager.onMeasure(ViewPager.java:1432)
09-30 09:53:24.650: E/AndroidRuntime(2268): at
android.view.View.measure(View.java:15518)
09-30 09:53:24.650: E/AndroidRuntime(2268): at
android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4825)
09-30 09:53:24.650: E/AndroidRuntime(2268): at
android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1404)
09-30 09:53:24.650: E/AndroidRuntime(2268): at
android.widget.LinearLayout.measureVertical(LinearLayout.java:695)
09-30 09:53:24.650: E/AndroidRuntime(2268): at
android.widget.LinearLayout.onMeasure(LinearLayout.java:588)
09-30 09:53:24.650: E/AndroidRuntime(2268): at
android.view.View.measure(View.java:15518)
09-30 09:53:24.650: E/AndroidRuntime(2268): at
android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4825)
My XML is
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:gravity="center"
android:padding="10dp" >
<ImageView
android:id="@+id/imageFull"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentRight="true"
android:background="#000000"
android:padding="1dp" />
</RelativeLayout>
Sorry for posting long codes
Thanks in advance
I expect the program prints the numbers 0 to 99, but when I run the code I see 100 lines of 99
I expect the program prints the numbers 0 to 99, but when I run the code I
see 100 lines of 99
I have a class foo:
class foo{
public:
int i;
};
And a class bar:
class bar{
public:
foo* foo_;
};
And a code similar to:
int i=0;
vector<bar*> fs;
while(i<100){
foo f;
f.i = i;
bar* b = new bar;
b->foo_ = &f;
fs.push_back(b);
i++;
}
I expect that each bar->foo_ refer to a different foo, so when i have:
for(i=0;i<fs.size();i++){
cout << (fs[i]->foo_->i) << "\n";
}
I expect the program prints the numbers 0 to 99, but when i run the code i
see 100 lines of 99!!
why all pointers refers to the last object?
see 100 lines of 99
I have a class foo:
class foo{
public:
int i;
};
And a class bar:
class bar{
public:
foo* foo_;
};
And a code similar to:
int i=0;
vector<bar*> fs;
while(i<100){
foo f;
f.i = i;
bar* b = new bar;
b->foo_ = &f;
fs.push_back(b);
i++;
}
I expect that each bar->foo_ refer to a different foo, so when i have:
for(i=0;i<fs.size();i++){
cout << (fs[i]->foo_->i) << "\n";
}
I expect the program prints the numbers 0 to 99, but when i run the code i
see 100 lines of 99!!
why all pointers refers to the last object?
Subscribe to:
Posts (Atom)