Search Results

Search found 7391 results on 296 pages for 'record locking'.

Page 75/296 | < Previous Page | 71 72 73 74 75 76 77 78 79 80 81 82  | Next Page >

  • strange SqlAlchemy update behaviour

    - by Max
    I'm new to SqlAlchemy and Elixir, so I've started from tutorial and tried to create table, insert a record, and then update it as follows: #'elixir_test.py' from elixir import * metadata.bind = "postgresql://myuser:mypwd@localhost:5432/dbname" metadata.bind.echo = True class Movie(Entity): title = Field(Unicode(30)) year = Field(Integer) description = Field(UnicodeText) def __repr__(self): return '<Movie "%s" (%d)>' % (self.title, self.year) and in another file in the same directory: from elixir_test import * setup_all() #create table create_all() Movie(title=u"Blade Runner", year=1982) #add record session.commit() #get records Movie.query.all() #trying to update record and commit changes, BUT... movie = Movie.query.first() movie.year = 1983 session.commit() #now we have two records in our table, one #with year=1982 and one with year=1983 Movie.query.all() What did I missed?

    Read the article

  • Using key().id() on GAE Datastore and reverse geocoding

    - by Ivan Slaughter
    I have 6000 data of district, subdistrict. I need to represent this on dependent dropdown. The datamodel is for example; class Location(db.Model): location_name = db.StringProperty() location_parent = db.IntegerProperty() location_parent is reference to key() or id()? Still cannot decide which one is good. When i use key() as reference then using JSON to create jquery dependent drop down. My page loading/query and rendering time the dropdown is quite slow? Can i use key().id() as drop down option value to lighten up the page load? Any better solution for this parent/child reference for the drop down? For example: for the district record/entities the location-parent is null, for sub district record location_name will contain reference to parent district record. Other issue is to reverse geocoding the location to store or display geoPoint (lat,long)? Is google MAP API always find the exact lat,long of specific region boundaries or any error checking for the result?

    Read the article

  • Using LINQ to XML, how can I join two sets of data based on ordinal position?

    - by Donald Hughes
    Using LINQ to XML, how can I join two sets of data based on ordinal position? <document> <set1> <value>A</value> <value>B</value> <value>C</value> </set1> <set2> <value>1</value> <value>2</value> <value>3</value> </set2> </document> Based on the above fragment, I would like to join the two sets together such that "A" and "1" are in the same record, "B" and "2" are in the same record, and "C" and "3" are in the same record.

    Read the article

  • ActiveRecord fundamentally incompatible with composite keys?

    - by stimms
    I have been attempting to use subsonic for a project on which I'm working. All was going quite well until I encountered a link table with a composite primary key. That is a key made up of the primary keys of the two tables it joins. Subsonic failed to recognize both keys which was problematic. I was going to adjust subsonic to support compound keys but I stopped and though "Maybe there is a reason for this". Normally active record relies on a single primary key field for every record, even in link tables. But is this necessary? Should I just give up on active record for this project or continue with my modifications?

    Read the article

  • How to check all check boxes at a click of a button

    - by LivingThing
    I am new to Swing, UI and MVC I have created a code based on MVC. Now my problem is that that in the controller part i have an actioneventlistener which listens to different button clicks. Out of all those buttons i have "select all" and "de-select all". In my view i have a table, one of the column of that table contains "check boxes". Now, when i click the "select-all" button i want to check all the check boxes and with "de-select all" i want to uncheck all of them. Below is my code which is not working. Please tell me what am i doing wrong here. Also, if someone knows a more elagent way please share. Thanks In my view public class CustomerSelectorDialogUI extends JFrame{ public CustomerSelectorDialogUI(TestApplicationUI ownerView, DummyCustomerStore dCStore, boolean modality) { //super(ownerView, modality); setTitle("[=] Customer Selection Dialog [=]"); //setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); custSelectPanel = new JPanel(); buttonPanel = new JPanel(); selectAllButton = new JButton(" Select All "); clearAllButton = new JButton(" Clear All "); applyButton = new JButton(" Apply "); cancelButton = new JButton(" Cancel "); PopulateAndShow(dCStore, Boolean.FALSE); } public void PopulateAndShow(DummyCustomerStore dCStore, Boolean select) { List data = new ArrayList(); for (Customer customer : dCStore.getAllCustomers()) { Object record[] = new Object[COLUMN_COUNT]; record[0] = (select == false) ? Boolean.FALSE : Boolean.TRUE; record[1] = Integer.toString(customer.customerId); record[2] = customer.fullName; data.add(record); } tModel = new TableModel(data); // In the above for loop accoring to user input (i.e click on check all or // uncheck all) i have tried to update the data. As it can be seen that i // have a condition for record[0]. //After the loop, here i have tried several options like validate(). repaint but to no avail customerTable = new JTable(tModel); scrollPane = new JScrollPane(customerTable); setContentPane(this.createContentPane()); setSize(480, 580); setResizable(false); setVisible(true); } private JPanel createContentPane() { custSelectPanel.setLayout(null); customerTable.setDragEnabled(false); customerTable.setFillsViewportHeight(true); scrollPane.setLocation(10, 10); scrollPane.setSize(450,450); custSelectPanel.add(scrollPane); buttonPanel.setLayout(null); buttonPanel.setLocation(10, 480); buttonPanel.setSize(450, 100); custSelectPanel.add(buttonPanel); selectAllButton.setLocation(0, 0); selectAllButton.setSize(100, 40); buttonPanel.add(selectAllButton); clearAllButton.setLocation(110, 0); clearAllButton.setSize(100, 40); buttonPanel.add(clearAllButton); applyButton.setLocation(240, 0); applyButton.setSize(100, 40); buttonPanel.add(applyButton); cancelButton.setLocation(350, 0); cancelButton.setSize(100, 40); buttonPanel.add(cancelButton); return custSelectPanel; } } Table Model private class TableModel extends AbstractTableModel { private List data; public TableModel(List data) { this.data = data; } private String[] columnNames = {"Selected ", "Customer Id ", "Customer Name " }; public int getColumnCount() { return COLUMN_COUNT; } public int getRowCount() { return data == null ? 0 : data.size(); } public String getColumnName(int col) { return columnNames[col]; } public void setValueAt(Object value, int rowIndex, int columnIndex) { getRecord(rowIndex)[columnIndex] = value; super.fireTableCellUpdated(rowIndex, columnIndex); } private Object[] getRecord(int rowIndex) { return (Object[]) data.get(rowIndex); } public Object getValueAt(int rowIndex, int columnIndex) { return getRecord(rowIndex)[columnIndex]; } public Class getColumnClass(int columnIndex) { if (data == null || data.size() == 0) { return Object.class; } Object o = getValueAt(0, columnIndex); return o == null ? Object.class : o.getClass(); } public boolean isCellEditable(int row, int col) { if (col > 0) { return false; } else { return true; } } } } A Views Action Listener class CustomerSelectorUIListener implements ActionListener{ CustomerSelectorDialogUI custSelectView; Controller controller; public CustomerSelectorUIListener (Controller controller, CustomerSelectorDialogUI custSelectView) { this.custSelectView = custSelectView; this.controller = controller; } @Override public void actionPerformed(ActionEvent e) { String actionEvent = e.getActionCommand(); else if ( actionEvent.equals( "clearAllButton" ) ) { controller.checkButtonControl(false); } else if ( actionEvent.equals( "selectAllButton" ) ) { controller.checkButtonControl(true); } } } Main Controller public class Controller implements ActionListener{ CustomerSelectorDialogUI selectUI; DummyCustomerStore store; public Controller( DummyCustomerStore store, TestApplicationUI appUI ) { this.store = store; this.appUI = appUI; appUI.ButtonListener( this ); } @Override public void actionPerformed(ActionEvent event) { String viewAction = event.getActionCommand(); if (viewAction.equals("TEST")) { selectUI = new CustomerSelectorDialogUI(appUI, store, true); selectUI.showTextActionListeners(new CustomerSelectorUIListener( this, selectUI ) ); selectUI.setVisible( true ); } } public void checkButtonControl (Boolean checkAll) { selectUI.PopulateAndShow(store, checkAll); } }

    Read the article

  • If Inner Join can be thought of as Cross Join but filtering out the records satisfying the condition

    - by Jian Lin
    If an Inner Join can be thought of as a cross join and then getting the records that satisfy the condition, then a LEFT OUTER JOIN can be thought of as that, plus ONE record on the left table that doesn't satisfy the condition. In other words, it is not a cross join that "goes easy" on the left records (even when the condition is not satisfied), because then the left record can appear many times (as many as how many records there are in the right table). So the LEFT OUTER JOIN is the Cross JOIN with the records satisfying the condition, plus ONE record from the LEFT TABLE that doesn't satisfy the condition.

    Read the article

  • Pageview implementation

    - by The Elite Gentleman
    Hi everyone I want to add a pageview feature on my current web application. This page view is based on the count of user viewing the page. It must be unique, i.e. I must not view a person's page 10000 times and record it as 10000 views, just record 1 view instead. My question is, should I base my pageview count on IP address? If not, what is/are the best approach in doing this? I know that if the person has logged in to my system, I can simply use the user id stored in the session and check on the record if the user has/hasn't viewed the page and update accordingly. But for "anonymous" viewers, what is the best approach? Thanks. PS How does Youtube does it?

    Read the article

  • How To Get A Field Value Based On The Max Of Another Field In VFP v8.0

    - by DaveB
    So, I have a table and I want to get the value from one field in the record with the greatest DateTime() value in another field and where still another field is equal to a certain value. Example data: Balance Created MeterNumber 7924.252 02/02/2010 10:31:48 AM 2743800 7924.243 02/02/2010 11:01:37 AM 2743876 7924.227 02/02/2010 03:55:50 PM 2743876 I want to get the balance for a record with the greatest created datetime for a specific meter number. In VFP 7 I can use: SELECT a.balance ,MAX(a.created) FROM MyTable a WHERE a.meternumber = '2743876' But, in the VFP v8.0 OleDb driver I am using in my ASP.NET page I must conform to VFP 8 which says you must have a GROUP BY listing each non aggregate field listed in the SELECT. This would return a record for each balance if I added GROUP BY a.balance to my query. Yes, I could issue a SET ENGINEBEHAVIOR 70 but I wanted to know if this could be done without having to revert to a previous version?

    Read the article

  • Cross-reference between delphi records

    - by Paul-Jan
    Let's say I have a record TQuaternion and a record TVector. Quaternions have some methods with TVector parameters. On the other hand, TVector supports some operations that have TQuaternion parameters. Knowing that Delphi (Win32) does not allow for forward record declarations, how do I solve this elegantly? Using classes is not really an option here, because I really want to use operator overloading for this rare case where it actually makes good sense. For now I simply moved these particular methods out of the records and into separate functions, the good old-fashioned way. Better suggestions are most welcome.

    Read the article

  • Getting "on the wire" Size of Messages in WCF

    - by Mystagogue
    While I'm making SOAP or REST invocations to WCF, I'd like to have the channel stack on either end (client and server) record the on-the-wire size of the data received. So I'm guessing I need to add a custom behavior to the channel stack on either side. That is, on the server side I'd record the IP-header advertised size that was received. On the client side I'd record the IP-header advertised size that was returned from the server. But this presupposes that this information is visible to a custom WCF behavior at the channel stack level. Perhaps it is only visible at the level of ASP.NET (at a layer beneath WCF)? In short, does anyone have any further insight on if and how this information is accessible? I must qualify that this "size" data will be collected in a production environment, as part of regular business logic calls. This question is related to my earlier bandwidth question.

    Read the article

  • Question About DateCreated and DateModified Columns - MS SQL Server

    - by user311509
    CREATE TABLE Customer ( customerID int identity (500,20) CONSTRAINT . . dateCreated datetime DEFAULT GetDate() NOT NULL, dateModified datetime DEFAULT GetDate() NOT NULL ); When i insert a record, dateCreated and dateModified gets set to default date/time. When i update/modify the record, dateModified and dateCreated remains as is? What should i do? Obviously, i need to dateCreated value to remain as was inserted the first time and dateModified keeps changing when a change/modification occurs in the record fields. In other words, can you please write a sample quick trigger? I don't know much yet... Any help will be appreciated.

    Read the article

  • Question About DateCreated and DateModified Columns - SQL Server

    - by user311509
    CREATE TABLE Customer ( customerID int identity (500,20) CONSTRAINT . . dateCreated datetime DEFAULT GetDate() NOT NULL, dateModified datetime DEFAULT GetDate() NOT NULL ); When i insert a record, dateCreated and dateModified gets set to default date/time. When i update/modify the record, dateModified and dateCreated remains as is? What should i do? Obviously, i need to dateCreated value to remain as was inserted the first time and dateModified keeps changing when a change/modification occurs in the record fields. In other words, can you please write a sample quick trigger? I don't know much yet...

    Read the article

  • Must I loop to search results for a specific value?

    - by tag
    I have a table in the database: name Opinion Tim Tim has an opinion John other random text Dan Dan's random text Al Al says something else I call this data and get it back in getRecords.lastResult To access John's opinion, I could use: getRecords.lastResult[1].opinion But that's only because I know that John is the second record (record 1), but this may change. So the right way is to search through the results to first find the record index for John, then access his opinion. My guess is I need some sort of a loop? Is there an easier way to search for John directly without a loop?

    Read the article

  • MVC: Upload image in partial view, routing problem

    - by D.J
    I am trying to upload images via a form which sits in partial view using MVC. View Code: <form action="/Item/ImageUpload" method="post" enctype="multipart/form-data"> <%= Html.TextBox("ItemId",Model.ItemId) %> <input type="file" name="file" id="file" /> <input type="submit" value="Add" /> </form> Action Code: public void ImageUpload(string ItemId, HttpPostedFileBase file) { // upload image // Add Image record to database // Associate Image record to Item record //Go back to existing view where the partial view sits RedirectToAction("Details/"+ItemId); } The Image is uploaded successful All the data manipulation are working as expected However instead of redirect to view "Item/Details/id", page went to "/Item/ImageUpload" I tried several different way of doing this including using jsonResultAction, but all failed in this same result. where did i do wrong, any ideas? thanks in advance

    Read the article

  • 50 sequences in one line

    - by user343934
    I have Muttiple sequence alignment (clustal) file and i want to read this file and arrange sequences in a such a way that in looks more clear and precise in order. I am doing this from biopython using AlignIO object. My codes like this alignment = AlignIO.read("opuntia.aln", "clustal") print "Number of rows: %i" % len(align) for record in alignment: print "%s - %s" % (record.id, record.seq) My Output-- http://i48.tinypic.com/ae48ew.jpg , it looks messy and long scrolling. What i want to do is print only 50 sequences in each line and continue till the end of alignment file. I wish to have output like this---http://i45.tinypic.com/4vh5rc.jpg from --http://www.ebi.ac.uk/Tools/clustalw2/, sorry two links are just a text due to my reputation. Any suggestions, algorithm and sample code is appreciated Thanks in advance Br,

    Read the article

  • Querying Two Tables At Once

    - by John
    Hello, I am trying to do what I believe is called a join query. First, in a MySQL table called "login," I want to look up what "loginid" is in the record where "username" equals $profile. (This will be just one record / row in the MySQL table). Then, I want to take that "loginid" and look up all rows / records in a different MySQL table called "submission," and pull data that have that "loginid." This could possibly be more than one record / row. How do I do this? The code below doesn't seem to work. Thanks in advance, John $profile = mysql_real_escape_string($_GET['profile']); $sqlStr = "SELECT l.username, l.loginid, s.loginid, s.submissionid, s.title, s.url, s.datesubmitted, s.displayurl FROM submission AS s, login AS l WHERE l.username = '$profile', s.loginid = l.loginid ORDER BY s.datesubmitted DESC";

    Read the article

  • .net Diagnostics best practices?

    - by mamu
    We initially didn't use any logging or debug tracing but after spending few weeks to trace down some data corruption we decided to put required Debug.Write and Trace for production and Debug.Assert So now question is What is the best practice to use debug and trace logging. I am just looking for some thing generic. public void AddRectodatabase(object record) { Debug.WriteLine(record.ToString()); Trace.WriteLine(record.ToString()); // Add it to databse Debug.Assert(true, "Use this on case by case basis"); } Is this good enough for general purpose, am i doing anything wrong in there? We want to stick with .net System.Diagnostics over other alternatives like log4net. Is there any thing else useful in System.Diagnostics?

    Read the article

  • Best practice for partial updates in a RESTful service

    - by magiconair
    I am writing a RESTful service for a customer management system and I am trying to find the best practice for updating records partially. For example, I want the caller to be able to read the full record with a GET request. But for updating it only certain operations on the record are allowed, like change the status from ENABLED to DISABLED. (I have more complex scenarios than this) I don't want the caller to submit the entire record with just the updated field for security reasons (it also feels like overkill). Is there a recommended way of constructing the URIs? Do I use GET, POST, PUT or is there no agreed way of doing these kind of things? When reading the REST books RPC style calls seem to be frowned upon. Thanks Frank

    Read the article

  • Walking a hierarchy table with Linq

    - by Retrocoder
    I have a table with two columns, GroupId and ParentId (both are GUIDS). The table forms a hierarchy so I can look for a value in the “GroupId” filed, when I have found it I can look at its ParentId. This ParentId will also appear in the GroupId of a different record. I can use this to walk up the hierarchy tree from any point to the root (root is an empty GUID). What I’d like to do is get a list of records when I know a GroupId. This would be the record with the GroupId and all the parents back to the root record. Is this possible with Linq and if so, can anyone provide a code snippet?

    Read the article

  • Data model for timesheet to task and/or timesheet to project?

    - by John
    Let's say I want to make a simple project tracking system. A manager can create a project. Then he can create tasks for that project. Team members can record the hours they work for each task or for the project as a whole. Is the following design for the t_timesheet table a good idea? timesheet_id - primary key, autoincrement project_id - not null, foreign key constraint to t_project task_id - nullable, foreign key constraint to t_task user_id - not null, foreign key constraint to t_user hours - decimal Or should I do something like this: timesheet_id - primary key, autoincrement task_id - not null, foreign key constraint to t_task user_id - not null, foreign key constraint to t_user hours - decimal In the second option, I intend to always have a record in t_task labelled "miscellaneous items" with a foreign key to the relevant t_project record. Then I'll be able to track all hours for a project that aren't for any particular task. Are any of the ideas above good? What would be better?

    Read the article

  • SQL trigger for audit table question

    - by mattgcon
    I am writing a trigger to audit updates and deletes in tables. I am using SQL Server 2008 My questions are, Is there a way to find out what action is being taken on a record without going through the selection phase of the deleted and inserted tables? Another question is, if the record is being deleted, how do I record within the audit table the user that is performing the delete. (NOTE: the user connected to the database is a general connection string with a set user, I need the user who is logged into either a web app or a windows app) Please help?

    Read the article

  • Upsert - Efficient Update or Insert in VB.Net, SQL Server

    - by HK1
    I'm trying to understand how to streamline the process of inserting a record if none exists or updating a record if it already exists. I'm not using stored procedures, although maybe that would be the most efficient way of doing this. The actual scenario in which this is necessary is saving a user preference/setting to my SettingsUser table. In MS Access I would typically pull a DAO recordset looking for the specified setting. If the recordset comes back empty then I know I need to add a new record which I can do with the same recordset object. On the other hand, if it isn't empty, I can just update the setting's value right away. In theory, this is only two database operations. What is the recommended way of doing this in .NET?

    Read the article

  • PHP e-commerce site talking to internal database for stock / ordering?

    - by CitrusTree
    Hi. I'm working on an e-commerce site (either bespoke with PHP, or using Drupal/Ubercart), and I'd like to investigate the site interacting with an internal (filemaker) database we use to manage stock and orders. Currently we manually transfer orders from the web site to our own database, and the site does not check or record changes in stock. My plan to allow the 2 to interact is as follows: Make the internal database available externaly on a machine with a fixed IP Allow external access from the site only Connect to the internal database using ODBC (or similar) Use simple queries to check stock / record stock changes / record order details Am I missing something here as this sounds quite straight forward? Is there another solution I should be taking a look at? Thanks in advance for any help or comments.

    Read the article

  • Simulating an identity column within an insert trigger

    - by William Jens
    I have a table for logging that needs a log ID but I can't use an identity column because the log ID is part of a combo key. create table StuffLogs { StuffID int LogID int Note varchar(255) } There is a combo key for StuffID & LogID. I want to build an insert trigger that computes the next LogID when inserting log records. I can do it for one record at a time (see below to see how LogID is computed), but that's not really effective, and I'm hoping there's a way to do this without cursors. select @NextLogID = isnull(max(LogID),0)+1 from StuffLogs where StuffID = (select StuffID from inserted) The net result should allow me to insert any number of records into StuffLogs with the LogID column auto computed. StuffID LogID Note 123 1 foo 123 2 bar 456 1 boo 789 1 hoo Inserting another record using StuffID: 123, Note: bop will result in the following record: StuffID LogID Note 123 3 bop

    Read the article

  • saving a records containing a member of type string to a file (Delphi, Windows)

    - by wonderer
    I have a record that looks similar to: type TNote = record Title : string; Note : string; Index : integer; end; Simple. The reason I chose to set the variables as string (as opposed to an array of chars) is that I have no idea how long those strings are going to be. They can be 1 char long, 200 or 2000. Of course when I try to save the record to a type file (file of...) the compiler complains that I have to give a size to string. Is there a way to overcome this? or a way to save those records to an untyped file and still maintain a sort of searchable way? Please do not point me to possible solutions, if you know the solution please post code. Thank you

    Read the article

< Previous Page | 71 72 73 74 75 76 77 78 79 80 81 82  | Next Page >