Posts

Showing posts from 2012

internet explorer - Flash object inside iframe didn't work in IE7-8 -

i have iframe loads page following html inside it: <object height="315" width="560"> <param name="movie" value="http://www.youtube.com/v/vbbx9ujay3a?version=3&hl=en_us"> <param name="allowfullscreen" value="true"> <param name="allowscriptaccess" value="always"> <embed wmode="transparent" src="http://www.youtube.com/v/vbbx9ujay3a?version=3&hl=en_us" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" height="315" width="560"> <param name="wmode" value="transparent"> </object> but when trying open page in ie 7-8 browsed didn't display content. when inspected page developer tools found ie removes embed tag (the rest ok). when accessing page directly browser (not iframe) — works. i can't abandon iframe due secu...

css3 - CSS Rotate 2 objects -

i've got strange problem.. 've got 2 objects: <div id="menu"> <a href="#"><img src="images/nagrody.png"></a> <a href="#"><img src="images/zwyciezcy.png"></a> <a href="#"><img src="images/zasady.png"></a> </div> with style: #menu { float:right; margin:20px 10px; width: 160px; -webkit-transform:rotate(3deg); -moz-transform:rotate(3deg); -o-transform:rotate(3deg); } #menu img{ -webkit-transition-duration: 0.5s; -moz-transition-duration: 0.5s; -o-transition-duration: 0.5s; transition-duration: 0.5s; -webkit-transform:scale(0.95,0.95); -moz-transform:scale(0.95,0.95); -o-transform:scale(0.95,0.95); overflow:hidden; } #menu img:hover{ -webkit-transform:scale(1,1); -moz-transform:scale(1,1); -o-transform:scale(1,1); } and second object: <div id="znajomi...

Getting the wrong order when using ORDER BY in XQuery using Saxon processor on Oxygen XML Editor -

this first post , i'm seeking because i've tried without luck. so, i'm trying use simple xquery data xml file (showed below), i'm having trouble trying order results, don't appear expected. my input file: <?xml version="1.0" encoding="utf-8"?> <database name="mydb"> <constraints> <constraint name="asignaturas_matriculadas_chk1"> <type>c</type> <table-name>asignaturas_matriculadas</table-name> <condition>convocatorias_agotadas &gt;= 0 , convocatorias_agotadas &lt; 6</condition> </constraint> <constraint name="sys_c0029035"> <type>c</type> <table-name>asignaturas_matriculadas</table-name> <condition>&quot;convocatorias_agotadas&quot; not null</condition> </constraint> ...

javascript - Checkbox div double the label? -

