Posts

Showing posts from July, 2011

java - Restlet 1.1 Access Control Header Issue -

i'm working on restlet built on restlet 1.1.1 the issue i'm facing setting 'access-control-allow-origin' header allow cross domain requests. i've attempted few things didn't work. method one, put header in acceptrepresentation function: @override public void acceptrepresentation( representation resetentity ) { form headers = (form)getresponse().getattributes().get("org.restlet.http.headers"); if (headers == null) { headers = new form(); getresponse().getattributes().put("org.restlet.http.headers", headers); } headers.add("access-control-allow-origin","https://origin.server.edu"); //other code here actual resource logic... } this didn't work. still received errors when attempting send request using jquery such: jquery.ajax({ type: "post", contenttype: "application/json", url: "https://test.servername.edu/cas/cas-rest-api/reset/"

asp.net - How do I populate an ASPX C# Form with multiple dropdowns from different related tables? -

this first attempt @ building website company. have 1 database 3 tables. structured below. tblsitedataentryform id sitename sitetype sitesubtype tblprimarytypes id primarytype tblsubtypes id primarytypeid subtype an employee use simple form create new db entry in primary table. have form working. second form used update primary table. on update form have dropdown gets values using select query on primary database. dropdowns primary type , sub type filled based on row data primary table. primary type dropdown working sub type keeps throwing error. "ddlsubtype has selectedvalue invalid because not exist in list of items. parameter name: value" here code. appreciated. using system; using system.collections.generic; using system.configuration; using system.data; using system.data.sqlclient; using system.linq; using system.web; using system.web.ui; using system.web.ui.webcontrols; public partial class ddef_update :

javascript - CSS not changing after altering data attribute tag with AJAX post -

i designing website shows availability of resource using either green or red colour indicator based upon availability field of connected mysql database table. the item looking alter span element: <span class="equipment" data-id="1" data-available="1" data-location="0-0"></span> this being parsed jquery data attributes availability , location, , compared mysql database ajax post note changes in availability should propagated webpage, changing colour of indicator per below css. .equipment[data-available='1'] { background-color: rgb(0,226,0); //green } .equipment[data-available='0'] { background-color: rgb(226,0,0); //red } the ajax request, seen below, recognizes changes database , returns php file successfully, returning new availability (0 or 1). if console.log() php post url, value returned equipment_span.data("available") , stored in old_avail appears have updated new value desired af

html - How do I use the parent div to contain & move rotated spans? -

how use parent div (#warped) move , contain, rotated span elements (which in fact 'curved words' want keep in said position) in 1 movement? i have used link generate curvature: http://csswarp.eleqtriq.com/ the <span> tags placed within #warped parent element in html document, despite on webpage appear located outside of #warped div i to, example, move entire curved word left of page. how this? here css: #warped { position: relative; display: block; } #warped>span[class^=w]:nth-of-type(n+0) { display: block; position: absolute; transform-origin: 50% 100%; } #warped span { font-family: 'abeezee'; font-size: 38px; font-weight: regular; font-style: normal; line-height: 0.65; white-space: pre; overflow: visible; padding: 0px; } #warped .w0 { transform: rotate(0.91rad); width: 20px; height: 24px; left: 552.15px; top: 152.55px; } #warped .w1 { transform: rotate(1.06rad); width: 23px; height: 24px; left: 565.17px; top: 174.68

php - Slim framework get the data from a form -

i try make simple form slim framework. don't know how display posted data. want try echo it. heard need use library respect, think slim can such small thing. here code : require '../../vendor/slim/slim/slim/slim.php'; \slim\slim::registerautoloader(); $app = new \slim\slim(); $app->get('/', function() use ($app){ $app->render('form.php'); }); $app->post('/', function() use ($app){ $req = $app->request(); $errors = array(); $params = array( 'email' => array( 'name'=>'email', 'required'=>true, 'max_length'=>64, ), 'subject' => array( 'name'=>'subject', 'required'=>true, 'max_length'=>256, ), ); //submit_to_db($email, $subject, $message); $app->flash('message','form submitted

php - How to use two arrays in one foreach loop using C# -

how loop through 2 arays using foreach loop? found previously, that's php not c# $images = array('image1', 'image2', ...); $descriptions = array('description1', 'description2', ...); foreach (array_combine($images, $descriptions) $image => $desc) { echo $image, $desc; } my thought have following string[] valuea = {1,2,3} string[] valueb = (a,b,c} foreach(something here valuea && valueb) { methodnamehere(valuea, valueb); //method calling requires 2 values } you zip operation come in .net 4 in feature. on link1 , link2 description. you right like: var alpha = new [] { a, b, c, d }; var day = new [] { "s", "s", "m", "t" }; var alphasanddays = alpha.zip(day, (n, w) => new { alpha = n, day = w }); foreach(var ad in alphasanddays) { console.writeline(aw.alpha + aw.day); }

unix - SSH command to find and delete all files that contain a string -

Image
i need use ssh find files containing string (malware) , delete these files. this command using find , display list of these malware files: find * -name '*.php' -exec grep -l "return base64_decode(" {} \; and list this: i want delete these files (not display list of them). basically "find files contain string, , delete files". you can pipe xargs rm given file names removed: find * -name '*.php' -exec grep -l "return base64_decode(" {} \; | xargs rm you can store current output of find , loop through content executing rm <file> : find ... > file while ifs= read -r file rm "$file" done < file

android - Not setOnKeyListener nor setOnEditorActionListener working unexpectedly -

i trying thing when user press enter button in edittext (it multi lines edittext means user can write more 1 lines) want detect either enter key pressed code used given below <edittext android:id="@+id/body" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@android:color/transparent" android:hint="@string/hint" android:padding="5dp" android:scrollbars="vertical" android:textcolor="@android:color/black" android:textcursordrawable="@null" android:textsize="22sp" /> and listener mbodytext.setonkeylistener(new view.onkeylistener() { @override public boolean onkey(view view, int i, keyevent keyevent) { if ((keyevent.getaction()== keyevent.action_up)) { if(i == keyev

ruby - ActiveModel::Serializer instance variable in class unaccessible in method -

i have snippet below in activemodel::serializer . it's recursive method, need add array that's returned when recursion ends. so, set instance variable @rows equal empty array [] . push onto array in method, ruby returning undefined method 'push' nil:nilclass . class myserializer < activemodel::serializer attributes :hierarchies @rows = [] def hierarchies_run(child, user) hierarchy = userhierarchy.where(child: child, user_id: user).first if hierarchy @rows.push(usersimpleserializer.new(user.find(hierarchy.child), :root => false)) hierarchies_run(hierarchy.parent, current.id) else @rows.push(usersimpleserializer.new(user.find(child), :root => false)) end end def hierarchies hierarchies_run(current.id, current.id) @rows end end why returning error? the problem have defined @row in class (the constructor itself) instead of instance. should put initialization of @row like: class myse

How to use MLlib in spark SQL -

lately, i've been learning spark sql, , wanna know, there possible way use mllib in spark sql, : select mllib_methodname(some column) tablename; here, "mllib_methodname" method mllib method. there example shows how use mllib methods in spark sql? thanks in advance. the new pipeline api based on dataframes, backed sql. see http://spark.apache.org/docs/latest/ml-guide.html or can register predict method mllib models udfs , use them in sql statement. see http://spark.apache.org/docs/latest/sql-programming-guide.html#udf-registration-moved-to-sqlcontextudf-java--scala

sonarqube - Hide integration test coverage per line? -

i'm using sonarqube 5.1. , use unit test coverage. is there way in sonarqube gui hide integration coverage bar in sourcecode page @ left side, says if line of code covered or not integration test? the reason sonar.jacoco.reportmissing.force.zero set true.

c - Swapping 2 function pointers without a temporary variable -

swapping 2 void pointers easy without using memory: void* p1; void* p2; //... p1 = ((uintptr_t)p1) ^ ((uintptr_t)p2); p2 = ((uintptr_t)p1) ^ ((uintptr_t)p2); p1 = ((uintptr_t)p1) ^ ((uintptr_t)p2); but swap function pointers must use pointer? (as not guaranteed fit integer type). void (*p1)(); void (*p2)(); //... void (*tmp)() = p1; p1 = p2; p2 = tmp; can give me example of portable method swap function pointers without using temporary variable? i think works, because aliasing through (unsigned) char allowed: void (*p1)(); void (*p2)(); (size_t = 0; < sizeof(p1); ++i) { ((unsigned char *)&p1)[i] ^= ((unsigned char *)&p2)[i] } (size_t = 0; < sizeof(p2); ++i) { ((unsigned char *)&p2)[i] ^= ((unsigned char *)&p1)[i] } (size_t = 0; < sizeof(p1); ++i) { ((unsigned char *)&p1)[i] ^= ((unsigned char *)&p2)[i] }

powershell - Text extraction and reformatting for output -

i have text file "e:\abc.txt" contains data in format heading asia name china val 200 drt fun , play end heading europe name paris val 234234 drt tour end heading america name ny val 234 drt shop end [continued this..] i create new text file "xyz.txt" extract selected headings , drt in following format. heading drt asia fun , play europe tour i have tried following script: $source e:\abc.txt $search "asia","europe" $a = select-string $source -pattern $search -context (0,3) output heading asia name china val 200 drt fun , play heading europe name paris val 234234 how remove in between lines heading - drt asia - fun , play europe - tour whipped since have @ least been trying something. hope not go on head uses regular expressions break file "sections" converts each section own object. advantage being can filter using command powershell cmdlets where-object . not terse said

java - action.keyDown(Keys.CONTROL).sendKeys("a").keyUp(Keys.CONTROL).build() works on windows but doesn't work on linux -

action.keydown(keys.control).sendkeys("a").keyup(keys.control).build() works fine on windows doesn't work on linux. writing testcase using selenium webdriver , trying select text written in rich textbox , have used code snippet perform select command.it works fine on windows on firefox 38 browser when run testcases on jenkins machine linux machine,browser firefox(don't know exact version above version 33) code snippet doesn't work.i have tried alternatives driver.findelement(by.cssselector("body")).sendkeys(keys.chord(keys.control, "a")); , double click on rich textbox select text written in nothing works.what reason,why these code snippets not working on linux machine. i have found answer own question action.keydown(keys.control).sendkeys("a").keyup(keys.control).build() , driver.findelement(by.cssselector("body")).sendkeys(keys.chord(keys.control, "a"));was not running on linux machine firefox br

Is it posible to create a XML node with prefix in Javascript? -

im trying create xml file namespace or prefix this. <bpmndi:bpmndiagram id="bpmndiagram_1"> <bpmndi:bpmnplane id="bpmnplane_1" bpmnelement="process_1"> <bpmndi:bpmnshape id="_bpmnshape_startevent_2" bpmnelement="startevent_1"> <dc:bounds x="173" y="102" width="36" height="36" /> </bpmndi:bpmnshape> <bpmndi:bpmnshape id="task_1_di" bpmnelement="task_1"> <dc:bounds x="437" y="107" width="100" height="80" /> </bpmndi:bpmnshape> <bpmndi:bpmnedge id="sequenceflow_1_di" bpmnelement="sequenceflow_1"> <di:waypoint xsi:type="dc:point" x="209" y="120" /> <di:waypoint xsi:type="dc:point" x="323" y="120" /> <di:waypoint xsi:t

How to loop in jQuery -

i have couple of jquery function similar syntax. $("#item-1").hover(function(){ $(".item-1").animate({opacity:1},"slow"); },function(){ $(".item-1").animate({opacity:0},"slow"); }); $("#item-2").hover(function(){ $(".item-2").animate({opacity:1},"slow"); },function(){ $(".item-2").animate({opacity:0},"slow"); }); $("#item-3").hover(function(){ $(".item-3").animate({opacity:1},"slow"); },function(){ $(".item-3").animate({opacity:0},"slow"); }); my question how shorten code of loop. tried following didn’t work: for (i = 1; <= 3; ++i) { $("#item-" + i).hover(function(){ $(".item-" + i).animate({opacity:1},"slow"); },function(){ $(".item-" + i).animate({opacity:0},"slow"); }); } this should work : for (i = 1; <= 3; ++i) { (

scripting - Powershell - help. Search and name file -

i appreciate feedback or assistance the problem having have folder contains log files of machines i'm working with. have several scripts search logs looking predetermined strings, have script generate report based on count of each outcome. however, additionally tell machine name of each string outcome. also, not display if nothing found. fortunately, i've titled each log file machine name in hopes if finds string inside log have name title of log file found in. could provide assistance script? i've attempted various scripts using gci , if statements no avail. thanks! $items = get-childitem "path-to-file" foreach ($item in $items) { if ($items -contains "success") { write-host $items.name } } you should use get-content query file contents. foreach ($item in $items) { if ((get-content $item) -match "success") { $item.name } }

ehcache - How to configure Jcache with Ecache as Provider in Spring application-context.xml? -

spring documentation provides below information. <bean id="cachemanager" class="org.springframework.cache.jcache.jcachecachemanager" p:cache-manager-ref="jcachemanager"/> <!-- jsr-107 cache manager setup --> <bean id="jcachemanager" .../> i want know how configure jcachemanager bean (with ehcache provider) in spring application context xml. i have configured dependency, below, in pom.xml fine. <dependency> <groupid>org.ehcache</groupid> <artifactid>jcache</artifactid> <version>1.0.1</version> <exclusions> <exclusion> <artifactid>slf4j-api</artifactid> <groupid>org.slf4j</groupid> </exclusion> </exclusions> </dependency> it depends how want configure it. if you're using spring boot 1.3, automatically created you. maybe have source of jcachecac

c# - Wix ToolSet Patch Creation Using "Patch Creation Properties" -

first of all, i'd iterate complete noob regarding installers , patches, , have been living articles interwebz. quick background: we've created installer "installs" web app - creates iis services, databases, etc. succeeding releases, plan on using patches minor upgrades. use .net c# app. i've been trying create patch project using "patch creation properties" tutorial wix site: http://wixtoolset.org/documentation/manual/v3/patching/patch_building.html i managed create patch, , work, i've noticed changes html, js, , css files, along web config. changes made on .cs files not reflected. i'm assuming dll files not being replaced patch. below config patch.wxs: <patchcreation id="{real guid heere}" cleanworkingfolder="yes" outputpath="c:\outputpath\patch.pcp" wholefilesonly="yes" > <patchinformation description="project 3.0.10 patch" manu

sbt - How do I add a Nexus resolver after local repository, but before the default repositories? -

we have internal nexus repository use publish artifacts , cache external dependencies (from maven central, typesafe, etc.) i want add repository resolver in sbt build, under following restrictions: the settings need part of build declaration (either .sbt or .scala, not in "global" sbt settings if dependency exists in local repository, should taken there. don't want have access network dependencies every build. if dependency doesn't exist locally, sbt should first try nexus repository before trying external repositories. i saw several similar questions here, didn't find solution this. specifically, code have is: externalresolvers ~= { rs => nexusresolver +: rs } but when show externalresolvers nexus repo appears before local one. so far, i've come following solution: externalresolvers ~= { rs => val grouped = rs.groupby(_.isinstanceof[filerepository]) val filerepos = grouped(true) val remoterepos = grouped(false) fil

google oauth - Submit Site Map Using C# -

i using follwoign code submit site map webmaster tools google.gdata.webmastertools.webmastertoolsservice service = new google.gdata.webmastertools.webmastertoolsservice("www.test1.com"); service.setusercredentials("email", "password"); string lwebsite = "http%3a%2f%2fwww%2etest1%2ecom%2f"; query.uri = new uri("https://www.google.com/webmasters/tools/feeds/sites/"); google.gdata.webmastertools.sitemapsentry se = new google.gdata.webmastertools.sitemapsentry(); se.content.src = "http://www.test1.com/sitemap.xml"; se.content.type = "text/xml"; google.gdata.webmastertools.sitemapsentry ret = service.insert( new uri("https://www.google.com/webmasters/tools/feeds/sites/" + lwebsite + "/sitemaps/"), se); but no luck code. can 1 provide me sample code submit site map? code ripped google-webmastertools sample pm> install-package google.apis.webmasters.v3

amazon ec2 - Unable to connect from ec2 server -

i trying login on ec2 instance server, getting me errors too many authentication failures ubuntu, or permission denied (public key). when connect server ssh -i "pem_file" ec2_name@public_ip when yesterday, login in server, it's worked after exit server , again trying login it's giving me errors mentions above. so if message too many authentication failures ubuntu, it's because have tried many private_keys authenticate against user ubuntu in server. you can more info here: https://superuser.com/questions/187779/too-many-authentication-failures-for-username try running this: ssh-add -l ssh-add -d you may have many keys stored in local ssh-agent. if this: permission denied (public key). generally means public key not in ~ubuntu/.ssh/authorized_keys file on server. can debug creating snapshot of ebs volume (if using ebs). create new volume snapshot , attach volume running ec2 instance. http://docs.aws.am

python - Combining two matplotlib colormaps -

Image
i merge 2 colormaps one, such can use 1 cmap negative values , other 1 positive values. at moment masked arrays , plotting 1 image 1 cmap , other image other, resulting in: with following data dat = np.random.rand(10,10) * 2 - 1 pos = np.ma.masked_array(dat, dat<0) neg = np.ma.masked_array(dat, dat>=0) i plotted pos gist_heat_r , neg binary . i have single colorbar combined cmap 's, not correct approach me. so, how take 2 existing cmaps 's , merge them one? edit: admit, duplicate, answer that's given more clear here. example images make more clear. colormaps interpolation functions can call. map values interval [0,1] colors. can sample colors both maps , combine them: import numpy np import matplotlib.pyplot plt import matplotlib.colors mcolors data = np.random.rand(10,10) * 2 - 1 # sample colormaps want use. use 128 each 256 # colors in total colors1 = plt.cm.binary(np.linspace(0., 1, 128)) colors2 = plt.cm.gist_heat_r(np.linspac

Java DAO implementation setObjects -

Image
there such problem. i have entity classes appartment , landlord etc. i'm creating apartmentdaoimpl , dao implementation apartment . clear primitive types, can landlordid . the question - how set landlord field id ? this doesn't work because getid() method non-static: apartment apartment = new apartment(id); apartment.setrooms(rooms); apartment.setdescription(description); apartment.setfree(free); apartment.setprice(price); apartment.setlastupdatedprice(lastupdatedprice); apartment.setlandlord(landlord.getid()); first, have decalre landlord object , set properties, e.g.: landlord landlord = new landlord(); landlord.setname("foo"); landlord.setemail("foo@bar"); etc. alternatively, can db, if record exists: landlord landlord = dataaccess.getlandlordbyname("heregoesthename"); of course, in latter case, need implement proper dataaccess class , access

javascript - Using quickForm with a collection and separate schema at the same time does not seem to work -

i want store time value in seconds in db. in form, user should able type string (mm:ss). after submission string (mm:ss) should transformed seconds. why schema form validated against differs schema used validate against in backend (right before writing database). so did supposed here ( https://github.com/aldeed/meteor-autoform#autoform-1 ) , defined 2 schemas, 1 form (with time.type = "string") , 1 attached collection (time.type = number). in template set both parameters , collection="timeitem" , schema="specialformschema . in end, form renders html number input field , ignores form schema . can help? in advance! the collection , schema not supported together. have pick 1 or other. try using hooks you're trying do: https://github.com/aldeed/meteor-autoform#callbackshooks

mouseevent - Simulate mouse motion on linux wayland -

i receive xy data network , control mouse position using linux on wayland. i've seen many source codes using x libs or x apps not work on wayland. have on libinput , evedev don't find code sample how create/simulate mouse. uinput answer. void initmouse(){ fd = open("/dev/uinput", o_wronly | o_nonblock); ioctl(fd, ui_set_evbit, ev_key); ioctl(fd, ui_set_keybit, btn_left); ioctl(fd, ui_set_evbit, ev_abs); ioctl(fd, ui_set_absbit, abs_x); ioctl(fd, ui_set_absbit, abs_y); struct uinput_user_dev uidev; memset(&uidev,0,sizeof(uidev)); snprintf(uidev.name,uinput_max_name_size,"holusionmouse"); uidev.id.bustype = bus_usb; uidev.id.version = 1; uidev.id.vendor = 0x1; uidev.id.product = 0x1; uidev.absmin[abs_x] = 0; uidev.absmax[abs_x] = 1080; uidev.absmin[abs_y] = 0; uidev.absmax[abs_y] = 1080; write(fd, &uidev, sizeof(uidev)); ioctl(fd, ui_dev_create); usleep(100000); } and update: struct input_e

jquery - How to scale div using css animation in javascript -

i trying apply scale animation when javascript function called. not able that. here have div contains data inside it. div hidden , flip function should scale div. scaling not happening through javascript function.how can this? here have tried. function flip1(){ $('#category-1').delay(100).css('display', 'none'); $('.box-1').delay(100).css('display', 'block'); $('.box-1').transition({ perspective: '100px', rotatey: '360deg' width: 100px; height: 100px; background: red; -webkit-transition: transform 0.3s; transform:scalex(1); animation-name: example; animation-duration: 0.3s; } @keyframes example { 25% {transform:scalex(0.060);} 50% {transform:scalex(0.500);} 75% {transform:scalex(0.700);} 100% {transform:scalex(1);} } },200) settimeout(startslidecat1, 2000

java - Transforming Map<Key, List<Value>> to Map<Key, Value> -

what have: sortedset<person> ss = new treeset<>(); ss.add(new person("john", "doe", 20)); ss.add(new person("max", "power", 26)); ss.add(new person("bort", "bort", 30)); ss.add(new person("scorpio", "mcgreat", 56)); map<integer, list<person>> list = ss.stream().collect(collectors.groupingby(p -> p.name.length())); i need transform map map<integer, person> know need use flatmap purpose don't know how. what have tried far: value-set , flatmap it. map <integer, person> list2 = list.values() .stream() .flatmap(f -> f.stream()) .collect(collectors.groupingby(f -> f.name.length()); //doesn't work question: far understand java returns values lists when create maps via streams, how can flatmap lists ? additional

android - AVD Manager Nexus 5_API_22_X86 -

i'm getting error in this. me fix it. installed intel x86 emulator accelerator (haxm installer) error message- cannot launch avd emulator. output: emulator error: x86 emulation requires accelaration! please ensure intel haxm installed , unusable. cpu acceleration status: hax kernel module not installed. seems problem in installing haxm. have followed these steps? steps using intel hardware accelerated execution manager 1.start android sdk manager, select extras , select intel hardware accelerated execution manager.(you have done this) 2.run [sdk]/extras/intel/hardware_accelerated_execution_manager/intelhaxm.exe and follow instructions , complete installation(this step may left).

python - Import error "no module named": When importing dynamic class -

all, i'm putting system needs dynamically load modules , create instances of class within. my code is: tokens = os.path.splitext("a.b.c") try: module_str = str(tokens[0]) task_class_str = str(tokens[1][1:]) module = __import__(module_str, fromlist=[task_class_str]) task_class = getattr(module, task_class_str) except exception, e: stdout.error("failed import task module", module=module_str, task_class=task_class_str, exception=e) continue try: task = task_class(task) except exception, e: stdout.error("failed create task", task=task, module=module, task_class=task_class, exception=e) continue the error is: [error]: 'failed create task' task_class=<class a.b.c @ 0x7fd3beb13e88> exception=importerror('no module named c',) task=<d.e instance @ 0x25700e0> module=<module 'a.b' '.../a/b/__init__.pyc'> the definition of class

javascript - How to visualize a taxonomy for web? -

i trying draw taxonomy on web page, can drill down content of taxonomy links other webpages. the input following. <root> <catsuper1 link="google.com"> <subcat1-1> <item1-1-1 link="http://web.com/1" /> <item1-1-2 link="http://web.com/2" /> <item1-1-3 link="http://web.com/3" /> </subcat1-1> <subcat1-2> <item1-2-1 link="http://web.com/1" /> <item1-2-2 link="http://web.com/2" /> <item1-2-3 link="http://web.com/3" /> </subcat1-2> </catsuper1> <catsuper2> <subcat2-1> <item2-1-1 link="http://web.com/1" /> <item2-1-2 link="http://web.com/2" /> <item2-1-3 link="http://web.com/3" /> </subcat2-1> <subcat2-2> <item2-2-1 link="http://web.com/1" /> <item2-2-2 link="http://web.com/2" /> <it

c++ - VS 2013 exception when using C++11 unrestricted unions -

consider code: struct tnumeric { bool negative; wstring integral; wstring fraction; }; union tvalue { // unnamed structs needed because otherwise compiler not accept it... bool bit; struct{ tnumeric numeric; }; struct{ wstring text; }; }; tnumeric numeric; tnumeric &rnumeric{ numeric }; rnumeric.integral = l""; rnumeric.integral.push_back( l'x' ); //ok, no problem tvalue value; tvalue &rvalue{ value }; rvalue.text = l""; rvalue.text.push_back( l'x' ); //ok, no problem rvalue.numeric.integral = l""; rvalue.numeric.integral.push_back( l'x' ); // exception in release mode there no problem. when run in debug mode there exception @ last statement in method _adopt of class _iterator_base12 in xutility: access violation reading location 0x0000005c . in _adopt code run when _iterator_debug_level == 2 . tried with #define _iterator_debug_level 1 added in main progr

Xtensa --- dangerous relocation: windowed long call crosses 1GB boundary -

i got following error during compilation (.sram.text+0x1283): dangerous relocation: windowed longcall crosses 1gb boundary; return may fail: ( und +0xdeadcafe) in 1 of functions. the architecture xtensa , toolchain used gnu toolchain built xtensa. error inside function elf_xtensa_do_reloc() in file elf32-xtensa.c in binutils source code. please let me know cause of error , possible solution. thanks , regards, hari this known caveat of default xtensa windowed-register abi. quoting xtensa isa reference manual : the window increment stored return address register in a4 occupies 2 significant bits of register, , therefore bits must filled in subroutine return. retw , retw.n instructions fill in these bits 2 significant bits of own address. prevents register-window calls being used call routine in different 1gb region of address space. you have 2 options fix this: you can try adjusting load base address code and/or make smaller (!) u

How to assign weights to searched documents in MongoDb? -

this might sounds simple question have spend on 3 hours achieve got stuck in mid way. inputs : list of keywords list of tags problem statement : need find documents database satisfy following conditions: list documents has 1 or many matching keywords. (achieved) list documents has 1 or many matching tags. (achieved) sort found documents on basis of weights: each keyword matching carry 2 points , each tag matching carry 1 point. query : how can achieve requirement#3. my attempt : in attempt able list on basis of keyword match (that without multiplying weight 2 ). tags array of documents. structure of each tag like { "id" : "icc", "some other key" : "some other value" } keywords array of string: ["women", "cricket"] query: var predicate = [ { "$match": { "$or": [ { "keywords" : {

shell - how to properly read from stream in bash -

i reading shared memory stream producing infinite information output such as: 0x1 (timestamp) 12bytes:11216 + 1771/(47999+1) (0.036896) delta= 0+ 1536/(47999+1) (0.032000) 11216.013361 23.534ms 2015.06.25 11:51:16.525 0x4 (referencetime) 12bytes:11215 + 24786286/(26999999+1) (0.918011) delta= 0+ 806359/(26999999+1) (0.029856) 11216.013376 -95.366ms 2015.06.25 11:51:16.525 0x6 (processdelay) 4bytes: 32 (0x20) 0x7 (clockaccuracy) 8bytes: offset=0.000ppm (+-0.000ppm) 0xb (clockid) 8bytes: 01 00 00 00 42 22 01 00 0x20001 (samplerate) 4bytes: 48000 (0xbb80) 0x20002 (channels) 4bytes: 6 (0x6) 0x20003 (pcmlevel) 24bytes: -11041 -11541 -49076 -86121 -24846 -24382 0x20004 (pcmpeak) 24bytes: -8088 -8697 -37244 -84288 -21437 -21769 0x2000e (dolbydpmetadata) 39352bytes: linear time: 11216 + 1771/(47999+1) (0.036896) delta= 0+ 1536/(47999+1) (0.032000) if try read stream following command: while read line; echo "$line"; echo "im here!" done <

File upload in ionic (image or any file)? -

can 1 please sort out gives error filetransfer not defined . below code controller("examplecontroller", function($scope, $cordovafiletransfer) { $scope.upload = function() { var options = { filekey: "avatar", filename: "yedu.jpg", chunkedmode: false, mimetype: "image/jpg" }; $cordovafiletransfer.upload("http://192.168.1.109/uploads/upload", "/android_asset/www/img/yedu.jpg", options).then(function(result) { console.log("success: " + json.stringify(result.response)); }, function(err) { console.log("error: " + json.stringify(err)); }, function (progress) { // constant progress updates }); } }); i think getting error in browser . per official documentation of plugin plugin not supported browser more details go here , here . if testing in browser befo

c++ cli - Lambdas don't appear to work within ref classes in VS2010 -

one of cool new c++ features in visual studio 2010 lambda expressions. however, can't them work within managed class. class unmanagedclass { void foo() { // creating empty lambda within unmanaged class. // compiles fine. auto lambda = [](){ ; }; } }; ref class managedclass { void foo() { // creating empty lambda within managed class. // creates error c3809: // managed type cannot have friend functions/classes/interfaces. auto lambda = [](){ ; }; } }; my best guess compiler creates anonymous function class friend class, though never use class members. seems mean lambdas cannot used @ within ref classes. i happy when read vs2010 adds lambda expressions c++. know how them work within ref classes? looks like being considered future versions. otherwise known as: "we'll it."

java - Download file in jsp -

in jsp file, want initiate download , want continue next jsp page while download happens in background. in final page, want check download 100% complete , allow user confirm details. the problem facing in same jsp can wait till download complete once move next page have no handle monitor download %. please let me know if can provide me pointers same thanks i resolved downloading in servlet , updating session variable final jsp access

android - What is the cordova version used in Mobilefirst 6.3? -

i want use password field in phonegap notification prompt. in ios cordova code available. android have cordova jar file added.so want create own cordova jar file using cordova source code. version of cordova used in mobilefirst 6.3? mobilefirst platform foundation 6.3 uses cordova v3.6.3. note though ibm not support swapping provided cordova version own, , in fact overwritten on every build made in studio. for android may need create own ui instead of h acking notification.alert code provided android.

RMI Server refuses to start: java.security.AccessControlException: access denied ("java.net.SocketPermission" "127.0.0.1:1099" "connect,resolve") -

ok, tried google , tried million different things, none of helped. currently launching server following command: java -djava.security.policy=rmi_generated.policy -djava.security.debug=access,failure mainlauncher aiserver.aiserver mainlauncher loads bin/ , lib/ class path + invokes aiserver.aiserver.main, shouldn't affect relevant this. here's part launches actual server: policyfilegenerator.generate(); if (system.getsecuritymanager() == null) system.setsecuritymanager ( new rmisecuritymanager() ); try { naming.bind("aiservice",server); } catch (malformedurlexception | remoteexception | alreadyboundexception ex) { throw new runtimeexception("failed binding server",ex); } and here's exception get: exception in thread "main" java.lang.reflect.invocationtargetexception @ sun.reflect.nativemethodaccessorimpl.invoke0(native method) @ sun.reflect.nativemethodaccessorimpl.invoke(nativemethodaccessor

dropdown value pass from javascript to php -

i have drop down box has 150 options want value of current option selected.i tried achieve using javascript , successful.now want want pass value php php knows option selected , on basis have change value of particular variable in php. how can achieve type of functionality.this code select option selected in drop down menu in javascrpit function myfun(){ var e=document.getelementbyname("location"); var struser = e.options[e.selectedindex].value; struser ocntain index value of dropdown option how can use value in php this drop down code <form action="final.php" method="post"> <select style="width: 200px;" name="location" onchange="myfun"> <option value="all">all</option> <option value="noida sector 1">noida sector 1</option> <option value="noida sector 2">noida sector 2</option> <option value="noida sector 3&qu

c# - Populating ListBox/View with just one item -

Image
i have listbox (or listview ) populate, list ever contains 1 item this: (it derived job class) so listbox have 2 columns, 1 key, , 1 value, , row each key/value pair. i cant seem work out how collection of 1 item, rather many items. edit: have job class, has been auto generated linq. partial exmaple code: public partial class job : inotifypropertychanging, inotifypropertychanged { private int _id; private string _hostname; [global::system.data.linq.mapping.columnattribute(storage="_id", dbtype="int not null", isprimarykey=true)] public int id { { return this._id; } set { if ((this._id != value)) { this.onidchanging(value); this.sendpropertychanging(); this._id = value; this.sendpropertychanged("id"); this.onidchanged(); } } } [global::system.da

stream - Change default reader in common lisp -

i wrote function replace function read of common lisp (defun my-read (stream &rest args) (declare (ignore args)) (funcall (my-get-macro-character (read-char stream)))) is there way use function default reader? you can't redefine built in functions 1 , can define package shadows cl:read , defines new function my:read , when use package, looks like it's default read function. e.g., this: cl-user> (defpackage #:my-package (:use "common-lisp") (:shadow #:read) (:export #:read)) ;=> #<package "my-package"> cl-user> (defun my-package:read (&rest args) (declare (ignore args)) 42) ;=> my-package:read cl-user> (defpackage #:another-package (:use #:my-package "common-lisp") (:shadowing-import-from #:my-package #:read)) ;=> #<package "another-package"> cl-user> (in-package #:another-package) ;=> #&l

mysql - select the extra row data -

this table sample, had deleted lot column. id orid to_id seq 1 1 5 a12 2 2 6 a12 3 3 7 a12 4 4 _ a12 <--- want find row 5 5 _ a13 6 6 _ a13 7 7 _ a13 i want find data. want use 2 sql find data. (select * forgerock seq = 'a13') (select * forgerock seq != 'a13') b i had tried it, not wanted. how can it? thanks. select b.* (select * forgerock seq = 'a13') right join (select * forgerock seq != 'a13') b on a.to_id = b.to_id; this sqlfiddle i guessing want find rows have no connection row. select fr.* forgerock fr fr.to_id null , not exists (select 1 forgerock fr2 fr.from_id = fr2.to_id );

java - Can not delete the note from the list and from the database in my note app for Android -

in note app android, if press long on note chose "delete" delete note, note still exists in list, after close app return it, note gone! hint: uses oncontextitemselected method show "delete" option. how can delete note list , database?! the mainactivity class contains oncontextitemselected method: package com.twitter.i_droidi.mynotes; import android.app.alertdialog; import android.content.context; import android.content.dialoginterface; import android.content.intent; import android.support.v7.app.actionbaractivity; import android.os.bundle; import android.view.contextmenu; import android.view.layoutinflater; import android.view.menu; import android.view.menuinflater; import android.view.menuitem; import android.view.view; import android.view.viewgroup; import android.widget.adapterview; import android.widget.arrayadapter; import android.widget.listview; import android.widget.textview; import android.widget.toast; import java.util.list; public c