Search Results

Search found 35102 results on 1405 pages for 'text mining'.

Page 43/1405 | < Previous Page | 39 40 41 42 43 44 45 46 47 48 49 50  | Next Page >

  • Collaborative Whiteboard using WebSocket in GlassFish 4 - Text/JSON and Binary/ArrayBuffer Data Transfer (TOTD #189)

    - by arungupta
    This blog has published a few blogs on using JSR 356 Reference Implementation (Tyrus) as its integrated in GlassFish 4 promoted builds. TOTD #183: Getting Started with WebSocket in GlassFish TOTD #184: Logging WebSocket Frames using Chrome Developer Tools, Net-internals and Wireshark TOTD #185: Processing Text and Binary (Blob, ArrayBuffer, ArrayBufferView) Payload in WebSocket TOTD #186: Custom Text and Binary Payloads using WebSocket One of the typical usecase for WebSocket is online collaborative games. This Tip Of The Day (TOTD) explains a sample that can be used to build such games easily. The application is a collaborative whiteboard where different shapes can be drawn in multiple colors. The shapes drawn on one browser are automatically drawn on all other peer browsers that are connected to the same endpoint. The shape, color, and coordinates of the image are transfered using a JSON structure. A browser may opt-out of sharing the figures. Alternatively any browser can send a snapshot of their existing whiteboard to all other browsers. Take a look at this video to understand how the application work and the underlying code. The complete sample code can be downloaded here. The code behind the application is also explained below. The web page (index.jsp) has a HTML5 Canvas as shown: <canvas id="myCanvas" width="150" height="150" style="border:1px solid #000000;"></canvas> And some radio buttons to choose the color and shape. By default, the shape, color, and coordinates of any figure drawn on the canvas are put in a JSON structure and sent as a message to the WebSocket endpoint. The JSON structure looks like: { "shape": "square", "color": "#FF0000", "coords": { "x": 31.59999942779541, "y": 49.91999053955078 }} The endpoint definition looks like: @WebSocketEndpoint(value = "websocket",encoders = {FigureDecoderEncoder.class},decoders = {FigureDecoderEncoder.class})public class Whiteboard { As you can see, the endpoint has decoder and encoder registered that decodes JSON to a Figure (a POJO class) and vice versa respectively. The decode method looks like: public Figure decode(String string) throws DecodeException { try { JSONObject jsonObject = new JSONObject(string); return new Figure(jsonObject); } catch (JSONException ex) { throw new DecodeException("Error parsing JSON", ex.getMessage(), ex.fillInStackTrace()); }} And the encode method looks like: public String encode(Figure figure) throws EncodeException { return figure.getJson().toString();} FigureDecoderEncoder implements both decoder and encoder functionality but thats purely for convenience. But the recommended design pattern is to keep them in separate classes. In certain cases, you may even need only one of them. On the client-side, the Canvas is initialized as: var canvas = document.getElementById("myCanvas");var context = canvas.getContext("2d");canvas.addEventListener("click", defineImage, false); The defineImage method constructs the JSON structure as shown above and sends it to the endpoint using websocket.send(). An instant snapshot of the canvas is sent using binary transfer with WebSocket. The WebSocket is initialized as: var wsUri = "ws://localhost:8080/whiteboard/websocket";var websocket = new WebSocket(wsUri);websocket.binaryType = "arraybuffer"; The important part is to set the binaryType property of WebSocket to arraybuffer. This ensures that any binary transfers using WebSocket are done using ArrayBuffer as the default type seem to be blob. The actual binary data transfer is done using the following: var image = context.getImageData(0, 0, canvas.width, canvas.height);var buffer = new ArrayBuffer(image.data.length);var bytes = new Uint8Array(buffer);for (var i=0; i<bytes.length; i++) { bytes[i] = image.data[i];}websocket.send(bytes); This comprehensive sample shows the following features of JSR 356 API: Annotation-driven endpoints Send/receive text and binary payload in WebSocket Encoders/decoders for custom text payload In addition, it also shows how images can be captured and drawn using HTML5 Canvas in a JSP. How could this be turned in to an online game ? Imagine drawing a Tic-tac-toe board on the canvas with two players playing and others watching. Then you can build access rights and controls within the application itself. Instead of sending a snapshot of the canvas on demand, a new peer joining the game could be automatically transferred the current state as well. Do you want to build this game ? I built a similar game a few years ago. Do somebody want to rewrite the game using WebSocket APIs ? :-) Many thanks to Jitu and Akshay for helping through the WebSocket internals! Here are some references for you: JSR 356: Java API for WebSocket - Specification (Early Draft) and Implementation (already integrated in GlassFish 4 promoted builds) Subsequent blogs will discuss the following topics (not necessary in that order) ... Error handling Interface-driven WebSocket endpoint Java client API Client and Server configuration Security Subprotocols Extensions Other topics from the API

    Read the article

  • Issue with text in a Intel 82945G Express Chipset Family

    - by user34681
    I am on Ubuntu 11.04 and the text in all the applications often looks with visual artifacts. I have installed xserver-xorg-video-intel. Attached a image so you can appreciate. lshw -c video output: *-display description: VGA compatible controller product: 82945G/GZ Integrated Graphics Controller vendor: Intel Corporation physical id: 2 bus info: pci@0000:00:02.0 version: 02 width: 32 bits clock: 33MHz capabilities: msi pm vga_controller bus_master cap_list rom configuration: driver=i915 latency=0 resources: irq:16 memory:dfe00000-dfe7ffff ioport:8800(size=8) memory:e0000000-efffffff memory:dfe80000-dfebffff In the text selected in green you can see the 'Online', 'File' and 'hassle' words cut.

    Read the article

  • Distorted text in programs

    - by Teneff
    I've installed Ubuntu 11 with gnome and in some point the text in the programs becomes unreadable like this. It's not only the text, but even the desktop background looks awful. I've tried to add section in xorg.conf, but it didn't helped out. Section "Device" Identifier "g33/X3000" Driver "intel" BusID "PCI:0:2:0" Option "ModeDebug" "on" Option "MonitorLayout" "LCD,VGA" Option "DevicePresence" "true" EndSection And this is what the lshw returns about the VGA *-display description: VGA compatible controller product: 82945G/GZ Integrated Graphics Controller vendor: Intel Corporation physical id: 2 bus info: pci@0000:00:02.0 version: 02 width: 32 bits clock: 33MHz capabilities: msi pm vga_controller bus_master cap_list rom configuration: driver=i915 latency=0 resources: irq:16 memory:dfe00000-dfe7ffff ioport:8800(size=8) memory:e0000000-efffffff memory:dfe80000-d$

    Read the article

  • How to remove text from file icons ?

    - by Jesse
    I am fairly new to Ubuntu (Linux). I noticed when creating a .java file or .py gives me an icon, however when I start writing code it overrides the thumbnail into showing text. Is there a way to disable this silly feature ? When I installed Linux Mint on the VM I noticed I was able to accomplish this task by unchecking "Show text in icon". I know they use Namo as their file manager. I read this thread and it did not work. How to stop Nautilus from creating thumbnails of specific file types?

    Read the article

  • Link two or more text boxes in Visio

    - by Dan
    I am working on creating a template in Visio 2007 (Professional). Each page should reflect a document number and a revision number (two text boxes). I would like to make the template such that entering or changing text in one of these boxes on one page will automatically update the equivalent text boxes on all other pages. Is there an easy way to link two (or more) text boxes to show the same data (mirror each other)? I've looked into creating a ShapeData set and then using the ShapeData field in place of each box, but this will require training others to access and adjust the ShapeData field. In short - I want the issue that was attempting to be solved in Changing Text in Visio Org Chart Shape Changes Multiple Shapes' Text .

    Read the article

  • Address search from large text file

    - by user73809
    Basically I want to develop a Address lookup(part of my project) using C# (and I can use SQL if necessary). I have a very large text file which have all the UK address and postcodes. Addresses needs to be looked up from this text file. For example, as soon as a user type in the first letter of the postcode it should list all the postcodes starting with that letter and as they type in further, the list should narrow down. Could you guys please how I can do this search very fast and list the results in a efficient way. If you guys know any methods and technologies pls do advice.

    Read the article

  • Writing long line support for text editor

    - by Mathematician82
    I know that some some text editors have problems to show long lines https://bugzilla.gnome.org/show_bug.cgi?id=172099 . What is the best way to fix the bug or are they equally well? Modify the GTK+ source code and add a support for long lines. Modify the text editor source code such that it does not use GTK+ if it meets a long line. Split the long lines into part (maybe by cut on the Bash ) I'm just a junior programmer so I don't know what people does when they meet a bug that is on the library they use.

    Read the article

  • Is there a difference between plain text emails, and multipart emails with only plain text?

    - by Brian Armstrong
    I'm using Rails to send emails and I just want to send a plain text email (there is no corresponding HTML part). I've noticed that if I just have one file named email.text.plain.erb it actually generates a multipart email with one part (the plain text part) like this: Content-Type: multipart/alternative; boundary=mimepart_4c04a2d34c4bb_690a4e56b0362 --mimepart_4c04a2d34c4bb_690a4e56b0362 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: Quoted-printable Content-Disposition: inline text of the email here... --mimepart_4c04a2d34c4bb_690a4e56b0362-- But if I take out the text.plain part and name it email.erb ActionMailer generates a regular plain text email without multipart like this: Content-Type: text/plain; charset=utf-8 text of the email here... Both work fine most of the time (so this is kind of nitpicky), but I guess my question is whether the second one is more correct. My goal here is just to make sure deliverability is as high as possible across a wide variety of devices and email clients. I've read that plain text emails can have slightly better deliverability rates than html and was just curious if throwing in this multipart (even if it only contained a plain text part) might throw off some of the dumber email clients. Thanks for your help!

    Read the article

  • error insert text in papervision typography class

    - by safeDomain
    hi evryone , i am encounter with a small problem i want to make a 3d rtl text animation with papervision this code generet a problem to this : [Fault] exception, information=TypeError: Error #1009: Cannot access a property or method of a null object reference. but when using a english text this error dont genereta my code : package { import flash.display.Sprite; import flash.events.Event; import org.papervision3d.scenes.Scene3D import org.papervision3d.view.Viewport3D import org.papervision3d.cameras.Camera3D import org.papervision3d.render.BasicRenderEngine import org.papervision3d.typography.Font3D import org.papervision3d.typography.fonts.HelveticaBold import org.papervision3d.typography.Text3D import org.papervision3d.materials.special.Letter3DMaterial import flash.text.engine.FontDescription import flash.text.engine.ElementFormat import flash.text.engine.TextElement import flash.text.engine.TextBlock import flash.text.engine.TextLine /** * ... * @author vahid */ public class Main extends Sprite { private var fd:FontDescription private var ef:ElementFormat private var te:TextElement protected var st:String; private var scene:Scene3D private var view:Viewport3D private var camera:Camera3D private var render:BasicRenderEngine private var vpWidth:Number = stage.stageWidth; private var vpHeight:Number = stage.stageHeight; private var text3d:Text3D private var font3d:Font3D //private var font:HelveticaBold private var textMaterial:Letter3DMaterial private var text:String public function Main():void { if (stage) init(); else addEventListener(Event.ADDED_TO_STAGE, init); } private function init(e:Event = null):void { removeEventListener(Event.ADDED_TO_STAGE, init); // rtl block fd = new FontDescription () ef = new ElementFormat (fd) te = new TextElement ("?????? ?????? ???? ?????? ?? papervision", ef) text = te.text //3d block scene = new Scene3D () view = new Viewport3D (vpWidth,vpHeight,true,true,false,false) camera = new Camera3D () render = new BasicRenderEngine() addChild (view) this.addEventListener (Event.ENTER_FRAME , renderThis) textMaterial = new Letter3DMaterial(0xFF0000,1) font3d = new HelveticaBold() text3d = new Text3D (text, font3d, textMaterial) scene.addChild (text3d) } protected function renderThis(e:Event):void { text3d.rotationY +=5 render.renderScene(scene,camera,view) } } } i am using flashdevelop. please help me thank's

    Read the article

  • After Adding "readonly" attribute on text box not able to remove it in one event

    - by Sreedhar K
    Steps to repro USE Internet Explorer Check unlimited check box Click on text box (It will remove tick/check from check box) Try to enter text in text box We cannot enter in the text box 4. Click again on the text box. Now we will be able to enter text in the text box We tried by 1. Making attribute readOnly to flase i.e. $('#myinput').attr('readOnly', false); 2. Calling $('#myinput').click(); Below is the HTML code <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Make input read only</title> <script type="text/javascript" src="http://ajax.microsoft.com/ajax/jquery/jquery-1.4.4.min.js"></script> </head> <body> <input id="myinput" type="text" /> <input id="mycheck" type="checkbox" /> <script type="text/javascript"> /*oncheck box click*/ $('#mycheck').click(function () { if ($(this).attr('checked')) { $('#myinput').attr('readOnly', 'readOnly'); } else { $('#myinput').removeAttr('readOnly'); /* also tried * $('#myinput').attr('readOnly', false); * $('#myinput').attr('readOnly', ''); */ } }); /*on text box click*/ $('#myinput').click(function () { $('#mycheck').removeAttr('checked'); $('#myinput').removeAttr('readOnly'); /* also tried * $('#myinput').attr('readOnly', false); * $('#myinput').attr('readOnly', ''); */ }); </script> </body> </html> Live copy

    Read the article

  • How to start matching and saving matched from exact point in a text

    - by yuliya
    I have a text and I write a parser for it using regular expressions and perl. I can match what I need with two empty lines (I use regexp), because there is a pattern that allows recognize blocks of text after two empty lines. But the problem is that the whole text has Introduction part and some text in the end I do not need. Here is a code which matches text when it finds two empty lines #!/usr/bin/perl use strict; use warnings; my $file = 'first'; open(my $fh, '<', $file); my $empty = 0; my $block_num = 1; open(OUT, '>', $block_num . '.txt'); while (my $line = <$fh>) { chomp ($line); if ($line =~ /^\s*$/) { $empty++; } elsif ($empty == 2) { close(OUT); open(OUT, '>', ++$block_num . '.txt'); $empty = 0; } else { $empty = 0;} print OUT "$line\n"; } close(OUT); This is example of the text I need (it's really small :)) this is file example I think that I need to iterate over the text till the moment it will find the word LOREM IPSUM with regexps this kind "/^LOREM IPSUM/", because it is the point from which needed text starts(and save the text in one file when i reach the word). And I need to finish iterating over the text when INDEX word is fount or save the text in separate file. How could I implement it. Should I use next function to proceed with lines or what? BR, Yuliya

    Read the article

  • c# warn if text box is empty or contains a non-whole number

    - by Jamaul Smith
    In my specific case, I need the value in propertyPriceTextBox to be numeric only, and a whole number. A value also has to be entered, and I can just Messagebox.Show() a warning and that's all I'd need to do. This is what I have so far. private void computeButton_Click(object sender, EventArgs e) { decimal propertyPrice; if ((decimal.TryParse(propertyPriceTextBox.Text, out propertyPrice))) decimal.Parse(propertyPriceTextBox.Text); { if (residentialRadioButton.Checked == true) commisionLabel.Text = (residentialCom * propertyPrice).ToString("c"); if (commercialRadioButton.Checked == true) commisionLabel.Text = (commercialCom * propertyPrice).ToString("c"); if (hillsRadioButton.Checked == true) countySalesTaxTextBox.Text = ( hilssTax * propertyPrice).ToString("c"); if (pascoRadioButton.Checked == true) countySalesTaxTextBox.Text = (pascoTax * propertyPrice).ToString("c"); if (polkRadioButton.Checked == true) countySalesTaxTextBox.Text = (polkTax * propertyPrice).ToString("c"); decimal result; result = (countySalesTaxTextBox.Text + stateSalesTaxTextBox.Text + propertyPriceTextBox.Text + comissionTextBox.Text).ToString("c"); } else (.) MessageBox.Show("Property Price must be a whole number."); }

    Read the article

  • Is C# development effectively inseparable from the IDE you use?

    - by Ghopper21
    I'm a Python programmer learning C# who is trying to stop worrying and just love C# for what it is, rather than constantly comparing it back to Python. I'm really get caught up on one point: the lack of explicitness about where things are defined, as detailed in this Stack Overflow question. In short: in C#, using foo doesn't tell you what names from foo are being made available, which is analogous to from foo import * in Python -- a form that is discouraged within Python coding culture for being implicit rather than the more explicit approach of from foo import bar. I was rather struck by the Stack Overflow answers to this point from C# programmers, which was that in practice this lack of explicitness doesn't really matter because in your IDE (presumably Visual Studio) you can just hover over a name and be told by the system where the name is coming from. E.g.: Now, in theory I realise this means when you're looking with a text editor, you can't tell where the types come from in C#... but in practice, I don't find that to be a problem. How often are you actually looking at code and can't use Visual Studio? This is revelatory to me. Many Python programmers prefer a text editor approach to coding, using something like Sublime Text 2 or vim, where it's all about the code, plus command line tools and direct access and manipulation of folders and files. The idea of being dependent on an IDE to understand code at such a basic level seems anathema. It seems C# culture is radically different on this point. And I wonder if I just need to accept and embrace that as part of my learning of C#. Which leads me to my question here: is C# development effectively inseparable from the IDE you use?

    Read the article

  • SQL 05 full-text query fails "Specified module could not be found."

    - by Dan Bailiff
    I'm running SQL 2005 on Windows XP. I have a database table that has full text searching enabled. I was able to build and even re-build the index. However, when I try to query it like this: Select * from fulltext_english WHERE CONTAINS(page_data, 'causes') I get this error: Msg 7619, Level 16, State 1, Line 1 The execution of a full-text query failed. "The specified module could not be found." Did I miss something on the install? Is this a dll issue? I've googled and binged for days and can't find anything similar to this message. Thanks!

    Read the article

  • Changing the Settings item description text color in Android?

    - by Cori
    I use a Samsung Vibrant, and one of the annoying bits that Samsung tossed on their TouchWiz skin was changing the color of the Settings menu item description text from white (AOSP) to light blue. This looks okay as long as the skin is bluey-themed, but most ROMs seem to be leaning toward Gingerbread clones... doesn't look good with the green. How can I change that settings description font color back to white, or even the orange it is in actual Android 2.3? Which xml file is the color property located in? It seems to also spread to all apps you install, too... the blue text.

    Read the article

  • what is a fast way to output h5py dataset to text?

    - by user362761
    I am using the h5py python package to read files in HDF5 format. (e.g. somefile.h5) I would like to write the contents of a dataset to a text file. For example, I would like to create a text file with the following contents: 1,20,31,75,142,324,78,12,3,90,8,21,1 I am able to access the dataset in python using this code: import h5py f = h5py.File('/Users/Me/Desktop/thefile.h5', 'r') group = f['/level1/level2/level3'] dset = group['dsetname'] My naive approach is too slow, because my dataset has over 20000 entries: # write all values to file for index in range(len(dset)): # do not add comma after last value if index == len(dset)-1: txtfile.write(repr(dset[index])) else: txtfile.write(repr(dset[index])+',') txtfile.close() return None Is there a faster way to write this to a file? Perhaps I could convert the dataset into a NumPy array or even a Python list, and then use some file-writing tool? (I could experiment with concatenating the values into a larger string before writing to file, but I'm hoping there's something entirely more elegant)

    Read the article

  • Bash: any command to replace strings in text files?

    - by mikez302
    I have a hierarchy of directories containing many text files. I would like to search for a particular text string every time it comes up in one of the files, and replace it with another string. For example, I may want to replace every occurrence of the string "Coke" with "Pepsi". Does anyone know how to do this? I am wondering if there is some sort of Bash command that can do this without having to load all these files in an editor, or come up with a more complex script to do it. I found this page explaining a trick using sed, but it doesn't seem to work in files in subdirectories.

    Read the article

  • Is there a Windows utility that will let me do multiple programmatic find/replaces on text that I cu

    - by billmaya
    I've inherited some C# code that contains about a thousand lines of source that I need to modify, transforming it from this: newDataRow["to_dir"] = comboBox108.Text; To this: assetAttributes.Add("to_dir", comboBox108.Text); The lines occur in various places throughout the application in groups of 40 or 50. Modifying each line by hand in Visual Studio 2008 can be done but it's labor intensive and prone to errors. Is there a Windows utility out there that will let me cut and paste groups of code into it and then run some sort of reg-ex expression to transform the individual lines one-by-one? I'd also be willing to use some sort of VS 2008 add-in that performed the same set of reg-ex operations against a selection of code. Thanks in advance.

    Read the article

  • How to stop jQuery from returning tabs and spaces from formated code on .html() .val() .text() etc.

    - by brandonjp
    I've got an html table: <table><tr> <td>M1</td> <td>M2</td> <td>M3</td> <td>M4</td> </tr></table> and a simple jQ script: $('td').click(function(){ alert( $(this).html() ); }); That works just fine.... but in the real world, I've got several hundred table cells and the code is formatted improperly in places because of several people editing the page. So if the html is: <td> M1 </td> then the alert() is giving me all the tabs and returns and spaces: What can I do to get ONLY the text without the tabs and spaces? I've tried .html(), .val(), .text() to no avail. Thanks!

    Read the article

< Previous Page | 39 40 41 42 43 44 45 46 47 48 49 50  | Next Page >