Prototype working ternary device
Quantum computing with qbits and so on is one thing, but what exactly do we stand to gain from a CPU which works on a ternary basis, where each 'bit' is ether yes/no/maybe (or true/false/filenotfound)?
Is it simply an academic exercise or could it change processor design?
I have one node(ImageView) that displays an image and another node(rectangle) that resides on top of it. The behavior I need is that when the mouse is dragged(press-drag-release gesture) over the rectangle, both the nodes should move coherently. My thought process goes in the following direction:
• Move both the nodes by the same distance in the direction of the drag.
For this option(maybe there are more options) I need the distance between the start and end of the mouse drags. I tried capturing the start and end coordinates of the drag but have been unsuccessful. I think I am getting lost in which handlers to implement.
The code I have is below:
import javafx.event.EventHandler;
import javafx.geometry.Rectangle2D;
import javafx.scene.image.ImageView;
import javafx.scene.input.MouseEvent;
public class MyView
{
double mouseDragStartX;
double mouseDragEndX;
double mouseDragStartY;
double mouseDragEndY;
ImageView imageView;
public MyView()
{
imageView = new ImageView("C:\\temp\\test.png");
}
private void setRectangleEvents(final MyObject myObject)
{
myObject.getRectangle().setOnMousePressed(new EventHandler<MouseEvent>()
{
@Override
public void handle(MouseEvent mouseEvent)
{
mouseDragStartX = mouseEvent.getX();
mouseDragStartY = mouseEvent.getY();
mouseEvent.consume();
}
});
myObject.getRectangle().setOnMouseReleased(new EventHandler<MouseEvent>()
{
public void handle(MouseEvent mouseEvent)
{
mouseDragEndX = mouseEvent.getX();
mouseDragEndY = mouseEvent.getY();
myObjectDraggedHandler();
}
});
}
private void myObjectDraggedHandler()
{
Rectangle2D viewport = this.imageView.getViewport();
double newX = this.imageView.getImage().getWidth()
+ (mouseDragEndX - mouseDragStartX);
double newY = this.imageView.getImage().getHeight()
+ (mouseDragEndY - mouseDragStartY);
this.imageView.setViewport(new Rectangle2D(newX, newY, viewport.getWidth(), viewport
.getHeight()));
}
}
P.S: This code is just for indicating what I am trying to implement and will not compile correctly.
Or maybe my question should just have been:
How to capture the length or span of a mouse drag?
I need to automate packing of Java EE projects into EAR archive in Eclipse. The most easy way, I think, is using Ant script. But writing of Ant from start is routine and long task. Is there a way to generate Ant script based on my actions in eclipse (like macros in MS Office)?
Or, maybe, exists easier way to do this?
Thanks!
While running my program I get this Error:
terminate called after throwing an instance of 'std::length_error'
what(): basic_string::_S_create
Abort trap
I know that you can't do much without the code but I think that error is to deep in the code to copy all of it. Maybe I can figure it out if I understand what this error means.
Is this a sign for an issue with reading or writing at the wrong memory address?
Is there something I can do to get more information about the problem from my program?
Which set of libraries and tools would you recommend to use for development SOAP-service on Ruby 1.9 - soap-tools, web-servers, or maybe a web-framework?
.net System.Net.Mail does not issue SMTP quit commands in version 3.5 or lower. Although the problem is fixed in .net v4.0 RTM, unfortunately v4.0 cannot handle attachments in an email larger than 3-4MB's so I can't use it in my solution.
I was thinking of maybe rolling back to the now outdated CDonts found in System.Web.Mail. Can anyone confirm if CDonts mailing routines explicitly issues SMTP Quit commands?
Guys, in one of the excersises in TC++PL B.S. asks to:
"Write a function that either returns a value or that throws that value based on an argument. Measure the difference in run-time between the two ways."
Great pity he never explaines how to measure such things. I'm not sure if I'm suppose to write simple "time start, time end" counter or maybe there are more effective and practical ways to do it?
Thanks in advance.
I have a python script that'll be checking a queue and performing an action on each item:
# checkqueue.py
while True:
check_queue()
do_something()
How do I write a bash script that will check if it's running, and if not, start it. Roughly the following pseudo code (or maybe it should do something like ps | grep?):
# keepalivescript.sh
if processidfile exists:
if processid is running:
exit, all ok
run checkqueue.py
write processid to processidfile
I'll call that from a crontab:
# crontab
*/5 * * * * /path/to/keepalivescript.sh
Thanks in advance.
Guys would it be difficult to write coutn which will be basically place newline symbol at the end of the input. While working with console (that's all I can do at the moment) I'm finding very tedious to write '\n' every time I want the line to be a new line.
Or maybe it is already implemented?
Hi everybody,
My issue is as follows :
I have stored a few pictures into the sqlite database, using the blob format, which seems to work ok. now i want to get my pictures out of the DB and put then back into images... to complicate the matter, their format is variable (png, jpg, maybe something else, im not sure)
Is there a way of doing so in android?
thank you
Hello guys!
As I mentioned in the title, I need this version of XCode, but there is no download link on the apple site. Maybe you know a good link where I can download it?
Hi,
I'm looking for free tools to design the UI for my web app.
I'm pretty new to this field, so please point me to acceptable solutions.
Basically, I need to fill a "screen" with some controls, that's it.
Thanks.
EDIT: Well, as soon as nobody answers, maybe somebody can help me with this problem for some framework other than Cappuccino?
I wonder if some of you would like the idea to collect in this place features/improvements we would like to see most in visual studio, vote for them and then send them (these with the most votes) to VS Team. Maybe some of them would make their way into another release of VS.
Looking forward to see what you're thinking about it.
I'd like to take a snapshot of my database, make some changes and then use the db compare functionality to identify the changes, and who knows, maybe even generate scripts to make the change.
I'd like to avoid having to backup the current db and restore it as a separate db just to have a "before" snapshot. I'm guessing I shouldn't have to.
Obsviously, I'm clueless about db projects and am looking to be pointed in the right direction.
ty!
I want to use prosody or maybe another xmpp server to test my xmpp bot. I want it to only accept connection from the address/localhost(don't want to configure firewall to block access). I would like to know the easiest way to accomplish this.
I have a nightly team build that is reporting errors from the test step but zero errors in the summary. This results in a partial success.
I cant see any errors in the full build log but maybe it's just the quantity of warnings??
Anyone got any ideas?
Thanks
I've searched many places and haven't get found the answer to this, I suspect I'm missing something either fundamental or basic (maybe both)
I'm using the chef-client::windows_service recipe and trying to set the interval and can't seem to sort it out.
I've tried at the role level with:
{
"defaults": {
"chef_client": {
"interval":15
}
},
"overrides":{
}
}
and at the node level with:
{
"chef_client": {
"interval":25
},
"tags":[]
}
but the interval on the node is still 1800 (default)
I am looking for a more convenient way to manage assignment of applications to a particular Space without having to popup System Preferences all the time. Maybe there exists a contextual menu that allows me to do it, or a menu hack? I'ld even be open to use Applescript, but Spaces is not very well supported in Applescript, AFAIK.
Hi All.
I'm using windows XP , hebrew version.
I am trying to save an AVI file using the Video For Windows API in C++, when I run the AviSaveOptions() function, the dialog opens as a thin unclickable strip at the corner of the screen.
Would it have anything to do with the language (Hebrew)? maybe with the vfw driver itself? what might cause a windows dialog window to be distorted/invisible?
thanks
Roey
I've always assumed that the VB6 help was just deficient in that few (or no) examples were included. But it does have the link for Example in the help, it's just greyed out and not accessible.
Then I thought "maybe there's just something extra in the MSDN that needs to be installed".
Any ideas?
I have a bunch of product sku's that look like:
abc234
asdf234324
adc234-b
result:
abc 234
asdf 234324
adc 234-b
I want to split the text at the first instance of a letter.
When I say split, basically I want to have access to both parts of the text, maybe in an array?
What's the best way to do this?
I want to traverse a tree and return changes to the tree whilst doing so. The result should be a Maybe monad, with Just tree if it succeeds otherwise None.
The question is, what is the cleanest way to stop with the traversing half-way and return None if necessary?
Hi,
I have a WebView. I'd like to show some page from my server, but I require some basic authentication. Is there a way I can specify basic auth credentials when calling WebView.loadData() somehow? I can do this on iphone with the equivalent webview class, thinking maybe same is possible with android?
Thanks