Daily Archives

Articles indexed Tuesday May 25 2010

Page 8/118 | < Previous Page | 4 5 6 7 8 9 10 11 12 13 14 15  | Next Page >

  • How to make Jtable column contain checkboxes?

    - by theraven
    Preface: I am horrible with java, and worse with java ui components. I have found several different tutorials on how to add buttons to tables, however I am struggling with adding checkboxes. I need to have a column that draws a text box ticked on default (cell renderer i think handles that), then on click of tickbox, unticks the box, redraws said box, and fires off an event somewhere I can track. currently I have a custom cellrenderer: public class GraphButtonCellRenderer extends JCheckBox implements TableCellRenderer { public GraphButtonCellRenderer() { } public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { if(isSelected) setSelected(true); else setSelected(false); setMargin(new Insets(0, 16, 0, 0)); setIconTextGap(0); setBackground(new Color(255,255,255,0)); return this; }} Which currently handles drawing the tick box, but only ticks and unticks the box if that row is selected. But I don't know how to handle the events. Really what I am asking is possibly a link to a good tutorial on how to add checkboxes cleanly to a JTable. Any assist is greatly appreciated :)

    Read the article

  • T-SQL Picking up active IDs from a comma seperated IDs list

    - by hammayo
    I have two tables "Product" having following structure: ProductID,ProductName, IsSaleTypeA, IsSaleTypeB, IsSaleTypeC 1, AAA, N, N, N 2, BBB, N, Y, N -- active 3, CCC, N, N, N 4, DDD, Y, N, N -- active 5, EEE, N, N, N 6, FFF, N, N, N 7, FFE, N, N, N 8, GGG, N, N, N 9, HHH, Y, N, N -- active The second table "ProductAllowed" having following structure where ProductIDs is a comma separated string filed having mix of active and inactive product ids based on their IsSaleType mode. ProductCode, ProductIDs AMRLSPN, "1,2" AMRLOFD, "1,3" BLGHVF, "2,4,6" BLGHVO, "2,4" BLGHVD, "3,5" BLGSDO, "0" CHOHVF, "1,6" CHOHVP, "1,2,7,8" ... ... Q: Is there a t-sql query that will return a list of active records from the "ProductAllowed" table if any of three IsSaleType fileds is/are switched on for a product. Based on the sample data the ProductAllowed records should return following records. AMRLSPN BLGHVF BLGHVO BLGSDO CHOHVP This needs to be applied in a SQLSERVER 2000 database containing aprox 150000 records. Thanks

    Read the article

  • How to get the Queue name that NServiceBus pulled the message from.

    - by Simon
    I can use this code to get the return address. string returnAddress = Bus.CurrentMessageContext.ReturnAddress; But how do i get the "to address" of the message. i.e. the Queue that NServiceBus pulled the message from. I had a look through the source and it seems Bus.Transport.Address is what i want but there is no get on Transport Note: I am within the "Handle" method of a message handler.

    Read the article

  • What will we use Theory Attribute for ?

    - by Sandbox
    I discovered [Theory] and [Datapoint] attributes in NUnit. I am not very sure about how should I use these. I think they can be used for data-driven testing and this has got me interested. There aren't many resources available on the same. Can someone explain to me how to use them or point me to resources? Thanks.

    Read the article

  • Help on Removal of Dynamically Created sprites.

    - by Brrr Ice Tea
    import flash.display.Sprite; import flash.net.URLLoader; var index:int = 0; var constY = 291; var constW = 2; var constH = 40; hydrogenBtn.label = "Hydrogen"; heliumBtn.label = "Helium"; lithiumBtn.label = "Lithium"; hydrogenBtn.addEventListener (MouseEvent.CLICK, loadHydrogen); heliumBtn.addEventListener (MouseEvent.CLICK, loadHelium); lithiumBtn.addEventListener (MouseEvent.CLICK, loadLithium); var myTextLoader:URLLoader = new URLLoader(); myTextLoader.addEventListener(Event.COMPLETE, onLoaded); function loadHydrogen (event:Event):void { myTextLoader.load(new URLRequest("hydrogen.txt")); } function loadHelium (event:Event):void { myTextLoader.load(new URLRequest("helium.txt")); } function loadLithium (event:Event):void { myTextLoader.load(new URLRequest("lithium.txt")); } var DataSet:Array = new Array(); var valueRead1:String; var valueRead2:String; function onLoaded(event:Event):void { var rawData:String = event.target.data; for(var i:int = 0; i<rawData.length; i++){ var commaIndex = rawData.search(","); valueRead1 = rawData.substr(0,commaIndex); rawData = rawData.substr(commaIndex+1, rawData.length+1); DataSet.push(valueRead1); commaIndex = rawData.search(","); if(commaIndex == -1) {commaIndex = rawData.length+1;} valueRead2 = rawData.substr(0,commaIndex); rawData = rawData.substr(commaIndex+1, rawData.length+1); DataSet.push(valueRead2); } generateMask_Emission(DataSet); } function generateMask_Emission(dataArray:Array):void{ var spriteName:String = "Mask"+index; trace(spriteName); this[spriteName] = new Sprite(); for (var i:int=0; i<dataArray.length; i+=2){ this[spriteName].graphics.beginFill(0x000000, dataArray[i+1]); this[spriteName].graphics.drawRect(dataArray[i],constY,constW, constH); this[spriteName].graphics.endFill(); } addChild(this[spriteName]); index++; } Hi, I am relatively new to flash and action script as well and I am having a problem getting the sprite to be removed after another is called. I am making emission spectrum's of 3 elements by dynamically generating the mask over a picture on the stage. Everything works perfectly fine with the code I have right now except the sprites stack on top of each other and I end up with bold lines all over my picture instead of a new set of lines each time i press a button. I have tried using try/catch to remove the sprites and I have also rearranged the entire code from what is seen here to make 3 seperate entities (hoping I could remove them if they were seperate variables) instead of 2 functions that handle the whole process. I have tried everything to the extent of my knowledge (which is pretty minimal @ this point) any suggestions? Thanks ahead of time!

    Read the article

  • Speed up math code in C# by writing a C dll?

    - by Projectile Fish
    I have a very large nested for loop in which some multiplications and additions are performed on floating point numbers. for (int i = 0; i < length1; i++) { s = GetS(i); c = GetC(i); for(int j = 0; j < length2; j++) { double oldU = u[j]; u[j] = c * oldU + s * omega[i][j]; omega[i][j] = c * omega[i][j] - s * oldU; } } This loop is taking up the majority of my processing time and is a bottleneck. Would I be likely to see any speed improvements if I rewrite this loop in C and interface to it from C#?

    Read the article

  • Returning structs in registers - ARM ABI in GCC

    - by jbcreix
    Hi, In the ARM ABI documentation I come across functions defined like: __value_in_regs struct bar foo(int a, int b) { ... } but GCC(4.3.3) doesn't allow it and all I could find are references to some RealView compiler. Is there any way of doing this from GCC? I have tried -freg-struct-return but it doesn't make a difference. As it is an ABI I can't change the original programs, and returning a regular struct mangles the stack. I would rather not using assembly for this if avoidable as it isn't otherwise necessary. Thanks!

    Read the article

  • How to change order in ordered+persisted collection?

    - by Jaroslav Záruba
    I just need to change order of items in a (previously persisted) ordered collection... I tried simply passing the re-arranged collection to a setter: after committing a transaction the collection is gone. Then I tried to clear() the existing collection and addAll() afterwards: clear() makes persistent manager to mark all the elements as deleted. (But obviously I would like to be able to work with the collection items in the very transaction.) (The collection is not in a default fetch group, so I tried the above also with the named fetch group added into the fetch plan. No luck.) This must be the most stupid question, but I ran out of ideas and I'm stuck here two days already. I swear I googled. :(

    Read the article

  • Is it possible to have a Shared/Static Dependency Property?

    - by Matt H.
    [using VB.NET, but I can easily read C# code in responses] I have a class called QuestionClipboard with ALL shared methods/properties. I previously had a QuesitonClipboard.doesClipboardHaveContent function that returned true/false if there was a Object on my 'clipboard'. I'd prefer to implement a Dependency Property so I can allow this true/false value to participate in data binding. The "GetValue(dp as DependencyProperty)" method requires an object instance, which would mean that my Property CAN'T be shared! Here is what the code would look like in my perfect world... Of course, the word "Shared" before the property declaration renders this code useless. Private Shared clipboardHasContentPropertyKey As DependencyPropertyKey = DependencyProperty.RegisterReadOnly("clipboardHasContent", GetType(Boolean), GetType(QuestionClipboard), _ New PropertyMetadata(False, Nothing, New CoerceValueCallback(AddressOf coerceClipboardHasContent))) Private Shared clipboardHasContentProperty As DependencyProperty = clipboardHasContentPropertyKey.DependencyProperty Public SHARED Property clipboardHasContent As Boolean Get Return GetValue(clipboardHasContentProperty) End Get Set(ByVal value As Boolean) SetValue(value) End Set End Property

    Read the article

  • Your Django Development process/steps (Step by Step)

    - by AJ
    I want to know step by step process of how folks develop on Django here. I have seen that whenever I try to create a website in Django, I always get confused amongst: DB Schema/models.py UI/Template Structure Login module urls.py views.py How do you approach this? I may have missed something. You do not need to elaborate everything, just stepwise what you do. If you do two things at the same time (or side-by-side), that would also be helpful to mention. Thanks a lot.

    Read the article

  • Rails: three most recent comments for unique users

    - by Dennis Collective
    class User has_many :comments end class Comment belongs_to :user named_scope :recent, :order => 'comments.created_at DESC' named_scope :limit, lambda { |limit| {:limit => limit}} named_scope :by_unique_users end what would I put in the :by_unique_users so that I can do Comment.recent.by_unique_users.limit(3), and only get one comment per user

    Read the article

  • Android pluginable application

    - by Alxandr
    I've been trying to create an android-application the last couple of weeks, and mostly everything has worked out great, but there is one thing that I was wondering about, and that is pluginability trough the use of intents. What I'm trying to create is basically a comic-reader. As of the version I use now, I open the application and get a list of commics that are my favourites, then I enter one to get a detailed view, and finally I enter a page. This is managed trough 3 activities. List, Details and Page. However, as of now the application can only read comics of one source (a specialiced xml-feed comming from my server), and I was hoping to be able to expand this a litle (also, the page-activity and some other stuff needs to be cleaned up in, so I'm thinking about remaking from scratch, and just take the first go as a learning-round). And I came up with an idea which I think sounds great, but I don't know if it's possible, but this is what I'm thinking about: The user enters the application and get an (first time empty) list of comics. The user hits a button to find comics, this launces an intent that says something like "find comic" or something like that. This should cause the system to display all matching activities. This would make it possible to provide different comic-providers trough different applications. Another activity kicks in and might displays some options to the user (for instance a file-browser), or might not (in the example of an xml-feed, which should just load). The list is returned to the first activity and displayed to the user. The second (find) activity is closed. The user picks a comic from the list. This should open some details-activity. The details-activity should receive a key which corresponds to the comic selected. This should be unique amongst the comic-providers. The details-view should get it's data trough some cind of content-provider, or an activity (whichever is most suited, if one of them is). The user can select a page. This should be the same routine as step 5. My question is, is this possible in the android system, and if it is, is it a bad idea? And also, is there any better way to achieve more or less the same thing?

    Read the article

  • Employee Monitoring software

    - by nute
    I am looking for an employee monitoring solution, that would allow us to remotely connect to our computers to see what is happening live, and preferably having some recording capabilities such as snapshots, URLs visited, etc ... I've looked around the web and most softwares I found were from unknown companies, had crappy websites, and made me feel like their either wanted me to install a virus on my computer, or to scam me. Most also seemed to have planted "reviews" online most likely written by themselves. Basically, anyone has experience with a trustworthy company to accomplish that? Thanks

    Read the article

  • Keyboard Navigation of File Open Dialog in Windows 7

    - by dkusleika
    In Windows XP standard File - Open dialog, the top has a "Look In" box. I can press Alt+I to drop down a tree of the disks folders and easily navigate to other folders or network shares. In Windows 7, I can't seem to navigate the File - Open dialog as easily. The best I've been able to muster is to tab 5 times (in Excel 2007, but I assume it's a windows standard), then use arrow keys or use Alt+arrow keys like a browser to get around. It's simply not as good because I can't see the whole tree at once. Is there a way to see the whole folder tree? If not, do you have any other tips for keyboard navigation of the file open dialog in Windows 7?

    Read the article

  • Word 2003: Bullet style renamed; is there some way to reverse this?

    - by Margaret
    I have a machine that seems to have had its bullet style permanently changed - I previously was creating a document which had a question/answer format, where the answers were bullet points, so I created a style for them. The problem is, it seems to have stuck. If you click the "Bullet" button, the paragraph is formatted in the style. I've tried deleting the style in Normal.dot, and even deleting the Normal.dot file in the entirely - neither seems to fix the problem. Anyone have any other bright ideas on how to fix it?

    Read the article

  • Getting text boxes on a webpage

    - by C-UNIT
    So what I am trying to do is make an application (just for fun, not a lot of purpose), where when you launch it a interface comes up consisting of Username: textboxhere Password: textbox2here then a connect button, and when you fill out your information in the textboxs' then click Connect, it navigates to facebook.com and puts in your information that you defined in the textbox and logs you in. Any ideas guys?

    Read the article

  • Is a many-to-many relationship with extra fields the right tool for my job?

    - by whichhand
    Previously had a go at asking a more specific version of this question, but had trouble articulating what my question was. On reflection that made me doubt if my chosen solution was correct for the problem, so this time I will explain the problem and ask if a) I am on the right track and b) if there is a way around my current brick wall. I am currently building a web interface to enable an existing database to be interrogated by (a small number of) users. Sticking with the analogy from the docs, I have models that look something like this: class Musician(models.Model): first_name = models.CharField(max_length=50) last_name = models.CharField(max_length=50) dob = models.DateField() class Album(models.Model): artist = models.ForeignKey(Musician) name = models.CharField(max_length=100) class Instrument(models.Model): artist = models.ForeignKey(Musician) name = models.CharField(max_length=100) Where I have one central table (Musician) and several tables of associated data that are related by either ForeignKey or OneToOneFields. Users interact with the database by creating filtering criteria to select a subset of Musicians based on data the data on the main or related tables. Likewise, the users can then select what piece of data is used to rank results that are presented to them. The results are then viewed initially as a 2 dimensional table with a single row per Musician with selected data fields (or aggregates) in each column. To give you some idea of scale, the database has ~5,000 Musicians with around 20 fields of related data. Up to here is fine and I have a working implementation. However, it is important that I have the ability for a given user to upload there own annotation data sets (more than one) and then filter and order on these in the same way they can with the existing data. The way I had tried to do this was to add the models: class UserDataSets(models.Model): user = models.ForeignKey(User) name = models.CharField(max_length=100) description = models.CharField(max_length=64) results = models.ManyToManyField(Musician, through='UserData') class UserData(models.Model): artist = models.ForeignKey(Musician) dataset = models.ForeignKey(UserDataSets) score = models.IntegerField() class Meta: unique_together = (("artist", "dataset"),) I have a simple upload mechanism enabling users to upload a data set file that consists of 1 to 1 relationship between a Musician and their "score". Within a given user dataset each artist will be unique, but different datasets are independent from each other and will often contain entries for the same musician. This worked fine for displaying the data, starting from a given artist I can do something like this: artist = Musician.objects.get(pk=1) dataset = UserDataSets.objects.get(pk=5) print artist.userdata_set.get(dataset=dataset.pk) However, this approach fell over when I came to implement the filtering and ordering of query set of musicians based on the data contained in a single user data set. For example, I could easily order the query set based on all of the data in the UserData table like this: artists = Musician.objects.all().order_by(userdata__score) But that does not help me order by the results of a given single user dataset. Likewise I need to be able to filter the query set based on the "scores" from different user data sets (eg find all musicians with a score 5 in dataset1 and < 2 in dataset2). Is there a way of doing this, or am I going about the whole thing wrong?

    Read the article

  • Winform Textbox CanGrow ?

    - by bochur1
    I don't find a CanGrow property on the Textbox control. This is common in some other controls, and what it does is expand the control to acomodate more data. Anyway to get this feature in the TextBox?

    Read the article

  • Watin - Watin.Core.Exceptions.ElementNotFoundException

    - by potterosa
    I have code that runs that gives me the error : Could not find a 'INPUT (text password textarea hidden) or TEXTAREA' tag containing attribute name with value ________ (It's testing a website) It says it can't find a What reason could it be that it can't find it? It finds others without an issue on other pages, but this page for some odd reason it baulks? How can that be?

    Read the article

  • How to setup ASP.NET Ajax Library and WCF Data Services

    - by Jronny
    I was following http://msdn.microsoft.com/en-us/magazine/ee336022.aspx but there were js errors. for example Sys is undefined So I added http://ajax.microsoft.com/ajax/act/40412/start.js. Then Sys.Data is undefined So I added http://ajax.microsoft.com/ajax/act/40412/MicrosoftAjaxDataContext.debug.js. But then TypeError: Sys.Data.OpenDataContext is not a constructor What shall I do to be able to call the service the way they do it on the first link? What are the scripts and resources needed? Thanks a lot.

    Read the article

  • CommandManager "cannot resolve symbol"

    - by Budda
    After adding "RelayCommand" class (that uses CommandManager class) into my Silverlight App I've got an error: The name 'CommandManager' does not exist in the current context This class is a member of System.Windows.Input namespace that is in PresentationCore.dll assembly. The problem is that I can't add this dll into my app... I am having a strange assumption: this class (CommmandManager) can't be used in the Silverlight. Am I right? How can I implement MVVM-pattern (http://msdn.microsoft.com/en-us/magazine/dd419663.aspx)? Thanks.

    Read the article

< Previous Page | 4 5 6 7 8 9 10 11 12 13 14 15  | Next Page >