Search Results

Search found 26929 results on 1078 pages for 'table cell'.

Page 8/1078 | < Previous Page | 4 5 6 7 8 9 10 11 12 13 14 15  | Next Page >

  • Pass table as parameter to SQLCLR TV-UDF

    - by Skeolan
    We have a third-party DLL that can operate on a DataTable of source information and generate some useful values, and we're trying to hook it up through SQLCLR to be callable as a table-valued UDF in SQL Server 2008. Taking the concept here one step further, I would like to program a CLR Table-Valued Function that operates on a table of source data from the DB. I'm pretty sure I understand what needs to happen on the T-SQL side of things; but, what should the method signature look like in the .NET (C#) code? What would be the parameter datatype for "table data from SQL Server?" e.g. /* Setup */ CREATE TYPE InTableType AS TABLE (LocationName VARCHAR(50), Lat FLOAT, Lon FLOAT) GO CREATE TYPE OutTableType AS TABLE (LocationName VARCHAR(50), NeighborName VARCHAR(50), Distance FLOAT) GO CREATE ASSEMBLY myCLRAssembly FROM 'D:\assemblies\myCLR_UDFs.dll' WITH PERMISSION_SET = EXTERNAL_ACCESS GO CREATE FUNCTION GetDistances(@locations InTableType) RETURNS OutTableType AS EXTERNAL NAME myCLRAssembly.GeoDistance.SQLCLRInitMethod GO /* Execution */ DECLARE @myTable InTableType INSERT INTO @myTable(LocationName, Lat, Lon) VALUES('aaa', -50.0, -20.0) INSERT INTO @myTable(LocationName, Lat, Lon) VALUES('bbb', -20.0, -50.0) SELECT * FROM @myTable DECLARE @myResult OutTableType INSERT INTO @myResult MyCLRTVFunction @myTable --returns a table result calculated using the input The lat/lon - distance thing is a silly example that should of course be better handled entirely in SQL; but I hope it illustrates the general intent of table-in - table-out through a table-valued UDF tied to a SQLCLR assembly. I am not certain this is possible; what would the SQLCLRInitMethod method signature look like in the C#? public class GeoDistance { [SqlFunction(FillRowMethodName = "FillRow")] public static IEnumerable SQLCLRInitMethod(<appropriateType> myInputData) { //... } public static void FillRow(...) { //... } } If it's not possible, I know I can use a "context connection=true" SQL connection within the C# code to have the CLR component query for the necessary data given the relevant keys; but that's sensitive to changes in the DB schema. So I hope to just have SQL bundle up all the source data and pass it to the function. Bonus question - assuming this works at all, would it also work with more than one input table?

    Read the article

  • How to fill DataGridView from nested table oracle

    - by arkadiusz85
    I want to create my type: CREATE TYPE t_read AS OBJECT ( id_worker NUMBER(20), how_much NUMBER(5,2), adddate_r DATE, date_from DATE, date_to DATE ); I create a table of my type: CREATE TYPE t_tab_read AS TABLE OF t_read; Next step is create a table with my type: enter code hereCREATE TABLE Reading ( id_watermeter NUMBER(20) constraint Watermeter_fk1 references Watermeters(id_watermeter), read t_tab_read ) NESTED TABLE read STORE AS store_read ; Microsoft Visual Studio can not display this type in DataGridView. I use Oracle.Command: C# using Oracle.DataAccess; using Oracle.DataAccess.Client; private void button1_Click(object sender, EventArgs e) { try { //my working class to connect to database ConnectionClass.BeginConnection(); OracleDataAdapter tmp = new OracleDataAdapter(); tmp = ConnectionClass.ReadCommand(ReadClass.test()); DataSet dataset4 = new DataSet(); tmp.Fill(dataset4, "Read1"); dataGridView4.DataSource = dataset4.Tables["Read1"]; } catch (Exception o) { MessageBox.Show(o.Message); } public class ReadClass { public static OracleCommand test() { string sql = "select c.id_watermeter, a. from reading c , table (c.read) a where id_watermeter=1"; ConnectionClass.Command1= new OracleCommand(sql, ConnectionClass.Connection); ConnectionClass.Command1.CommandType = CommandType.Text; return ConnectionClass.Command1; } } I tray: string sql = "select r.id_watermeter, o.id_worker, o.how_much, o.adddate_r, o.date_from, o.date_to from reading r, table (r.read) o where r.id_watermeter=1" string sql = "select a.from reading c , Table (c.read) a where id_watermeter=1" string sql = "select a.id_worker, a.how_much, a.adddate_r, a.date_from, a.date_to from reading c , table (c.read) a where id_watermeter=1" string sql = "select c.id_watermeter, a. from reading c , table (c.read) a where id_watermeter=1" Error : Unsuported Oracle data type USERDEFINED encountered Sombady can help me how to fill DataGridView using data from nested table. I am using Oracle 10g XE

    Read the article

  • iPhone: UITextField inside TableView cell?

    - by Nic Hubbard
    I am trying to programatically add a UITextFiled inside one of my tableview cells. How would I do this? Assuming it is in the following method, what code would I use? - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"Cell"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (cell == nil) { cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue2 reuseIdentifier:CellIdentifier] autorelease]; cell.editingAccessoryType = UITableViewCellAccessoryDisclosureIndicator; // Don't let the user click when not in editing mode cell.selectionStyle = UITableViewCellSelectionStyleNone; } switch (indexPath.row) { case 0: cell.textLabel.text = @"Title"; // This is where I want to add a text field cell.detailTextLabel.text = @"test"; cell.editing = YES; break; } return cell; }

    Read the article

  • problem in table:

    - by Ayyappan.Anbalagan
    i had table inside the another table, my inner table display the image, if i enter the text after the inner table,The text should display right side of the table and the bottom of the inner table.how do i do this??? "the below code display the outer table text always displayed bellow the inner table" Heading ## <tr style=" width:500px; float:left;"> <td style="border: thin ridge #008000; text-align:left;" align="left"; > <table class="" style=" border: 1px solid #800000; width:200px; float:left; height: 200px;"> <tr> <td>&nbsp;stackoverflowstackoverflow stackoverflowstackoverflow stackoverflowstackoverflow stackoverflowstackoverflow&nbsp; </td> </tr> </table> stackoverflow stackoverflowstackoverflow stackoverflowstackoverflow stackoverflowstackoverflow stackoverflowstackoverflow stackoverflowstackoverflow stackoverflowstackoverflow stackoverflowstackoverflow stackoverflowstackoverflow stackoverflowstackoverflow stackoverflowstackoverflow stackoverflowstackoverflow stackoverflowstackoverflow stackoverflowstackoverflow stackoverflowstackoverflow stackoverflowstackoverflow stackoverflowstackoverflow statackoverflow sta</td> </tr> </table>

    Read the article

  • table cell background color change problem

    - by Mellon
    I work on another guy's code, and I try to change the table cell background color when mouse over the cell, and change back to the original background color when mouse leave. I use the following code: var bgcolor=$(".cell-el").css("background-color") $(".cell-el").hover( function(){ $(this).css("background-color", "#3c3c36")}, //mouse enter, bg-color change function(){ $(this).css("background-color", bgcolor) // mouse leave, bg-color change back }) Things are working fine, EXCEPT that when mouse first time enter the cell, the cell background color is not changed to "#3c3c36", but when mouse leave the cell after first entering and enter in the cell again, the cell's background color changed to "#3c3c36". That's the cell color never change for mouse first enter, after that, everything is working great. What's could be the cause of this problem?

    Read the article

  • preventing changes to a cell in google spreadsheet [migrated]

    - by A B
    I want to prevent changes to column K in google spreadsheet. Whatever value is there, I do not want it changed. I do not like the protection feature as it makes what I consider an ugly display. My code. Unfortunately, it does absolutely nothing. The intent was to take whatever the current value is in the cell, save it, and then write it back on exit of the cell instead of saving whatever changes might have been made to the cell. The cell will either be blank to start, or will already have been modified to contain a date & time. Whatever the current contents blank or not, it should retain the same value after leaving the cell. function onEdit() { var s = SpreadsheetApp.getActiveSheet(); var r = s.getActiveCell(); var columnNum=r.getColumn() // if column is K then prevent any changes if (columnNum == 11) { var dateCell = s.getRange(r.getRow(), 11); var v=dateCell.getValue(); dateCell.setValue(v); } };

    Read the article

  • Inheritance Mapping Strategies with Entity Framework Code First CTP5: Part 2 – Table per Type (TPT)

    - by mortezam
    In the previous blog post you saw that there are three different approaches to representing an inheritance hierarchy and I explained Table per Hierarchy (TPH) as the default mapping strategy in EF Code First. We argued that the disadvantages of TPH may be too serious for our design since it results in denormalized schemas that can become a major burden in the long run. In today’s blog post we are going to learn about Table per Type (TPT) as another inheritance mapping strategy and we'll see that TPT doesn’t expose us to this problem. Table per Type (TPT)Table per Type is about representing inheritance relationships as relational foreign key associations. Every class/subclass that declares persistent properties—including abstract classes—has its own table. The table for subclasses contains columns only for each noninherited property (each property declared by the subclass itself) along with a primary key that is also a foreign key of the base class table. This approach is shown in the following figure: For example, if an instance of the CreditCard subclass is made persistent, the values of properties declared by the BillingDetail base class are persisted to a new row of the BillingDetails table. Only the values of properties declared by the subclass (i.e. CreditCard) are persisted to a new row of the CreditCards table. The two rows are linked together by their shared primary key value. Later, the subclass instance may be retrieved from the database by joining the subclass table with the base class table. TPT Advantages The primary advantage of this strategy is that the SQL schema is normalized. In addition, schema evolution is straightforward (modifying the base class or adding a new subclass is just a matter of modify/add one table). Integrity constraint definition are also straightforward (note how CardType in CreditCards table is now a non-nullable column). Another much more important advantage is the ability to handle polymorphic associations (a polymorphic association is an association to a base class, hence to all classes in the hierarchy with dynamic resolution of the concrete class at runtime). A polymorphic association to a particular subclass may be represented as a foreign key referencing the table of that particular subclass. Implement TPT in EF Code First We can create a TPT mapping simply by placing Table attribute on the subclasses to specify the mapped table name (Table attribute is a new data annotation and has been added to System.ComponentModel.DataAnnotations namespace in CTP5): public abstract class BillingDetail {     public int BillingDetailId { get; set; }     public string Owner { get; set; }     public string Number { get; set; } } [Table("BankAccounts")] public class BankAccount : BillingDetail {     public string BankName { get; set; }     public string Swift { get; set; } } [Table("CreditCards")] public class CreditCard : BillingDetail {     public int CardType { get; set; }     public string ExpiryMonth { get; set; }     public string ExpiryYear { get; set; } } public class InheritanceMappingContext : DbContext {     public DbSet<BillingDetail> BillingDetails { get; set; } } If you prefer fluent API, then you can create a TPT mapping by using ToTable() method: protected override void OnModelCreating(ModelBuilder modelBuilder) {     modelBuilder.Entity<BankAccount>().ToTable("BankAccounts");     modelBuilder.Entity<CreditCard>().ToTable("CreditCards"); } Generated SQL For QueriesLet’s take an example of a simple non-polymorphic query that returns a list of all the BankAccounts: var query = from b in context.BillingDetails.OfType<BankAccount>() select b; Executing this query (by invoking ToList() method) results in the following SQL statements being sent to the database (on the bottom, you can also see the result of executing the generated query in SQL Server Management Studio): Now, let’s take an example of a very simple polymorphic query that requests all the BillingDetails which includes both BankAccount and CreditCard types: projects some properties out of the base class BillingDetail, without querying for anything from any of the subclasses: var query = from b in context.BillingDetails             select new { b.BillingDetailId, b.Number, b.Owner }; -- var query = from b in context.BillingDetails select b; This LINQ query seems even more simple than the previous one but the resulting SQL query is not as simple as you might expect: -- As you can see, EF Code First relies on an INNER JOIN to detect the existence (or absence) of rows in the subclass tables CreditCards and BankAccounts so it can determine the concrete subclass for a particular row of the BillingDetails table. Also the SQL CASE statements that you see in the beginning of the query is just to ensure columns that are irrelevant for a particular row have NULL values in the returning flattened table. (e.g. BankName for a row that represents a CreditCard type) TPT ConsiderationsEven though this mapping strategy is deceptively simple, the experience shows that performance can be unacceptable for complex class hierarchies because queries always require a join across many tables. In addition, this mapping strategy is more difficult to implement by hand— even ad-hoc reporting is more complex. This is an important consideration if you plan to use handwritten SQL in your application (For ad hoc reporting, database views provide a way to offset the complexity of the TPT strategy. A view may be used to transform the table-per-type model into the much simpler table-per-hierarchy model.) SummaryIn this post we learned about Table per Type as the second inheritance mapping in our series. So far, the strategies we’ve discussed require extra consideration with regard to the SQL schema (e.g. in TPT, foreign keys are needed). This situation changes with the Table per Concrete Type (TPC) that we will discuss in the next post. References ADO.NET team blog Java Persistence with Hibernate book a { text-decoration: none; } a:visited { color: Blue; } .title { padding-bottom: 5px; font-family: Segoe UI; font-size: 11pt; font-weight: bold; padding-top: 15px; } .code, .typeName { font-family: consolas; } .typeName { color: #2b91af; } .padTop5 { padding-top: 5px; } .padTop10 { padding-top: 10px; } p.MsoNormal { margin-top: 0in; margin-right: 0in; margin-bottom: 10.0pt; margin-left: 0in; line-height: 115%; font-size: 11.0pt; font-family: "Calibri" , "sans-serif"; }

    Read the article

  • How to delete child table records during the update of parent table using Hibernate

    - by Harsha
    I have a Parent Table A and child tables B,C with many to one relations. Lets say I have data like, for primary key 1 in parent table A I have 3 rows in child table B and 4 rows in child table C. Now if I want to delete the rows of the child table during an update of the parent table(that means Now, I want to update the table only with one row in each child tables and delete the other rows in them) then how to handle this scenario in hibernate?

    Read the article

  • Creating a fixed formatted cell in UITableview

    - by Wes
    Hi, I want to have a tableview create rows that look like this: value1 item1 container1 value10 item10 container10 value100 item100 container100 value2 item2 container2 What I am trying to show is that the first word (value) will have a set length of 12 and then the second word (item) will have a set length of 10 and then the last word (container) is just tagged on at the end. I am pulling these from a SQLite database and don't want to use multiple lines, but read in a strictly formatted structure like this.

    Read the article

  • set different images to uitableview cell

    - by Sudha
    I am making an app in which one of the view has a tableview. Tableview cell has two conditions. There are two images which are going to be set on uitableview cell according to the condition i.e. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{ NSString *que =[[userqueries objectAtIndex:indexPath.row]objectForKey:@"question"]; NSString *ans =[[userqueries objectAtIndex:indexPath.row]objectForKey:@"answer"]; static NSString *CellIdentifier = @"Cell"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (cell == nil){ cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier] autorelease]; cell.imageView.image=nil; if ((que.length!=0)&&(ans.length!=0)) { UIImageView* imag = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, 320, 75)]; imag.image = [UIImage imageNamed:@"ques.png"]; [cell.contentView addSubview:imag]; questext = [[UITextView alloc]initWithFrame:CGRectMake(10, 0, 300, 35)]; questext.backgroundColor = [UIColor clearColor]; questext.delegate = self; questext.tag = 101; questext.textAlignment = UITextAlignmentLeft; questext.editable = NO; questext.scrollEnabled = YES; [cell addSubview:questext]; anstext = [[UITextView alloc]initWithFrame:CGRectMake(10, 37, 300, 35)]; anstext.backgroundColor = [UIColor clearColor]; anstext.delegate = self; anstext.tag = 102; anstext.scrollEnabled = YES; anstext.textAlignment = UITextAlignmentLeft; anstext.editable = NO; [cell addSubview:anstext]; } else { UIImageView* imag = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, 320, 40)]; imag.image = [UIImage imageNamed:@"answ.png"]; [cell.contentView addSubview:imag]; onlyques = [[UITextView alloc]initWithFrame:CGRectMake(10, 0, 300, 35)]; onlyques.backgroundColor= [UIColor clearColor]; [onlyques setScrollEnabled:YES]; onlyques.delegate = self; onlyques.tag = 103; onlyques.textAlignment = UITextAlignmentLeft; onlyques.editable = NO; onlyques.scrollEnabled = YES; [cell addSubview:onlyques]; } } questext = (UITextView*)[cell viewWithTag:101]; questext.text = que; anstext = (UITextView*)[cell viewWithTag:102]; anstext.text = ans; onlyques = (UITextView*)[cell viewWithTag:103]; onlyques.text = que; return cell; } But image is not appearing properly. As I scroll up and down the table view ,images get changes automatically. Please look upon my code and help me in finding the error. second image is when I scroll up and down the table view and first image is in the starting. please help me. if any one knows how to load different images to uitableview cell. thanks in advance.

    Read the article

  • INSERT 0..n records into table 'A' based on content of table 'B' in MySql 5

    - by Robert Gowland
    Using MySql 5, I have a task where I need to update one table based on the contents of another table. For example, I need to add 'A1' to table 'A' if table 'B' contains 'B1'. I need to add 'A2a' and 'A2b' to table 'A' if table 'B' contains 'B2', etc.. In our case, the value in table 'B' we're interested is an enum. Right now I have a stored procedure containing a series of statements like: INSERT INTO A SELECT 'A1' FROM B WHERE B.Value = 'B1'; --Repeat for 'B2' -> 'A2a'; 'B2' -> 'A2b'; 'B3' -> 'A3', etc... Is there a nicer more DRY way of accomplishing this? Edit: There may be values in table 'B' that have no equivalent value for table 'A'.

    Read the article

  • UICollectionView with one static cell and N dynamic ones from a fetchresultscontroller exception

    - by nflacco
    I'm trying to make a UITableView that shows a blog post and comments for that post. My setup is a tableview in storyboard with two dynamic prototype cells. The first cell is for the post and should never change. The second cell represents the 0 to N comments. My cellForRowAtIndexPath method shows the post cell properly, but fails to get the comment at the given index path (though if I comment out the fetch I get the appropriate number of comment cells with a green background that I set as a visual debug thing). let comment = fetchedResultController.objectAtIndexPath(indexPath) as Comment I get the following exception on this line: 2014-08-24 15:06:40.712 MessagePosting[21767:3266409] *** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[__NSArrayM objectAtIndex:]: index 1 beyond bounds [0 .. 0]' *** First throw call stack: ( 0 CoreFoundation 0x0000000101aa43e5 __exceptionPreprocess + 165 1 libobjc.A.dylib 0x00000001037f9967 objc_exception_throw + 45 2 CoreFoundation 0x000000010198f4c3 -[__NSArrayM objectAtIndex:] + 227 3 CoreData 0x00000001016e4792 -[NSFetchedResultsController objectAtIndexPath:] + 162 Section and cell setup: override func tableView(tableView: UITableView!, numberOfRowsInSection section: Int) -> Int { // #warning Incomplete method implementation. // Return the number of rows in the section. switch section { case 0: return 1 default: if let realPost:Post = post { return fetchedResultController.sections[0].numberOfObjects } else { return 0 } } } override func tableView(tableView: UITableView!, cellForRowAtIndexPath indexPath: NSIndexPath!) -> UITableViewCell! { switch indexPath.section { case 0: let cell = tableView.dequeueReusableCellWithIdentifier(postViewCellIdentifier, forIndexPath: indexPath) as UITableViewCell cell.backgroundColor = lightGrey if let realPost:Post = self.post { cell.textLabel.text = realPost.text } return cell default: let cell = tableView.dequeueReusableCellWithIdentifier(commentCellIdentifier, forIndexPath: indexPath) as UITableViewCell cell.backgroundColor = UIColor.greenColor() let comment = fetchedResultController.objectAtIndexPath(indexPath) as Comment // <---------------------------- :( cell.textLabel.text = comment.text return cell } } FRC: func controllerDidChangeContent(controller: NSFetchedResultsController!) { tableView.reloadData() } func getFetchedResultController() -> NSFetchedResultsController { fetchedResultController = NSFetchedResultsController(fetchRequest: taskFetchRequest(), managedObjectContext: managedObjectContext, sectionNameKeyPath: nil, cacheName: nil) return fetchedResultController } func taskFetchRequest() -> NSFetchRequest { if let realPost:Post = self.post { let fetchRequest = NSFetchRequest(entityName: "Comment") let sortDescriptor = NSSortDescriptor(key: "date", ascending: false) fetchRequest.predicate = NSPredicate(format: "post = %@", realPost) fetchRequest.sortDescriptors = [sortDescriptor] return fetchRequest } else { return NSFetchRequest(entityName: "") } }

    Read the article

  • UITableView with Custom Cell only loads one row of data at a time

    - by Anton
    For my table, I've created a custom cell that has two labels. I also have two arrays with data, that I use to respectively assign each label in the cell. My problem, is that when the table is viewed, only the first row has data, and the rest of the data "sorta" loads when I start scrolling down. By "sorta", only the first row will load at a time. The only time I get to see all the data, is when I scroll to the bottom, then scroll up again. I've used the cellForRowAtIndexPath method to load the data into my cell. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CustomCellIdentifier = @"CustomCellIdentifier"; CustomCell *cell = (CustomCell *)[tableView dequeueReusableCellWithIdentifier:CustomCellIdentifier]; if (cell == nil) { NSArray *nib = [[NSBundle mainBundle] loadNibNamed:@"CustomCell" owner:self options:nil]; for (id oneObject in nib) if ([oneObject isKindOfClass:[CustomCell class]]) cell = (CustomCell *)oneObject; } NSUInteger row = [indexPath row]; //I have two tables to fill up, hence the tag if statement if ([tableView tag] == 0) { cell.arriveTimeLabel.text = [homeBoundTimes objectAtIndex:row]; cell.departTimeLabel.text = [homeBoundTimes objectAtIndex:row]; } else if ([tableView tag] == 1) { cell.arriveTimeLabel.text = [workBoundTimes objectAtIndex:row]; cell.departTimeLabel.text = [workBoundTimes objectAtIndex:row]; } return cell; } Is it possible that its only getting called when the top cell is being called?

    Read the article

  • iOS Cell Label link

    - by hart1994
    Hi I am new to iOS programming and I need a little help. I have a table view cell which is populated by data from a .plist file. I need to be able to make a link within one of the cells. How could I do this? Here is the code which is loading the data into the cells: - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"CustomTableCell"; static NSString *CellNib = @"DetailViewCell"; DetailViewCell *cell = (DetailViewCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (cell == nil) { NSArray *nib = [[NSBundle mainBundle] loadNibNamed:CellNib owner:self options:nil]; cell = (DetailViewCell *)[nib objectAtIndex:0]; } cell.accessoryType = UITableViewCellAccessoryNone; cell.cellTitleLabel.textColor = [UIColor blackColor]; cell.cellTitleLabel.font = [UIFont systemFontOfSize:20.0]; cell.cellSubtitleLabel.textColor = [UIColor darkGrayColor]; informations = [[NSArray alloc] initWithObjects:@"City", @"Country", @"State", @"History", @"Link", nil]; subtitles = [[NSArray alloc] initWithObjects:titleString, subtitleString, stateString, populationString, @"Link", nil]; cell.cellTitleLabel.text = [informations objectAtIndex:indexPath.row]; cell.cellSubtitleLabel.text = [subtitles objectAtIndex:indexPath.row]; return (DetailViewCell *) cell; } For the cell "Link" I need it to open a url which is stored in the .plist file. How could i do this? Many thanks Ryan PS: I'm a newbie at this stuff, so be descriptive. Thanks

    Read the article

  • mysql master slave "table already exists" but table not exists

    - by Korjavin Ivan
    I have 1 master mysql process, and 2 slave. Today on both slaves i see : Error 'Table 'bgbilling.contract_status_balance_dump' already exists' on query. Default database: 'bgbilling'. Query: 'CREATE TABLE contract_status_balance_dump( UNIQUE(cid) ) SELECT cid, MAX(yy*12+(mm-1))%12 + 1 AS mm,FLOOR(MAX(yy*12+(mm-1)) / 12) AS yy FROM contract_balance GROUP BY cid' "show tables" does not show this table. I tryed stop slave , and do "drop table contract_status_balance_dump" but: ERROR 1051 (42S02): Unknown table 'contract_status_balance_dump' How its possible? And how fix that?

    Read the article

  • Vaadin table hide columns and container customization

    - by Alex
    Hello I am testing a project, using Vaadin and Hibernate. I am trying to use the HbnContainer class to show data into table. The problem is that I do not want to show all the properties of the two classes in the table. For example: @Entity @Table(name="users") class User { @Id @GeneratedValue(strategy=GenerationType.AUTO) private Long id; private String name; @ManyToOne(cascade=CascadeType.PERSIST) private UserRole role; //getters and setters } and a second class: @Entity @Table(name="user_roles") class UserRole { @Id @GeneratedValue(strategy=GenerationType.AUTO) private Long id; private String name; //getters and setters } Next, I retrieve my data using the HbnContainer, and connect it to the table: HbnContainer container = new HbnContainer(User.class, app); table.setContainerDataSource(container); The Table will only display the columns from User, and for the "role" it will put the role id instead. How can I hide that column, and replace it with the UserRole.name ? I managed to use a ColumnGenerator() to get the string value in the table, for the UserRole - but I couldn't remove the previous column, with the numerical value. What am I missing? Or, what is the best way to "customize" your data, before displaying a table (if i want to show data in a table from more than one object type.. what do I do?) If I can't find a simple solution soon, I think I will just build the tables "by hand".. So, any advice on this matter? Thank you, Alex

    Read the article

  • Dojo Table not Rendering in IE6

    - by Mike Carey
    I'm trying to use Dojo (1.3) checkBoxes to make columns appear/hide in a Dojo Grid that's displayed below the checkBoxes. I got that functionality to work fine, but I wanted to organize my checkBoxes a little better. So I tried putting them in a table. My dojo.addOnLoad function looks like this: dojo.addOnLoad(function(){ var checkBoxes = []; var container = dojo.byId('checkBoxContainer'); var table = dojo.doc.createElement("table"); var row1= dojo.doc.createElement("tr"); var row2= dojo.doc.createElement("tr"); var row3= dojo.doc.createElement("tr"); dojo.forEach(grid.layout.cells, function(cell, index){ //Add a new "td" element to one of the three rows }); dojo.place(addRow, table); dojo.place(removeRow, table); dojo.place(findReplaceRow, table); dojo.place(table, container); }); What's frustrating is: 1) Using the Dojo debugger I can see that the HTML is being properly generated for the table. 2) I can take that HTML and put just the table in an empty HTML file and it renders the checkBoxes in the table just fine. 3) The page renders correctly in Firefox, just not IE6. The HTML that is being generated looks like so: <div id="checkBoxContainer"> <table> <tr> <td> <div class="dijitReset dijitInline dijitCheckBox" role="presentation" widgetid="dijit_form_CheckBox_0" wairole="presentation"> <input class="dijitReset dijitCheckBoxInput" id="dijit_form_CheckBox_0" tabindex="0" type="checkbox" name="" dojoattachevent= "onmouseover:_onMouse,onmouseout:_onMouse,onclick:_onClick" dojoattachpoint="focusNode" unselectable="on" aria-pressed="false"/> </div> <label for="dijit_form_CheckBox_0"> Column 1 </label> </td> <td> <div class="dijitReset dijitInline dijitCheckBox" role="presentation" widgetid="dijit_form_CheckBox_1" wairole="presentation"> <input class="dijitReset dijitCheckBoxInput" id="dijit_form_CheckBox_1" tabindex="0" type="checkbox" name="" dojoattachevent= "onmouseover:_onMouse,onmouseout:_onMouse,onclick:_onClick" dojoattachpoint="focusNode" unselectable="on" aria-pressed="false"/> </div> </td> </tr> <tr> ... </tr> </table> </div> I would have posted to the official DOJO forums, but it says they're deprecated and they're using a mailing list now. They said if a mailing list doesn't work for you, use stackoverflos.com. So, here I am! Thanks for any insight you can provide.

    Read the article

  • How to resize table via javascript in IE?

    - by MartyIX
    I've got this table: <table id="correctness" style="overflow: hidden;"> <tr><td style="overflow: hidden;"> <div id="correctness-message"></div> <span class="hide"> <button type="button" class="hide" onclick="new DisplayEffect('correctness').Hide(500);">Hide</button> </span> </td> </tr> </table> and a function for resizing the table: function resize(element, size) { element.style.height = size + "px";}; which is called for a certain amount of time (e.g. 1 second) with the ID of table (i.e. "correctness") in order to resize the table from zero height to its full height. This code works in Firefox and Chrome but it doesn't work in IE8. What it does is that it displays right away whole table even thought the height set in "resize" method is much lower. It seems that the cell sets the height of parent table and not the other way around. Is it possible to change the behaviour? I like changing the height of the table better because I can set visibility of the table easily. Thanks for any help!

    Read the article

  • mysql alter to table

    - by user485783
    Hi, I drop the mysql alter code below to database via phpmyadmin one by one, it it work fine, is there anyone could help me how to drop it all together at once? or do you know the the samples of php code that may execute it? just let me know please. thanks in advace ALTER TABLE user ADD title varchar(16) COLLATE utf8_bin NOT NULL DEFAULT '' AFTER user_id ALTER TABLE customer ADD title varchar(16) COLLATE utf8_bin NOT NULL DEFAULT '' AFTER customer_id ALTER TABLE customer ADD date_birtdate datetime NOT NULL DEFAULT '0000-00-00 00:00:00' AFTER lastname ALTER TABLE customer ADD security_question varchar(96) COLLATE utf8_bin NOT NULL DEFAULT '' AFTER fax ALTER TABLE customer ADD security_answer varchar(96) COLLATE utf8_bin NOT NULL DEFAULT '' AFTER fax ALTER TABLE customer ADD pin_number text COLLATE utf8_bin AFTER password ALTER TABLE customer ADD notes text COLLATE utf8_bin AFTER bank_number ALTER TABLE customer ADD last_active datetime NOT NULL DEFAULT '0000-00-00 00:00:00' AFTER date_added

    Read the article

  • When to use SQL Table Alias

    - by Rossini
    I curious to know how people are using table alias. The other developers where I work always use table alias, and always use the alias of a, b, c, ect. Here's an example SELECT a.TripNum, b.SegmentNum, b.StopNum, b.ArrivalTime FROM Trip a, Segment b WHERE a.TripNum = b.TripNum I disagree with them, and think table alias should be use more sparingly. I think it should be used when including the same table twice in a query, or when the table name is very long and using a shorter name in the query will make the query easier to read. I also think the alias should be a good name instead of a letter. In the above example if I felt I needed to use 1 letter table alias I would use t for the Trip table and s for the segment table.

    Read the article

  • Adjust width of td to make make row widths even

    - by user1729886
    I am trying to produce a table with a different number of cells in each row. The first row is a header row (every other row contains cells). This header is the width of the table. The second row has 2 cells in it... the third has 1 cell... the fourth has 4 cells... the fifth and final row has 3 cells. I want the table set up so that the rows span the full width of the table. If the table is 1000px... The header would be 1000px wide the cells in the 2nd row would be 500px EACH the cell in the 3rd row would be 1000px the cells in the 4th row would be 250px EACH and the cells in the 5th row would be 333px, 334px, and 333px each (left-to-right) I figured out I could use colspan for the first 4 rows, but the 5th (with 3 cells) would require a non-integer value. The cells in the 5th row won't expand beyond their column without colspan that I can tell... trying the width:## CSS code inside a div tag for each cell inside the td tag creating a class or classes that define the cell widths id-ing each cell, with or without a div tag, and defining widths individually and adjuting the table-layout: option After several days, I'm now at my rope's end. The only thing I can come up with is deliberately tripling the number of cells in each row so that colspan would be all integer values. That sounds inconvenient and unreasonably difficult to format the table the way I'd like. It's a table of Batman movies for a website -- a practice website I'm building, in order to learn HTML/CSS. I've been working on-and-off with HTML for several months, and CSS for a few weeks. PS: It is not being used for layout, I am simply trying to adjust the layout of the table itself.

    Read the article

  • Using list() to extract a data.table inside of a function

    - by Nathan VanHoudnos
    I must admit that the data.table J syntax confuses me. I am attempting to use list() to extract a subset of a data.table as a data.table object as described in Section 1.4 of the data.table FAQ, but I can't get this behavior to work inside of a function. An example: require(data.table) ## Setup some test data set.seed(1) test.data <- data.table( X = rnorm(10), Y = rnorm(10), Z = rnorm(10) ) setkey(test.data, X) ## Notice that I can subset the data table easily with literal names test.data[, list(X,Y)] ## X Y ## 1: -0.8356286 -0.62124058 ## 2: -0.8204684 -0.04493361 ## 3: -0.6264538 1.51178117 ## 4: -0.3053884 0.59390132 ## 5: 0.1836433 0.38984324 ## 6: 0.3295078 1.12493092 ## 7: 0.4874291 -0.01619026 ## 8: 0.5757814 0.82122120 ## 9: 0.7383247 0.94383621 ## 10: 1.5952808 -2.21469989 I can even write a function that will return a column of the data.table as a vector when passed the name of a column as a character vector: get.a.vector <- function( my.dt, my.column ) { ## Step 1: Convert my.column to an expression column.exp <- parse(text=my.column) ## Step 2: Return the vector return( my.dt[, eval(column.exp)] ) } get.a.vector( test.data, 'X') ## [1] -0.8356286 -0.8204684 -0.6264538 -0.3053884 0.1836433 0.3295078 ## [7] 0.4874291 0.5757814 0.7383247 1.5952808 But I cannot pull a similar trick for list(). The inline comments are the output from the interactive browser() session. get.a.dt <- function( my.dt, my.column ) { ## Step 1: Convert my.column to an expression column.exp <- parse(text=my.column) ## Step 2: Enter the browser to play around browser() ## Step 3: Verity that a literal X works: my.dt[, list(X)] ## << not shown >> ## Step 4: Attempt to evaluate the parsed experssion my.dt[, list( eval(column.exp)] ## Error in `rownames<-`(`*tmp*`, value = paste(format(rn, right = TRUE), (from data.table.example.R@1032mCJ#7) : ## length of 'dimnames' [1] not equal to array extent return( my.dt[, list(eval(column.exp))] ) } get.a.dt( test.data, "X" ) What am I missing? Update: Due to some confusion as to why I would want to do this I wanted to clarify. My use case is when I need to access a data.table column when when I generate the name. Something like this: set.seed(2) test.data[, X.1 := rnorm(10)] which.column <- 'X' new.column <- paste(which.column, '.1', sep="") get.a.dt( test.data, new.column ) Hopefully that helps.

    Read the article

< Previous Page | 4 5 6 7 8 9 10 11 12 13 14 15  | Next Page >