Search Results

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

Page 177/266 | < Previous Page | 173 174 175 176 177 178 179 180 181 182 183 184  | Next Page >

  • SQL Query in Ruby: Only select the changes

    - by JJ Liu
    Suppose I have a table (PriceHistory) like this, every time I change anything in the row, I will record the whole row again in the table. id | buy_price | sell_price | change_date 1 | 2 | 2 | 2012-06-22 2 | 3 | 2 | 2012-06-20 3 | 2 | 6 | 2012-06-15 4 | 5 | 5 | 2012-06-15 5 | 5 | 7 | 2012-06-15 6 | 4 | 8 | 2012-06-12 I only care about the change of BuyPrice, Is there a way to just select row 1, 2, 3, & 5? Here is the Ruby code I come up with, but it does not only select the changed rows PriceHistory.select("id, BuyPrice, change_date"). order("change_date DESC") Both Ruby and SQL answers are fine.

    Read the article

  • how relate one table to another for future records

    - by Sinan
    I have a games table which holds the data about a game. Then another table which holds the data about news. So far so good. First I thought about creating a junction table for game_news so I could relate news to games. This way works as intended when the game exists. So whenever I insert a news I can relate it to a game using the junction table. However there are cases when there is news about game but the game isn't published and it doesn't exists. So my question would be; is there a way to relate these news to a particular game when the game record is created. What is the best way to do this? Any ideas?

    Read the article

  • problem when I save the text of an htmlEditor ?

    - by ahmed
    Hello guys , I have a problem when I save the content of a htmlEditor it takes the first line of the message. For example I enter text text text text text text After entering the text when i retrieve it I just get the first line of the message . Send message code HtmlEdit1.Lines.Add(" <br />") HtmlEdit1.Lines.Add(" <br />") html_txt = "" For I = 0 To HtmlEdit1.Lines.Count - 1 html_txt = html_txt + HtmlEdit1.Lines(I).ToString() Next mydt = DateTime.Now Then inserting the record in SQL insert into MESSAGES (SRNO, ID, subject)values ( @P1, @P2, @P3) Finally updating the grid.

    Read the article

  • Rails: Skinny Controller vs. Fat Model, or should I make my Controller Anorexic?

    - by Nick Gorbikoff
    I know similar questions have been answered before - such as: Where should logic go, where to do certain tasks, etc. But I have a more specific question - How far should I take this axiom: "keep your controller skinny, make your model fat!" Here is an example: For instance let's say I have multiple source of verification data. A good example would be a VIN number - I can verify it against, manufacturers data source, DMV's data source, also my local databases - to see what I have on record. So I have a model called Vin and vins_controller. Inside the model I have 5 methods: check_against_local_db, check_against_dmv, check_against_car_maker_1, check_against_car_maker_2, etc. In my controller keeping with the REST, in action show - I have a simple case statement which looks at the params[:source], and based on source specified - will call specific check method. Now here is the question: Should I leave the logic that governs which data source to call in controller or should I move it to model and then in controller just do something like check_vin(source, vin)? Should I make my controller anorexic?

    Read the article

  • Logging from symfony's model layer

    - by naag
    I'm currently working on a project with symfony 1.4 and Doctrine 1.2. I'm looking for a proper way to do logging from the model layer. In some model classes I use the record hook postSave() to create a ZIP file using exec() (since PHP zip doesn't provide for storage method 'Stored'). To be sure that everythings works fine I check the return code and log an error if something goes wrong. My first naive approach was to do it like this: if ($returnCode != 0) { sfContext::getInstance()->getLogger()->debug(...); } As you know, this doesn't work so well because sfContext belongs to the controller layer and shouldn't be used from the model layer. My next try was to use the model's constructor to pass in an sfLogger instance, but this doesn't work due to Doctrine 1.2 reserving the constructor for internal use (Doctrine 1.2 Documentation). I'm looking forward for your suggestions!

    Read the article

  • Union on two tables with a where clause in the one

    - by Lostdrifter
    Currently I have 2 tables, both of the tables have the same structure and are going to be used in a web application. the two tables are production and temp. The temp table contains one additional column called [signed up]. Currently I generate a single list using two columns that are found in each table (recno and name). Using these two fields I'm able to support my web application search function. Now what I need to do is support limiting the amount of items that can be used in the search on the second table. the reason for this is become once a person is "signed up" a similar record is created in the production table and will have its own recno. doing: Select recno, name from production UNION ALL Select recno, name from temp ...will show me everyone. I have tried: Select recno, name from production UNION ALL Select recno, name from temp WHERE signup <> 'Y' But this returns nothing? Can anyone help?

    Read the article

  • mySQL one-to-many query

    - by Stomped
    I've got 3 tables that are something like this (simplified here ofc): users user_id user_name info info_id user_id rate contacts contact_id user_id contact_data users has a one-to-one relationship with info, although info doesn't always have a related entry. users has a one-to-many relationship with contacts, although contacts doesn't always have related entries. I know I can grab the proper 'users' + 'info' with a left join, is there a way to get all the data I want at once? For example, one returned record might be: user_id: 5 user_name: tom info_id: 1 rate: 25.00 contact_id: 7 contact_data: 555-1212 contact_id: 8 contact_data: 555-1315 contact_id: 9 contact_data: 555-5511 Is this possible with a single query? Or must I use multiple?

    Read the article

  • Jquery UI accordion question - how would you approach this?

    - by E.J. Brennan
    I am using jquery UI accordion control in one of my apps asp.net apps. The data for the accordion comes from a database, and each database record has an ID, a Title Field and a content field. The title is the heading, and the content is the data that shows up when the draw is opened... I'd like to be able to call my page like this: http://www.mywebsite.com/mypage.aspx?ID=123 and have it display all the data (as it does now), but then have the default 'drawer' of the accordion open to the section that corresponds to the ID number passed in on the url...there are about 50 sections on the page. Any suggestions on how to approach this? My questions is specific to the jquery accordion function, the rest I know. So where would be the best place to 'tag' the drawer with the unique ID's, and then what is the snippet of javascript code (I assume) that I would use 'open' that drawer based on the ID passed in?? Thanks!

    Read the article

  • Doctrine: Multiple (whereIn OR whereIn) query?

    - by Tom
    I'm having trouble crafting a fairly simple query with Doctrine... I have two arrays ($countries, $cities) and I need to check whether database record values would match any inside either. I'm looking for something like: ->whereIn('country', 'city', $countries, $cities) ... with 'country' being a WHERE IN for $countries and 'city' being a WHERE IN for $city. I could separate the two out but the needed query has lots of other conditions so that's not possible. The resulting SQL I'm after would be: SELECT ... WHERE ... AND ... AND ... AND ('country' IN (1,2,3) OR 'city' IN (7,8,9)) AND ... AND ...; One could therefore think of it also as a bracketing issue only. Anyone know if this is possible with Doctrine DQL? I've looked through the documentation but can't find any direction. Thanks

    Read the article

  • ffmpeg screen capture

    - by Mirai
    I wrote this script for some basic screen capture; it gets the window dimensions then uses the ffmpeg binary to record. I suspect there is a better way (maybe with the ffmpeg library), but scripting is what I know and ffmpeg generally works. Any software (other than recordmydesktop), or improvements to the script are welcome. info=`xwininfo -frame` H=`echo "$info" | grep Height | sed -E "s/^.*: ([[:digit:]]+)$/\1/"` W=`echo "$info" | grep Width | sed -E "s/^.*: ([[:digit:]]+)$/\1/"` offset=:0.0+`echo "$info" | grep Corners | sed -E "s/^.*:[[:space:]]+\+([[:digit:]]+\+[[:digit:]]+)[[:space:]]+.+/\1/" | tr + ,` /usr/local/bin/ffmpeg -f x11grab -s ${W}x${H} -r 45 -i $offset -sameq -f avi ~/videos/`date +%Y-%m-%d-%H%M%s`_vid & echo $! > /tmp/$(basename $0)-$USER

    Read the article

  • optimization mvc code

    - by user276640
    i have such code var prj = _dataContext.Project.FirstOrDefault(p => p.isPopular == true); if (prj != null) { prj.isPopular = false; _dataContext.SaveChanges(); } prj = Details(id); prj.isPopular = true; _dataContext.SaveChanges(); idea-i have only one record with value true in field isPopular, so i get it and make false, then i get object by id and make it isPopular true. i don't like 2 calls on savechanges. any ideas?

    Read the article

  • Insert rownumber repeatedly in records in t-sql.

    - by jeff
    Hi, I want to insert a row number in a records like counting rows in a specific number of range. example output: RowNumber ID Name 1 20 a 2 21 b 3 22 c 1 23 d 2 24 e 3 25 f 1 26 g 2 27 h 3 28 i 1 29 j 2 30 k I rather to try using the rownumber() over (partition by order by column name) but my real records are not containing columns that will count into 1-3 rownumber. I already try to loop each of record to insert a row count 1-3 but this loop affects the performance of the query. The query will use for the RDL report, that is why as much as possible the performance of the query must be good. any suggestions are welcome. Thanks

    Read the article

  • SQL for selecting only the last item from a versioned table

    - by Jeremy
    I have a table with the following structure: CREATE TABLE items ( id serial not null, title character varying(255), version_id integer DEFAULT 1, parent_id integer, CONSTRAINT items_pkey PRIMARY KEY (id) ) So the table contains rows that looks as so: id: 1, title: "Version 1", version_id: 1, parent_id: 1 id: 2, title: "Version 2", version_id: 2, parent_id: 1 id: 3, title: "Completely different record", version_id: 1, parent_id: 3 This is the SQL code I've got for selecting out all of the records with the most recent version ids: select * from items inner join ( select parent_id, max(version_id) as version_id from items group by parent_id) as vi on items.version_id = vi.version_id and items.parent_id = vi.parent_id Is there a way to write that SQL statement so that it doesn't use a subselect?

    Read the article

  • TypeInitilazationException When Getting an NHibernate Session

    - by Paul Johnson
    I’ve run into what appears to be an NHibernate config problem. Basically, I ran up a simple proof of concept persistence integration test using NUnit, the test simply querys an Oracle database and successfully returns the last record received by the underlying table. However, when the assemblies are taken out of the NUnit test environment and deployed as they would be for an actual application build, my call for an NHibernate session results in a ‘TypeInitializationException’ whilst executing the code line: sessionFactory = New Configuration().Configure().BuildSessionFactory() The application is a vb.net console app running against an Oracle 9.2 database, using a ‘coding framework’ published on the web by Bill McCafferty entitled 'NHibernate Best Practices with ASP.NET' (pre S#harp Architecture). I am running version 2.1.2.4000 of NHibernate. Any assistance much appreciated. Kind Regards Paul J.

    Read the article

  • Ipad, closed environment and threat to privacy

    - by Akshay Bhat
    I had an unusual question about ipad, Since ipad environment is closed and does not allows installation of diagnostic and security related programs. How can then we be sure that any of the software installed on ipad is not infringing upon our privacy by doing stuff such as homing back information, etc. We cant install a packet tracer or any other software to check for attacks on privacy. Also given Apples poor track record (the safari browser was broken in one day), I don't think trusting apple solely would be a good idea. This might not seem to be a big issue but for business users it would be a significant concern.

    Read the article

  • Transform data in FMPXMLRESULT grammar into a "Content Standard for Digital Geospatial Metadata (CS

    - by Andrew Igbo
    I have a problem in FileMaker; I wish to link the METADATA element/FIELD element “NAME” attribute to its corresponding data in the RESULTSET element/COL element. However, I also wish to map the METADATA element/FIELD element “NAME” to "Content Standard for Digital Geospatial Metadata (CSDGM)" metadata elements Sample XML Metadata Record with CSDGM Essential Elements Louisiana State University Coastal Studies Institute 20010907 Geomorphology and Processes of Land Loss in Coastal Louisiana, 1932 – 1990 A raster GIS file that identifies the land loss process and geomorphology associated with each 12.5 meter pixel of land loss between 1932 and 1990. Land loss processes are organized into a hierarchical classification system that includes subclasses for erosion, submergence, direct removal, and undetermined. Land loss geomorphology is organized into a hierarchical classification system that includes subclasses for both shoreline and interior loss. The objective of the study was to determine the land loss geomorphologies associated with specific processes of land loss in coastal Louisiana.

    Read the article

  • Multiple records with one request in RESTful system

    - by keithjgrant
    All the examples I've seen regarding a RESTful architecture have dealt with a single record. For example, a GET request to mydomain.com/foo/53 to get foo 53 or a POST to mydomain.com/foo to create a new Foo. But what about multiple records? Being able to request a series of Foos by id or post an array of new Foos generally would be more efficient with a single API request rather than dozens of individual requests. Would you "overload" mydomain.com/foo to handle requests for both a single or multiple records? Or would you add a mydomain.com/foo-multiple to handle plural POSTs and GETs? I'm designing a system that may potentially need to get many records at once (something akin to mydomain.com/foo/53,54,66,86,87) But since I haven't seen any examples of this, I'm wondering if there's something I'm just not getting about a RESTful architecture that makes this approach "wrong".

    Read the article

  • Dynamics CRM Get Info For Customer

    - by macinjosh
    I'm working on a ASP.NET (C#) site that pulls most of its data from Dynamics CRM over SOAP using Microsoft's CrmService SDK. I'm at the point where a query has returned an entity with a property of the type Customer. I need to get the name string of that customer record, but cannot figure out how to do so. By doing a little guess work I figured out that what I have is GUID for the customer. How can I use this GUID to get the customer's name as a string? Relevant Links: CrmService Docs Customer Property Customer Class

    Read the article

  • Minimum & Maximum Values in Crystal Reports 2008 Column

    - by GregD
    Say I have this column returned in a command for Crystal: deposit_no 123 130 125 124 126 127 128 129 and I need to have this in the report title: Includes deposits between 123 - 130 I've tried a running formula for minimum and maximum and they aren't returning the correct values no matter how I manipulate them. I've tried evaluate for every record, on change of the deposit_no field, etc. I have no grouping on this report. Edited to add: While I preferred to handle this on the CR side of things, I changed my command to include what mson wrote below. So technically, mson had the correct answer.

    Read the article

  • dilemma about mysql. using condition to limit load on a dbf

    - by ondrobaco
    hi, I have a table of about 800 000 records. Its basically a log which I query often. I gave condition to query only queries that were entered last month in attempt to reduce the load on a database. My thinking is a) if the database goes only through the first month and then returns entries, its good. b) if the database goes through the whole database + checking the condition against every single record, it's actually worse than no condition. What is your opinion? How would you go about reducing load on a dbf?

    Read the article

  • I need to know what link is clicked, how do i get these variables with cherrypy?

    - by user291071
    Lets say I display 3 links, I want to accomplish 2 things, know which link is clicked, and record this choice in a list/pickle or txt file but also capture this variable in cherrypy so I can perform another action. How do I do this? Its been suggested that I use a query string which makes sense but I can't get the querystring variable to cherrypy to use for further actions. So would anyone have a simple code of cherrypy with lets say 2 pages and have one page display 2 links with a querystring in each and the second page able to get that value?

    Read the article

  • Finding indexes of each element in a multidimensional array in ruby

    - by Shreyas Satish
    Eg :a=[["hello", "world"], ["good", "lord"], ["hello", "lord"]] I need to find and record the indexes of each word with respect to the super-array. i.e hello => 0,2 world => 0 lord => 1,2. here's my shot ,but its very amateurish and lengthy. all_tokens=tokens.flatten all_tokens.each do|keyword| tokens.each do|token_array| if token_array.include?keyword x << i end i=i+1 end y[k] = x.clone y=y.clear end

    Read the article

  • Obey the MediaBox/CropBox in PDF when using ghostscript to render a PDF to a png

    - by gordonwatts
    I've been using ghostscript to convert my single figure plots rendered in PDF to png: gswin32c -sDEVICE=png16m -r300x300 -sOutputFile=junk.png -dBATCH -dNOPAUSE Figure_001-a.pdf This works in the sense I get a png out and it contians the plot. But it contains a huge amount of white space as well (an example source image: http://cdsweb.cern.ch/record/1258681/files/Figure_001-a.pdf). If you view it in Acrobat you'll note there is no white space around the plot. If you use the above command line you'll find the plot is only about 1/3 of the space. When doing the same thing with an eps file I run into the same problem. However, there is the command-line parameter -dEPSCrop that one can pass to get the PS rendering engine to pay attention to the BoundingBox. I need the similar argument for rendering PDF's. I was not able to find it in docs (nor even the EPSCrop, actually).

    Read the article

  • EF Code First Detached Entity not updating object reference

    - by Alvaro
    I'm posting the exact entity: public class Person : ContactableEntity { public Plan Plan { get; set; } public int Record { get; set; } public int PersonTypeValue { get; set; } } I'm using the following code to update in a disconected context fashion: public void Update(DbSet MySet, object Obj) { MySet.Attach(Obj); var Entry = this.Entry(Obj); Entry.State = EntityState.Modified; this.SaveChanges(); } This is a method exposed by my dbContext Called this way: PersistentManager.Update(PersistentManager.Personas,UpdatedPersona); The problem is, EF will update any property but the referenced Plan object. Can someone tell me where is the mistake? In advance : the entity reaches the point of update with all the properties correctly set. EF just fails to update the FK in the Database (no exception though)

    Read the article

  • OleDbException in my update method

    - by Hamed Norouzi
    Why do I have this error? The error message is: Syntax error in INSERT INTO statement. I want to add a record to my database, but it isn't working. Where is the problem? The code is: using (OleDbConnection connection = new OleDbConnection(connectionString)) { OleDbDataAdapter DbDataAdabter = new OleDbDataAdapter(); DbDataAdabter.SelectCommand = new OleDbCommand("SELECT * FROM [Phone-Book]", connection); OleDbCommandBuilder cb = new OleDbCommandBuilder(DbDataAdabter); connection.Open(); DataRow dataRow = myDataset.Tables["salam"].NewRow(); dataRow[1] = textBox2.Text; dataRow[2] = textBox3.Text; dataRow[3] = textBox4.Text; dataRow[4] = textBox5.Text; dataRow.EndEdit(); myDataset.Tables["salam"].Rows.Add(dataRow); DbDataAdabter.Update(myDataset , "salam"); connection.Close(); connection.Dispose(); } }

    Read the article

< Previous Page | 173 174 175 176 177 178 179 180 181 182 183 184  | Next Page >