If I use this class to do a
SELECT * FROM ...
statement against a database, what method or variable of this class should I use just to give me a dump of the output from the SQL statement?
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?
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
Basically, this is what I currently use in an included file:
$sites[0]['url'] = "http://example0.com";
$sites[1]['url'] = "http://example1.com";
$sites[2]['url'] = "http://example2.com";
$sites[3]['url'] = "http://example3.com";
$sites[4]['url'] = "http://example4.com";
$sites[5]['url'] = "http://example5.com";
And so I output it like so:
foreach($sites as $s)
But I want to make it easier to manage via a MySQL database. So my question is, how can I make it automatically add additional "$sites[x]['url'] = "http://examplex.com";" and output it appropriately from my MySQL table?
I have a database in access 2007 accdb extension , there are more or less 30-40 tables with related primary key "local_number". it is a text primary key with 10 lenght.
How can I change the length of this primary key to 30 WITHOUT delete previosly all the 30 relationship.
2,A similar question.
I need add a compose primary key to my PK "local_number". I need Add a "Date" as composed PK.
Then access just allow this if I first delete all relationships.
How can Avoid this warning and change my PK ignoring this message.
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 am using Reportviewer to generate a sales invoice to be printed by the user. How can I get databound fields to be printed on every page of a multi page invoice?
The invoice is printed on a pre-printed form. I want the printed form to look roughly like:
page 1
customer john smith
123 main st.
city, CA 90000
some item1 $100
some item2 $150
some item3 $150
page 2
customer john smith
123 main st.
city, CA 90000
some item4 $500
some item5 $250
some item6 $950
Total $2100
Using 1 list which contains databound textbox fields for the customer info, and a table for the items. The problem is if there are many items such that the items flow over to page 2, the next page only contains items, and not the customer info which needs to be printed on second page as well.
I tried using page header, but I can't use databound items in page header. Please Help!
I am creating an RSS reader application that requests the RSS from my server. I mean, the RSS is first downloaded to my server, then application downloads it from my server.
I want to create RSS cache for this. And for example, each RSS would be refreshed every 1 minute. So, If 10 users request RSS of example.com in 1 minute, my server will download it only for the first time, and in other 9 requests, RSS will be loaded from cache.
My question is, Should I use a Database (MSSQL) for this purpose? or I should use files?
I have no limit in Database size nor in file size...
EDIT: I'm using ASP.NET for the server.
I need to view my "BO report SQL" in database rather from web thru edit query. How i can acheive this? Please helpw me out and provide me the steps.
It may be in BO repositry OR
I'm looking for something similar to facebook suggestion list with
cities and countries.
You can see what I'm exactly talking about when you try to create new
event in facebook, click to add address, and then start typing in the
City field.
I prefer finding working suggestion tool in jQuery(with the date),
but database with city/country will do the trick too.
Thanks in advance,
Ilian Iliew
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?
If an attacker has several distinct items (for example: e-mail addresses) and knows the encrypted value of each item, can the attacker more easily determine the secret passphrase used to encrypt those items? Meaning, can they determine the passphrase without resorting to brute force?
This question may sound strange, so let me provide a use-case:
User signs up to a site with their e-mail address
Server sends that e-mail address a confirmation URL (for example: https://my.app.com/confirmEmailAddress/bill%40yahoo.com)
Attacker can guess the confirmation URL and therefore can sign up with someone else's e-mail address, and 'confirm' it without ever having to sign in to that person's e-mail account and see the confirmation URL. This is a problem.
Instead of sending the e-mail address plain text in the URL, we'll send it encrypted by a secret passphrase.
(I know the attacker could still intercept the e-mail sent by the server, since e-mail are plain text, but bear with me here.)
If an attacker then signs up with multiple free e-mail accounts and sees multiple URLs, each with the corresponding encrypted e-mail address, could the attacker more easily determine the passphrase used for encryption?
Alternative Solution
I could instead send a random number or one-way hash of their e-mail address (plus random salt). This eliminates storing the secret passphrase, but it means I need to store that random number/hash in the database. The original approach above does not require storage in the database.
I'm leaning towards the the one-way-hash-stored-in-the-db, but I still would like to know the answer: does having multiple unencrypted e-mail addresses and their encrypted counterparts make it easier to determine the passphrase used?
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)?
I have values that are 64-bit unsigned ints, and I need to store them in mongodb, which has no unsigned int type. I see three main possibilities for storing them in other field types, and converting on going in and out:
Using a signed int is probably easiest and most space efficient, but has the disadvantage that they're not human readable and if someone forgets to do the conversion, some of them will work, which may obscure errors.
Raw binary is probably most difficult for inexperienced programmers to deal with, and also suffers from non-human-readability.
A string representation is the least space efficient (~40 bytes in unicode vs 8 bytes per field), but then at least all of the possible values will map properly, and for querying only a conversion to string is required instead of a more complicated conversion.
I need these values to be available from different platforms, so a single driver-specific solution isn't an option.
Any major pros and cons I've missed? Which one would you use?
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
I've created a model in Xcode, and for various attributes I have minimum & maximum values defined and that are enforced by coreData at runtime.
I'm using NSManagedObject validateValue:forKey:error to check for user input values.
I was a bit disappointed to see that the localized error message is not specific, and I get a "The operation couldn't be completed. (Cocoa error 1620)" for too small values and a "The operation couldn't be completed. (Cocoa error 1610)" for too large values.
It's written in the coreData documentation that "you can localize most aspects of a managed object model, including entity and property names and error messages". Unfortunately it's not very detailed on how you implement it for error messages.
So How do you customize error message ? How do you localize them ?
Is it possible to customize it in a way where it will mentioned the reference value ex: "Value should be lower than %@" or "Value should be higher than %@" ?
Should I make a single NSLock instance in the application delegate, to be used by all classes? Or is it advisable to have each class instantiate its own NSLock instance as needed?
Would the locking work in the second case, if I, for example, had access to a managed object context that is spread across two view controllers?
Hi guys,
I've got the scenario with two NSManagedObjects, Arm and Person. Between them is a many-to-one relationship Person.arms and inverse Arm.owner.
I'd like to write a simple NSPredicate where I've got the NSManagedObject *arm and I'd like to fetch the NSManagedObject *person that this arm belongs to. I could make a textual representation and look for that, but is there a better way where I can look it up by identity? Something like this perhaps?
NSEntityDescription *person = [NSEntityDescription entityForName:@"Person" inManagedObjectContext:MOC];
NSPredicate *personPredicate = [NSPredicate predicateWithFormat:@"%@ IN arms", arm];
Cheers
Nik
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 have written some code to ensure that items on an order are all numbered (the "position number" or "item number" has been introduced only recently and we did not want to go and change all related code - as it is "asthetics only" and has no functional impact.)
So, the idea is to go and check for an records that jave an itemno of NULL or 0 - and then compute one and assign it. When executing this code in a query window, it works fine. When putting it into an AFTER INSERT-trigger, it loops forever.
So what is wrong here?
/****** Objekt: Trigger [SetzePosNr] Skriptdatum: 02/28/2010 20:06:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TRIGGER [SetzePosNr]
ON [dbo].[bestellpos]
AFTER INSERT
AS
BEGIN
DECLARE @idb int
DECLARE @idp int
DECLARE @pnr int
SELECT @idp=id,@idb=id_bestellungen FROM bestellpos WHERE posnr IS NULL OR posnr=0
WHILE @idp IS NOT NULL
BEGIN
SELECT @pnr = 1+max(posnr) FROM bestellpos WHERE id_bestellungen = @idb
print( 'idp=' + str(@idp) + ', idb=' + str(@idb) + ', posnr=' + str(@pnr))
UPDATE bestellpos SET posnr=@pnr WHERE id=@idp
SELECT @idp=id,@idb=id_bestellungen FROM bestellpos WHERE posnr IS NULL OR posnr=0
END
END
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.
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.
This little project / problem came out of left field for me. Hoping someone can help me here. I have some rough ideas but I am sure (or at least I hope) a simple, fairly efficient solution exists.
Thanks in advance.... pseudo code is fine. I generally work in .NET / C# if that sheds any light on your solution.
Given:
A pool of n individuals that will be meeting on a regular basis. I need to form pairs that have not previously meet. The pool of individuals will slowly change over time. For the purposes of pairing, (A & B) and (B & A) constitute the same pair. The history of previous pairings is maintained. For the purpose of the problem, assume an even number of individuals. For each meeting (collection of pairs) and individual will only pair up once.
Is there an algorithm that will allow us to form these pairs? Ideally something better than just ordering the pairs in a random order, generating pairings and then checking against the history of previous pairings. In general, randomness within the pairing is ok.
Ajax applications, and GWT in particular, use the URL fragment (e.g. http://example.com/myapp#fragment) to maintain application state on the client without reloading the page.
Is there a GWT library that facilitates the encoding and decoding of arbitrary parameters into the URL fragment? I'm looking for something analogous to the Servlet API's getParameter() method, but for client-side URL parameters.