Posts

Showing posts from August, 2012

ios - How to protect swift code with framework or static lib? -

usually can protect source code implementation wrapping static lib or dynamic lib, or framework open header files etc. for swift, got knowing "swift not support static lib". does mean there no way protect swift source code such legacy lib way ? question here clarify , find out approach. thanks,

jboss7.x - MSC00001: Failed to start service jboss.deployment.subunit."oneflexi.ear"."LinkWEB.war" -

what's reason following error, , how can solved? 10:54:14,546 info [org.jboss.as.server.deployment] (msc service thread 1-7) jbas015876: starting deployment of "oneflexi.ear" 10:54:14,998 info [org.jboss.as.server.deployment] (msc service thread 1-3) jbas015876: starting deployment of "linkweb.war" 10:54:14,998 info [org.jboss.as.server.deployment] (msc service thread 1-1) jbas015876: starting deployment of "linkejb.jar" 10:54:15,225 error [org.jboss.msc.service.fail] (msc service thread 1-4) msc00001: failed start service jboss.deployment.subunit."oneflexi.ear"."linkweb.war".parse: org.jboss.msc.service.startexception in service jboss.deployment.subunit."oneflexi.ear"."linkweb.war".parse: failed process phase parse of subdeployment "linkweb.war" of deployment "oneflexi.ear" @ org.jboss.as.server.deployment.deploymentunitphaseservice.start(deploymentunitphaseservice.java:119) [jbo...

angularjs - issue when set parent form valid manually by setting each child form field valid -

i have nested , repeated forms on ui. <form class="form-horizontal" name="registration"> <form ng-repeat = "s in students" name="studentregisteration"> <input type="number" id="input" name="input" model="input" ng-change="validate()"> </form> </form> i trying $setvalidity() specific field of child form following $scope.validate = function (index) { if (condition true) $scope.registration.studentregisteration.input.$setvalidity('integer', false); } it works fine until have 1 form on ui i.e. set integer (property) valid , parent forms become valid. it not work when have multiple forms on ui... parent forms not become valid... not sure how set field valid individual child form parent becomes valid. any idea? i think if pass form controller in function parameter validate work. like <form class="form-horizont...

database - How to make the association in model so I can get all places of user_places's id in rails console? -

Image
i have 2 tables example: user_places ---------------- | id | place_id| ---------------- | 1 | 1 | ---------------- | 1 | 5 | ---------------- | 1 | 6 | ---------------- | 2 | 8 | and places table -------------------------------------------- | id | title | description | image_url | -------------------------------------------- | 1 | 1 | description1 | image1 | -------------------------------------------- | 2 | 5 | description2 | image2 | -------------------------------------------- | 3 | 6 | description3 | image3 | -------------------------------------------- | ...| ... | description4 | image4 | how make association in both models can places of user_places's id = 1 in rails console? you'll want foreign_keys , pertaining rails. rails way interact relational database. such, if know how correctly structure relational db, you'll able better understand rails' activerecord assoc...

validation - How to validate input in javascript for numbers -

this question has answer here: html text input allows numeric input 53 answers here trying validation html input form. here want return false if input not number. want return false if else other number supplied input. how can this? pattern number validation <form class="form-horizontal" name="product-form" method="post" action="go.php" role="form" enctype="multipart/form-data" onsubmit="return validateform();"> <div class="form-group"> <label class="control-label col-sm-2" for="product_price">product price</label> <div class="col-sm-10"> <input type="text" class="form-control" name="product_price" id="product_price" placeholder=...

regex - gunzip or decompress the file in perl and capture the file name in variable -

i have 9001_20150921113547_00041.xml.gz , want gunzip or can decompress 9001_20150921113547_00041.xml ... have many ways in perl, have use system() , qw , qx , backtick well, decompress file , stored file in path want store new decompress file name variable how can ? you can use archive::zip cpan execute job bits under control. not need fork out unzip command, , control output file name yourself. documentation on page has code examples.

audio - Setup AVAudioPlayer with swift 1.2? -

