Posts

Showing posts from April, 2010

c# - Difference between inproc and outproc -

i trying find difference between inproc , outproc in c#. if have dll running on server , question run in both inproc , outproc? performance-wise process better? an inproc server runs in same process calling application. it's close normal function call on dll. calling outproc server, data needs marshalled across process boundry expensive operation. inproc server fast can bring down application.

asp.net mvc 2 - C# MVC 2 HtmlHelper to generate Table Columns with Model Binding -

i'm after mvc2 custom htmlhelper allow me dynamically create x amount of columns given data. say instance have zoo class contains list of animals (which contains sub class). ex: public class zoo { public list<animals> myanimals; } public class animals { public string year; public warmclimate warm; public class warmclimate { public string hippo; public string zebra; public string elephant; etc... } } and want create table similar following. creating column every list of animals have. 4 columns worth of data or 30. | | 2011 | 2012 | 2013 | 2014 | | hypo | 6 | 1 | 7 | 0 | | zebra | 1 | 1 | 2 | 1 | | elephant | 1 | 1 | 3 | 0 | i have this; quite basic. loop iterates on list grabbing defined property value. if there 100 animals in class, page 100 loops nightmare. <tr> <td>zebras: </td> <% (int = 0; < model.myanimals.c

node.js - Proper way to integrate compile-to-javascript languages under node? -

i'm trying set application using coffeescript, jade , mocha. however, when run mocha, --compilers flag, jade templates don't load. i have done similar setup using brunch, , jade templates automatically converted commonjs modules there. under node, not appear loaded modules. is there proper way this? right now, running mocha so: mocha --compilers coffee:coffee-script,jade:jade i'm sure there's way jury-rig along lines, thing understand .coffee files compile .js files, , when written commonjs modules, node can run them. however, .jade templates compile single javascript function opposed full commonjs module, node never going able make use of .jade templates without other module integrate standalone compiled template functions commonjs module system. guess automated build tools brunch adding little wrapper code boilerplate make templates commonjs modules.

c# - Binding a dynamically created CombinedGeometry Path? -