i don't know why when checkbox clicked, double label text associated. me? // add multiple select / deselect functionality $("#selectall").click(function () { $('.child').attr('checked', this.checked); $('.ck,.chkbox,.checkall ,input:radio').dcustominput(); }); jquery.fn.dcustominput = function(){ $(this).each(function(i){ if($(this).is('[type=checkbox],[type=radio]')){ var input = $(this); var id=input.attr('id'); // associated label using input's id var forlabel = $('label[for='+input.attr('id')+']'); var chklabel = forlabel.text(); forlabel.hide(); var label = $("<label for='"+id+"...

asp.net - Is the same key derived providing the same salt and password using Rfc2898DeriveBytes -

i read this tutorial encryption in .net it uses rfc2898derivebytes create random key used symmetric algorithm . doesn't save key . , later in decryption method supplies same password , salt , decrypts text . does mean supplying same salt , password rfc2898derivebytes derived same key ? no need save key , save salt , password ? yes, correct. identical inputs rfc2898derivebytes provide identical outputs. otherwise, decryption not possible. the article reference uses term "random" loosely. output of rfc2898derivebytes not random: has high entropy.

android - How to resize an ImageView by pressing a MenuItem -

i trying create imageview resized when user presses menuitem. tried use following code, error , application stops. @override public boolean onoptionsitemselected(menuitem item) { switch(item.getitemid()) { case r.id.sub_item_25_percent: try { layoutparams params = new layoutparams(imageview1.getlayoutparams()); params.width = pages.page_width_25_percent; params.height = pages.page_height_25_percent; imageview1.setlayoutparams(params); } catch(exception ex) { toast.maketext(this, ex.getmessage(), toast.length_short); } break; } } as can see, used try-catch-block informations exception, application still stopping without displaying toast. does have clue fix problem? try this: @override public boolean onoptionsitemselected(menuitem item) ...

Using a Canvas as a three.js Texture: Text Not Showing Above a Certain Size -

i've been experimenting three.js recently, i've hit show stopper occurs when size of canvas used texture above 256x256. here's example code demonstrates what's happening: http://jsfiddle.net/ssd65/26/ notice when size = 256 , canvas , contents rendered correctly on faces of cube. case when size < 256 . however , size > 256 , border of canvas rendered on faces of cube text mysteriously left out. example of happens when size = 257 : http://jsfiddle.net/ssd65/27/ i can't understand why graphical part of canvas being rendered on cube not textual part. is bug in three.js, issue canvas or (most likely) being stupid? ideas? this odd indeed. looks texture caching / syncing issue on chrome side, somewhere in code handling 2d canvas => webgl texture conversion. if add canvas drawing operation after drawing text, works again 257 pixel sized canvas: http://jsfiddle.net/ssd65/28/ so seems what's going on canvas size > 256 chrome us...

java - Google App Engine - Servlet (Error: Expecting a stackmap frame at branch target 44 in method test.) -

hi have th following servlet in new google app engine (sdk 1.6.6) project on eclipse: package test; import java.io.ioexception; import java.io.printwriter; import javax.servlet.http.*; @suppresswarnings("serial") public class teststorageservlet extends httpservlet { public void doget(httpservletrequest req, httpservletresponse resp) throws ioexception { resp.setcontenttype("text/plain"); printwriter writer = resp.getwriter(); try { writer.write("hello"); } catch (exception ex) { writer.write("error: " + ex.getmessage()); } { writer.close(); } } } such servlet working fine on tomcat (as normal java web project)m in google app engine project face following 500 error: http error 500 problem accessing /teststorage. reason: expecting stackmap frame @ branch target 44 in method test.teststorageservlet.doget(ljavax/servlet/http/ht...

coefficient in trigonometrics sums in Mathematica -

i compute coefficient in mathematica. example wrote code find coefficients of cos(kx) in (a+b*cos(x))^4 "a" , "b" parameters. f[x_] := (a + b cos[x])^4 f1[x_] := trigreduce[f[x]] g[x_, k_] := coefficient[f1[x], cos[k x]] it works coefficients of cos(k*x), for example coefficient of cos(2x) is g[x,2]= 1/8 (24 a^2 b^2 + 4 b^4) but not work constant(here constant means independent of cos(kx). in other words, terms numbers , parameters "a" , "b"). i write code find constant in above meaning. thanks. plugging coefficient[trigreduce[(a + b*cos[x])^4],cos[2*x]] wolfram|alpha produced output wanted to. leads me suggest problem might have how expression being evaluated opposed problem how mathematically thinking it. i not have access copy of mathematica can not test this, try changing := = in second line of code. i try putting in 1 line as g[x_, k_] := coefficient[trigreduce[(a + b cos[x])^4], cos[k x]] if works, w...

c# 4.0 - C# way to write Func with void return -

i have following 2 functions, identical, difference 1 uses func , other action . , i'd combine them 1 function if possible. private static void trycatch(action action) { try { action(); } catch (exception x) { emailer.logerror(x); throw; } } private static tresult trycatch<tresult>(func<tresult> func) { try { return func(); } catch (exception x) { emailer.logerror(x); throw; } } combining these 2 1 function in c# isn't possible. void in c#, , clr, isn't type , hence has different return semantics non-void function. way implement such pattern provide overload void , non-void delegates the clr limitation doesn't mean it's impossible in every clr language. it's impossible in languages use void represent function returns no values. pattern ...

python - mean of 3d points as minimization task -

i have set of n 3d points (x,y,z) , compute mean. in particular purpose compare differences between several metric. euclidean distance: d_e(d_1,d_2) = ||d_1 - d_2|| riemannian distance: d_r(d_1,d_2) = ||log(d_1^(-1/2) * d_2 * d_1^(-1/2))|| once fix metric, should compute minimization problem. i founded in python scipy.optimize kind of task, not know how formulate problem. should use loop? edit: i found scipy.optimize.leastsq . seems useful, goal. how use in gradient descent framework? >>> import numpy np >>> = np.array([[1,2,3],[1,2,3],[7,-100,8]]) >>> a.mean(axis=0) array([ 3. , -32. , 4.66666667])

Strange memory leak in silverlight 5 -

i'm facing problems silverlight application. my application looks image manager. can open images, edit, view, etc. my problem when add images , after remove these images, memory doesn't return same amount used before add these images. if repeat these operations (add images , after remove these images), memory doesn't stop going up. why it's happen? i create new silverlight 5 project recreate scenario, test codes , try find happening. in new project have stackpanel , 3 buttons these actions: 1- add 1000 buttons in stackpanel; 2- remove children of stackpanel; 3- call gc.collect; i call same actions repeatedly: add(1), remove(2), call gc(3) after repeated several times same action (add , remove). observed same result of first application, memory doesn't stop going up. after call gc.collect memory not freed. don't what's happen. possible memory leak of silverlight? is pc 'tablety'? silverlight automation kicks in if ha...

sql - difference between two timestamps (in days) in oracle -

select min (snap_id) first_snap, max (snap_id) last_snap, min (begin_interval_time) first_query, max (end_interval_time) last_query, max(end_interval_time) - min(begin_interval_time) "time_elapsed" dba_hist_snapshot order snap_id; 2931 3103 5/28/2012 6:00:11.065 6/4/2012 11:00:40.967 +07 05:00:29.902000 i last columns output 7 (for days). have tried trunc , extract other posts mentioned can't seem syntax right. ideas? judging comment, you're using timestamp columns, not datetime . use extract retrieve hour difference, , trunc(.../24) whole number of days: trunc(extract(hour max(end_interval_time) - min(begin_interval_time))/24) or cast timestamp date : trunc(cast(max(end_interval_time) date) - cast(min(begin_interval_time) date))

authentication - Implementing Security for Java Web Services with Spring and Apache CXF -

i have application runs on java spring 3. application uses restful services , spring security security. has user table , checks user credentials it. implemented web service capability application(one of customer's wanted web services instead of restful services). if possible want same authentication mechanism , want database , allow 1 user (for now-to admin) communicate web service server. should follow same way restful authentication or there authentication , security mechanism java web services @ spring (i.e. how deal logout, how enable logout mechanism client-server web services communication) ps: use apache-cxf. two potential ways: put basicauthenticationfilter or digestauthenticationfilter in front of cxf servlet. use ws-security usernamepasswordtoken cxf , write callbackhandler a) creates usernamepasswordauthenticationtoken, b) calls authenticationmanager.authenticate() , c) stores authentication in securitycontextholder. note above doesn't cove...

jquery - Can not render dynatree treeview a second time when the containing div is cleared with $.empty() -

i rendering dynatree treeview in #treediv opentemplate function. before load units template in dynatree empty/clear #treediv remove existing tree. works first time. when try load other units template in #treediv not see unit data, div empty. somehow #treediv got corrupted because code run first time creating unit tree. difference @ 2nd time .empty() there exist tree. what wrong? function opentemplate(dlg, form) { $.ajax({ url: $(form).attr('action'), type: 'post', data: form.serialize(), success: function (response) { if (response.success) { dlg.dialog("close"); $('#treediv').empty(); loadunits(response.data); } else { // reload dialog form show model/validation errors ...

c - Jiffies - how to calculate seconds elapsed? -

i have piece of code, want calculate time in seconds.. though getting time in jiffies, how can convert in seconds? here kernel code: #include <linux/module.h> #include <linux/kernel.h> #include <linux/jiffies.h> #include <linux/timer.h> unsigned long js, je, tet; int netblock_init_module(void){ js = jiffies; printk("\n[jiffies start time : %lu]\nmodule started.\n", js); return 0; } void netblock_cleanup_module(void) { je = jiffies; printk("\n[jiffies end time : %lu]\nmodule removed.\n", je); tet = je - js; printk("\nend time [%lu] - start time [%lu]: \ntotlal elapsed time [%lu]\n",js,je, tet); } module_init(netblock_init_module); module_exit(netblock_cleanup_module); module_license("gpl"); module_description("jiffies example"); module_author("raheel"); output getting this: $insmod jiffexample.ko [jiffies start time : 13363583] module started ...

c# - Asp.net MVC URL routing: issue changing URL when has parameters -

i need change urls in mvc project, , far has been quite simple - i've had change url string in appropriate routes.maproute() in global.asax.cs file. one link in particular acting stubborn , won't change, , i'm sure it's because 1 parameters. the maproute in question is: routes.maproute( "mortgage.getthisrate", "mortgage-rates/mortgage-rate-details/{groupid}/{paymenttype}/{mortgagevalue}/{province}", new { controller = "mortgage", action = "getthisrate", paymenttype = urlparameter.optional, mortgagevalue = urlparameter.optional, province = urlparameter.optional }, new { groupid = "\\d+", paymenttype = "\\d+", mortgagevalue = "\\d+", province = "\\d+" } ); and button calling maproute is: @html.omniturebutton( url.action("getthisrate", new { groupid = info.groupid }), "<span class=\"payment\">...

asp.net - Gridview column width changes when converting to pdf using itextsharp -

good day ! before converting gridview pdf can modify font size , color using: gridview.headerrow.style.add("font-family", "arial, helvetica, sans-serif;"); gridview.headerrow.style.add("font-size", "7.20px"); gridview.headerrow.style.add("color", "#284775"); gridview.style.add("font-family", "arial, helvetica, sans-serif;"); gridview.style.add("font-size", "6px"); the gridview has different column widths because of information being displayed, sizes set .aspx file. but, generated pdf file auto adjusts width of each column same size, therefore information shrinked , doesnt good.. i tried following: gridview.width =100; gridview.style.add("width","100"); and many more haven't been able adjust gridview it's original columns width. how can that? thanks in advance. edit: i've tried: gridview.columns[3].itemstyle.width =unit.pixel(10); ...

javascript - How can I point to a url full of json value and eval parse it, using json2.js? -

how can parse eval object json2 dot js? there url http: //blah.com/json.data want call button this <input type="button" value"go" onclick="go()" /> from go javascript function, want hit blah url has type of data-content (it has no html) on page: userdetails.attribute.name=lastname userdetails.attribute.value=smith userdetails.attribute.name=givenname userdetails.attribute.value=michael how can use eval() function throw of data blah url var object1 can this: document.getelementbyid("lname").innerhtml = object1.blah[1].lastname; thanks in advanced...i'm new json2 start using it. use jquery : $.get({ url: "/json.data", datatype: "json", success: function (result) { $("#lname").text(result.blah[1].lastname); } }); if data formatted posted in example (which not valid json), may need parse hand. can tell jquery send plain text instead of attemptin...

serial port - Arduino: How store values in a char array in one line then clear/empty a char array? -

i attempting write code store command text between { , } serial terminal. far have: byte index = 0; // index array; store character char cmdarr[10]; boolean startofline = false; boolean endofline = false; void setup() { serial.begin(38400); } void serialevent() { while (serial.available()) { char cmd = (char)serial.read(); if (cmd == '{') { startofline = true; } if (cmd == '}') { endofline = true; //cmdarr[index] = '\0'; //null terminate c string; i'm not sure if needed } if (startofline && cmd != '{' && cmd != '}') { cmdarr[index++] = cmd; } if (startofline && endofline) { int i; (i = 0; < 10; i++) { //do command } startofline = false; endofline = false; break; } } } void loop() { } i able iterate through cmdarr print out array values. right now, example, comm...

sql server - How do I declare and use variables in PL/SQL like I do in T-SQL? -

Image
in sql server, times when i'm testing body of stored procedure, copy body ssms, declare variables @ top of page, set them sample values, , execute body as-is. for example, if proc is create proc mysampleproc @name varchar(20) select @name then test sql be declare @name varchar(20) set @name = 'tom' select @name what oracle pl/sql equivalent this? this closest i've come with, i'm getting "pls-00428: clause expected in select statement" declare myname varchar2(20); begin myname := 'tom'; select myname dual; end; this better example of i'm trying do: declare myname varchar2(20); begin myname := 'tom'; select * customers name = myname; end; but again, wants 'into' when want records printed on screen, not stored in table.... resolved: thanks @allan, i've got working enough. oracle sql developer apparently remembers parameter values supply wit...

android - Using onSavedInstance for other classes than pregiven methods -

how add in items inside onsavedinstance such different class such hashmap multiple items inside it. how able achieve this? hashmap implements serializable , long both key , value types serializable, can put entire map in bundle.

javascript - google place search location biasing -

i using google places search , want "location biasing" on gcc countries (uae, saudi arabia, oman, kuwait & bahrain). i want achieve below https://developers.google.com/maps/documentation/places/autocomplete#location_biasing i want provide google places search on textbox user can see results these countries uae, saudi arabia, oman, kuwait & bahrain? thanks, i can "location bias" on 1 country using "componentrestrictions" argument shown in below code snippet var mapoptions = { //bounds : defaultbounds, center: new google.maps.latlng(25.2644444, 55.31166669999993), zoom: 13, maptypeid: google.maps.maptypeid.roadmap }; map = new google.maps.map(document.getelementbyid('map_canvas'), mapoptions); var input = document.getelementbyid('searchtextfield'); var inputoptions = { types: ['(cities)'], **co...

android - How to Reverse Fragment Animations on BackStack? -

i thought system reverse animations on backstack when button pressed when using fragments using following code: fragmentmanager fm = getfragmentmanager(); fragmenttransaction ft = fm.begintransaction(); ft.setcustomanimations(r.anim.slide_in, r.anim.hyperspace_out); ft.replace(r.id.viewcontainer, new class(), "layout").addtobackstack(null).commit(); according android documentation custom animation : change: ft.setcustomanimations(r.anim.slide_in, r.anim.hyperspace_out); to: ft.setcustomanimations(r.anim.slide_in, r.anim.hyperspace_out, r.anim.hyperspace_in, r.anim.slide_out ); and backstack animates - in reverse!!

c# - StretchBlt occasionally inverts image when it shouldn't -

i’m having problem using stretchblt (or bitblt) copy image picturebox bitmap use in creating avi file. avi file unimportant aspect believe - can display bitmap on picturebox , see problem. the problem (not often) single image flipped (mirrored across x axis, never y axis). i’m not sure if known problem stretchblt haven’t yet found mention of or if doing wrong. note not due intended functionality stretchblt of "if signs of source , destination height or width different creates mirror image". update: changed things force source/destination same size, , using bitblt same behavior. i’ve included code (c#), of important parts. stepping through code can see happen single image has same information being passed stretchblt (other hdc copy to) previous image , next image (and next, next) of fine. doesn't happen often, , dont see reason when does. or way detect happened (so can flip back). have work around doesn't use stretchblt, slower , degrades performance. ...

java ee 6 - Custom tag file code assist not working in Eclipse but working in IntelliJIDEA -

Image
i new javaee struggling hard learn it. i noticed 1 thing not working code assist in custom tag files in eclipse. same working in intellijidea current version. both screen shots below. someone me enable code assist in eclipse indigo service release 2. edited netbeans & esclipse don't show code assist custom classes when type ${user.} el. intellijidea supports that. eclipse intellijidea jar files 1) try window / preferences / web / jsp files / editor / content assist. make sure html , xml tag proposals checkboxes checked. 2) can specify taglib instead of tag import? <%@ tablib prefix="user" uri="/web-inf/tags/user.tld" %> 3) have right libraries in classpath? enabling content assist jsp files having proper files defined in java™ build class path essential content assist work in jsp files. essential links builder able correctly resolve links servlets or java beans in jsp , html files. enable content assist jsp fi...

jquery - simulating text selection with spans, bottle neck -

i have text. words wrapped in spans(span ids 1,2,3...n): <span id="79" class="p">თაობის<div class="p" style="width: 9px; left: -9px; "></div></span> <span id="80" class="p">განადგურების<div class="p" style="width: 10px; left: -10px; "></div></span> i'm simulating text selection by: i need simulate text selection changing span's background colours , filling gap between spans background filled divs. when span count large enough, in internet explorer, javascript code runs through "selected text spans" , calculates gap space between putting there divs(with background color) takes way time(internet explorer hangs up 30 second in case when total amount of spans 500). i dont understand mean "simulating text selection" you @ example http://jsfiddle.net/fullpipe/dpp7w/embedded/result/ if suggest code, easy you a ...

javascript - Parse custom Date from string -

possible duplicate: help parsing iso 8601 date in javascript i have set of strings, in similar form: 2012-05-31t00:00:00.0000000 all want pull year (2012), month (05), , day (31), construct javascript date object data. what best way parse data? the easiest way can think of using regular expression, , passing values date constructor : function parseisodate(datestring) { var match = /^(\d{4})-(\d\d)-(\d\d)/.exec(datestring); return new date(number(match[1]), number(match[2]) - 1, number(match[3])); } console.log(parseisodate('2012-05-31t00:00:00.0000000')); // date {thu may 31 2012 00:00:00 gmt+0200} of course, expand match time well...

java - Trouble building executable uber jar with Maven and Subetha SMTP and LOG4J -

i'm new maven, , trying create application uses [subetha smtp library][1], , package entire app 1 executable app. to packaging attempting use [mavens shade plugin][2], running issue 1 of libraries subetha smtp using/including. the project seems build fine: [info] [info] --- maven-jar-plugin:2.3.2:jar (default-jar) @ smtpserver --- [info] building jar: d:\dev\apps\smtpserver\target\smtpserver-1.0-snapshot.jar [info] [info] --- maven-shade-plugin:1.7:shade (default) @ smtpserver --- [info] including org.subethamail:subethasmtp:jar:3.1.6 in shaded jar. [info] including javax.mail:mail:jar:1.4.4 in shaded jar. [info] including javax.activation:activation:jar:1.1.1 in shaded jar. [info] including com.google.code.findbugs:jsr305:jar:1.3.9 in shaded jar. [info] including org.slf4j:slf4j-api:jar:1.5.6 in shaded jar. [info] replacing original artifact shaded artifact. [info] replacing d:\dev\apps\smtpserver\target\smtpserver-1.0-snapshot.jar d:\dev\apps\smtpserver\target\smtpserve...

email - Outlook Interop from c# service -

i have barebones c# service installed , want use outlook.interop functionallity within program. detect , read new emails recieved. have program form application. possible use outlook.interop c# service? better avoid using interactive application within service environment. using outlook service not supported microsoft , in sorts of trouble (think message boxes popping instance). if want talk exchange server better use cdo/mapi or exchange web service api. if want talk pop3 or imap server use dedicated library.

C++ wrapper for boost/c++11 -

i not sure title of question proper. here problem. writing library use c++11 library features. not implementations support these libraries yet , there portability problem. not matter library of concern here. 1 solution use boost, provide lot c++11 libraries. solution define macro, use_cxx11 , , define new namespace internal , introduce names internal namespace dependent on macros. example need use name foo c++ library <foo> , available in <boost/foo/foo.hpp> . is #ifdef use_cxx11 #include <foo> #else #include <boost/foo/foo.hpp> #endif namespace internal { #ifdef use_cxx11 using std::foo; #else using boost::foo::foo; #endif } and in rest of library use internal::foo . third party code use library can define proper macro indicate if have working c++ 11 implementation or can use boost. , library pickup right header , namespace. works far. hope have explained intention well. but above solutions seems ugly me. there better practice kind of thing? or the...

hibernate Schema export happens twice -

a friend , develop web application conferences management uses hibernate (school project). when start application db (mysql) tables created data. until worked well, yesterday friend entered functionality assign participant conference, , whenever try use following (cleared console before action): hibernate: select conference0_.conferenceid conferen1_2_, conference0_.active active2_, conference0_.description descript3_2_, conference0_.enddate enddate2_, conference0_.location_name location7_2_, conference0_.name name2_, conference0_.startdate startdate2_ test.conferences conference0_ conference0_.name=? hibernate: select location0_.name name5_0_, location0_.active active5_0_, location0_.address address5_0_, location0_.contactname contactn4_5_0_, location0_.locationid locationid5_0_, location0_.maxcapacity maxcapac6_5_0_, location0_.pho...