Posts

Showing posts from June, 2011

How To remove a marker on google maps api v3 -

i want delete marker, doesn't work, help? code gevent.addlistener(map, "dblclick", function() { deletemarker(marker, cells); } ); function deletemarker(marker,cells) { marker.setmap(null); } thank you i think error not google maps v3 . marker.setmap(null); //correct function call has 3 parameters deletemarker(marker, cells,true); whereas function definition has 2 parameters function deletemarker(marker,cells) { marker.setmap(null); }

.net - Exclude code coverage in assemblyinfo file -

i want know how can set exclude code coverage attribute few files assemblyinfo file? aware can set attribute @ class level in case not want go each of these classes , set attribute. i set attribute @ higher level or @ single place can manage this. believe can in assemblyinfo file not sure. use .runsettings file configure code coverage specified here: http://msdn.microsoft.com/en-us/library/jj159530.aspx in file use "source" element exclude source files want leave out. <sources> <exclude> <source>.*\\model\\.*</source> </exclude> </sources>

c++ - Multithreading and oop -

i working on project uses 2 different threads ( th1 , th2 ). share several object , variables via extern keyword. global object , global variables something like: extern obj1 *obj1; it seems me that: calling metod of obj1 in different threads; setting value of obj1 in different threads; using heavily global boolean variables semaphores; is not safe way of programming, have reference proof it, paper or book discourage it. can clarify? i'm assuming x86 platform being used visual studio c++. the rule simple: if thread modifies object (including "objects" doubles or pointers), , more 1 thread accesses it, all accesses must protected. defined in c++11 standard, restates rules applied under posix (and far know, under windows well). beyond that, safe depends on doing. in own code, example, find rare need non-const global objects; logging exception (and there, of objects thread local, shared object used when log message flushed final destination)...

java - Propagating Exception to called method using throws -

stack trace follows: c b main assume c throwing filenotfoundexception . propagated exception b using throws . , propagating exceptions b a , a main . when use throws filenotfoundexception in main, exception propagated? because didn't define catch inside main filenotfoundexception , throws . to java runtime, print stack trace , abort program. (i'm curious led question. did try code? confused behavior?)

java - Client Not Receiving String From Server -

