Daily Archives

Articles indexed Thursday March 25 2010

Page 24/127 | < Previous Page | 20 21 22 23 24 25 26 27 28 29 30 31  | Next Page >

  • Using multiple QStyledItemDelegate with stylesheets

    - by Shane Holloway
    I'm creating a styled QTreeView using double-dispatch to resolve specific delegate for data items, which is working great. I subclassed the delegates from QStyledItemDelegate to take advantage of stylesheets, enabling the designers to style the UI outside of the code. Unfortunately, I have been unable to address different styles from the CSS. How do I select and use the item sub-control style specified in the stylesheet? The CSS I'm testing with: QTreeView::item:selected { background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #dddddd, stop: 1 #888888); } QTreeView::item:selected[role="title"] { background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #fde7ef, stop: 1 #f1cbda); } QTreeView::item:selected[role="entry"] { background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #e7effd, stop: 1 #cbdaf1); } My delegate rendering classes: class VisitingDelegate(QtGui.QAbstractItemDelegate): def __init__(self, parent=None): super(VisitingDelegate,self).__init__(parent) roles = {} self.renderRoles = roles d = TitleDelegate(parent) d.setProperty("role", "title") roles['title'] = d d = EntryDelegate(parent) d.setProperty("role", "entry") roles['entry'] = d def delegateForIndex(self, mi): role = mi.model().data(mi, "renderRole") return self.renderRoles[role] def paint(self, painter, option, mi): dg = self.delegateForIndex(mi) return dg.paint(painter, option, mi) def sizeHint(self, option, mi): dg = self.delegateForIndex(mi) return dg.sizeHint(option, mi) class TextDocumentDelegate(QtGui.QStyledItemDelegate): fmt = "<font color='%(color)s'>%(text)s</font)>" def paint(self, painter, option, mi): painter.save() opt = QtGui.QStyleOptionViewItemV4(option) self.initStyleOption(opt, mi) opt.text = '' style = opt.widget.style() style.drawControl(style.CE_ItemViewItem, opt, painter, opt.widget) textRect = style.subElementRect(style.SE_ItemViewItemText, opt, opt.widget); doc = self.asTextDoc(option, mi) painter.translate(textRect.topLeft()) doc.drawContents(painter) painter.restore() def sizeHint(self, option, mi): doc = self.asTextDoc(option, mi) sz = doc.size() sz = QtCore.QSize(sz.width(), sz.height()) return sz def asTextDoc(self, option, mi): info = {} info['text'] = mi.model().data(mi, Qt.DisplayRole) doc = QtGui.QTextDocument() doc.setDefaultFont(option.font) pal = option.palette if option.state & QtGui.QStyle.State_Selected: color = pal.color(pal.HighlightedText) else: color = pal.color(pal.Text) info['color'] = color.name() doc.setHtml(self.fmt % info) return doc class EntryDelegate(TextDocumentDelegate): pass class TitleDelegate(TextDocumentDelegate): fmt = "<h3><font color='%(color)s'>%(text)s</font)></h3>"

    Read the article

  • difference b/w soap web service and webservice

    - by Praveen Prasad
    i saw that in asp.net .asmx file, we create webservices [webmethod] //method defination here now for soap webservice [webmethod] [SoapHeader(some parameters here)] //method defination here my question is what's the difference b/w both webservices type and how to choose which service type to choose

    Read the article

  • How to call windows authentication programmatically in sharepoint?

    - by HamdiKavak
    Hi guys, Here is my scenario. When anonymous user visits site collection's default site, custom login form panel is shown. This form is a webUserControl(.ascx file) that is embeded into page as webpart. Then user enters username and password. When submit button has been clicked, authentication will be handled by code behind of custom login form panel. Here is my question. How can I call SharePoint's authentication method with the username and password that is entered by user. Simply, I want users to login through my custom login form panel because default windows authentication window is looking really bad.

    Read the article

  • How to avoid locking key-guard in windows-mobile

    - by Solitaire
    Hi, Can any one please help me, How to avoid key-guard lock programmatically in windows mobile. i have an application in that after certain minutes key-guard gets lock. i don't want mobile to get locked when my application is running. please suggest me how to do programmatically.. Thanks Grabit

    Read the article

  • How to dispatch on the result of submiting an AJAX form in ASP.Net MVC?

    - by J. Pablo Fernández
    In ASP.Net MVC, having a form more or less like this: <% using (Ajax.BeginForm(new AjaxOptions() { OnSuccess="onSuccess"})) {%> <p> <label for="Comment">Comment:</label> <%= Html.TextArea("Comment")%> <%= Html.ValidationMessage("Comment", "*")%> </p> <p><input type="submit" value="Submit comment" /></p> <% } %> How can the onSuccess Javascript function know whether the result is another version of the form because it didn't validate, a comment as a div to add to the list of comments or a log in page that should be pop up for logging in?

    Read the article

  • customvalidator can't find controltovalidate

    - by ravi
    iam having a problem finding a textbox inside createuserwizard which is inside a contentplaceholder i have a custom validator for this textbox ..now when i put this customvalidator outside createuser wizard it says "cannot find controltovalidate control id CaptchaValue " heres is a row inside my createuserwizard <CreateUserWizard......> : : : <tr> </td> </tr> : : : </CreateUserWizard> and i have a customevalidator outside createuserwizard <asp:CustomValidator ID="CustomValidator5" runat="server" ControlToValidate="CaptchaValue" ErrorMessage="Image value must match" ValidationGroup="CreateUserWizard1" EnableClientScript="False"></asp:CustomValidator>

    Read the article

  • Parsing nested JSON objects with JSON Framework for Objective-C

    - by Sheehan Alam
    I have the following JSON object: { "response": { "status": 200 }, "messages": [ { "message": { "user": "value" "pass": "value", "url": "value" } ] } } I am using JSON-Framework (also tried JSON Touch) to parse through this and create a dictionary. I want to access the "message" block and pull out the "user", "pass" and "url" values. In Obj-C I have the following code: // Create new SBJSON parser object SBJSON *parser = [[SBJSON alloc] init]; // Prepare URL request to download statuses from Twitter NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:myURL]]; // Perform request and get JSON back as a NSData object NSData *response = [NSURLConnection sendSynchronousRequest:request returningResponse:nil error:nil]; // Get JSON as a NSString from NSData response NSString *json_string = [[NSString alloc] initWithData:response encoding:NSUTF8StringEncoding]; //Print contents of json-string NSArray *statuses = [parser objectWithString:json_string error:nil]; NSLog(@"Array Contents: %@", [statuses valueForKey:@"messages"]); NSLog(@"Array Count: %d", [statuses count]); NSDictionary *results = [json_string JSONValue]; NSArray *tweets = [[results objectForKey:@"messages"] objectForKey:@"message"]; for (NSDictionary *tweet in tweets) { NSString *url = [tweet objectForKey:@"url"]; NSLog(@"url is: %@",url); } I can pull out "messages" and see all of the "message" blocks, but I am unable to parse deeper and pull out the "user", "pass", and "url".

    Read the article

  • Embedded views and resources (mvc)

    - by Steve Ward
    Hi I've embedded several views in a library so that I can re-use across projects using this method which works OK: http://www.wynia.org/wordpress/2008/12/aspnet-mvc-plugins/ But one view usings a Javascript file. I've tried marking this as an embedded resource and adding it AssemblyInfo.cs and then referencing this resource using <%= ClientScript.GetWebResourceUrl(this.GetType(), "FullPath.FileName.js")%> This is literally displaying this output in the view WebResource.axd?d=nUxqfqAUQLabLU54W I think this is because Im trying to refer to an embedded resource from an embedded resource. Help appreciated as Im going round in circles.. Steve

    Read the article

  • How can I ask Hibernate to create an index on a foreign key (JoinColumn)?

    - by Kent Chen
    Hi, This is my model. class User{ @CollectionOfElements @JoinTable(name = "user_type", joinColumns = @JoinColumn(name = "user_id")) @Column(name = "type", nullable = false) private List<String> types = new ArrayList<String>(); } You can imagin there would be a table called "user_type", which has two columns, one is "user_id", the other is "type". And when I use hbm2ddl to generate the ddls, I can have this table, along with the foreign key constraint on "user_id". However, there is no index of this for this column. And I need this index. How can I let hibernate to generate this index for me? Thank you!

    Read the article

  • Unable to execute a function using reflection

    - by Steven
    hi, i am developing a eclipse plugin . In this plugin i am using reflection to execute a function in a class present in another project which is a hibernate project.Whenever the invoke is used i.e mymethod.invoke(myobj); it is giving this exception java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37) at java.lang.reflect.Method.invoke(Method.java:599) at packagesearch.DummyExecution.execution(DummyExecution.java:154) at packagesearch.HelloWorldAction.run(HelloWorldAction.java:48) at org.eclipse.ui.internal.PluginAction.runWithEvent(PluginAction.java:251) at org.eclipse.ui.internal.WWinPluginAction.runWithEvent(WWinPluginAction.java:229) at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:583) at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:500) at org.eclipse.jface.action.ActionContributionItem$6.handleEvent(ActionContributionItem.java:452) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1003) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3823) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3422) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2384) at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2348) at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2200) at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:495) at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:288) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:490) at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149) at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:113) at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:193) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:386) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37) at java.lang.reflect.Method.invoke(Method.java:599) at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:549) at org.eclipse.equinox.launcher.Main.basicRun(Main.java:504) at org.eclipse.equinox.launcher.Main.run(Main.java:1236) at org.eclipse.equinox.launcher.Main.main(Main.java:1212) Caused by: java.lang.NoClassDefFoundError: org.dom4j.DocumentException at java.lang.J9VMInternals.verifyImpl(Native Method) at java.lang.J9VMInternals.verify(J9VMInternals.java:72) at java.lang.J9VMInternals.initialize(J9VMInternals.java:134) at test.Example.demo1(Example.java:38) ... 36 more Caused by: java.lang.ClassNotFoundException: org.dom4j.DocumentException at java.net.URLClassLoader.findClass(URLClassLoader.java:419) at java.lang.ClassLoader.loadClass(ClassLoader.java:643) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:345) at java.lang.ClassLoader.loadClass(ClassLoader.java:609) ... 40 more what is the exact problem . i have used loader to load the class.Help

    Read the article

  • How to convert xlsx files into 2003 xls files programatically in C#?

    - by Victor Rodrigues
    I've found ExcelPackage, a better library than Excel Interop API to create and mantain programatically excel sheets, but they are generated in .xlsx. Most of people that will see the files have only office 2003 installed, so I need to convert, in my C# code, the final result into a .xls file. Do you know any way to do it in C# code? ** UPDATE I'm trying to use SaveAs method, but it doesn't work, it just doesn't do anything, or return the error 0x800A03EC .

    Read the article

  • Access current_user in model

    - by LearnRails
    I have 3 tables items (columns are: name , type) history(columns are: date, username, item_id) user(username, password) When a user say "ABC" logs in and creates a new item, a history record gets created with the following after_create filter. How to assign this username ‘ABC’ to the username field in history table through this filter. class Item < ActiveRecord::Base has_many :histories after_create :update_history def update_history histories.create(:date=Time.now, username= ?) end My login method in session_controller def login if request.post? user=User.authenticate(params[:username]) if user session[:user_id] =user.id redirect_to( :action='home') flash[:message] = "Successfully logged in " else flash[:notice] = "Incorrect user/password combination" redirect_to(:action="login") end end end I am not using any authentication plugin. I would appreciate if someone could tell me how to achieve this without using plugin(like userstamp etc.) if possible.

    Read the article

  • php - disconnecting and connecting to multiple databases

    - by Phil Jackson
    Hi, I want to be able to switch from the current db to multiple dbs though a loop: $query = mysql_query("SELECT * FROM `linkedin` ORDER BY id", $CON ) or die( mysql_error() ); if( mysql_num_rows( $query ) != 0 ) { $last_update = time() / 60; while( $rows = mysql_fetch_array( $query ) ) { $contacts_db = "NNJN_" . $rows['email']; // switch to the contacts db mysql_select_db( $contacts_db, $CON ); $query = mysql_query("SELECT * FROM `linkedin` WHERE token = '" . TOKEN . "'", $CON ) or die( mysql_error() ); if( mysql_num_rows( $query ) != 0 ) { mysql_query("UPDATE `linkedin` SET last_update = '{$last_update}' WHERE token = '" . TOKEN . "'", $CON ) or die( mysql_error() ); }else{ mysql_query("INSERT INTO `linkedin` (email, token, username, online, away, last_update) VALUES ('" . EMAIL . "', '" . TOKEN . "', '" . USERNAME . "', 'true', 'false', '$last_update')", $CON ) or die( mysql_error() ); } } mysql_free_result( $query ); } // switch back to your own mysql_select_db( USER_DB, $CON ); It does insert and update details from the other databases but it also inserts and edits data from the current users database which I dont want. Any ideas?

    Read the article

  • doofus ASP.Net master page scrollbar question

    - by Stephen Falken
    Like happens to all of us sometimes, I inherited some crappy code I have to fix. We need to center our pages on widescreen machines, so we have a master page layout div like so: .MasterLayout { width:1100px; height: 100%; position:absolute; left:50%; margin-left:-550px; vertical-align:top; } I removed most of the detailed attributes for readability here, but here's how the table for the master page is laid out: <table border="0" cellpadding="0" cellspacing="0" style="width: 100%;"> <tr> <td style="width: 100%" align="center" colspan="2"> </td> </tr> <tr> <td colspan="2" style="height: 20px; background-color: #333;"> <asp:SiteMapPath/> </td> </tr> <tr> <td style="width: 86px; height: 650px; background-color: #B5C7DE; margin: 6px;" valign="top"> <asp:Menu /> <asp:SiteMapDataSource /> </td> <td style="background-color:#ffffff; margin:5px; width:1000px;" valign="top"> <asp:contentplaceholder id="ContentPlaceHolder1" runat="server"/> </td> </tr> </table> When resizing the browser window, the horizontal scrollbar only reaches as far as the left edge of the <asp:contentplaceholder/> control, and the <asp:menu/> that's in the 86px wide <td> is hidden. How can I fix this problem? THANKS IN ADVANCE

    Read the article

  • What service do you use for music on hold?

    - by Russ Warren
    This may not be a sysadmin question for some, but it is definitely a hurdle I have to jump as the sysadmin for my company. We recently rolled-out a company wide VoiP system (Switchvox, to be exact) that has come preloaded with some royalty-free music on hold. Our customers have been complaining that the music on hold sounds like "funeral music." This may be the case (although I wouldn't want it played at my funeral), but it is all we have and we aren't willing to be sued over using music that isn't properly licensed. So, that brings me to the question asked in the title -- what and/or how do you provide decent music on hold? I'm assuming many people here use a PBX that allows customized music, so this has to apply to many of you. We've been looking at some sites that allow you to download royalty-free music for a one-time fee, but the music seems...lame. Something like a one-year subscription from ibaudio.com seems to be the best bet so far. Have you been able to discover something a little more mainstream for a decent licensing fee? Thank you. EDIT: Our PBX allows the playback of MP3 and OGG files, but does not allow streaming of a live audio source, Internet-based or otherwise. It also does not allow the use of a "line-in" source such as a CD player or radio. Don't let this stop you from sharing your setup, though. I'm interested in hearing what everyone uses!

    Read the article

  • Is there any USB2.0 data transfer chunk size limit?

    - by goldenmean
    With one read() or write() at a time, can we increase the bulk data size over USB interface? For example, I want to transfer chunk of 1024 (1K) bytes data and if the device has limitations of only 64bytes, is there any way I can increase the packet size for read() and write() system call over USB? Is there any limitation on size of data transfer over USB in a host-device environment?

    Read the article

< Previous Page | 20 21 22 23 24 25 26 27 28 29 30 31  | Next Page >