Image
i have application draws slots on screen rectangles rounded corners. slot can part of section, nothing more collection of slots. i want visually mark slots have been assigned. draw solid shape covering selected slots. before selection: after selection: the shape has without inner borders , hence combined geometry. i want bind combinedgeometry datatemplate of selected slots. viewmodel public observablecollection<slot> slots { { return _slots; } set { if (equals(value, _slots)) return; _slots = value; drawshape(); onpropertychanged(); } } private void drawshape() { path = new path(); path.stroke = brushes.white; path.strokethickness = 3; var count = slots.count(); var combined = new combinedgeometry(); combined.geometrycombinemode = geometrycombinemode.union; (var = 0; < count; i++) {

Wordpress: Simple solution to have mobile devices load a different homepage -

i have done quite bit of googling , have not found simple solution method or plugin load different static homepage mobile devices. there way or plugin (without revamping whole site mobile devices, mobile site style good, specific static homepage thing need changed). wordpress cms platform. thanks in advance! update: so installed plugin suggested below, copied on exact copy of theme using named 'mobile' in front reference, other same. read via google add following code functions.php theme file shows blank when add specific code. code: //set homepage $mobilehome = get_page_by_title( 'mobilehome' ); update_option( 'page_on_front', $mobilehome->id ); update_option( 'show_on_front', 'page' ); // set blog page $blog = get_page_by_title( 'blog' ); update_option( 'page_for_posts', $blog->id ); update 2, solved. i found simple solution. created new theme file 'page-home.php' , changed css class '#primar

c# - Add images dynamicaly asp net mvc 4 -

i building simple image gallery using asp.net mvc 4. best way in create method images users pc? mean there way open file explorer in browser , copy selected file /content/images folder? what best way in create method images users pc? using file input control , having action take file: @using (html.beginform("youraction", "controller", formmethod.post, new { enctype = "multipart/form-data" })) { <input type="file" name="image" /> <input type="submit" value="upload" /> } then post action be: public actionresult youraction(httppostedfilebase image) { //do whatever image } i mean there way open file explorer in browser , copy selected file /content/images folder? no, not content/images folder. should consider hosting solution/database store these images.

java - Hadoop get relative path from absolute path and base path -

i want relative path absolute path, given absolute base path. there hadoop java api this? for example, if absolute hdfs path abs_path = hdfs://name-node/level1/level2/level3 , absolute base path abs_base_path = hdfs://name-node/level1 , extract relative path abs_path , rel_path = level2/level3 . familiar using path constructor combine 2 paths. for example, if have rel_path , abs_base_path , can use 1 of overloaded constructors in path class http://hadoop.apache.org/docs/current/api/org/apache/hadoop/fs/path build abs_path cannot find api reverse. this done in fileoutputcommitter 's source code. relevant function is /** * find final name of given output file, given job output directory * , work directory. * @param joboutputdir job's output directory * @param taskoutput specific task output file * @param taskoutputpath job's work directory * @return final path specific output file * @throws ioexception */ private path getfin

Is MySQL Replication out of sync? Waiting for the slave SQL thread to free enough relay log space -

mysql slave server showing waiting slave sql thread free enough relay log space status week because relay logs full. it happened because sql thread stuck on error. once cleared error, started processing relay logs again , freeing space. does mean slave out of sync master, after reading through all relay logs? my reasoning since slave couldn't download relay logs week, data lost. please clarify me what's going on, can determine whether or not resync servers. re-syncing slave master not favorite option since database huge. try running select queries on slave, should return data inserted in master. if replication has stopped, new data not in slave.

c# - Is there a way to register events in bulk? -

Image
i have number of mother classes, each of these classes have different number of children objects of same type. , mother class need register event of these children objects. wondering if there's way registration automatically? something like: go through properties inside mother class, find properties of children type, , register event. you can use reflections subscribe events. define child class: class child { public child() { } // define event public event eventhandler didsomethingnaughty; // proeprty used trigger event public bool isnaughty { { return this.isnaughty; } set { this.isnaughty = value; if (this.isnaughty) { if (this.didsomethingnaughty != null) { this.didsomethingnaughty(this, new eventargs()); } } } } // private data member pro

c# - Split table in Entity Framework into multiple entities -

here's problem. have table user have quite few fields. want split table multiple entities this: user -> generaldetails -> communicationdetails -> address etc. all goes when extracting fields user generaldetails . however, when try same thing communicationdetails ef blows , require establish one-to-one relationship between generaldetails , communicationdetails . sample entities definition: public class user { public int userid { get; set; } public string somefield1 { get; set; } public int somefield2 { get; set; } public virtual generaldetails generaldetails { get; set; } public virtual communicationdetails communicationdetails { get; set; } public virtual address address { get; set; } } public class generaldetails { [key] public int userid { get; set; } public string firstname { get; set; } public string lastname { get; set; } public string email { get; set; } public virtual user user { get;set;

python - Populate a Pandas SparseDataFrame from a SciPy Sparse Matrix -

i noticed pandas has support sparse matrices , arrays . currently, create dataframe() s this: return dataframe(matrix.toarray(), columns=features, index=observations) is there way create sparsedataframe() scipy.sparse.csc_matrix() or csr_matrix() ? converting dense format kills ram badly. thanks! a direct conversion not supported atm. contributions welcome! try this, should ok on memory spareseries csc_matrix (for 1 column) , pretty space efficient in [37]: col = np.array([0,0,1,2,2,2]) in [38]: data = np.array([1,2,3,4,5,6],dtype='float64') in [39]: m = csc_matrix( (data,(row,col)), shape=(3,3) ) in [40]: m out[40]: <3x3 sparse matrix of type '<type 'numpy.float64'>' 6 stored elements in compressed sparse column format> in [46]: pd.sparsedataframe([ pd.sparseseries(m[i].toarray().ravel()) in np.arange(m.shape[0]) ]) out[46]: 0 1 2 0 1 0 4 1 0 0 5 2 2 3 6 in [47]: df

sublimetext2 - Sublime Text 2: Disable 'Goto Anything' Preview -

is there way disable document preview when using goto / ctrl + p in sublime text 2? i've done lot of searching recent information i've found seems bit old (such http://www.sublimetext.com/forum/viewtopic.php?f=3&t=5895 ) , part related disabling preview single click in sidebar. i use ctrl + p open files typing in path, having dozen or files flash open second annoying; plus, i'm typing in path file open in current tab, , once preview comes can't see path more. thanks! i not entirely positive can disable entirely, works part of editor. the settings related preview can find "preview_on_click" , makes mention of sidebar. not aware of having effect on goto overlay. the 1 other thing dealing goto overlay , previews, "binary_file_patterns" setting, tell st2 treat file specify in there binary... not sure want that.

String formatting in C# to get identical spacing -

i've been looking string formatting , frankly i'm getting confused. want do. i have "character stats" page (this console app), , want formatted this: =----------------------------------= = strength: 24 | agility: 30 = = dexterity: 30 | stamina: 28 = = magic: 12 | luck: 18 = =----------------------------------= i guess i'm trying find out how make middle '|' divider in same place regardless of how many letters stat or how many points stat is. thanks input. edit: want ending '=' in same spot. i learned new, seems! of others have mentioned, can accomplish same thing using string.format . the interpolation strings used in string.format can include optional alignment component. // index alignment // v v string.format("hello {0,-10}!", "world"); when negative, string left-aligned. when positive, right aligned. in both cases, string padded corre

Not seeing BoneCP shutdown() with Hibernate, Spring, Bonecp -

i implementing application spring, hibernate , bonecp. when invoke shutdown script of tomcat see errors this the web application [/rest] appears have started thread named [bonecp-release-thread-helper-thread] has failed stop it. create memory leak. when see logs, not seeing "shutting down connection pool...", assuming missing on here. <?xml version="1.0" encoding="utf-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:oxm="http://www.springframework.org/schema/oxm" xmlns:sws="http://www.springframework.org/schema/web-services" xsi:schemalocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd http://www.springframework.org/schema/oxm http://www.springframework.org/schema/oxm/spring-oxm-1.5.xsd http://www.springframework.org/schema/web-services http://www.

javascript - Triggering a click event from content script - chrome extension -

in chrome extension's content script, click on links/buttons on webpages sites. that, use following code in content script (i embed jquery in content script): $(css_selector).trigger("click") this works on sites. however, on sites delta.com, match.com, , paypal.com, way of triggering click on elements not work. on delta.com, following exception thrown when attempt triggering in content script: error: attempt made reference node in context not exist. error: notfounderror: dom exception 8 strange thing is, if open javascript consoleon delta.com, include jquery , attempt same click triggering code snippet, works. on match.com , paypal.com, triggering not work in content script , there no error. cannot trigger "click" event through javascript console way did on delta.com. if manually use mouse click, works fine on 3 sites. hence tried simulate using mousedown(), mouseup(), did not work either. this seems issue because javascripts sites hijacking

video.js - VideoJS font not applied to controls in Firefox 22 -

i did according setup instructions , got video.js player play flv video. problem ui broken in firefox 22 because font loaded correctly not applied controls. see box numbers inside instead of play button example. this works in chrome correctly. i double checked firebug font file loaded server , there no problems. firebug shows when inspect play button: content: ""; and if hover font-family see videojs font sample displayed. it same origin policy. working on development subdomain font hosted on main domain , that's why firefox refused use it. (chrome used it)

Why will a batch file fail when run from a C# app, but not when run on it's own? -

i'm trying run simple batch script uninstall windows update. @echo off rem uninstall windows update 2592687 wusa /uninstall /kb:2592687 /norestart when run command line works fine, when run c# console app static void main(string[] args) { string path = path.getfullpath("..\\..\\kbunins.bat"); processstartinfo proc = new processstartinfo(path); process.start(proc); } i installer encountered error: 0x8000ffff catastrophic failure error message i've tried googling error message , couldn't find useful , tried run cmd.exe bat file argument , have tried running command directly , got same results. edit: i've built application , run installer administrator update still isn't uninstalled. i've added in file.exists() bit , finds file. what cause this? try compile app. go bin folder. right click on exe file , choose run administrator . if works, assign administrator permission code (if can so).

rest - http DELETE with parameters using Jersey -

i have code contains several different delete methods, 1 of takes parameter, or @ least ideally take parameter. when make request, either through curl or through web client, doesn't work. other delete requests function fine , i've hard-coded in parameter want pass see if call works , does. i've tried both pathparam , queryparam , neither works. here's how i'm using pathparams, i'm pretty sure correct, queryparams looks similar don't want post too. @delete @path("/byid/{id}") public void deletebyid(@pathparam("id") string id) and same thing quereyparams path different from understand lot of restful apis ignore kind of request body delete request, or treat put or post. there way around this? have database contains several objects , need delete 1 based on unique identifier, passed in client. if there no way around there other way it? its possible im missing obvious here i've been using jersey few weeks , point had never hear

html - append span to hover -

how can append span effected hover transition. i'm trying text span fade image when there mouseover #grid li span { color: white; display:block; bottom:250px; position:relative; width:180px; } #grid li { float: left; margin: 0 40px 75px 0px; display:inline; position:relative; } #grid li a:hover img { -webkit-transition: opacity .3s ease-in; -moz-transition: opactiy .3s ease-in; -ms-transition: opacity .3s ease-in; -o-transition: opacity .3s ease-in; transition: opacity .3s ease-in; opacity: 1; } #grid:hover img { -webkit-transition: opacity .3s ease-in; -moz-transition: opactiy .3s ease-in; -ms-transition: opacity .3s ease-in; -o-transition: opacity .3s ease-in; transition: opacity .3s ease-in; zoom: 1; filter: alpha(opacity=100); opacity: 0.3; } jsfiddle modify css li fade. target 1 being hovered. http://jsfiddle.net/xyzzx/13/ change #grid:hover img { ...transitions... } to #grid:hover li { ..

r - Remove list from lists in list if length -

i have list: a <- list(list(c("sam1", "control"), c("sam1", "latanoprost free acid", "gsm6683", "gsm6684"), c("sam1", "prostaglandin f2alpha", "gsm6687", "gsm6688")), list(c("sam2", "control"), c("sam2", "latanoprost free acid", "gsm6681", "gsm6682"), c("sam2", "prostaglandin f2alpha", "gsm6685", "gsm6686"))) i'd remove elements (lists), length less 3 (<3). tried double lapply a[[i]][[j]] , <- null, got lists null. this: b <- lapply(seq(length(a)),function(i){ lapply(seq(length(a[[1]])),function(j){ if(length(a[[i]][[j]]) < 3) {a[[i]][[j]] <- null} }) }) thank help... how this? lapply(a, function(x) x[sapply(x, length) >= 3]) or lapply(a, filter, f = function(x) length(x) >= 3)

r - Sampled the original values and convert it to no. of time it occured in sample -

t has 20 values, c has 20 values 0, 1. interested in t matrix. here have loop, repeating 5 times. every time sel give 20 values. want store there frequency in t.mat. how can required results, resulting table may below table t <- 1:20 # c <- seq(0:1, 10) t.mat <- array(dim = c(20, 5)) rep <- 5 for(mm in 1:rep){ sel <- sample(1:20, replace = true) tt <- t[sel] # cc <- c[sel] t.mat[, mm] = tt[1:20] # here problem lies, have no clue how } the output above may below. t of 20 values, give 6 lines: t v1 v2 v3 v4 v5 1 1 0 1 0 1 2 0 0 2 0 1 3 0 1 1 1 0 4 1 1 0 0 1 5 2 0 2 1 0 6 0 0 0 1 2 i'm guessing little bit want, it's this: do.call(cbind, lapply(1:5, function(i) tabulate(sample(t, replace = t), nbins = 20))) sample generates samples want, tabulate counts frequencies (with max specified manually not occur in sample), lappl

sql - Using (UPDLOCK, READPAST) and ORDER BY - Not Working? -

i trying select codes database, not need person coming along , selecting same codes before have chance update them taken. have tried using updlock , solves duplicate sales problem adds problem of deadlocks. using (updlock, readpast), works fine until try use order within statement. microsoft sql 2005 begin transaction select top 10 id dbo.codes (updlock, readpast) itemno = 'type-2' , sold = 0 order cast(nowstamp datetime) asc commit transaction i feel problem going come indexes. this similar issue order , with(rowlock, updlock, readpast) the answer describes need rowlock , index. unfortunately, can't create index on column since it's considered non-deterministic because of cast (see first note on http://msdn.microsoft.com/en-us/library/ms189292(v=sql.90).aspx ). you should use convert , specify deterministic style from: http://msdn.microsoft.com/en-us/library/ms187928(v=sql.90).aspx

xml - XPath count adjacent nodes with similar attribute value -

i wonder if help. have xml, like: <foo> <bar id="1"> <chu id="1" val="2" /> <chu id="2" val="2" /> <chu id="3" val="3" /> <chu id="4" val="3" /> <chu id="5" val="3" /> <chu id="6" val="4" /> <chu id="7" val="3" /> <chu id="8" val="3" /> <chu id="9" val="3" /> </bar> <bar id="2"> <chu id="1" val="2" /> <chu id="2" val="2" /> <chu id="3" val="3" /> <chu id="4" val="3" /> <chu id="5" val="3" /> <chu id="6" val="3" /> <chu id="7" val=&qu

c# - Can't get Microsoft.Office.Interop reference to work -

i have c# winforms app , trying open excel sheet. when try add reference microsoft.office.interop, "office" part red , says "can't resolve symbol 'office'". when attempt build, error is: the type or namespace name 'office' not exist in namespace 'microsoft' (are missing assembly reference?) i have office 2012 installed, , think have primary interop assemblies installed... i'm not positive. i know should easy, i've been looking around answer hour , can't figure out. in advance! you need add reference project. (assuming visual studio 2010) in solution explorer can right click on references tree , choose "add reference." choose .net tab , "microsoft.office.[...]" components. add ones need. think excel may suffice (you may have trial , error on ones). references http://oi39.tinypic.com/65010w.jpg reference add box http://oi40.tinypic.com/260qv7b.jpg

indexing - Undefined index: connection_string -

i trying install app , got message slim application error application not run because of following error: details type: errorexception code: 8 message: undefined index: connection_string file: /applications/mamp/htdocs/file2/app/config/initializers/setup.php line: 198 trace #0 /applications/mamp/htdocs/file2/app/config/initializers/setup.php(198): slim\slim::handleerrors(8, 'undefined index...', '/applications/m...', 198, array) #1 [internal function]: {closure}() #2 /applications/mamp/htdocs/file2/app/slim/router.php(172): call_user_func_array(object(closure), array) #3 /applications/mamp/htdocs/file2/app/slim/slim.php(1222): slim\router->dispatch(object(slim\route)) #4 /applications/mamp/htdocs/file2/app/slim/middleware/flash.php(86): slim\slim->call() #5 /applications/mamp/htdocs/file2/app/slim/middleware/methodoverride.php(94): slim\middleware\flash->call() #6 /applications/mamp/htdocs/file2/app/slim/middleware/prettyexceptions.php(67): slim\middlew

batch file - How to find out if HDD is ATA or AHCI? -

from batch file how find if hard drive ata or ahci? stored somewhere in file can parse or there command find out? there may better methods detects ahci here: wmic idecontroller|find /i "ahci">nul && echo ahci detected

javascript - Broadcast message to all clients -

Image
i've tried broadcasting message clients no success. the marked line works 1 client. i've tried these options: socket.emit socket.broadcast.emit thanks you calling on function on wrong object. should rename socket variable else. commonly, people use io . io = require('socket.io').listen(server); then, need call emit on sockets send users: io.sockets.on('connection', function(socket) { io.sockets.emit('message', data); }); of course, send emit uses message event. can use instead inside callback: io.sockets.send(data); in either case, have following in client react event: socket.on('message', function (data) { // things data }); note: socket.broadcast.emit can used send event users connected other user connected socket .

java - How do I make the background color change? -

i working on program has 5 different color radio buttons, , when clicked, background should change corresponding color. background not changing. cannot life of me figure out wrong code. can out there me find problem? thank you! code follows: public void actionperformed(actionevent e) { if (blue.getstate()) f.setbackground(color.blue); else if (red.getstate()) f.setbackground(color.red); else if (yellow.getstate()) f.setbackground(color.yellow); else if (pink.getstate()) f.setbackground(color.pink); else if (gray.getstate()) f.setbackground(color.gray); } //end of actionperformed method public void itemstatechanged(itemevent e) { } more you're using java.awt.checkbox components (from your earlier question ) respond itemlisteners not actionlisteners . therefore move code itemstatechanged method public void itemstatechanged(itemevent e) { if (blue.getstate()) { f.setbackground(color.blue); } else if (red.getstate()) { f

ajax - Passing div element to success callback jquery -

i using lis obtain list of <li> dom, , in each li , update projectphoto after ajax call. "li" in callback function referring last item in lis , there way overcome this, or such pass value ? p/s: pretty sure has been discussed before can't reach right terminology. apology in advance. var lis = $('.porject_list li'); (var = 0; < lis.length; i++) { var li = lis.eq(i); var projectid = li.attr('data-project-id'); $.get("/webapi/projects/projectphoto/" + projectid, function (res) { $("img", li).attr('src', res); }); } you may try (just wrap ajax call in function) (function(current){ $.get("/webapi/projects/projectphoto/" + projectid, function (res) { $("img", current).attr('src', res); }); })(li); update : i didn't notice var li = lis.eq(pos); , this, anyways, can use var li = lis[i]; to curr

html - Trying to Categorize XML data in a PHP Shopping Cart -

ok, i'm attempting create php based shopping cart reading xml file catalogue. problem when print out information onto website, prints out in xml file. need put them categories (i.e. shoes, apparel, etc.) , print out called category. the xml file structured such (extra spaces added organizational purposes): <items> <product> <id> tshirt01 </id> <title> red t-shirt </title> <category> apparel </category> <description> t-shirt designed sassafrass </description> <img> ../images/apparel1.jpg </img> <price> 5.99 </price> </product> </items> i print out information onto website using following code: <?php echo render_products_from_xml(); ?> and here's function php command sets

cannot open connection in an r script that worked previously -

i having "cannot open connection" error in r script. below details: > write.csv(table1.fivereitwts,file="c:\\users\\john broussard\\dropbox\\evthandbookproject\\figurestables\\figure3data.csv") error in file(file, ifelse(append, "a", "w")) : cannot open connection in addition: warning message: in file(file, ifelse(append, "a", "w")) : cannot open file 'c:\users\john broussard\dropbox\evthandbookproject\figurestables\figure3data.csv': no such file or directory > this new file being created, directory exists. can see directory, contains other files. have used code success, of sudden, unable write file directory. what additional information can provide me resolve error? you have use escape character whitespace in filepath. try write whole thing this: c:/users/john\ broussard/dropbox/evthandbookproject/figurestables/figure3data.csv edit: since apparently not source of problem, maybe fi

android - In a service, why can you make toast in onDestroy() but not onHandleIntent()? -

it's sort of academic how come following displays toast: public class myservice extends intentservice { public pdfrotateservice() { super("myservice"); // todo auto-generated constructor stub } @override protected void onhandleintent(intent intent) { dosomethings(); } @override public void ondestroy() { super.ondestroy(); toast.maketext(this, text, duration).show(); } } ,but putting toast.maketext() in onhandleintent() instead doesn't display toast? read documentation understand how each method works. according documentation of intentservice onhandleintent runs on worker thread that runs independently other application logic. toast work, has implemented in main ui thread

jquery - CSS "onclick" pseudo class is not working -

this code taken http://www.webdesignerdepot.com/2012/10/creating-a-modal-window-with-html5-and-css3/ modifications. my purpose show modal form , close when user click [x] button @ corner, or automatically close after 10 seconds. the problem form cannot close when click [x] button. what's wrong in code below? index.html: <html> <head> <link href="style.css" rel="stylesheet"> <script src="jquery.min.js"></script> </head> <body> <div id="openmodal" class="modaldialog"> <div> <a href="#close" title="close" class="close">x</a> hi, modal form. </div> </div> <script type="text/javascript"> settimeout(function() { $('#openmodal').fadeout('slow'); }, 10000); </script> </body> </html> style.css: .modaldialog:target {

Setting a Network location in Java ClassPath -

i trying run java program on windows machines. libraries program placed on network location - \\libs\myprog . i can't create network drive on windows machine . now question is, how set java classpath above lib? i tried following: java -cp \\libs\myprog main java -cp //libs/myprog main but nothing worked. if desparate , need (beware: lousy design , performance point of view), can use urlclassloader retrieving libraries @ runtime. configure urls want load libs e.g. @ application start @ argument main class or system property , hand them on urlclassloader can retrieve classes (probably lot slower , more risky local file system access, work). have @ javadoc: urlclassloader javadoc

java - JRException: Invalid byte 1 of 1-byte UTF-8 sequence -

i trying generate report using jasper reports, getting following error. net.sf.jasperreports.engine.jrexception: com.sun.org.apache.xerces.internal.impl.io.malformedbytesequenceexception: invalid byte 1 of 1-byte utf-8 sequence. i using java code: list<aluno> lista = alunoservice.findall(); string path = req.getsession().getservletcontext().getrealpath("web-inf"); jasperreport report = jaspercompilemanager.compilereport(path + "/relatorios/aluno.jasper"); jasperprint print = jasperfillmanager.fillreport(report, null, new jrbeancollectiondatasource(lista)); jasperexportmanager.exportreporttopdffile(print, path + "/relatorios/teste.pdf"); the error ocurring when try compile report: jasperreport report = jaspercompilemanager.compilereport(path + "/relatorios/aluno.jasper"); the aluno.jrxml file in utf-8 enconding: <?xml version="1.0" encoding="utf-8"?> i've researched pr

PHP payment gateway integration for buyer side application -

i need payment gateway php application.i running software consultancy , employees different parts of world. have build application manage invoices , pay money them. need integrated payment gateway. my organization in usa. i checked payment gateways, need seller account each employee.that not possible. my direct requirement cash must transferred card/bank account employee's bank account . want pay through net banking,credit/debit cards,wired transfers,etc. please help!! thank you if requirements such employees need invoice first before paid, don't know how can around seller account requirement. however, if you're trying pay employees, , manage invoices through separate system, paypal work -- think payment gateway work if push requirements point pay employees (one process) , handle client invoices through second process. last time checked, pay pal lets transfer family , friends without percentage charge, possibly bend meet employee payment requiremen

protocol buffers - Problems with protobuf when generating haxe source file -

i want generate protobuf source file haxe,but last step "haxelib run protohx generate protohx.json" come across problem says plugin: program not found or not executable --haxe_out: protoc-gen-haxe: plugin failed status code 1. anyone can fix out?thanks lot! i ran same issue , got around running task manually generate proto class files. i copied plugin local path, made proto shell script executable: for example: chmod +x proto protoc --plugin=protoc-gen-haxe=plugin --haxe_out=./src-gen --proto_path=. proto/your.proto

sqlite3 - Android SQLiteConstraintException: error code 19: constraint failed -

i have seen other questions this, none of answers seemed work code. i'm getting 'sqliteconstraintexception: error code 19: constraint failed' error when try insert db. here code insert operation @override public void oncreate(sqlitedatabase db) { db.execsql("create table " + data_table + "(" + key_id + " integer primary key autoincrement," + key_name + " text not null," + key_type + " text);"); } public static void insert_data(string name, string type) { mdb = dbhelper.getwritabledatabase(); contentvalues iv = new contentvalues(); iv.put(key_name, name); iv.put(key_type, type); mdb.insert(data_table, null, iv); } in activity inserting values database db.insert_data("all value", "all artist");//my constrain error points here

Ruby and PHP togheter -

i know php i'm new ruby on rails, learn it. the thing have php code inside ruby code, or similar this. there way that, if it's hard achieve ? you can invoke php interpreter inside ruby external command, whether system , backticks, popen3 or mechanism. why want that?

Javascript parseInt on large negative number gives NaN -

when this: var x = parseint("–2147483648"); console.log(x); i value as: nan why happen? i want test if number in range of c (int), doing above, not work. also, want c (long), there way this? for example: if do: var x = parseint("-9223372036854775808"); console.log(x); now, know (-+)2^53 limit of numbers in javascript. there other way test if given value in form in range of long or int? it should work fine, problem you're using wrong character, ndash – vs hyphen - : var x = parseint("-2147483648"); console.log(x); if copy/paste you'll see works now.

PHP Columns and Rows with Pagination -

i use responsive grid framework html sites , need incorporate fetching results database populate rows/columns. im looking 4 columns x 3 rows setting data horizontally. <div class="row"> <div class="three columns">$row=>result</div> <div class="three columns">$row=>result</div> <div class="three columns">$row=>result</div> <div class="three columns">$row=>result</div> </div> <div class="row"> <div class="three columns">$row=>result</div> <div class="three columns">$row=>result</div> <div class="three columns">$row=>result</div> <div class="three columns">$row=>result</div> </div> <div class="row"> <div class="three columns">$row=>result</div> <div class="three

javascript - jquery mobile coming back to prev page onclick event is not working -

i trying create 1 app having 3 pages in single page template architecture first page contains login page , using $.mobile.changepage('xxxx.php'); navigate working in second page having listview there navigating page using $.mobile.changepage('xxxx.php'); , coming prev page using $.mobile.changepage('xxxx.php'); but when go prev page listview on click delegate method other method not working. works after refresh page. below code. suggestions great. secondpage.php <!doctype html> <html> <head> <title> management</title> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>jquery mobile</title> <script src="http://code.jquery.com/jquery-1.9.1.min.js"></script> <script src="http://code.jquery.com/mobile/1.3.1/jquery.mobile-1.3.1.min.js"></script> <link rel="stylesheet" href="

rust - DuplexStream across tasks and closures -

i'm having trouble lifetimes , borrowed points. i've read manual , borrowed pointer tutorial, but... i'm still stuck. sketch of main.rs fn main() { let (db_child, repo_child):(duplexstream<~str, ~str>, duplexstream<~str, ~str>) = duplexstream(); spawn { slurp_repos(&repo_child); } } sketch of repos.rs fn slurp_repos(chan: &'static duplexstream<~str, ~str>) { ... request.begin |event| { ... chan.send(api_url); } } when compile these modules, main.rs has following error: main.rs:21:20: 21:31 error: borrowed value not live long enough main.rs:21 slurp_repos(&repo_child); ^~~~~~~~~~~ note: borrowed pointer must valid static lifetime... main.rs:13:10: 1:0 note: ...but borrowed value valid block @ 13:10 error: aborting due previous error i can't quite figure out how declare duplexstreams lifetime static. or perhaps wrong way go in function

mysql - migration to and from aws rds -

can advise me, 1) if using aws rds, how can seamlessly migrate own cluster of mysql without downtime , data loss? 2) if using own cluster of mysql, how can switch rds without downtime , data loss? use replication, both new , old mysql sync data, , can shutdown old 1 after import completes. check link: http://docs.aws.amazon.com/amazonrds/latest/userguide/mysql.procedural.importing.nonrdsrepl.html

How is CountDownLatch used in Java Multithreading? -

can me understand java countdownlatch , when use it? i don't have clear idea of how program works. understand 3 threads start @ once , each thread call countdownlatch after 3000ms. count down decrement 1 one. after latch becomes 0 program prints "completed". maybe way understood incorrect. import java.util.concurrent.countdownlatch; import java.util.concurrent.executorservice; import java.util.concurrent.executors; class processor implements runnable { private countdownlatch latch; public processor(countdownlatch latch) { this.latch = latch; } public void run() { system.out.println("started."); try { thread.sleep(3000); } catch (interruptedexception e) { e.printstacktrace(); } latch.countdown(); } } // ----------------------------------------------------- public class app { public static void main(string[] args) { countdownlatch latch = n

html - jquery not clear div -

i have code ajax load in site if (base === 'basic') { $.ajax({ url: location, data: {}, success: function (result) { document.title = titlepage; window.history.replacestate(null, null, url); $('#content').empty(); $('#content').html(''); $("#content").html(result); } }); } //if base everything work on not $('#content').empty(); $('#content').html(''); how can clear on <div id="content"> so can load new things on it? lot of other div , other codes in it. the problem have 2 tags same attribute value attribute id. html specification id must unique identificator. <header> <div id="content"></div> </header> <section> <div id="content"></div> </section> so change header div id , ready go.

java - Protect a DB against rooted devices -

imagine have game, need save data every user level, highscore, gold,... if saved of these locally (on user´s device) aren´t safe , modified user rooted device , bit of skill. (as discussed here ) so need put them on database on server - i´d connect webservice , json. but realized isn´t safer: if can apk, can decompile it, code used post highscore, , either edit post 1,234,567 (and compile again) or extract , post highscore. in case of highscore, it´s not big problem - this, it´s possible get/post that´s used in app. how can protect app/database against this? my ideas: encrypt post: can´t work, encryption happens on device encrypt post seed db: "hacker" can seed aswell, not safer generate key every connection: same first in 1 sentence: long "hacker" can mirror behaviour of app, there way of ensuring connection db opened app , not else? you need change approach this. if don't want user change data, don't put on device. se

Time Scheduling in Navision with Timer -

i facing problem regarding running object , can form,report etc, automatically depending on user defined time. let @ 6am everyday, process report should run automatically. how can achieve this? i have found solution me.. example runs @ 7:40, 12:40 , 16:40 each day. using navision timer 1.0 navtimer automation 'navision timer 1.0'.timer set property 'withevents' of navtimer yes set property 'singleinstance' of codeunit, if using one, yes in on run trigger write if isclear(navtimer) create(navtimer); navtimer.interval := 1 * 60000; // important! set 1 minute navtimer.enabled := true; in timer trigger (it appers after change withevents property yes) write stime := copystr(format(time), 1, 5); // cut seconds shour := copystr(stime, 1, 2); sminute := copystr(stime, 4, 2); if shour in ['07','12','16'] if sminute = '40' if not codeunit.run(codeunit::xxx) then;

ruby on rails - What's causing this error? ActionView::Template::Error: ActionController::Metal#session delegated to @_request.session, but @_request is nil -

in /app/models/review.rb , have method that's designed create pdf output of review#print action. designed capture entire print stylesheet , inline in header when i'm in production mode: def create_pdf snip # code sets @competitors, @elements & @questions css = rails.application.assets.find_asset('print').to_s if rails.env.production? html = actioncontroller::base.new.render_to_string "reviews/print", :locals => {:@review => self, :@competitors => @competitors, :@elements => @elements, :@questions => @questions, :@css => css} pdf = hypdf.new(html, :test => true) upload = pdf.upload_to_s3("testivate", [self.id, "_", time.now.full_time, ".pdf"].join.downcase.gsub(" ", "_"), true) self.update_attribute :latest_url, upload notificationmailer.pdf_creation(self).deliver return html.to_s.truncate(300) # debugging -- can see <head> end i have tried many var