i trying write tcp client using sockets in java, cannot seem read data sent server client. time received server not time.. public class tcpclient { private string servermessage; public static final string serverip = "103.13.97.87"; //your computer ip address public static final int serverport = 8101; private onmessagereceived mmessagelistener = null; private boolean mrun = false; printwriter out; bufferedreader in; /** * constructor of class. onmessagedreceived listens messages received server */ public tcpclient(onmessagereceived listener) { mmessagelistener = listener; } /** * sends message entered client server * @param message text entered client */ public void sendmessage(string message){ if (out != null && !out.checkerror()) { out.println(message); out.flush(); } } public void stopclient(){ mrun = false; } ...

java - Cross Domain in Tomcat using crossdomain.xml -

i'm trying add page in web pages. first choice iframe, target websites didn't allow iframe. after tried using cross domain. i'm using tomcat 7.0.27 i place crossdomain.xml in webapps/root/crossdomain.xml my crossdomain.xml code: <?xml version="1.0" ?> <cross-domain-policy> <allow-access-from domain="*" /> </cross-domain-policy> my jsp code: <html> <head><script src="http://code.jquery.com/jquery-2.0.3.min.js"></script></head> <body> <script> $(document).ready(function() { jquery('#result').load('http://www.facebook.com', function() { alert('load performed.'); }); }); </script> <div id="result"/> </body> </html> the problem still doesn't work. got error says **xmlhttprequest cannot load http://www.facebook.com/. origin http://localhost:8080 not allowed access-control-allow-origin.** ...

How to determine the RAM Size of my MongoDB Sever -

i have used command db.collection.stats() db.stats() { "collections" : 17, "objects" : 487747, "avgobjsize" : 1924.9327048654322, "datasize" : 938880152, "storagesize" : 1159314432, "numextents" : 82, "indexes" : 32, "indexsize" : 153812992, "filesize" : 8519680000, "ok" : 1 } from net found out statement indexes should in memory .(which nothing ram) the index size 153812992 , datasize 938880152 could please tell me amount of ram require on mongodb server , performance aways great . as per applciation design , daiily 100k insertions/updations might happen , , 1 more question have , index size grow each day ?? then in case how can determine best fit ram size application . please advice , in advance . there tool in later versions of mongodb finding out how big working set is, sti...

seo - .htaccess make friendly url's -

i have website www.example.com/index.php?q=registration redirect www.example.com/registration this code doesn't seems work, don't know why. rewriteengine on rewriterule ^([^/]*)\.html$ /index.php?q=$1 [l] can me? try this rewriteengine on rewriterule ^(.*)$ index.php?q=$1 [l,qsa] rewriterule ^([^/]*)(.*)$ /$1[l,qsa]

Barcode Number required in crystal reports -

i using crystal reports 2011.for field when changed bar code(ascii 39) giving bar code need corresponding number below of bar code. please how corresponding number below bar code. if has been set conventionally, using code39 should drag barcode db field underneath barcode , set font more regular display barcode number.

javascript - Jquery Hover effect with clickable element inside the main clickable element -

i have div has clickable event. <div id="economy" class="service-block" title="economy" data-price="79.09"> <h3>economy </h3> <span class="service-price">r79.09</span> <div class="selected-service"></div> <div class="service-info" title="economy">?</div> </div> it has hover effect $(function () { $('.service-block').hover( function () { $(this).animate({ backgroundcolor: '#258dd4' }, 250); var tron = $(this).attr('id'); $('#' + tron + ' .service-info').show(50); $('#' + tron + ' h3').css('color', '#303030'); }, function () { $(this).animate({ backgroundcolor: 'rgba(37, 140, 212,0.2)', }, 250); var tron = $(this).attr('id'); $('....

c# - On ASP.NET formview when are the ModeChanged and ModeChanging events raised? -

this popped up, when trying find why onmodechanging handler wasn't being called when called changemode event of formview. on formview's changemode method msdn page , stated it: switches formview control specified data-entry mode but that: the modechanged , modechanging events not raised when method called and in modechanged , modechanging events pages , says occur: when formview control switches between edit, insert, , read-only mode after/before mode changes, respectively. can explain me: when modechanged/ing events raised? and, there way force these events raised? i think know why now. i've found answer in other forum , , though didn't find code of formview, i've found detailsview implementation , think in case might similar. basically i've understood of it, modechanged/ing events raised when command buttons clicked (cancel, edit, insert, new , update), i.e. when 1 doesn't have direct control on these events...

java - Updating Juno to Kepler cause existing project in workspace non functional -

does 1 know how on come issue ? have followed link after updating it, every thing seems correct existing projects not able run via tomcat (previously in juno working). can see tomcat server under servers view, when click on file menu -> new show no applicable item .. not able create new dynamic web project, neither able change project facets project properties... can 1 me out in case ? i go answer in https://stackoverflow.com/a/17337692/429972 i clean new install , plugins need again. doesnt take long usually. after have done import old projects in new workspace.

jQuery input prob disable false by clicking the input -

i want clicking on input element, prop, "disabled" getting false, not working. to set input on .ready "disabled" -> true working. <script> $(document).ready(function() { $("input").prop("disabled", true); // working }); $("input").click(function() { $(this).prop("disabled", false); // not working }); </script> solution / edit (sorry not allowed use answer-button on own question): i found better solution. using "readonly" instead of "disabled" job. <script> $(document).ready(function() { $("input").prop("readonly", true); $("input").click(function() { $(this).prop("readonly", false); }); }); </script> seems logic reverted. disabled=true means element disabled (not clickable). try way: $(document).ready(function() { $(this).removeprop("disabled"); $(...

javascript - doPostback failing in IE 11+ Windows 8.1 -

i getting blank page in ie 11 in windows 8.1 preview.after inspecting page assumed following code might culprit,since after these line there not further line displayed debugger window, code breaking after line. ie 11 <!-- <form name="aspnetform" method="post" action="register" id="aspnetform"> <input type="hidden" name="__viewstate" id="__viewstate" value="/wepdwukmtkwndq3o i tried same page in chrome version 29.0.1547.57 m in windows 8.1 preview working fine there , following code. chrome <script type="text/javascript"> //<![cdata[ var theform = document.forms['aspnetform']; if (!theform) { theform = document.aspnetform; } function __dopostback(eventtarget, eventargument) { if (!theform.onsubmit || (theform.onsubmit() != false)) { theform.__eventtarget.value = eventtarget; theform.__eventargument.value = eventargument;...

Stuck on some multichoice questions for MYSQL -

Image
i doing past year test on mysql questions , not sure of following questions. can me out? my picks following questions follows i'm not sure if right: 4c 4c add column , you'll error column count doesn't match value count @ row 1 a) doesn't matter long don't want insert duplicate keys b) data truncated , warning produced, not fail d) not true, can specify whatever value want (as long it's not duplicate if column primary key or has unique index on it) e) why should break. don't have have pk, though i'd recommend have one. 6a c, d , e not unique, of course. difference between , b is, in b district not needed make unique. have district in automatically created index primary keys? no. if want improve performance of queries on table, 1 can assume every field of table in clause. therefore want have compound index , in this, want have columns first, filter rows. , neither country, nor district. 21b not that, it...

gcc - converting elf32--bigarm to motorolla s19 -

i want convert elf32-bigarm motorolla s19 using binutil objcopy of codesourcery toolchain as: copy sample.elf sample.s19 arm-none-eabi-objcopy.exe -o srec sample.s19 when convert file converts automatically little endian. i.e. 0x12345678 0x78563412 how can solve problem. i have seen dump of elf , in correct endianness. while s19 file has incorrect ordering.

java - Reading from assets gives null pointer -

i have file in assets folder want access in class i've named storagemanager (just regular class, doesn't extend anything): public class storagemanager { private context context; public storagemanager(context context){ this.context=context; } public string readfileasstring(string filepath) throws java.io.ioexception { assetmanager = context.getassets(); inputstream = am.open(filepath); string results = ""; int data = is.read(); while (data !=-1) { results += (char)data; data = is.read(); } is.close(); return results; } } i'm creating instance of class within listfragment , passing getactivity() context. however when make call readfileasstring valid filepath nullpointerexception line: assetmanager = context.getassets(); i'm assuming means context null. why? how fix this? edit how called: public class mylistfragment ex...

javascript - AutoComplete text box with text value and id -

i want auto complete text box text , id .i used following code auto complete in application <script type="text/javascript"> var $auto=$.noconflict(); $auto(document).ready(function(){ var data3 = ['niju','vivek','anil','anil']; $auto("#employee").autocomplete(data3); }); </script> <input type="text" name="employee" id="employee" value="" class="inp-form"> in code faced 1 drawback .there can duplicate entry possible since same values been repeated . how id value instead of text label ? any suggestions highly appreciated. demo here you can try source define : [ { label: "choice1", value: "value1" }, ... ] . see documentation here : autocomplete#option-source in case : var data3 = [{label: 'niju', value: 1},{label : 'vivek', value : 2}, ...]; $auto("#employee").autocomplete({sourc...

iterator - Iterate through changing range in VBA -

i iterating through range in vba, in loop. have if statement removes values range when meet criteria, when next value in range skipped. i know can around array , iterator in java, vba have this? you have iterate backwards when deleting rows therefore have use for loop instead of for each you set i last row in range , add step -1 have loop decrement i sample for each will not work properly dim cell range each cell in range("a1:a100") if isempty(cell) cell.delete shift:=xlup next a replacement for loop delete rows if empty dim long, lastrow long, firstrow long lastrow = 100: firstrow = 1 dim cell range = lastrow firstrow step -1 set cell = range("a" & i) if isempty(cell) cell.delete shift:=xlup set cell = nothing next

iphone - Displaying Image and Message in Viewcontroller and Dissmiss after Specific Time in IOS -

i want display viewcontroller , contains image , message . viewcontroller needs displayed when pushnotification arrives , pushnotification contains message , id . id i'll fetch image server , need display in viewcontroller specific time interval , dismiss automatically . till have completed pushnotification , getting image server, next thing need display in viewcontroller. can 1 please me out? you can try this, in appdelegate.m - (void)application:(uiapplication *)application didreceiveremotenotification:(nsdictionary *)userinfo { viewcontroller *vc=[[viewcontroller alloc]initwithnibname:@"viewcontroller" bundle:nil]; vc.image=// set image vc.message=//message [[uiapplication sharedapplication].keywindow.rootviewcontroller presentviewcontroller:vc animated:yes completion:nil]; } in viewcontroller.m -(void)viewwillappear:(bool)animated { [nstimer scheduledtimerwithtimeinterval:60 target:self selector:@selector(closevc) ...

concurrency - ios - sending data to NSOperation or should I use NSThread? -

i have core data objects created/updated via http. want create background thread continuously receive timestamp , state info app , update core data objects. should use nsoperation or gcd this? since it's not simple task, nsoperation seems better since can loop within it, can't figure out how pass information operation, main thread, while it's running. there simple way of doing this? have seen many threads/articles sending messages main thread operation, nothing passing messages it. does using nsoperation/gcd seem solution? step , relook @ architecture. should using managed object context uses private dispatch queue (option nsprivatequeueconcurrencytype). you use nsurlconnections data want, , when data in delegate method can asynchronously update repository using performblock . conversely may want retrieve data using performblockandwait , using block variables or mutable pre-defined objects receive results block.

javascript - Jquery set HTML via ajax -

i have following span: <span class='username'> </span> to populate have value php therefor use ajax: $('.username').html(getusername()); function getusername(){ $.ajax({ type: 'post', url: mybaseurl + 'profiles/ajax_getusername', datatype: 'json', data: { }, success: function(data){ document.write(data); } }) } now when debug see returned data ( data ) correct value html between span tags stay same. what doing wrong? little update i have tried following: function getusername(){ $.ajax({ type: 'post', url: mybaseurl + 'profiles/ajax_getusername', datatype: 'json', data: { }, success: function(data){ $('.username').html('rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr'); }...

css - Putting two ul elements side-by-side in a menu and changing to click instead of hover -

i have menu using css , html. of sub-menus long, sub-divide them separate lists of 5 items , display them side side instead of underneath each other. so i've put them in <div> , created 2 separate <ul> items. tried make them display: inline , set maximum height of <div> 100px doesn't force browser put second <ul> beside first one. <li> <a href="#">sub item 1.2 can long</a> <div> <ul> <li><a href="#">sub item 1.2.1</a></li> <li><a href="#">sub item 1.2.2</a></li> <li><a href="#">sub item 1.2.3</a></li> <li><a href="#">sub item 1.2.4</a></li> <li><a href="#">sub item 1.2.5</a></li> ...

c# - GroupBy - is this expected behavior? -

i have simple eav'ish scenario user can in multiple usergroup , usergroup can have multiple field . select user, select usergroups , show fields. problem want not show fields duplicate key property. current situation fields = user.usergroups .selectmany(x => x.usergroupfields) .select(field => new { field.key }) product "fields": [ { "key": "field 1" }, { "key": "field 1" }, { "key": "field 2" } ] as can see have multiple field 1 , want remove duplicates based on key property. tried groupby() doing weird. groupby() fields = user.usergroups .selectmany(x => x.usergroupfields) .groupby(field => field.key) .firstordefault() .select(field => new { field.key }) results in "fields": [ { "key": "field 1" }, { "key": "field 1" } ] ...

Generate git diff from a list of commits -

given range of commits such as b9dc80c commit msg 1 #530 88a4d3c commit 1010bce commit msg 2 #530 040ac6d commit msg 3 #530 6b72683 commit ed17416 commit f49bbbd commit msg 4 #530 i see diff of changes in commits #530 . far, have appropriate hashes in convinient format. git log --oneline | grep #530 | awk -f" " '{print $1}' | xargs echo # b9dc80c 1010bce 040ac6d f49bbbd can somehow "merge" these commits 1 diff? is, merge in memory, without affecting original repository. know can cherry pick commits in separate branch , diff that, complicated. the use case want see changes ticket id specified. example: echo > file git add file && git commit "first" echo b > file git add file && git commit "second #xx" echo > file git add file && git commit "third #xx" the-special-command with "diff" had in mind, "comparing" #xx commits should give empty output rather 2 sepa...

Scala objects masked as methods vs actual method (Stream.cons) -

i have been going through scala stream collection api , have noticed stream.cons implemented embedded object. advantage have on implementing function? under circumstances should 1 consider using technique? cheers. as object, defines unapply in addition apply , let pattern match on it.

javascript - split string doesn't work -

for form validation wrote function split date in 3 pieces. pieces split "\" so date looks "01\01\2013" here's function function check_date() { var input = $('#start_date').val(); var lines = input.split('\\'); if (lines[0] <= 31) { $('#start_date').css({'border': '1px solid #b0b0b0'}); } else { $('#start_date').css({'border': '1px solid red'}); } if (lines[1] <= 12) { $('#start_date').css({'border': '1px solid #b0b0b0'}); } else { $('#start_date').css({'border': '1px solid red'}); } } but doesn't work @ all... is there can help? thx :) you're s...

xna - imageItem returning null in c# -

i have line of code ment extract image data item, code skips imageitem = null. cause of this? foreach (layer layer in level.layers) { foreach (item item in layer.items) { imageitem imageitem = item imageitem; if (imageitem != null) { texture2d texture = imageitem.texture; imageitemlist[iimageitemnum].itemtexturedatalist[0] = new color[imageitem.texture.width * imageitem.texture.height]; imageitem .texture .getdata(imageitemlist[iimageitemnum] .itemtexturedatalist[0]); iimageitemnum++; } } } the as operator cast operation. however, if conversion isn't possible, returns null instead of raising exception so if current item in layer.items not imageitem null assigned imageitem in line imageitem imageitem = item imageitem;

visual studio - Differences between MSBuild v4.0 and VS 2010 Build -

our developers use vs 2010 build locally; however, our ci server uses msbuild v4.0 scripts build code in source. i'm aware vs uses msbuild behind scenes differences between two, if any? there aren't differences. however, when install vs 20xx, bunch of dependencies , '.targets' installed you. when trying mimic on build machine, may have install sdk's or manually move on .targets build work. every blue moon, there .target issue cannot resolved on non vs-installed build machine, drives me nuts , makes me smirk @ microsoft. here 2 examples memory: http://connect.microsoft.com/visualstudio/feedback/details/549216/microsoft-data-schema-sqltasks-targets-file-missing-on-team-foundation-server https://connect.microsoft.com/visualstudio/feedback/details/580568/ability-to-build-database-projects-using-only-msbuild do search in folder: c:\program files (x86)\ for "*.targets" and you'll idea of i'm talking (in regards vs inst...

java - Duplicate log entries log4j -

i getting duplicate entries in log file. have attached log4j.properties below. log4j.properties: ############################################################################### # log4j configuration file: defines following loggers # sl - standard root logger # el - error logger threshold level explicitly set error # dl - data base logger - log db queries separately # bl - batch logger ############################################################################### log4j.rootlogger=trace,sl,el log4j.rootlogger.additivity=false #standard log log4j.appender.sl=org.apache.log4j.dailyrollingfileappender log4j.appender.sl.file=${log.file}/log.log log4j.appender.sl.layout=org.apache.log4j.patternlayout log4j.appender.sl.layout.conversionpattern=[%5p] [%t %d{hh:mm:ss:sss}] [%x{sessionid}:%x{hostid}:%x{userid}] (%f:%m:%l) %m%n #error log log4j.appender.el=org.apache.log4j.dailyrollingfileappender log4j.appender.el.file=${log.file}/error.log log4j.appender.el.layout...

android listfragment - retain searchView state on orientation change in a Fragment -

i trying use actionbarcompat (with android support library) following android developer's blog entry. basically, trying create fragment extending listfragment. using arrayadapter listview. able integrate actionbar compat search menu item , search working well. i want retain state of fragment on orientation change well. haven't set setretaininstance(true) in fragment. inorder retain state of search view, tried following: save text in searchview in onsaveinstancestate() in oncreateview, retrieve searchtext if available in oncreateoptionsmenu (which invoked on every orientation change), trying set search query searchview instance msearchview.setquery(msearchtext, false); there 2 issues see approach: the onquerytextchange() called twice on orientation change - once searchtext has been retained (because of msearchview.setquery(msearchtext, false); ) , again, empty string value. second call empty string value updates list adapater have items without filtering. not...

mapping - Necessity to decouple business objects from entity framework (POCOs) objects? -

in our application upgrading existing dal ef 4.0 ef 5.0. currently generic repository pattern implemented , using poco objects business entities. these objects decorated wcf attributes, since passed in web services interfaces , extended partial classes in order add further business , validation methods. each poco entity inherits base class "businessentity" , interface "ibusinessentity" in order use generics repository methods easily. we planning decouple business entities pocos objects in order make latter plain classes properties , no logic. however after reading topic, seems current state of art adopt code first approach , persist domain entities directly (even if of course not possible generalize cases). related answer 1 , related answer 2 . in our case, make sense keep poco objects business logic in them , apply changes related ef 5.0 (dbcontext)? or rather should introduce mapping layer inside repository? in way application work on business entities ,...

java - cassandra : Is there a way to get all value of columns starting with a particular prefix? -

i need column:column_value pairs key. constraint columns have common prefix , there way using hector ? you can slicequery, , range prefix prefix|, providing alphanumerics should work. stringserializer ss = stringserializer.get(); slicequery slicequery = hfactory.createslicequery(keyspace, rowserializer, ss, ss); slicequery.setcolumnfamily(my_column_family); slicequery.setkey(rowkey); slicequery.setrange("prefix", "prefix|", false, integer.max_int);

asp.net - Using custom virtual paths -

Image
i'm making test solution 2 or 3 pages organized in folders this: and when run app url this: there way maintain physical path having different virtual path http://localhost:40300/index.aspx without odd word "views"? take @ url rewrite module iis. alternative, can create custom http module rewrite virtual path appropriately: public class myrewritehttpmodule : ihttpmodule { // ... public void init(httpapplication app) { app.authenticaterequest += application_authenticaterequest; } private void application_authenticaterequest(object sender, eventargs e) { var app = sender httpapplication; var path = app.request.url.pathandquery; if (!path.startswith("/views/", stringcomparison.ordinalignorecase)) app.context.rewritepath("/views/" + path); } }

glassfish - Inject a file using @Resource and JNDI in JEE6 -

Image
is possible inject file using jndi , @resource in jee6? if how setup , jndi (file) resource in glassfish? if objective configure properties file follows: @inject @resource("meta-inf/aws.properties") properties awsproperties; then want use weld extension explained in weld documentation here it simple adding pom <dependency> <groupid>org.jboss.weld</groupid> <artifactid>weld-extensions</artifactid> <version>${weld.extensions.version}</version> <type>pom</type> <scope>import</scope> </dependency> otherwise see article programmatic approach. or else, store properties in db schema table , use jpa 2.0 retrieve them using jta pointing jndi. or if application jsf one: add resource bundle in faces-config.xml file follows: <application> <resource-bundle> <base-name>/yourproperties</base-name> <var>yo...

ios - Why is this iPhone app's "quote" button not replacing the Text View's lorem ipsum? -

Image
i working through "iphone introduction programmers" tutorial @ http://www.raywenderlich.com/21320/objectively-speaking-a-crash-course-in-objective-c-ios6 , , present project @ http://jonathanscorner.com/project/quotes.tgz . tutorial's focus on providing iphone app randomly displays 1 of several quotes in text view when click on button. later on tutorial pushes further defining properties , storing , retrieving xml, i'm @ first " let rip! ", offers first attempt running app within simulator increment of functionality, should when click button, randomly pulled quote appears. text should read-only far editing keyboard concerned. the behavior presently observing simulator displays text view's native lorem ipsum. continues after clicking button, , when click on text view, pulls keyboard , edits it. i've checked wiring, , don't see failed duplicate tutorial shares. (the tutorial references viewcontroller.[h|m]; problem have prefix before takes pr...

Read Excel-files from .NET -

i'm looking free class or example read data closed excel-file . have full file path (as string) @ hand can passed class reading data file. i'd able validation before trying read data: check how many worksheets , names on each worksheet how many rows contain data if possible, read metadata/custom document properties file i'm concerned, if oldedb used, how works excel versions (2003,2007,2010 etc). is there out there can these things safely?

php - Not able to perform a PDO Prepare Statement -

'm trying execute following code: try { $conn = new pdo('odbc:clasges5'); $conn->setattribute(pdo::attr_errmode, pdo::errmode_exception); $sql = "insert codpais (clapai,codpas,nompas) values (:clapai,:codpas,:nompas)"; $q = $conn->prepare($sql); $clapai = 31; $codpas = 'test codpas'; $nompas = 'test nompas'; $q->bindparam(':clapai', $clapai, pdo::param_int); $q->bindparam(':codpas', $codpas, pdo::param_str); $q->bindparam(':nompas', $nompas, pdo::param_str); $q->execute(); } catch(exception $e) { echo $e->getmessage(); } the database (visualfox dbase via odbc) looks this: - table codpais - clapai primary key - codpas string - nompas string i'm getting error invalid character value cast specification: 302 the problem "clapai". if perform update codpas or nompas works ok, if try tu update clapai value throws same err...

Shell script: variable scope in functions -

i wrote quick shell script emulate situation of xkcd #981 (without hard links, symlinks parent dirs) , used recursive function create directories. unfortunately script not provide desired result, think understanding of scope of variable $count wrong. how can make function use recursion create twenty levels of folders, each containing 3 folders (3^20 folders, ending in soft links top)? #!/bin/bash echo "generating folders:" toplevel=$pwd count=1 gen_dirs() { in 1 2 3 dirname=$random mkdir $dirname cd $dirname count=$(expr $count + 1) if [ $count < 20 ] ; gen_dirs else ln -s $toplevel "./$dirname" fi done } gen_dirs exit try (amended version of script) — seems work me. decline test 20 levels deep, though; @ 8 levels deep, each of 3 top-level directories occupies 50 mb on mac file system. #!/bin/bash echo "generating folders:" toplevel=$pwd gen_dirs...

forms - How to get available classes at runtime -

i poll class , have return available subclasses in way can address them. can return array, dictionary, or else. long can loop through set of them , read properties or call functions each. scenario: want create form user inputs details of series of events. read form , output report. each kind of event has ".name", different set of inputs (formoptions) , methods (formatoutput) create output. right implemented complex form , script runs after user submits form. the trouble every time add option form, have change code in several different places. in interest of making code easier maintain, contain code each event type in class, build form based on available classes. so example, i'm building itinerary collection of meeting , travel objects: class itinerary class event public property name() name = "meeting" end property public function formoptions(id) form options = "<div id="...

java - Method returning null is manipulating a final int array -

can please explain me why method returning null manipulating final int [] ? final int [] vals = {2,3}; int [] vals2 = multiply(vals); for(int : vals) system.out.println(i); int [] multiply(int [] in){ for(int = 0; < in.length;i++){ in[i] *= 2; } return null; } ouput: 4 6 edit: have noticed behavior in methods returning array. same method returning int doesn't change original integers value... full code: public class main{ public main(){ int [] mylist = {56, 32, 200}; int [] newlist = mylist; bubble_sort(newlist); for(int : mylist){ system.out.println(i); } system.out.println(); for(int : newlist){ system.out.println(i); } } public int [] bubble_sort(int a[]){ int n = a.length; int [] s = a; (int = 0; < n ; i++){ (int j = n - 1; j >= (i+1); j--){ if (s[j - 1] > s[j]){ int t = s[j - ...

ios - Can't change size for UIPopover? -

i'm writing app needs spawn popover in order add new note. end, have kind of trick, however, can't seem adjust size of popover. how i'm spawning it: uibutton* btn =sender; uiviewcontroller* footroller = [[uiviewcontroller alloc] init]; cgrect rectfoo = cgrectmake(0, 0, 100, 100); uiview* fooview = [[uiview alloc] initwithframe:rectfoo]; [fooview setbackgroundcolor:[uicolor redcolor]]; [footroller setview:fooview]; popover =[[uipopovercontroller alloc] initwithcontentviewcontroller:footroller]; [popover presentpopoverfromrect:btn.frame inview:self.view permittedarrowdirections:uipopoverarrowdirectionleft animated:yes]; any thoughts? it's not respecting view size. you should not calling setview: on view controller. let view controller setup own view. the proper way size popover either override contentsizeforviewinpopover method of view controller return size or set popovercontentsize property o...

jpa - Cannot create and close multiple EntityManagers in a SessionBean method -

i'm trying use openjpa slice persistence mechanism 1 of classes inside jboss 4.0.5 (ejb 2.1) application server , i'm experiencing problems. in j2se setting following code (create entitymanager, use it, close it, create new one, use close it) works fine. entitymanagerfactory factory = persistence.createentitymanagerfactory("my_persistence_unit"); entitymanager em = factory.createentitymanager(); query q = em.createquery("select m mytable m"); list result = q.getresultlist(); // ... result em.close(); em = factory.createentitymanager(); q = em.createquery("select m myothertable m"); result = q.getresultlist(); // ... result em.close(); but if try same thing in statelesssessionbean (again: ejb 2.1) // entity manager factory static variable defined elsewhere entitymanager em = factory.createentitymanager(); query q = em.createquery("select m mytable m"); list result = q.getresultlist(); // ... result em.close(); em = factory.c...

c# - WPF Is possible to map Escape key in theme style -

i have searched , got following code working individual forms. this.keydown += new keyeventhandler(handleesc); private void handleesc(object sender, keyeventargs e) { if (e.key == key.escape) { this.close(); } } the problem have code same on each , every wpf form in app. looking way put in theme style can avoid repeated coding. there way that? thanks, i don't think can done using styles. can though, create new layer between window , window class, , have intermediate layer take care of handling escape key. this, first create new class called escapewindow , have inherit window this: namespace wpfapplication1 { public class escapewindow : window { public escapewindow() : base() { this.keydown += new keyeventhandler(handleesc); } private void handleesc(object sender, keyeventargs e) { if (e.key == key.escape) { this.close(); } } } } now ever...

javascript - Play Framework and Require JS optimization fails -

i'm trying use requirejs play! framework 2.1.3, can't seem work in production. running play stage gives ioexception when optimizing requirejs. i tried example on play framework docs: http://www.playframework.com/documentation/2.1.3/requirejs-support i'm running project on windows machine. know stage , start tasks don't work on windows, requirejs optimization should work, right? here's output of play stage : d:\nb17527\ideaprojects\carlosmendonca>play stage [info] loading project definition d:\nb17527\ideaprojects\carlosmendonca\pr oject [info] set current project carlosmendonca (in build file:/d:/nb17527/ideaproj ects/carlosmendonca/) [info] wrote d:\nb17527\ideaprojects\carlosmendonca\modules\common\target\scala- 2.10\carlosmendonca-common_2.10-1.0.pom [info] wrote d:\nb17527\ideaprojects\carlosmendonca\target\scala-2.10\carlosmend onca_2.10-1.0.pom [info] requirejs optimization has begun... [info] app.build.js: [i...

javascript - What's a good webrtc audio solution? -

there's opentok , vline webrtc video there similar service audio? or can use these apis in restricted way? if not, there open source javascript library / tutorial can me started building 1-1 , 1-many audio connections on webrtc? thanks with vline api can audio-only calls (as combinations such 1 side sending audio , video , other side sending audio). if you're using "web client" can click on small arrow next "video call" button make audio-only call (there similar drop-down when answering call). if you're using vline api , can use vline.mediaconstraints audio-only call when calling vline.person.startmedia() .

javascript - CSS transition bug -

i have pair of divs should resize on click, works fine except every once in while div kind of flashes before resizing. done lot of research , agrees should fix "-webkit-backface-visibility: hidden;" i've tried , doesn't change anything. fails both in chrome , firefox. mean works fine , other times flickers horribly. any ideas on wrong? in jquery? in css? any appreciated. my js: (function($){ setup = function setup(){ var windowwidth; $('.day').each(function(){ var $this = $(this), links = $('.links', $this), images = $('.images', $this), largewidth, smallwidth, linkswidth, imageswidth; images.click(function(){ windowwidth = $(window).width(); linkswidth = $('.links', $this).width(); imageswidth = $('.images...

c# - How can i display image in image link? -

i want create image link can't see image it's extension methods: public static mvchtmlstring actionimage(this htmlhelper htmlhelper, string controller, string action, object routevalues, string imagepath, string alternatetext = "", object htmlattributes = null) { var anchorbuilder = new tagbuilder("a"); var url = new urlhelper(htmlhelper.viewcontext.requestcontext); anchorbuilder.mergeattribute("href", url.action(action, controller, routevalues)); var imgbuilder = new tagbuilder("img"); imgbuilder.mergeattribute("src", url.content(imagepath)); imgbuilder.mergeattribute("alt", alternatetext); var attributes = (idictionary<string, object>)htmlhelper.anonymousobjecttohtmlattributes(htmlattributes); imgbuilder.mergeattributes(attributes); string imghtml = imgbuilder.tostring(tagrendermode.selfclosing); anchorbuilder.inne...

python - IOError: [Errno 2] No such file or directory:'ux_source_2850.txt -

i trying convert file format python code requires 3 arguments input file, output file , percentage value. call python function in shell script , works fine first time, doesn't work second time. error "ioerror: [errno 2] no such file or directory: 'ux_source_2850.txt". pretty sure file in directory. can please me out. also, wondering if there way call python function, compiled c function, can execute function several arguments. #!/usr/bin/env python def convertfile(file1,file2,percentage): open(file1, "r+") infile, open(file2, "w+") outfile: outfile.write('lon lat ve vn se sn cen site ref\n') line in infile.readlines(): line = line.strip() new_line=line + " "+percentage+" "+percentage+" "+'0.05 stat(0,0) test1'+'\n' outfile.write(new_line) file1=raw_input() file2=raw_input() ...

php - 'MySQL server has gone away' but after that the site runs correctly -

on 1 of sites, keep getting warning: warning: mysql_pconnect() [function.mysql-pconnect]: mysql server has gone away in /volumes/xxx.php on line 11 but after queries seem work fine , site displays correctly. possible connection reestablished after gone away? should worry warning? any tip on how should approach appreciated. thanks

regex - What it the fastest way to check if a string consists of three or more dashes in php? -

is regex way? slow? something this? preg_match("/^(\-){3,}/", $string); only dashes if want string only dashes, , there must 3 or more: $match = (preg_match('/^-{3,}$/', $string) === 1); another way without regex seems 25% slower ( isset beats strlen ): $match = (count_chars($string, 3) === '-' && isset($string[2])); adjacent dashes if want 3 or more dashes in row, there may other characters (e.g. foo---bar ): $match = (strpos($string, '---') !== false); some dashes if want 3 or more dashes anywhere (e.g. -foo-bar- ): $match = (substr_count($string, '-') >= 3);