Search Results

Search found 6630 results on 266 pages for 'cname record'.

Page 198/266 | < Previous Page | 194 195 196 197 198 199 200 201 202 203 204 205  | Next Page >

  • I want to select the distict value from models field and then update them (django)

    - by qulzam
    I have models... class Item(models.Model): name = models.CharField('Item Name', max_length = 30) item_code = models.CharField(max_length = 10) color = models.CharField(max_length = 150, null = True, blank = True) size = models.CharField(max_length = 30, null = True, blank = True) fabric_code = models.CharField(max_length = 30, null = True, blank = True) I have values in Item. in Item model name field has the similar values..(but the other values of record are change). I want to select the name field values distinctly(ie similar values select only ones). in one box(like combo box). What kind of form or views i use??

    Read the article

  • Return multiple results using dynamic sql (postgresql 8.2)

    - by precose
    I want to loop through schemas and get a result set that looks like this: Count 5 834 345 34 984 However, I can't get it to return anything using dynamic sql...I've tried everything but 8.2 is being a real pain. Here is my function: CREATE OR REPLACE FUNCTION dwh.adam_test4() RETURNS void LANGUAGE plpgsql AS $function$ DECLARE myschema text; rec RECORD; BEGIN FOR myschema IN select distinct c.table_schema, d.p_id from information_schema.tables t inner join information_schema.columns c on (t.table_schema = t.table_schema and t.table_name = c.table_name) join dwh.sgmt_clients d on c.table_schema = lower(d.userid) where c.table_name = 'fact_members' and c.column_name = 'debit_card' and t.table_schema NOT LIKE 'pg_%' and t.table_schema NOT IN ('information_schema', 'ad_delivery', 'dwh', 'users', 'wand', 'ttd') order by table_schema LOOP EXECUTE 'select count(ucic) from '|| myschema || '.' ||'fact_members where debit_card = ''yes''' into rec; RETURN rec; END LOOP; END $function$

    Read the article

  • With paperclip, how can I change the image location to a ":parent_model_id/:id" folder format?

    - by Jamis Charles
    Given that I have a Listing model that has many images and each image has one attachment, how can I have the listing_id be part of the folder structure? Like so: system/photos/[listing_id]/:id I know that using :id will output the id of the image record. Here's what I currently have: class Image < ActiveRecord::Base belongs_to :listing #Rails ActiveRecord Relation. An image belongs to a post. # paperclip data has_attached_file :photo, :styles => { :medium => "300x300>", :thumb => "100x100>" }, :url => "/public/system/:class/:attachment/:id/:style_:filename" end

    Read the article

  • Handling missing data

    - by soppotare
    Say I have a simple helpdesk application which logs calls made by users. I would typically have such fields in a table relating to the call e.g. CallID, Description, CustomerID etc. I Would also have a table of customers including CustomerID, Username, Password, FullName etc. Now when a user is deleted from the customers table then the inner join between the calls table and the users table to find out historically which user logged a call would produce no results. How do people usually deal with this? Have seperate customer and useraccount tables Just disable the accounts so the data is still available Record the customers name in the calls table as a seperate field. or any other methods / suggestions?

    Read the article

  • Capturing Mac OS X System Audio output with Python

    - by richbs
    Hello, I've been trying to "hijack" the Mac OS X system audio using PyAudio and save to a wav in python. That is, I do not want to record from an input device such as a microphone. I want to grab the sound output from any or all applications. I have followed the tutorials on the PyAudio site but these do not appear to cover my use case and when I try to read from the output stream I unsurprisingly get the paCanNotReadFromAnOutputOnlyStream exception. Fair enough! Is there a way to do what I am proposing with the PyAudio or other FOSS Python Library?

    Read the article

  • Is it possible to output other formats than .docx and .odt with TinyButStrong and OpenTPS plugin

    - by Corum
    I have a module which merge document from database records and .docx or .odt document model. I have to output .docx, .odt or .pdf. For outputing MS and Open format, there is no problem, all work properly. But what I want to know is, if I can output something (like XML or HTML) which I can use after to build a PDF document? If I can't, are there any libraries which provide merge document like : DOCX (or ODT) + database record => PDF And I don't want use phplivedocx.

    Read the article

  • GCC compiler -- bug or unspecified behavior?

    - by Jared P
    When I have conflicting definitions of the ivars of a class in objective-c (not redeclaring the class in the same file, but rather naming the same class with diff ivars, no warnings or better yet errors are issued by the compiler. However, both sets of ivars are useable by the appropriate methods in the respective files. For instance Foo.m: @interface foo { int a; } - (int)method; @end @implementation foo - (int)method { return a; } @end Bar.m: @interface foo { float baz; } @end @implementation foo (category) - (float)blah { return baz; } @end compiles without warnings or errors. Is this intentional? Is this an unchecked error? (for the record, a and baz are actually the same memory location.)

    Read the article

  • Problem using Min(field)

    - by Todd
    have these two queries: SELECT classroomid AS crid, startdate AS msd FROM unitTemplates where classroomid = 6 GROUP BY classroomid and: SELECT classroomid AS crid, Min(startdate) AS msd FROM unitTemplates where classroomid = 6 GROUP BY classroomid The second query uses the minimum function. There is only one record in my table with a classroomid of 6. The first query returns msd = 20100505, the second query returns msd = 0 (instead of the expected 20100505). If I change the "Min" to "Max" it returns the highest (and only) startdate (20100505). Why doesn't MySQL like the Min function I'm using?

    Read the article

  • How can I parse free text (Twitter tweets) against a large database of values?

    - by user136416
    Hi there Suppose I have a database containing 500,000 records, each representing, say, an animal. What would be the best approach for parsing 140 character tweets to identify matching records by animal name? For instance, in this string... "I went down to the woods to day and couldn't believe my eyes: I saw a bear having a picnic with a squirrel." ... I would like to flag up the words "bear" and "squirrel", as they appear in my database. This strikes me as a problem that has probably been solved many times, but from where I'm sitting it looks prohibitively intensive - iterating over every db record checking for a match in the string is surely a crazy way to do it. Can anyone with a comp sci degree put me out of my misery? I'm working in C# if that makes any difference. Cheers!

    Read the article

  • question abouut string sort

    - by davit-datuashvili
    i have question from programming pearls problem is following show how to use lomuto's partitioning scheme to sort varying length bit strings in time proportional to the sum oof their length and algorithm is following each record in x[0..n-1] has an integer length and pointer to the array bit[0..length-1] code void bsort(l,u,depth){ if (l>=u) return; for (int i=l;i<u;i++) if (x[i].length<depth) swap(i,l++); m=l; if (x[i].bit[depth] ==0) swap(i,m++); bsort(l,m-1,depth+1); bsort(m,u,depth+1); please help me i need following things 1. how this algorith works 2.how implement in java?

    Read the article

  • Stopping users posting more than once

    - by user342391
    Before posting my form I am checking the database to see if there are any previous posts from the user. If there are previous posts then the script will kick back a message saying you have already posted. The problem is that what I am trying to achieve isn't working it all goes wrong after my else statement. It is also probable that there is an sql injection vulnerability too. Can you help??4 <?php include '../login/dbc.php'; page_protect(); $customerid = $_SESSION['user_id']; $checkid = "SELECT customerid FROM content WHERE customerid = $customerid"; if ($checkid = $customerid) {echo 'You cannot post any more entries, you have already created one';} else $sql="INSERT INTO content (customerid, weburl, title, description) VALUES ('$_POST[customerid]','$_POST[webaddress]','$_POST[pagetitle]','$_POST[pagedescription]')"; if (!mysql_query($sql)) { die('Error: ' . mysql_error()); } echo "1 record added"; ?>

    Read the article

  • how to select distinct rows for a column

    - by Satoru.Logic
    Hi, all. I have a table x that's like the one bellow: id | name | observed_value | 1 | a | 100 | 2 | b | 200 | 3 | b | 300 | 4 | a | 150 | 5 | c | 300 | I want to make a query so that in the result set I have exactly one record for one name: (1, a, 100) (2, b, 200) (5, c, 300) If there are multiple records corresponding to a name, say 'a' in the table above, I just pick up one of them. In my current implementation, I make a query like this: select x.* from x , (select distinct name, min(observed_value) as minimum_val from x group by name) x1 where x.name = x1.name and x.observed_value = x1.observed_value; But I think there may be some better way around, please tell me if you know, thanks in advance.

    Read the article

  • SQL update statement to change the value of a field and not replace it

    - by wzzrd
    I'm in the process of migrating some databases. I have this table that has a couple of hundred rows, and has a filename column. To each record in this table, the filename column needs to be altered and part of a path needs to be prepended to the value that is in that field. The table is like: | 1 | filename1 | | 2 | filename2 | and needs to become: | 1 | path/filename1 | | 2 | path/filename2 | I am not an SQL guru, but I know the basics. This eludes me though. Is there a way to do something like: update table set filename = 'path/' + filename where id = 1;

    Read the article

  • Next Identity Key LINQ + SQL Server

    - by user569347
    To represent our course tree structure in our Linq Dataclasses we have 2 columns that could potentially be the same as the PK. My problem is that if I want to Insert a new record and populate 2 other columns with the PK that was generated there is no way I can get the next identity and stop conflict with other administrators who might be doing the same insert at the same time. Case: A Leaf node has right_id and left_id = itself (prereq_id) **dbo.pre_req:** prereq_id left_id right_id op_id course_id is_head is_coreq is_enforced parent_course_id and I basically want to do this: pre_req rec = new pre_req { left_id = prereq_id, right_id = prereq_id, op_id = 3, course_id = query.course_id, is_head = true, is_coreq = false, parent_course_id = curCourse.course_id }; db.courses.InsertOnSubmit(rec); try { db.SubmitChanges(); } Any way to solve my dilemma? Thanks!

    Read the article

  • Querying results on timestamp in mysql

    - by Tom
    Hi, I have series of records in a table called 'hits' and each record has the current_timestamp (ie. 2010-04-30 10:11:30) in a column called 'current_time'. What I would like to do is query these records and return only the records from the current month. I cannot seem to get this to work. I have tried a range of queries that don't work such as - Select * FROM hits WHERE MONTH(FROM_UNIXTIME(current_time)) = 4 I don't know if I am even on the right lines! Can anyone point me in the right direction? Cheers.

    Read the article

  • Find records produced in the last hour

    - by justSteve
    I have a smalldatetime field named myTime recording when the record was created. I need the syntax that selects records created within the last hour. thought it would be: and DATEDIFF("hh", datePart(hh, myTime), DatePart(hh, GETDATE()) < 1 where datediff 1) looks for hours; 2) looks at the hours portion of the data in myTime as starting; 3) looks at the hours portion of now for ending 3) produces an int that gets compared to '1' the results i'm getting are clearly way, way off base cuz umm...clearly...i don't know what i'm doing. help? thx

    Read the article

  • Looping in filemaker using a local variable

    - by Mike Davis
    Been programming in C# for a little bit - trying to use file maker and I cant believe it but I cant even get a simple for loop to work. What I want to do is simple: loop through for the amount of entries in my "amountOfRooms" field and create an entry in a table for each room. Sounds so simple, but I cant get it to work. Right now I have this: Set Variable[$cnt[Customers::AmountOfRooms]; value:1] Go to Layout["rooms"(Rooms)] Loop Exit Loop If[$cnt = Customers::AmountOfRooms] New Record / Request Set Variable[$cnt; Value: $cnt + 1] End Loop Exit Script No new records are created. I know the script is running because it does go to my layout, but doesnt create any new records. There is a "Repetition" field for my local variable - not sure how to use that or what it means? Any thoughts on how to do this simple loop? Thanks.

    Read the article

  • How to get the next element of a SortedSet?

    - by Pentium10
    I have a SortedSet holding my ordered data. I use the .first() method to return the first record, and pass it to another window. When the other window finishes I get an event called, and I want to pass the next from the SortedSet to the window, so how to move to the next element? launchWindow(this.set.first()); Then I have this: onActivityResult(...) { if (this.set.hasNext()) launchWindow(this.set.next());//hasNext/next doesn't exists in the current context for SortedSet } What options I have?

    Read the article

  • ActiveRecord date format

    - by Mongus Pong
    I've run into a spot of bother with date formats in our Rails application. I have a date field in our view which I want to be formatted as dd/mm/yy. This is how the user will expect to enter their dates, and the datepicker control uses this format. However, Active Record seems to be expecting mm/dd/yy. If I enter 01/03/2010, this gets put in as 03 January 2010. If I enter 25/03/2010, this gets put in a null. How do I get ActiveRecord to expect Her Majesties date format?

    Read the article

  • Getting 'choice' to work in Highline Ruby Gem without error and getting variable from it

    - by The Warm Jets
    I'm having a couple of problems using Highline in Ruby, and trying to get the choice element, detailed here, to work. At the moment the following code produces the error "error: wrong number of arguments (0 for 1). Use --trace to view backtrace" How do I get the variable out of choice? At the moment I have the 'do' setup, but I have no idea about how to get the variable the user has chosen out and into a variable for use elsewhere. Sorry if this is a bit beginner, I'm brand new to ruby and this is my first project, in at the deep end. Thanks in advance. if agree("Are these files going to be part of a set? ") set_title = ask("Title: ") set_desc = ask("Description:") set_genre = ask("Genre: ") set_label = ask("Record Label: ") set_date = ask_for_date("Release Date (yy-mm-dd): ") set_label = ask("EAN/UPC: ") set_buy = ask("Buy this set link: ") set_tags = ask_for_array("Tags (seperated by space): ") # Sort out license choose do |menu| menu.prompt = "Please choose the license for this set? " menu.choices(:all_rights_reserved, :cc_by) do # put the stuff in a variable end end end # End setup set

    Read the article

  • Selecting a sequence NEXTVAL for multiple rows

    - by stringpoet
    I am building a SQL Server job to pull data from SQL Server into an Oracle database through a linked server. The table I need to populate has a sequence for the name ID, which is my primary key. I'm having trouble figuring out a way to do this simply, without some lengthy code. Here's what I have so far for the SELECT portion (some actual names obfuscated): SELECT (SELECT NEXTVAL FROM OPENQUERY(MYSERVER, 'SELECT ORCL.NAME_SEQNO.NEXTVAL FROM DUAL')), psn.BirthDate, psn.FirstName, psn.MiddleName, psn.LastName, c.REGION_CODE FROM Person psn LEFT JOIN MYSERVER..ORCL.COUNTRY c ON c.COUNTRY_CODE = psn.Country MYSERVER is the linked Oracle server, ORCL is obviously the schema. Person is a local table on the SQL Server database where the query is being executed. When I run this query, I get the same exact value for all records for the NEXTVAL. What I need is for it to generate a new value for each returned record. I found this similar question, with its answers, but am unsure how to apply it to my case (if even possible): Query several NEXTVAL from sequence in one satement

    Read the article

  • Duplicate records

    - by czuroski
    Hello, I am using nHibernate for db persistence. I have a one-to-many relationship defined between 2 tables. When I query and try to get data, I am getting the correct number of rows from the "many" table, but the rows are duplicates of the first row returned. table1 (one), table2 (many). I create a criteria query to get a certain record from table1. I then expect to get all associated records from table2. ie, table1 holds orders, table2 holds items. I query table1 to get an order which has 4 items. I expect to see each of those 4 items from table2, but all I am seeing is the 1st item repeated 4 times. Does anyone have any idea what might be happening?

    Read the article

  • swipe to delete uitableview cell; a bit jumpy?

    - by Veeru
    I have implemented "swipe to delete" on my table cell. It works fine, how ever, the delete button is a little jumpy; as in, i really have to position my finger on top of the button and carefully touch it to delete the record. I am not sure if am making it clear; let me do my best to explain When the delete button appears; the user has trouble clicking on it, it disappears the moment its clicked. THe user has to try a few times to actually delete the cell. Am not sure what the reason is, it just seems like the delete button gets hidden as though the user has clicked on a different part of the cell. Any suggestsions?

    Read the article

  • How to query for entities with no matching siblings, with LINQ?

    - by Ryan
    I've got the two following entities ... class Citation { public int CitationId { get; set; } public string Identifier { get; set; } } class CitationIdentifier { public int CitationIdentifierId { get; set; } public string Identifier { get; set; } } I'm trying to query for all Citation records where the Identifier property does not match any of the CitationIdentifiers record Identifier property. So, if I have a Citation with an Identifier property containing "foo", but there are no CitationIdentifier records with an Identifier property containing "foo", then I'd like to retrieve that Citation. I'm working with an IDbSet<Citation>. Any ideas? Thanks.

    Read the article

  • Rails: validate presence of parent_id in has_many association

    - by deb
    I have a projects resource that has many tasks. I want to ensure that every task has a project_id by adding validates_presence_of :project_id to the tasks model. However, when creating a new project with tasks, the project_id won't be available until the record saves, therefore I can't use validates_presence_of :project_id. So my question is, how do I validate presence of project_id in the task model? I want to ensure every task has a parent. ... class Project < ActiveRecord::Base has_many :tasks, :dependent => :destroy accepts_nested_attributes_for :tasks, :allow_destroy => true ... class Task < ActiveRecord::Base belongs_to :project validates_presence_of :project_id

    Read the article

< Previous Page | 194 195 196 197 198 199 200 201 202 203 204 205  | Next Page >