Posts

Showing posts from February, 2013

batch file - Windows access denied error message on using net use -

i having following issue when try use net use using batch file configured in hudson . i added test user administrator in remote windows server 2012 , set password. my batch script: net use p: /delete net use p: "\\cazrt\c$" /user:test /persistent:no xxxxx set "source=%~1" set "target=p:/%~2" echo "%source%" "%target%" echo f|xcopy /s /i /q /y "%source%" "%target%" output on execution: [exec] c:\hudsonprojects\nga>net use p: /delete [exec] [exec] c:\hudsonprojects\apps>net use p: "\\cazrt\c$" /user:test /persistent:no xxxxx [exec] system error 5 has occurred. [exec] [exec] access denied. if try use net use without persistent , same access denied error , network connection not found. output on execution: [exec] c:\hudsonprojects\nga>net use p: /delete [exec] [exec] c:\hudsonprojects\apps>net use p: "\\cazrt\c$" /user:test xxxxx [exec] network connect...

php - SilverStripe gridField Entries not visible for normal backend user -

i have 2 user groups administrator , inhaltsautoren my landingpage has tab teaser gridfield . normal user can not see entries , dont know why? i cant find setting permissions inhaltsautoren. has idea why there no entries in gridfield? teaser.php <?php class teaser extends dataobject { private static $db = array ( 'title' => 'varchar', 'description' => 'htmltext' ); private static $has_one = array ( 'photo' => 'image', 'link' => 'link' ); private static $many_many = array( 'tags' => 'tag' ); private static $summary_fields = array ( 'gridthumbnail' => '', 'title' => 'titel', 'description' => 'beschreibung' ); public function getgridthumbnail() { if($this->photo()->exists()) { return $this->photo()->setwidth(100); } return "(no image)"; } pu...

javascript - Injecting Carbon in Handlebars Template -

i have handlebars template renders articles on site fetching data through api. api returning timestamp i'd convert human readable format. format timestamp through js wondering whether inject carbon, diffforhumans() specific, on fly. <script id="article-template" type="text/x-handlebars-template"> <div class="post-item"> <div class="post-item__thumb"> <img class="post-item__thumb__img" src="@{{ thumbnail_image }}" alt="@{{ title }}"/> </div> <div class="post-item__content"> <a class="post-item__title" href="@{{ url }}">@{{ title }}</a> <p class="post-item__meta"> <a href="#">@{{ author }}</a> on @{{ published_at }} </p> <p class="post-item__teaser">@{{ ...

kimono - Scraping past page 25 with KimonoAPI from Kimonolabs -

i'm trying capture information architects register can scrape down 25 pages, how can access pages after page 25? example url http://architects-register.org.uk/search/address/london try add following parameters source-url of api kimoffset=xxx&kimlimit=1000 where xxx "elements page number x number of pages mean skip"

How to take a whole line as input using vector in c++? -

**example:-animals ( reptiles birds ( eagles pigeons crows ) ) input? ** not getting answer input animals ( reptiles birds ( eagles pigeons crows ) ) #include<vector> #include<string> #define ll long long #include <iostream> using namespace std; int main() { ll n,m,k,cb=0,ob=0; cin>>n; string c; vector<string> s; while(cb!=ob) { cin>>c; if(c=="(") ob++; else if(c==")") cb++; s.push_back(c); } for(ll i=0;i<s.size();i++) cout<<s[i]; return 0; } first problem first thing read long long value. animal isn't. you checking while(cb!=ob) . lines above cb , ob both initialized 0 . loop never run. even if fix loop next problem input doesn't start ( . after reading animal loop exit. the third problem output. don't flush cout when done. also: why use long long i ? std::vector::size() returns size_t . please stick that. one "easy" solution this: #inc...

pascal - Delphi - Prime Numbers -

this question has answer here: how check prime number in delphi 2 answers a prime number (or prime) natural number greater 1 has no positive divisors other 1 , itself. i'm doing check if number prime or not : begin writeln('give number '); readln(n); s := 0; := 1 n if n mod = 0 s := s + 1 ; if s = 2 writeln('prime') else writeln('not prime'); sleep(50000); end. i'm trying prime numbers between 1 , 100 (or other number) using : begin writeln('give number '); readln(n); := 1 n begin s := 0; j := 1 begin if mod j = 0 s := s +1 ; if s = 2 writeln(i); end; end; sleep(500000000000); end. but it's not reallyworking . i able fix : begin writeln('give number '); readln(n); := 1 n begin s := 0; j := 1 begin if mod j = 0 s := s +1 ; end; if s = 2 wri...

Show multilayer function relationship by cscope in vim -

i know source insight can show multilayer function relationship in 1 window. for example, have 4 functions below void example_a() { example_b(); } void example_b() { example_c(); } void example_c() { example_d(); } void example_d(); { return 5; } when click example_d() in source insight, source insight show example_c() calling function. moreover, when click example_c() , see example_b() calling function. the relationship this: example_d() | -->example_c() | -->example_b() | -->example_a() could see relationship in 1 window using cscope in vim? thank you. cctree plugin vim kind of visualization using cscope https://sites.google.com/site/vimcctree/ http://www.vim.org/scripts/script.php?script_id=2368 https://github.com/hari-rangarajan/cctree

How do I get the gradient of the loss at a TensorFlow variable? -

the feature i'm after able tell gradient of given variable respect error function given data. one way see how variable has changed after call train, can vary massively based on learning algorithm (for example impossible tell rprop) , isn't clean. thanks in advance. the tf.gradients() function allows compute symbolic gradient of 1 tensor respect 1 or more other tensors—including variables. consider following simple example: data = tf.placeholder(tf.float32) var = tf.variable(...) # must tf.float32 or tf.float64 variable. loss = some_function_of(var, data) # some_function_of() returns `tensor`. var_grad = tf.gradients(loss, [var])[0] you can use symbolic gradient compute numerical gradient particular data: sess = tf.session() var_grad_val = sess.run(var_grad, feed_dict={data: ...})

python - How to check if Pyro4 client is still alive -

situation: a pyro4 server gives pyro4 client pyro4 proxy. i want detect whether client still indeed using proxy, server can give proxy other clients. my idea @ moment have server periodically ping client. this, client need host pyro daemon, , give server pyro4 proxy server can use proxy ping clients. is there cleaner way this? i'd let client report server no longer needs proxy. i.e. don't overcomplicate server dependencies/knowledge clients.

SSL Poke connection issue ( Jenkins to Sonarqube ) -

i using jenkins 1.643 , sonarqube 5.1 while trying access sonarqube url via sslpoke jenkins server (with jdk 1.6), i'm getting below error /usr/lib/jvm/jdk1.6.0_45/bin/java sslpoke sonarqube-b.test.com 443 java.io.eofexception: ssl peer shut down incorrectly @ com.sun.net.ssl.internal.ssl.inputrecord.read(inputrecord.java:462) @ com.sun.net.ssl.internal.ssl.sslsocketimpl.readrecord(sslsocketimpl.java:863) @ com.sun.net.ssl.internal.ssl.sslsocketimpl.performinitialhandshake(sslsocketimpl.java:1188) @ com.sun.net.ssl.internal.ssl.sslsocketimpl.writerecord(sslsocketimpl.java:654) @ com.sun.net.ssl.internal.ssl.appoutputstream.write(appoutputstream.java:100) @ com.sun.net.ssl.internal.ssl.appoutputstream.write(appoutputstream.java:114) @ sslpoke.main(sslpoke.java:31)** the same working fine jkd 1.7 /usr/lib/jvm/jdk1.7.0_60/bin/java sslpoke sonarqube-b.test.com 443 successfully connected ...

sql server - How can I pass a table name as a variable in SQL - Python 3.4 -

i trying write sql statement in python passes table name variable. however, following error: must declare table variable "@p1". pypyodbc.programming error: ('42000', '[42000]' [miscrosoft] [sql server native client 10.0] [sql server] must declare table variable "@p1" the code yielding error is: query = cursor.execute('''select * ?''', (table_variable,)) i have other code pass variables sql statement using same syntax works fine (code below works intended). query = cursor.execute('''select column_name information_schema.columns table_name = ?''', (table_variable,)) the error seems occur when using variable pass table name. any resolving error appreciated. what you're trying impossible. can pass values queries parameters - select * @table is banned but select * tablename column=@value is legal. now, why it's banned. logical point of view database layer can...

php - Laravel Installation directory location -

laravel's documentation not explicitly execute "laravel new project_name"? should executed @ webserver's root htdocs or www? use wamp server in windows. it should executed @ parent folder of htdocs or www . the laravel folder can't live in htdocs , expose sensitive files. after that, must map laravel_myapp/public htdocs/myapp . you can symlink laravel_myapp/public folder want in htdocs .

wpf - Changing ListBoxItem Height while using MahApps.Metro -

i have project uses mahapps.metro. in code behind of listbox temporarily make height of listboxitem 0. dim draggeditemcontainer uielement = helper.getitemcontainerfrompoint(itemscontrol, _dragstartposition) if draggeditemcontainer isnot nothing dim lbi listboxitem = ctype(draggeditemcontainer, listboxitem) lbi.height = 0 end if without using mahapps.metro works fine. there special here? the metrolistboxitem style of mahapps.metro sets minheight 25 , must set 0 .

SSDT-BI 2013 slows to a crawl when loading a Data Flow component from an SSIS Pkg -

new using ssdt-bi 2013. i have loaded ssis package complex data flow component. when double click data flow component open takes on half hour validate everything. no errors, long time load, point of being unuseful. when open same thing in pre ssdt-bi 2013, same data flow opens immediately. can't find online this, have ideas? thanks!

Scheduled/Delay messaging in Spring AMQP RabbitMq -

i struggling hard find out way scheduled/delaying messages in spring amqp/rabbit mq. after hell lot of searching still not able in spring amqp. can please tell me how x-delay in spring amqp. i want delay message if exception occurs in consumer side. rabbitmq says add x-delay , install plugin have done, still messages comming without delay i getting in message received <(body:'[b@60a4ae5f(byte[26])'messageproperties [headers={x-delay=15000} @bean connectionfactory connectionfactory(){ cachingconnectionfactory connectionfactory=new cachingconnectionfactory("127.0.0.1"); connectionfactory.setusername("guest"); connectionfactory.setpassword("guest"); connectionfactory.setport(1500); connectionfactory.setpublisherreturns(true); return connectionfactory; } @bean binding binding(@qualifier("queue")queue queue, directexchange exchange) { return new binding(queue.getname(), binding.destinationtype.queue...

coldfusion - cfindex shows records inserted but doccount is 0 -

i'm using cfindex on query can't data out of index. other indexes have doccount greater 0 when check collections, 1 0 though status of refresh has value. here code: <cfindex action="refresh" collection="quizzes" body="quiz,course,coursename,quizname,inclass,unlock_at,lock_at,type" query="qexams" type="custom" key="quiz" status="info" /> <cfdump var="#info#" /> <cfcollection name="qquizzes" action="list" /> <cfdump var="#qquizzes#"/> <cfabort/> i don't think there reason show query creates qexams, i've dumped before index , note there there indeed data in it. the result of #info# following: struct deleted 0 inserted 1154 updated 0 the result of #qqizzes# following: doccount lastmodified name path size 1 53 [date] faq [path] 144 2 4892...

java - equivalent of ZipEntry in directory use context -

what's equivalent of zipentry in directory use context ? i'm trying replace code written zipfiles convert code written directories instead. as zipentry represents file, guess looking java.io.file .

android - splash screen shown as blank screen -

i made splash layout, last time , other activity should loaded,alone works perfectly, when it's connected other activity, shows blank screen. mainifest file : <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="andy.propaganda" android:installlocation="auto" > <application android:allowbackup="true" android:icon="@drawable/my_launcher" android:label="@string/app_name" android:supportsrtl="true" android:theme="@style/apptheme.noactionbar" > <activity android:name=".shit" android:label="@string/app_name" > <intent-filter> <action android:name="com.coderefer.androidsplashscreenexample.mainactivity" /> ...

c# - Catching exceptions without a catch block -

i'm working in legacy project (read: refactoring not option) throwing applicationexception s. throw new applicationexception(string.format("more 1 type found name {0} in {1}", typename, assemblies)); context i'm relatively new dev. basic throwing/catching exceptions explicitly makes sense me. concept of exceptions bubbling call stack different catch statement feels intuitive. beyond know clr capable of.. something. line particularly confusing (from this article ) the exception passed stack until application handles or program terminates. i cannot find single catch statement in entire solution, leave me think exception terminate process, i'm seeing error message on front end instead - process runs on. the top of call stack spinning new thread , above external code. show more code if weren't proprietary. dim installthread new thread(ctype(sub() installpackageasyncinner(appstooverride, package, parameters), threading.threadstart)) the q...

c++ - _mm_store_si128 throws exception -

so i've been tryna learn see optimization on own , i'm not quite getting it, thought simple function zeroes memory easy implement, went on , tried implement myself. here 0 memory function loops buffer start buffer end , uses _mm_store_si128 0 out. bool zeromem( byte * _dest, uint _sz ) { if ( _dest == nullptr ) return false; __m128i 0 = _mm_setzero_si128( ); ( auto = rcast<__m128i*>( _dest ), end = rcast<__m128i*>( _dest + _sz ); < end; ++i ) { _mm_store_si128( i, 0 ); } return true; } exception thrown: access violation (0x00000) though pointer not 0x00000. the test did allocating 1024 bytes of memory , calling zeromem. the exception thrown on first iteration. _mm_store_si128 translates movdqa , requires operands aligned on 16-byte boundary cause exception. iirc, example windows doesn't implement explicit alignment exception, causes access violation. concerning memset imple...

essbase - Is it possible to create dynamic drop-down boxes in Hyperion Planning forms -

i'm working on first sandbox hyperion planning application , i'm curious if possible create dynamic drop-down boxes in planning forms. example, if form requires planner select team/cost center, company , currency possible create form dynamic such that: when planner picks particular cost center, company , currency drop-down boxes dynamically populated valid choices given selected cost center / team. without hyperion in front of me, can't remember if got syntax correct, should pretty close this. in dropdown1 onchange script: var objdd1 = this; var objdd2 = activedocument.sections['dashboard'].shapes['dropdown2']; var value1 = 'selection'; var objtable1 = activedocument.sections['table']; var objcolumn1 = objtable1.columns['list_items']; var value2 = 'selection2'; var objtable2 = activedocument.sections['another table']; var objcolumn2 = objtable2.columns['list_items']; // go through dropdow...

javascript - Is there a way to know how inline css property value was set using developer tools? -

Image
i'm having bad time javascript-based layout, wondering if there's way, using chrome dev tools, know, example, line of js set element's width. chrome capable of detecting that? under sources tab of chrome developer tools can set execution pause on dom mutation. here link relevant section of documentation

swift - What is causing "Use of unresolved identifier ParseClientConfiguration"? -

i'm on final step of migrating parse heroku. need update code in app include new keys , sever info. put in code: let config = parseclientconfiguration(block: { (parsemutableclientconfiguration) -> void in parsemutableclientconfiguration.applicationid = "..."; parsemutableclientconfiguration.clientkey = "..."; parsemutableclientconfiguration.server = "..."; }); parse.initializewithconfiguration(config); and error on first line. i have imported parse, i'm not entirely sure why i'm getting this. i using outdated parse sdk. had update. working now.

Using python array's column as boolean to change another column's values -

i farily new python, may why haven't been able search in site answer problem, in case know already. i reading several data files consisting in 6 columns: xyz coordinates , 3-vector components around sphere. using x , z coordinates find angle location of vectors, , using angle results new column array, fourth column. so, have 7 column array. the angles calculated np.arctan , (-) or (+) sign depending on quadrant xz coordinates located. now, want make angles around upper half of sphere (z positive) positive , spanning 0º 180º. on other hand, want angles around lower half negative, , going 0º -180º. the operations change sign , apply 0º-180º range easy implement. but, want use third column of array (z coordinates) boolean decide how change angles (fourth column of array). have read quite lot of info slicing arrays, or modifying columns/rows based on arbitrary boolean conditions applied same columns/rows. i trying avoid combining for-loops , if-statements, , learn how use...

MD5 Hash Brute Force java -

i having trouble creating brute force java code class assignment. professor not hoping lend me hand or give tips. professor supplied 2 methods md5_bytes , mini_md5_bytes . mini bytes used decode 24 bits instead of full hash. have tried go on own , have hit wall. random string generator attempt @ trying use random strings find hash preselected word s. appreciate help. public class bruteforce { static int num_bytes=24; static string rand = ""; static string s = "aefbcefacefeacaecefc"; static byte[] random = null; static byte[] md = null; public static void main(string[] args) throws exception{ md = mini_md5_bytes(s, num_bytes); if(s.equalsignorecase(rand)){ system.out.println(rand); } else{ rand = brute(md, s); } } public static byte[] mini_md5_bytes(string s, int num_bytes){ byte[] md = md5_bytes(s); return arrays.copyof(md,num_bytes); } public static byte[] md5_bytes(string s){ messagedigest md; ...

json - PHP POST not working. Sending but NULL params? -

i have issue when trying send json java web service. using curl post json web service responds paramters send null see error message below. $data = "{'firstname': 'tom', 'surname' : 'tom', 'companyname' : 'test','phone' : 01234567, 'email' : 'test@test.com'}"; $ch = curl_init('http://10.50.1.71:8080/sme/api/details.json'); curl_setopt($ch, curlopt_customrequest, "post"); curl_setopt($ch, curlopt_postfields, $data); curl_setopt($ch, curlopt_returntransfer, true); curl_setopt($ch, curlopt_httpheader, arra...

nunit - Selenium: Check i the testcase pass or fail -

guys first of totally new selenium. having automation project. in project, creating screenshot function take screenshots of event have created testcases. if test cases passes screenshot should move pass folder, else fail folder. i know how detect test case pass? i know nunit detects wanted program cam place screenshot log file pass or fail folder. program in c# selenium nunit run test case. i think meant this. there work around this. need add code accordingly. if (testcontext.currentcontext.result.outcome.equals(resultstate.failure)) { integrationtest.writeinlog("fails"); } else if (testcontext.currentcontext.result.outcome.equals(resultstate.success)) { integrationtest.writeinlog("sucess"); }

javascript - Managing Image Map, managing interaction with the area maps -

i'm working develop real estate website client. client stuck idea create : http://woodfield-sillery.com/plans/ basically, i'm looking find way recreate same thing, technically require : managing image map behaviour (to able react mouseover) managing onclick open view of selected floor once selected, second map show of floor, available condos then onclick again, show pricing, availability, etc. i'm having trouble managing rollover image map through css. besides that, of course, client want manage himself (so can update condo statuses), , planning host website through wordpress questions : has worked on solution , willing share experience? has come across wordpress solution works this? has have technical solution (javascript, html5, css combined?) i'm author of mapsvg wordpress / jquery plugin able need: http://mapsvg.com to started need create blank image in vector editor (inkscape, adobe illustator, etc.). embed building image (png/...

hadoop - how to handle data skew in reducer? -

i have simple mapreduce job , in of keys , number of values millions in number . result of reducer not able finish . have gone through link hadoop handling data skew in reducer not able follow if there best practice available such kind of scenarios. can please suggest best way handle such cases in mapreduce job ?

Android - Java - MediaStore - How to use selection for multiple conditions -

i wan't document (docs) files android device. use contentresolver mediastore.files achive that. can files 1 type , example: pdf , wonder how files number of types. my code: string selection = mediastore.files.filecolumns.mime_type + "=?" + ""; string[] selectionargs = new string[] { mimetypemap.getsingleton().getmimetypefromextension("pdf")}; arraylist<myfile> list = new arraylist<myfile>(); uri contenturi = mediastore.files.getcontenturi("external"); string[] columns = { mediastore.files.filecolumns.mime_type , mediastore.files.filecolumns.media_type , mediastore.files.filecolumns.data , }; string sortorder = null; cursor cursor = contentr.query(contenturi , columns , selection , selectionargs , sortorder); how can use selection & selectioargs multiple conditions in sql: or , , ... ...

vba - Does the SSRS Switch function Evaluate the results of all conditions, as the IIF function does? -

many aware iif function not "short circuit". does iif function compute both paths in ssrs or short-circuited? so, switch function not short circuit? in other words suppose have switch : switch(true, 5, false, 5/0) contrived example of course. will cause error because evaluate 5/0? switch doesn't short circuit. shows same behavior iif evaluates conditions. but expression switch(true, 5, false, 5/0) won't show #error . it evaluate fine. show 5. 5/0 evaluate in ssrs infinity not #error . a better test be =switch(true,5,false,5/"") when using above expression, ssrs evaluate #error instead of 5.

css - Using translateX on overflowing div is causing white space flickering in FireFox -

i'm making site background gradient animates. it, i'm making large gradient (~10,000px wide) pattern repeats twice , using transforms inside keyframe animation translate 50% before repeating. works great in chrome super buggy in firefox. firefox can handle translation (i checked adjusting manually) chokes when put inside of animation. here visual of how looks in chrome vs firefox chrome http://i.imgur.com/ii6he84.gifv firefox http://i.imgur.com/nf8t478.gifv relevant html & scss (i have autoprefixer running...) @keyframes shift-bg { 0% { transform: translatex(0%); } 100% { transform: translatex(-50%); } } main { overflow-x: hidden; } .section { min-height: 100vh; } .home-background { position: absolute; top: 0; bottom: 0; left: 0; width: 10000px; background: -webkit-gradient(linear,left top,right top,color-stop(0,#a4c4d1),color-stop(16%,#fec746),color-stop(33%,#a3d282),color-stop(50%,#a4c4d1),color-stop(66%,#fe...

javascript - Allow unnamed function with JSCS -

i have couchdb map.js file expects code defined within unnamed function: function(doc){ // } because jscs expects function named, says: parseerror: unexpected token ( how can ignore error without changing code? i don't want add inline rules // jscs:disable

Simple html form using php and mysql. How do l maintain NULL values for empty fields in the database -

i have built simple html form has input boxs , text areas, inserted mysql database of php script. not fields have filling in , l want able search database null fields. problem when form submits, entries have no information having inserted empty space means l can't search db null fields returns everything. this php script sends mysql insert query db <?php /*av tech name*/ $technam = $_post['technam']; /* building */ $building = $_post['building']; /* room */ $roomnum = $_post['roomnum']; /* day */ $day = $_post['day']; /*month*/ $month = $_post['month']; /*projector power */ $projpower = $_post['projpower']; /* screen decends , retracts */ $screenupdown = $_post['screenupdown']; /* power buton control */ $controlpower = $_post['controlpower']; /* lamp working */ $projlamp = $_post['projlamp']; /* rips , tears screen */ $rips = $_post['rips']; /* control functions */ $controlfunctions = $_post...

java - Swing text field visibility issue -

i trying make frame , add text field inside it. used jtextfield . it's not appearing. code import java.awt.*; import javax.swing.*; class tst { jframe f; jtextfield tf; public tst() { f=new jframe(); tf=new jtextfield(10); f.setsize(400,400); f.add(tf); f.setlayout(null); f.setvisible(true); } public static void main(string s[]) { new tst(); } } if don't want use layout manager, need set bounds using jtextfield 's setbounds(x, y, width, height) method, x , y position of textfield in jframe : tf.setbounds(100 , 100 , 100 , 20 ); first set layout frame, add elements , components it, in full code: import javax.swing.*; class tst { public tst() { jtextfield tf = new jtextfield(10); tf.setbounds(100 , 100 , 100 , 20 ); jframe f = new jframe(); f.setsize(400, 400); f.setlayout(null); f.setvisible(true); ...

Batch IF ELSE statement both execute -

the batch file execute both commands in if , else. checked syntax , space, no idea wrong. if exist c:\program files (x86)\google\chrome ( start chrome www.google.com ) else ( start iexplore www.google.com ) both chrome , ie opened if statement not working. the space in path passed exist test confusing parser. in general should place quotes around such names. if exist "c:\program files (x86)\google\chrome" ( start chrome www.google.com ) else ( start iexplore www.google.com )

mariadb - Auto generating a String non-primary key value using jpa -

kindly me find out solution problem. have property of type string in entity not primary key. act system generated unique profile id users in project. want auto generate value random string of particular size. could please me arrive @ solution. have tried @generator , custom id generator class. still null getting inserted field in db. i using maria db. hi can use hibernate events. @postpersist executed after entity manager persist operation executed or cascaded. call invoked after database insert executed. starting java 5, uuid class provides simple means generating unique ids. identifiers generated uuid universally unique identifiers. please follow sample example. public class testmodel { @column("column_name") private string uid; //setter , getter uid @prepersist protected void oncreate() { // set uid setuid(java.util.uuid.randomuuid()); } } please find below link more information on @prepersist. https://docs.jboss.org...

c# - Figure up how to implement dynamic JSON manipulation -

my issue this: i trying send json represent order api. this structure of problem facing and examples of orders: multiply shipment , items, orders one shipment , multiply items, orders one shipment , 1 item, order -> hoping covered cases this json built xml, built dynamically each time customer wants order something. he can order, multiply shipment, , multiply items - function needs take care of it. i having trouble struct function handle case , write correct id's. for wrote(i writing values xml , serialize json of newtonsoft - working fine) public void sendorder(string renderedoutput, string orderid) { var xml = xelement.parse(renderedoutput); var elmorderdata = xml.element("orderdata").descendants(); var shipmentsids = getshipmentsids(orderid); int shipmentid = 0; int shipmentid_index = 0; foreach (var el in elmorderdata) {// correct order according xml template if (el.name == "shipmentinde...

javascript - meteor android cordova: Empty tiles with openlayers basemap -

i have meteor app openlayers osm map works fine in browsers. however, have following problem when build android cordova app it: the map tiles empty (white background). vector features show in app. has ever built meteor app android includes openlayers?

java how to connect to a MySQL database in OpenShift -

package library; import java.sql.connection; import java.sql.drivermanager; import java.sql.sqlexception; import java.util.logging.level; import java.util.logging.logger; public class conexion { private string server = "jdbc:mysql://" + system.getenv("openshift_mysql_db_host") + ":" + system.getenv("openshift_mysql_db_port") + "/" + system.getenv("openshift_app_name") + ""; private string user = system.getenv("openshift_mysql_db_username"); private string pass = system.getenv("openshift_mysql_db_password"); private connection conn; public connection conectar() throws classnotfoundexception, sqlexception { try { class.forname("com.mysql.jdbc.driver"); this.conn = drivermanager.getconnection(server, user, pass); } catch (exception ex) { logger.getlogger(conexion.class.getname()).log(level.severe, null, ex + ex....

java - How to decouple code using shared information -

hopefully, i'm not asking duplicate. tried searching , didn't find anything, have been keyword choice (i can't think of keywords use). frequently, while coding, encounter situations following: public void dostuff() { string sharedvalue = getvalue(); // code block 1 uses sharedvalue // code block 2 uses sharedvalue } private string getvalue() { // code sharedvalue } for example, hash table class, , getvalue() corresponds hashing function. ideally, code block 1 , code block 2 modularized 2 separate methods so: public void usevalue1() { string sharedvalue = getvalue(); // code block uses sharedvalue } public void usevalue2() { string sharedvalue = getvalue(); // code block uses sharedvalue } now, problem if call usevalue1() , usevalue2() , getvalue() runs twice. using java's hashmap example : public class clazz { map<string, list<string>> map = new hashmap<string, list<string>>(); ...

writing to file with new arrays java -

i need multiplying 2d arrays , input file (input.txt) , need writing multiplied outputs , output file(output.txt) why isn't method shownewarray working? input.txt: 9 3 8 5 2 3 3 8 2 1 1 2 3 3 5 9 2 2 3 3 4 6 8 9 7 6 (edit: sorry wrote question fast!) import java.io.bufferedreader; import java.io.filenotfoundexception; import java.io.filereader; import java.io.filewriter; import java.io.ioexception; public class hw1 { public int[][] shownewarray(int[][] matrix1, int[][] matrix2){// mulitplies 2 matrixes int[][] matrix3 = new int[matrix1.length][matrix2.length];// takes lengths matrix1&&matrix2 for(int =0;i <matrix1.length;i++){ for(int j =0; j<matrix2[0].length;j++){//column length of matrix2 for(int k =0; k< matrix1[0].length;k++){//column length of matrix1 matrix3[i][j] += matrix1[i][k] * matrix2[k][j];// multiplies em } } } shownewarray(...

java - Get method from a class on an Arraylist -

i made class returns 3 values of arraylist main program when use get() method compiler throws me en error cant find method - symbol. tried same thing doing not arraylist array , seems work. cant figure way array list. //error on "action evt" show button on second mark of code. error msg is: "cannot find symbol-method getmarka()". i posting code below maybe can me. the class method returns values: public class cars { private string modelo,marka; private int kyvismos; public cars(string m,string ma,int k) { modelo=m; marka=ma; kyvismos=k; } public string getmodelo() { return modelo; } public string getmarka() { return marka; } public int getkyvismos() { return kyvismos; } public void setmodelo(string m) { modelo=m; } public void setmarka(string ma) { marka=ma; } public void setkyvismos(int k) { ...

java - how to write BeforeAdvice for Thread Class in a struts application using Spring AOP? -

i having struts application using spring aop , ioc via applicationcontext.xml loading through classpathxmlapplicationcontext(). now having mailer.java extends thread below public class mailer extends thread { public static void sendmessage(string to, string cc, string from, string subject, string message) throws messagingexception { //sending e-mails, returning nothing } } in above class sendmessage() static method , called in sucha way mailer.sendmessage() in service classes of application. now want create methodbeforeadvice sendmessage() method. how can that? spring aop proxy based - therefore need use aspectj compiler/weaver

swing - java: how to delay code in GUI -

Image
i making programme in java school project. has form of interactive multiple-choice test. i wanted perform in way action button creates event in (the order of code same listed): 1) randomly chooses object consist of several strings prepared list , prints on adequate text fields in gui 2) using proper method there delay created holds further code down below 1 minute. in time user should able check proper checkboxes gui must stay active. 3)when minute ends checked places read , further processed. the thing unable create step number 2) delaying of code below. have tried function sleep() when sleep() whole gui freezes , user unable on it. have read function swing timer appropriate dont know how it. have seen examples in them timer along functions executed after time written in class actionlistener instead of action button. using netbeans 8.1 sorry bad explanation of problem, total beginner in java programming , count on :) cheers! your problem comes how structure...

python - My quicksort code is not working. What's wrong with it? -

def quicksort(a): if len(a) > 1: pivot = a[0] = 1 j = len(a)-1 while j >= i: if a[i] < a[0]: += 1 elif a[j] > a[0]: j = j-1 elif a[i] > a[0] , a[j] < a[0]: a[i],a[j] = a[j],a[i] += 1 j = j-1 a[0],a[j] = a[j],a[0] quicksort(a[:j]) quicksort(a[j+1:]) = [9,4,1,3,2,5,8,6,7] quicksort(a) print in result,all getting list returned first , last values swapped.

string - How to implement trim() method in java by using only substring() method -

i know question quite silly, in interview told implement trim() method without using method string class except substring() method. i approached problem using tochararray() , identifying first , last valid character of string. told not use tochararray() method. could suggest approach it. overriden methods of objects class allowed equals() , hashcode(). string untrimmed = " string "; string trimmed = ""; string innerspaces = ""; boolean wordboundary = true; try { (int = 0; ; i++) { string substr = untrimmed.substring(i, + 1); if (!substr.equals(" ") && !substr.equals("\t") && !substr.equals("\n") && !substr.equals("\r")) { trimmed += innerspaces + substr; wordboundary = false; innerspaces = ""; } else if (!wordboundary) { innerspaces += substr; } ...

java - Checkbox not true when checked for every panel in my recyclerview? -

so created recyclerview , inflating xml file recyclerview, inside customxml file have checkbox, however, when click on checkbox gives me true statement first panel in recyclerview , rest false whats that? public void checkbox(view view) { final checkbox checkbox = (checkbox) findviewbyid(r.id.checkbox); if (checkbox.ischecked()) { system.out.println("set checked"); } else{ system.out.println("set unchecked"); } } note in recyclerview , multiple child views have same id . suspect final checkbox checkbox = (checkbox) findviewbyid(r.id.checkbox); not return checkbox want. sounds returns first 1 in list, not 1 clicked on. since checkbox() onclick listener checkboxes, there no reason call findviewbyid() . can use view sent parameter: checkbox checkbox = (checkbox)view;

javascript - Invoking a function expression with hanging Parens Vs Function.prototype.call -

what difference between using standard hanging parens method invoking function expression , using .call in javascript? i see iifes invoked like (function(){ //your code here }).call(this); as opposed more standard (function(){ //your code here })(); what advantage of using .call if any? it depends on scope. if in global scope, using .call(this) has absolutely 0 effect because this window object. if in nested scope somewhere, , want use thisbinding ( this ) using .call(this) important (or storing this in variable such self or that ). iife going executing @ global scope, this binding going change window . if attempt use this made in scope, , this isn't bound, referencing wrong object. here example: window.x = 5; (function(){ console.log(this.x);//5 })() var obj = { x : 6, test : function(){ (function(){ console.log(this.x);//5 })() }, close : function(){ (function()...

c# cannot run process(cmd) with custom argument with asp.net -

i have small asp.net web-form application.i trying run cmd.exe given command.i publishing project server cannot debug on server. first , tried dir command working should be system.diagnostics.process si = new system.diagnostics.process(); si.startinfo.workingdirectory = "c:\\"; si.startinfo.useshellexecute = false; si.startinfo.filename = "cmd.exe"; si.startinfo.username = "administrator"; si.startinfo.password = new securestring(); si.startinfo.arguments = @"/c dir"; si.startinfo.createnowindow = true; si.startinfo.redirectstandardinput = true; si.startinfo.redirectstandardoutput = true; si.startinfo.redirectstandarderror = true; foreach (char c in "pass*") si.startinfo.password.appendchar(c); si.start(); string error = si.standarderror.readtoend(); string output = si.standardoutput.readtoend(); ...

Create matching template to detect image in Matlab -

Image
i trying detect numbers in sudoku grid using template image.i doing in matlab. example have cropped '1' image , need use image detect other '1' present in image. not going anywhere this. please me. ho you have choosen hardest number start with, because if use typical template matching approach (using xcorr2 , normxcorr2 , or conv2 ) you're going accidentally match horizontal , vertical lines upright part of 4's. to better demonstrate basic process, start number 7 since little bit more unique of shape. first want load images in grayscale (extract red channel) board = imread('board.jpg') board = board(:,:,1); template = imread('seven.jpg') template = template(:,:,1) in order detect template in image, can use normalized 2d cross-correlation . method shifts template on image , @ each shift computes correlation between template , image. c = normxcorr2(template, board); figure; imshow(c); as can see, correlation value...

php - How to control template in gridview yii2 advanced template? -

i want give if condition control action buttons(view, edit , delete) in template attribute , add new buttons. have code, wrong: [ 'class' => 'yii\grid\actioncolumn', 'template'=>function ($session){ if($session->get('usertype') != 'admin'){ '{view}{update}{delete}'; }else{ 'template' => '{view}{update}{delete}{activate}{deactivate}', 'buttons' => [ 'deactivate' => function ($url,\backend\models\document $model) { if($model->status==1) return html::a('<span class="glyphicon glyphicon glyphicon-remove"></span>', $url, [ 'title' => yii::t('app', 'deactivate'), ]); }, 'activate' => function ($url, $model) { ...