if have multiples object, how to arrange it so that each number of object in row x column will form a near square?
exp:14 objects arrange to something like this:
0 0 0 0
0 0 0 0
0 0 0 0
0 0
If my table looks like this:
daily_individual_tracking', 'CREATE TABLE `daily_individual_tracking` (
`daily_individual_tracking_id` int(10) unsigned NOT NULL auto_increment,
`daily_individual_tracking_date` date NOT NULL default ''0000-00-00'',
`sales` enum(''no'',''yes'') NOT NULL COMMENT ''no'',
`repairs` enum(''no'',''yes'') NOT NULL COMMENT ''no'',
`shipping` enum(''no'',''yes'') NOT NULL COMMENT ''no'',
PRIMARY KEY (`daily_individual_tracking_id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1
basically the fields can be either yes or no.
How can I count how many yes's their are for each column over a date range?
Thanks!!
Am getting the below error when trying to do a select through a Stored procedure in mysql.
Illegal mix of collations (latin1_general_cs,IMPLICIT) and (latin1_general_ci,IMPLICIT) for operation '='
Any idea on what might be going wrong here?
The collation of the table is latin1_general_ci and that of the column in the where clause is latin1_general_cs
Thanks!
Here is the table data with the column name as Ships.
+--------------+
Ships |
+--------------+
Duke of north |
---------------+
Prince of Wales|
---------------+
Baltic |
---------------+
In the Outcomes table, transform names of the ships containing more than one space, as follows:
Replace all characters between the first and the last spaces (excluding these spaces) by symbols
of an asterisk (*). The number of asterisks must be equal to number
Hi,
I have the fallowing stored procedure:
CREATE PROCEDURE `get`(IN tb VARCHAR(50), IN id INTEGER)
BEGIN
SELECT * FROM tb WHERE Indx = id;
END//
When I call get(user,1) I get the following:
ERROR 1054 (42S22): Unknown column 'user' in 'field list'
Hey there
i have a column in the databsePostgreSQL
which contains arabic data
when reading the data from the database in the controller it's read fine, encoding is good
but when sending the data to the jsp page and trying to read it
it appears something like ?????????
any ideas why something like this occur?
I have to create a 2d array with unknown size. So I have decided to go with a 2d ArrayList the problem is I'm not sure how to initialize such an array or store information.
Say I have the following data
0 connects 1
2 connects 3
4 connects 5
....etc up to a vast amount of random connections
and I want to insert
true(1) into [0][1],
true(1) into [2][3],
true(1) into [4][5].
Can the array automatically update the column/rows for me
Any help is appreciated thanks
When I try to update a value in a column or DROP a table or ALTER a table, the database just not respond, and I have to reboot the service to get database works again.
I can only SELECT data from my database(SO SAD)....
Please help me, THANKS!!!!!!!!!!!!!!!!!
I have create a report in Microsoft Reporting Service that is presented in a browser. I would like to create button that opens a textbox where the user can fill in text. This text should be saved in column in the underlying database.
Hi
I'm fighting to get the following mapping working in Grails 1.3.1 and MySQL:
class Login {
int id
String email
static mappings = {
table 'my_table'
id column: "Mgr_id"
version: false
}
}
No matter what I do the queries that are being issued refer to "schema.login" table instead of "schema.my_table". This is very frustrating... Can anyone answer why this might not be working?
I'm doing some experiments with jquery n widths for a liquid column and I'm not sure why it isn't working on firefox.
It works fine on IE6,7,8 Chrome, Opera(sluggish).
I found some articles about firefox not recognizing the .resize attribute but no explanation/solution =\
$(document).ready(function(){
$(midCol).width((window,$(window).width()) - 470)
$(window).resize(function(){$(midCol).width((window,$(window).width()) - 470)
})
});
Take for the following for example:
<GridSplitter Grid.Row="0" Grid.Column="1" Background="Yellow"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch" Width="Auto" Height="Auto"
Grid.RowSpan="3" ResizeDirection="Columns etc etc
This will create a GridSplitter across the 3 rows that I have in my grid. However, it's conceivable that I might add another row to my grid at a later stage, and I don't really want to go back and have all of my rowspans.
My first guess was Grid.RowSpan="*", but that doesn't compile. Does anyone know the answer to this off hand?
Say that I have two CSV files (file1 and file2) with contents as shown below:
file1:
fred,43,Male,"23,45",blue,"1, bedrock avenue"
file2:
fred,39,Male,"23,45",blue,"1, bedrock avenue"
I would like to compare these two CSV records to see if columns 0,2,3,4, and 5 are the same. I don't care about column 1.
What's the most pythonic way of doing this?
EDIT:
Some example code would be appreciated.
Hi all,
I have the following DB model:
**Person table**
ID | Name | StateId
------------------------------
1 Joe 1
2 Peter 1
3 John 2
**State table**
ID | Desc
------------------------------
1 Working
2 Vacation
and domain model would be (simplified):
public class Person
{
public int Id { get; }
public string Name { get; set; }
public State State { get; set; }
}
public class State
{
private int id;
public string Name { get; set; }
}
The state might be used in the domain logic e.g.:
if(person.State == State.Working)
// some logic
So from my understanding, the State acts like a value object which is used for domain logic checks. But it also needs to be present in the DB model to represent a clean ERM.
So state might be extended to:
public class State
{
private int id;
public string Name { get; set; }
public static State New {get {return new State([hardCodedIdHere?], [hardCodeNameHere?]);}}
}
But using this approach the name of the state would be hardcoded into the domain.
Do you know what I mean? Is there a standard approach for such a thing? From my point of view what I am trying to do is using an object (which is persisted from the ERM design perspective) as a sort of value object within my domain. What do you think?
Question update:
Probably my question wasn't clear enough.
What I need to know is, how I would use an entity (like the State example) that is stored in a database within my domain logic. To avoid things like:
if(person.State.Id == State.Working.Id)
// some logic
or
if(person.State.Id == WORKING_ID)
// some logic
I've created a jquery table that from time to time needs to be cleared and the re-populated, my clear method is this:
//Clear table content before repopulating values
$('#tabela_dash2_maquinas .real-content table tr:gt(0)').remove();
Now i'm trying to use tablesorter to sort a specific column, but my problem is that when I enable the tablesorter:
//Initialize tablesorter
$("table").tablesorter();
The table clearing method is not working anymore, it just keeps adding the new data with the old data, creating a lot of repeated information.
Please help
I keep coming across scenarios where it will be useful to store a set of arbitrary data in a table using a per-row key/value model, rather than a rigid column/field model. The problem is, I want to store the values with their correct data type rather than converting everything to a string. This means I have to choose either a single table with multiple nullable columns, one for each data type, or a set of value tables, one for each data type. I'm also unsure as to whether I should use full third normal form and separate the keys into a separate table, referencing them via a foreign key from the value table(s), or if it would be better to keep things simple and store the string keys in the value table(s) and accept the duplication of strings.
Old/bad:
This solution makes adding additional values a pain in a fluid environment because the table needs to be modified regularly.
MyTable
============================
ID Key1 Key2 Key3
int int string date
----------------------------
1 Value1 Value2 Value3
2 Value4 Value5 Value6
Single Table Solution
This solution allows simplicity via a single table. The querying code still needs to check for nulls to determine which data type the field is storing. A check constraint is probably also required to ensure only one of the value fields contains non-nulll data.
DataValues
=============================================================
ID RecordID Key IntValue StringValue DateValue
int int string int string date
-------------------------------------------------------------
1 1 Key1 Value1 NULL NULL
2 1 Key2 NULL Value2 NULL
3 1 Key3 NULL NULL Value3
4 2 Key1 Value4 NULL NULL
5 2 Key2 NULL Value5 NULL
6 2 Key3 NULL NULL Value6
Multiple-Table Solution
This solution allows for more concise purposing of each table, though the code needs to know the data type in advance as it needs to query a different table for each data type. Indexing is probably simpler and more efficient because there are less columns that need indexing.
IntegerValues
===============================
ID RecordID Key Value
int int string int
-------------------------------
1 1 Key1 Value1
2 2 Key1 Value4
StringValues
===============================
ID RecordID Key Value
int int string string
-------------------------------
1 1 Key2 Value2
2 2 Key2 Value5
DateValues
===============================
ID RecordID Key Value
int int string date
-------------------------------
1 1 Key3 Value3
2 2 Key3 Value6
How do you approach this problem? Which solution is better? Also, should the key column be separated into a separate table and referenced via a foreign key or be should it be kept in the value table and bulk updated if for some reason the key name changes?
we have several pages as tabs where datatable is used in most of the pages.when we sort on a particular coulmn and exit the page and re enter this page the arrow appears(up /down based on how we left) Although the data is not sorted in the direction the arrow shows.i have set preserveSort and preserveDataMode to false. The arrow is set to true in the column's t:commandSortHeader tag in all the pages. is this a bug or am i missing any setting?I have tried to set forceId to false in t:commandSortHeader but of now use.
Hi All, this question came up based on the responses I got for the question
http://stackoverflow.com/questions/2785033/getting-wierd-issue-with-to-number-function-in-oracle
As everyone suggested that storing Numeric values in VARCHAR2 columns is not a good practice (which I totally agree with), I am wondering about a basic Design choice our team has made and whether there are better way to design.
Problem Statement : We Have many tables where we want to give certain number of custom fields. The number of required custom fields is known, but what kind of attribute is mapped to the column is available to the user
E.g. I am putting down a hypothetical scenario below
Say you have a laptop which stores 50 attribute values for every laptop record. Each laptop attributes are created by the some admin who creates the laptop.
A user created a laptop product lets say lap1 with attributes String, String, numeric, numeric, String
Second user created laptop lap2 with attributes String,numeric,String,String,numeric
Currently there data in our design gets persisted as following
Laptop Table
Id Name field1 field2 field3 field4 field5
1 lap1 lappy lappy 12 13 lappy
2 lap2 lappy2 13 lappy2 lapp2 12
This example kind of simulates our requirement and our design
Now here if somebody is lookinup records for lap2 table doing a comparison on field2, We need to apply TO_NUMBER.
select * from laptop where name='lap2' and TO_NUMBER(field2) < 15
TO_NUMBER fails in some cases when query plan decides to first apply to_number instead of the other filter.
QUESTION
Is this a valid design?
What are the other alternative ways to solve this problem
One of our team mates suggested creating tables on the fly for such cases. Is that a good idea
How do popular ORM tools give custom fields or flex fields handling?
I hope I was able to make sense in the question.
Sorry for such a long text..
This causes us to use TO_NUMBER when queryio
Which of the following is faster, or are they equivalent?
(grabbing recent most records from a TIMESTAMP COLUMN)
SELECT UNIX_TIMESTAMP(`modified`) stamp
FROM `some_table`
HAVING stamp > 127068799
ORDER BY stamp DESC
or
SELECT UNIX_TIMESTAMP(`modified`) stamp
FROM `some_table`
WHERE UNIX_TIMESTAMP(`modified`) > 127068799
ORDER BY `modified` DESC
or even another combination?
How can I solve the issue of content existing in multiple versions and multiple languages?
My current structure:
Each content can only have one active version in each language, and that's how I'm curious on how to best solve.
Right now I have a column of the contentversions table, which means for each change of active version I have to run a update and set active=false on all version and then a update to set active=true for the piece of content in question.
Oracle 9i has not BOOLEAN data type. CheckBoxes in ASP.NET are BOOLEAN controls are they not?
So using a CHAR(1) column with Y or N values in the Oracle table, how do I bind to a CheckBox or CheckBoxList or RadioButton or RadioButtonList control on an ASP.NET 2.0 web form?
I'm using VB, 'specially since I'm a noobie.
Hello Friends,
Actually I am working on Pdf by using IReport Software. This software provided two detail section but i want this two detail section with Column Header .then say me how i changes it
reply me on [email protected]
a = matrix(1:25,5,5)
B = capture.output(for (X in 1:5){
A = c(min(a[,X]),quantile(a[,X],0.25),median(a[,X]),quantile(a[,X],0.75),max(a[,X]),mean(a[,X]),sd(a[,X])/m^(1/2),var(a[,X]))
cat(A,"\n")
})
matrix(B,8,5)
what i was trying to do is to generate a table which each column has those element in A and in that order. i try to use the matrix, but seems like it dont reli work here...can anyone help
1 2 3 4 5
min
1st quartile
median
SEM
VAR
THIS IS WHAT I WANT THE TABLE LOOKS LIKE ..