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?
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)?
Hi my code is as such
var xhReq = new XMLHttpRequest();
xhReq.open("GET", linksRaw, false);
xhReq.send(null);
var serverResponse = xhReq.responseText;
var tempDiv = document.createElement('div');
tempDiv.innerHTML = serverResponse.replace(/<script(.|\s)*?\/script>/g, '');
var plzWork = tempDiv.getElementsByClassName('organizationID').innerHTML;
console.log(plzWork);
The value of 'plzWork' :-) which is logged to the firebug console is always 'undefined' while the link code is
<a class="organisationID" href="orglists.htm">Partner Organisations</a>
I'm writing this script in the latest versions of Greasemonkey and FF 3.6
Thanks
Let's say that I have a Person who runs an inventory system. Each Person has some Cars, and each Car has a very large number of Parts (thousands, let's say).
A Person, Bob, uses a Django form to create a Car. Now, Bob goes to create some Parts. It is only at the form level that Django knows that the Parts belong to some specific Car, and that the Parts.ForeignKey(Car) field should only have a specific Car as a choice. When creating a Part, you have to mess with the form's constructor or similar in order to limit the choice of Cars to only the cars owned by Bob.
It does not seem proper that to enforce this ownership at the form level. It seems that other users' Cars must be inaccessible to anyone but the owner of the Car. What do you all think about this, and is there any way to enforce this?
I have a Customer table with a Primary key (int auto increment) and an Address table with a foreign key to the Customer table. I am trying to insert both rows into the database in one nice transaction.
using (DatabaseDataContext db = new DatabaseDataContext())
{
Customer newCustomer = new Customer()
{
Email = customer.Email
};
Address b = new Address()
{
CustomerID = newCustomer.CustomerID,
Address1 = billingAddress.Address1
};
db.Customers.InsertOnSubmit(newCustomer);
db.Addresses.InsertOnSubmit(b);
db.SubmitChanges();
}
When I run this I was hoping that the Customer and Address table automatically had the correct keys in the database since the context knows this is an auto incremented key and will do two inserts with the right key in both tables.
The only way I can get this to work would be to do SubmitChanges() on the Customer object first then create the address and do SubmitChanges() on that as well. This would create two roundtrips to the database and I would like to see if I can do this in one transaction. Is it possible?
Thanks
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
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.
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
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?
HI,
I want to convert MicrosoftOffice Docs(.doc,.docx,ppt,xlsx,xls) +PDF+Images++Audio/Video into an swf file. The idea behind this project is to open the documents on any machine which have a flash plugin. I want to do this in VC++.
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\
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.
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.
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
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!
I've posted this before, but I worded it poorly. I'm trying again with a more well thought out structure.
Re-writing this a bit to make it more clear. I have the following code and I am trying to figure out the shorter linq expression to do it 'inline'. Please examine the "Run()" method near the bottom. I am attempting to understand how to join two dictionaries together based on a matching identifier in one of the objects - so that I can use the query in this sort of syntax.
var selected = from a in items.List()
// etc. etc.
select a;
This is my class structure. The Run() method is what I am trying to simplify. I basically need to do this conversion inline in a couple of places, and I wanted to simplify it a great deal so that I can define it more 'cleanly'.
class TModel
{
public Guid Id { get; set; }
}
class TModels : List<TModel>
{
}
class TValue
{
}
class TStorage
{
public Dictionary<Guid, TValue> Items { get; set; }
}
class TArranged
{
public Dictionary<TModel, TValue> Items { get; set; }
}
static class Repository
{
static public TItem Single<TItem, TCollection>(Predicate<TItem> expression)
{
return default(TItem); // access logic.
}
}
class Sample
{
public void Run()
{
TStorage tStorage = new TStorage();
// access tStorage logic here.
Dictionary<TModel, TValue> d = new Dictionary<TModel, TValue>();
foreach (KeyValuePair<Guid, TValue> kv in tStorage.Items)
{
d.Add(Repository.Single<TModel, TModels>(m => m.Id == kv.Key),kv.Value);
}
}
}
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?
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!
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?
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.