Search Results

Search found 124 results on 5 pages for 'raphael k'.

Page 2/5 | < Previous Page | 1 2 3 4 5  | Next Page >

  • How to reapper the sphere shape of SVG tag code by Raphael description exactly?

    - by TelTel
    I'm trying to figure a Raphael.js shape(sphere) which is based on following SVG tag code. I have succeed in basic similar sphere style by the description : Paper.circle(100, 100, 30).attr({ fill: "r(0.35, 0.25)#FFFFFF-#252525:96-#000000", stroke: "none"}); // radius is 30 But I can't reappear exactly. --- [picture] ** The tag code of sphere ... main part is extracted ** <g id="layer1"> <radialGradient id="path5725_3_" cx="156.0352" cy="657.6802" r="200.0004" gradientTransform="matrix(1.0404 0.7962 0.8145 -1.0643 -531.7884 745.2471)" gradientUnits="userSpaceOnUse"> <stop offset="0" style="stop-color:#FFFFFF"/> <stop offset="1" style="stop-color:#000000"/> </radialGradient> <path id="path5725" fill="url(#path5725_3_)" d="M445.037,229.105c0,113.218-89.543,205-200,205c-110.457, 0-200-91.782-200-205s89.543-205,200-205C355.494, 24.105,445.037,115.887,445.037,229.105z"/> </g> ** ---------------------------------------- ** Here the completed picture of tag code is linked. How to describe(modify) the Raphael.js code to reappear the picture ? Thank you.

    Read the article

  • Raphael how to get last path and last circle, if i have 2 elements in the paper?

    - by 3gwebtrain
    I need to find the last path or circle in a paper, in order to perform further calculations to draw more elements, and calling 'paper.bottom' only gets the last element. Is there any way to get shapes of specific types, e.g. bottom.path, bottom.circle or traverse for the n'th child? I want to avoid using jQuery selectors, as i can't retrieve any properties from those. An example of a paper populated with shapes: var paper = Raphael('paper',500,500); var c1 = paper.circle(100,100,50) var p1 = paper.path("M10 20l70 0") var c2 = paper.circle(200,100,50)

    Read the article

  • How to animate a path like it's being drawn, dot by dot? (Raphael.js)

    - by Anton
    How to animate a vector path like it's being drawn by hand? In other words, slowly show the path pixel by pixel. I'm using Raphaël.js, but if your answer is not library specific—like maybe there's some general programming pattern for doing that kind of thing (I'm fairly new to vector animation)—it's welcome! Update I know it's easy to do with straight paths, as easy as an example on that page:: path("M114 253").animate({path: "M114 253 L 234 253"}); But try to change code on that page, say, this way:: path("M114 26").animate({path: "M114 26 C 24 23 234 253 234 253"}); And you'll see what I mean. Path is certainly animated from it initial state (point "M114 26") to the end state (curve "C 24 23 234 253 234 253" starting on point "M114 26"), but not in a way specified in question, not like it's being drawn. (Sorry for not making clear from the start that I don't mean animating straight lines.) I don't see how animateAlong can do that either. It can animate an object along a path, and how can I make this path to gradually show itself while object is being animated along it?

    Read the article

  • problem drawing gRaphaeljs pie chart

    - by Aswad
    Hi, I was trying to draw the raphaeljs piechart. I used the same example as shown on "http://g.raphaeljs.com/piechart2.html". It renders me the text but the pie charts goes missing.Can someone please help? please find the code below. g·Raphaël Dynamic Pie Chart Demo window.onload = function () { var r = Raphael("holder"); r.g.txtattr.font = "12px 'Fontin Sans', Fontin-Sans, sans-serif"; r.g.text(320, 100, "Interactive Pie Chart Demo").attr({"font-size": 20}); var pie = r.g.piechart(320, 240, 100, [55, 20, 13, 32, 5, 1, 2, 10], {legend: ["%%.%% – Enterprise Users", "IE Users"], legendpos: "west", href: ["http://raphaeljs.com", "http://g.raphaeljs.com"]}); pie.hover(function () { this.sector.stop(); this.sector.scale(1.1, 1.1, this.cx, this.cy); if (this.label) { this.label[0].stop(); this.label[0].scale(1.5); this.label[1].attr({"font-weight": 800}); } }, function () { this.sector.animate({scale: [1, 1, this.cx, this.cy]}, 500, "bounce"); if (this.label) { this.label[0].animate({scale: 1}, 500, "bounce"); this.label[1].attr({"font-weight": 400}); } }); }; </script> </head> <body class="raphael" id="g.raphael.dmitry.baranovskiy.com"> <div id="holder"></div> <p> Pie chart with legend, hyperlinks on two first sectors and hover effect. </p> <p> Demo of <a href="http://g.raphaeljs.com/">g·Raphaël</a> JavaScript library. </p> </body>

    Read the article

  • Raphaeljs animation kills my browser

    - by user1688606
    I have this code where I have a made a character using 20 paths and put it into a set. Now when I animate the set, the first transformation runs smoothly, the second animation stutters, the third animation doesn't happen as it should and the 4th animation kills my pc, the browser hangs and in the task manager I can see that it consumes up to 70% of CPU. How can I avoid this and free the resources so all the animations run smoothly. *I have to execute 10 simple y-axis transformation animations on that character. JS Fiddle window.onload = function(){ var paper = Raphael(0,0,400,400); var character = paper.set(); paper.setStart(); var attr = {fill:'red',stroke:'none'}; var shape = paper.rect(100,100,10,20).attr(attr); var shape = paper.rect(100,100,10,20).attr(attr); var shape = paper.rect(100,100,10,20).attr(attr); var shape = paper.rect(100,100,10,20).attr(attr); var shape = paper.rect(100,100,10,20).attr(attr); var shape = paper.rect(100,100,10,20).attr(attr); var shape = paper.rect(100,100,10,20).attr(attr); var shape = paper.rect(100,100,10,20).attr(attr); var shape = paper.rect(100,100,10,20).attr(attr); var shape = paper.rect(100,100,10,20).attr(attr); var shape = paper.rect(100,100,10,20).attr(attr); var shape = paper.rect(100,100,10,20).attr(attr); var shape = paper.rect(100,100,10,20).attr(attr); var shape = paper.rect(100,100,10,20).attr(attr); var shape = paper.rect(100,100,10,20).attr(attr); var shape = paper.rect(100,100,10,20).attr(attr); var shape = paper.rect(100,100,10,20).attr(attr); var shape = paper.rect(100,100,10,20).attr(attr); var shape = paper.rect(100,100,10,20).attr(attr); var shape = paper.rect(100,100,10,20).attr(attr); var character = paper.setFinish(); character.transform("t0,200") //1st animation.. var chartrnsfrm = Raphael.animation({ transform:'...t0,-48' },1000,"easeout",function(){ character.animate(chartrnsfrm1.delay(2000)) }); character.animate(chartrnsfrm.delay(2000)); //2nd animation.. var chartrnsfrm1 = Raphael.animation({ transform:'...t0,-48' },1000,"easeout",function(){ character.animate(chartrnsfrm2.delay(2000)) }); //3rd animation.. var chartrnsfrm2 = Raphael.animation({ transform:'...t0,-48' },1000,"easeout",function(){ character.animate(chartrnsfrm3.delay(2000)) }); //4th animation.. var chartrnsfrm3 = Raphael.animation({ transform:'...t0,-48' },1000,"easeout"); }

    Read the article

  • Problems with animateAlong in IE7

    - by Andrei
    Hi there, I'm having trouble making a simple shape move along a path in IE7 (the only version of IE I tried, actually). The following code works fine in chrome and firefox, but not IE. I couldn't find an obvious reason, has anybody seen something similar? canvas.path(rPath.path).attr("stroke", "blue"); var circle = canvas.circle(rPath.startX, rPath.startY, 5); circle.animateAlong(rPath.path, 3000, true); My rPath variable has the path and the starting point coordinates. Microsoft script debugger points to this line as the one where the code breaks: os.left != (t = x - left + "px") && (os.left = t); (line 2131 inside the uncompressed raphael.js script file, inside Element[proto].setBox = function (params, cx, cy) {...}) Any ideas? Any experience (good or bad) with raphael's animateAlong in IE7? TIA, Andrei

    Read the article

  • How to catch mousewheel up/down event using RaphaelJs

    - by alex.dominte
    I need to implement a horizontal scrollable timeline. I've drawn the timeline/grids/rulers etc. I just need to catch mousewheel up/down to scroll the timeline (backward - past/forward - future). First I need to catch the event: but nothing I've found seems to work. Need browser support only for chrome/firefox (latest versions). These 2 won't listeners won't work: var paper = new Raphael('raphael-paper'); // ... paper.canvas.on('mousewheel', function(event) { console.log(event); }); // ... paper.canvas.addEventListener('mousewheel', function(event) { console.log(event); });

    Read the article

  • Added key, but still getting "gpg: Can't check signature: public key not found"

    - by gertvdijk
    Trying to download Django source package using dget and the .dsc file from here. Then dget fails to verify the source, because it is missing a public key. $ dget https://launchpad.net/ubuntu... [...] dscverify: python-django_1.4.1-2.dsc failed signature check: gpg: Signature made Tue 21 Aug 2012 09:12:04 CEST using RSA key ID F2AC729A gpg: Can't check signature: public key not found Validation FAILED!! Fine, I added this key to my keyring, because I think I can trust this one: $ gpg --keyserver keyserver.ubuntu.com --recv-key 0xF2AC729A gpg: requesting key F2AC729A from hkp server keyserver.ubuntu.com gpg: key F2AC729A: "Raphaël Hertzog <[email protected]>" not changed gpg: Total number processed: 1 gpg: unchanged: 1 (well, this output is run afterwards, when it was already in my keyring) And it is really there: $ gpg --fingerprint F2AC729A pub 4096R/F2AC729A 2009-05-07 Key fingerprint = 3E4F B711 7877 F589 DBCF 06D6 E619 045D F2AC 729A uid Raphaël Hertzog <[email protected]> uid Raphaël Hertzog (Debian) <[email protected]> uid Raphaël Hertzog (Freexian SARL) <[email protected]> sub 2048R/71F23DEE 2009-05-07 But still fails for the same reason: gpg: Signature made Tue 21 Aug 2012 09:12:04 CEST using RSA key ID F2AC729A gpg: Can't check signature: public key not found I'm running all these commands as my regular user. I also tried adding this key to APT's keyring and root's keyring. Both to no avail. What am I missing here?

    Read the article

  • SVG text parameter changing on conversion to image uri : random dy on tspan element

    - by Kitex
    Sorry that I could not compile jsfiddle because it's jsf application hosted locally and code is dependent on data from jsf application. Although I have arrange part of it and part if it as snippet here. Now Everything's correct in Firefox. Suddenly when I open it in chrome something happened. The text on raphael paper suddenly gets scattered in the paper. It's not where it's meant to be. This happens when I convert svg to image and again generate svg. Everything works fine in Firefox. There is chagne id dy of tspan dy=3.09499999 dy=432.0949999999999 Why is there this change in dy although x and y are same? SVG Correct: The fiddle is here. SVG Incorrect: The fiddle is here. function printMap(){ var svg = $('#map').html().replace(/>\s+/g, ">").replace(/\s+</g, "<"); // strips off all spaces between tags canvg('cvs', svg, { ignoreMouse: true, ignoreAnimation: true }); var canvas = document.getElementById('cvs'); var img = canvas.toDataURL("image/png"); $("#resImg").attr("src",img); $("#resImg").css("display",'block'); //$("resImg").css("display",'none'); $("#map").css("display",'none'); // location.href = img; } Before: Text are above the object: After: Texts are scattered:

    Read the article

  • Meteor: how to update DOM via Javascript without a page refresh?

    - by strack
    UPDATE: It looks like this script may be the catalyst I'm looking for. Will test it and answer/close this question if so. I'm sure I'll find the answer to this eventually, but I'm putting it out there now, in case someone else knows it right off... I am using RaphaelJS to manipulate the DOM (adds a bunch of SVG tags to an identified DIV), and I want to re-render those specific DOM parts, if there's an update to the MongoDB collection. As an example: -Let's say that I have a collection called PiePieces. -When the page is first rendered/ called, let's pretend that the number of pieces in the collection is 4. -I programmatically add a pie piece using console: PiePieces.insert({...}) -I want the page to update like it would for a standard handlebars binding situation, but the problem is, the new entry needs to go through the Raphael script, which performs direct DOM manipulation. So, the logic would go something like this: MongoDB collection update event - Client function call to manipulate DOM - DOM modified/ page updated without a refresh. I've tried implementing this by reading values from the DOM itself, and I can get the updated DOM, but the entire page refreshes and/or I have to manually refresh the page, OR the DOM tree isn't completed yet, and so it's blank until I refresh. Can you point me in the right direction, maybe with a small code snippet/example? (if something similar already exists, just tell me where and I'll go digging) Thanks in advance! (I am LOVING Meteor so far...)

    Read the article

  • How to call a set of variables functions based on class on a group of elements

    - by user1547007
    I have the following html code: <i class="small ele class1"></i> <i class="medium ele class1"></i> <i class="large ele class1"></i> <div class="clear"></div> <i class="small ele class2"></i> <i class="medium ele class2"></i> <i class="large ele class2"></i> <div class="clear"></div> <i class="small ele class3"></i> <i class="medium ele class3"></i> <i class="large ele class3"></i> <div class="clear"></div> <i class="small ele class4"></i> <i class="medium ele class4"></i> <i class="large ele class4"></i>? And my javascript looks like so: var resize = function(face, s) { var bb = face.getBBox(); console.log(bb); var w = bb.width; var h = bb.height; var max = w; if (h > max) { max = h; } var scale = s / max; var ox = -bb.x+((max-w)/2); var oy = -bb.y+((max-h)/2); console.log(s+' '+h+' '+bb.y); face.attr({ "transform": "s" + scale + "," + scale + ",0,0" + "t" + ox + "," + oy }); } $('.ele').each(function() { var s = $(this).innerWidth(); var paper = Raphael($(this)[0], s, s); var face = $(this).hasClass("class1") ? class1Generator(paper) : class4Generator(paper); /*switch (true) { case $(this).hasClass('class1'): class1Generator(paper); break; case $(this).hasClass('class2'): class2Generator(paper) break; case $(this).hasClass('class3'): class3Generator(paper) break; case $(this).hasClass('class4'): class4Generator(paper) break; }*/ resize(face, s); }); my question is, how could I make this line of code more scalable? I tried using a switch but The script below is calling two functions if one of the elements has a class, but what If i have 10 classes? I don't think is the best solution I created a jsFiddle http://jsfiddle.net/7uUgz/6/ //var face = $(this).hasClass("awesome") ? awesomeGenerator(paper) : awfulGenerator(paper);

    Read the article

  • Using Ruby Hash instead of Rails ActiveRecord in Coffeescript / Morris.JS

    - by Vanessa L'olzorz
    I'm following the Railscast #223 that introduced Morris.JS. I generate a data set called @orders_yearly in my controller and in my view I have the following to try and render the graph: <%= content_tag :div, "", id: "orders_chart", data: {orders: @orders_yearly} %> Calling @orders_yearly.inspect shows it's just a simple hash: {2009=>1000, 2010=>2000, 2011=>4000, 2012=>100000} I'll need to modify the values for xkey and ykeys in coffeescript to work, but I'm not sure how to make it work with my data set: jQuery -> Morris.Line element: 'orders_chart' data: $('#orders_chart').data('orders') xkey: 'purchased_at' # <------------------ replace with what? ykeys: ['price'] # <---------------------- replace with what? labels: ['Price'] Anyone have any ideas? Thanks!

    Read the article

  • Define variable in variable/parameter and use in javascript?

    - by Ross
    I want to defined a variable/parameter in CSS and access it by javascript. What is the best way of doing this? One option I thought of would be to place a cutsom attribute on the body element, then access that attribute via jQuery. A little more info: I'm defining colour sets in CSS. I've created a function with RaphaelJS to draw a gradient background on the page. I want this function to use a highlight colour (which is not used elsewhere on the DOM) which will be defined in the CSS along with the other colour elements. Thanks

    Read the article

  • How to fix javascript and raphaeljs memory leak?

    - by luc
    Hello all, I have the following code using RapahelJs running in IE. This code cause a memory leak and I don't know what is wrong. Does anybody can help me and give some advices in the usage of raphaeljs and memory leaks. for (i=0; i<2000; i++) { var r = paper.rect(100, 100, 30, 30); r.remove(); r = null; } Thanks in advance

    Read the article

  • SVG drawing application with vector export

    - by Bram Jetten
    I want to create a drawing application where I can place text and images on a canvas. Those elements also need to be interactively manipulated. Eventually the resulting canvas has to be exported to a vector based PDF. An excellent contender for this functionality would be SVG. However, this application also needs to be crossbrowser compatible. I've been browsing around for some time now and have seen a couple of solutions available. I found among others RaphaelJS and Google's SVGWeb for working with SVG. Now for converting those SVG files to a PDF I'm not sure if for instance Batik will offer me what I am looking for. Also, how would bitmap images be handled when converting the SVG to PDF?

    Read the article

  • nextSibling difference between IE and FF?

    - by Ahmet Yildirim
    Hi fellows, I just wrote a javascript code for layering in raphaeljs it works perfectly on FF. But it doesn't on IE. The problem is IE returns null for nextSibling for any object. How does one use it correctly, or is there a nextElementSibling call in IE? Here is the code fragment I used to change the order of objects: n = items[selected_item_id].nextSibling.id; if (n != '') { items[selected_item_id].insertAfter(items[n]); } <div id="consarea"> <svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="100%" height="100%"> <desc>Created with Raphaël</desc> <defs/> <rect x="188" y="100" width="200" height="200" r="10" rx="10" ry="10" fill="#ee8515" stroke="none" style="opacity: 1;" opacity="1"/> <rect x="253" y="158" width="50" height="50" r="0" rx="0" ry="0" fill="#0080ff" stroke="none" style="opacity: 1;" opacity="1" id="0"/> <rect x="230" y="140" width="50" height="50" r="0" rx="0" ry="0" fill="#c03022" stroke="none" style="opacity: 1;" opacity="1" id="1"/></svg> here it is above. the piece of the html im working on

    Read the article

  • RaphaelJS HTML5 Library pathIntersection() bug or alternative optimisation (screenshots)

    - by user1236048
    I have a chart generated using RaphaelJS library. It is just on long path: M 50 122 L 63.230769230769226 130 L 76.46153846153845 130 L 89.6923076923077 128 L 102.92307692307692 56 L 116.15384615384615 106 L 129.3846153846154 88 L 142.6153846153846 114 L 155.84615384615384 52 L 169.07692307692307 30 L 182.3076923076923 62 L 195.53846153846152 130 L 208.76923076923077 74 L 222 130 L 235.23076923076923 66 L 248.46153846153845 102 L 261.6923076923077 32 L 274.9230769230769 130 L 288.15384615384613 130 L 301.38461538461536 32 L 314.6153846153846 86 L 327.8461538461538 130 L 341.07692307692304 70 L 354.30769230769226 130 L 367.53846153846155 102 L 380.7692307692308 120 L 394 112 L 407.2307692307692 68 L 420.46153846153845 48 L 433.6923076923077 92 L 446.9230769230769 128 L 460.15384615384613 110 L 473.38461538461536 78 L 486.6153846153846 130 L 499.8461538461538 56 L 513.0769230769231 116 L 526.3076923076923 80 L 539.5384615384614 58 L 552.7692307692307 40 L 566 130 L 579.2307692307692 94 L 592.4615384615385 64 L 605.6923076923076 122 L 618.9230769230769 98 L 632.1538461538461 120 L 645.3846153846154 70 L 658.6153846153845 82 L 671.8461538461538 76 L 685.0769230769231 124 L 698.3076923076923 110 L 711.5384615384615 94 L 724.7692307692307 130 L 738 130 L 751.2307692307692 66 L 764.4615384615385 118 L 777.6923076923076 70 L 790.9230769230769 130 L 804.1538461538461 44 L 817.3846153846154 130 L 830.6153846153845 36 L 843.8461538461538 92 L 857.076923076923 130 L 870.3076923076923 76 L 883.5384615384614 130 L 896.7692307692307 60 L 910 88 Also below these chart I have a jqueryUI slider of the same width (860px) and centered with the chart. I want when I move the slider to move a dot on the chart accordingly with the slider position. See attached screenshot: As you can see it seems to work fine. I've implemented this behaviour using the pathIntersection() method. On the slide event at each ui.value (x coordinate) I intersect my chartPath (the one from above) with a vertical straight line at the x coordinate. But still there are some problems. One of them is that it runs very hard, and it kinda freezes sometimes.. and very weird sometimes it doesn't seem to intersect at all even it should.. I'll example below 2 cases I identified: M 499.8461538461538 0 L 499.8461538461538 140 M 910 0 L 910 140 Could you please explain why this intersect behaviour happens (it should return a dot).. and the worst part it seems like it happens randomly.. if I use another chartdata. Also if you can identify another (better) solution to syncronise the slider position with the dot on the chart.. would be perfect. I thought about using Element.getPointAtLength(length), but I don't know how. I think I should save the pathSegments and for each to compute the start Length and the finish Length.

    Read the article

  • Put Raphael (SVG) canvas behind other divisions to make them clickable?

    - by Kerry
    I am using Raphael to create lines between divisions in an organization chart (or flow chart), but I need to be able to actually click on the divisions and content behind it. If I could make the canvas be behind the other elements, kind of like a background image, that would be idea. Is this possible? UPDATE: I found a solution. Raphael makes an SVG canvas that is absolutely positioned in my case. Absolute positions act as layers, and so to be on top of that layer, my content had to be absolutely positioned as well. If someone else has a better solution, I would be happy to hear it, though this is working fine.

    Read the article

  • How can the javascript plugin architecture in raphael/jquery be done?

    - by TimDog
    I'm looking for a barebones javascript example that demonstrates how the javascript plugin architecture works with large javascript libraries (such as raphael or jquery). In either scenario, you build plugins by ensuring your custom plugin follows this pattern: jQuery.fn.pluginName -- so assume I have a library: myLibrary = (function() { //my fancy javascript code return function() { //my return object }; }); How would fn be incorporated into the above myLibrary object to ensure that he resulting plugin is callable? I instantiate myLibrary like so: var lib = new myLibrary(); And now I have included a reference to my plugin in my page: myLibrary.fn.simplePlugin = function() { //more fancy code } So finally, I can just call: lib.simplePlugin(); Basically, what magic is actually occuring when the .fn is used during the creation of the plugin?

    Read the article

  • Can't build gcc anymore since upgrade to 11.10

    - by Raphael R.
    On Monday I've upgraded to from Ubuntu 11.04 (my initial installation) to 11.10 and now I can't build gcc from source anymore. Since I forgot to uninstall the gcc package before the upgrade, Ubuntu replaced my 4.7.0 compiler with it's stable 4.6.1. So I tried to build the SVN sources again, but it fails. I've most recently tried it with SVN revision 180193. After some time, the build fails with the following message: /home/raphael/devel/gcc/build/./gcc/xgcc -B/home/raphael/devel/gcc/build/./gcc/ -B/usr/i686-pc-linux-gnu/bin/ -B/usr/i686-pc-linux-gnu/lib/ -isystem /usr/i686-pc-linux-gnu/include -isystem /usr/i686-pc-linux-gnu/sys-include -g -O2 -O2 -I. -I. -I../../src/gcc -I../../src/gcc/. -I../../src/gcc/../include -I../../src/gcc/../libdecnumber -I../../src/gcc/../libdecnumber/bid -I../libdecnumber -I../../src/gcc/../libgcc -g -O2 -DIN_GCC -W -Wall -Wwrite-strings -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition -isystem ./include -fPIC -g -DHAVE_GTHR_DEFAULT -DIN_LIBGCC2 -fbuilding-libgcc -fno-stack-protector -I. -I. -I../.././gcc -I../../../src/libgcc -I../../../src/libgcc/. -I../../../src/libgcc/../gcc -I../../../src/libgcc/../include -I../../../src/libgcc/config/libbid -DENABLE_DECIMAL_BID_FORMAT -DHAVE_CC_TLS -DUSE_TLS -o _ashldi3.o -MT _ashldi3.o -MD -MP -MF _ashldi3.dep -DL_ashldi3 -c ../../../src/libgcc/../gcc/libgcc2.c \ -fvisibility=hidden -DHIDE_EXPORTS In file included from /usr/include/stdio.h:28:0, from ../../../src/libgcc/../gcc/tsystem.h:88, from ../../../src/libgcc/../gcc/libgcc2.c:29: /usr/include/features.h:323:26: fatal error: bits/predefs.h: File or directory not found. I've cofigured it with: ~/devel/gcc/build$ ../src/configure --prefix=/usr --enable-languages=c++ And make it with: ~/devel/gcc/build$ make -j4 Just to be sure, I did a rm -rf * in the build directory in case there's some broken stuff inside. Didn't help, though. That's the backstory. I tried to fix it and searched for the bits/predefs.h. It's inside /usr/include/i386-linux-gnu. I temporarily fixed the problem by doing ~/devel/gcc/build$ C_INCLUDE_PATH=/usr/include/i386-linux-gnu make -j4 Which is only temporary because now gcc complains that it can't find crti.o. Which i can find in /usr/lib/i386-linux-gnu. Now i could also set C_LIBRARY_PATH - actually it doesn't work - but I feel like I'm fighting the system here. Also, even if it succeeds, my newly built compiler would also not know about the i386-linux-gnu stuff. So I would have to set C_LIBRARY_PATH and C_INCLUDE_PATH before every build of every project I have. I could add it to my .bashrc but that subverts the system even more. So, how do I tell the build process: That there are additional include/lib directories, and That it should build a gcc which respects them too? Edit: I forgot to include the command which causes the above error message. Also I can think of another solution: Copy the stuff from /usr/include/i386-linux-gnu to /usr/include (same thing for /usr/lib/i386-linux-gnu to /usr/lib). But that doesn't feel right, either. Finally, the system's gcc 4.6.1 can compile other applications just fine, except mine, which use C++11 features not present in the 4.6 series.

    Read the article

  • Handling EJB/JPA exceptions in a “beautiful” way

    - by Rodrigues, Raphael
    In order to handle JPA exceptions, there are some ways already detailed in lots of blogs. Here, I intend to show one of them, which I consider kind of “beauty”. My use case has a unique constraint, when the User try to create a duplicate value in database. The JPA throws a java.sql.SQLIntegrityConstraintViolationException, and I have to catch it and replace the message. In fact, ADF Business Components framework already has a beautiful solution for this very well documented here . However, for EJB/JPA there's no similar approach. In my case, what I had to do was: 1. Create a custom Error Handler Class in DataBindings file; a. Here is how you accomplish it. 2. Override the reportException method and check if the type of exception exists on property file a. If yes, I change the message and rethrows the exception b. If not, go on the execution The main goal of this approach is whether a new or unhandled Exception was raised, the job is, only create a single entry in bundle property file. Here are pictures step by step: 1. CustomExceptionHandler.java 2. Databindings.cpx 3. Bundle file 4. jspx: 5. Stacktrace: Give your opinion, what did you think about that?

    Read the article

  • How to create a simple adf dashboard application with EJB 3.0

    - by Rodrigues, Raphael
    In this month's Oracle Magazine, Frank Nimphius wrote a very good article about an Oracle ADF Faces dashboard application to support persistent user personalization. You can read this entire article clicking here. The idea in this article is to extend the dashboard application. My idea here is to create a similar dashboard application, but instead ADF BC model layer, I'm intending to use EJB3.0. There are just a one small trick here and I'll show you. I'm using the HR usual oracle schema. The steps are: 1. Create a ADF Fusion Application with EJB as a layer model 2. Generate the entities from table (I'm using Department and Employees only) 3. Create a new Session Bean. I called it: HRSessionEJB 4. Create a new method like that: public List getAllDepartmentsHavingEmployees(){ JpaEntityManager jpaEntityManager = (JpaEntityManager)em.getDelegate(); Query query = jpaEntityManager.createNamedQuery("Departments.allDepartmentsHavingEmployees"); JavaBeanResult.setQueryResultClass(query, AggregatedDepartment.class); return query.getResultList(); } 5. In the Departments entity, create a new native query annotation: @Entity @NamedQueries( { @NamedQuery(name = "Departments.findAll", query = "select o from Departments o") }) @NamedNativeQueries({ @NamedNativeQuery(name="Departments.allDepartmentsHavingEmployees", query = "select e.department_id, d.department_name , sum(e.salary), avg(e.salary) , max(e.salary), min(e.salary) from departments d , employees e where d.department_id = e.department_id group by e.department_id, d.department_name")}) public class Departments implements Serializable {...} 6. Create a new POJO called AggregatedDepartment: package oramag.sample.dashboard.model; import java.io.Serializable; import java.math.BigDecimal; public class AggregatedDepartment implements Serializable{ @SuppressWarnings("compatibility:5167698678781240729") private static final long serialVersionUID = 1L; private BigDecimal departmentId; private String departmentName; private BigDecimal sum; private BigDecimal avg; private BigDecimal max; private BigDecimal min; public AggregatedDepartment() { super(); } public AggregatedDepartment(BigDecimal departmentId, String departmentName, BigDecimal sum, BigDecimal avg, BigDecimal max, BigDecimal min) { super(); this.departmentId = departmentId; this.departmentName = departmentName; this.sum = sum; this.avg = avg; this.max = max; this.min = min; } public void setDepartmentId(BigDecimal departmentId) { this.departmentId = departmentId; } public BigDecimal getDepartmentId() { return departmentId; } public void setDepartmentName(String departmentName) { this.departmentName = departmentName; } public String getDepartmentName() { return departmentName; } public void setSum(BigDecimal sum) { this.sum = sum; } public BigDecimal getSum() { return sum; } public void setAvg(BigDecimal avg) { this.avg = avg; } public BigDecimal getAvg() { return avg; } public void setMax(BigDecimal max) { this.max = max; } public BigDecimal getMax() { return max; } public void setMin(BigDecimal min) { this.min = min; } public BigDecimal getMin() { return min; } } 7. Create the util java class called JavaBeanResult. The function of this class is to configure a native SQL query to return POJOs in a single line of code using the utility class. Credits: http://onpersistence.blogspot.com.br/2010/07/eclipselink-jpa-native-constructor.html package oramag.sample.dashboard.model.util; /******************************************************************************* * Copyright (c) 2010 Oracle. All rights reserved. * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 * which accompanies this distribution. * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html * and the Eclipse Distribution License is available at * http://www.eclipse.org/org/documents/edl-v10.php. * * @author shsmith ******************************************************************************/ import java.lang.reflect.Constructor; import java.lang.reflect.InvocationTargetException; import java.util.ArrayList; import java.util.List; import javax.persistence.Query; import org.eclipse.persistence.exceptions.ConversionException; import org.eclipse.persistence.internal.helper.ConversionManager; import org.eclipse.persistence.internal.sessions.AbstractRecord; import org.eclipse.persistence.internal.sessions.AbstractSession; import org.eclipse.persistence.jpa.JpaHelper; import org.eclipse.persistence.queries.DatabaseQuery; import org.eclipse.persistence.queries.QueryRedirector; import org.eclipse.persistence.sessions.Record; import org.eclipse.persistence.sessions.Session; /*** * This class is a simple query redirector that intercepts the result of a * native query and builds an instance of the specified JavaBean class from each * result row. The order of the selected columns musts match the JavaBean class * constructor arguments order. * * To configure a JavaBeanResult on a native SQL query use: * JavaBeanResult.setQueryResultClass(query, SomeBeanClass.class); * where query is either a JPA SQL Query or native EclipseLink DatabaseQuery. * * @author shsmith * */ public final class JavaBeanResult implements QueryRedirector { private static final long serialVersionUID = 3025874987115503731L; protected Class resultClass; public static void setQueryResultClass(Query query, Class resultClass) { JavaBeanResult javaBeanResult = new JavaBeanResult(resultClass); DatabaseQuery databaseQuery = JpaHelper.getDatabaseQuery(query); databaseQuery.setRedirector(javaBeanResult); } public static void setQueryResultClass(DatabaseQuery query, Class resultClass) { JavaBeanResult javaBeanResult = new JavaBeanResult(resultClass); query.setRedirector(javaBeanResult); } protected JavaBeanResult(Class resultClass) { this.resultClass = resultClass; } @SuppressWarnings("unchecked") public Object invokeQuery(DatabaseQuery query, Record arguments, Session session) { List results = new ArrayList(); try { Constructor[] constructors = resultClass.getDeclaredConstructors(); Constructor javaBeanClassConstructor = null; // (Constructor) resultClass.getDeclaredConstructors()[0]; Class[] constructorParameterTypes = null; // javaBeanClassConstructor.getParameterTypes(); List rows = (List) query.execute( (AbstractSession) session, (AbstractRecord) arguments); for (Object[] columns : rows) { boolean found = false; for (Constructor constructor : constructors) { javaBeanClassConstructor = constructor; constructorParameterTypes = javaBeanClassConstructor.getParameterTypes(); if (columns.length == constructorParameterTypes.length) { found = true; break; } // if (columns.length != constructorParameterTypes.length) { // throw new ColumnParameterNumberMismatchException( // resultClass); // } } if (!found) throw new ColumnParameterNumberMismatchException( resultClass); Object[] constructorArgs = new Object[constructorParameterTypes.length]; for (int j = 0; j < columns.length; j++) { Object columnValue = columns[j]; Class parameterType = constructorParameterTypes[j]; // convert the column value to the correct type--if possible constructorArgs[j] = ConversionManager.getDefaultManager() .convertObject(columnValue, parameterType); } results.add(javaBeanClassConstructor.newInstance(constructorArgs)); } } catch (ConversionException e) { throw new ColumnParameterMismatchException(e); } catch (IllegalArgumentException e) { throw new ColumnParameterMismatchException(e); } catch (InstantiationException e) { throw new ColumnParameterMismatchException(e); } catch (IllegalAccessException e) { throw new ColumnParameterMismatchException(e); } catch (InvocationTargetException e) { throw new ColumnParameterMismatchException(e); } return results; } public final class ColumnParameterMismatchException extends RuntimeException { private static final long serialVersionUID = 4752000720859502868L; public ColumnParameterMismatchException(Throwable t) { super( "Exception while processing query results-ensure column order matches constructor parameter order", t); } } public final class ColumnParameterNumberMismatchException extends RuntimeException { private static final long serialVersionUID = 1776794744797667755L; public ColumnParameterNumberMismatchException(Class clazz) { super( "Number of selected columns does not match number of constructor arguments for: " + clazz.getName()); } } } 8. Create the DataControl and a jsf or jspx page 9. Drag allDepartmentsHavingEmployees from DataControl and drop in your page 10. Choose Graph > Type: Bar (Normal) > any layout 11. In the wizard screen, Bars label, adds: sum, avg, max, min. In the X Axis label, adds: departmentName, and click in OK button 12. Run the page, the result is showed below: You can download the workspace here . It was using the latest jdeveloper version 11.1.2.2.

    Read the article

< Previous Page | 1 2 3 4 5  | Next Page >