Search Results

Search found 4126 results on 166 pages for 'bitwise operations'.

Page 137/166 | < Previous Page | 133 134 135 136 137 138 139 140 141 142 143 144  | Next Page >

  • Create table and call it from sql

    - by user1770816
    I have a PL/SQL function which creates a new temporary table. For creating the table I use execute immediate. When I run my function in oracle sql developer everything is ok; the function creates the temp table without errors. But when U use SQL: Select function_name from table_name I get an exceptions: ORA-14552: cannot perform a DDL, commit or rollback inside a query or DML ORA-06512: at "SYSTEM.GET_USERS", line 10 14552. 00000 - "cannot perform a DDL, commit or rollback inside a query or DML " *Cause: DDL operations like creation tables, views etc. and transaction control statements such as commit/rollback cannot be performed inside a query or a DML statement. Update Sorry, write from tablet PC and have problems with format text. My function: CREATE OR REPLACE FUNCTION GET_USERS ( USERID IN VARCHAR2 ) RETURN VARCHAR2 AS request VARCHAR2(520) := 'CREATE GLOBAL TEMPORARY TABLE '; BEGIN request := request || 'temp_table_' || userid || '(user_name varchar2(50), user_id varchar2(20), is_administrator varchar2(5)') || ' ON COMMIT PRESERVE ROWS'; EXECUTE IMMEDIATE (request); RETURN 'true'; END GET_USERS;

    Read the article

  • Adding cancel ability and exception handling to async code.

    - by Rob
    I have this sample code for async operations (copied from the interwebs) public class LongRunningTask { public LongRunningTask() { //do nowt } public int FetchInt() { Thread.Sleep(2000); return 5; } } public delegate TOutput SomeMethod<TOutput>(); public class GoodPerformance { public void BeginFetchInt() { LongRunningTask lr = new LongRunningTask(); SomeMethod<int> method = new SomeMethod<int>(lr.FetchInt); // method is state object used to transfer result //of long running operation method.BeginInvoke(EndFetchInt, method); } public void EndFetchInt(IAsyncResult result) { SomeMethod<int> method = result.AsyncState as SomeMethod<int>; Value = method.EndInvoke(result); } public int Value { get; set; } } Other async approaches I tried required the aysnc page attribute, they also seemed to cancel if other page elements where actioned on (a button clicked), this approach just seemed to work. I’d like to add a cancel ability and exception handling for the longRunningTask class, but don’t erm, really know how.

    Read the article

  • How should I lock the table in this VB6 / Access application?

    - by Brian Hooper
    I'm working on a VB6 application using an Access database. The application writes messages to a log table from time to time. Several instances of the application may be running simultaneously and to distinguish them they each have their own run number. The run number is deduced from the log table thus... Set record_set = New ADODB.Recordset query_string = "SELECT MAX(RUN_NUMBER) + 1 AS NEW_RUN_NUMBER FROM ERROR_LOG" record_set.CursorLocation = adUseClient record_set.Open query_string, database_connection, adOpenStatic, , adCmdText record_set.MoveLast If IsNull(record_set.Fields("NEW_RUN_NUMBER")) Then run_number = 0 Else run_number = record_set.Fields("NEW_RUN_NUMBER") End If command_string = "INSERT INTO ERROR_LOG (RUN_NUMBER, SEVERITY, MESSAGE) " & _ " VALUES (" & Str$(run_number) & ", " & _ " " & Str$(SEVERITY_INFORMATION) & ", " & _ " 'Run Started'); " database_connection.Execute command_string Obviously there is a small gap between the calculation of the run number and the appearance of the new row in the database, and to prevent another instance getting access between the two operations I'd like to lock the table; something along the lines of SET TRANSACTION READ WRITE RESERVING ERROR_LOG FOR PROTECTED WRITE; How should I go about doing this? Would locking the recordset do any good (the row in the record set doesn't match any particular row in the database)?

    Read the article

  • Low Throughput on Windows Named Pipe Over WAN

    - by MichaelB76
    I'm having problems with low performance using a Windows named pipe. The throughput drops off rapidly as the network latency increases. There is a roughly linear relationship between messages sent per second and round trip time. It seems that the client must ack each message before the server will send the next one. This leads to very poor performance, I can only send 5 (~100 byte) messages per second over a link with an RTT of 200 ms. The pipe is asynchronous, using multiple overlapped write operations (and multiple overlapped reads at the client end), but this is not improving throughput. Is it possible to send messages in parallel over a named pipe? The pipe is created using PIPE_TYPE_MESSAGE, would PIPE_READMODE_BYTE work better? Is there any other way I can improve performance? This is a deployed solution, so I can't simply replace the pipe with a socket connection (I've read that Windows named pipe aren't recommended for use over a WAN, and I'm wondering if this is why). I'd be grateful for any help with this matter.

    Read the article

  • LINQ to SQL - database relationships won't update after submit

    - by Quantic Programming
    I have a Database with the tables Users and Uploads. The important columns are: Users -> UserID Uploads -> UploadID, UserID The primary key in the relationship is Users -> UserID and the foreign key is Uploads -> UserID. In LINQ to SQL, I do the following operations: Retrieve files var upload = new Upload(); upload.UserID = user.UserID; upload.UploadID = XXX; db.Uploads.InsertOnSubmit(upload) db.SubmitChanges(); If I do that and rerun the application (and the db object is re-built, of course) - if do something like this: foreach(var upload in user.Uploads) I get all the uploads with that user's ID. (like added in the previous example) The problem is, that my application, after adding an upload an submitting changes, doesn't update the user.Uploads collection. i.e - I don't get the newly added uploads. The user object is stored in the Session object. At first, I though that the LINQ to SQL Framework doesn't update the reference of the object, therefore I should simply "reset" the user object from a new SQL request. I mean this: Session["user"] = db.Users.Where(u => u.UserID == user.UserID).SingleOrDefault(); (Where user is the previous user) But it didn't help. Please note: After rerunning the application, user.Uploads does have the new upload! Did anyone experience this type of problem, or is it normal behavior? I am a newbie to this framework. I would gladly take any advice. Thank you!

    Read the article

  • Symfony 2 - Updating a table based on newly inserted record in another table

    - by W00d5t0ck
    I'm trying to create a small forum application using Symfony 2 and Doctrine 2. My ForumTopic entity has a last_post field (oneToOne mapping). Now when I persist my new post with $em->persist($post); I want to update my ForumTopic entity so its last_post field would reference this new post. I have just realised that it cannot be done with a Doctrine postPersist Listener, so I decided to use a small hack, and tried: $em->persist($post); $em->flush(); $topic->setLastPost($post); $em->persist($post); $em->flush(); but it doesn't seem to update my topics table. I also took a look at http://docs.doctrine-project.org/projects/doctrine-orm/en/2.1/reference/working-with-associations.html#transitive-persistence-cascade-operations hoping it will solve the problem by adding cascade: [ 'persist' ] to my Topic.orm.yml file, but it didn't help, either. Could anyone point me to a solution or an example class? My ForumTopic is: FrontBundle\Entity\ForumTopic: type: entity table: forum_topics id: id: type: integer generator: strategy: AUTO fields: title: type: string(100) nullable: false slug: type: string(100) nullable: false created_at: type: datetime nullable: false updated_at: type: datetime nullable: true update_reason: type: text nullable: true oneToMany: posts: targetEntity: ForumPost mappedBy: topic manyToOne: created_by: targetEntity: User inversedBy: articles nullable: false updated_by: targetEntity: User nullable: true default: null topic_group: targetEntity: ForumTopicGroup inversedBy: topics nullable: false oneToOne: last_post: targetEntity: ForumPost nullable: true default: null cascade: [ persist ] uniqueConstraint: uniqueSlugByGroup: columns: [ topic_group, slug ] And my ForumPost is: FrontBundle\Entity\ForumPost: type: entity table: forum_posts id: id: type: integer generator: strategy: AUTO fields: created_at: type: datetime nullable: false updated_at: type: datetime nullable: true update_reason: type: string nullable: true text: type: text nullable: false manyToOne: created_by: targetEntity: User inversedBy: forum_posts nullable: false updated_by: targetEntity: User nullable: true default: null topic: targetEntity: ForumTopic inversedBy: posts

    Read the article

  • How do software events work internally?

    - by Duddle
    Hello! I am a student of Computer Science and have learned many of the basic concepts of what is going on "under the hood" while a computer program is running. But recently I realized that I do not understand how software events work efficiently. In hardware, this is easy: instead of the processor "busy waiting" to see if something happened, the component sends an interrupt request. But how does this work in, for example, a mouse-over event? My guess is as follows: if the mouse sends a signal ("moved"), the operating system calculates its new position p, then checks what program is being drawn on the screen, tells that program position p, then the program itself checks what object is at p, checks if any event handlers are associated with said object and finally fires them. That sounds terribly inefficient to me, since a tiny mouse movement equates to a lot of cpu context switches (which I learned are relatively expensive). And then there are dozens of background applications that may want to do stuff of their own as well. Where is my intuition failing me? I realize that even "slow" 500MHz processors do 500 million operations per second, but still it seems too much work for such a simple event. Thanks in advance!

    Read the article

  • Parallelize or vectorize all-against-all operation on a large number of matrices?

    - by reve_etrange
    I have approximately 5,000 matrices with the same number of rows and varying numbers of columns (20 x ~200). Each of these matrices must be compared against every other in a dynamic programming algorithm. In this question, I asked how to perform the comparison quickly and was given an excellent answer involving a 2D convolution. Serially, iteratively applying that method, like so list = who('data_matrix_prefix*') H = cell(numel(list),numel(list)); for i=1:numel(list) for j=1:numel(list) if i ~= j eval([ 'H{i,j} = compare(' char(list(i)) ',' char(list(j)) ');']); end end end is fast for small subsets of the data (e.g. for 9 matrices, 9*9 - 9 = 72 calls are made in ~1 s). However, operating on all the data requires almost 25 million calls. I have also tried using deal() to make a cell array composed entirely of the next element in data, so I could use cellfun() in a single loop: # who(), load() and struct2cell() calls place k data matrices in a 1D cell array called data. nextData = cell(k,1); for i=1:k [nextData{:}] = deal(data{i}); H{:,i} = cellfun(@compare,data,nextData,'UniformOutput',false); end Unfortunately, this is not really any faster, because all the time is in compare(). Both of these code examples seem ill-suited for parallelization. I'm having trouble figuring out how to make my variables sliced. compare() is totally vectorized; it uses matrix multiplication and conv2() exclusively (I am under the impression that all of these operations, including the cellfun(), should be multithreaded in MATLAB?). Does anyone see a (explicitly) parallelized solution or better vectorization of the problem?

    Read the article

  • Android - save/restore state of custom class

    - by user1209216
    I have some class for ssh support - it uses jsch internally. I use this class on main activity, this way: public class MainActivity extends Activity { SshSupport ssh = new SshSupport(); ..... @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); //Handle events for ssh ssh.eventHandler = new ISshEvents() { @Override public void SshCommandExecuted(SshCommandsEnum commandType, String result) { } //other overrides here } //Ssh operations on gui item click @Override public void onItemClick(AdapterView<?> arg0, View v, int position, long arg3) { if (ssh.IsConnected() == false) { try { ssh.ConnectAsync(/*parameters*/); } catch (Exception e) { e.printStackTrace(); } } try { ssh.ExecuteCommandAsync(SshCommandsEnum.values()[position]); } catch (Exception e) { e.printStackTrace(); } } }); } It works very well. My application connects to ssh, performs all needed operation in background thread and results are reported to gui, via events as shown above. But nothing works after user change device orientation. It's clear for me - activity is re-created and all state is lost. Unfortunately, my SshSupport class object is lost as well. It's pretty easy to store gui state for dynamically changed/added objects (using put/get serializable etc methods). But I have no idea how to prevent my ssh object, ssh connected session being lost. Since my class is not serializable, I can't save it to bundle. Also, even if I make my SshSupport class serializable, jsch objects it uses still are not serializable. So what is the best way to solve this?

    Read the article

  • REST design: what verb and resource name to use for a filtering service

    - by kabaros
    I am developing a cleanup/filtering service that has a method that receives a list of objects serialized in xml, and apply some filtering rules to return a subset of those objects. In a REST-ful service, what verb shall I use for such a method? I thought that GET is a natural choice, but I have to put the serialized XML in the body of the request which works but feels incorrect. The other verbs don't seem to fit semantically. What is a good way to define that Service interface? Naming the resource /Cleanup or /Filter seems weird mainly because in the examples I see online, it is always a name rather than a verb being used for resource name. Am I right to feel that REST services are better suited for CRUD operations and you start bending the rules in situations like this service? If yes, am I then making a wrong architectural choice. I've pushed to develop this service in REST-ful style (as opposed to SOAP) for simplicity, but such awkward cases happen a lot and make me feel like I am missing something. Either choosing REST where it shouldn't be used or may be over-thinking some stuff that doesn't really matter? In that case, what really matters?

    Read the article

  • Installing Image_Graph and using with BASE

    - by PPowerHouseK
    Hello all, I have Windows 7 with the latest XAMPP installation. I configured BASE to work, for the most part. My problem is that in BASE, when I click on the graph alerts button, I get this error: Error loading the Graphing library: Check your Pear::Image_Graph installation! * Image_Graph can be found here:at http://pear.veggerby.dk/. Without this library no graphing operations can be performed. * Make sure PEAR libraries can be found by php at all: pear config-show | grep "PEAR directory" PEAR directory php_dir /usr/share/pear This path must be part of the include path of php (cf. /etc/php.ini): php -i | grep "include_path" include_path => .:/usr/share/pear:/usr/share/php => .:/usr/share/pear:/usr/share/php</code> I think it may have to do with the include path of the php.ini so here is what it currently says: ;;;;;;;;;;;;;;;;;;;;;;;;; ; Paths and Directories ; ;;;;;;;;;;;;;;;;;;;;;;;;; ; UNIX: "/path1:/path2" ;include_path = ".:/php/includes" ; ; Windows: "\path1;\path2" ;include_path = ".;c:\php\includes" ; ; PHP's default setting for include_path is ".;/path/to/php/pear" ; http://php.net/include-path include_path = ".;C:\xampp\php\PEAR" I am really at a loss as to how to resolve this. I searched for a while for some documentation but most referred to installing on ubuntu. I don't know any pear or php, so if you know how to fix this please explain thoroughly. I am willing to supply as much information as needed.

    Read the article

  • How string accepting interface should look like?

    - by ybungalobill
    Hello, This is a follow up of this question. Suppose I write a C++ interface that accepts or returns a const string. I can use a const char* zero-terminated string: void f(const char* str); // (1) The other way would be to use an std::string: void f(const string& str); // (2) It's also possible to write an overload and accept both: void f(const char* str); // (3) void f(const string& str); Or even a template in conjunction with boost string algorithms: template<class Range> void f(const Range& str); // (4) My thoughts are: (1) is not C++ish and may be less efficient when subsequent operations may need to know the string length. (2) is bad because now f("long very long C string"); invokes a construction of std::string which involves a heap allocation. If f uses that string just to pass it to some low-level interface that expects a C-string (like fopen) then it is just a waste of resources. (3) causes code duplication. Although one f can call the other depending on what is the most efficient implementation. However we can't overload based on return type, like in case of std::exception::what() that returns a const char*. (4) doesn't work with separate compilation and may cause even larger code bloat. Choosing between (1) and (2) based on what's needed by the implementation is, well, leaking an implementation detail to the interface. The question is: what is the preffered way? Is there any single guideline I can follow? What's your experience?

    Read the article

  • Pointers into elements in a container

    - by Pillsy
    Say I have an object: struct Foo { int bar_; Foo(int bar) bar_(bar) {} }; and I have an STL container that contains Foos, perhaps a vector, and I take // Elsewhere... vector<Foo> vec; vec.push_back(Foo(4)); int *p = &(vec[0].bar_) This is a terrible idea, right? The reason is that vector is going to be storing its elements in a dynamically allocated array somewhere, and eventually, if you add enough elements, it will have to allocate another array, copy over all the elements of the original array, and delete the old array. After that happens, p points to garbage. This is why many operations on a vector will invalidate iterators. It seems like it would be reasonable to assume that an operation that would invalidate iterators from a container will also invalidate pointers to data members of container elements, and that if an operation doesn't invalidate iterators, those pointers will still be safe. However, many reasonable assumptions are false. Is this one of them?

    Read the article

  • Using external SOAP service in Workflow service

    - by whirlwin
    I am using the .NET 4 framework and have made a WCF Workflow Service Application. I want to use a SOAP web service (.NET 3.5) I have running in another instance of VS. The only method that is exposed is the following: [WebMethod] public string Reverse(string input) { char[] chars = input.ToCharArray(); Array.Reverse(chars); return new string(chars); } I have used the following steps to add the service in my Workflow: Add Service Reference Provided the WSDL (the operation shows in the Operations box as expected) Clicked OK Build the solution to ensure that the service shows in my toolbox Drag the service from the toolbox into the workflow However, when I look at the properties of the service in the workflow, there is no way to specify the input argument or where to store the result of the invocation of the service. I only have the option of specifying some obscure parameters such as Body:InArgument<ReverseRequestBody and outBody:OutArgument<ReverseResponseBody (none of which are strings). Here is a screenshot depicting the properties of the service in the workflow: My question is therefore: Is it possible at all to use the SOAP service by specifying a string as the input argument (like it is meant to be used), and also assign the result to a workflow variable?

    Read the article

  • A specific data structure

    - by user550413
    Well, this question is a bit specific but I think there is some general idea in it that I can't get it. Lets say I got K servers (which is a constant that I know its size). I have a program that get requests and every request has an id and server id that will handle it. I have n requests - unknown size and can be any number. I need a data structure to support the next operations within the given complexity: GetServer - the function gets the request ID and returns the server id that is supposed to handle this request at the current situation and not necessarily the original server (see below). Complexity: O(log K) at average. KillServer - the function gets as input a server id that should be removed and another server id that all the requests of the removed server should be passed to. Complexity: O(1) at the worst case. -- Place complexity for all the structure is O(K+n) -- The KillServer function made me think using a Union-Find as I can do the union in O(1) as requested but my problem is the first operation. Why it's LogK? Actually, no matter how I "save" the requests if I want to access to any request (lets say it's an AVL tree) so the complexity will be O(log n) at the worst case and said that I can't assume Kn (and probably K Tried thinking about it a couple of hours but I can't find any solution. Known structures that can be used are: B+ tree, AVL tree, skip list, hash table, Union-Find, rank tree and of course all the basics like arrays and such.

    Read the article

  • How to parse mathematical expressions involving parentheses

    - by Rob P.
    Please forgive my title, I really don't know how to phrase it better. This isn't a school assignment or anything, but I realize it's a mostly academic question. But, what I've been struggling to do is parse 'math' text and come up with an answer. For Example - I can figure out how to parse '5 + 5' or '3 * 5' - but I fail when I try to correctly chain operations together. (5 + 5) * 3 It's mostly just bugging me that I can't figure it out. If anyone can point me in a direction, I'd really appreciate it. EDIT Thanks for all of the quick responses. I'm sorry I didn't do a better job of explaining. First - I'm not using regular expressions. I also know there are already libraries available that will take, as a string, a mathematical expression and return the correct value. So, I'm mostly looking at this because, sadly, I don't "get it". Second - What I've tried doing (is probably misguided) but I was counting '(' and ')' and evaluating the deepest items first. In simple examples, this worked; but my code is not pretty and more complicated stuff crashes. When I 'calculated' the lowest level, I was modifying the string. So... (5 + 5) * 3 Would turn into 10 * 3 Which would then evaluate to 30 But it just felt 'wrong'. I hope that helps clarify things. I'll certainly check out the links provided.

    Read the article

  • Need help debugging a huge chunk of JSON data...

    - by meder
    I have a huge chunk, so large that I can't manually edit the file and need to read it in and do regex operations to see what's wrong. Basically - my server is PHP 5.1.6 and I can't update it. This features an older json_decode which is less featured than the 5.2/5.3 versions. json_decode returns NULL and json_last_error is being invoked but the function doesn't exist except in PHP 5.3 so I'm manually trying to see what's wrong. $regex = '#[^0-9"$a-zA-Z{:}().]#'; $json = preg_replace( $regex, '', $json ); $tree = json_decode ( $json, true ); var_dump($tree); // NULL A snippet of the JSON.. somewhere in the middle {"109":0,"103":1,"102":59,"101":70,"100":4299,"94":0,"50":51,"46":0,"45":0,"44":0,"43":0,"42":0,"23":0,"22":0,"18":0,"17":1,"16":1,"13":160,"8":4298}},"2":{"d":{"109":0,"103":92,"102":54,"101":53,"100":4301,"94":0,"50":4278,"49":328,"46":1,"45":0,"44":1,"43":0,"42":0,"26":0,"23":0,"22":0,"18":0,"17":1,"16":1,"8":4300},"m":{"94":1,"100":1,"26":1,"50":1,"8":1,"49":1,"18":1,"43":1,"42":1,"109":1},"c":{"\/":{"d":{"109":0,"100":4301,"94":0,"50":4278,"49":328,"43":0,"42":0,"26":0,"18":0,"8":4300}},"G":{"d":{"109":1,"100":4303,"94":1,"68":17,"50":64,"49":53,"43":1,"42":1,"34":0,"18":1,"13":2216,"11":0,"8":4302}}}},"3": The }}}} is suspicious but this probably just closes 4 nested object literals. Would appreciate any insight.

    Read the article

  • Extracting a number from a 1-word string

    - by Kyle
    In this program I am trying to make, I have an expression (such as "I=23mm", or "H=4V") and I am trying to extract the 23 (or the 4) out of it, so that I can turn it into an integer. The problem I keep running into is that since the expression I am trying to take the numbers out of is 1 word, I cannot use split() or anything. One example I saw but wouldnt work was - I="I=2.7A" [int(s) for s in I.split() if s.isdigit()] This wouldnt work because it only takes the numbers are are delimited by spaces. If there was a number in the word int078vert, it wouldnt extract it. Also, mine doesnt have spaces to delimit. I tried one that looked like this, re.findall("\d+.\d+", "Amps= 1.4 I") but it didnt work either, because the number that is being passed is not always 2 digits. It could be something like 5, or something like 13.6. What code do I need to write so that if I pass a string, such as I="I=2.4A" or I="A=3V" So that I can extract only the number out of this string? (and do operations on it)? There are no spaces or other constant chars that I can delimit by.

    Read the article

  • C# cross thread dialogue co-operation

    - by John Attridge
    K I am looking at a primarily single thread windows forms application in 3.0. Recently my boss had a progress dialogue added on a separate thread so the user would see some activity when the main thread went away and did some heavy duty work and locked out the GUI. The above works fine unless the user switches applications or minimizes as the progress form sits top most and will not disappear with the main application. This is not so bad if there are lots of little operations as the event structure of the main form catches up with its events when it gets time so minimized and active flags can be checked and thus the dialog thread can hide or show itself accordingly. But if a long running sql operation kicks off then no events fire. I have tried intercepting the WndProc command but this also appears queued when a long running sql operation is executing. I have also tried picking up the processes, finding the current app and checking various memory values isiconic and the like inside the progress thread but until the sql operation finishes none of these get updated. Removing the topmost causes the dialog to disappear when another app activates but if the main app is then brought back it does not appear again. So I need a way to find out if the other thread is minimized or no longer active that does not involve querying the actual thread as that locks until the sql operation finishes. Now I know that this is not the best way to write this and it would be better to have all the heavy processing on separate threads leaving the GUI free but as this is a huge ancient legacy app the time to re-write in that fashion will not be provided so I have to work with what I have got. Any help is appreciated

    Read the article

  • Is it possible to cache all the data in a SQL Server CE database using LinqToSql?

    - by DanM
    I'm using LinqToSql to query a small, simple SQL Server CE database. I've noticed that any operations involving sub-properties are disappointingly slow. For example, if I have a Customer table that is referenced by an Order table, LinqToSql will automatically create an EntitySet<Order> property. This is a nice convenience, allowing me to do things like Customer.Order.Where(o => o.ProductName = "Stopwatch"), but for some reason, SQL Server CE hangs up pretty bad when I try to do stuff like this. One of my queries, which isn't really that complicated takes 3-4 seconds to complete. I can get the speed up to acceptable, even fast, if I just grab the two tables individually and convert them to List<Customer> and List<Order>, then join then manually with my own query, but this is throwing out a lot of what makes LinqToSql so appealing. So, I'm wondering if I can somehow get the whole database into RAM and just query that way, then occasionally save it. Is this possible? How? If not, is there anything else I can do to boost the performance besides resorting to doing all the joins manually? Note: My database in its initial state is about 250K and I don't expect it to grow to more than 1-2Mb. So, loading the data into RAM certainly wouldn't be a problem from a memory point of view. Update Here are the table definitions for the example I used in my question: create table Order ( Id int identity(1, 1) primary key, ProductName ntext null ) create table Customer ( Id int identity(1, 1) primary key, OrderId int null references Order (Id) )

    Read the article

  • Accessing and manipulating lwpf listbox datatemplate elements

    - by black sensei
    Hello good people , i'm trying to achieve a functionality but i'm don't know how to start it. I'm using vs 2008 sp1 and i'm consuming a webservice which returns a collection (is contactInfo[]) that i bind to a ListBox with little datatemplate on it. <ListBox Margin="-146,-124,-143,-118.808" Name="contactListBox" MaxHeight="240" MaxWidth="300" MinHeight="240" MinWidth="300"> <ListBox.ItemTemplate> <DataTemplate> <TextBlock> <CheckBox Name="contactsCheck" Uid="{Binding fullName}" Checked="contacts_Checked" /><Label Content="{Binding fullName}" FontSize="15" FontWeight="Bold"/> <LineBreak/> <Label Content="{Binding mobile}" FontSize="10" FontStyle="Italic" Foreground="DimGray" /> <Label Content="{Binding email}" FontStyle="Italic" FontSize="10" Foreground="DimGray"/> </TextBlock> </DataTemplate> </ListBox.ItemTemplate> </ListBox> Every works fine so far. so When a checkbox is checked i'll like to access the information of the labels (either the) belonging to the same row or attached to it and append the information to a global variable for example (for each checkbox checked). My problem right now is that i don't know how to do that. Can any one shed some light on how to do that? if you notice Checked="contacts_Checked" that's where i planned to perform the operations. thanks for reading and helping out

    Read the article

  • Creating multiple instances of a generic database

    - by sagekilla
    Hi all, currently I'm trying to have a setup where a generic database is distributed to students. They would develop an application using this database (Say a shopping cart application), submit their project onto our server, and then it would be graded automatically. These databases are being run in Microsoft SQL Server 2005. We're using user instances to instantiate each database, and multiple requests could be serviced at once. But, the problem is when more than one student submitted a project to be graded, the first database to be instantiated would be the only one and would overwrite all other copies that were currently open. So if stu1 modified his database and stu2 and stu3 had their projects being graded concurrently, at the end of the grading stu1, stu2, and stu3 would have identical DB's at the end. Is there any way I can have multiple independent copies of a generic database, each of which I can load concurrently and modify without having any changes made to any one affecting the others? I did a little reading, and thought it might be possible to do something along the lines of: Student submits project Attach the database with unique db name (specified by student) Do all necessary operations Detach the database I'm unsure if this would fix our problem or be possible, so any help would be much appreciated!

    Read the article

  • The sign of zero with float2

    - by JackOLantern
    Consider the following code performing operations on complex numbers with C/C++'s float: float real_part = log(3.f); float imag_part = 0.f; float real_part2 = (imag_part)*(imag_part)-(real_part*real_part); float imag_part2 = (imag_part)*(real_part)+(real_part*imag_part); The result will be real_part2= -1.20695 imag_part2= 0 angle= 3.14159 where angle is the phase of the complex number and, in this case, is pi. Now consider the following code: float real_part = log(3.f); float imag_part = 0.f; float real_part2 = (-imag_part)*(-imag_part)-(real_part)*(real_part); float imag_part2 = (-imag_part)*(real_part)+(real_part)*(-imag_part); The result will be real_part2= -1.20695 imag_part2= 0 angle= -3.14159 The imaginary part of the result is -0 which makes the phase of the result be -pi. Although still accomplishing with the principal argument of a complex number and with the signed property of floating point's 0, this changes is a problem when one is defining functions of complex numbers. For example, if one is defining sqrt of a complex number by the de Moivre formula, this will change the sign of the imaginary part of the result to a wrong value. How to deal with this effect?

    Read the article

  • C function prototype: void f(). Is it recommended?

    - by ycalleecharan
    Hi, I'm learning C and I saw in a book that a function prototype has the form void f() and in the function declaration or in the calling function, the f function takes arguments. Thus In the function declaration we have something like void f(long double y[], long double A) and in the calling function is f(y, A). The function is doing operations on the array y i.e. when the function is called, some elements in the array y are changing. A is just a constant numerical value that doesn't change. I have two questions: If defining the function prototype at the top in the program as void f() a good practice? Or is it better to put it as void f(long double y[], long double A) as in the function declaration? The called function f is changing elements in the array y. Is void the right return type? The program is working fine as such with the void as described. Or should I change all my "voids" to "long double". I'm working with long double as I need as much precision as possible though on my machine both double and long double gives me 15 precision digits. Thanks a lot

    Read the article

  • Android: Calculator on showing 0 immediately after the dot

    - by pearmak
    I am now working on a calculator, and everything works fine except for decimal places. The calculator contains 2 displays actually, one is called fakedisplay for actual operations, and one is called Display, for presenting the desired format, ie adding commas. When pressing 12345.678, Display will follow fakedisplay and present as 12,345.678, but if i press 12345.009, the fakedisplay will work normally as 12345.009, but the Display stuck as 12,345 until 9 is pressed, and at that time it will show 12,345.009 normally. However, it is strange that when the user presses 0, there is no response, and until pressing 9, 009 will then immediately append. I know this arise from the parsing code, but based on this, how could I amend the following code? I really cannot think of any solution... Many thanks for all your advice! one.setOnClickListener(new View.OnClickListener() { if (str.length()<15) {Fakedisplay.append("1");} DecimalFormat myFormatter1 = new DecimalFormat("###,###,###,###.#################"); String str1=Fakedisplay.getText().toString(); String stripped1 = Double.valueOf(str1).toString(); stripped1 = myFormatter1.format(Double.valueOf(stripped1)); if (stripped1.endsWith(".0")) stripped1 = stripped1.substring(0, stripped1.length() - 2); Display.setText(stripped1);

    Read the article

< Previous Page | 133 134 135 136 137 138 139 140 141 142 143 144  | Next Page >