Search Results

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

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

  • Encrypted ID in URLs

    - by Eric
    I am trying to hash or encrypt a record's ID for URL's such that people can't view various records simply by guessing different integer ID's. Essentially, my URL's would be something like this: /plans/0AUTxwoGkOYfiZGd2 instead of /plans/304. Would the best way to do this just be to use SHA-1 to hash the plan's id and store it in a hashed_id column for plans? Then, overwrite to_param and add a finder to find by hashed_id? How do you ensure that the characters generated are 0-9, a-z, or A-Z? Thanks!

    Read the article

  • Difference between local and instance variables in ruby

    - by fflyer05
    I am working on a script that creates several fairly complex nested hash datastructures and then iterates through them conditionally creating database records. This is a standalone script using active record. After several minutes of running I noticed a significant lag in server responsiveness and discovered that the script, while being set to be nice +19, was enjoying a steady %85 - %90 total server memory. In this case I am using instance variables simply for readability. It helps knowing what is going to be re-used outside of the loop vs. what won't. Is there a reason to not use instance variables when they are not needed? Are there differences in memory allocation and management between local and instance variables? Would it help setting @variable = nil when its no longer needed?

    Read the article

  • Should I use polymorphic association, just a has_one, or attribute in this case?

    - by Angela
    I have three Models: Contact_Email, Contact_Letter, and Contact_Call. These represent the unique pairing of a Contact with a template for each of the three. For all of these, I want to record at least a status and date for the status. For example, "declined" on 5/10/10 or "responded" on 5/10/10 or something like that. I may in the future want to extend that. I later do want to be able to see all the instances that have the same status, such as "responded" or "meeting requested." What is the best way to do this? To make the three Contacts statusable and create a polymorphic association on a model called Status. Or just each Object of Contact_Email has_one Status?

    Read the article

  • How do I filter values in a Django form using ModelForm?

    - by malandro95
    I am trying to use the ModelForm to add my data. It is working well, except that the ForeignKey dropdown list is showing all values and I only want it to display the values that a pertinent for the logged in user. Here is my model for ExcludedDate, the record I want to add: class ExcludedDate(models.Model): date = models.DateTimeField() reason = models.CharField(max_length=50) user = models.ForeignKey(User) category = models.ForeignKey(Category) recurring = models.ForeignKey(RecurringExclusion) def __unicode__(self): return self.reason Here is the model for the category, which is the table containing the relationship that I'd like to limit by user: class Category(models.Model): name = models.CharField(max_length=50) user = models.ForeignKey(User, unique=False) def __unicode__(self): return self.name And finally, the form code: class ExcludedDateForm(ModelForm): class Meta: model = models.ExcludedDate exclude = ('user', 'recurring',) How do I get the form to display only the subset of categories where category.user equals the logged in user?

    Read the article

  • left join without duplicate values using MIN()

    - by Clipper87
    I have a table_1: id custno 1 1 2 2 3 3 and a table_2: id custno qty descr 1 1 10 a 2 1 7 b 3 2 4 c 4 3 7 d 5 1 5 e 6 1 5 f When I run this query to show the minimum order quantities from every customer: SELECT DISTINCT table_1.custno,table_2.qty,table_2.descr FROM table_1 LEFT OUTER JOIN table_2 ON table_1.custno = table_2.custno AND qty = (SELECT MIN(qty) FROM table_2 WHERE table_2.custno = table_1.custno ) Then I get this result: custno qty descr 1 5 e 1 5 f 2 4 c 3 7 d Customer 1 appears twice each time with the same minimum qty (& a different description) but I only want to see customer 1 appear once. I don't care if that is the record with 'e' as a description or 'f' as a description. How could I do this ? Thx!

    Read the article

  • How to create wordpress-like option table and get values for each row? (PHP-MySQL)

    - by Nacho
    Hi guys. I'm looking to create an options table in my db that makes every record a system option, so i can work with a little number of fields. my db has the following structure: 3 columns named id, name, and value following data is inserted as an example -- id - name - value 1 - uri - www.example.com 2 - sitename - Working it out 3 - base_folder - /folder1/folder2/ 4 - slogan - Just a slogan for the site -- that way i can include a large number of customizable system options very easily the problem is that i don't know how to retrieve them how do i get the value of uri and store it as a var? and better yet, how do i get, for exmaple, values of id 1 and 4 only without making a query each time? (i assume multiple queries are useless and a pretty ugly method) i know the question is pretty basic but i'm lost here. i'd really appreciate your answer! Thanks in advance

    Read the article

  • Do you leave historical code commented out in classes that you update?

    - by 18Rabbit
    When you need to obsolete a section of code (say either the business rules changed, or the old system has been reworked to use a new framework or something) do you delete it from the file or do you comment it out and then put in the new functionality? If you comment it out, do you leave a note stating why it was removed and what it was originally intended to do? I ask mainly because I've done a lot of contract work for different places over the years and sometimes it's like excavating a tomb to find the actual code that is still being used. Why comment it out and leave it in the file if source control has a record of what used to be there? If you comment out a method do you also comment out/delete any methods that were exclusively used by that method? What do you think the best practices for this should be?

    Read the article

  • Any efficient way to read datas from large binary file?

    - by limi
    Hi, I need to handle tens of Gigabytes data in one binary file. Each record in the data file is variable length. So the file is like: <len1><data1><len2><data2>..........<lenN><dataN> The data contains integer, pointer, double value and so on. I found python can not even handle this situation. There is no problem if I read the whole file in memory. It's fast. But it seems the struct package is not good at performance. It almost stuck on unpack the bytes. Any help is appreciated. Thanks.

    Read the article

  • How to schedule heavy work for later display for Listviews?

    - by Pentium10
    I have a listview with 200 items. I use a custom view for each row. There is a code that takes some time to calculate, and because of this the list hangs out on scrolling and loads in slow (2-3sec). I have subclassed SimpleCursorAdapter, and using Filterable and SectionIndexer. I have in mind to show initially the name of the record, and put in a thread the calculation, and will show up later when it's done. How do I push back some work, and later update the listview to include the calculated data? This should show up on fly without user interaction.

    Read the article

  • Unable to center text in IE but works in firefox

    - by greenpool
    Can somebody point out where I'm going wrong with the following code. Text inside td elements need to be centered except for Summary and Experience. This only appears to work in Firefox/chrome. In IE8 all td text are displayed as left-justified. No matter what I try it doesn't center it. Any particular reason why this would happen? Thanks. css #viewAll { font-family:"Trebuchet MS", Arial, Helvetica, sans-serif; width:100%; border-collapse:collapse; margin-left:10px; table-layout: fixed; } #viewAll td, #viewAll th { font-size:1.1em; border:1px solid #98bf21; word-wrap:break-word; text-align:center; overflow:hidden; } #viewAll tbody td{ padding:2px; } #viewAll th { font-size:1.1em; padding-top:5px; padding-bottom:4px; background-color:#A7C942; color:#ffffff; } table <?php echo '<table id="viewAll" class="tablesorter">'; echo '<thead>'; echo '<tr align="center">'; echo '<th style="width:70px;">Product</th>'; echo '<th style="width:105px;">Prob</th>'; echo '<th style="width:105px;">I</th>'; echo '<th style="width:60px;">Status</th>'; echo '<th style="width:120px;">Experience</th>'; echo '<th style="width:200px;">Technical Summary</th>'; echo '<th style="width:80px;">Record Created</th>'; echo '<th style="width:80px;">Record Updated</th>'; echo '<th style="width:50px;">Open</th>'; echo '</tr>'; echo '</thead>'; echo '<tbody>'; while ($data=mysqli_fetch_array($result)){ #limiting the summary text displayed in the table $limited_summary = (strlen($data['summary']) > 300) ? substr(($data['summary']),0,300) . '...' : $data['summary']; $limited_exp = (strlen($data['exp']) > 300) ? substr(($data['exp']),0,300) . '...' : $data['exp']; echo '<tr align="center"> <td style="width:70px; text-align:center;">'.$data['product'].'</td>'; //if value is '-' do not display as link if ($data['prob'] != '-'){ echo '<td style="width:105px;">'.$data['prob'].'</a></td>'; } else{ echo '<td style="width:105px; ">'.$data['prob'].'</td>'; } if ($data['i'] != '-'){ echo '<td style="width:105px; ">'.$data['i'].'</a></td>'; } else{ echo '<td style="width:105px; ">'.$data['i'].'</td>'; } echo'<td style="width:40px; " >'.$data['status'].'</td> <td style="width:120px; text-align:left;">'.$limited_cust_exp.'</td> <td style="width:200px; text-align:left;">'.$limited_summary.'</td> <td style="width:80px; ">'.$data['created'].'</td> <td style="width:80px; ">'.$data['updated'].'</td>'; if (isset($_SESSION['username'])){ echo '<td style="width:50px; "> <form action="displayRecord.php" method="get">'.' <input type="hidden" name="id" value="'. $data['id'].'" style="text-decoration: none" /><input type="submit" value="Open" /></form></td>'; }else{ echo '<td style="width:50px; "> <form action="displayRecord.php" method="get">'.' <input type="hidden" name="id" value="'. $data['id'].'" style="text-decoration: none" /><input type="submit" value="View" /></form></td>'; } echo '</tr>'; }#end of while echo '</tbody>'; echo '</table>'; ?>

    Read the article

  • What are some Coldfusion (mx7 and greater) "Gotchas" that I should know about?

    - by jakeonrails
    I just spent half the day troubleshooting what is apparently a rather famous gotcha for Coldfusion MX7 and below: The nested query loop bug: Where you are required to reference the current_row of the outer query or else you will only see the first record. For example: <cfloop query="outer"> <cfloop query="innner"> <p>#outer.field#</p><!--- this won't work, you'll only get the first row ---> <p>#outer.field[current_row]#</p><!--- you must do this instead ---> </cfloop> </cfloop> Are there any other ways in which ColdFusion does not work in the obvious way?

    Read the article

  • how to get the second batch and 3rd batch in the same query result in oracle sql + yii framework?

    - by sasori
    let' say i have 20 results in the sql query. if am gonna use the limit in the yii active record, I'll obviously get the first four from the result, but what if i wanna get the 2nd four and then 3rd four in the same query result ? how to query that via sql ? e.g $criteria2 = new CDbCriteria(); $criteria2->select = 'USERID, ADID ,ADTYPE, ADTITLE, ADDESC, PAGEVIEW, DISPPUBLISHDATE'; $criteria2->addCondition("STATUS = 1"); $criteria2->order = '"t".PAGEVIEW DESC,"t".PUBLISHDATE DESC'; $criteria2->limit = 4; $criteria2->with = array('subcat','adimages'); $result = $this->findAll($criteria2); return $result;

    Read the article

  • How to extract the latest row

    - by Bob
    Hi, I have a table like this: Table A Date Time ID Ref 110217 91703 A001 A1100056 110217 91703 A001 A1100057 110217 91703 A001 A1100058 110217 91703 A001 A1100059 110217 132440 A001 A1100057 110217 132440 A001 A1100058 110217 132440 A001 A1100060 I wish to have the latest data only & the final result should look like this using SQL: Date Time ID Ref 110217 132440 A001 A1100057 110217 132440 A001 A1100058 110217 132440 A001 A1100060 The database will self-update by itself at certain time. The problem is: I do not know the exact time, hence I do not know which record is the latest. Thanks.

    Read the article

  • Rails valiation among a three model relationship

    - by Andrew
    I'm working on a three model relationship with one aspect that I'm not sure how to approach. Here's the basic relationship: class Taxonomy has_many :terms # attribute: `inclusive`, default => false end class Term belongs_to :taxonomy has_and_belongs_to_many :photos end class Photo has_and_belongs_to_many :terms end This is pretty straightforward stuff except for one thing: A Taxonomy can be either 'Inclusive' or 'Exclusive'. Exclusive means the terms are mutually exclusive, Inclusive means they're not. So, if a Taxonomy is exclusive ie. taxonomy.inclusive = false, then there can only be one term from that taxonomy attached to a given photo. Now, I can handle this on the client-side without a problem, but I am not quite sure how to set up a validation on Photos (or somewhere else) that says basically: "validate that no more than one term from an exclusive taxonomy is associated with this record." Any ideas on how to do that?

    Read the article

  • Word wrapping issue in text file export

    - by photec
    I just whipped up a program to export a dataset to a text file and am running into a issue with data from an observation being wrapped to the line below in the exported file. Below is a stripped down version of my program and the text seems to be wrapping at column 1025. Does anyone happen to know why this is occurring and how to go about ensuring that record data stays on its own row? Any help would be greatly appreciated. data ; set (firstobs = 1 obs = 75); file '\' lrecl = 32767; put first_var $1 ... last_var 1244; run;

    Read the article

  • Select distinct ... inner join vs. select ... where id in (...)

    - by Tonio
    I'm trying to create a subset of a table (as a materialized view), defined as those records which have a matching record in another materialized view. For example, let's say I have a Users table with user_id and name columns, and a Log table, with entry_id, user_id, activity, and timestamp columns. First I create a materialized view of the Log table, selecting only those rows with timestamp some_date. Now I want a materliazed view of the Users referenced in my snapshot of the Log table. I can either create it as select * from Users where user_id in (select user_id from Log_mview), or I can do select distinct u.* from Users u inner join Log_mview l on u.user_id = l.user_id (need the distinct to avoid multiple hits from users with multiple log entries). The former seems cleaner and more elegant, but takes much longer. Am I missing something? Is there a better way to do this?

    Read the article

  • Quiz module as a part of SQL Tutorial (Project) in C#. Help!

    - by N1107
    Kindly help. Am a beginner in C#. The details of my project work include: Front End: C# Back End: SQL MS Visual Studio 2010 Windows Application Quiz Module Each session contains 20 questions. At the end of the test, the test-engine will evaluate the answers. If the student obtains more than 50% then he can unlock the next module. And his test score is printed using Crystal Reports and saved in teacher's database, against that student's record. Else, if his score is less than 50%, the test-engine will count the no. of attempts to clear the quiz & randomly generate another set of 20 questions from a file (from the teacher's database). It's complicated for me cause am a beginner. Would appreciate some help. Thanks.

    Read the article

  • PHP - Get values from Array

    - by danit
    I am trying to get a record from a database using an sql lookup (sql1). This then returns as an array which is fine, but I need to use part of the array for my next stage. $opt=get_records_sql($sql1); //Diags for SQL content print_object($opt); $n = count($opt); if (empty($opt)) { echo 'No options selected'; } else { $optno = $opt["subjectid"]; // Diags of $optno echo '<br>$optno = '.$optno; As you can see, I tried to use this: $opt["subjectid"] as subjectid is the fieldname that I am trying to access and I was under the impression that this was correct for accessing an array, but I get the following error: Notice: Undefined index: subjectid Array contents: Array ( [1] => stdClass Object ( [uname] => JHollands06 [tutor] => M LSt [subjectid] => 1 [year] => 2010 [optid] => 1 ) )

    Read the article

  • strange behavior of <> to filter null values

    - by Kerezo
    Hi experts: I have a table Called tblAlarm and it has some records like this: I have another table for determine what user see what message: Now I want to write a query to show Messages that user has not seen if message didinot expired.(for example it's year between BeginYear and EndYear and so on ...). I write this query: SELECT * FROM tblAlarms LEFT OUTER JOIN tblUsersAlarms tua ON tblAlarms.Id=tua.MessageID WHERE @CurrentYear BETWEEN tblAlarms.BeginYear AND tblAlarms.EndYear AND @CurrentMonth BETWEEN tblAlarms.BeginMonth AND tblAlarms.EndMonth AND @CurrentDay BETWEEN tblAlarms.BeginDay AND tblAlarms.EndDay AND (@CurrentHour * 60 + @CurrentMinute) BETWEEN tblAlarms.BeginHour*60 + tblAlarms.BeginMinute AND tblAlarms.EndHour*60 + tblAlarms.EndMinute --AND (tua.UserID <> 128 AND tua.UserID IS NULL) and it returns : but if I unComment last line it does not return any record.How I can determine what messages that users has not been seen? thanks

    Read the article

  • many-to-many relationship in CI (not using ORM)

    - by Ross
    I'm implementing a categories system in my CI app and trying to work out the best way of working with many to many relationships. I'm not using an ORM at this stage, but could use say Doctrine if necessary. Each entry may have multiple categories. I have three tables (simplified) Entries: entryID, entryName Categories: categoryID, categoryname Entry_Category: entryID, categoryID my CI code returns a record set like this: entryID, entryName, categoryID, categoryName but, as expected with Many-to-Many relationships, each "entry" is repeated for each "category". What would the best way to "group" the categories so that when I output the results, I am left with something like: Entry Name Appears in Category: Foo, Bar rather than: Entry Name Appears in Category: Foo Entry Name Appears in Category: Bar I believe the option is to track if the post ID matches a previous entry, and if so, store the respective category, and output it as one, rather than several, but am unsure of how to do this in CI. thanks for any pointers (I appreciate this is may be a vague/complex question without a better knowledge of the system).

    Read the article

  • In yii how to access other tables fields

    - by user1636115
    I am creating project in yii framework. I am having table as- Qbquestion QbquestionOption -questionId -optionId -question -questionId -userId -option -isPublished -isAnswer In QbquestionOption controller i want to access Qbquestion tables fields. I had written quesry as- $Question=Qbquestion::model()->findAllByAttributes(array("questionId"=>$number)); where $number is some random number. When i am using its fields as= $Question-isPublished then its giving error as "trying to get access to property of non-object" Statement var_dump($Question) is showing all record and all values of Qbquestion table. So how can i access records? Please help me

    Read the article

  • Building my first Javascript Application (jQuery), struggling on something

    - by Jason Wells
    I'd really appreciate recommendations on the most efficient way to approach this. I'm building a simple javascript application which displays a list of records and allows the user to edit a record by clicking an "Edit" link in the records row. The user also can click the "Add" link to pop open a dialog allowing them to add a new record. Here's a working prototype of this: http://jsfiddle.net/FfRcG/ You'll note if you click "Edit" a dialog pops up with some canned values. And, if you click "Add", a dialog pops up with empty values. I need help on how to approach two problems I believe we need to pass our index to our edit dialog and reference the values within the JSON, but I am unsure how to pass the index when the user clicks edit. It bothers me that the Edit and Add div contents are so similiar (Edit just pre populates the values). I feel like there is a more efficient way of doing this but am at a loss. Here is my code for reference $(document).ready( function(){ // Our JSON (This would actually be coming from an AJAX database call) people = { "COLUMNS":["DATEMODIFIED", "NAME","AGE"], "DATA":[ ["9/6/2012", "Person 1","32"], ["9/5/2012","Person 2","23"] ] } // Here we loop over our JSON and build our HTML (Will refactor to use templating eventually) members = people.DATA; var newcontent = '<table width=50%><tr><td>date</td><td>name</td><td>age</td><td></td></tr>'; for(var i=0;i<members.length;i++) { newcontent+= '<tr id="member'+i+'"><td>' + members[i][0] + '</td>'; newcontent+= '<td>' + members[i][1] + '</td>'; newcontent+= '<td>' + members[i][2] + '</td>'; newcontent+= '<td><a href="#" class="edit" id=edit'+i+'>Edit</a></td><td>'; } newcontent += "</table>"; $("#result").html(newcontent); // Bind a dialog to the edit link $(".edit").click( function(){ // Trigger our dialog to open $("#edit").dialog("open"); // Not sure the most efficient way to change our dialog field values $("#name").val() // ??? alert($()); return false; }); // Bind a dialog to the add link $(".edit").click( function(){ // Trigger our dialog to open $("#add").dialog("open"); return false; }); // Bind a dialog to our edit DIV $("#edit").dialog(); // Bind a dialog to our add DIV $("#add").dialog(); }); And here's the HTML <h1>People</h1> <a href="#" class="add">Add a new person</a> <!-- Where results show up --> <div id="result"></div> <!-- Here's our edit DIV - I am not clear as to the best way to pass the index in our JSON so that we can reference positions in our array to pre populate the input values. --> <div id="edit"> <form> <p>Name:<br/><input type="text" id="name" value="foo"></p> <p>Age:<br/><input type="text" id="age" value="33"></p> <input type="submit" value="Save" id="submitEdit"> </form> </div> <!-- Here's our add DIV - This layout is so similiar to our edit dialog. What is the most efficient way to handle a situation like this? --> <div id="add"> <form> <p>Name:<br/><input type="text" id="name"></p> <p>Age:<br/><input type="text" id="age"></p> <input type="submit" value="Save" id="submitEdit"> </form> </div>

    Read the article

  • mySQL : using BETWEEN in table ?

    - by Meko
    I have a table that includes somestudent group name ,lesson time,day names like Schedule. I am using C# whit MYSql and I want to find which lesson is when user press button from table. I can find it like entering exact value like in table 08:30 or 10:25 , it finds. But I want to make that getting system time and checking that is it between 08:30 and 10:25 or 10:25 and 12:30 . Then I can sythat it is first lesson or it is second lesson . I have also table includes Table_Time column has 5 record like 08:20 , 10:25 , 12:20 so on. Could I use like : select Lesson_Time from mydb.clock where Lesson_Time between (current time)-30 AND (current time)+30 Or can I use between operator between two columns ? Like creating Lesson_Time_Start and Lesson_Time_End and compairing current time like Lesson_Start_Time

    Read the article

  • complex data requirement.

    - by Abulalia
    Here is my query: select Table1.a, Table1.b, Table1.c, Table1.d, Table2.e, Table3.f, Table4.g, Table5.h from Table1 left join Table6 on Table1.b=Table6.b left join Table3 on Table6.j=Table3.j left join Table7 on Table1.b=Table7.b left join Table5 on Table7.h=Table5.h inner join Table4 on Table1.k=Table4.k inner join Table2 on Table1.m=Table2.m where Table2.e <= x and Table2.n = y and Table3.f in (‘r’, ‘s’) and Table1.d = z group by Table1.a, Table1.b, Table1.c, Table1.d, Table2.e, Table3.f, Table4.g, Table5.h order by Table1.a, Table1.b, Table1.c I am looking for records (a,b,c,d,e,f,g,h) for every a when the very first record b (there are multiple records b for each a) is either 'r' or 's'. Can someone help?

    Read the article

  • how to filter in sql

    - by user3634746
    good day i have a database containing time in and time out and i want to filter all the record of the employees time in and time out. here is my sample db using php and mysql PersonalId LogCount LogDate LogType LogKind 2 1 2014-04-09 12:42:24 0 0 2 1 2014-04-10 12:43:53 1 0 2 1 2014-04-11 02:17:39 0 0 2 2 2014-04-09 12:42:48 1 0 3 2 2014-04-10 12:44:14 0 0 3 2 2014-04-11 02:48:54 1 0 3 3 2014-04-09 12:43:23 0 0 3 3 2014-04-09 12:43:23 1 0 0 in log type is =login 1 in log type is =login this will be the format emp id IN OUT HOURS 2 6/2/2014 8:15 6/2/2014 17:00 7.25 2 6/2/2014 8:15 6/2/2014 17:00 7.25 thanks for your help

    Read the article

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