Search Results

Search found 215 results on 9 pages for 'bytearray'.

Page 9/9 | < Previous Page | 5 6 7 8 9 

  • Problem converting a byte array into datatable.

    - by kranthi
    Hi, In my aspx page I have a HTML inputfile type which allows user to browse for a spreadsheet.Once the user choses the file to upload I want to read the content of the spreadsheet and store the content into mysql database table. I am using the following code to read the content of the uploaded file and convert it into a datatable in order into insert it into database table. if (filMyFile.PostedFile != null) { // Get a reference to PostedFile object HttpPostedFile myFile = filMyFile.PostedFile; // Get size of uploaded file int nFileLen = myFile.ContentLength; // make sure the size of the file is > 0 if (nFileLen > 0) { // Allocate a buffer for reading of the file byte[] myData = new byte[nFileLen]; // Read uploaded file from the Stream myFile.InputStream.Read(myData, 0, nFileLen); DataTable dt = new DataTable(); MemoryStream st = new MemoryStream(myData); st.Position = 0; System.Runtime.Serialization.IFormatter formatter = new System.Runtime.Serialization.Formatters.Binary.BinaryFormatter(); dt=(DataTable)formatter.Deserialize(st); } } But I am getting the following error when I am trying to deserialise the byte array into datatable. Binary stream '0' does not contain a valid BinaryHeader. Possible causes are invalid stream or object version change between serialization and deserialization. Could someone please tell me what am I doing wrong? I've also tried converting the bytearray into string ,then converting the string back to byte array and convert into datatable.That is also throwing the same error. Thanks.

    Read the article

  • RSA C# Encrypt Java Decrypt

    - by user353030
    Hi guys, In my program (server side - Java) I've created keystore file, with command: keytool -genkey -alias myalias -keyalg RSA -validity 10000 -keystore my.keystore and exported related X509 certificate with: keytool -export -alias myalias -file cert.cer -keystore my.keystore After I saved cert.cer on client side (C#) and I write this code: X509Certificate2 x509 = new X509Certificate2(); byte[] rawData = ReadFile("mycert.cer"); x509.Import(rawData); RSACryptoServiceProvider rsa = (RSACryptoServiceProvider)x509.PublicKey.Key; byte[] plainbytes = System.Text.Encoding.ASCII.GetBytes("My Secret"); byte[] cipherbytes = rsa.Encrypt(plainbytes, true); String cipherHex = convertToHex(cipherContent); byte[] byteArray = encoding.GetBytes(cipherHex); .... I write this Java code on server side: keyStore = KeyStore.getInstance(KeyStore.getDefaultType()); keyStore.load(new FileInputStream("C:\\my.keystore"), "mypass".toCharArray()); Key key = keyStore.getKey("myalias", "mypass".toCharArray()); if (key instanceof PrivateKey) { Certificate cert = keyStore.getCertificate("myalias"); PublicKey pubKey = cert.getPublicKey(); privKey = (PrivateKey)key; } byte[] toDecodeBytes = new BigInteger(encodeMessageHex, 16).toByteArray(); Cipher decCipher = Cipher.getInstance("RSA"); decCipher.init(Cipher.DECRYPT_MODE, privKey); byte[] decodeMessageBytes = decCipher.doFinal(toDecodeBytes); String decodeMessageString = new String(decodeMessageBytes); I receive this error: javax.crypto.BadPaddingException: Data must start with zero Can you help me, please? Thanks thanks,

    Read the article

  • How do I play back a WAV in ActionScript?

    - by Jeremy White
    Please see the class I have created at http://textsnip.com/51013f for parsing a WAVE file in ActionScript 3.0. This class is correctly pulling apart info from the file header & fmt chunks, isolating the data chunk, and creating a new ByteArray to store the data chunk. It takes in an uncompressed WAVE file with a format tag of 1. The WAVE file is embedded into my SWF with the following Flex embed tag: [Embed(source="some_sound.wav", mimeType="application/octet-stream")] public var sound_class:Class; public var wave:WaveFile = new WaveFile(new sound_class()); After the data chunk is separated, the class attempts to make a Sound object that can stream the samples from the data chunk. I'm having issues with the streaming process, probably because I'm not good at math and don't really know what's happening with the bits/bytes, etc. Here are the two documents I'm using as a reference for the WAVE file format: http://www.lightlink.com/tjweber/StripWav/Canon.html https://ccrma.stanford.edu/courses/422/projects/WaveFormat/ Right now, the file IS playing back! In real time, even! But...the sound is really distorted. What's going on?

    Read the article

  • Facebook Graph API - Image Uploading (as3/flash)

    - by lollertits
    I have been trying to get a bit more familiar with the Graph API for facebook. Its very convenient although the documentation is poor at some places. Im having trouble uploading an image to an album. Anyone know how to do it ? This is the code im currently working on :) private function uploadNewPic(albumId:String):void { var bmd1:BitmapData = new BitmapData(200, 200, false, 0x666666); var bm1:Bitmap = new Bitmap(bmd1); var jpgEncoder:JPGEncoder = new JPGEncoder(); var ba:ByteArray = jpgEncoder.encode(bmd1); var data:URLVariables = new URLVariables(); data.message = "Message"; data.image = ba; data.photos = ba; data.url = ba; var method:String = URLRequestMethod.POST; var loader:URLLoader = facebook.call(albumId + "/photos", data, method); loader.addEventListener(FacebookOAuthGraphEvent.ERROR, onPicError); loader.addEventListener(FacebookOAuthGraphEvent.DATA, onPicUploaded); } Im pretty much down to trial and error :) Any ideas ?

    Read the article

  • how to convert bitmap into byte array in android

    - by satyamurthy
    hi all i am new in android i am implementing image retrieve in sdcard in image convert into bitmap and in bitmap convert in to byte array please forward some solution of this code public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); ImageView image = (ImageView) findViewById(R.id.picview); EditText value=(EditText)findViewById(R.id.EditText01); FileInputStream in; BufferedInputStream buf; try { in = new FileInputStream("/sdcard/pictures/1.jpg"); buf = new BufferedInputStream(in,1070); System.out.println("1.................."+buf); byte[] bMapArray= new byte[buf.available()]; buf.read(bMapArray); Bitmap bMap = BitmapFactory.decodeByteArray(bMapArray, 0, bMapArray.length); for (int i = 0; i < bMapArray.length; i++) { System.out.print("bytearray"+bMapArray[i]); } image.setImageBitmap(bMap); value.setText(bMapArray.toString()); if (in != null) { in.close(); } if (buf != null) { buf.close(); } } catch (Exception e) { Log.e("Error reading file", e.toString()); } } } solution is 04-12 16:41:16.168: INFO/System.out(728): 4......................[B@435a2908 this is the result for byte array not display total byte array this array size is 1034 please forward some solution

    Read the article

  • What am I doing wrong with HttpResponse content and headers when downloading a file?

    - by Slauma
    I want to download a PDF file from a SQL Server database which is stored in a binary column. There is a LinkButton on an aspx page. The event handler of this button looks like this: protected void LinkButtonDownload(object sender, EventArgs e) { ... byte[] aByteArray; // Read binary data from database into this ByteArray // aByteArray has the size: 55406 byte Response.ClearHeaders(); Response.ClearContent(); Response.BufferOutput = true; Response.AddHeader("Content-Disposition", "attachment; filename=" + "12345.pdf"); Response.ContentType = "application/pdf"; using (BinaryWriter aWriter = new BinaryWriter(Response.OutputStream)) { aWriter.Write(aByteArray, 0, aByteArray.Length); } } A "File Open/Save dialog" is offered in my browser. When I store this file "12345.pdf" to disk, the file has a size of 71523 Byte. The additional 16kB at the end of the PDF file are the HTML code of my page (as I can see when I view the file in an editor). I am confused because I was believing that ClearContent and ClearHeaders would ensure that the page content is not sent together with the file content. What am I doing wrong here? Thanks for help!

    Read the article

  • Attempting to Convert Byte[] into Image... but is there platform issues involved

    - by user305535
    Greetings, Current, I'm attempting to develop an application that takes a Byte Array that is streamed to us from a Linux C language program across a TCPClient (stream) and reassemble it back into an image/jpg. The "sending" application was developed by a off-site developer who claims that the image reassembles back into an image without any problems or errors in his test environment (all Linux)... However, we are not so fortunate. I (believe) we successfully get all of the data sent, storing it as a string (lets us append the stream until it is complete) and then we convert it back into a Byte[]. This appears to be working fine... But, when we take the byte[] we get from the streaming (and our string assembly) and try to convert it into an image using the System.Drawing.Image.FromStream() we get errors.... Anyone have any idea what we're doing wrong? Or, does anyone know if this is a cross-platform issue? We're developing our app for Windows XP and C# .net, but the off-site developer did his work in c and Linux... perhaps there's some difference as to how each Operating System Coverts Images into Byte Arrays? Anyway, here's the code for converting our received ByteArray (from the TCPClient Stream) into an image. This code works when we send an image from a test machine we built that RUNS on XP, but not from the Linux box... System.Text.ASCIIEncoding encoding = new System.Text.ASCIIEncoding(); byte[] imageBytes = encoding.GetBytes(data); MemoryStream ms = new MemoryStream(imageBytes, 0, imageBytes.Length); // Convert byte[] to Image ms.Write(imageBytes, 0, imageBytes.Length); System.Drawing.Image image = System.Drawing.Image.FromStream(ms, false); <-- DIES here, throws a {System.ArgumentException: Parameter is not valid.} error Any advice, suggestions, theories, or HELP would be GREATLY appreciated! Please let me know??? Best wishes all! Thanks in advance! Greg

    Read the article

  • convert bitmap to byte array

    - by narasimha
    hi 437400a8-1-40-1-32016747073700110010100-1-370670967876987810109111322151312121327202116223229343432293131364052443638493931314561454953555858583543636863566752575855-1-37067110101013121326151526553731375555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555-1-640178010401043134021713171-1-600270103031000000000002461375-1-6004716022133244700000001234517336184919-127203465817505111366829798-111-95-79-1-600241111110000000000001234-1-6003217110222230000000001217318433506581113-95-1-380123102173170630-16-480094-43116-84-8341-30-84-72118-4865250106-2-80-97-121-2-11836-5741-108-362116-43101-966-102974345-787448-12486-1877-87316379-54-71-58112-109-116-94-98279102-97-36-767534-11711311444-57-56-82859384-100399-83-100100-68-90-114-788678118-394344-108-895754-274161-37111-53108-11938-11-2005010612210612546-764577107-107-36-1125-61-7319-78-51-109107-26-287-37-5284119-25126-26-749476-79-116115-19-107-102-7795-33-46-2402764-47-1214100-15-6-10918-105-115-127-1097069-111-123-16-50-9051-8367127-10291-65-53-78-35-18-66-36-103-6499-1099-982327-107979107-473-22-672780-23-5595-4581-4550-18-57-7598-37101-72-79-107-10885-77-39-42-92-72-114-41194622-4108-49200-29-30-8-40-8-8116-58-19114-6907-91073-6210617-101-116-10836-3882-37-122-41-97-6-120-128000-1089941-67-952339-7712337-6511-1064640000000105-11110-85-114-95-46-409042-45-24-86120-8355-10726-32-91110-5-9111-7686-33-63-54123-66-3411951024-29-29-57-11410724-74-2002764-77-127-97-107-899159112-81-9951-78-71854171-21945-92-67-478818-55102-88010000-7386116-85-45111-63-1249-2727-84-115-114-3986-99-111-19-33-120-53-24-98-4-94-9538-2-64080000-73-101-1212890-79108-1149461-18-6-677126-92-37-87-18-41108-72-31-15-65-7145-110-2484020000005949-20-12111-82-5724-53-7873-1956-8739-5-89-28852-29-61771251215652-99109-81105-38-1010261-7086-10594-97858542-278-5911146-33-10645-75-3-11843111-90-49-49-1095499-11344-78-5892-90-81-32-960-40000000090-44-79106-61-55-12-88-52-894629-111-105-8578-3-69-76-10192-8141-15-2077-5-48-86040000114-4594836411202-26-103-90102-22-7149-57-45-15-84-66-42-46645-19-5-3-118-41851012258-18-82117-393149-10090107-39-9771-89117-20-2-100-49121-685-118-68-98-5754145-4679-493031-70107-3398-10611885-103-39-73-27-35-6-105-394337-53124-73-65-43-73-289-119-33-67-33-59125105-48054-1280000011075980-53-446115-116-71-37-16-12-58-102-7373118-62622301982-35-118-962-12800015-1-39 this resultfor bytearray its not true how can implement byte array please some solution

    Read the article

  • how to send image to remote server using webservices in android only save to byte array

    - by satyamurthy
    get image from sdcard and store that image to remote server. i am getting the image from sdcard and i converterd that image to bytearray by using bitmap .but what's the problem if i oberver byte array it is showing some different values it is not matching with .net image byte array conversion. can u pl help if you have any solution it is very urgent to me following is the code i am using can u pl suggest me FileInputStream fin = new FileInputStream(new File("/sdcard/pictures/1.jpg")); BufferedInputStream bis = new BufferedInputStream(fin,3000); byte[] data = new byte[bis.available()]; bis.read(data, 0, data.length); byte[] data1=new byte[data.length]; for (int i = 0; i < data.length; i++) { System.out.print(data[i]); data1[i]=data[i]; } System.out.println("5..................."+data1); Bitmap bitmap = BitmapFactory.decodeByteArray(data1,0,data1.length); System.out.println("6..................."+data1.length); Log.v("hgfjohfjghjdfhgj",""+bitmap); if(bitmap!=null) image.setImageBitmap(bitmap); else Log.e("Bitmap "," Not Created");

    Read the article

  • how to send image to remote server using web services in android

    - by Aswan
    get image from sdcard and store that image to remote server. i am getting the image from sdcard and i converterd that image to bytearray by using bitmap .but what's the problem if i oberver byte array it is showing some different values it is not matching with .net image byte array conversion. can u pl help if you have any solution it is very urgent to me following is the code i am using can u pl suggest me FileInputStream fin = new FileInputStream(new File("/sdcard/pictures/1.jpg")); BufferedInputStream bis = new BufferedInputStream(fin,3000); byte[] data = new byte[bis.available()]; bis.read(data, 0, data.length); byte[] data1=new byte[data.length]; for (int i = 0; i < data.length; i++) { System.out.print(data[i]); data1[i]=data[i]; } System.out.println("5..................."+data1); Bitmap bitmap = BitmapFactory.decodeByteArray(data1,0,data1.length); System.out.println("6..................."+data1.length); Log.v("hgfjohfjghjdfhgj",""+bitmap); if(bitmap!=null) image.setImageBitmap(bitmap); else Log.e("Bitmap "," Not Created");

    Read the article

  • Filtering null values with pig

    - by arianp
    It looks like a silly problem, but I can´t find a way to filter null values from my rows. This is the result when I dump the object geoinfo: DUMP geoinfo; ([longitude#70.95853,latitude#30.9773]) ([longitude#-9.37944507,latitude#38.91780853]) (null) (null) (null) ([longitude#-92.64416,latitude#16.73326]) (null) (null) ([longitude#-9.15199849,latitude#38.71179122]) ([longitude#-9.15210796,latitude#38.71195131]) here is the description DESCRIBE geoinfo; geoinfo: {geoLocation: bytearray} What I'm trying to do is to filter null values like this: geoinfo_no_nulls = FILTER geoinfo BY geoLocation is not null; but the result remains the same. nothing is filtered. I also tried something like this geoinfo_no_nulls = FILTER geoinfo BY geoLocation != 'null'; and I got an error org.apache.pig.backend.executionengine.ExecException: ERROR 1071: Cannot convert a map to a String What am I doing wrong? details, running on ubuntu, hadoop-1.0.3 with pig 0.9.3 pig -version Apache Pig version 0.9.3-SNAPSHOT (rexported) compiled Oct 24 2012, 19:04:03 java version "1.6.0_24" OpenJDK Runtime Environment (IcedTea6 1.11.4) (6b24-1.11.4-1ubuntu0.12.04.1) OpenJDK 64-Bit Server VM (build 20.0-b12, mixed mode)

    Read the article

  • CoreData : App crashes when deleting last instance created

    - by Leo
    Hello, I have a 2 tabs application. In the first one, I'm creating objects of the "Sample" and "SampleList" entities. Each sampleList contains an ID and a set of samples. Each sample contains a date and temperature property. In the second tab, I'm displaying my data in a tableView. I implemented the - (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath method in order to delete SampleLists. In my xcdatamodel the delete rule for my relationship between SampleList and Sample is Cascade. My problem is that when I try to delete SampleList I just created, the app crashes and I receive a EXC_BAD_ACCESS signal. If I restart it, then I'm able to delete "old" sampleList without any problems. Earlier, I had the following problem : I couldn't display the the sampleLists I created since I launched the app, because it crashed too. I received also the EXC_BAD_ACCESS signal. Actually, it seemed that the date of the last sample created of the set was nil. If I am not releasing the NSDate I'm using to set the sample's date, I don't have this problem anymore... If anyone could help me to find out what could cause my troubles it would be great !! Here is the method I'm using to create new instances : SampleList *newSampleList = (SampleList *)[NSEntityDescription insertNewObjectForEntityForName:@"SampleList" inManagedObjectContext:managedObjectContext]; [newSampleList setPatchID:patchID]; NSMutableSet *newSampleSet = [[NSMutableSet alloc] init]; NSCalendar *gregorian = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar]; for (int i = 0; i < [byteArray count]; i=i+4, sampleCount++) { NSDateComponents *comps = [[NSDateComponents alloc] init]; [comps setYear:year]; [comps setMonth:month]; [comps setDay:day]; [comps setHour:hours]; [comps setMinute:minutes]; NSDate *sampleDate = [gregorian dateFromComponents:comps]; Sample *newSample = (Sample *)[NSEntityDescription insertNewObjectForEntityForName:@"Sample" inManagedObjectContext:managedObjectContext]; [newSample setSampleDate:sampleDate]; [newSample setSampleTemperature:[NSNumber numberWithInt:temperature]]; [newSampleSet addObject:newSample]; [comps release]; //[sampleDate release]; } [newSampleList setSampleSet:newSampleSet]; // [newSampleSet release]; NSError *error; if (![managedObjectContext save:&error]) { NSLog(@"Could not Save the context !!"); } [gregorian release];

    Read the article

  • Could not load file or assembly ... or one of its dependencies. An attempt was made to load a progra

    - by Dan
    I am getting the following error message when compiling or attempting to run my application on Windows 7 64 bit. I've scoured the internet and many people have the same error message however none of the solutions address my problem or situation. Using VS 2010. Error 38 Could not load file or assembly 'file:///D:/Projects/Windows Projects/Weld/Components/FileAttachments/FileAttachments/FileAttachments/bin/x86/Debug/FileAttaching.dll' or one of its dependencies. An attempt was made to load a program with an incorrect format. Line 1212, position 5. D:\Projects\Windows Projects\Weld\Weld\Weld.UI\frmMain.resx 1212 5 Weld.UI Ok, so I have 2 projects a UI project and a FileAttachment project. UI project has a reference to FileAttachment project. When I compile UI project in "Any CPU" mode everything works fine and it runs. I assume 'Any CPU' will run in 64bit mode when I compile as that is the platform I am using. I want to run/compile as x86 so I try to do that, so I change configuration for all projects to x86 and verify that these configurations are compiling to x86. I compile and get the error as stated above. I find it odd that it compiles and works fine in 64bit but not 32bit. However when compiled and deployed to users as 'Any CPU', if these users have x86 it still works for them no problem. I just can't compile or run as x86 on my PC. Again, I can compile as Any CPU and deploy to a 32bit PC no problem. Neither project are referencing any 64bit only dlls. Both projects are verified to be targetting 32bit dll's and .NET Framework assemblies. I need to compile and run this locally under 32bit mode. I need JIT edit/continue among other things. Here is the line of code in the resx file that is causing the problem: </data> <data name="Appearance17.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> <value> The resx file is verified to be generated for .NET 2.0 amnd is only referencing .NET 2.0 assemblies and not .NET 4.0 versions. Any ideas here? I've searched the net and have found hundreds of people with the same error message but a different problem.

    Read the article

  • Nashorn, the rhino in the room

    - by costlow
    Nashorn is a new runtime within JDK 8 that allows developers to run code written in JavaScript and call back and forth with Java. One advantage to the Nashorn scripting engine is that is allows for quick prototyping of functionality or basic shell scripts that use Java libraries. The previous JavaScript runtime, named Rhino, was introduced in JDK 6 (released 2006, end of public updates Feb 2013). Keeping tradition amongst the global developer community, "Nashorn" is the German word for rhino. The Java platform and runtime is an intentional home to many languages beyond the Java language itself. OpenJDK’s Da Vinci Machine helps coordinate work amongst language developers and tool designers and has helped different languages by introducing the Invoke Dynamic instruction in Java 7 (2011), which resulted in two major benefits: speeding up execution of dynamic code, and providing the groundwork for Java 8’s lambda executions. Many of these improvements are discussed at the JVM Language Summit, where language and tool designers get together to discuss experiences and issues related to building these complex components. There are a number of benefits to running JavaScript applications on JDK 8’s Nashorn technology beyond writing scripts quickly: Interoperability with Java and JavaScript libraries. Scripts do not need to be compiled. Fast execution and multi-threading of JavaScript running in Java’s JRE. The ability to remotely debug applications using an IDE like NetBeans, Eclipse, or IntelliJ (instructions on the Nashorn blog). Automatic integration with Java monitoring tools, such as performance, health, and SIEM. In the remainder of this blog post, I will explain how to use Nashorn and the benefit from those features. Nashorn execution environment The Nashorn scripting engine is included in all versions of Java SE 8, both the JDK and the JRE. Unlike Java code, scripts written in nashorn are interpreted and do not need to be compiled before execution. Developers and users can access it in two ways: Users running JavaScript applications can call the binary directly:jre8/bin/jjs This mechanism can also be used in shell scripts by specifying a shebang like #!/usr/bin/jjs Developers can use the API and obtain a ScriptEngine through:ScriptEngine engine = new ScriptEngineManager().getEngineByName("nashorn"); When using a ScriptEngine, please understand that they execute code. Avoid running untrusted scripts or passing in untrusted/unvalidated inputs. During compilation, consider isolating access to the ScriptEngine and using Type Annotations to only allow @Untainted String arguments. One noteworthy difference between JavaScript executed in or outside of a web browser is that certain objects will not be available. For example when run outside a browser, there is no access to a document object or DOM tree. Other than that, all syntax, semantics, and capabilities are present. Examples of Java and JavaScript The Nashorn script engine allows developers of all experience levels the ability to write and run code that takes advantage of both languages. The specific dialect is ECMAScript 5.1 as identified by the User Guide and its standards definition through ECMA international. In addition to the example below, Benjamin Winterberg has a very well written Java 8 Nashorn Tutorial that provides a large number of code samples in both languages. Basic Operations A basic Hello World application written to run on Nashorn would look like this: #!/usr/bin/jjs print("Hello World"); The first line is a standard script indication, so that Linux or Unix systems can run the script through Nashorn. On Windows where scripts are not as common, you would run the script like: jjs helloWorld.js. Receiving Arguments In order to receive program arguments your jjs invocation needs to use the -scripting flag and a double-dash to separate which arguments are for jjs and which are for the script itself:jjs -scripting print.js -- "This will print" #!/usr/bin/jjs var whatYouSaid = $ARG.length==0 ? "You did not say anything" : $ARG[0] print(whatYouSaid); Interoperability with Java libraries (including 3rd party dependencies) Another goal of Nashorn was to allow for quick scriptable prototypes, allowing access into Java types and any libraries. Resources operate in the context of the script (either in-line with the script or as separate threads) so if you open network sockets and your script terminates, those sockets will be released and available for your next run. Your code can access Java types the same as regular Java classes. The “import statements” are written somewhat differently to accommodate for language. There is a choice of two styles: For standard classes, just name the class: var ServerSocket = java.net.ServerSocket For arrays or other items, use Java.type: var ByteArray = Java.type("byte[]")You could technically do this for all. The same technique will allow your script to use Java types from any library or 3rd party component and quickly prototype items. Building a user interface One major difference between JavaScript inside and outside of a web browser is the availability of a DOM object for rendering views. When run outside of the browser, JavaScript has full control to construct the entire user interface with pre-fabricated UI controls, charts, or components. The example below is a variation from the Nashorn and JavaFX guide to show how items work together. Nashorn has a -fx flag to make the user interface components available. With the example script below, just specify: jjs -fx -scripting fx.js -- "My title" #!/usr/bin/jjs -fx var Button = javafx.scene.control.Button; var StackPane = javafx.scene.layout.StackPane; var Scene = javafx.scene.Scene; var clickCounter=0; $STAGE.title = $ARG.length>0 ? $ARG[0] : "You didn't provide a title"; var button = new Button(); button.text = "Say 'Hello World'"; button.onAction = myFunctionForButtonClicking; var root = new StackPane(); root.children.add(button); $STAGE.scene = new Scene(root, 300, 250); $STAGE.show(); function myFunctionForButtonClicking(){   var text = "Click Counter: " + clickCounter;   button.setText(text);   clickCounter++;   print(text); } For a more advanced post on using Nashorn to build a high-performing UI, see JavaFX with Nashorn Canvas example. Interoperable with frameworks like Node, Backbone, or Facebook React The major benefit of any language is the interoperability gained by people and systems that can read, write, and use it for interactions. Because Nashorn is built for the ECMAScript specification, developers familiar with JavaScript frameworks can write their code and then have system administrators deploy and monitor the applications the same as any other Java application. A number of projects are also running Node applications on Nashorn through Project Avatar and the supported modules. In addition to the previously mentioned Nashorn tutorial, Benjamin has also written a post about Using Backbone.js with Nashorn. To show the multi-language power of the Java Runtime, there is another interesting example that unites Facebook React and Clojure on JDK 8’s Nashorn. Summary Nashorn provides a simple and fast way of executing JavaScript applications and bridging between the best of each language. By making the full range of Java libraries to JavaScript applications, and the quick prototyping style of JavaScript to Java applications, developers are free to work as they see fit. Software Architects and System Administrators can take advantage of one runtime and leverage any work that they have done to tune, monitor, and certify their systems. Additional information is available within: The Nashorn Users’ Guide Java Magazine’s article "Next Generation JavaScript Engine for the JVM." The Nashorn team’s primary blog or a very helpful collection of Nashorn links.

    Read the article

  • How to deploy jBPM 3.2.2 console on Oracle 10g iAS

    - by Balint Pato
    Hi! Does anybody have experience regarding deployment of the jBPM Administration Console on Oracle 10g iAS? I successfully deployed it using an .ear, security mappings working, I can even login to the console, Hibernate finds the JNDI datasource but it cannot find the TransactionManager. I see no log, only the exception thrown in the jsf page: Can anybody help me? The hibernate.cfg.xml file now looks like this: <?xml version='1.0' encoding='utf-8'?> <!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd"> <hibernate-configuration> <session-factory> <!-- hibernate dialect --> <property name="hibernate.dialect">org.hibernate.dialect.Oracle9Dialect</property> <!-- JDBC connection properties (begin) === <property name="hibernate.connection.driver_class">org.hsqldb.jdbcDriver</property> <property name="hibernate.connection.url">jdbc:hsqldb:mem:jbpm</property> <property name="hibernate.connection.username">sa</property> <property name="hibernate.connection.password"></property> ==== JDBC connection properties (end) --> <property name="hibernate.cache.provider_class">org.hibernate.cache.HashtableCacheProvider</property> <!-- DataSource properties (begin) --> <property name="hibernate.connection.datasource">java:/JbpmDS</property> <!-- DataSource properties (end) --> <!-- JTA transaction properties (begin) --> <property name="hibernate.transaction.factory_class">org.hibernate.transaction.JTATransactionFactory</property> <!-- <property name="hibernate.transaction.manager_lookup_class">org.hibernate.transaction.JBossTransactionManagerLookup</property>--> <!-- JTA transaction properties (end) --> <!-- CMT transaction properties (begin) === <property name="hibernate.transaction.factory_class">org.hibernate.transaction.CMTTransactionFactory</property> <property name="hibernate.transaction.manager_lookup_class">org.hibernate.transaction.JBossTransactionManagerLookup</property> ==== CMT transaction properties (end) --> <!-- logging properties (begin) --> <property name="hibernate.show_sql">true</property> <property name="hibernate.format_sql">true</property> <property name="hibernate.use_sql_comments">true</property> <--==== logging properties (end) --> <!-- ############################################ --> <!-- # mapping files with external dependencies # --> <!-- ############################################ --> <!-- following mapping file has a dependendy on --> <!-- 'bsh-{version}.jar'. --> <!-- uncomment this if you don't have bsh on your --> <!-- classpath. you won't be able to use the --> <!-- script element in process definition files --> <mapping resource="org/jbpm/graph/action/Script.hbm.xml"/> <!-- following mapping files have a dependendy on --> <!-- 'jbpm-identity.jar', mapping files --> <!-- of the pluggable jbpm identity component. --> <!-- Uncomment the following 3 lines if you --> <!-- want to use the jBPM identity mgmgt --> <!-- component. --> <!-- identity mappings (begin) --> <mapping resource="org/jbpm/identity/User.hbm.xml"/> <mapping resource="org/jbpm/identity/Group.hbm.xml"/> <mapping resource="org/jbpm/identity/Membership.hbm.xml"/> <!-- identity mappings (end) --> <!-- following mapping files have a dependendy on --> <!-- the JCR API --> <!-- jcr mappings (begin) === <mapping resource="org/jbpm/context/exe/variableinstance/JcrNodeInstance.hbm.xml"/> ==== jcr mappings (end) --> <!-- ###################### --> <!-- # jbpm mapping files # --> <!-- ###################### --> <!-- hql queries and type defs --> <mapping resource="org/jbpm/db/hibernate.queries.hbm.xml" /> <!-- graph.action mapping files --> <mapping resource="org/jbpm/graph/action/MailAction.hbm.xml"/> <!-- graph.def mapping files --> <mapping resource="org/jbpm/graph/def/ProcessDefinition.hbm.xml"/> <mapping resource="org/jbpm/graph/def/Node.hbm.xml"/> <mapping resource="org/jbpm/graph/def/Transition.hbm.xml"/> <mapping resource="org/jbpm/graph/def/Event.hbm.xml"/> <mapping resource="org/jbpm/graph/def/Action.hbm.xml"/> <mapping resource="org/jbpm/graph/def/SuperState.hbm.xml"/> <mapping resource="org/jbpm/graph/def/ExceptionHandler.hbm.xml"/> <mapping resource="org/jbpm/instantiation/Delegation.hbm.xml"/> <!-- graph.node mapping files --> <mapping resource="org/jbpm/graph/node/StartState.hbm.xml"/> <mapping resource="org/jbpm/graph/node/EndState.hbm.xml"/> <mapping resource="org/jbpm/graph/node/ProcessState.hbm.xml"/> <mapping resource="org/jbpm/graph/node/Decision.hbm.xml"/> <mapping resource="org/jbpm/graph/node/Fork.hbm.xml"/> <mapping resource="org/jbpm/graph/node/Join.hbm.xml"/> <mapping resource="org/jbpm/graph/node/MailNode.hbm.xml"/> <mapping resource="org/jbpm/graph/node/State.hbm.xml"/> <mapping resource="org/jbpm/graph/node/TaskNode.hbm.xml"/> <!-- context.def mapping files --> <mapping resource="org/jbpm/context/def/ContextDefinition.hbm.xml"/> <mapping resource="org/jbpm/context/def/VariableAccess.hbm.xml"/> <!-- taskmgmt.def mapping files --> <mapping resource="org/jbpm/taskmgmt/def/TaskMgmtDefinition.hbm.xml"/> <mapping resource="org/jbpm/taskmgmt/def/Swimlane.hbm.xml"/> <mapping resource="org/jbpm/taskmgmt/def/Task.hbm.xml"/> <mapping resource="org/jbpm/taskmgmt/def/TaskController.hbm.xml"/> <!-- module.def mapping files --> <mapping resource="org/jbpm/module/def/ModuleDefinition.hbm.xml"/> <!-- bytes mapping files --> <mapping resource="org/jbpm/bytes/ByteArray.hbm.xml"/> <!-- file.def mapping files --> <mapping resource="org/jbpm/file/def/FileDefinition.hbm.xml"/> <!-- scheduler.def mapping files --> <mapping resource="org/jbpm/scheduler/def/CreateTimerAction.hbm.xml"/> <mapping resource="org/jbpm/scheduler/def/CancelTimerAction.hbm.xml"/> <!-- graph.exe mapping files --> <mapping resource="org/jbpm/graph/exe/Comment.hbm.xml"/> <mapping resource="org/jbpm/graph/exe/ProcessInstance.hbm.xml"/> <mapping resource="org/jbpm/graph/exe/Token.hbm.xml"/> <mapping resource="org/jbpm/graph/exe/RuntimeAction.hbm.xml"/> <!-- module.exe mapping files --> <mapping resource="org/jbpm/module/exe/ModuleInstance.hbm.xml"/> <!-- context.exe mapping files --> <mapping resource="org/jbpm/context/exe/ContextInstance.hbm.xml"/> <mapping resource="org/jbpm/context/exe/TokenVariableMap.hbm.xml"/> <mapping resource="org/jbpm/context/exe/VariableInstance.hbm.xml"/> <mapping resource="org/jbpm/context/exe/variableinstance/ByteArrayInstance.hbm.xml"/> <mapping resource="org/jbpm/context/exe/variableinstance/DateInstance.hbm.xml"/> <mapping resource="org/jbpm/context/exe/variableinstance/DoubleInstance.hbm.xml"/> <mapping resource="org/jbpm/context/exe/variableinstance/HibernateLongInstance.hbm.xml"/> <mapping resource="org/jbpm/context/exe/variableinstance/HibernateStringInstance.hbm.xml"/> <mapping resource="org/jbpm/context/exe/variableinstance/LongInstance.hbm.xml"/> <mapping resource="org/jbpm/context/exe/variableinstance/NullInstance.hbm.xml"/> <mapping resource="org/jbpm/context/exe/variableinstance/StringInstance.hbm.xml"/> <!-- job mapping files --> <mapping resource="org/jbpm/job/Job.hbm.xml"/> <mapping resource="org/jbpm/job/Timer.hbm.xml"/> <mapping resource="org/jbpm/job/ExecuteNodeJob.hbm.xml"/> <mapping resource="org/jbpm/job/ExecuteActionJob.hbm.xml"/> <!-- taskmgmt.exe mapping files --> <mapping resource="org/jbpm/taskmgmt/exe/TaskMgmtInstance.hbm.xml"/> <mapping resource="org/jbpm/taskmgmt/exe/TaskInstance.hbm.xml"/> <mapping resource="org/jbpm/taskmgmt/exe/PooledActor.hbm.xml"/> <mapping resource="org/jbpm/taskmgmt/exe/SwimlaneInstance.hbm.xml"/> <!-- logging mapping files --> <mapping resource="org/jbpm/logging/log/ProcessLog.hbm.xml"/> <mapping resource="org/jbpm/logging/log/MessageLog.hbm.xml"/> <mapping resource="org/jbpm/logging/log/CompositeLog.hbm.xml"/> <mapping resource="org/jbpm/graph/log/ActionLog.hbm.xml"/> <mapping resource="org/jbpm/graph/log/NodeLog.hbm.xml"/> <mapping resource="org/jbpm/graph/log/ProcessInstanceCreateLog.hbm.xml"/> <mapping resource="org/jbpm/graph/log/ProcessInstanceEndLog.hbm.xml"/> <mapping resource="org/jbpm/graph/log/ProcessStateLog.hbm.xml"/> <mapping resource="org/jbpm/graph/log/SignalLog.hbm.xml"/> <mapping resource="org/jbpm/graph/log/TokenCreateLog.hbm.xml"/> <mapping resource="org/jbpm/graph/log/TokenEndLog.hbm.xml"/> <mapping resource="org/jbpm/graph/log/TransitionLog.hbm.xml"/> <mapping resource="org/jbpm/context/log/VariableLog.hbm.xml"/> <mapping resource="org/jbpm/context/log/VariableCreateLog.hbm.xml"/> <mapping resource="org/jbpm/context/log/VariableDeleteLog.hbm.xml"/> <mapping resource="org/jbpm/context/log/VariableUpdateLog.hbm.xml"/> <mapping resource="org/jbpm/context/log/variableinstance/ByteArrayUpdateLog.hbm.xml"/> <mapping resource="org/jbpm/context/log/variableinstance/DateUpdateLog.hbm.xml"/> <mapping resource="org/jbpm/context/log/variableinstance/DoubleUpdateLog.hbm.xml"/> <mapping resource="org/jbpm/context/log/variableinstance/HibernateLongUpdateLog.hbm.xml"/> <mapping resource="org/jbpm/context/log/variableinstance/HibernateStringUpdateLog.hbm.xml"/> <mapping resource="org/jbpm/context/log/variableinstance/LongUpdateLog.hbm.xml"/> <mapping resource="org/jbpm/context/log/variableinstance/StringUpdateLog.hbm.xml"/> <mapping resource="org/jbpm/taskmgmt/log/TaskLog.hbm.xml"/> <mapping resource="org/jbpm/taskmgmt/log/TaskCreateLog.hbm.xml"/> <mapping resource="org/jbpm/taskmgmt/log/TaskAssignLog.hbm.xml"/> <mapping resource="org/jbpm/taskmgmt/log/TaskEndLog.hbm.xml"/> <mapping resource="org/jbpm/taskmgmt/log/SwimlaneLog.hbm.xml"/> <mapping resource="org/jbpm/taskmgmt/log/SwimlaneCreateLog.hbm.xml"/> <mapping resource="org/jbpm/taskmgmt/log/SwimlaneAssignLog.hbm.xml"/> </session-factory> </hibernate-configuration> ---- edit --- I have already tried the hibernate.transaction.manager_lookup_class to set to the JBoss version (org.hibernate.transaction.JBossTransactionManagerLookup) it did not work...well it's not that suprising...I'll try now: org.hibernate.transaction.OC4JTransactionManagerLookup I tried with CMT instead of JTA, but it didn't work also.

    Read the article

< Previous Page | 5 6 7 8 9