Daily Archives

Articles indexed Monday November 11 2013

Page 4/19 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • How to handle class dependency with interfaces and implementatons

    - by lealand
    I'm using ObjectAid with Eclipse to generate UML class diagrams for my latest Java project, and I currently have a handful of situations like this, where I have a dependency between two interfaces, as well as one of the implementations of one of the interfaces. Here, foo is the graphics library I'm using. In the previous example, FooCanvas draws ITexture objects to the screen, and both FooCanvas and its interface, ICanvas, take ITexture objects as arguments to their methods. The method in the canvas classes which cause this dependency is the following: void drawTexture(ITexture texture, float x, float y); Additionally, I tried a variation on the method signature using Java's generics: <T extends ITexture> void drawTexture(T texture, float x, float y); The result of this was a class diagram where the only dependencies where between the interfaces and the implementing classes, and no dependency by a canvas object on a texture. I'm not sure if this is more ideal or not. Is the dependency of both the interface and implementation on another interface an expected pattern, or is it typical and/or possible to keep the implementation 'isolated' from its interfaces dependencies? Or is the generic method the ideal solution?

    Read the article

  • Thread count in Java game

    - by Taylor Hill
    I'm just curious as to what a reasonable number of threads is for a simple 2D mmo in Java. Is it reasonable to have two threads per connection, one for the input stream and one for the output stream? The reason I ask is because I use a blocking method on the input stream, and a workaround seems unnecessarily complex if I were to try to get around it without adding threads. This is mostly for my own edification; I don't expect to have 5 million people playing it ever, or even 5, but I'm wondering what a good scalable solution is, and if this is reasonable for a small server (<30 connections).

    Read the article

  • Project collision shapes to plane for 2.5D collision detection

    - by Jkh2
    I am working on a top down 2.5D game. In the game anything that overlaps on the screen should be 'colliding' with each other regardless of whether they are on the same plane in the 3D world. This is illustrated below from a side-ways view: The orange and green circles are spheres floating in the 3D world. They are projected onto a plane parallel to the viewport plane (y = 0 in the image) and if they overlap there is a collision event between them. These spheres are attached to other meshes to represent the sphere bounding boxes for collisions. The way I plan to implement this at the moment is the following: Get the 3D world position at the center of the sphere. Use Camera.WorldToViewportPoint to project the point to the viewport plane. Move a Sphere Collider with the radius of the sphere to that point. Test for collisions using unity colliders. My question is how to extend this to work for rotated cuboids. For instance if I have two rotated cuboids, if I follow the logic above it would not work as intended as the cuboids may not collide but they could still be intersected on the view plane. An example is below: Is there a way to project a cuboid that would be aligned with the plane? Would it be a valid cuboid for all rotations if I did this?

    Read the article

  • Target tracking with a small delay (actionscript 3.0)

    - by John Dodson
    I'm having trouble thinking of a good method to track my character with an enemy attack. Of course, I don't want the attack to track my character's current position; I want it to track where the character was about 1 second before (so you can move around and make the attack miss and loop around you sort of a thing). The general structure of my game uses a timer to update all of my events. I have a timer going off every 25 milliseconds that updates everything, including my player's position and the enemies position. Right now I just have the enemy attack directly targeting my character....which works fine except that it's impossible to escape =p. Let me know if I didn't supply enough details. My approach was going to basically be get my character's position from about 1 second ago, then have the enemy target that position, the only problem is I can't think of a good way to get my character's position from previous times. Thanks for the help!

    Read the article

  • Using a Higher Precision (than 8-bit unsigned integer) Buffered Image for Heightmaps in Java

    - by pl12
    I am generating a heightmap for every quad in my quadtree in openCL. The way I was creating the image is as follows: DataBufferInt dataBuffer = (DataBufferInt)img.getRaster().getDataBuffer(); int data[] = dataBuffer.getData(); //img is a bufferedimage inputImageMem = CL.clCreateImage2D( context, CL_MEM_READ_WRITE | CL_MEM_USE_HOST_PTR, new cl_image_format[]{imageFormat}, size, size, size * Sizeof.cl_uint, Pointer.to(data), null); This works ok but the major issue is that as the quads get smaller and smaller the 8-bit format of the buffered image starts to cause intolerable "stepping" issues as seen below: I was wondering if there was an alternate way I could go about doing this? Thanks for the time.

    Read the article

  • Program is not displaying output correctly

    - by Dave Lee
    My program is suppose to display information from a text file. The text file is here http://pastebin.com/qB6nX2x4 I cant find the problem in my program. I think it has to deal with the looping but im not sure. My program runs correctly but only displays the first line of text. Any help would be appreciated. #include <iostream> #include <string> #include <cstdlib> #include <fstream> using namespace std; int buildArrays(int A[],int B[],int C[]) { int i=0,num; ifstream inFile; inFile.open("candycrush.txt"); if(inFile.fail()) { cout<<"The candycrush.txt input file did not open"<<endl; exit(-1); } while(inFile) { inFile>>num; A[i]=num; inFile>>num; B[i]=num; inFile>>num; C[i]=num; i++; } inFile.close(); return i; } void printArrays( string reportTitle, int levelsArray[], int scoresArray[], int starsArray[], int numberOfLevels ) { cout<<endl; cout<<reportTitle<<endl; cout<<"Levels\tScores\tStars"<<endl; cout<<"---------------------"<<endl; for(int i=0;i<numberOfLevels;i++) { cout<<levelsArray[i]<<"\t"<<scoresArray[i]<<"\t"; for(int j=0;j<starsArray[j];j++) { cout<<"*"; } cout<<endl; } } void sortArrays( int levelsArray[], int scoresArray[], int starsArray[], int numberOfLevels ) { for(int i=0;i<numberOfLevels;i++) { for(int j=0;j<numberOfLevels;j++) { if(levelsArray[i]<levelsArray[j]) { int temp1=levelsArray[i]; int temp2=scoresArray[i]; int temp3=starsArray[i]; levelsArray[i]=levelsArray[j]; scoresArray[i]=scoresArray[j]; starsArray[i]=starsArray[j]; levelsArray[j]=temp1; scoresArray[j]=temp2; starsArray[j]=temp3; } } } } int main() { const int MAX=400; int levelsArray[MAX]; int scoresArray[MAX]; int starsArray[MAX]; int numberOfLevels=buildArrays(levelsArray,scoresArray,starsArray); printArrays( "Candy Crush UNSORTED Report", levelsArray, scoresArray, starsArray, numberOfLevels ); sortArrays( levelsArray, scoresArray, starsArray, numberOfLevels); printArrays( "Candy Crush SORTED Report", levelsArray, scoresArray, starsArray, numberOfLevels ); system("pause"); }

    Read the article

  • Objectify - Retrieve subclass instances with superclass query

    - by Deviling Master
    for a project i'm making, i'm using Objectify and Google AppEngine I'm quoting and old message from Google Groups, but the problem i have is the same: Here's the problem I'm trying to solve: I'd like to persist instances of several subclasses of one superclass to the datastore, and then retrieve them by querying for that superclass. (For example, a query for Game would return instances of Chess and Backgammon). Is there any way to accomplish this using Objectify? Because the thing i want is the same, but the topic does not provides yet an answer (it's 3 years old), I moved here with the same question. From 2010 to now, this question has been solved? Thanks Bye

    Read the article

  • postgresql: Fast way to update the latest inserted row

    - by Anonymous
    What is the best way to modify the latest added row without using a temporary table. E.g. the table structure is id | text | date My current approach would be an insert with the postgresql specific command "returning id" so that I can update the table afterwards with update myTable set date='2013-11-11' where id = lastRow However I have the feeling that postgresql is not simply using the last row but is iterating through millions of entries until "id = lastRow" is found. How can i directly access the last added row?

    Read the article

  • R graphics plotting a linegraph with date/time horizontally along x-axis

    - by user2978586
    I want to get a linegraph in R which has Time along x and temperature along y. Originally I had the data in dd/mm/yyyy hh:mm format, with a time point every 30 minutes. https://www.dropbox.com/s/q35y1rfila0va1h/Data_logger_S65a_Ania.csv Since I couldn't find a way of reading this into R, I formatted the data to make it into dd/mm/yyyy and added a column 'time' with 1-48 for all the time points for each day https://www.dropbox.com/s/65ogxzyvuzteqxv/temp.csv This is what I have so far: temp<-read.csv("temp.csv",as.is=T) temp$date<-as.Date(temp$date, format="%d/%m/%Y") #inputting date in correct format plot(temperature ~ date, temp, type="n") #drawing a blank plot with axes, but without data lines(temp$date, temp$temperature,type="o") #type o is a line overlaid on top of points. This stacks the points up vertically, which is not what I want, and stacks all the time points (1-48) for each day all together on the same date. Any advice would be much appreciated on how to get this horizontal, and ordered by time as well as date.

    Read the article

  • Where to define a filter function for a form field in my Joomla component's preferences

    - by Herman
    I am creating a component in Joomla 2.5. This component has some options that are defined in its config.xml, so they can be set in the preferences of the component. Now I would like to apply a filter to one of these option fields, using the attribute filter="my_filter". In the source code of JForm I saw the following lines at the very end of the implementation of JForm::filterField(): if (strpos($filter, '::') !== false && is_callable(explode('::', $filter))) { $return = call_user_func(explode('::', $filter), $value); } elseif (function_exists($filter)) { $return = call_user_func($filter, $value); } That's what I needed for using a filter function defined by myself! I managed to do this for form fields used in the views of my component. I defined the filter function as MyComponentHelper::my_filter(), where MyComponentHelper is a helper class which I always load in the very base of my component. And in the form's xml I added filter="MyComponentHelper::my_filter" to the fields that have to be filtered. However... when I am trying to apply the filter function to a form field in my component's preferences, I am not in my own component, but in com_config instead, so my helper class is not available! So, therefore, my question: where to define my own filter function in such a way that it can be found and called by JForm::filterField() in com_config?? Help is very much appreciated.

    Read the article

  • Align contents of a div in the center

    - by Jim
    I have a div with width:100%; since I want to fill out the parent container. I also want to have the contents of the div in its center. I can not find a horizontal-align:center attribute for the divs. How can I configure the div so that its contents are in the center? I.e if the div is this big: ------------------------------------------------------------------------------------------------------------ Enclosing tags here in the center ------------------------------------------------------------------------------------------------------------

    Read the article

  • PHP Initialising strings as boolean first

    - by Anriëtte Myburgh
    I'm in the habit of initialising variables in PHP to false and then applying whatever (string, boolean, float) value to it later. Which would you reckon is better? $name = false; if (condition == true) { $name = $something_else; } if ($name) { …do something… } vs. $name =''; if (condition == true) { $name = $something_else; } if (!empty($name)) { …do something… } Which would you reckon can possibly give better performance? Which method would you use?

    Read the article

  • How do I make java wait for boolean to run funciton

    - by TWeeKeD
    I'm sure this is pretty simple but I can't figure out and it sucks I'm up on suck on (what should be) an easy step. ok. I have a method that runs one function that give a response. this method actually handles the uploading of the file so o it takes a second to give a response. I need this response in the following method. sendPicMsg needs to complete and then forward it's response to sendMessage. Please help. b1.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { if(!uploadMsgPic.equalsIgnoreCase("")){ Log.v("response","Pic in storage"); sendPicMsg(); sendMessage(); }else{ sendMessage(); } 1st Method public void sendPicMsg(){ Log.v("response", "sendPicMsg Loaded"); if(!uploadMsgPic.equalsIgnoreCase("")){ final SharedPreferences preferences = this.getActivity().getSharedPreferences("MyPreferences", getActivity().MODE_PRIVATE); AsyncHttpClient client3 = new AsyncHttpClient(); RequestParams params3 = new RequestParams(); File file = new File(uploadMsgPic); try { File f = new File(uploadMsgPic.replace(".", "1.")); f.createNewFile(); //Convert bitmap to byte array Bitmap bitmap = decodeFile(file,400); ByteArrayOutputStream bos = new ByteArrayOutputStream(); bitmap.compress(CompressFormat.PNG, 0 /*ignored for PNG*/, bos); byte[] bitmapdata = bos.toByteArray(); //write the bytes in file FileOutputStream fos = new FileOutputStream(f); fos.write(bitmapdata); params3.put("file", f); } catch (FileNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } params3.put("email", preferences.getString("loggedin_user", "")); params3.put("webversion", "1"); client3.post("http://peekatu.com/apiweb/msgPic_upload.php",params3, new AsyncHttpResponseHandler() { @Override public void onSuccess(String response) { Log.v("response", "Upload Complete"); refreshChat(); //responseString = response; Log.v("response","msgPic has been uploaded"+response); //parseChatMessages(response); response=picurl; uploadMsgPic = ""; if(picurl!=null){ Log.v("response","picurl is set"); } if(picurl==null){ Log.v("response", "picurl no ready"); }; } }); sendMessage(); } } 2nd Method public void sendMessage(){ final SharedPreferences preferences = this.getActivity().getSharedPreferences("MyPreferences", getActivity().MODE_PRIVATE); if(preferences.getString("Username", "").length()<=0){ editText1.setText(""); Toast.makeText(this.getActivity(), "Please Login to send messages.", 2); return; } AsyncHttpClient client = new AsyncHttpClient(); RequestParams params = new RequestParams(); if(type.equalsIgnoreCase("3")){ params.put("toid",user); params.put("action", "sendprivate"); }else{ params.put("room", preferences.getString("selected_room", "Adult Lobby")); params.put("action", "insert"); } Log.v("response", "Sending message "+editText1.getText().toString()); params.put("message",editText1.getText().toString() ); params.put("media", picurl); params.put("email", preferences.getString("loggedin_user", "")); params.put("webversion", "1"); client.post("http://peekatu.com/apiweb/messagetest.php",params, new AsyncHttpResponseHandler() { @Override public void onSuccess(String response) { refreshChat(); //responseString = response; Log.v("response", response); //parseChatMessages(response); if(picurl!=null) Log.v("response", picurl); } }); editText1.setText(""); lv.setSelection(adapter.getCount() - 1); }

    Read the article

  • Joining two select queries and ordering results

    - by user1
    Basically I'm just unsure as to why this query is failing to execute: (SELECT replies.reply_post, replies.reply_content, replies.reply_date AS d, members.username FROM (replies) AS a INNER JOIN members ON replies.reply_by = members.id) UNION (SELECT posts.post_id, posts.post_title, posts.post_date AS d, members.username FROM (posts) as b WHERE posts.post_set = 0 INNER JOIN members ON posts.post_by = members.id) ORDER BY d DESC LIMIT 5 I'm getting this error: #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'a INNER JOIN members ON replies.re' at line 2 All I'm trying to do is select the 5 most recent rows (dates) from these two tables. I've tried Join, union etc and I've seen numerous queries where people have put another query after the FROM statement and that just makes no logical sense to me as to how that works? Am I safe to say that you can join the same table from two different but joined queries? Or am I taking completely the wrong approach, because frankly I can't seem see how this query is failing despite reading the error message. (The two queries on there own work fine)

    Read the article

  • Bug on submitted app binary but not in the simulator - CALayer position contains NaN

    - by Jonathan Thurft
    I submitted my app to the App Store where is ready to download. I've since then received some interesting crash reports when people select an image from the ImagePicker in one of my views. This bug (see below) makes the app crash. I was wondering 2 things. Can anyone spot the problem in the code below? How do you deal with bugs that are only in the App Binary but do not show up when trying to recreate them on the dev environment? - I can make the app crash with the Binary that is on the app store but when I do the same on the simulator or on my test phone the app works perfectly.. The Crash report in BugSense CALayer position contains NaN: [798 nan] Class: CALayerInvalidGeometry 0x00120e99 -[imageCroppingViewController imagePickerController:didFinishPickingMediaWithInfo:] (imageCroppingViewController.m:126) + 163481 The Code - (void) imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info { UIImage *image = [info objectForKey:UIImagePickerControllerOriginalImage]; imageView.image = image; CGRect rect; rect.size.width = image.size.width; rect.size.height = image.size.height; imageView.center = scrollView.center; [imageView setFrame:rect]; scrollView.contentSize = imageView.frame.size; self.navigationController.navigationBar.hidden = NO; [myPicker.view removeFromSuperview]; }

    Read the article

  • c# deleting whole row in access database

    - by user2978474
    I have question about my problem. Thru manustrip in form1 i have made new form2 when i click on a right option. This form is for deleting data in access database if you pick in combobox ID of row it deletes the whole row wher is ID 4 or somethig else... My combobox is connected on my database. my code: public partial class Form2 : Form { public string myConnectionString = @"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Users\Bojan\Desktop\Programiranje\School\Novo\Novo\Ure.accdb"; // to je provider za Access 2007 in vec - ce ga ni na lokalni mašini ga je treba namestiti!!! public Form2() { InitializeComponent(); } private void Form2_Load(object sender, EventArgs e) { // TODO: This line of code loads data into the 'dataSet1.Ure' table. You can move, or remove it, as needed. this.ureTableAdapter.Fill(this.dataSet1.Ure); } private void Brisanje_Click(object sender, EventArgs e) { OleDbConnection myConnection = null; myConnection = new OleDbConnection(); // kreiranje konekcije myConnection.ConnectionString = myConnectionString; myConnection.Open(); OleDbCommand cmd = myConnection.CreateCommand(); cmd.Connection = myConnection; cmd.CommandText = "DELETE FROM Ure WHERE (ID) = '"+Izbor.SelectedValue+"'"; cmd.ExecuteNonQuery(); cmd.Prepare(); myConnection.Close(); } } Thanks for your help

    Read the article

  • Unable to output XML data in a manageable way

    - by Rob
    I've been given data from a previous version of a website (it was a custom CMS) and am looking to get it into a state that I can import it into my Wordpress site. This is what I'm working on - http://www.teamworksdesign.com/clients/ciw/datatest/index.php. If you scroll down to row 187 the data starts to fail (there should be a red message) with the following error message: Fatal error: Uncaught exception 'Exception' with message 'String could not be parsed as XML' in /home/teamwork/public_html/clients/ciw/datatest/index.php:132 Stack trace: #0 /home/teamwork/public_html/clients/ciw/datatest/index.php(132): SimpleXMLElement-__construct(' Can anyone see what the problem is and how to fix it? This is how I'm outputting the date: <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> </head> <body> <?php ini_set('memory_limit','1024M'); ini_set('max_execution_time', 500); //300 seconds = 5 minutes echo "<br />memory_limit: " . ini_get('memory_limit') . "<br /><br />"; echo "<br />max_execution_time: " . ini_get('max_execution_time') . "<br /><br />"; libxml_use_internal_errors(true); $z = new XMLReader; $z->open('dbo_Content.xml'); $doc = new DOMDocument; $doc->preserveWhiteSpace = false; // move to the first <product /> node while ($z->read() && $z->name !== 'dbo_Content'); $c = 0; // now that we're at the right depth, hop to the next <product/> until the end of the tree while ($z->name === 'dbo_Content') { if($c < 201) { // either one should work $node = simplexml_import_dom($doc->importNode($z->expand(), true)); if($node->ClassId == 'policydocument') { $c++; echo "<h1>Row: $c</h1>"; echo "<pre>"; echo htmlentities($node->XML) . "<br /><br /><br /><b>*******</b><br /><br /><br />"; echo "</pre>"; try{ $xmlObject = new SimpleXMLElement($node->XML); foreach ($xmlObject->fields[0]->field as $field) { switch((string) $field['name']) { case 'parentId': echo "<b>PARENT ID: </b> " . $field->value . "<br />"; break; case 'title': echo "<b>TITLE: </b> " . $field->value . "<br />"; break; case 'summary': echo "<b>SUMMARY: </b> " . $field->value . "<br />"; break; case 'body': echo "<b>BODY:</b> " . $field->value . "<br />"; break; case 'published': echo "<b>PUBLISHED:</b> " . $field->value . "<br />"; break; } } echo '<br /><h2 style="color:green;">Success on node: '.$node->ContentId.'</h2><hr /><br />'; } catch (Exception $e){ echo '<h2 style="color:red;">Failed on node: '.$node->ContentId.'</h2>'; } } // go to next <product /> $z->next('dbo_Content'); } } ?> </body> </html>

    Read the article

  • Assigning values to the lable through database depending on listbox values

    - by SurajVitekar
    I want to assign the values of five labels from database regarding to values selected in listbox. The db query returns single column with multiple records. Please help. I'm working with C# 2010 and MS SQL. My current code is: private void listBox1_SelectedIndexChanged(object sender, EventArgs e) { try { String c1, c2; c1 = "NULL"; MessageBox.Show("LB index :"+listBox1.SelectedIndex.ToString()); //p = listBox1.SelectedItem.ToString(); SqlConnection con = new SqlConnection(); con.ConnectionString = "Data Source=localhost;Initial Catalog=eVoting;Integrated Security=True;Pooling=False"; con.Open(); MessageBox.Show("List bOx sect :"+listBox1.SelectedValue.ToString()); SqlCommand cmd = new SqlCommand("select Firstname from candidates where position ='" + listBox1.SelectedValue.ToString() + "'", con); int index = 0; SqlDataReader reader = cmd.ExecuteReader(); while(reader.Read()) { if (index == 0) { c1 = reader[index].ToString(); radioButton1.Text = c1; } if (index == 1) { c1 = reader[index].ToString(); radioButton2.Text = c1; } if (index == 2) { c1 = reader[index].ToString(); radioButton3.Text = c1; } if (index == 3) { c1 = reader[index].ToString(); radioButton4.Text = c1; } if (index == 4) { c1 = reader[index].ToString(); radioButton4.Text = c1; } if (index == 5) { c1 = reader[index].ToString(); radioButton5.Text = c1; } MessageBox.Show("c1 :" + c1); index++; } } catch (Exception E) { } }

    Read the article

  • Prevent delegate method from being called too often

    - by Lord Zsolt
    How would you add a delay between certain method being called? This is my code that I want to only trigger 30 times per second: - (void) scrollViewDidScroll: (UIScrollView*)scrollView { [self performSelector:@selector(needsDisplay) withObject:nil afterDelay:0.033]; } - (void) needsDisplay { [captureView setNeedsDisplay]; } If I leave it like this, it only gets called after the user stopped scrolling. What I want to do is call the method when the user is scrolling, but with a delay of 33 milliseconds between each call.

    Read the article

  • ClickOnce related

    - by Nair
    After publishing a WPF application to a central location using ClickOnce, I am getting following exception when user tries to access the application. There are other applications, which works fine for them and issue is only when they access a particular application. I can't workout why this hence the exception doesn't seems to be very helpful. Problem signature: Problem Event Name: CLR20r3 Problem Signature 01: KG0SYKVDCXEI452K403RIQ4BNPUF3BQA Problem Signature 02: 1.0.0.0 Problem Signature 03: 528094d2 Problem Signature 04: System.Data Problem Signature 05: 4.0.0.0 Problem Signature 06: 4dd23ac7 Problem Signature 07: 24da Problem Signature 08: 2c Problem Signature 09: System.Windows.Markup.XamlParse OS Version: 6.1.7601.2.1.0.256.48 Locale ID: 2057 Additional Information 1: 0a9e Additional Information 2: 0a9e372d3b4ad19135b953a78882e789 Additional Information 3: 0a9e Additional Information 4: 0a9e372d3b4ad19135b953a78882e789 Read our privacy statement online: http://go.microsoft.com/fwlink/?linkid=104288&clcid=0x0409 If the online privacy statement is not available, please read our privacy statement offline: C:\Windows\system32\en-US\erofflps.txt

    Read the article

  • No EJB receiver available for handling [appName:,modulename:HelloWorldSessionBean,distinctname:]

    - by zoit
    I'm trying to develop my first EJB with an Example I found, I have the next mistake: Exception in thread "main" java.lang.IllegalStateException: No EJB receiver available for handling [appName:,modulename:HelloWorldSessionBean,distinctname:] combination for invocation context org.jboss.ejb.client.EJBClientInvocationContext@41408b80 at org.jboss.ejb.client.EJBClientContext.requireEJBReceiver(EJBClientContext.java:584) at org.jboss.ejb.client.ReceiverInterceptor.handleInvocation(ReceiverInterceptor.java:119) at org.jboss.ejb.client.EJBClientInvocationContext.sendRequest(EJBClientInvocationContext.java:181) at org.jboss.ejb.client.EJBInvocationHandler.doInvoke(EJBInvocationHandler.java:136) at org.jboss.ejb.client.EJBInvocationHandler.doInvoke(EJBInvocationHandler.java:121) at org.jboss.ejb.client.EJBInvocationHandler.invoke(EJBInvocationHandler.java:104) at $Proxy0.sayHello(Unknown Source) at com.ibytecode.client.EJBApplicationClient.main(EJBApplicationClient.java:16) I use JBOSS 7.1, and the code is this: HelloWorld.java package com.ibytecode.business; import javax.ejb.Remote; @Remote public interface HelloWorld { public String sayHello(); } HelloWorldBean.java package com.ibytecode.businesslogic; import com.ibytecode.business.HelloWorld; import javax.ejb.Stateless; /** * Session Bean implementation class HelloWorldBean */ @Stateless public class HelloWorldBean implements HelloWorld { /** * Default constructor. */ public HelloWorldBean() { } public String sayHello() { return "Hello World !!!"; } } EJBApplicationClient.java: package com.ibytecode.client; import javax.naming.Context; import javax.naming.NamingException; import com.ibytecode.business.HelloWorld; import com.ibytecode.businesslogic.HelloWorldBean; import com.ibytecode.clientutility.ClientUtility; public class EJBApplicationClient { public static void main(String[] args) { // TODO Auto-generated method stub HelloWorld bean = doLookup(); System.out.println(bean.sayHello()); // 4. Call business logic } private static HelloWorld doLookup() { Context context = null; HelloWorld bean = null; try { // 1. Obtaining Context context = ClientUtility.getInitialContext(); // 2. Generate JNDI Lookup name String lookupName = getLookupName(); // 3. Lookup and cast bean = (HelloWorld) context.lookup(lookupName); } catch (NamingException e) { e.printStackTrace(); } return bean; } private static String getLookupName() { /* The app name is the EAR name of the deployed EJB without .ear suffix. Since we haven't deployed the application as a .ear, the app name for us will be an empty string */ String appName = ""; /* The module name is the JAR name of the deployed EJB without the .jar suffix. */ String moduleName = "HelloWorldSessionBean"; /*AS7 allows each deployment to have an (optional) distinct name. This can be an empty string if distinct name is not specified. */ String distinctName = ""; // The EJB bean implementation class name String beanName = HelloWorldBean.class.getSimpleName(); // Fully qualified remote interface name final String interfaceName = HelloWorld.class.getName(); // Create a look up string name String name = "ejb:" + appName + "/" + moduleName + "/" + distinctName + "/" + beanName + "!" + interfaceName; return name; } } ClientUtility.java package com.ibytecode.clientutility; import java.util.Properties; import javax.naming.Context; import javax.naming.InitialContext; import javax.naming.NamingException; public class ClientUtility { private static Context initialContext; private static final String PKG_INTERFACES = "org.jboss.ejb.client.naming"; public static Context getInitialContext() throws NamingException { if (initialContext == null) { Properties properties = new Properties(); properties.put("jboss.naming.client.ejb.context", true); properties.put(Context.URL_PKG_PREFIXES, PKG_INTERFACES); initialContext = new InitialContext(properties); } return initialContext; } } properties.file: remote.connectionprovider.create.options.org.xnio.Options.SSL_ENABLED=false remote.connections=default remote.connection.default.host=localhost remote.connection.default.port = 4447 remote.connection.default.connect.options.org.xnio.Options.SASL_POLICY_NOANONYMOUS=false This is what I have. Why I have this?. Thanks so much. Regards

    Read the article

  • How to redefine symbol names in objects with RVCT?

    - by Batuu
    I currently develop a small OS for an embedded platform based on a ARM Cortex-M3 microcontroller. The OS provides an API for customer application development. The OS kernel and the API is compiled into a static lib by the ARMCC compiler and customer can link his application against it. The lib and the containing object files offer the complete list of symbols used in kernel. To "protect" the kernel and its inner states from extern hooking into obvious variables and functions, I would like to do some easy obfuscation by renaming the symbols randomly. The GNU binutils seems to do this by calling objcopy with the --redefine-sym flag. The GNU binutils cannot read the ARMCC / RVCT objects. Is there any solution to do this kind of obfuscation with RVCT?

    Read the article

  • What causes session/forms authentication timeouts in MVC3

    - by SimpleUser
    Can somebody please let me know what are the reasons for your authentication to die suddenly, even when you are working on an application without any idle time? Both with and without AJAX calls. And what are the different reasons for getting a 302 redirect from an MVC3 application to the Logon page. Been struggling with an issue with timeouts that happen at random. Sometimes within a few minutes of login to the application and sometimes you can go for hours (with/without idle time) without being thrown out. Thank You

    Read the article

  • Auto refresh of page in Rails 3 using javascript

    - by teknull
    I have a view in my rails app: blah.app/units/status This displays a status of all my units. I'd like to have the page automatically refresh via javascript but I'm not sure how to do it. I tried writing this but it doesn't reload: <script> $(function() { setInterval(function(){ $.getScript("/units/status"); }, 10000); }); </script> Can someone point out where I'm going wrong here?

    Read the article

  • Approach For Syncing One SharePoint List With One or More SharePoint Lists

    - by plattnum
    What would be the best approach or strategy for configuring, customizing or developing in SharePoint a solution that allows me to keep one or more SharePoint lists in sync with a SharePoint list I have designated as a master or parent list. I would like to be able to create a master/parent list of some information that can be extended or used by different parts of the organization without them being able to CRUD any items on the actual columns of the master list. (I have seen some commercial web parts that offer column security on SharePoint lists and although that’s one way of potentially meeting my needs I would like to explore other options.) Scenario: I have a list called FOO: FOO Title Description I would like to create a new list BAR based off of FOO (BAR is managed by sub-organization that doesn't have access to FOO List): BAR FOO.Title (Read-Only) FOO.Description (Read-Only) NewColumn1 NewColumn2 Actions: Create- If a new item is entered in FOO I would like the new item added to BAR. Read - N/A Update - If the title or description is changed in FOO I would like it changed in BAR. Delete- No Deletes in the scenario. (Deletes are handled by the business with status column.) Templates with content extraction offer me this but it’s a one time shot at list creation. Just not sure what the best approach or strategy would be for this in MOSS 2007. Thanks!

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >