Array based level help
Hi, I was hoping someone could explain the concept behind using an array for a level in a 2d game. The only tutorial I could find on the subject was not helpfull. I do not see how to take the array and create a grid where I could place a character or wall into an array location. any help is greatly appreciated. Thx for reading
Although all gfx are essencially primative arrays ([] not [][]), through abstraction Java tries to hide this concept from you. In Java, all images that can be rendered to the screen are subclasses of the Image class.
There are subclasses of Image (java.awt.image.BufferedImage) that allow ou to manipulate the underlying primitive representation, but, for the most part you don't need to do this.
Simply creating a BufferedImage with the desired width and height and an appropriate TYPE_ like this..
BufferedImage bufferedImage = new BufferedImage(width,height,BufferedImage.TYPE_INT_RGB); //(the TYPE_ is how the image data will be stored in the underlying primitive [] - in this case it is integer packed RGB values, with no alpha)when you want to draw the image to a Graphics context, simply use the method in the Graphics class, drawImage(Image,x,y,ImageObserver)
public void paint(Graphics g)
g.drawImage(bufferedImage,x,y,null);//in this case you need not worry about the ImageObserver
rob,
Similar Messages
-
Oracle and volume- and disk array-based replication?
Dear mighty all,
here is a situation:
Location A - active Oracle database + volume replication software + geocluster software
Location B - standby location, i.e. standby database + volume replication software + geocluster
Oracle is 10g
The size of the database is 500 GB+
The daily updates are roughly 2-3%.
The comm channel between locations can have any reasonable bandwidth, however the jitter and latency cannot be guaranteed (i.e. no synchronous replication).
This is a matter of protecting against a disaster (such as a complete destruction of Location A).
The task is to make sure that Location B has the up-to-date data (RPO is 8 hours) and Oracle database can be started automatcially without any manual intervention. (I.e. cluster administrator pushes the button and the rest is done without human intervention).
Here is what I am thinking of:
1) volume replication software usually observes the atomicity on the disk block level. I.e. it is impossible that the data block being updated on the volume in Location A is updated in location B incompletely.
2) When the database in Location A completes a transaction it writes data to the disk thus initiating the series of disk block updates being sent to Location B.
3) From the database point of view, the transaction is completed, database files are updated.
4) However there is a slim chance of Location A being destroyed while:
* the volume replication software has started pushing through to Location B the updated disk blocks representing the completed transaction
* but it did not finish transmitting the whole lot of disk updates (boom! the asteroid fell on Location A)
* and volume replicator in Location B cannot roll back the disk updates since volume replicator does not know of the database transaction
5) Volume replicator atomicity is disk data block while Oracle's atomictity is transaction (i.e. there cannot be a half-transaction applied)
6) Thus, when we start Oracle in Location B, we will get inconsistent database, since the last transaction was transferred to Location B incompletely
7) Sure that there is a way to fix this using various DBA tools, but that defies the whole purpose of automatic start
So, my question is:
1) Is volume- or disk array-based replication not a good idea in this case at all?
2) or is there a way to nonetheless ensure the consistency of the database (say start it every time in the recovery mode)?
3) Or should I dump the idea of replicating Oracle with volume replication and switch to DataGuard? (The cluster software can handle DataGuard).
thanks a million for your answers, ye mighty all!Hi,
this is not a "typical" question what is easy to discuss in a forum.
Just some hints:
1. using volume replication won't help you against logical or physical corruption
2. RPO of 8 hours ? Sounds a lot regarding a change rate of 10-15 GB a day.
3. 100% Automation is normally not a good idea in a database disaster scenario
( a false disaster detection can end in a real disaster!) I've already seen too much databases which had been totally corrupted by a false switch. -
Deleting data from a 2D array based on the id of the second column
Hello
I hope someone can help me. I have come across a hurdle in the programming of my application.
1.
I have a 2D array, the first column of this array contains my data and the second column contains an id, which is either 0 or 1.
I have sorted this 2D array based on the id column so that the data corresponding to the 0’s is on top part of the array and the data corresponding to the 1’s follows it (on the bottom of the array).
I want to delete that data (rows) of this sorted array that correspond to the 1’s and keep only the data (rows) that correspond to the 0’s.
So I would end up with a new 2D array that has only the data that I want on the first column and 0’s on the second column.
I have hundreds of these 2D arrays resulting from my program (using a for loop) hence I want to automate this procedure. The length of the selected data arrays will vary.
2.
Once I can do this I will want to remove the id column (with the 0’s) from the 2D array and would like to build a new array with only the data from the first column (which may be of different length).
So I want to end up with a 2D array with columns corresponding to the selected (1st column) data from the (original) 2D arrays. These data may be of different lengths so when building this new array I may need to do some padding. Will labview do this automatically?
I hope that this is clear.
Best wishes,Attached is a different approach - you don't need to do any sorting.
The outer FOR loop assumes you have all the arrays available at once. If you are reading a file, modify it accordingly.
You may or may not want the TRANSPOSE function on the final results, depending on what you want to do with it.
Yes, when you assemble N-dimensional arrays into (N+1)-dimensional arrays, LabVIEW automatically pads for you.
Enjoy.
Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
Culverson.com
Blog for (mostly LabVIEW) programmers: Tips And Tricks
Attachments:
Extract Marked Data.vi 40 KB -
Filter an array of arrays based on some criteria
Hi Folks:
Is there a way to filter an array of arrays based on some criteria?
Say I have the below set of records in an array of arrays. testArr[][]
ID DTLNUM PARTNUM PARTDESC
AB11 AB11-1 6531079 bath towel
AB11 AB11-2 5122830 bathtub mat
AB11 AB11-3 3649100 shower curtain
AB11 AB11-4 1143784 hamper
AB11 AB11-5 2672324 bath scaleI want to filter the above array and get all records having PARTDESC beginning with the letters "bath" into another array of arrays, resultArr[][] //I want to get the result in this one.
How could this be done?
Please help.
Thank you for your time.Say I have the below set of records in an array of arrays. testArr[][]
Why array of arrays? Why not an array of objects of a class say 'Part'?
class Part{
String id;
String dtlnum;
String partnum;
String partdesc;
// getters and setters
}As far as filtering is concerned, regex match would be very easy...
Part[] parts;
Part[] filtered;
//initiallize parts
void filter(String keyword){
ArrayList<Part> list=new ArrayList<Part>();
for(Part p:parts){
if(p.getPartdesc().matches(keyword+".*"))list.add(p);
filtered=list.toArray();
// call filter function to filter
filter("bath");Thanks!
PS: This code is neither tested nor compiled. -
Providing application-level help within Flex apps
What is the general guideline / approach for help (not
embedded or field-level help but page level or application level
help like you get when you click Help in most applications) within
a Flex app? Is it to spawn a new Window that goes to standard
HTML-based help engines/content or to display the content in a
dialog within the Flex application itself? ThanksSlow down! Found it here:
http://raghunathraoflexing.blogspot.com/2006/12/flex-i-frame.html -
Is there an easy way to filter a 2-d array based on the values of two of the fields?
Is there an easy way to filter a 2-d array based on the values of one of the fields. In my attached VI the output array has the following format:
TimeStamp Ident Frame Type Bytes Data
10:57:07.621 3AD00016 CAN Data Frame 8 0000000000000000
10:57:07.622 3AD00017 CAN Data Frame 8 000005E000000000
10:57:07.624 3AD00018 CAN Data Frame 8 0000000003300000
10:57:07.625 2DC00000 CAN Data Frame 8 0000000000000000
10:57:07.626 3AD00019 CAN Data Frame 4 0000030000000000
I would like to delete any rows that do not have an "Ident" between the values of 3AD00000 and 3AD0001E. So for the above data the fourth row would be deleted. The only way I can see to do it is to form a 1-d array. Is there a better approach?
Thank you.
Solved!
Go to Solution.
Attachments:
CMM_SN_MULTI.vi 20 KBHi chuck72352,
after you have sorted your data, you can use the InRange Function. Combined with a "search 1D Array" you'll get the range you really want.
Mike
Attachments:
ArraySubset.PNG 25 KB -
APEX - 4
DB version - 10g
Web server architecture - OHS
Browser - IE8
Theme - 5
I know how to set and display help text for a page item, and I see there is the option to add help text at the page level, but how does the user accessing the screen see the page level help text?
I was thinking it might be a good way to add user help guide information at the page level.
Thank you for any assistance.I know how to set and display help text for a page item, and I see there is the option to add help text at the page level, but how does the user accessing the screen see the page level help text?Using a Help page and region accessed via a help link (e.g. a navigation bar entry), or using the <tt>apex_application.help</tt> API method in a PL/SQL Dynamic Content region.
This is covered in the APEX documentation which should be consulted before posting a question here. -
Get value from the array based on the HashCode
public static void runJoin(int[][] t1,int[][] t2)
PrintWriter out=null;
int rows = 1000;
int cols = 7;
int [][] myTable3 = new int[rows][cols];
int x = 0;
System.out.print("Running HashJoin:Method loads the "+
"smaller table in the memory and applies a hashing function "+
"to common column and stores it in another table. "+
"The larger table is then read from the file. "+
"The same hashing function is applied to Col n of the table and a matching record in the first table is looked up. A match will create a row in Table 3. ");
//Apply hashing function to smaller table and store it in the memory.
Integer[] It2 = new Integer[t2.length];
int [] hashCodest2 = new int[t2.length];
Hashtable ht = new Hashtable();
for(int i =0; i <t2.length;i++){
It2[i] = new Integer(t2[0]);
hashCodest2[i] = It2[i].hashCode();
ht.put(new Integer(hashCodest2[i]),It2[i]);
//Larger table get hashcodes
Integer It1[] = new Integer[t2.length];
int [] hashCodest1 = new int[t2.length];
for(int j =0; j <t1.length;j++){
It1[j] = new Integer(t1[j][4]);
hashCodest1[j] = It1[j].hashCode(); }
//Based on the hashcode get the value from the Table2;
try{
out = new PrintWriter( new FileOutputStream( "c:\\HashJoinTable.txt" ) );
Enumeration e = ht.keys();
while(e.hasMoreElements())
//How do I get the value from the array based on the HashCode? Do I need to do a loop here???
hashCodes1.get(e.nextElement());
}catch(Exception e){}ok I got it......
//Apply hashing function to smaller table and store it in the memory.
Integer[] It2 = new Integer[t2.length];
int [] hashCodest2 = new int[t2.length];
Hashtable ht = new Hashtable();
for(int i =0; i <t2.length;i++){
It2[i] = new Integer(t2[0]);
hashCodest2[i] = It2[i].hashCode();
ht.put(new Integer(hashCodest2[i]),It2[i]);
//Larger table get hashcodes and compare
Integer It1[] = new Integer[t2.length];
int [] hashCodest1 = new int[t2.length];
Hashtable ht2 = new Hashtable();
for(int j =0; j <t1.length;j++){
It1[j] = new Integer(t1[j][4]);
hashCodest1[j] = It1[j].hashCode();
ht2.put(new Integer(hashCodest1[j]),It1[j]);
//Based on the hashcode get the value from the Table2;
try{
out = new PrintWriter( new FileOutputStream( "c:\\HashJoinTable.txt" ) );
Enumeration e = ht.keys();
Integer t3[] = new Integer[t2.length];
while(e.hasMoreElements())
t3[x] = (Integer) ht2.get(e.nextElement());
x++;
}catch(Exception e){} -
How to add byte[] array based Image to the SQL Server without using parameter
how to add byte[] array based Image to the SQL Server without using parameter.I have a column in table with the type image in sql and i want to add image array to the sql image column like below:
I want to add image (RESIM) to the procedur like shown above but sql accepts byte[] RESIMI like System.Drowing. I whant that sql accepts byte [] array like sql image type
not using cmd.ParametersAdd() method
here is Isle() method contentSQL Server binary constants use a hexadecimal format:
https://msdn.microsoft.com/en-us/library/ms179899.aspx
You'll have to build that string from a byte array yourself:
byte[] bytes = ...
StringBuilder builder = new StringBuilder("0x", 2 + bytes.Length * 2);
foreach (var b in bytes)
builder.Append(b.ToString("X2"));
string binhex = builder.ToString();
That said, what you're trying to do - not using parameters - is the wrong thing to do. Not only it is insecure due to the risk of SQL injection but in the case of binary data is also inefficient since these hex strings are larger than the original byte[]
data. -
Use Of Dictionary Based search help in adobe interactive form
Hi friends,
I wanted to export the search help value into corresponding field of Adobe interactive form.
I am using dictionary type search help in WD context attribute property. I am able to get the search help popup with right data on form. But if select some value it is not exporting data into the field and getting "entry too longer" error.
Can any one help out for this issue.
Note : Wanted to use only dictionary based search help.
Thanks in advance
Naganath Mudalethanks
-
Help reqd on Item Level Help Geneneration in Desg6.0
Hi,
Has anyone generated Help Modules using Designer 6.0. It worked fine on 2.0 i.e. item level help link was generated.. but with 6.0 only the form(module) level help link is generated. Is there any prefernce change/setting to directly get item level links.
DayaHi,
Has anyone generated Help Modules using Designer 6.0. It worked fine on 2.0 i.e. item level help link was generated.. but with 6.0 only the form(module) level help link is generated. Is there any prefernce change/setting to directly get item level links.
Daya -
Best way to author field level help for a CHM?
Hi
I have been asked to create an HTML help (CHM) system for a .Net application which will include context sensitive help at both page and field level.
I have used map ids for page level help before - i.e. assigned a map id to topics and given this list to a developer for implementation, but I have never created field level help.
I've been looking at the 'What's This?' help project wizard but am confused as to whether this is the best approach and how it fits with the project as a whole (or even if it compatible with .Net applications). Does this mean that I need two help projects for the application - one for the main help, and one for the field level help? Is there a way to create field level help without using the 'What's This?' wizard?
I am using Robohelp 7.
Any advice gratefully received!
ChloeHi, Chloe,
As Peter notes, even Microsoft has backed away from using field-level Help in the last few years, so it may be worth trying to determine whether your users will benefit from having it available to them. That's not to say that you can't deliver field-level Help, however, as all the required methods for calling it are still available to .NET developers.
To clarify, what Madcap Software calls "DotNet Help" is just a proprietary Help viewer that the company hopes will be more modern and appealing to writers than the older HTML Help (.chm) viewer. HTML Help remains the recommended format for Windows applications, whether .NET or not, and you can use any authoring tool that is capable of outputting a .chm file to create online Help for a .NET application.
The method that your developers use to call field-level Help determines how it should be authored. If they use the standard .NET method (the SetHelpString method of the HelpProvider class), each text string is embedded in the application code itself, and not retrieved from your .chm file. More information here:
http://msdn.microsoft.com/en-us/library/system.windows.forms.helpprovider.sethelpstring(VS .71).aspx
http://support.microsoft.com/kb/821777
http://helpware.net/mshelp2/demo2/h1xNET.htm
Alternatively, developers can use the old HTML Help API to retrieve the text string from a .chm file. See:
http://msdn.microsoft.com/en-us/library/ms670082(VS.85).aspx
http://helpware.net/htmlhelp/how_to_whatsthis.htm
http://support.microsoft.com/?kbid=317406
The drawback of both methods is that the Help popups are plain text only — no graphics, text formatting, hyperlinks, etc. To work around this, some people use the third-party KeyHelp control to create feature-rich HTML popups. See:
http://www.keyworks.net/keyhelp.htm
This allows you to deliver the type of Help that you mentioned in your second message ("is there a way to do this so that these topics open in a small popup, without the TOC / tri-pane structure?").
Pete -
Field-level Help possible with WebHelp?
Hi All,
I'm trying to determine whether WebHelp supports field-level
help, and between reading the online Help and the forums, I'm
confused. The online help states "WebHelp window support is only
available with the context-sensitive Help API." Does that mean that
WebHelp doesn't officially support field-level help? I'm sure we
can implement field-level help with some creative programming, but
I'm not sure of the requirements.
Is the CSH API required for field-level help? Or do we need
only implement the solutions described on
Peter's
site detailing calling WebHelp? And the RoboHelp Office
TechNote
Calling
Topics with Two Pane View?
I appreciate any assistance that anyone can provide!
want2bewiserwant2bewiser -
If you recall, field-level help was implemented by clicking
on a Question mark icon on the top right in the title bar. Your
cursor changed to a Question Mark and pointer, and clicking on a
field, button or other control would evoke a popup.
You can duplicate that functionality, but the lions's share
of the work would be on the developers. You can provide the small
blurbs, but how it is called is up to them.
The API is useful if you might change topic ids often, or if
you need a sort of map file, or if you just want a standard way of
calling Webhelp into a certain window format. But you don't need
the two-pane format instructions for 'What's This' help.
So, your developer will have to add a function to each page
so that, if the user changes the cursor to a 'What's This' curson,
and an object is clicked during this 'What's This' state, an
explanatory popup will, um, pop up.
...Otherwise, everything behaves normally. -
Field level help always shows homeID URL
I implemented context-sensitive help of 2 types:
1. Field level help - triggered from a menuitem using:
menuitem_CSH.addActionListener(new CSH.DisplayHelpAfterTracking(mainHS, "javax.help.Popup", null));
2. Help key (F1) type help - using:
mainHB.enableHelpKey(getRootPane(), "top", mainHS);
Point 2 type help works perfectly - which implies that my MAP file & setHelpID...() stuff is alright.
CSH.setHelpIDString(jbtnConfigure, "config");
CSH.setHelpIDString(jbtnAlarms, "gettingstarted");
Point 1 however always displays the URL of the homeID. I've tried all kinds of things but can't get this to work.
Am I missing something here? Any help/pointers would be appreciated.maybe something like this will work.
works OK for System.exit(), other options??
click into the 2nd textfield, message displays
click the menu items, no message
import java.awt.event.*;
import java.awt.*;
import javax.swing.*;
class Testing extends JFrame
JMenu file = new JMenu("File");
int counter;
public Testing()
setDefaultCloseOperation(EXIT_ON_CLOSE);
setLocation(400,200);
JMenuItem exit = new JMenuItem("Exit");
file.add(exit);
JMenuBar menuBar = new JMenuBar();
menuBar.add(file);
setJMenuBar(menuBar);
JTextField tf = new JTextField(10);
tf.setInputVerifier(new MyVerifier());
getContentPane().add(tf,BorderLayout.NORTH);
getContentPane().add(new JTextField(10),BorderLayout.SOUTH);
pack();
exit.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent ae){
System.exit(0);}});
class MyVerifier extends InputVerifier
public boolean verify(JComponent input)
if(((JTextField)input).getText().equals(""))
if(file.isSelected() == false) System.out.println("Invalid "+counter++);
return false;
return true;
public static void main(String[] args){new Testing().setVisible(true);}
} -
Field Level Help on Tabular forms
Hi,
Is there any easy way I can add field level help to tabular forms?
If I create a form on a table I can add help for each field, however if I create a tabular form there seems to be no way I can associate field level help with a column.
I know that I can add page level help and could describe all of the columns there, but it would be nicer to add individual help to each column.
Any ideas?
Thanks,
MartinHi Martin!
Take a look at these sites which will provide you more information about your problem.
[http://apex-at-work.blogspot.com/2008/10/apex-select-list-with-dynamic-help-text.html|http://apex-at-work.blogspot.com/2008/10/apex-select-list-with-dynamic-help-text.html]
TRICK: Dynamic Item Help Text as Tooltip
[http://apex.oracle.com/pls/otn/f?p=11933:121|http://apex.oracle.com/pls/otn/f?p=11933:121]
Regards,
Tobias
[http://apex-at-work.blogspot.com/]
Maybe you are looking for
-
Question says it all. What all started this was that I accidentally spilled a cup of Coffee onto my Keyboard. I instantly dried it with tissues and shut it off. A couple of hours later I was unable to log in. I started the MBP and it started up in Sa
-
I no longer have access to my primary email address that is my Apple ID. I want to use my rescue email as my primary email. I have tried and tried and tried to, but Apple will not let me without accessing my old email account... which I cannot. How c
-
Hi All, When we set the fnd_global.apps_initialize from the backend using begin fnd_global.APPS_INITIALIZE(user_id=>4599,resp_id=>50860, resp_appl_id=>800); end; ,resp_id=>50860------->'San Antonio, TX HRMS User' An employee emp#2565 is not getting r
-
HT1338 problems with time machine and parallels desktop, mac osx mountain lion 10.8
have a good day, i have been problems with time machine and parallels desktop, dont work in mac osx 10.8, i upgrate two mac´s (macbook air, imac), in the two machines shows problems, could you help me please. two machines have good ram memory (macbo
-
Hello all, How can I add JButtons to a JTable? I found an article that is supposed to show you how to do just that: http://www.devx.com/getHelpOn/10MinuteSolution/20425 I downloaded the code in the article and it works to an extent - I can see the bu