Search Results

Search found 12215 results on 489 pages for 'identity column'.

Page 69/489 | < Previous Page | 65 66 67 68 69 70 71 72 73 74 75 76  | Next Page >

  • Rails uniqueness constraint and matching db unique index for null column

    - by Dave
    I have the following in my migration file def self.up create_table :payment_agreements do |t| t.boolean :automatic, :default => true, :null => false t.string :payment_trigger_on_order t.references :supplier t.references :seller t.references :product t.timestamps end end I want to ensure that if a product_id is specified it is unique but I also want to allow null so I have the following in my model: validates :product_id, :uniqueness => true, :allow_nil => true Works great but I should then add an index to the migration file add_index :payment_agreements, :product_id, :unique => true Obviously this will throw an exception when two null values are inserted for product_id. I could just simply omit the index in the migration but then there's the chance that I'll get two PaymentAgreements with the same product_id as shown here: Concurrency and integrity My question is what is the best/most common way to deal with this problem

    Read the article

  • how do I update the date type column?

    - by Muhammad Hammad
    update answers a1 set a1.FilingDate=( select date_sub( a2.FilingDate ,Interval 1000 Year) as FilingDate from answers a2 where Year(a2.FilingDate)>=3000 ) where Year(a1.FilingDate)>=3000 but it gives me the following error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'update answers a1 set a1.FilingDate=( select date_sub(a2.FilingDate,Interval 10' at line 1 Can anyone tell me about the issue and its solution?

    Read the article

  • WPF data grid - Column Header not aligned with data rows

    - by Pawan
    Hi, I am using Datagrid in WPF. This is a very simple and basic implementation. I not using any styles. I created a simple datagrid : <dg:DataGrid x:Name="dg" > </dg:DataGrid> and populated it with data as: dg.ItemsSource = " H E L L O W O R L D!".Split(); Grid gets properly populated but the columnheader of the grid is drawn with some offset. Due to this my data and header are mis aligned. I tried searching for this over net but I haven't found anything. This seems to be a straightforward implementation which is working for everyone except me :(. Can anyone please tell me what might be going wrong? I have tried using different data sets and appyling some style to test this. Thanks in advance.

    Read the article

  • Datatable add new column and values speed issue

    - by Cine
    I am having some speed issue with my datatables. In this particular case I am using it as holder of data, it is never used in GUI or any other scenario that actually uses any of the fancy features. In my speed trace, this particular constructor was showing up as a heavy user of time when my database is ~40k rows. The main user was set_Item of DataTable. protected myclass(DataTable dataTable, DataColumn idColumn) { this.dataTable = dataTable; IdColumn = idColumn ?? this.dataTable.Columns.Add(string.Format("SYS_{0}_SYS", Guid.NewGuid()), Type.GetType("System.Int32")); JobIdColumn = this.dataTable.Columns.Add(string.Format("SYS_{0}_SYS", Guid.NewGuid()), Type.GetType("System.Int32")); IsNewColumn = this.dataTable.Columns.Add(string.Format("SYS_{0}_SYS", Guid.NewGuid()), Type.GetType("System.Int32")); int id = 1; foreach (DataRow r in this.dataTable.Rows) { r[JobIdColumn] = id++; r[IsNewColumn] = (r[IdColumn] == null || r[IdColumn].ToString() == string.Empty) ? 1 : 0; } Digging deeper into the trace, it turns out that set_Item calls EndEdit, which brings my thoughts to the transaction support of the DataTable, for which I have no usage for in my scenario. So my solution to this was to open editing on all of the rows and never close them again. _dt.BeginLoadData(); foreach (DataRow row in _dt.Rows) row.BeginEdit(); Is there a better solution? This feels too much like a big giant hack that will eventually come and bite me. You might suggest that I dont use DataTable at all, but I have already considered that and rejected it due to the amount of effort that would be required to reimplement with a custom class. The main reason it is a datatable is that it is ancient code (.net 1.1 time) and I dont want to spend that much time changing it, and it is also because the original table comes out of a third party component.

    Read the article

  • 3 column sticky footer

    - by blackessej
    html, body, #box { padding:0px; margin:0px; height:100%; min-height:100%; } body { background-image:url(images/footerbg.png); background-repeat:repeat-x repeat-y scroll; font-size:12px; font-family:Georgia; color:#564b47; } p, h1 { margin:0px 10px 10px 10px; } h1 { font-size:14px; padding-top:10px; text-transform:uppercase; color:#564b47; background-color:transparent; } a { color:#ff66cc; font-size:11px; background-color:transparent; text-decoration:none; } pre { color:#564b47; font-size:11px; background-color:transparent; } #box { position:relative; width:750px; margin:0 auto; text-align:left; height:auto!important; } #shadow { background:url("images/shadow.png") repeat-y scroll 0 0 transparent; width:760px; margin:auto; padding:0px; text-align:left; height:100%; z-index:0; margin-bottom:-40px; } #left { width:175px; float:left; background-color:#ff99cc; height:auto!important; height:100%; min-height:100%; text-align:left; } #content { width:400px; float:left; overflow:auto; background-color:#fff; height:auto!important; } #right { width:175px; float:right; background-color:#ff99cc; height:auto!important; height:100%; min-height:100%; text-align:right; } #head { background-image:url(images/banner.png); background-repeat:no-repeat; background-color:#000; height:125px; text-align:center; margin:auto; } #menu { width:100%; } p a { color:#000; text-decoration:underline; } a { color:#fb0303; text-decoration:none; outline:none; } a:visited { color:#fb0303; } p a:hover { text-decoration:underline!important; } ul#nav { margin:auto; width:100%; } ul#nav li a { display:block; font-size:12px; font-weight:bold; padding:4px; background:#000; } ul#nav li a:hover { background:#000; color:#fff; } li { list-style:none; top:100px; float:left; position:relative; width:110px; text-align:center; } li ul { display:none; position:relative; width:auto; margin-left:6px; border-top:4px dotted #fb0303; } li>ul { top:-102px; left:-40px; } li:hover ul, li.over ul { display:block; } ul#nav li.current a { background:#000; } ul#nav li.current a:hover { background:#000; } #player { width:360px; height:240px; position:absolute; z-index:2; } #head h1 { font-size:11px; text-transform:uppercase; text-align:right; color:#564b47; background-color:#90897a; padding:5px 15px; margin:0px; } #head p { padding:10px; margin:0px; } .footer { position:relative; height:40px; background-color:#444; } I want the three columns to be 100% height so that they go all the way to the footer. Right now, they're only as long as their content. The columns are #left, #right and #content. Pretty new to this stuff. Please feel free to point out sloppy code, redundancy, etc. And thank you.

    Read the article

  • making arrays from tab-delimited text file column

    - by absolutenewbie
    I was wondering if anyone could help a desperate newbie with perl with the following question. I've been trying all day but with my perl book at work, I can't seem to anything relevant in google...or maybe am genuinely stupid with this. I have a file that looks something like the following: Bob April Bob April Bob March Mary August Robin December Robin April The output file I'm after is: Bob April April March Mary August Robin December April So that it lists each month in the order that it appears for each person. I tried making it into a hash but of course it wouldn't let me have duplicates so I thought I would like to have arrays for each name (in this example, Bob, Mary and Robin). I'm afraid to upload the code I've been trying to tweak because I know it'll be horribly wrong. I think I need to define(?) the array. Would this be correct? Any help would be greatly appreciated and I promise I will be studying more about perl in the meantime. Thank you for your time, patience and help. #!/usr/bin/perl -w while (<>) { chomp; if (defined $old_name) { $name=$1; $month=$2; if ($name eq $old_name) { $array{$month}++; } else { print "$old_name"; foreach (@array) { push (@array, $month); print "\t@array"; } print "\n"; @array=(); $array{$month}++; } } else { $name=$1; $month=$2; $array{month}++; } $old_name=$name; } print "$old_name"; foreach (@array) { push (@array, $month); print "\t@array"; } print "\n";

    Read the article

  • sql server : get default value of a column

    - by luke
    Hello, I execute a select to get the structure of a table. I want to get info about the columns like its name or if it's null or if it's primary key.. I do something like this ....sys.columns c... c.precision, c.scale, c.is_nullable as isnullable, c.default_object_id as columndefault, c.is_computed as iscomputed, but for default value i get the id..something like 454545454 but i want to get the value "xxxx". What is the table to search or what is the function to convert that id to the value. Thanks

    Read the article

  • Jquery: How do i not select a specific column

    - by Poku
    I have a table, where i have a click event on the tr: <tr id="<%= candidate.AnsogerID %>" class="newCandidatesTableTr"> , this click event: $(".newCandidatesTableTr").click(function(e) { works just fine, but in the row i also have a click event on a td: $(".insertCandidate").live("click", (function(e) { and this conflicts eachother. I want to do one thing if the tr is clicked and other when this specific td in the tr is clicked. So how do i in my tr.click() event defined that the event shall not happend when i click the specific td? Here is the code: // Lists a table with old candidates who migth be the same person as the new candidate $(".newCandidatesTableTr").click(function(e) { alert(this.id); GetCandidateName(this.id); }); // Show insert candidate dialog $(".insertCandidate").live("click", (function(e) { var tempCanName = $(".suggentionCandidatesTableTitle").text(); var tempCanNameSub = tempCanName.substr(0, tempCanName.length - 1); var canName = $(".suggentionCandidateName_" + canID + "").text(); $("#mergeCandidateDialog").empty(); $.blockUI({ message: $("#mergeCandidateDialog").append( "<div>" + tempCanNameSub + "'s ansøgning vil blive lagt under den eksiterende ansøger " + canName + "'s data.<br /><br /> Ønsker du at fortsætte?<br /><br /></div>" + "<div id=\"content\">" + "<input type=\"button\" id=\"" + this.id + "\" class=\"insertCandidateYes\" value=\"Ja\" />" + "<input type=\"button\" id=\"insertCandidateNo\" value=\"Nej\" /></div>"), css: { cursor: 'default', fontWeight: 'normal', padding: '7px', textAlign: 'left' } }); })); <% foreach (var candidate in Model.Ansogninger) { %> <tr id="<%= candidate.AnsogerID %>" class="newCandidatesTableTr"> <td><div id="candidateID""><label title="<%= candidate.Navn %>"><%= candidate.AnsogerID %></label></div></td> <td><div id="<%= "candidateName_" + candidate.AnsogerID %>" class="candidateNameTD"><%= candidate.Navn %></div></td> <td><div id="candidateEmail"><%= candidate.Email %></div></td> <td><div id="candidateRundeName"><%= Model.RundeName %></div></td> <td id="testTD"> <div id="<%= "acceptCandidateButton_" + candidate.AnsogerID %>" class="acceptb">Godkend</div> </td> </tr> <% } %>

    Read the article

  • sqlite ERROR no such column

    - by Richard
    Hi, Does anyone here have some experience with this error? Only If I use the WHERE clause, I get this error. I use php PDO to get the results. And this is my simple table $sql = "CREATE TABLE samenvatting ( stem_id INTEGER PRIMARY KEY AUTOINCREMENT, poll_id TEXT, stem_waarde_id TEXT, totaal INTEGER )"; $crud->rawQuery($sql); $poll_id = "somepoll"; $records = $crud->rawSelect('SELECT * FROM samenvatting WHERE poll_id=´.$poll_id); pdo abstract class public function conn() { isset($this->username); isset($this->password); if (!$this->db instanceof PDO) { $this->db = new PDO($this->dsn, $this->username, $this->password); $this->db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); } } public function rawSelect($sql) { $this->conn(); return $this->db->query($sql); } Thanks, Richard

    Read the article

  • ng-grid get filtered column count after filtering

    - by Ryan Langton
    I'm using ng-grid with filtering. Any time the filter updates I want to get the filtered item count. I have been able to do this using the filteredRows property of ngGrid. However I'm getting the rows BEFORE the filtering occurs and I want them AFTER the filtering occurs. Here is a plunker to demonstrate the behavior: http://plnkr.co/edit/onyE9e?p=preview Here is the code where filtering is occuring: $scope.$watch('gridOptions.filterOptions.filterText2', function(searchText, oldsearchText) { if (searchText !== oldsearchText) { $scope.gridOptions.filterOptions.filterText = "name:" + searchText + "; "; $scope.recordCount = $scope.gridOptions.ngGrid.filteredRows.length; } });

    Read the article

  • NSOutlineView/NSTreeController - calculate sum of column

    - by matei
    I have a NSOutlineView bound to a NSTreeController. My data items are a custom class , let's call them "Row", and suppose a Row contains a "name" and a numeric field called "number" . All these "Rows" are found in let's say a "RowContainer" which has a "rows" mutable array holding the parent (level 0) rows. Each row also has a "children" NSMutableArray member which holds it's children. I have this working, and I want to display under the outlineview a textfield with the sum of all the "number" values of the rows. I bound this textfield to a "total" property of the "RowContainer". Now the problem is how or from where to trigger the recalculation of the "total" property, since this involves a recursive walk on the tree of rows, and I always get a "Collection was mutated while being enumerated" error. I've tried making a method "recalculateTotal", and calling it from the "setNumber" method of the "Row" class , but same error occurs. If I put the recalculation logic in the "total" getter, I can't trigger it to do the math. I'm sure the solution is simple but I can't see it

    Read the article

  • Flex Column Chart customization

    - by tdfs
    Hi all, When I customized the ColumnChart in Flex by overrided updateDisplayList function, colors in legend no longer display. As you will see in the below picture: http://i41.tinypic.com/mim35d.png Does I missed anything? Thanks.

    Read the article

  • DataGridTemplateColumn for individual control-column vs DataGridTextColumn

    - by msfanboy
    Hello, what is the difference, both works: DataGridTemplateColumn versus DataGridTextColumn <DataGridTemplateColumn Header="Homework"> <DataGridTemplateColumn.CellTemplate> <DataTemplate> <RichTextBox > <FlowDocument> <Paragraph> <Run Text="{Binding Homework}"/> </Paragraph> </FlowDocument> </RichTextBox> </DataTemplate> </DataGridTemplateColumn.CellTemplate> </DataGridTemplateColumn> <DataGridTextColumn Header="Homework"> <DataGridTextColumn.CellTemplate> <DataTemplate> <RichTextBox > <FlowDocument> <Paragraph> <Run Text="{Binding Homework}"/> </Paragraph> </FlowDocument> </RichTextBox> </DataTemplate> </DataGridTextColumn.CellTemplate> </DataGridTextColumn >

    Read the article

  • Dynamic column width

    - by nCdy
    protected void GridView1_DataBound(object sender, EventArgs e) { GridView1.Columns[0].ItemStyle.Width = 400; <asp:GridView ID="GridView1" runat="server" DataSourceID="ObjectDataSource1" ObjectDataSource1 returns data table , but I can't find any width property there , so I guess there is GridView side option but even on data bound there is like no columns ... protected void GridView1_DataBound(object sender, EventArgs e) { if (GridView1.Columns.Count!=0) GridView1.Columns[0].ItemStyle.Width = 800;

    Read the article

  • search & replace on 3000 row, 25 column spreadsheet

    - by Deca
    I'm attempting to clean up data in this (old) spreadsheet and need to remove things like single and double quotes, HTML tags and so on. Trouble is, it's a 3000 row file with 25 columns and every spreadsheet app I've tried (NeoOffice, MS Excel, Apple Numbers) chokes on it. Hard. Any ideas on how else I can clean this thing up for import to MySQL? Clearly I could go through each record manually, row by row, but would like to avoid that if at all possible. Likewise, I could write a PHP script to handle it on import, but don't want to put the server into a death spiral either.

    Read the article

  • MYSQL select query where multiple conditions in same column must exist

    - by David
    I'm putting together a dating site and I'm having a mysql query issue. This works: SELECT * FROM `user` , `desired_partner` , `user_personality` WHERE dob BETWEEN '1957-05-18' AND '1988-05-18' AND country_id = '190' AND user.gender_id = '1' AND user.user_id = desired_partner.user_id AND desired_partner.gender_id = '2' AND user.user_id = user_personality.user_id AND user_personality.personality_id = '2' The sql finds any male (gender_id=1) with ATLEAST personality trait 2 (and possibly other personality traits) between certain age range in the USA (country_id=190) looking for a female (gender_id=2). Question 1) How do I make it so it returns those with personality type 2 ONLY and no other personality traits? Find any man in the USA that is between 22 and 53 that is of personality type 2 (only) that is looking for a woman. Question 2) Supposing I want to find someone that matches personality type 1, personality type 2, and personality type 5 ONLY. There are 14 personality traits in the database and a user can be associated with any of them. Find any man in the USA that is between 22 and 53 that is of personality type 1, 2, and 5 (ONLY) that is looking for a woman.

    Read the article

  • How to pull data from a MySQL column and put it into a single array

    - by Rob
    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?

    Read the article

  • Flex 3 ColumnChart: dynamically changing the column colors

    - by James
    When using a ColumnChart created in Flex 3, how can I to change the fill color of columns that meet a certain criteria? Example: I have 8 columns representing agreement percentages between groups of people and want to change the fill color (or otherwise highlight) of all the columns that have over 80% agreement.

    Read the article

  • multiple currency formats in one column - Access 2007

    - by glinch
    Hi there, Is it possible to have multiple currency denominations in a field? I have a field that will have a currency value that will be either euro's or sterling dependent on whether or not the applicable record is in the currency zone. Is this possible in Access or will i need to have seperate fields for euro/sterling? Thanks in advance for any help Noel

    Read the article

  • Django save, column specified twice

    - by realshadow
    Hey, I would like to save a modified model, but I get Programming error - that a field is specified twice. class ProductInfo(models.Model): product_info_id = models.AutoField(primary_key=True) language_id = models.IntegerField() product_id = models.IntegerField() description = models.TextField(blank=True) status = models.IntegerField() model = models.CharField(max_length=255, blank=True) label = models.ForeignKey(Category_info, verbose_name = 'Category_info', db_column = 'language_id', to_field = 'node_id', null = True) I get this error because the foreign key uses as db_column language_id. If I will delete it, my object will be saved properly. I dont quite understand whats going on and since I have defined almost all of my models this way, I fear its totally wrong or maybe I just missunderstood it... Any ideas? Regards

    Read the article

  • Can you select which column to sync with Sync Framework

    - by pdiddy
    I notice that with MS Sync, going through the wizard to create the WCF service that will do the sync, you can only choose which table to sync. Is it possible to only sync a few columns of the table and not the entire table? It will also create the local sdf file with the whole table structure. I only need a few columns of the table to be displayed in my mobile device.

    Read the article

  • DataGridView Autosize but restrict max column size

    - by aaginor
    Hi folks, in my C# 4.0 Application, I have a DataGridView to display some data. I want the Columns size accordingly to the content, so I set the AutoSizeColumnsMode to AllCellsExceptHeader. But I want to restrict the columns to grow beyond a certain value. There is a MinimumWidth Property ... but unfortunately no MaximumWidth Property. Any ideas how to solve this? Thanks in advance, Frank

    Read the article

  • Error with varchar(max) column when using net.sourceforge.jtds.jdbc.Driver

    - by Rihan Meij
    Hi I have a MS SQL database running (MS SQL 2005) and am connecting to it via the net.sourceforge.jtds.jdbc.Driver. The query works fine for all the columns except one that is a varchar(max). Any ideas how to get around this issues? I am using the jdbc driver to run a data index into a SOLR implementation. (I do not control the database, so the first prize solution would be where I can tweak the SQL command to get the desired results) Thanks

    Read the article

  • T-SQL: Omit/Ignore repetitive data from a specific column

    - by Dsyfa
    Hi, For my question lets consider the following sample table data: ProductID    ProductName    Price   Category 1                Apple                 5.00       Fruits 2                Apple                 5.00       Food 3                Orange               3.00       Fruits 4                Banana                 2.00       Fruits I need a query which will result in the following data set: ProductID    ProductName    Price   Category 1                Apple                 5.00       Fruits 3                Orange               3.00       Fruits 4                Banana                 2.00       Fruits As you can see ProductID 2 has been omitted/ignored because Apple is already present in the result i.e. each product must appear only once irrespective of Category or Price. Thanks

    Read the article

< Previous Page | 65 66 67 68 69 70 71 72 73 74 75 76  | Next Page >