when tried setup avaudioplayer last time, used code: func setupaudioplayerwithfile(file:nsstring, type:nsstring) -> avaudioplayer { var path = nsbundle.mainbundle().pathforresource(file, oftype:type) var url = nsurl.fileurlwithpath(path!) var error: nserror? var audioplayer:avaudioplayer? audioplayer = avaudioplayer(contentsofurl: url, error: &error) return audioplayer! } var buttonbeep = avaudioplayer() buttonbeep = self.setupaudioplayerwithfile("buttonpush", type:"m4a") and worked perfectly. swift 1.2 seems can't that. i tried code: var button : avaudioplayer? in didmovetoview: if let button = self.setupaudioplayerwithfile("button", type:"m4a") { self.button = button } func setupaudioplayerwithfile(file:nsstring, type:nsstring) -> avaudioplayer? { let path = nsbundle.mainbundle().pathforresource(file string, oftype: type string) let url = nsurl.fileurlwithpath(path!)...

objective c - Star Pattern Logic -

i want make star pattern this. * * * * * * * * * * * * * i using code. for (int i=1; i<=3; i++) { (int j=1; j<=3-i; j++) { printf(" "); } (int k=1; k<=2*i-1; k++) { printf("x"); } printf("\n"); } this give * * * * * * * * * how iterate in decrement order. when using (int i=3; i>=0; i--) { (int j=1; j<=3-i; j++) { printf(" "); } (int k=1; k<=2*i-1; k++) { printf("x"); } printf("\n"); } xxxxx xxx x how merged it? another logic here int x=11; int y=x/2; int z=1; bool b1=true; bool b2= true; for(int i=0;i<x;i++) { for(int j=0;j<y;j++) { printf(" "); } for(int k=0;k<z;k++) { printf("*"); } if(y==0) b1=false; if(z==x) b2=false; y=b1?y-1:y+1...

java - android: creat layout dynamically and setContentView it dynamically -

suppose there activity called "m1" , there 2 layouts called "m2" , "m3" both have few buttons dynamically how can setcontentview dynamically whay you have method set view setcontentview so can pass root parent view method achieve requirement.

java - How to resolve namespace file location -

in 1 xslt found namespace xmlns:ns="http://www.sometext.co.jp/ns" url returns 404 error , there no url mapping in tomcat container. please let me know how , found namespace file , function defined in it. namespace names uri (by convention) can arbitrary name. excerpt linked wiki page: a namespace name uniform resource identifier (uri). typically, uri chosen namespace of given xml vocabulary describes resource under control of author or organization defining vocabulary, such url author's web server. however, namespace specification not require nor suggest namespace uri used retrieve information; treated xml parser string. that means cannot expect fetch url.

Android Facebook login does not work on LG G3 -

i'm developing new app on android studio , created app facebook login: facebook sdk v4. there problem connection facebook on device lg g3. on devices works - " emulators, device samsung note3" when connect device lg g3 receive error"key hash invalid" can do? version i'm trying test on is: lg g3 android version 5.0. thanks help.

image processing - Find the LBP code in java -

hello new image processing in java , trying develop face recognizing system using linear binary pattern. trying calculate lbp code image recognizing face. not figure out how it. divided image using code below. not find lbp code then. package project; import javax.imageio.imageio; import java.awt.image.bufferedimage; import java.io.*; import java.awt.*; public class imagesplittest { public void split(string s) throws ioexception { file file = new file(s); bufferedimage image = imageio.read(file); int rows = 3; int cols = 3; int chunks = rows * cols; int chunkwidth = image.getwidth() / cols; int chunkheight = image.getheight() / rows; int count = 0; bufferedimage imgs[] = new bufferedimage[chunks]; (int x = 0; x < rows; x++) { (int y = 0; y < cols; y++) { imgs[count] = new bufferedimage(chunkwidth, chunkheight, image.gettype()); graphics2d gr = imgs[count+...

php - PHP5 Laravel - Replace all object attributes that are equal to a value -

i'm building website laravel 5 framework , i'm little trouble. i extracted array of objects database eloquent model , passed view. the format of array that: array[object1{prop1:xxxx, prop2: xxxx}, object2{prop1:xxxx,prop2:xxxx}...] the problem proprieties values false when print {{ object1->propriety }} doesn't print anything. i want replace false proprieties in objects in array without placing statement if (!obj1->prop) something times, because objects many. thank you. you can use ternary operators in views: {{ $object->boolean_attribute ? 'true' : 'false' }}

CSS Transform and Transition Effect -

i trying figure out way make checkbox transform @ 0% scale(0) 90% scale(1.3) scale(1) has in , out effect. problem i've been trying accomplish past couple of hours , need help. here css. body { padding: 100px; } label { cursor: pointer; } input[type="checkbox"] { display: none; } .check-sq:before { content: "\f096"; font-family: "fontawesome"; speak: none; font-style: normal; font-weight: normal; font-variant: normal; text-transform: none; line-height: 1; -webkit-font-smoothing: antialiased; width:1em; display: inline-block; margin-right: 5px; } :checked + .check-sq:before { content: "\f14a"; color: #06a3e9; /* needing */ transform: scale(0) scale(1.3) scale(1); transition: 1s transform ; } maybe work. :checked + .check-sq:before { animation: nameyouranimation [duration] forwards; } @keyframes nameyouranimation { 0% { transform: scale(0); } 90% { transform:...

url routing - Javascript url content with parameter? -

i wish pass 'selectlang' parameter in javascript , redirect mvc controller var 'selectlang' have error , mention not exist in current content? please guide me thanks! my javascript: $('.filterlang').on("click", function () { var selectlang = document.getelementbyid("language").value; location.href = '@url.content("~/surv_main/surv_main_details/?key=" + model.survey_key +"&language=" + selectlang)'; }); filterlang button class , "language" dropdownlist id. have tried this: $(document).on(".filterlang", "click", function(){ var selectedlang = $("#language").val(); // if normal dropdown, work both cases var selected2lang = $("#language").select2("val"); // if select2 dropdown window.location = '@url.content("~/surv_main/surv_main_details/?key=" + model.survey_key +"&lan...

arrays - Personality Quiz with Javascript -

i quite new javascript , have make personality quiz. need quiz javascript, no jquery. need make each answer option clickable, , show 1 question @ time. finding way store each answer display result. i'm not sure start , i've been having bit of trouble. may seem silly, i'd in seeing i've gone wrong , how can fix it. below i've done far html, css , javascript. in advance var startbutton = document.getelementbyid("startbutton"); startbutton.addeventlistener("click", startclick); function startclick() { var intro = document.getelementbyid("intro"); intro.style.display = "none"; startbutton.style.display = "none"; var question1 = document.getelementbyid("question1"); question1.style.display = "block"; } var answerbutton = document.getelementsbytagname("li"); answerbutton[0].addeventlistener("click", answerclick); console.dir(answerbu...

c# - How do I DataBind a DataGrid after reading serial port -

i trying read serial port , put data grid. , data doesn't appear in data grid. i used notify changer per martin comment below. only wanted show data on datagrid view when serial port updated. here xaml: <window x:class="wpfapplication2.mainwindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" title="mainwindow" height="689.7" width="655"> <grid margin="0,0,2,9"> <datagrid x:name="datagriddata" margin="50,25,19,10" autogeneratecolumns="false" itemssource="{binding source=firstname}"> </datagrid> </grid> </window> and here cs: using system; using system.collections.generic; using system.linq; using system.text; using system.threading.tasks; using system.windows; using system.windows.controls...

ios - Load file to application local storage -

is there ability load files documents, articles server , store them in application local storage using filemanager? , how users can read these files? have access folder? follow these steps downloading , saving file in nsdocumentdirectory // determine local file path nsarray *paths = nssearchpathfordirectoriesindomains(nsdocumentdirectory, nsuserdomainmask, yes); nsstring *filepath = [nsstring stringwithformat:@"%@/%@", [paths objectatindex:0],@"filename.doc"]; //it file type // download , write file nsurl *url = [nsurl urlwithstring:@"http://www.filepathfromserverlocation.com"]; //and write file nsdata *urldata = [nsdata datawithcontentsofurl:url]; [urldata writetofile:filepath atomically:yes]; this way file save @ filepath , u can use in future whatever way u like. opening file in ios: using webview nsstring *path = [[nsbundle mainbundle] pathforresource:@"document" oftype:@"pdf"]; nsurl *targeturl = [nsurl...

ruby on rails - flash[:alert] not working, but flash[:notice] displays the message on redirect -

i using rails_admin gem , configuration follows config.authorize_with if current_user.nil? || current_user.role != 'admin' redirect_to main_app.root_path flash[:alert] = "sorry not authorized!" end end when use flash[:notice] , can see message on root_path, if change flash[:alert] not display, ideas why , solution? i want use :alert only, since changing notice color result displaying red font other notices. it you're not outputting flash[:alert] hash out onto page. look in views output flash[:notice] (probably in app/views/layouts/application.html.erb (or similar) , copy line notice alert. should this: <% if flash[:alert] %> <div id="alert"> <%= flash[:alert] %> </div> <% end %> if doesn't exist (or can't find it), add view (or layout)

I can't load fonts while using tomcat -

i have such errors while loading fonts when using tomcat: 1 failed decode downloaded font: https://my-address.com/css/fonts/robotocondensed-bold-webfont.woff2 1 ots parsing error: failed convert woff 2.0 font sfnt 1 failed decode downloaded font: https://my-address.com/css/fonts/robotocondensed-regular-webfont.woff2 1 ots parsing error: failed convert woff 2.0 font sfnt 1 failed decode downloaded font: https://my-address.com/css/fonts/fontawesome-webfont.woff2?v=4.3.0 1 ots parsing error: failed convert woff 2.0 font sfnt 1 failed decode downloaded font: https://my-address.com/css/fonts/robotocondensed-regular-webfont.woff 1 ots parsing error: incorrect file size in woff header 1 failed decode downloaded font: https://my-address.com/css/fonts/robotocondensed-bold-webfont.woff 1 ots parsing error: incorrect file size in woff header https:// fake .com/ failed load resource: net::err_blocked_by_client 1 failed dec...

c++ - Is "Multiple Include Guard" required for .cpp files? -

i have file1.h , file1.cpp in project. have multiple include guard in file1.h avoid multiple inclusions of same file. have include file1.h file in file1.cpp file. run third party tool (parasoft) find issues respect project, has identified multiple include guard missing in file1.cpp file. question required have multiple include guard in file1.cpp file? if not required why getting error in file*.cpp file? please me.... the usual cause of message #include "file1.cpp" . say, accidentally included .cpp file instead of actual header. the tool you're using correctly thinks if file1.cpp included, should guarded against multiple inclusion. tool doesn't wonder whether file1.cpp should have been included in first place.

maven - how to specify multiple mavenRepo's in build.gradle? -

i use multiple mavenrepo's in build: repositories { mavenlocal() mavencentral() mavenrepo { url: "http://cloudant.github.io/cloudant-sync-eap/repository/" url: 'https://github.com/snowch/sync-android-p2p/raw/master/repository/' } } however, build fails error similar this: > not find method mavenrepo() arguments [...] on repository container. how can specify multiple mavenrepo's? note: i'm using old version of gradle , therefore need use deprecated mavenrepo statement. according official gradle 1.1 documentation , should able use newer url attribute follows: repositories { mavenlocal() mavencentral() maven { url 'http://cloudant.github.io/cloudant-sync-eap/repository/' } maven { url 'https://github.com/snowch/sync-android-p2p/raw/master/repository/' } } as this gradle discussion mentions, should use 1 url per maven block.

php - Second select depending on first select using AJAX in CodeIgniter -

i want second selects options vary depending on choice in first select. if pick "skalman" can't pick "whole day lunch" , if choose "lilleskutt" can't choose "half day". haven't worked ajax before thinking might right way go, if me out more grateful! i options database, using 2 functions in booking.php: private function get_room_options() { $this->load->model('booking_model'); $rooms = $this->booking_model->get(); $rooms_form_options = array(); // room title , store in array foreach ($rooms $id => $room) { $rooms_form_options[$id] = $room->title; } return array( 'rooms_form_options' => $rooms_form_options, ); } public function get_package_options() { $room = $this->input->post('searchdata'); $this->load->model('package_model'); $packages = $this->package_model->get(); $packages_form_opt...

sublimetext2 - Why package does not appear in sublime text 2 Package Control? -

Image
i install new package ( rsync-ssh ) in sublime text 2 editor. have installed package control . i followed installation steps: ... installing via excellent package control plugin. press ⌘⇧p , type package control: install package , select it, type package name rsync-ssh , select it. but package not available on list, see img: any ideas? i'm on linux (ubuntu 15.04), installed sublime text few days ago, quite new. i checked out package want install on package control website , think exclusively available sublime text 3. https://packagecontrol.io/packages/rsync%20ssh try uninstalling st2 , install st3 instead , should fix issue having, because have st3 , package available me.

php - Force all errors to a custom error page in CakePHP -

i'm trying force of errors single custom page in cakephp(2.0) of tutorials find specific error codes. want show single error page first did point of errors of specific error status single error page. after further testing, noticed other codes not being captured. i need code capture of http error codes single error page. this code: configure::write('exception', array( 'handler' => 'errorhandler::handleexception', 'renderer' => 'appexceptionrenderer', 'log' => true )); and appexceptionrenderer: <?php app::uses('exceptionrenderer', 'error'); class appexceptionrenderer extends exceptionrenderer { public function internalerror($error) { $this->controller->beforefilter(); $this->controller->set('title_for_layout', 'internal server error'); $this->controller->render('/errors/error500'); $this->controller->response->send(); ... other ...

hbase integration with pyspark -

i trying access hbase pyspark in hdp 2.3 trying execute sample program given in spark directory using following command: spark-submit --driver-class-path /usr/hdp/current/spark-client/lib/spark-examples-1.3.1.2.3.0.0-2557-hadoop2.7.1.2.3.0.0-2557.jar --jars /root/{user}/hbase-0.94.0.jar /usr/hdp/current/spark-client/examples/src/main/python/hbase_inputformat.py 10.77.36.78 iemployee in starting giving class not found exception downloaded hbase-0.94.0.jar , previous error gone getting below error. error log: 08:59:49 error tableinputformat: org.apache.hadoop.hbase.client.noserverforregionexception: unable find region iemployee,,99999999999999 after 10 tries. @ org.apache.hadoop.hbase.client.hconnectionmanager$hconnectionimplementation.locateregioninmeta(hconnectionmanager.java:926) @ org.apache.hadoop.hbase.client.hconnectionmanager$hconnectionimplementation.locateregion(hconnectionmanager.java:832) @ org.apache.hadoop.hbase.client.hconnectionmanager$hconnection...

perl - installation package not supported by this processor -

i need install perl interpreter in computer. downloaded installation file .msi file. when open following window appears: "ce package n'est pas pris en charge par ce type de processeur. contactez votre revendeur." translated englich follow: "this installation package not supported processor type. contact vendor". how resolve problem? can me please

ios - How to check how much the first row is hidden in UITableView without using contentOffset? -

i need know how of first cell hidden current scroll in uitableview . in other words, @ point in cell's coordinates, cell not covered yet? the contentoffset cannot used because calculate myself. you have indexpath first visible row, , convert origin cell's coordinates: if let firstvisibleindexpath = indexpathsforvisiblerows?.first { if let cell = cellforrowatindexpath(firstvisibleindexpath) { let coveredheightoffirstvisiblecell = tableview.superview!.convertpoint(tableview.frame.origin, toview: cell).y } }

unit testing - Mock a public method of the class being tested -

i'm trying unit test class 1 public method (method 1) uses public method (method 2) of same class within it. e.g. class myclass { public function method1() { $var = $this->method2(); // stuff var $answer return $answer; } public function method2() { // complex workings out $var return $var; } } now, method2 unit tested , don't want build argument call whilst testing method1 . want mock method2 , define in test returned. have: function test_method1() { $myclass = new myclass(); $mockedmyclass = mockery::mock('myclass'); $mockedmyclass->shouldreceive('method2')->once()->andreturn([1,2,3,4]); // mocked $var returned used in rest of method1 $answer = $myclass->method1(); // assertions } clearly doesn't work method being tested in same class contains method being mocked, there's no way pass in mocked class dependency. what's best way mock me...

jmeter - How can I set condition to execute some steps just for particular amount of users -

how can set condition in jmeter step 80% of users execute , 20% of users not. please me this. have http sampler , want execute 80% of users in test, when number of users (threads) change percentage of executed requests sampler stay same. if have samplers want work in threads, not all, easiest way add them if controller , in condition add like: ${__random(1,100)} <= 80 in case requests in controller has 80% chance run (fires when random lower or equal 80). of course it's not perfect, can go +-5% of requests it's fastest , easiest way know. , sort of randomness it's more real life experience.

javascript - jsp dont load css and scripts after deploy -

i trying deploy java jsp application, view not charge .css , .js files, can fix this? file structure follows: -project -meta-inf -web_inf -resources -css -scripts -administracion -control -inicio your add lines given below: <script type="text/javascript" src="resources/scripts/your_js_file.js"></script> <link rel="stylesheet" type="text/css" href="resources/css/style.css" />

Erlang filter list using lists:keyfind partial string -

i new erlang i have list as: list = [[{name, <<"redcar1">>}, {turbo, true}], [{name, <<"redcar2">>}, {turbo, true}], [{name, <<"greencard">>}, {turbo, false}]]. now want filter "red" cars i tried using: filtercar() -> myf = fun(list) -> case lists:keyfind(name, 1, list) of {name, <<"red", _rest/binary>>} -> true: _ -> false end end, myf. then lists:filter(myf, list), it works perfectly. now want create generic function filter, like: myfilter(value, list) -> case lists:keyfind(name, 1, list) of {name, <<value, _rest/binary>>} -> true; _ -> false end. but when try execute function got [] empty list. i sure problem when try pass value because if replace {name, <<value, _rest/binary>>} with {name, <<"red", _rest/binary>>} i...

api - Authenticating Requests From A Single Server -

i'm working on project contains data belonging multiple clients, , i'm trying find secure way notify servers of sensitive changes data. the issue secure method found oauth, since server pushing updates them, mean each client have implement oauth provider solely authenticate server, , feels bit of overkill. my question is: keeping in mind not clients use https, enough use shared secret, timestamp, , form of encryption servers safely receive , validate updates or leave them vulnerable attacks? yes, secure. simple messages think jtw choice. use authentication or actual notification itself. few reasons might want use it: it's signed, know message hasn't been tampered with. you can encrypt public/private key pairs. you can add data like. it's simple implement , doesn't require back-and forth exchange between servers oauth does.

How to read data from properties file instead of a feature file in Cucumber BDD Framework? -

i have scenario want log in multiple users, cucumber provides scenario outline examples perform action requires user details entered in feature file. there way keep user details in properties file , call there in step definition class? if there is, can please provide me example code gmail login scenario? using junit cucumber framework,any suggestion junit highly appreciated. thanks fola i've been searching sorta same thing , found lot of ridiculous "answers" this. overly complicated, when super easy. my goal read .txt file here solution in ruby. #inject environment properties given /^i enter environment url field$/ file.open("/path/to/your/env.txt") |envfile| envfile.each_line |environment| puts environment keyboard_enter_text environment end end end now jenkins can create parameterized build writes properties file. viola you're tests dynamic, enjoy!

.net - What is the frequency to update exchange rate for eCommerce website with multiple currencies? -

we including third party api convert currency per country selected in dropdown. steps are 1) set currency in session/cookie 2) have lookup table of currency conversions stored somewhere (e.g. database) - convert new price using lookup table depending on whichever currency set in session/cookie. unable decide how set cookie expiry time lookup table currency conversion. good, if twice in day. per our requirement don't need exchange rate updating every request. just store last data in session well. session["lastconversiondate"] = datetime.now , , upon next request test whether ((datetime)session["lastconversiondate"]) < datetime.now.addminutes(-expirationinminutes) .

Nexmo VoiceXML not working in language other than en-US -

i have running voicexml application works ok in nexmo. if set language other en-us calls want answered. change en xml:lang in: <vxml application="/dialogue/root/50b9bab0-9ce8-4d7a-9389-09f06aa8f9ee" version="2.1" xml:lang="es-es"> i have tried in vxml above , in prompt tag. language es-es, es-es... en-uk make vxml stop working in nexmo. sure script ok can change en-us female , male voice en-us-male , en-us-female. works. am missing something? (i don't think makes difference use great rivr java library generated vxml) for me "fr-ca" doesnt work "fr-ca-female" work

fortran - Unresolved external symbol when linking a precompiled module -

i trying compile fortran file external precompiled module. first compile module file with: ifort /c kdtree_mod.f90 it generates .mod files (kdtree2_module.mod, kdtree2_precision_module.mod, kdtree2_priority_queue_module.mod). at beginning of subroutine have: subroutine film(h,tinf,ts,n,time) use kdtree2_module but when launch program gives me error: user_film.obj : error lnk2019: unresolved external symbol kdtree2_module_mp_kdtree2_create referenced in function film user_film.obj : error lnk2019: unresolved external symbol kdtree2_module_mp_kdtree2_n_nearest referenced in function film user_film.exe : fatal error lnk1120: 2 unresolved externals link failed user_film.obj procedure: 1. compile module ifort /c kdtree_mod.f90 2. launch msc marc user subroutine film. run_marc -j name_input_file -u user_subroutine 3. error msc marc commercial software has possibility create user subroutine. update: tried: 1. ifort /c kdtree_mod.f90 --> generate .obj file ...

java - Problems with implementing a sorted map -

i'm trying implement sorted hash map , have 1 problem. let me describe situation first, 1 understand what's going on. i defined interface called map . looks this public interface map<k extends comparable<k>, v> { /*** state information ***/ public boolean isempty(); public int size(); public boolean contains(k key); /*** main operations ***/ public void insert(k key, v value); public v get(k key); public v delete(k key); } and defined class called sortedmap implements interface. in class have nested static class called item acts wrapper. here is private static class item<k extends comparable<k>, v> implements comparable<item<k, v>> { private k key; private v value; item(k key, v value) { this.key = key; this.value = value; } @override public string tostring() { return string.format("%s=%s", key.tostring(), value.tostring()); } public int compareto(item...

java - Generate a random number and add 0 before it to ensure fixed number of digits -

so trying generate random number. going append day , month integers before random number. able using following code. calendar calendar; calendar=calendar.getinstance(); int day= calendar.get(calendar.day_of_month); int month=calendar.get(calendar.month)+1; //it treats jan 0 hence add 1 int num= integer.valueof(string.valueof(month)+string.valueof(day)); now need generate random number add 0s before it. example today 21st september numbers like 921 (num) + 22334 (random num) = 92122334 921 (num) + 2 (random num) = 92100002 basically add 0s start ensuring number of digits remain same. use case of easier way of generating unique order numbers have inbuilt time stamp well. dont expect process more 200 orders day hence taking 5 digit random number seems reasonable enough probability of duplicates small. two possible solutions. calendar calendar = gregoriancalendar.getinstance(); int num = 0; num += (calendar.get(calendar.month) + 1) * 10_0...

c# - How Run Multiple UI Actions Asyncronously in Silverlight? -

what have seen this post shows how asynchronously run multiple tasks , wait of them. here solution: var thread1 = new thread(() => dosomething(1, 0)); var thread2 = new thread(() => dosomething(2, 3)); thread1.start(); thread2.start(); thread1.join(); thread2.join(); the problem but seems task non-ui task. have same problem ui task. if want ui-related task in wpf/silverlight should use dispatcher , tried code: thread getthread(action action) { return new thread(()=> { application.current.rootvisual.dispatcher.begininvoke(()=> { action(); }); }); } and how use it: var thread1=getthread(async ()=>{uiproperty1 = await getuipropertyvaluesfromwebserviceasync1();}); var thread2=getthread(async ()=>{uiproperty2 = await getuipropertyvaluesfromwebserviceasync2();}); thread1.start(); thread2.start(); but throws exception invalid cross-thread access. how correct code run multiple ui-related task asy...

AEM 6.1 - Store data in session -

Image
in our aem instance getting data external system, per user data same during session. make sense store data in session / cache or that. cms used before stored such data in session. right solution here aem 6.1 or there better alternatives? call 1 needs stored: size in bytes: 34597 call 2 needs stored: size in bytes: 2201 thanks response. i can think of 3 solutions.. get data session java class, create pojo, , build object of pojo data in session. serialize pojo , save in browser's cookie. while retrieving it, can de-serialize , use on form or in java code. have see how big of object becomes data comes. cookies have 4kb limit on size. if can use angular(or jquery), can save session "html5 localstorage" , retrieve manipulate , display on form or send webservice. advantage localstorage has bigger capacity(5mb) , modern browsers support it. drawback cannot access locastorage java (server-side). have attached screenshot browser storage options show when pr...

matlab - Change the color of specific letter in console -

Image
i forming specific string using several strcat , displaying console. string contains characters such as: 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 0 , # , * , e , using fprintf('%s') purpose. for instance: 2e4137e65922# is possible outcome of code. is there anyway make letter e stand out in output? making red? thanks @dev -il information! while seems cprinf() other answer not work single characters, if there single color 1 wants use, , color orange, trick used warning in cprintf can used: disp(['this [' 8 'orange]' 8 ' text']) read more at: http://undocumentedmatlab.com/blog/another-command-window-text-color-hack thus, code like: s='2e4137e65922#'; c=strsplit(s,'e'); str=c{1}; ii=2:size(c,2) str=[str ['[' 8 'e]' 8 ]]; str=[str c{ii}]; end disp(str);

javascript - Show hidden div in page after clicking link to open the page -

i have html page in hidden div becomes visible when button clicked. this: $('#display').click(function(){ $('#itemlist').removeclass('hide'); ... }) on page, there link when clicked takes user earlier page, , element id= 'itemlist' on page has become visible. code this: <a href='firsthtml.php'> view items</a> i not sure else add code make other page appear hidden element visible. can please? one of probable solution localstorage .where may implement cookies or string query pass value other page. i showing use of localstorage , may store id in localstorage on click of anchor below <a href='firsthtml.php' data-showid='itemlist'> view items</a> now bind event on anchor $("[data-showid]").bind('click',function(){ var idtoshow=$(this).attr('data-showid'); if(idtoshow) store('visibleid', idtoshow); }); now need define these fu...

php - Select an unpersisted entity -

i'm using twig loop display list of elements. these elements come decoded json array, api. i have onetomany relation between user , these elements. user needs chose 1 of these elements, added user addelement() function. i tried using symfony2 form in loop, displayed on first element. tried using link controller function, since none of these elements persisted in db, got error: "unable guess how doctrine instance request information." here's how display elements: {% block itinerary %} {% element in elements %} <aside class="flights-results__by-price col-md-3"> <span class="flights-results__price">{{ element.price ? element.price : 'unknown' }}</span> <a href="{{ path('selectleg', {'element': element}) }}">delete</a> </aside> {% endfor %} {% endblock itinerary %} here function create , fill elements : public function getavailabilities($availabi...

Xslt loop through different nodes and combine in BizTalk map -

i want compare 2 records in single xml file , fetch matching records. (note: not able change inputschema) the inputrequest1 contains identifiers (id , idscheme) , want compare inputrequest2 contains multiple products , corresponding identifiers (id , idscheme) , login detials (id , idscheme - login). should compare inputrequest1 inputrequest2 nodes , extract matching product details form output. output should contain login , id details shown in example below. sample xml: <ns0:root xmlns:ns0="http://schemas.microsoft.com/biztalk/2003/aggschema"> <inputmessagepart_0> <ns1:inputrequest1 xmlns:ns1="http://myclient/schema/5.0.0/"> <ns1:identifier> <ns1:id>123456</ns1:id> <ns1:idscheme>abc</ns1:idscheme> </ns1:identifier> <ns1:identifier> <ns1:id>654321</ns1:id> <ns1:idscheme>cba</ns1:idscheme> </...