Wednesday, 11 September 2013

Which preference controls whether multiple selection is available to Package Explorer in Eclipse Juno?

Which preference controls whether multiple selection is available to
Package Explorer in Eclipse Juno?

In previous versions of Eclipse, if I selected two files (or directories)
in Package Explorer, I could then right click and use Compare With -> Each
Other.
Since moving to Juno, I have found that my workspaces now only allow
either a single file or a contiguous range of file to be selected. In
other words, Click...Shift+Click does what I expect, but
Click...Ctrl+Click doesn't.
Since this works fine for colleagues working with exactly the same version
of eclipse (we all module load the same Eclipse deployment) I have to
assume that it is a preference of some kind.
Unfortunately, after having gone through the preferences page with a fine
tooth comb, I can't see anything which might control this behaviour.
So, can anyone think of a reason why multi-selection may be failing or
disables in my explorer, but not that of some of my colleagues?

‘insert’ was not declared in this scope

'insert' was not declared in this scope

I have two files
bst.h
using namespace std;
#ifndef BINARY_SEARCH_TREE
#define BINARY_SEARCH_TREE
template<class t>
class bstnode{
public: t key;
bstnode *left,*right;
bstnode(){left=right=NULL;}
bstnode(const t& el, bstnode* l=0,bstnode* r=0){
key=l;left=l;right=r;
}
};
template<class t>
class bst{
public: bstnode<t>* root;
bst(){root=NULL;}
~bst(){}
bool isempty()const{return root==NULL;}
bstnode<t>* insert(bstnode<t>*,const t&);
//void delete(const t& el);
//void clear(bstnode<t>*);
t* search(bstnode<t>*,const t&) const;
void preorder(bstnode<t>*);
void inorder(bstnode<t>*);
void postorder(bstnode<t>*);
};

Tuesday, 10 September 2013

How to keep the Google place after coming back from another page?

How to keep the Google place after coming back from another page?

I am using google autocomplete textbox and a map to show the place entered
in the textbox. following code will work on button click to show map.
function SetStreet() {
$('#map-canvas').fadeIn('slow', function() {
google.maps.event.trigger(map, 'resize');
if (checkPlace == "placeselected") {
map.setCenter(place.geometry.location);
map.setZoom(15);
marker.setPosition(place.geometry.location);
marker.setVisible(true);
}
});
}
When i navigate to another page and comes back, currently map not showing
the place.Is there any way to keep the
place.geometry.locationand to show the place in map again with out
triggering google maps textbox.

PHP www-data permissions failing - but only sometimes

PHP www-data permissions failing - but only sometimes

I am writing code to have users upload a file, then parse that file and
save both the upload and the output to the server. However, this code
works only sporadically - sometimes it will work, then a little later it
will stop or vice versa.
This is not an issue of file permissions - the folders and files in
question all are owned by a group that www-data is in and have 664
permissions (plus it works some of the time, so must have permissions).
Even when it fails, a call to is_writable() returns true right before file
operations fail.
For the first part of the code where this fails, I'm storing the file path
to copy to in $uplnm, and want to delete any previously existing data that
exists at this location. Thus I have the following two lines:
if(is_writable($uplnm)) echo "Writable<br>";
if(file_exists($uplnm)) unlink($uplnm);
A good portion of the time, I get the output:
Writable
Warning: unlink(/var/sandbox/File.txt): Permission denied in
/var/www/Upload.php on line 37
I've seen some suggestions that one should keep trying to unlink with a
loop until it works, but since I'll be running parsing later though a
shell script (which can be computationally intensive and require
intermediate read/writes) that's not an option here. I also can't change
to 666 permissions because I want to protect these folders and files from
changes by other users.
So I was wondering:
Is there a reason that php will sometimes fail to be able to make file
system changes, even with appropriate permissions?
Can I do anything to make sure that the file system changes won't fail?

Using virtual machines for OS compatibility testing of software

Using virtual machines for OS compatibility testing of software

I need to test a software across different operating systems for
compatibility. Is using a virtual machine with different OSs installed a
good way to test for compatibility? Is there a repository somewhere where
I can use pre-built virtual machines for this?

Arrange Toric Surfaces on top of each other

Arrange Toric Surfaces on top of each other

How can I have these two surfaces on top of each other in the y-plane. I
tried with this code but it didn't work.Can someone offer ideas?I have
tried several ways but they all couldn't work Thanks.
Cx=1/80;
Cy=1/70;
M=6;
Dr=20;
n=2^(M-1);
Vertex=[0 0 0];
phi = (linspace(-pi,pi,n));
r=(linspace(0,Dr,n))';
x = -r*cos(phi)+Vertex(1);
y = -r*sin(phi)+Vertex(2);
z=(Cx*x.^2+Cy*y.^2)./(1+(1-sqrt(Cx*x.^2+Cy*y.^2).^2)./(x.^2+y.^2))+Vertex(3);
surf(z,x,y)
axis
set(gca, 'YDir','reverse');
xlabel('X-axis','fontweight','bold');
ylabel('Z-axis','fontweight','bold');
zlabel('Y-axis','fontweight','bold');
hold on
Vertex=[pi pi pi];
phi = (linspace(-pi,pi,n));
r=(linspace(0,Dr,n))';
x = -r*cos(phi)+Vertex(1);
y = -r*sin(phi)+Vertex(2);
z=(Cx*x.^2+Cy*y.^2)./(1+(1-sqrt(Cx*x.^2+Cy*y.^2).^2)./(x.^2+y.^2))+Vertex(3);
surf(z,x,y)
axis
set(gca, 'YDir','reverse');
xlabel('X-axis','fontweight','bold');
ylabel('Z-axis','fontweight','bold');
zlabel('Y-axis','fontweight','bold');

Oracle 11g query strange behavior

Oracle 11g query strange behavior

I'm trying to write a script that will modify log files for oracle database.
Currently I've encountered a very strange behavior when writing the piece
of code that should have switched logfile if the current one is active.
The problem is:
When I execute the following script:
DECLARE
g_status v$log.status%type;
BEGIN
select status into g_status from v$log where group# = 2;
if g_status = 'CURRENT' then
EXECUTE IMMEDIATE('alter system switch logfile;');
end if;
END;
/
I get
SQL> @testSwitch
PL/SQL procedure successfully completed.
But when I change just one number
DECLARE
g_status v$log.status%type;
BEGIN
select status into g_status from v$log where group# = 1;
if g_status = 'CURRENT' then
EXECUTE IMMEDIATE('alter system switch logfile;');
end if;
END;
/
It gives me
SQL> @testSwitch
DECLARE
*
ERROR at line 1:
ORA-00911: invalid character
ORA-06512: at line 6
I'm not sure, that this script will work properly and really switch
logfile, but I don't get why does THIS happen.
Can anyone help?