Daily Archives

Articles indexed Friday March 12 2010

Page 20/130 | < Previous Page | 16 17 18 19 20 21 22 23 24 25 26 27  | Next Page >

  • How to force an HTML JLabel in a JTree to resize when the font changes

    - by Mike
    I'm updating a Java Swing application to support the user switching the app's font from normal size to a larger size (so the user can switch between the two sizes at runtime). One problem I'm having is with a JTree that uses HTML for the tree nodes to underline the text in some nodes (the HTML is just embedded in the JLabel of each tree node). One extra thing to know about the nodes is that they're a custom component, adding a JCheckBox in front of each JLabel. The problem is that once the JTree is visible, increasing the font size causes the nodes (containing underlined text) to not resize. The HTML for those nodes seems to prevent the node from becoming wider, so when the font changes, the text becomes truncated. I think my options are to either: 1) use another approach to make the text underlined, since removing the HTML from the JLabel causes it to resize properly when the font size changes, or 2) keep the HTML formatting and somehow force the JTree/JLabels to resize when the font size is updated (possibly by firing a property change event?). The code already calls SwingUtilities.updateComponentTreeUI() on the parent JFrame when the font size gets updated. Any help would be greatly appreciated. Thanks in advance! -Mike

    Read the article

  • submitting data via email to websystem

    - by tnriverfish
    I'm working on a task system and I'd like to be able to submit a task to the system by emailing it to a particular address. I'm thinking I could set my user by the sender, the task subject by the subject and the task comments by the text of the email. Not sure the version of Exchange we have available if that matters but I'm running .net 3.5 and using C#. Any direction would be appreciated. Thanks, Charlie

    Read the article

  • java simple JPanel management (see screenshot)

    - by Allen
    I have a JPanel that encapsulates two JPanels, one on top of the other. The first holds two JLabels which hold the playing cards. The second holds the player's text (name and score). However, when I remove the player's cards, the lower JPanel moves up to the top, which i would prefer that it not do. Is there a way to keep it in place regardless of whether the top JPanel is occupied or not? Thanks

    Read the article

  • How can I scale an image in a CSS sprite

    - by michael
    Hi, In this article, http://css-tricks.com/css-sprites/, it talks about how can I crop off a smaller image from 1 bigger image. Can you please tell me if it is possible/how I can crop off a smaller image and then scale the cropped off region before I lay it out? Here is an example from that article: A { background-image: url(http://www.jaredhirsch.com/coolrunnings/public_images/3deb155981/spriteme1.png); background-position: -10px -56px; } I would like to know how can I scale that image after I crop it from from spriteme1.png Here is the URL of the example: http://css-tricks.com/examples/CSS-Sprites/Example1After/ So I would like to know if I can make the icons next to Item1,2,3,4 smaller?

    Read the article

  • How do I format the contents of a DataGrid cell as a Date? as Currency?

    - by Ben McCormack
    I have a Silverlight DataGrid that's being populated with different types of data for each column. I'm trying to figure out how to format some of the contents of the DataGrid's cells, specifically for dates and formatting. I have a date column that's currently displaying like: 3/11/2010 12:00:00 AM. I would rather it display like 3/14/2010. I have a number column that's currently displaying like: 51.32. I'd rather it display as currency like $51.32. I'm not sure how I can go about doing this. I'd prefer to do it in XAML instead of C#, but both solutions are fine. For reference, here's my XAML so far: </data:DataGridTextColumn> <data:DataGridTextColumn Header="Payee" Binding="{Binding Payee}"/> <data:DataGridTextColumn Header="Category" Binding="{Binding Category}"/> <data:DataGridTextColumn Header="Memo" Binding="{Binding Memo}"/> <data:DataGridTextColumn Header="Inflow" Binding="{Binding Inflow}"/> <data:DataGridTextColumn Header="Outflow" Binding="{Binding Outflow}"/> </data:DataGrid.Columns>

    Read the article

  • Asp.net mvc getting partial view inside another view folder

    - by Shawn Mclean
    I have inside a controller PostLogicController.cs public ActionResult GetCreateNormalPost() { return PartialView("CreateNormalPost", null); } CreateNormalPost is inside the folder Post (which belongs to another post controller). How do I go about returning the CreateNormalPost.ascx? My folders are structured as follows: Controllers PostController.cs PostLogicController.cs Views Post Index.aspx CreateNormalPost.ascx There is no folder for PostLogicController.

    Read the article

  • ASP.NET MVC 2 RTM Released !

    - by shiju
    ASP.NET MVC 2 Framework has reached RTM version. You can download the ASP.NET MVC 2 RTM from here. There is not any new breaking changes were introduced by the ASP.NET MVC 2 RTM release.

    Read the article

  • Easy File Locker Locked My Desktop

    - by user20358
    I'm happy with easy file locker, it does as promised. Last night I decided to lock all my files. C:users/Barry Some how my desktop is locked. When I closed EFL my desktop went black. Safe mode is still black. Help Below are my spec's eMachines ET1161-03 CPU: Athlon 64 X2 4400+; CPU speed: 2300GHz; Graphics adapter: nVidia GeForce 6150SE; Monitor: No; Hard drive size: 320GB; WorldBench rating: Fair

    Read the article

  • Disadvantages of scanf

    - by karthi-27
    Hi all, I want to know the disadvantage of the scanf.In many of a sites I have read that using scanf will cause buffer overflow some times.What is the reason for that , and is there any other drawbacks with scanf .

    Read the article

  • How can I include an external JavaScript file exactly once per partial view?

    - by AaronSieb
    I have a partial view (UserControl) that implements a simple pager in my Asp.Net MVC project. This pager needs access to a .js file that needs to be included exactly once, regardless of how many instances of the pager control are present on the parent page. I've tried to use Page.ClientScript.RegisterClientScriptInclude, but it had no effect (I assume because the code nugget was evaluated too late to impact the head control). Is there any simple alternative?

    Read the article

  • how to add and remove jquery tabs dynamically?

    - by kranthi
    hi, I have an aspx page on which I have 2 static jquery tabs.Upon clicking on a button avaiable on one of these tabs,I would like to add a new tab dynamically,which gets its content loaded from another aspx page.I've also tried with the following sample http://jquery-ui.googlecode.com/svn/trunk/demos/tabs/manipulation.html I've downloaded jquery-ui-1.8rc3.custom zip file and tried to add the above page with the relevant script,css files to my asp.net website and run,but it does not seem to work.Also I do not want to have a dialog opening and asking the user to enter the tab title as in the above sample. Please could someone help me with this? Thanks.

    Read the article

  • Rich Text Editor in javascript

    - by chanthou
    iframe .text-bold{ border:1px solid orange; background-color:#ccc; width:16px; height:16px; font-weight:bold; cursor:pointer; } .active{ border-color:#9DAECD #E8F1FF #E8F1FF #9DAECD; background-color:yellow; } function init( ) { iframe = document.createElement("iframe"); document.body.appendChild(iframe); iframe.onload = setIframeEditable; isBold=false; div=document.getElementById("bold"); } var setIframeEditable = function(){ iframe.contentDocument.designMode='on'; iframe.focus(); } function makeBold(){ if(!isBold){ //console.log(iframe.contentDocument.execCommand("bold", false, null)); iframe.contentDocument.execCommand("bold", false, null); div.className += " active"; isBold=true; iframe.focus(); }else{ //console.log(iframe.contentDocument.execCommand("bold", true, null)); iframe.contentDocument.execCommand("bold", false, null); div.className ="text-bold"; isBold=false iframe.focus(); } } </script> </head> <body onload="init()"> <div id="bold" class="text-bold" onclick="makeBold()">B</div> </body>

    Read the article

  • TransactionRequiredException on OptimisticLockException

    - by João Madureira Pires
    Hi there. I have the following class that generates sequencial Card Numbers. I'm trying to recover from OptimisticLockException, by calling recursively the same method. however, i'm getting TransactionRequiredException. Dows anyone knows how to recover from OptimisticLockException in my case? Thanks a lot in advance @Name("simpleAutoIncrementGenerator") public class SimpleAutoIncrementGenerator extends CardNumberGenerator{ private static final long serialVersionUID = 2869548248468809665L; private int numberOfRetries = 0; @Override public String generateNextNumber(CardInstance cardInstance, EntityManager entityManager) { try{ EntityCard card = (EntityCard)entityManager.find(EntityCard.class, cardInstance.getId()); if(card != null){ String nextNumber = ""; String currentNumber = card.getCurrentCardNumber(); if(currentNumber != null && !currentNumber.isEmpty()){ Long numberToInc = Long.parseLong(currentNumber); numberToInc ++; nextNumber = String.valueOf(numberToInc); card.setCurrentCardNumber(nextNumber); // this is just to cause a OptimisticLock Exception try { Thread.sleep(4000); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } entityManager.persist(card); entityManager.flush(); return nextNumber; } } }catch (OptimisticLockException oLE) { System.out.println("\n\n\n\n OptimisticLockException \n\n\n\n"); if(numberOfRetries < CentralizedConfig.CARD_NUMBER_GENERATOR_MAX_TRIES){ numberOfRetries ++; return generateNextNumber(cardInstance,entityManager); } }catch (TransactionRequiredException trE) { System.out.println("\n\n\n\n TransactionRequiredException \n\n\n\n"); if(numberOfRetries < CentralizedConfig.CARD_NUMBER_GENERATOR_MAX_TRIES){ numberOfRetries ++; return generateNextNumber(cardInstance,entityManager); } }catch (StaleObjectStateException e) { System.out.println("\n\n\n\n StaleObjectStateException \n\n\n\n"); if(numberOfRetries < CentralizedConfig.CARD_NUMBER_GENERATOR_MAX_TRIES){ numberOfRetries ++; return generateNextNumber(cardInstance,entityManager); } } return null; } }

    Read the article

  • Post login execution

    - by Javi
    Hello, I need to do some processing only after the user has successfully logged in the system. I have thought that I can do a RESTful method and setting it as the default-target-url so when the login is successful it goes to this url and then I can redirect to the real index of my web application. <form-login login-page='/login.htm' default-target-url='/home.htm' always-use-default-target='true' /> The problem is that this processing can be executed by calling its URL so it could be executed by any user at any time. I want to make sure it is only executed after login. Is there any way to do this? Thank you very much.

    Read the article

  • Creating new Entities from Stored Procedure

    - by SK
    I have a stored procedure that retrieves existing rows from a table and also creates includes new rows that match the table definition and mapped entity (.net 3.5 entity framework). These new rows are not written to the database in the stored procedure. The stored procedure executes, but the new rows that were created will not load the navigation properties sucessfully i.e. the rows that do not actually exist in the database. e.g. database rows: key, data, FK 1, xxx, a 2, xxx, b returned rows from stored procedure: key, data, FK 1, xxx, a 2, xxx, b 3, yyy, a 4, yyy, b The entity will load FK entities a and b for rows 1 and 2, but for rows 3 and 4 the FK entity is null. Do I somehow need to add the new rows to the data context? or turn off tracking?

    Read the article

  • objective-c 2.0 properties and 'retain'

    - by Adam
    Stupid question, but why do we need to use 'retain' when declaring a property? Doesn't it get retained anyway when it's assigned something? Looking at this example, it seems that an object is automatically retained when alloc'ed, so what's the point? #import "Fraction.h" #import <stdio.h> int main( int argc, const char *argv[] ) { Fraction *frac1 = [[Fraction alloc] init]; Fraction *frac2 = [[Fraction alloc] init]; // print current counts printf( "Fraction 1 retain count: %i\n", [frac1 retainCount] ); printf( "Fraction 2 retain count: %i\n", [frac2 retainCount] ); // increment them [frac1 retain]; // 2 [frac1 retain]; // 3 [frac2 retain]; // 2 // print current counts printf( "Fraction 1 retain count: %i\n", [frac1 retainCount] ); printf( "Fraction 2 retain count: %i\n", [frac2 retainCount] ); // decrement [frac1 release]; // 2 [frac2 release]; // 1 // print current counts printf( "Fraction 1 retain count: %i\n", [frac1 retainCount] ); printf( "Fraction 2 retain count: %i\n", [frac2 retainCount] ); // release them until they dealloc themselves [frac1 release]; // 1 [frac1 release]; // 0 [frac2 release]; // 0 ¦output Fraction 1 retain count: 1 Fraction 2 retain count: 1 Fraction 1 retain count: 3 Fraction 2 retain count: 2 Fraction 1 retain count: 2 Fraction 2 retain count: 1 Deallocing fraction Deallocing fraction This is driving me crazy!

    Read the article

  • C#: Downloading video from YouTube

    - by Maxim Z.
    Hi! I wish to download a video from YouTube and then extract its audio. Can anyone point me to some C# code to download a video? Thanks! UPDATE: For clarification purposes, I already know how to extract audio from a .FLV file like these. Thanks!

    Read the article

  • WebDav rename fails on an Apache mod_dav install behind NginX

    - by The Daemons Advocate
    I'm trying to solve a problem with renaming files over WebDav. Our stack consists of a single machine, serving content through Nginx, Varnish and Apache. When you try to rename a file, the operation fails with the stack that we're currently using. To connect to WebDav, a client program must: Connect over https://host:443 to NginX NginX unwraps and forwards the request to a Varnish server on http://localhost:81 Varnish forwards the request to Apache on http://localhost:82, which offers a session via mod_dav Here's an example of a failed rename: $ cadaver https://webdav.domain/ Authentication required for Webdav on server `webdav.domain': Username: user Password: dav:/> cd sandbox dav:/sandbox/> mkdir test Creating `test': succeeded. dav:/sandbox/> ls Listing collection `/sandbox/': succeeded. Coll: test 0 Mar 12 16:00 dav:/sandbox/> move test newtest Moving `/sandbox/test' to `/sandbox/newtest': redirect to http://webdav.domain/sandbox/test/ dav:/sandbox/> ls Listing collection `/sandbox/': succeeded. Coll: test 0 Mar 12 16:00 For more feedback, the WebDrive windows client logged an error 502 (Bad Gateway) and 303 (?) on the rename operation. The extended logs gave this information: Destination URI refers to different scheme or port (https://hostname:443) (want: http://hostname:82). Some other Restrictions: Investigations into NginX's Webdav modules show that it doesn't really fit our needs, and forwarding webdav traffic to Apache isn't an option because we don't want to enable Apache SSL. Are there any ways to trick mod_dav to forward to another host? I'm open to ideas :).

    Read the article

< Previous Page | 16 17 18 19 20 21 22 23 24 25 26 27  | Next Page >