I have to write a UDP client. Unfortunately, the source system is not always available
Is there a simple tool out there that I can use to create a fake UDP server/traffic on my machine?
Good day.
I'm receiving a large objects via the net using boost::asio.
And I have a code:
for (int i = 1; i <= num_packets; i++)
boost::asio::async_read(socket_, boost::asio::buffer(Obj + packet_size * (i - 1), packet_size), boost::bind(...));
Where My_Class * Obj.
I'm in doubt if that approach possible (because i have a pointer to an object here)? Or how it would be better to receive this object using packets of fixed size in bytes?
Thanks in advance.
Let's say I have an web CMS type application, and an EDM model with an entity called 'article', and I need to offer
the ability for client applications, to a read/query the articles (and other resources stored in our database)
a straightforward syndication feed of these articles to end users (along the lines of a simple RSS feed)
It seems to me that for the first task, and .net 4's dataservice would be perfect for the job. For the second case, I'm wondering (a) whether atom the right format to choose - I think it is - and (b) whether it's possible to achieve such a feed using the same ado.net OData service.
I took a look at some of the examples out there and briefly set up a proof of concept:
http://localhost/projectname/DataService.svc/Articles
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<feed xml:base="http://localhost/projectname/DataService.svc/" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns="http://www.w3.org/2005/Atom">
<title type="text">Articles</title>
<id>http://localhost/projectname/DataService.svc/Articles</id>
<updated>2010-05-21T09:41:22Z</updated>
<link rel="self" title="Articles" href="Articles" />
<entry>
<id>http://---------DataService.svc/Articles(1)</id>
<title type="text"></title>
<updated>2010-05-21T09:41:22Z</updated>
<author>
<name />
</author>
<link rel="edit" title="Article" href="Articles(1)" />
<category term="Model1.Article" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
<content type="application/xml">
<m:properties>
<d:int_ContentID m:type="Edm.Int32">1</d:int_ContentID>
<d:Titel>hello world</d:Titel>
<d:Source>http://www.google.com</d:Source>
</m:properties>
</content>
</entry>
</feed>
and noticed that, though the feed works and items are showing up, the title tag on the entry level is left blank. (as a result, when you check this feed in a feed reader, you will see no title). I searched msdn but haven't found a way to do that, but it should be possible. Stackoverflow itself uses an atom feed in that fashion, so it should be possible. Right?
So I suppose my question is; Is there a way to make the ado.net dataservice Atom feed look like something suitable for your average news feed reader? - OR, am I using the wrong tool for the wrong purposes, and should I be looking elsewhere (.net syndication API's perhaps)?
Suppose I have a datawindow object which is attached to a datawindow control named 'dw_detail". This object uses grid presentation style and has a database column named 'found'. Now when a user modifies that column's value, I want to compare it with the original value that was fetched from the database. I know I can access the value of that column as 'dw_detail.object.found[row_no]'. Now I am trying to access the original value of the column as 'dw_detail.object.found.original[row_no]', but it is not working. It is not giving any compiling error, but when I debugged, 'dw_detail.object.found.original[row_no]' contains no values.
How can I access the original value of that column?
Im trying to extract part of a line with perl
use strict;
use warnings;
# Set path for my.txt and extract datadir
my @myfile = "C:\backups\MySQL\my.txt";
my @datadir = "";
open READMYFILE, @myfile or die "Error, my.txt not found.\n";
while (<READMYFILE>) {
# Read file and extract DataDir path
if (/C:\backups/gi) {
push @datadir, $_;
}
}
# ensure the path was found
print @datadir . " \n";
Basically at first im trying to set the location of the my.txt file. Next im trying to read it and pull part of the line with regex. The error Im getting is:
Unrecognized escape \m passed through
at 1130.pl line 17.
I took a look at http://stackoverflow.com/questions/1040657/how-can-i-grab-multiple-lines-after-a-matching-line-in-perl to get an idea of how to read a file and match a line within it, however im not 100% sure I'm doing this right or in the best way. I also seem to produce the error:
Error, my.txt not found.
But the file does exist in the folder C:\backups\MySQL\
Hi,
I'm trying to optimize a piece of software which is basically running millions of tests. These tests are generated in such a way that there can be some repetitions. Of course, I don't want to spend time running tests which I already ran if I can avoid it efficiently.
So, I'm thinking about using a Bloom filter to store the tests which have been already ran. However, the Bloom filter errs on the unsafe side for me. It gives false positives. That is, it may report that I've ran a test which I haven't. Although this could be acceptable in the scenario I'm working on, I was wondering if there's an equivalent to a Bloom filter, but erring on the opposite side, that is, only giving false negatives.
I've skimmed through the literature without any luck.
I have a time series of two indexes, with each row representing the closing price on the same day. I'd like to go to row 30 and lookback over the last 30 'days' and calculate the pearson correlation. And then store that value in a new vector. Then, repeat the calculation for the entire time series.
It is a trivial task in Excel, so I'm convinced it can be done in R. I don't know the method to use though.
i'm looking for recommended validation frameworks, or patterns for an n-tier client application, i wanna write the validation once and ind it to wpf gui, and also for server side and client side related bussiness logic
Hello,
I am working with an undocumented API (Osirix) and I have a sister-question to the one I posted here.
I am having trouble loading objects from a managed object context.
With loading from API, using their instance of _context and _model
2010-05-28 14:05:13.588 OsiriX[44012:a0f] Entity: Study
2010-05-28 14:05:13.589 OsiriX[44012:a0f] EntityClassName: DicomStudy
2010-05-28 14:05:13.589 OsiriX[44012:a0f] ClassName: DicomStudy
With loading from Fetch Request (and my own instance of _context, and _model)
2010-05-28 14:19:09.956 rcOsirix[44431:7a03] Entity: Study
2010-05-28 14:19:09.957 rcOsirix[44431:7a03] EntityClassName: DicomStudy
2010-05-28 14:19:09.958 rcOsirix[44431:7a03] ClassName: NSManagedObject
output given by:
NSLog(@"Entity: %@",[[item entity] name]);
NSLog(@"EntityClassName: %@", [[item entity] managedObjectClassName]);
NSLog(@"ClassName: %s", class_getName(object_getClass([item class])));
So it is obvious that even though the Entity thinks it is a DicomSeries - it is not. It is just a NSManagedObject. DicomSeries has some "hard-coded" KVC stuff that I ran into a problem with in my other question.
I'm pursuing a different line of reasoning in this thread - with the loading of the objects.
The following is their code:
- (NSManagedObjectModel *)managedObjectModel
{
if (managedObjectModel) return managedObjectModel;
NSMutableSet *allBundles = [[NSMutableSet alloc] init];
[allBundles addObject: [NSBundle mainBundle]];
[allBundles addObjectsFromArray: [NSBundle allFrameworks]];
managedObjectModel = [[NSManagedObjectModel alloc] initWithContentsOfURL: [NSURL fileURLWithPath: [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@"/OsiriXDB_DataModel.mom"]]];
[allBundles release];
return managedObjectModel;
}
- (NSManagedObjectContext *) managedObjectContextLoadIfNecessary:(BOOL) loadIfNecessary
{
NSError *error = nil;
NSString *localizedDescription;
NSFileManager *fileManager;
if( currentDatabasePath == nil)
return nil;
if (managedObjectContext)
return managedObjectContext;
if( loadIfNecessary == NO) return nil;
fileManager = [NSFileManager defaultManager];
[persistentStoreCoordinator release];
persistentStoreCoordinator = [[NSPersistentStoreCoordinator alloc] initWithManagedObjectModel: self.managedObjectModel];
managedObjectContext = [[NSManagedObjectContext alloc] init];
[managedObjectContext setPersistentStoreCoordinator: persistentStoreCoordinator];
NSURL *url = [NSURL fileURLWithPath: currentDatabasePath];
if (![persistentStoreCoordinator addPersistentStoreWithType:NSSQLiteStoreType configuration:nil URL:url options:nil error:&error])
{
NSLog(@"********** managedObjectContextLoadIfNecessary FAILED: %@", error);
localizedDescription = [error localizedDescription];
error = [NSError errorWithDomain:@"OsiriXDomain" code:0 userInfo:[NSDictionary dictionaryWithObjectsAndKeys:error, NSUnderlyingErrorKey, [NSString stringWithFormat:@"Store Configuration Failure: %@", ((localizedDescription != nil) ? localizedDescription : @"Unknown Error")], NSLocalizedDescriptionKey, nil]];
}
[[managedObjectContext undoManager] setLevelsOfUndo: 1];
[[managedObjectContext undoManager] disableUndoRegistration];
// This line is very important, if there is NO database.sql file
[self saveDatabase: currentDatabasePath];
return managedObjectContext;
}
This is my code:
NSManagedObjectModel* DataModule::managedObjectModel()
{
if (_managedObjectModel) return _managedObjectModel;
NSMutableSet *allBundles = [[NSMutableSet alloc] init];
[allBundles addObject: [NSBundle mainBundle]];
[allBundles addObjectsFromArray: [NSBundle allFrameworks]];
_managedObjectModel = [[NSManagedObjectModel alloc] initWithContentsOfURL: [NSURL fileURLWithPath: [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@"/OsiriXDB_DataModel.mom"]]];
[allBundles release];
return [_managedObjectModel retain];
}
...
NSError *error = nil;
[_storeCoordinator release];
_storeCoordinator = [[NSPersistentStoreCoordinator alloc] initWithManagedObjectModel: managedObjectModel()];
_context = [[NSManagedObjectContext alloc] init];
[_context setPersistentStoreCoordinator: _storeCoordinator];
NSURL *url = [NSURL fileURLWithPath: [[NSString alloc] initWithCString:_DBPath.c_str()]];
if (url == nil) { [pool release]; _loadLock = false; return nil; }
if (![_storeCoordinator addPersistentStoreWithType:NSSQLiteStoreType configuration:nil URL:url options:nil error:&error])
{
NSLog(@"********** managedObjectContextLoadIfNecessary FAILED: %@", error);
NSString *localizedDescription = [error localizedDescription];
error = [NSError errorWithDomain:@"OsiriXDomain" code:0 userInfo:[NSDictionary dictionaryWithObjectsAndKeys:error, NSUnderlyingErrorKey, [NSString stringWithFormat:@"Store Configuration Failure: %@", ((localizedDescription != nil) ? localizedDescription : @"Unknown Error")], NSLocalizedDescriptionKey, nil]];
//Exit Failure
[pool release]; _loadLock = false; return nil;
}
[[_context undoManager] setLevelsOfUndo: 1];
[[_context undoManager] disableUndoRegistration];
...
I am including all the same frameworks.... but _allBundles isn't even used to create the managedObjectModel so I don't know what it's supposed to do except load them into memory so that the mom can look at them while loading.
Totally lost.
Help!
Why would objects returned by my FetchRequest with the same Entity come out as NSManagedObjects and not DicomStudys? I'm including DicomStudy.h so it should see the object during creation of the model, context, and fetch request.
[request setEntity: [[managedObjectModel() entitiesByName] objectForKey:@"Study"]];
Thanks in advance,
-Stephen
Looking for tools on a windows platform to genereate ER diagram (or similar) from an existing Oracle database.
Any good tools out there that are free to use or low cost?
I do not see any Connection Configure dialog popping up when I try connecting 2 webparts.
I even tried using designer to connect webpart even though it gives me confirmation it does not appear to have been connected.... I am totally clueless.
I have a textfield and a label.
When you touch the textfield, the keyboard appears
In IB, the textfield's properties are
Keyboard: ASCII Capable
Return Key: Done
I wired the IBOutlet to the label and the textfield.
How do I get the keyboard to go away when I'm done entering text.
How do I get to copy the text to the UIlabel?
thanks
Hi,
I'm binding a GridView to a domain model object, this domain model object has a method for working out a formatted value to display on the grid. I'd like to use this method for my display value, which is fine, but I'd also like to be able to sort on the value returned by that method. My sort expression can only take in a property/field at the moment.
Help please! What do I need to do to get this to work?
I'm using an SPGridView actually, but that doesn't make a lot of difference to my problem.
Thanks.
Well basically I've got a vb.net script connecting to IRC, and I'm working on making it a basic chat system, but I've run into a problem.
Say I receive this:
:[email protected] PRIVMSG #channel :message
I want to grab specific information to output to the user.
I want to grab nickname and message
How can I go about doing this?
I thought about using regex, but I can't figure out how to make regex grab message since there's nothing after it.
I'd like the user to specify a RSS feed address and serialize the information from it. I am not interested in the XML format, but populate a strongly typed object from the XML. My question is, is there a standard that all RSS feeds support (Do all of them have date, title etc)? If so, is there a XSD that describes this. If not, how do I handle serializing a RSS feed to an object in ASP.NET?
I have to add either an embed tag for Firefox or an object tag for Internet Explorer with JavaScript to address the appropriate ActiveX / Plugin depending on the browser. The plugin could be missing and needs to get downloaded in this case. The dynamically added embed tag for Firefox works as expected. The dynamically added object tag for Internet Explorer seems to do nothing at all. The object tag needs the following attributes to function properly.
id ="SomeId"
classid = "CLSID:{GUID}"
codebase = "http://www.MyActicexSource.com/MyCuteActivex.CAB#Version=2,0,0,1"
Even a general working idea or method would be nice.
Thanks!
We currently have a 10 year old nasty, spaghetti-code-style SQL Server database that we are soon looking to pretty much re-write from scratch as part of a re-write to a large web application. (The existing application will serve as the functional requirements for the next incarnation of the app).
Some have suggested we use Visio to do all the diagramming and to generate the DDL, but others have suggested we use a dedicated database design tool, rather than a diagramming tool that is able to export DDL.
Is there any benefit to using "real" DB design tools, such as ModelRight, over general tools like Visio? If so, what are those specific benefits?
Edit: In a nutshell, what can real/dedicated tools do that something like Visio can't, and how much do these capabilities matter (from a best-practices standpoint, for example)
Consider the deletion procedure on a BST, when the node to delete has two children. Let's say i always replace it with the node holding the minimum key in its right subtree.
The question is: is this procedure commutative? That is, deleting x and then y has the same result than deleting first y and then x?
I think the answer is no, but i can't find a counterexample, nor figure out any valid reasoning.
EDIT:
Maybe i've got to be clearer.
Consider the transplant(node x, node y) procedure: it replace x with y (and its subtree).
So, if i want to delete a node (say x) which has two children i replace it with the node holding the minimum key in its right subtree:
y = minimum(x.right)
transplant(y, y.right) // extracts the minimum (it doesn't have left child)
y.right = x.right
y.left = x.left
transplant(x,y)
The question was how to prove the procedure above is not commutative.
Hello everyone,
Trying to run a time consuming task from a wxpython GUI. The basic idea is to start the long time task from the GUI (pressing a button) and then, a static text on the dialog should be updated from it.
First I tried some threading (http://wiki.wxpython.org/LongRunningTasks and many other resourses seen), and I want to show back the messages using Publisher.class. It didn't went so well, after a message or two, the GUI seems to frozen.
Now I want to achieve that with multiprocessing. I have this method inside my 'GUI' class:
def do_update(self, e):
self.txt_updatemsg.SetLabel("Don't stop this \n")
...
pub = Publisher() # i tried also calling directly from dbob object
# Publisher() is a singleton so this must be useless?
pub.subscribe(self.__update_txt_message, ('updatedlg', 'message'))
dbob = dbutils.DBUtils() # DBUtils is the class with 'long time' tasks
dbob.publisher = pub
p = Process(target=self.do_update_process, args=(dbob,))
p.start()
while p.is_alive:
wx.Yield
def do_update_process(self, dbob):
dbob.do_update()
__update_txt_message is a simple function what sets the static text on dialog.
Question is: how can I send back some text messages from this Process (just simple text, that's all I need)
Thanks guys!
I have 2 forms, in one of them I show DataTable rows in a combo box.
and in second form, I will edit that rows.
How can i reload that changes that are made by second form, in first form?
I don't wanna use TablaAdpater.Fill for reload!
thanks a million
Our asp.net 2.0 application has a very long process (synchronized) before sending response back to client. I observed that a second request, exactly same the initial one, was sent after client IE8 waited response for a long period of time while our application was still processing the first request.
I use page session with predefined key to store a flag when the initial request arrives and then starts long process while client IE waits for the response, so if second request comes in, our application checks the session value. After our application sets the session flag and starts processing, I use Fiddler “Abort Session” to abort the initial request, right away the second request (same as the first one) is sent automatically, but session value set earlier seems no longer exist.
Any thoughts?
Hi,
I have a raster file (basically 2D array) with close to a million points. I am trying to extract a circle from the raster (and all the points that lie within the circle. Using ArcGIS is exceedingly slow for this. Can anyone suggest any image processing library that is both easy to learn and powerful and quick enough for something like this?
Thanks!
I have a method in rails that is doing something like this:
a = Foo.new("bar")
a.save
b = Foo.new("baz")
b.save
...
x = Foo.new("123", :parent_id => a.id)
x.save
...
z = Foo.new("zxy", :parent_id => b.id)
z.save
The problem is this takes longer and longer the more entities I add. I suspect this is because it has to hit the database for every record. Since they are nested, I know I can't save the children before the parents are saved, but I would like to save all of the parents at once, and then all of the children. It would be nice to do something like:
a = Foo.new("bar")
b = Foo.new("baz")
...
saveall(a,b,...)
x = Foo.new("123", :parent_id => a.id)
...
z = Foo.new("zxy", :parent_id => b.id)
saveall(x,...,z)
That would do it all in only two database hits. Is there an easy way to do this in rails, or am I stuck doing it one at a time?
Im looking for a (free) solution to a bookingcalender. Among many candidates Ive found the Jquery Full Calender which has many cool features. One of the reason that I like this one is because it has "drag and drop" and resize, which I also need. But I also need to have the dayview where I the columms monday, tuesday, wedensday, thursday friday .... gets replaced with fx. Room1, Room2, Room3, Room4, Room5, Room6, Room7. Ive found some examples on:
http://www.devexpress.com/Products/NET/Controls/ASP/Scheduler/resources.xml
http://demos.telerik.com/aspnet-ajax/scheduler/examples/resourceavailability/defaultcs.aspx
which has the functionality im after.
Ive read others who has raised the same quistion on:
http://code.google.com/p/jquery-week-calendar/issues/detail?id=35
but with no final solution. Are there any out there who has or knows some good links for want Im looking for?