Is there any better way to refresh?
Hello
I would like to know if anyone here has a better solution for refreshing components like JPanels. I'm developing an application which uses slow algorithms to draw the points on them. It would be absurd to call these methods again to simply refresh these components (ex: when the user minimizes or resizes the component), just as absurd as it would be to put the slow algorithm code in the paint(Graphics g) method.
The solution I'm using now is to save the coordinates and attributes of the points the program needs to draw in an array or some other data structure, so that the program can easily call a refresh method (which draws the points from the information store in these arrays).
But, since I'm using many (slow) algorithms, and since each plot has it's own particularities, I end up creating big refresh methods, even creating classes specifically to refresh components!
I was wondering if it would be possible to simply copy the image of a component in a given time, so that I could just repaint it on the component whenever it's necessary (i.e, when the component listeners called it). Is it possible?
I think want you're wanting to do is just a simple double-buffering?
So, the first time your component is asked to paint itself (you should override paintComponent() rather than paint(), by the way), do this: private BufferedImage image = null;
public void paintComponent(Graphics g) {
if (image == null)
image = new BufferedImage(getWidth(), getHeight(), BufferedImage.TYPE_INT_RGB);
Graphics imageG = image.createGraphics();
// TODO: paint your component onto 'imageG'
g.drawImage(imageG, 0, 0, null);
}You may also want to reset 'image' to null if the component changes sizes.
Similar Messages
-
Is there any better way for updating table other than this?
Hi all, I need to update a row in the table that require me to search for it first (the table will have more than hundred thousands of row). Now, I am using a LOV that will return the primary key of the row and put that primary key to DEFAULT_WHERE property in the block and execute query command to fetch the row that need updating. This works fine except that it require 2-query-trip per update (the lov and the execute_query). Is there any better way to doing this? This update is the main objective for my application and I need to use the most effective way to do it since we need to update many records per hour.
Thanks Rama, I will try your method. Others, how to query row instead of primary key? I thought that querying primary key is faster due to the index?
BTW, what people do if you need to update a table using Form? I have been using the LOV then execute query since I first developing form. But I am building a bigger database recently that I start worrying about multiple query trip to dbms.
FYI my table will have up to million rows on it. Each row will be very active (updated) within 1-2 weeks after it creation. After that it will exist for records purposes only (select only). The active rows are probably less than 1% of all the rows. -
How to find out whether my Iphone 3Gs (OS version 3.1.3) is officlially unlocked ( factory unlocked ) or "made" unlocked ? Can I upgrade its current OS 3.1.3 to OS 5 even if my phone is not officlially unlocked ? how to up grade its OS ? what are there any better ways to do it ?
Thanks,
PRANAJDepends wher you obtained the iPhone from and it's original supplier
If the iPhone is an authorised unlock ( approved by the carrier) or was
purchased from Apple as an unlocked iPhone updating the iOS
will have no effect on the iPhone and it's lock status
HOWEVER if the software has been tampered with to remove the lock,
updating the iOs will lock the iPhone back to the original carrier who holds the lock
To find out the status of your iPhone you could call Apple support
and they may tell you if the iPhone is locked or not and if it is which carrier -
Is there any better way to test an agent?
Every time when I changes some code in the agent, I have to restart the domain to load the new class file. I tried the reload the agent from the Oracle Enterprise Manager, but it is not working. The old agent is still going on. It gives me many troubles since I can't start the SMB server from Window 2000 terminal console. I have to go to the computer room to start SMB natively. Is there any better way to test an agent or start the SMB server in the Window 2000 terminal console?
Your help will be greatly appreciated!Jailcorder requires a jail broken iDevice to work. While it is not illegal to jail brake your iPhone in the US it is illegal to jail break an iPad.
If you do that you will not be able to use these board for help as the discussion of anything relating to a jail broken iDevice is against the TOU and the hosts will remove your posts
In addition looking tha Jailcorder it seems it has not kept up with Apple. It doesn;t work Xcode 5 and IOS 7.
On final thing to keep in mind a jail broken device behaves differently then one that is non jail broken. So even of you test with Jailcode you will still need to go through testing with a non jail broken device before submitting.
All in all if you are serious about developing for IOS it would seem the better course is to get the Developer account now.
regards -
Is there any better way of optimizing memory?
Hi Friends!
I am new to Labview and need some help. In a VI sescibed below I would like to know about optimizing the memory.
Problem: Needs to take the values of 7 physical quantities for three different time intervals. Each physical quantity has individual elements(which are clusters) whose number actually depends on the user input ( can be of any number).
What I have done: I had first constructed an
1. Array(Let it be array1 for discussion) of three elements(For three time intervals) each element is a cluster(Let be Level 1 Cluster)
2.Cluster(Level1) has 7 arrays(Let them be Level 2 arrays) to represent 7 physical quantities
From the concepts of arrays in the C each element of the array occupies same memory space. But does this concept applicable here. As I have elements in a cluster(level1) as arrays(Level 2). Each one of the array(Level2) could be of different size depending on user input.
If there is another way to handle them please help me with ur valuable suggestion.
Siddhu.I don't quite understand why optimizing memory here is required as the
data set does not seem very large. That being said, clusters use
(relatively) a lot of memory, and nested arrays/clusters are generally
considered poor programming. It seems to me that this can be
handled with a 3D array (much more memory efficient): 3 pages for
the time intervals, 7 rows for the physical quantities and an
indeterminite number of columns for the individual elements. How
to handle the array depends on what are valid values for the individual
elements. If the data type is numeric and 0 is not a valid user
input value, then it's easy. Just build the array row by
row. Each row will have the number of columns equal to the
largest number of individual elements entered. Data that has not
been entered by the user will be 0. For example, at time interval
1:
PQ1: 9 2 7 4 1 8
PQ2: 8 7 2
PQ3: 1
PQ4: 4 6 8 2
PQ5: 2 3 4 5 6 7 8
PQ6: 4 2 7 9
PQ7: 2 4
The first page of the array would be:
9 2 7 4 1 8 0
8 7 2 0 0 0 0
1 0 0 0 0 0 0
4 6 8 2 0 0 0
2 3 4 5 6 7 8
4 2 7 9 0 0 0
2 4 0 0 0 0 0
If the data type is not numeric or 0 is a valid value, I would
initialize a 3D array that is 3 X 7 X (something larger than the max #
of individual elements) with some sort of invalid value. Then,
as the user inputs individual elements, replace the appropriate
array element. This also has the advantage of creating the array
ahead of time so LabVIEW will not have to create any memory buffers.
Hope this helps.
Dave.
==============================================
David Kaufman
LabVIEW Certified Developer
============================================== -
i have lost iphone 5 and iphone 5s within 4 month, its real sad coz there is no way i can track them, have been using icloud (find my iphone) for all these time but it doesn't show nothing helpful rather than my iphones are offline. i need help on this please.....
Find my...is the only way to track a device.
Barry -
Is there any better way to publish a "read-only" panel on the web
Hi
I am new user in Labview. I am trying to publish some of our test result on the web. However. the current methods all have their disadvantages in my application
.monitor: I like this, but it is only supported by Netscape, which is not do popular anymore. I dont want push our customer to install it just for our demonstration.
.snap+refresh: Our application requires fairly fast refresh, 1 fresh/sec. the blank in during the refresh does not look nice.
Embed: I want to demonstration to be read-only, I dont want the custome gain any control over that. Also scroll bar shows in the embed mode is also something I dont want.
I am using LabView 6.1, if the problem has been solve in new version, I am glad to upgrade. Also is there is other better to meet my requirement, please help me.
Thanks
Message Edited by zach DDS on 10-05-2005 12:23 PMSorry, you must have edited your message. When I saw it, only the title showed .
Embedded is what you want. You can change the windows apperance (e.g. hide the scroll bars) by changing the VI properties.
Uncheck "request control" in the web publishing wizard, and it will be read only.
Works fine here in LabVIEW 7.1. I don't remember if 6.1 had any limitations.
LabVIEW Champion . Do more with less code and in less time . -
Is there any better way of writing this query??
I have a query on insert which looks like this,
INSERT INTO TEMP( I1,I2)
SELECT TI1 FROM CLIENT1
WHERE R_CD ='PR' OR 'SR',
SELECT TI2 FROM CLIENT2
WHERE R_CD = 'MN' OR 'OP
There are two tables where the source data is coming from and inserted into TEMP table. I find this query to be inefficient. Anybody who can help me writing a good one?? Thanks.<BLOCKQUOTE><font size="1" face="Verdana, Arial, Helvetica">quote:</font><HR>Originally posted by [email protected]:
I have a query on insert which looks like this,
INSERT INTO TEMP( I1,I2)
SELECT TI1 FROM CLIENT1
WHERE R_CD ='PR' OR 'SR',
SELECT TI2 FROM CLIENT2
WHERE R_CD = 'MN' OR 'OP
There are two tables where the source data is coming from and inserted into TEMP table. I find this query to be inefficient. Anybody who can help me writing a good one?? Thanks.<HR></BLOCKQUOTE>
A possible solution,
INSERT INTO TEMP( I1,I2)
SELECT C1.TI1, C2.TI2
FROM CLIENT1 C1, CLIENT2 C2
WHERE (C1.R_CD = 'PR' OR C1.R_CD ='SR') AND
(C2.R_CD = 'MN' OR C2.R_CD = 'OP')
null -
Hey everyone, I'm creating a Flex/ColdFusion app. and I've
been working with CFCs and RemoteObjects. I know that when you want
to refresh data you have to call the CFC with the RemoteObject
every time (after the creationComplete is called I use addedToStage
and removedFromStage to re-call the CFC). Is there a better way to
refresh my data or "re-initialize" the component?
Also, does anyone know the proper way to log someone out
using ColdFusion and Flex? I pass the cflogout method in my CFC and
in Flex I return the user to the login page and "reset" my objects
I use to store user data, but after logging in as a different user
the previous user's info is still present. So I've resorted to
reloading the URL to clear the application of all data. Any tips?
Thanks,
PJI don't really get what you mean with "re-initialize the
component"?
Here you can learn about login and logout in ColdFusion.
http://www.brucephillips.name/blog/index.cfm/2006/11/27/Login-and-Logout-Flex-Example-That -Uses-ColdFusion-CFLogin-and-CFC-Role-Security -
Is there a better way to add int arrays together?
I'm working on a project that will add arrays of integer together...all element are nonnegative integers
For example
A = [0 1 2 3]
I need to find an algorithm to find 2A= A + A, 3A = A+A+A....., hA = A +...A ( h times)
For 2A, the result array will look like this
2A = [ 0 1 2 3 1 2 3 4 2 3 4 5 3 4 5 6]
Then using Array.sort(2A) i will have 2A= [ 0 1 1 2 2 2 3 3 3 3 4 4 4 5 5 6].
Lastly I will write another code to get rid of repetitions to get the desired array 2A = [ 0 1 2 3 4 5 6]
public static int[] hA(int[] a, int h){
// mon = null;
//mon = MonitorFactory.start("myFirstMonitor");
if (h==1) return a;
if (h==2){
int[] b = new int[(a.length)*(a.length)];
int count = 0;
int maxa = a.length,maxb=b.length;
for (int i = 0 ; i < maxa; i++)
for (int j=0 ; j <maxa; j++)
b[count]=a[i]+a[j];
count++;
return b;
else
return hA(a,h-1);
}I still don't know how to write recursive code to get it to find 3A, 4A....hA....
is there any better way to do this?sorry for not defining it better
2A ={ a + a' | a,a' E A}
that means for A = { 0 1 3} , 2A ={ 0 1 2 3 4 6}
but to get to [ 0 1 2 3 4 6], i don't know of any better way to achieve it.
Also to find 3A = { a+a'+a'' |a,a',a'' E A}
that means for A = { 0 1 3} ,3A={ 0 1 2 3 4 5 6 7 9}
the idea is simple but to put into java code is not...at least for me -
Hi, my domain is at the 2008R2 functional level, and I have a group policy which configures the "offer remote assistance" setting (Computer Configuration>admin templates>System>Remote Assistance). I have noticed some interesting
behavior, and I'd like to know if there's a more efficient way to do this: Whenever this policy gets applied, it seems as if it removes all individuals from the "Offer Remote Assistance" group, then re-adds them. I notice this because
when I update the group policies on the clients, I see security log event 4733 (removing the account from the "offer remote assistance group") for each defined helper, then see security log event 4732 (adding the account to the "offer remote
assistance group") for each helper.
Is there a better way to accomplish this without adding and removing the accounts from the "offer remote assistance" group every time the policy is refreshed?
I ask because I'm using a SIEM for logging privileged account usage or membership changes, and the hundreds of events per day are a bit noisy.
As always, any recommendations are greatly appreciated!
Thanks,
Kevin> the "apply without changes" setting that Martin mentioned?
Check http://gpsearch.azurewebsites.net/#329 - enable this and do not
set "apply without changes". But be aware that regardless of what you
configure, security policies WILL apply every 16 hours or so in the
background. That's a hard coded value and behavior, and this applies
only to security settings.
Martin
Mal ein
GUTES Buch über GPOs lesen?
NO THEY ARE NOT EVIL, if you know what you are doing:
Good or bad GPOs?
And if IT bothers me - coke bottle design refreshment :)) -
Is There a Better Way to Work in the Marker List Window?
Is there a better way to sequentially listen to phrases one-by-one in the Marker List window? What I'm doing is Auto-Marking one single long file to break out 271 bits and save each as their own file. It's WAY faster than copying and pasting bits into new files and "saving as" 217 times.
BUT, after Auto-Marking, I have 300-400 phrases to listen to, deleting the non-keepers as I go, until I'm left with my "keeper" 271 marked phrases. But it's so tedious to move from phrase-to-phase. I have to double-click each one before I can hear it (you can move the cursor with the down-arrow, but it won't actually select the audio). So I have to use the mouse (unless I'm missing something) and double-click each of the hundreds of phrases. Then whenever I delete one (which I'll have to do about a hundred times or more to get rid of bad takes, alternates, etc.), inexplicably the cursor jumps way up the list so you have to scroll back down dozens of files to get to where you were. It took me 35 minutes to do it this last time.
Contrast that with Reaper's audition/preview functionality (which, ironically, AA has also, but only for files already saved into a folder). Once I had all the files saved into a folder, I QC'd all 217 files in Reaper and MAN what a difference! All I had to do was use the "down" arrow to advance to the next file AND have it play automatically (Audition can do the same thing with the "Open File" feature). It literally took me 5 minutes to check all 217 files that way. If AA could add that kind of functionality to the Marker List window, or if I'm just completely missing something (very possible) I would REALLY be happy.
Any ideas?
Thanks again! Happy New Years again!
KenWild Duck,
That doesn't quite do what I need. My end-product is 271 (used to be 116) separate files created from one large file. That large one is made up of WAY more than 271 (the VO actor records different versions of some commands, makes mistakes, etc.).
So I need the ability to listen to each marker, and then be able to delete it if need be.
The Playlist makes this impossible in two ways. It only has 2 options for hearing each marker, and neither option allows me to delete that marker after I've heard it. It either plays them all back-to-back without stopping, or it plays each as you click the "Move Down" button. That last one would be great if showed me which marker was playing! But it doesn't, so there is no way for me to know which marker number I just heard, nor can I delete that marker after I hear it.
Sigh.
Thanks for the tip though:).
Ken -
hi, i had to re install my itunes library from a hard drive to my new laptop. Now itunes thinks i am trying to add new albums and saying there isnt enoug space. should i restore or is there a better way.
Have you tried exporting a 10 second section of the footage to see if the issue shows up once the seqeunce is actually exported from the timeline. I edit on CS5 with windows 7 pro at work quite often and have no issues so I assure you that isn't the issue. I also edit with AVCHD footage when at home and work quite freqeuntly as well so I'm positive that isn't the issue. It sounds like a GPU driver has been corrupted in the way it interacts with premiere pro. What type of GPU do you have? If it supports MPE's GPU acceleration have you tried turning it off and seeing if that makes any difference?
Anyways though try to export a 10 second test section of your timeline to see if when the clip is exported from premiere it will play normally in windows media player or vlc or w/e media player you want to use. If it exports fine then you can almost be positive it's a corrupted video card driver. If that's the case I'd re-install your GPU's driver and also check your gpu makers website to see if they have a updated driver avaiable. -
How to create a function with dynamic sql or any better way to achieve this?
Hello,
I have created below SQL query which works fine however when scalar function created ,it
throws an error "Only functions and extended stored procedures can be executed from within a
function.". In below code First cursor reads all client database names and second cursor
reads client locations.
DECLARE @clientLocation nvarchar(100),@locationClientPath nvarchar(Max);
DECLARE @ItemID int;
SET @locationClientPath = char(0);
SET @ItemID = 67480;
--building dynamic sql to replace database name at runtime
DECLARE @strSQL nvarchar(Max);
DECLARE @DatabaseName nvarchar(100);
DECLARE @localClientPath nvarchar(MAX) ;
Declare databaselist_cursor Cursor for select [DBName] from [DataBase].[dbo].
[tblOrganization]
OPEN databaselist_cursor
FETCH NEXT FROM databaselist_cursor INTO @DatabaseName
WHILE @@FETCH_STATUS = 0
BEGIN
PRINT 'Processing DATABASE: ' + @DatabaseName;
SET @strSQL = 'DECLARE organizationlist_cursor CURSOR
FOR SELECT '+ @DatabaseName +'.[dbo].[usGetLocationPathByRID]
([LocationRID])
FROM '+ @DatabaseName +'.[dbo].[tblItemLocationDetailOrg] where
ItemId = '+ cast(@ItemID as nvarchar(20)) ;
EXEC sp_executesql @strSQL;
-- Open the cursor
OPEN organizationlist_cursor
SET @localClientPath = '';
-- go through each Location path and return the
FETCH NEXT FROM organizationlist_cursor into @clientLocation
WHILE @@FETCH_STATUS = 0
BEGIN
SELECT @localClientPath = @clientLocation;
SELECT @locationClientPath =
@locationClientPath + @clientLocation + ','
FETCH NEXT FROM organizationlist_cursor INTO
@clientLocation
END
PRINT 'current databse client location'+ @localClientPath;
-- Close the Cursor
CLOSE organizationlist_cursor;
DEALLOCATE organizationlist_cursor;
FETCH NEXT FROM databaselist_cursor INTO @DatabaseName
END
CLOSE databaselist_cursor;
DEALLOCATE databaselist_cursor;
-- Trim the last comma from the string
SELECT @locationClientPath = SUBSTRING(@locationClientPath,1,LEN(@locationClientPath)- 1);
PRINT @locationClientPath;
I would like to create above query in function so that return value would be used in
another query select statement and I am using SQL 2005.
I would like to know if there is a way to make this work as a function or any better way
to achieve this?
Thanks,This very simple: We cannot use dynamic SQL from used-defined functions written in T-SQL. This is because you are not permitted do anything in a UDF that could change the database state (as the UDF may be invoked as part of a query). Since you can
do anything from dynamic SQL, including updates, it is obvious why dynamic SQL is not permitted as per the microsoft..
In SQL 2005 and later, we could implement your function as a CLR function. Recall that all data access from the CLR is dynamic SQL. (here you are safe-guarded, so that if you perform an update operation from your function, you will get caught.) A word of warning
though: data access from scalar UDFs can often give performance problems and its not recommended too..
Raju Rasagounder Sr MSSQL DBA
Hi Raju,
Can you help me writing CLR for my above function? I am newbie to SQL CLR programming.
Thanks in advance!
Satya
-
Is there a better way to position a flash movie than ap div?
I'm creating a new website(not yet active) and have a great flash movie for the home page. I've place it in an ap div and of course it moves to a different position in different browsers. Is there any way I can get it to display correctly, or is there a better way to position the movie? Thanks.
Of course. The following code is for the home page:
"http://www.w3.org/TR/html4/loose.dtd">
#page-background
#container
/* this image stays in internal style sheet*/
#mainImage{
background-image: url(images/mainImageBkgrnd.jpg);
background-position: center top;
background-repeat: repeat-y;
width: 875px;
height: 625px;
margin: 0 auto;
padding-left: 0px;
padding-right: 0px;
margin-top: 0px;
position: relative;
#footer{
position: absolute;
top: 700px;
left: 10px;
#serviceImage{
position: absolute;
top:300px;
left: 35px;
z-index: 0;
#orderImage{
position: absolute;
top: 300px;
right: 20px;
#flashMovie {
background-image: url(images/flashPix.png);
background-position: center top;
background-repeat: no-repeat;
width: 700px;
height: 300px;
margin: 0 auto;
.flashText p{
width: 250px;
padding-top: 75px;
font-family: "Arial Narrow";
font-size: 180%;
line-height: 1.5em;
color: #666;
#vertStripe {
position: absolute;
top: 325px;
left:435px;
#serviceHeader {
position: absolute;
z-index : 50;
#apDiv1 {
position:absolute;
left:607px;
top:169px;
width:700px;
height:298px;
z-index:2;
html {overflow-y:hidden;}
body {overflow-y:auto;}
#page-background
#content
</style>
<![endif]-->
<!IE7 and lower stylesheet>
<!>If this page is not displaying correctly, please update your browser by downloading Internet Explorer 8.<link rel="stylesheet" type="text/css" href="ie7-and-down <link rel="stylesheet" type="text/css" href="ie7-and-down.css" /> <![endif]>
body
font-size: 70%;
text-align: center;
<!begin flash Movie>
<!>>
<!<![endif]>
Content on this page requires a newer version of Adobe Flash Player.
!http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif|height=33|alt=Ge t Adobe Flash player|width=112|src=http://www.adobe.com/images/shared/download_buttons/get_flash_player .gif!</p>
</div>
<!>>
</object>
<!<![endif]>
</object>
</div>
<!end flash Movie>
!images/waves2.png|height=100%|alt=Waves|width=100%|src=images/waves2.png!
!images/banner_nws.gif|height=120|alt=Northwind Safety Corp.|width=875|src=images/banner_nws.gif!
<!main Navigation menu>
[About Us | about_us.html]
[Services | serv_fa.html]
[Training | train_cpr.html]
[Products | products.html]
First Aid
[AEDs | aed_philips.html]
<!end main Navigation menu>
!images/serviceComp.png|height=250|alt=Van Serviceman|width=400|src=images/serviceComp.png!<!end serviceHeader>
</div><!end serviceImage>
!images/vertStripe.png|height=150|width=5|src=images/vertStripe.png!
<!end vertical stripe>
!images/orderComp.png|height=250|alt=Order Taker|width=380|src=images/orderComp.png!
<!end orderImage>
</div><!end mainImage>
h1. Contact Us
h1. Careers
h3. Northwind Safety Corporation
8425 Rausch Drive
Plain City, Ohio 43064
phone: 614-873-1000
fax: 614-873-1002
[ [email protected] | mailto:[email protected]]
<!end footer div>
</div><!end container div>
</div><!end body div>
swfobject.registerObject("FlashID");
<!end body>
</html>
Thanks
Maybe you are looking for
-
How do I transfer a gift card balance to family members in family share
Ok well I just realized that the account associated with my Family share will only access my credit card and not my gift card balance. I had two $100 gift cards which I redeemed into my account thinking we could all share the gift card. Little did I
-
RE-CONNECTING email to my pearl (same account, different password)
Hi-- I recently changed passwords on my personal email account also connected to my blackberry. The phone automatically disconnected my email as the password was invalid. I want to re-connect but have been unable. I click the email appliation and scr
-
Some problems with the count function
Hi Guys, I am trying to return following: 2009 GUESTS NIGHTS between 1 and 5 = 80 guests 2009 GIESTS NIGHTS between 5 and 10 = 100 guest Whe I use the combine with a similar report option (union), I issue the following query: SELECT saw_0 saw_0, saw_
-
An oc4j instance keeps restarting itself.
Hi there, We have a issue that an oc4j instance is keeping restarting itself. It will stop, start, and as soon as it's started, it will stop again like an infinite loop. Is there any one experienced this and please share some insight about this probl
-
BUG: When using HTML buttons, message view goes to the end
As suggested by Host Kady, we are now extracting Bugs and Enhancements from our consolidation threads, and re-posting them individually. Reported by Da Gopha: When composing a post, selecting text and pressing one of HTML formatting buttons causes th