Search Results

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

Page 71/266 | < Previous Page | 67 68 69 70 71 72 73 74 75 76 77 78  | Next Page >

  • what's the right way to bind sqldatasource to asp:label in asp.net 4.0?

    - by cskilbeck
    Is it possible using Eval? If so, can someone post a short fragment to illustrate? My SqlDataSource returns 1 record with 3 fields, I'd like to Format these into a string. eg: Record Field 'Name' = 'Jack' Field 'Amount' = 100 Field 'Date' = 12.02.2010 asp:Label text should end up being: Welcome Jack, last payment was 100 on 12.02.2010 if another control than asp:Label is appropriate, that would be good to know also.

    Read the article

  • I have to select the checkbox two times to check/uncheck in jTable

    - by 117526709403775781607
    I have a jTable code i intend to use, but the problem with it is that when i click on the checkbox once it doesn't select/deselect it, instead i have to click twice. But if i select any other cell in the row except the one containing the checkbox the purpose is solved. HERE IS MY CODE : public class TableSelectionTest extends JFrame implements ListSelectionListener { private final int COLUMN_COUNT = 5; private TblModel model; public TableSelectionTest() { initialize(); setDefaultCloseOperation(EXIT_ON_CLOSE); pack(); } private void initialize() { List data = new ArrayList(); for (int i = 0; i < 10; i++) { Object record[] = new Object[COLUMN_COUNT]; record[0] = Boolean.FALSE; for (int j = 1; j < COLUMN_COUNT; j++) { record[j] = new Integer(j); } data.add(record); } model = new TblModel(data); JTable table = new JTable(model); table.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION); table.getSelectionModel().addListSelectionListener (this); JScrollPane scroll = new JScrollPane(table); getContentPane().add(scroll, BorderLayout.CENTER); } public static void main(String[] args) { TableSelectionTest f = new TableSelectionTest(); f.show(); } class TblModel extends AbstractTableModel { private List data; public TblModel(List data) { this.data = data; } public int getColumnCount() { return COLUMN_COUNT; } public int getRowCount() { return data == null ? 0 : data.size(); } public void setValueAt(Object value, int rowIndex, int columnIndex) { getRecord(rowIndex)[columnIndex] = value; super.fireTableCellUpdated(rowIndex, columnIndex); } public Object getValueAt(int rowIndex, int columnIndex) { return getRecord(rowIndex)[columnIndex]; } public boolean isCellEditable(int rowIndex, int columnIndex) { if(columnIndex == 0) return true; else return false; } public Class getColumnClass(int columnIndex) { if (data == null || data.size() == 0) { return Object.class; } Object o = getValueAt(0, columnIndex); return o == null ? Object.class : o.getClass(); } private Object[] getRecord(int rowIndex) { return (Object[]) data.get(rowIndex); } } public void valueChanged(ListSelectionEvent e) { if (!e.getValueIsAdjusting()) { ListSelectionModel lsm = (ListSelectionModel) e.getSource(); int index = lsm.getMinSelectionIndex(); if(model.getRecord(index)[0] == Boolean.FALSE) model.setValueAt(Boolean.TRUE, index, 0); else if(model.getRecord(index)[0] == Boolean.TRUE) model.setValueAt(Boolean.FALSE, index, 0); } } } Please reply soon as it is bugging me a lot Thank you in advance :)

    Read the article

  • group by query issue

    - by user319088
    gorup by query issue i have one table, which has three fields and data. Name , Top , total cat , 1 ,10 dog , 2, 7 cat , 3 ,20 hourse 4, 4 cat, 5,10 Dog 6 9 i want to select record which has highest value of "total" for each Name so my result should be like this. Name , Top , total cat , 3 , 20 hourse , 4 , 4 Dog , 6 , 9 i tried group by name order by total, but it give top most record of group by result. any one can guide me , please!!!!

    Read the article

  • get last insert id when using Activerecord

    - by pierr
    Hi, For Sqilte3 C API, I would use sqlite3_last_insert_rowid. How to get this id when using ActiveRecord after insert a new record? I use following way to insert a new record : Section.new |s| s.a = 1 s.b = 2 #I expected the return value of save to be the last_insert_id, but it is NOT s.save end

    Read the article

  • create a dict of lists from a string

    - by Chris Card
    I want to convert a string such as 'a=b,a=c,a=d,b=e' into a dict of lists {'a': ['b', 'c', 'd'], 'b': ['e']} in Python 2.6. My current solution is this: def merge(d1, d2): for k, v in d2.items(): if k in d1: if type(d1[k]) != type(list()): d1[k] = list(d1[k]) d1[k].append(v) else: d1[k] = list(v) return d1 record = 'a=b,a=c,a=d,b=e' print reduce(merge, map(dict,[[x.split('=')] for x in record.split(',')])) which I'm sure is unnecessarily complicated. Any better solutions?

    Read the article

  • How to read from database and write into text file with C#?

    - by user147685
    How to read from database and write into text file? I want to write/copy (not sure what to call) the record inside my database into a text file. One row record in database is equal to one line in the text file. I'm having no problem in database. For creating text file, it mentions FileStream and StreamWriter. Which one should I use?

    Read the article

  • grails find first

    - by srinath
    I know this is simple question but taking more time How to find first record from table in grails . I need to get only the first record with out knowing the id number . Is there any method like find :first in grails ? thanks in advance .

    Read the article

  • STI and subclasses

    - by markiv
    Hi All, I want to know, what is a rails way of converting a subclass record to another subclass record, just changing type isn't working and also superclass to subclass and vice versa. Thanks in advance Markiv

    Read the article

  • How to make item view render rich (html) text in PyQt?

    - by Giorgio Gelardi
    I'm trying to translate code from this thread in python: import sys from PyQt4.QtCore import * from PyQt4.QtGui import * __data__ = [ "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.", "Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.", "Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.", "Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum." ] def get_html_box(text): return '''<table border="0" width="100%"><tr width="100%" valign="top"> <td width="1%"><img src="softwarecenter.png"/></td> <td><table border="0" width="100%" height="100%"> <tr><td><b><a href="http://www.google.com">titolo</a></b></td></tr> <tr><td>{0}</td></tr><tr><td align="right">88/88/8888, 88:88</td></tr> </table></td></tr></table>'''.format(text) class HTMLDelegate(QStyledItemDelegate): def paint(self, painter, option, index): model = index.model() record = model.listdata[index.row()] doc = QTextDocument(self) doc.setHtml(get_html_box(record)) doc.setTextWidth(option.rect.width()) painter.save() ctx = QAbstractTextDocumentLayout.PaintContext() ctx.clip = QRectF(0, option.rect.top(), option.rect.width(), option.rect.height()) dl = doc.documentLayout() dl.draw(painter, ctx) painter.restore() def sizeHint(self, option, index): model = index.model() record = model.listdata[index.row()] doc = QTextDocument(self) doc.setHtml(get_html_box(record)) doc.setTextWidth(option.rect.width()) return QSize(doc.idealWidth(), doc.size().height()) class MyListModel(QAbstractListModel): def __init__(self, parent=None, *args): super(MyListModel, self).__init__(parent, *args) self.listdata = __data__ def rowCount(self, parent=QModelIndex()): return len(self.listdata) def data(self, index, role=Qt.DisplayRole): return index.isValid() and QVariant(self.listdata[index.row()]) or QVariant() class MyWindow(QWidget): def __init__(self, *args): super(MyWindow, self).__init__(*args) # listview self.lv = QListView() self.lv.setModel(MyListModel(self)) self.lv.setItemDelegate(HTMLDelegate(self)) self.lv.setResizeMode(QListView.Adjust) # layout layout = QVBoxLayout() layout.addWidget(self.lv) self.setLayout(layout) if __name__ == "__main__": app = QApplication(sys.argv) w = MyWindow() w.show() sys.exit(app.exec_()) Element's size and position are not calculated correctly I guess, perhaps because I haven't understand at all the style related parts from original code. Can someone help me?

    Read the article

  • Checking for nulls in ASP.NET MVC Controllers

    - by Brian McCord
    Another opinion question: What is the proper (in your opinion) to check for nulls in an MVC controller. For instance, if you have an edit controller that fetches a record from the db based on an id, what do you do if that record is not found? I found this article, but I'm not sure I like that method. Do you just check for it with an if statement and redirect to a 404 page? What solution do you use?

    Read the article

  • Setting Rails Checkbox from Another Model

    - by Kevin
    I have a checkbox that belongs to "Foo" class. I have another "Preferences" class that sets the default for what that checkbox should be. I tried using f.check_box :email_preference, :value => preferences.email_preference but it doesn't work. I use this page to do new record creation as well as edit, so obviously for new records I would want to take the preferences.email_preference setting as a default, then for editing the record use the foo.email_preference. Any suggestions?

    Read the article

  • Are there free, low cost, or open source tools for matching name/address data?

    - by luiscolorado
    This question is related to Tools for matching name/address data. There is a number commercial tools provided by SAS, Oracle, Microsoft, etc., that allow to de-duplicate or merging names of individuals or companies coming from multiple sources. However, after reading the answers to the question mentioned before, I wondered why a seemingly interesting problem didn't receive any answers mentioning open source projects that could tackle the problem. Are you aware of any open source projects or algorithms to implement the so called "record linking", "record merging", or "clustering"?

    Read the article

  • postgresql insert value in table in serial value

    - by Jesse Siu
    my database using postgresql. the table pk is uing serial value.if i want to insert a record in table, do i need type pk or it will automatic contain id. Can you give me a example about how to insert a record in dataset CREATE TABLE dataset ( id serial NOT NULL, age integer NOT NULL, name character varying(32) NOT NULL, description text NOT NULL DEFAULT ''::text CONSTRAINT dataset_pkey PRIMARY KEY (id ) )

    Read the article

  • Searching for duplicate records within a text file where the duplicate is determined by only two fie

    - by plg
    First, Python Newbie; be patient/kind. Next, once a month I receive a large text file (think 7 Million records) to test for duplicate values. This is catalog information. I get 7 fields, but the two I'm interested in are a supplier code and a full orderable part number. To determine if the record is dupliacted, I compress all special characters from the part number (except . and #) and create a compressed part number. The test for duplicates becomes the supplier code and compressed part number combination. This part is fairly straight forward. Currently, I am just copying the original file with 2 new columns (compressed part and duplicate indicator). If the part is a duplicate, I put a "YES" in the last field. Now that this is done, I want to be able to go back (or better yet, at the same time) to get the previous record where there was a supplier code/compressed part number match. So far, my code looks like this: Compress Full Part to a Compressed Part and Check for Duplicates on Supplier Code and Compressed Part combination import sys import re import time ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ start=time.time() try: file1 = open("C:\Accounting\May Accounting\May.txt", "r") except IOError: print sys.stderr, "Cannot Open Read File" sys.exit(1) try: file2 = open(file1.name[0:len(file1.name)-4] + "_" + "COMPRESSPN.txt", "a") except IOError: print sys.stderr, "Cannot Open Write File" sys.exit(1) hdrList="CIGSUPPLIER|FULL_PART|PART_STATUS|ALIAS_FLAG|ACQUISITION_FLAG|COMPRESSED_PART|DUPLICATE_INDICATOR" file2.write(hdrList+chr(10)) lines_seen=set() affirm="YES" records = file1.readlines() for record in records: fields = record.split(chr(124)) if fields[0]=="CIGSupplier": continue #If incoming file has a header line, skip it file2.write(fields[0]+"|"), #Supplier Code file2.write(fields[1]+"|"), #Full_Part file2.write(fields[2]+"|"), #Part Status file2.write(fields[3]+"|"), #Alias Flag file2.write(re.sub("[$\r\n]", "", fields[4])+"|"), #Acquisition Flag file2.write(re.sub("[^0-9a-zA-Z.#]", "", fields[1])+"|"), #Compressed_Part dupechk=fields[0]+"|"+re.sub("[^0-9a-zA-Z.#]", "", fields[1]) if dupechk not in lines_seen: file2.write(chr(10)) lines_seen.add(dupechk) else: file2.write(affirm+chr(10)) print "it took", time.time() - start, "seconds." ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ file2.close() file1.close() It runs in less than 6 minutes, so I am happy with this part, even if it is not elegant. Right now, when I get my results, I import the results into Access and do a self join to locate the duplicates. Loading/querying/exporting results in Access a file this size takes around an hour, so I would like to be able to export the matched duplicates to another text file or an Excel file. Confusing enough? Thanks.

    Read the article

  • Which MySql line is faster:

    - by Camran
    I have a classified_id variable which matches one document in a MySql table. I am currently fetching the information about that one record like this: SELECT * FROM table WHERE table.classified_id = $classified_id I wonder if there is a faster approach, for example like this: SELECT 1 FROM table WHERE table.classified_id = $classified_id Wont the last one only select 1 record, which is exactly what I need, so that it doesn't have to scan the entire table but instead stops searching for records after 1 is found? Or am I dreaming this? Thanks

    Read the article

  • nhibernate activerecord lazy collection with custom query

    - by George Polevoy
    What i'm trying to accomplish, is having a temporal soft delete table. table Project(ID int) table ProjectActual(ProjectID int, IsActual bit, ActualAt datetime) Now is it possible to map a collection of actual projects, where project is actual when there is no record in ProjectActual.ProjectID = ID, or the last record sorted by ActualAt descending has IsActual set to 1 (true)?

    Read the article

  • SQL Server 2005: Insert a row in a table and update the same row

    - by vikas
    eg:table pkey --guid annualpay datefrom dateto--if null means current record percentannualincrease percent annual increase will be calculated only if there is a difference in newly inserted and previously existing last differing value. percentannualincrease = ([newannualpay-just previous pay(if different from current)]/newannualpay)*100 eg newid(),5000,today,null,0--very first row newid(),5000,today+1,null(*),0 newid,5500,today+2,null(*),?????????????--> need to be calculated before insert *--insert will close the previous record by updating dateto=null to todays date How can I do this stuff in a trigger???

    Read the article

  • Postgresql - Edit function signature

    - by drave
    POSTGRESQL 8.4.3 - i created a function with this signature CREATE OR REPLACE FUNCTION logcountforlasthour() RETURNS SETOF record AS realised i wanted to change it to this CREATE OR REPLACE FUNCTION logcountforlasthour() RETURNS TABLE(ip bigint, count bigint) record AS but when i apply that change in the query tool it isnt accepted or rather it is accepted, there is no syntax error, but the text of the function has not been changed. even if i run "DROP FUNCTION logcountforlasthour()" between edits the old syntax comes back if i edit the body of the function, thats fine, it changes but not the signature is there something i'm missing thanks

    Read the article

  • C# Flash ActiveX - Recording

    - by Dremation
    I wrote an application that monitors live streams from various sites. The application has done well but theres a feature that is highly requested. And that's the ability to record the stream. I'm current using the Adobe Flash ActiveX control to stream the videos from the various sites. IS there a way to record the stream? Whether it be with Flash ActiveX or another framework/control that you may know of.

    Read the article

  • Authenticating users in iPhone app

    - by Myron
    I'm developing an HTTP api for our web application. Initially, the primary consumer of the API will be an iPhone app we're developing, but I'm designing this with future uses in mind (such as mobile apps for other platforms). I'm trying to decide on the best way to authenticate users so they can access their accounts from the iPhone. I've got a design that I think works well, but I'm no security expert, so I figured it would be good to ask for feedback here. The design of the user authentication has 3 primary goals: Good user experience: We want to allow users to enter their credentials once, and remain logged in indefinitely, until they explicitly log out. I would have considered OAuth if not for the fact that the experience from an iPhone app is pretty awful, from what I've heard (i.e. it launches the login form in Safari, then tells the user to return to the app when authentication succeeds). No need to store the user creds with the app: I always hate the idea of having the user's password stored in either plain text or symmetrically encrypted anywhere, so I don't want the app to have to store the password to pass it to the API for future API requests. Security: We definitely don't need the intense security of a banking app, but I'd obviously like this to be secure. Overall, the API is REST-inspired (i.e. treating URLs as resources, and using the HTTP methods and status codes semantically). Each request to the API must include two custom HTTP headers: an API Key (unique to each client app) and a unique device ID. The API requires all requests to be made using HTTPS, so that the headers and body are encrypted. My plan is to have an api_sessions table in my database. It has a unique constraint on the API key and unique device ID (so that a device may only be logged into a single user account through a given app) as well as a foreign key to the users table. The API will have a login endpoint, which receives the username/password and, if they match an account, logs the user in, creating an api_sessions record for the given API key and device id. Future API requests will look up the api_session using the API key and device id, and, if a record is found, treat the request as being logged in under the user account referenced by the api_session record. There will also be a logout API endpoint, which deletes the record from the api_sessions table. Does anyone see any obvious security holes in this?

    Read the article

< Previous Page | 67 68 69 70 71 72 73 74 75 76 77 78  | Next Page >