Posts

Showing posts from June, 2014

Camera crashes after taking picture and hitting ok in Android Marshmallow.? -

i new android. creating imageupload activity in android app working fine under apk(23). whenever try on android marshmallow crashes after clicking picture. here manifest file <uses-permission android:name="android.permission.internet" /> <uses-permission android:name="android.android.permission.camera" /> <uses-feature android:name="android.hardware.camera" /> <uses-feature android:name="android.hardware.camera.autofocus" /> <uses-permission android:name="android.permission.write_external_storage" /> <uses-permission android:name="android.permission.read_external_storage"/> <uses-permission android:name="android.permission.wake_lock" /> <uses-permission android:name="android.permission.change_wifi_multicast_state" /> <application android:name=".parseapplication" android:allowbackup="true" android:icon="@mipmap/ic

html - Can I add a dropdown menu in DOCUMENTS category without using div? -

how add dropdown menu in documents category without using div? possible. <!doctype html> <html> <head> <title>kenneth abuel | home</title> <link rel="stylesheet" href="style.css"> </head> <ul> <li><a href="homepage.html">home</a></li> <li><a href="about.html">about me</a></li> <li><a href="gallery.html">gallery</a></li> <li><a href="documents.html">documents</a> <li><a href="contact.html">contact me!</a> </ul> </div> </td></tr> something this: <ul> <li><a href="homepage.html">home</a></li> <li><a href="about.html">about me</a> <ul> <li><a>dropdown1</a></li> <li><a>dropdown2</a></li&

c++ - Accessing particular section in ELF -

we have program in section added named .proghead. i can read elf .proghead section data using following command, $ readelf -x .proghead elf-binary-file hex dump of section '.proghead': 0x0058b960 00112233 00000000 00010000 00000000 .."3............ 0x0058b970 15200704 00000000 00016904 00000000 . ........i..... now have access section using c/c++ program. can please me in writing c/c++ code read particular section in elf binary ? any highly appreciated . what need read section headers ( elf64_shdr ) find section names , offset. relevant information lies in sh_name , sh_offset fields. need compare sh_name required section. on finding required section, can offset( sh_offset ) , size sh_size . easy data through loop reads sh_offset sh_offset+sh_offset+sh_size . theoretically correct , hope data of required section further check following links get elf sections offsets how pointer specific section of program within itself? (maybe libelf)

elasticsearch - Log shipping from tomcat cluster -

i'm investigating issue logging system , looking input on possible solutions problem. have now: cluster of 6 tomcats, logging (log4j2) configured use socketappender the listener these logstash agent puts logged events on redis another logstash agent picks entries redis , pushes them elasticsearch the problem have @ times client sockets (log4j loggers) wait indefinitely causing application become unresponsive. 1 of suggested solutions away socket appenders , use local file (we don't need "instant" log info in kibana). logstash agent configured read 6 files (one per instance) , push these straight elastic search. can suggest disadvantages of approach other having 6 files defined in input configuration of logstash? other options can suggest? in advance. i not use socketappender if have choice so. 1 issue being 1 mentioned , 1 if on logstash 1.5x or before, find more troublesome, exact timestamp of event (as created log4j2) not conveyed, means timesta

converter - What is the Difference between JDK and JRE in beginners java? -

basically need tittle says dont understand topic , have test in week hey coded you... import java.util.scanner; public class piglatin { public static void main(string[] args) { scanner sc = new scanner(system.in); system.out.println("enter word."); string word = ""; word = sc.nextline(); { if(word.length() > 0) { if(containsvowels(word.substring(0,1))) { system.out.println(word+"way"); } else { if(containsvowels(word)) { system.out.println(word.substring(1,word.length())+word.substring(0,1)+"ay"); } else system.out.println("invalid"); } } system.out.println("enter word.

python: fast and easy way to compare these lists? -

i wrote function this, think wildly inefficient , over-complicated wanted ask if there easy way it. given 2 lists of lists... foo = [['one', 1], ['two', 1], ['three', 1]] bar = [['three', 1], ['four', 1], ['five', 1]] i need function return... final = [['one', 1], ['two', 1], ['three', 2], ['four', 1], ['five', 1]] so checks if there overlaps of first term, adds second terms , returns final list above edit: foo/bar[1:] guaranteed ordered, this... foo = [['the', 100], ['at', 99], ['for', 32]] bar = [['mitochondria', 20], ['at', 10], ['you', 9]] in other words, relatively random words paired descending numbers. >>> foo = [['one', 1], ['two', 1], ['three', 1]] >>> bar = [['three', 1], ['four', 1], ['five', 1]] >>> collections import counter >>&g

Simple math operation C# -

i have button , textbox , 1 label . want create when user click on button number in label must + number textbox. , can unlimited time. example first insert 100 label1.text = 100 , second insert 300 label.text = 400 , third enter 700 label.text = 1100 ... how without define new variable every click? you need not have new variable instead of append existing textbox value label label1.text = convert.tostring(int.parse(label1.text) + int.parse(textbox1.text)); happy coding

sip - How can free switch initiate a conference by a scheduled time -

i've tried set conference call using asterisk & free switch sip soft phone xlite. i'm able conference using both asterisk & free switch xlite. i'm trying reverse way instead of endpoints start conference,let free switch self start conference @ scheduled time. per research i've done i've wrote dialplan file make work out. these application & api useful idea, minute-of-day --> scheduling task @ perticular time conference_set_auto_outcall --> calling endpoints join conference i've added below default.xml of dialplan <extension name = "scheduling" > <! -- condition every day @ 10 start conference--> <condition minute-of-day= "600"> <!-- conference action --> <!--condition field="destination_number" expression="^(3000)$"--> <action application="answer"/> <action application="set" data=

javascript - How to change color when user scrolls -

i have piece of jquery code changes elements of couple of colors when users scrolls down. when user scrolls page, want switch original color. doesn't work way expect... original code works jquery(window).scroll(function() { var scrolltop = jquery(this).scrolltop(), offset = jquery('#masthead').height() - 55; if ( scrolltop < offset ) jquery(".float-manu").css({ backgroundcolor: "rgba(0,0,0,0)" }); else jquery(".float-manu").css({ backgroundcolor: "rgba(0,0,0,0.7)" }); }) modified code works })(window.jquery); jquery(window).scroll(function() { var scrolltop = jquery(this).scrolltop(), offset = jquery('#masthead').height() - 55; if ( scrolltop < offset ) jquery(".float-manu").css({ backgroundcolor: "rgba(0,0,0,0)" }); else jquery(".float-manu").css({ backgroundcolor: "rgba(0,0,0,0.7)" }); jquer

java - Sending url as query parameter in rest webservice -

i have written rest service encrypt , decrypt url. encryption code: @get @produces("application/json") @path("/encrypt/") public response encryptwithquery(@queryparam("plainstring") string plainstring) throws jsonexception { response response = new response(); aesutil util = new aesutil(key_size, iteration_count); response = util.encrypt(salt, iv, passphrase, plainstring); return response; } decryption code: @get @produces("application/json") @path("/decryptwp/") public response decryptwithquery(@queryparam("encryptstring") string encryptstring) throws jsonexception { response response = new response(); aesutil util = new aesutil(key_size, iteration_count); response = util.decrypt(salt, iv, passphrase, encryptstring); return response; } when call encrypt rest service encrypted string url encryption http://localhost:9080/kttafm/keybank/encrypt?plainstring=http://

php - foreach as from multiple arrays in single query -

i have: foreach($opts['img'] $img) { } i want add: foreach($opts['lnk'] $lnk) which read, put them follows: foreach($opts['img'] $img) { foreach($opts['lnk'] $lnk) { } } however duplicates of results end 9 images instead of 3. is there way of getting info both array's in same query? want end $img showing image address , $lnk showing link address. for identical keys, use key in foreach : foreach($opts['img'] $key => $img) { $lnk = $opts['lnk'][$key]; echo "$img , $lnk"; }

css - how to use linearGradient animate in CSS3 keyframe? -

is possible apply @keyframes in svg instead of using lineargradient animate ? <svg id="battery" width="110px" height="88px" viewbox="0 0 110 88" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:sketch="http://www.bohemiancoding.com/sketch/ns"> <g id="page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd"> <g id="group" fill="#eaeaea"> <path d="m104,30.2724875 c104.164709,30.2576038 104.331485,30.25 104.5,30.25 c107.537566,30.25 110,32.7220822 110,35.7458573 l110,53.1708094 c110,56.2060875 107.531385,58.6666667 104.5,58.6666667 c104.331455,58.6666667 104.164681,58.6590557 104,58.6441617 l104,82.0033234 c104,85.3151964 101.311488,88 97.9970362,88 l6.0029638,88 c2.68761844,88 0,85.3182852 0,82.0033234 l0,5.99667663 c0,2.684

google nativeclient - Encode video using ffmpeg and vp8 codec on Native Client -

i'm trying develop video encoder using native client. want output file .webm , i'm using ffmpeg example "muxing.c". when run example error message: not find encoder 'vp8' the error comes here: *codec = avcodec_find_encoder(codec_id); if (!(*codec)) { fprintf(stderr, "could not find encoder '%s'\n", avcodec_get_name(codec_id)); } where codec_id value av_codec_id_vp8 when put output file .mp4 works. can me. need enable vp8 encoder ffmpeg naclport? should do? thanks!! update @lee gi gone: yes. must need compile ffmpeg libvpx library encode vp8/vp9. can install via yum, apt. or can compile manually. once libvpx installed, install ffmpeg libvpx in following command : ./configure --enable-libvpx make -j 4 make install i put dependency libvpx on build.sh , pkg_info on ffmpeg naclport , built again. works! yes. must need compile ffmpeg libvpx library encode vp8/vp9. can install vi

java - Mule context having Spring application context as parent -

how can web application load mule context , have spring context parent? i have tried following(web.xml) , did not work: <context-param> <param-name>org.mule.config</param-name> <param-value>mule-config.xml</param-value> </context-param> <listener> <listener-class>org.mule.config.builders.mulexmlbuildercontextlistener</listener-class> </listener> <context-param> <param-name>contextconfiglocation</param-name> <param-value>classpath:applicationcontext.xml</param-value> </context-param> <listener> <listener-class> org.springframework.web.context.contextloaderlistener </listener-class> </listener> if switch order of listeners , following exceptions occur: caused by: org.springframework.beans.factory.nosuchbeandefinitionexception: no qualifying bean of type [org.mule.api.serialization.objectserializer] found depend

ios - Autolayout invalid related to hidden navigationbar in xib -

i working on problem related navigation bar in xib file. problem follows: i add xib file, , manually put uinavigationbar on top of it, , use constraints make stays on top of screen. add uilabel below it, , use constraints make below navigation bar. is, let label.top equals navigationbar.bottom . need add fullscreen function. add button , after pressing it, hide navigation bar code this: self.navbar.hidden = yes; the navbar hidden, label somehow still keeping position, , doesn't move top of screen, expected see. so question is: is effect normal? because navbar hidden, constraints should make label move top. what should achieve effect want if it's normal/abnormal. thank guys! idea can help! and pardon me english, it's not native language. as adding navigation bar, not navigation controller, hiding wont work. have set height constraint on navigation bar, , make outlet in controller, want hide bar have set constraint.constant zero.

centos - setting iptables rules to allow traffic of Ha-proxy -

hey new ha-proxy , iptables rules, case have setup 3 virtualbox centos instance practise 1 designated loadserver , rest of 2 webclient. network settings of webclient in virtualbox set bridge, , install nginx, web application, , allow port 80, port 443 , on. when install ha-proxy , check status of 3 machines using http://loadserver/stats seem of em down. question how allow traffic , forth loadserver 2 webclient? suggestion highly appreciated. thank you. loadserver 192.168.0.125 web1: 192.168.0.121 web2: 192.168.0.122 haproxy.cfg backend lb 192.168.0.125:80 mode http stats enable stats hide-version stats uri /stats stats realm haproxy\ statistics stats auth haproxy:redhat balance roundrobin option httpchk option httpclose option forwardfor cookie lb insert server web1-srv 192.168.0.121:80 cookie web1-srv check # backe

scala - Pattern matching on case classes with * (varargs) parameter -

i have 2 case class like: case class b(value:int) case class a(a:string, b:b*) extends alike and want pattern match on instance of a: def foo(al:alike) = { al match { case a(a, bs) => ... } } scalac doesn't understand bs seq[b] , thinks 1 b . why case , how should pattern match on it? it's varargs argument, need explain compiler explicitly. use following case expression: def foo(al:alike) = { al match { case a(a, bs @ _*) => ... } }

Angular JS : Does $scope exist without controller -

i have couple of questions in angular. since new angular can please explain below questions what scope of variable fname on below code if haven't created controller <html> <!-- included angular js --> <body ng-app=""> <input type="text" ng-model="fname" /> <span ng-bind="fname"></span> </body> </html> as per understanding $scope needed two-way binding. in above scenario $scope exist or not, controller not created. if using $rootscope can able add function alert or console fname value <button ng-click="alertme()">button</button> where use expression inside angular bultin directive. have seen serveral examples in cases {{}} used inside builtin directive. e.g: ng-form="{{}}" there rule expression in directives scopes attached dom $scope data property, , can retrieved debugging purposes the location root scope attached dom de

gradle task which works with files -

i trying write task works files, based on gradle-watch-plugin . (though not now. supposed run when start threadwatch task presume) however don't how pass , passed filenames inside task. apply plugin: 'java' apply plugin: 'application' apply plugin: 'groovy' apply plugin: 'com.bluepapa32.watch' watch { rules { files filetree(dir: '/src/main/resources', include: '*.xls') tasks 'validaterules' } } .... dependencies { compile "org.codehaus.groovy:groovy-all:2.0.5" compile ("org.drools:drools-core:${droolsversion}") compile ("org.drools:drools-compiler:${droolsversion}") compile ("org.drools:drools-decisiontables:${droolsversion}") } import org.drools.builder.* import org.drools.io.resourcefactory task validaterules(type: defaulttask) { ext.rulevalidator = { xls_file_name -> try { def tconfig

javascript - Twitter events bind in iOS 9.1 (callbacks) -

i have webpage i'm tracking twitter events tweet, follow etc. using twitter javascript documented here . since ios 9.1 came out avery action (tweet, follow etc.) redirects user twitter app (if installed). cool feature, problem cannot track events anymore javascript doesn't bind actions made in app. anyone facing same issue? workaround? thanks. a response twitter staff pointed out upcoming change: https://twittercommunity.com/t/forthcoming-change-to-web-intent-events/54718

Change flyway-maven-plugin's default scripts directory -

how can change following flyway-maven-plugin configuration can drop scripts in src/main/database instead of src/main/resources/db/migration ? the migrate mojo source code seems indicate default value db/migration , src/main/resources/ ? <plugin> <groupid>org.flywaydb</groupid> <artifactid>flyway-maven-plugin</artifactid> <version>3.2.1</version> <configuration> <url>jdbc:h2:file:target/tmp</url> <user>sa</user> </configuration> <dependencies> <dependency> <groupid>com.h2database</groupid> <artifactid>h2</artifactid> <version>1.4.190</version> </dependency> </dependencies

x509certificate - ADFS, WS-FED Passive and SAML token verification -

i working on web application should authenticate users via adfs. ws-fed passive chosen simplest , fastest implement. the setup went smooth , application seemed working: user first redirected the identity provider service, enters username/password , in case of success saml token posted web app. here confused: saml token can validated via signature , x509certificate data contained in it. however, proper mechanism verify token posted the identity provider service, not third-party posesses certificate?

Android how to place all my classes in one package using Proguard -

i developing sdk, environment got sdk library , testing project use it. i want protect library code library users , there need obfuscate it, it. so in android studio in library module, in proguard-rules.pro file added next script: -dontpreverify -optimizations !code/simplification/arithmetic -keep class !com.example.**{ *; } -keep public class com.example.sdk.example{*;} -keep public class com.example.sdk.iexamplecallback{*;} -keep public class com.example.sdk.ui.exampleactivity -dontwarn android.util.log -repackageclasses 'com.example.security' -allowaccessmodification the classes obfuscated package not changed. fallowed eric lafortune (the author of proguard) suggestion add allowaccessmodification , didn't helped. try using flattenpackagehierarchy , had no effect. help me, how place classes in 1 package? solved it: after adding lines did job -useuniqueclassmembernames -keeppackagenames donotkeepathing this full script -optimizationpasses 30

Can I multiply an int with a boolean in C++? -

i have widget in gui displays chart(s). if have more 1 chart there legend shown in rectangle on gui. i have qstringlist (legendtext) holds text of legend. if there no legend required, legendtext empty. if there legend, legendtext hold text. for finding height of rectangle around legend following: int height = 10; qstringlist legendtext; ... height = height * (legendtext->size() > 0); ... is idea/ style multiply int boolean ? run problems that? this technically fine, if bit unclear. the bool promoted int , result well-defined. however, looking @ code don't instantly semantics trying achieve. i write like: height = legendtext->isempty() ? 0 : height; this makes intent far clearer.

jsf - Cache ValueExpression instances -

i've written application in jsf generates crud pages based on configuration files. configure pages possible provide parameters. can of type , el expressions. create , evaluate these expressions each getter-invocation, not ideal solution, think: now have 2 simple questions can't answer myself: it should possible cache valueexpression instances per request. on first access (in case use jsf's postaddtoview event) create expression , evaluate in in each getter-invokation. public void populatecomponent(componentsystemevent event) { facescontext context = facescontext.getcurrentcontext(); _valueexpression = context.getapplication().getexpressionfactory() .createvalueexpression(context.getelcontext(), _expression, string.class); } public string getexpressionvalue() { facescontext context = facescontext.getcurrentcontext(); return (string) _valueexpression.getvalue(context.getelcontext()) } this should same using expression directly in xht

html - How can I add pad my text so the transparent box doesn't overlap? -

br { display: block; line-height: 80px; } h1, h2, h3, h4, h5, h6 { margin: .67em 0; text-align: center; color: floralwhite; font-family:'conv_milasiancircamediumpersonal','open sans', 'helvetica neue', arial, sans-serif; } h1 span { font-size: 1em; background-color: rgba(0, 0, 0, 0.2); -webkit-animation: mymove 10s infinite; /* chrome, safari, opera */ animation: mymove 10s infinite; } h3 span { font-size: 1.5em; background-color: rgba(0, 0, 0, 0.4); -webkit-animation: mymove 10s infinite; /* chrome, safari, opera */ animation: mymove 10s infinite; } h4 span { font-size: 1.5em; background-color: rgba(0, 0, 0, 0.4); -webkit-animation: mymove 10s infinite; /* chrome, safari, opera */ animation: mymove 10s infinite; } /* chrome, safari, opera */ @-webkit-keyframes mymove { 50% { color: ghostwhite; } } /* standard syntax */ @keyframes mymove { 50% { color: g

Script injection affects jquery template -

i tried load string using {{ html }} in jquery template. script injection affects {{html }}. how restrict script injection. it not problem jquery-template, because how html parses <script> element within string literals. see why split <script> tag when writing document.write()? if want parse , execute script, easy way move script separate file(and include file in html page) instead of inlining it. or can escape like testtemplate = "<i>{{html txt}}</i>"; $.template('testtemplate', testtemplate); $.tmpl("testtemplate", { txt: "<b>bold</b> , \x3cscript>alert('abc')\x3c/script>" }).appendto("#target"); <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <script src="http://ajax.microsoft.com/ajax/jquery.templates/beta1/jquery.tmpl.js"></script> <ul id="target"><

testing - Integration test for the order for a query in Rails 5 -

rails 5 will deprecat assigns , handy when testing order of ar query. test "admin sorts members date joined" memberships_path(sort: :by_date_joined) memberships = assigns(:memberships) assert_equal [@bart, @lisa, @homer], memberships.to_a end integration tests in rails 5 encourage simulate user experience as possible. means should search rendered html right links. [@bart, @lisa, @homer].each |member| assert_select "#member_#{member.id}" end assert_select useful if want ensure members being rendered correctly, not guarantee order. so can test order? one way accomplish compare indexes of elements in dom: assert response.body.index('member_1') < response.body.index('member_2') depending on case, can use assert_select nth-child expect specific order.

regex - search all values of list contains in a field of type string in mongodb and in mongodb java -

i have data in mongodb collection named speech field id , speech in following format. { "speechtext" : "always boy" }, { "speechtext" : "always guy" }, { "speechtext" : "always cute boy" }, { "speechtext" : "i girl." } i have fetch data on behalf of 2 keyword 'always be' , 'boy' condition and,or,not. if condition 'and' search keyword 'always be' , 'boy' result - { "speechtext" : "always boy" }, { "speechtext" : "always cute boy" } if condition 'or' search keyword 'always be' , 'boy' result - { "speechtext" : "always boy" }, { "speechtext" : "always guy" }, { "speechtext" : "always cute boy" } if condition 'not' search keyword 'always be' , 'boy' result - { "speechtext" : "i girl."

newline - wc -l returning 0 on a non-empty file -

i downloaded json file using curl on server https://api.data.gov/ed/collegescorecard/v1/schools?api_key=[my_api_key] ( i have uploaded file tinyupload if want play around it. ) the downloaded file 1.5mb , has large (and valid) json object. however, on server when run command wc -l against file, returns 0. running wc -c returns correct byte count. i opened file in textedit , looked fine. did notice man wc on server (centos 5.5) , man wc on mac (yosemite) seem have different descriptions -l flag does: centos 5.5: print newline counts osx 10.10.5 yosemite the number of lines in each input file written standard output. which manual correct? wc -l count lines or new lines? if count lines , not new lines, there ever case when wc -l return 0 when there line in file? is possible mark's comment regarding windows based characters on this related post correct diagnoses? ran cat -vet against file, couldn't find ^m using grep, , it's way text manu

Memory Leaking - C -

in same file have 2 routines. first store bytes 1 file. other give information routines process information. boolean adin_memory(char* buffer, int size_chunck, int end_flag){ real_data=(sp16 *)malloc(size_chunck); //real_data -->global memcpy(&(real_data[0]),&(buffer[0]),size_chunck); pos_write += size_chunck; global_size = size_chunck; global_end_flag = end_flag; //end_flag = 1 --> end of stream //end_flag = 0 --> streaming return true; } to prevent possibility of leaking using malloc . routine called several times. so, after repetitions of adin_memory , adin_read (where free ), think memory starts fragment (i can see leak size of input file in task manager - increment of ram). right? how can prevent this? see leak put 1 breakpoint @ beginning , @ end of adin_memory @ task manager. int adin_read(sp16 *buf, int sampnum) { file *fp; int cnt = 0; fp = gfp; //(.......) if(global_end_flag == 1 || pos_write == pos_re

Making API from Python docstrings written in PEP8 -

i've written code in python. tried follow common guidelines writing helpful comments @ beginnings of functions. style pep8, e.g. def __init__(self, f_name=none, list_=none, cut_list=none, n_events=none, description=none): """ parse lhco or root file list of event objects. possible initialize events class without lhco file, , later append events list. arguments: f_name -- name of lhco or root file, including path list_ -- list initalizing events cut_list -- cuts applied events , acceptance n_events -- number of events read lhco file description -- information events """ i want automatically generate helpful api code. i've found few options , looking @ sphinx in particular. seemed wanted (though struggled make generate api, rather manual program). drawback, however, has it's own expected style docstrings: """ :param x: parameter :typ

zlib - Cut string and gunzip using PHP -

i have router config export file, contains header of 20 bytes, followed zlib compressed data. once uncompressed should contain plain xml content. my code strips first 20 bytes, , decompresses file. exported data still binary. used file_get_contents , file_put_contents first, assumed (wrongly) wasn't binary-safe. i've tried change 20 in 1-1000 without avail. <? $fp_orig = fopen('config.cfg', "rb"); $data_orig = fread($fp_orig, filesize('config.cfg')); fclose($fp_orig); $bytes = 20; // tried 1-1000 $data_gz = substr($data_orig,$bytes); $fp_gz = fopen('config.cfg.gz', 'w'); fwrite($fp_gz, $data_gz); fclose($fp_gz); $fp_gz = gzopen('config.cfg.gz', 'rb'); $fp_xml = fopen('config.cfg.xml', 'wb'); while(!gzeof($fp_gz)) { fwrite($fp_xml, gzread($fp_gz, 4096)); } fclose($fp_xml); gzclose($fp_gz); echo file_get_contents('config.cfg.xm

c# - What are the differences between these project types, and how can I fix the difference? -

Image
we in process of migrating vs2012 vs2015, , i'm running issue hosting 1 of web projects of different "web project" icon. example project types: 1 hosted web site 2, 4, , 5 c# class libraries 3 test project 6 website... different #1. have not hosted project @ virtual directory in vs2015, in vs2012. how #1 different #6? see #1 has csproj file, #6 not. "property" windows different project types. 1 vs2012 1 vs2015 6 vs2012 6 2015 as can see property pages of 2 vses , 2 different project types differ pretty significantly. my #6 project in vs2012 hosted @ http://localhost:9999/virtualdirectory/ services can accessed (example): http://localhost:9999/virtualdirectory/service1.svc however in vs2015, can't hosted under http://localhost:9999/virtualdirectory/service1.svc rather http://localhost:9999/service1.svc i've tried changing radio button "use default server" "use custom server&quo

java - Play route/Controller just for unit test -

i have method takes play http.context , "does stuff" session. want write unit test method. specifically, want test if request comes in headers method works correctly. seems easiest way reliably create fakeapplication , controller test. i'd use helpers.fakerequest request , helpers.route route request controller. controller call method, set variables, etc. , assert success , such. seems splendid plan can't figure out how add route controller in fakeapplication . note controller isn't part of app - it's want use 1 test. want define , construct in 1 unit test; don't want add conf/routes file. specifically, want this: // maybe can use globalsettings.onrouterequest return type // play.api.mvc.handler seems inaccessible java fakeapplication app = helpers.fakeapplication(new myglobalsettings()); http.request request = helpers.fakerequest().withcookies(...).withbody(...); controller testcontoller = new mytestcontroller(); // doesn't exist, want

class - Reassigning $this in PHP/Laravel -

i have class extends class b class extends b{ function home(){ $site = new sitescontroller($this); return $site->home(); } } i want every variables in class availabe in sitescontroller class. dont want extend sitescontroller since everytime called re-initialized , there lot of repeated query calls. tried pass $this when class created. cant reinitialize $this in sitescontroller this. class sitescontroller implements siteinterface { function __construct($data) { $this = $data; } } is there anyway can make work?? thanks. you can't "reassign" $this. but can assign instance of property of sitescontroller, means can access public methods/properties of within sitescontroller instance. class sitescontroller implements siteinterface { protected $a; public function __construct(a $data) { $this->a = $data; } public function dosomething() { return $this->a->publicmethodofa()

html - How to position a link over another div that has position:absolute -

i have following html , css position of #header id has mandatory set absolute : <div class="main"> <a href="www.website.com"> <div id="header" class="other"> </div> #header{ padding-left: 250px; position:absolute; } this code sets header div on link tag , becomes (the link) unavailable selecting. my question css have apply .main > a not below header div? i tried below not work other ideas welcomed: .main > { z-index:99999; } z-index work on positioned elements z-index wont applied if no positioning has been specified element. so, suggest change css below. ie, new css .main > a like .main > { position:relative; z-index:99999; } update z-index not work statically positioned elements..see answer here

swift - Indexing into JSON object -

i have json object in shape of: let allsnippets = [<metdocument key: <collection: snippets, id: xnmjqh5n3hbomnatk>, fields: { text = "first snippet"; }>, <metdocument key: <collection: snippets, id: kvqwnwfyto5ixxsni>, fields: { text = "second snippet"; }>] how can index , example text "second snippet" fields ? i tried this: let json = json(allsnippets) if let text = json[1]["text"].string{ print(text) } but did not work.

angularjs - Avoid a property from body of Angular Resource POST request -

i creating angular resource follows. var book = $resource(baseurl + 'v1/users/:username/books/:id', { username: '@username' id: '@bookid' }); i sending post call using save() follows. book.save({username:'testuser', bookid:1, show: true}) this generates url properly v1/users/testuser/books/1 but sends username , id in body along show:true want avoid. how avoid username , id in body? here how, acheived it. used transformrequest property of actions , deleted unnecessary properties. var book = $resource(baseurl + 'v1/users/:username/books/:id', { username: '@username' id: '@bookid' }, { customsave: { method: 'post', transformrequest: function(body) { delete body.username; delete body.id; return angular.tojson(body); } } });

Logstash parsing progress bar -

i'm newbie logstash , i'm using parsing 500mb of logfiles in particular directory, when i'm start logstash doen't show progress bar how % has completed parsing log file. there way see progress of log parsing done? no, logstash has no built-in progress bar feature. of time wouldn't make sense since logstash meant process ever growing logs continuously, , there isn't "done". what correlate contents of sincedb file file size of corresponding file. sincedb file logstash stores current offset in file. exact description of file format found in file input's documentation , have care first , last columns. first column inode number, can found in ls -li output file, , last column current offset. example: 393309 0 64773 437 here, logstash @ offset 437 file inode 393309. the join command can used join file ls -li output (where file's inode number in first column): $ join /var/lib/logstash/.sincedb_f5fdf6ea0ea92860c6a6b2b354bfcbbc &

java - How do you overload dependent on what an object is an instance of? -

i've been instructed create 2 methods overload eachother. 1 should store object in 1 array, , other should store object in other array. assignment reads: redo zoo has ability storing wild animals , domestic animals separately. zoo class therefore probably/presumably have 2 different add() methods. 1 receives animal-object implements interface wildlife , add() method receives animal objects implement interface domestic animals. how do this? class zoo { ... void add(animal foobar instanceof wild){ [...] } [...] will not compile. nor does class zoo { ... void add(animal foobar implements wild){ [...] } [...] one could, in reality, use instanceof if statement in add(), asking 2 add() methods overload eachother. how do this? or, impossible, , teach trying mess me saying probably/presumably? the key provide 2 add() methods, 1 takes 1 type of parameter (a wildlife animal type) , 1 takes other type of parameter (a domestic animal type). you should have enoug

oop - return the extending class instance from an abstract method in PHP -

i have class extends abstract class. php allows access instance of extending class within abstract methods? something like: abstract class foo{ protected function bar(){ return $this; } } class bar extends foo{ public function foo(){ // should hold bar instance , not foo's $barclassinstance = $this->bar(); } } where $barclassinstance hold bar class instance, instead of abstract foo instance? trying out worth thousand stackoverflow questions <?php abstract class foo{ protected function bar(){ echo 'foo', php_eol; var_dump($this); return $this; } } class bar extends foo{ public function foo(){ echo 'bar', php_eol; var_dump($this); // should hold bar instance , not foo's $barclassinstance = $this->bar(); var_dump($barclassinstance); } } $bar = new bar(); $bar->foo(); output https://3v4l.org/b73bt bar ob

node.js - How to detect if a Node spawned process is still running? -

i can spawn process like: var spawn = require('child_process').spawn; var topiclistener = spawn('python', ['topic_listener.py','node.js'], {env: { twitter_consumer_secret: process.env.twitter_consumer_secret, twitter_consumer_key: process.env.twitter_consumer_key, twitter_token_secret: process.env.twitter_token_secret, twitter_access_token: process.env.twitter_access_token }}); topiclistener.stdout.on('data', function (data) { console.log(data.tostring()); }); topiclistener.stderr.on('data', function (data) { console.log(data.tostring()); }); topiclistener.on('close', function (code) { console.log("exited " + code); }); so of course can control asycnchronously .on(close, ...) there other way control if process still alive? spawn('python', ['topic_listener.py','node.js'].. return child process object. use topiclistener.pid find unique id associate

Break for C compilation -

i new c. encountered error message involves unexpected "}". however, checked number of "}" editor , indeed pair up. then wonder if there compiler command, compilation can stop whatever want? convenient have such tool debug help. thank you. (edited in 29-10-2015) typically write code gedit. nonetheless, since work done on cluster, troublesome transport files , down. must turn nano, vi or vim causes difficulty in debugging. stopping compilation partway through useful feature. you'll want see of errors may exist in code can fix more 1 @ time. that said, error such misplaced brace or parenthesis can cascade down , cause several more errors appear. if see long list of errors don't seem make sense when @ code, start @ top , fix that, recompile see if took care of others.

vb.net - How do I get multiple values from query using OleDBConnection? -

i have edited previous code , tried below, have changed textbox listbox same name, no value in listbox after running below code: myconnection.connectionstring = provideredit dim str string str = "select [email] [prd_records] [receivekmcwemsalerts] = yes" using cmd oledbcommand = new oledbcommand(str, myconnection) myconnection.open() dim reader oledbdatareader = cmd.executereader(commandbehavior.closeconnection) while reader.read() txtcreateannto.text = reader(0).tostring end while reader.close() end using thanks responses.... found problem code, simple , overlooking it. update coded below: myconnection.connectionstring = provideredit dim str string str = "select [email] [prd_records] [receivekmcwemsalerts] = yes" using cmd oledbcommand = new oledbcommand(str, myconnection) myconnection.open() dim reader oledbdatareader = cmd.executereader(commandbehavior.closeconnection) wh

javascript - Why overridden `controller.$render` is not getting called? -

have @ code @ plnkr.co . in link function of directive , controller.$render() called worked fine. problem when override controller.$render function not run. console.log('overridden $render function called'); not appear in console. script.js is: var app = angular.module('myapp', []); app.directive('test', function () { return { require: '?ngmodel', link: function ($scope, $element, $attr, controller) { if (!controller) { console.log("controller of ngmodel not found"); return; } else { console.log("controller of ngmodel found"); controller.$setviewvalue('qwerty'); //controller.$render(); controller.$render = function(){ console.log('overridden $render function called'); } } } }; }); index.html is: <!doc

java - Linker error on Clojure REPL but not on compiled jar when using a JNI library -

i have jni library, both .jar , .so files. note library intended java, not clojure. right i've been able run code using library in java, on eclipse. what i'm trying getting library run on clojure means of java interop capabilities. i've been successful in doing creating jar file, it's not working on repl. here's i've done far: first, i've set leiningen project , imported jar jni bindings import , see classes library expected. then, added native library ld_library_path (that's necessary library run in java), , loading seems fine (no errors) on repl. at point, when trying use constructor (or function, matter) library, linker errors: unsatisfiedlinkerror edu.upc.freeling.freelingjni.new_tokenizer(ljava/lang/string;)j edu.upc.freeling.freelingjni.new_tokenizer (freelingjni.java:-2) note that same line runs both on java , in clojure jar generated "lein uberjar". i'm still quite new clojure , don't know possibly wrong, s

android - Error inflating class Recycler View -

i beginner in android , trying learn recycler view using simple example.but getting exception seen in logcat.i have included necessary support libraries , added them build path of project. following files related recycler view: logcat: not find class android.support.v7.widget.recyclerview', referenced method com.example.rtest.mainactivity.oncreate 10-27 23:36:14.480: e/androidruntime(12806): fatal exception: main 10-27 23:36:14.480: e/androidruntime(12806): java.lang.runtimeexception: unable start activity componentinfo {com.example.rtest/com.example.rtest.mainactivity}: android.view.inflateexception: binary xml file line #7: error inflating class android.support.v7.widget.recyclerview activity_main.xml <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:cont

Best way to manage pages by language/location US/PT (Drupal) -

our platform runs in drupal , want show different pages taking in consideration users location (us or pt/brazil). features change. what best way that? this hard explain, have install modules like: content translation , locale after have add languages in configuration, , need set in content type. more detail can view video. https://www.youtube.com/watch?v=sx9lj_horcw or can search multi language in youtube.

grails 3 war in JBoss EAP 6.2.0 does not work -

when try run simple grails 3 (3.0.7) application war (with embedded tomcat removed) in jboss eap 6.2.0.ga (as 7.3.0.final-redhat-14) requests end in http 404. same war works in tomcat. searching web found following related spring boot: springboot application on jboss eap, servlet context not lodaed unfortunately configuring property server.servlet-path in application.yml (in yml format) did not work. looking grails 3 source: https://github.com/grails/grails-core/blob/master/grails-plugin-controllers/src/main/groovy/org/grails/plugins/web/controllers/controllersgrailsplugin.groovy#l79 i found solution. in application.yml add following configuration: grails: web: servlet: path: /* starting web: existing grails: section. requests working again expected.

Xcode iOS - Rotate/scale UIImageView with an "anchor" at top right? -

Image
i building image editing program places "stamps" on images. i've added image views stamps photo , can re-position/scale/rotate these stamps (image views) using pinch gesture recognizers. however when stamp gets small, becomes impossible fit 2 fingers on stamp resize or rotate. i've noticed similar types of apps use sort of "anchor" or icon @ top-right corner of stamp's frame can drag 1 finger achieves same scale/rotate effect (as opposed using pinching gestures). is there specific term "anchor" or term kind of scale/rotate procedure? i'm having trouble searching on particular kind of feature. if might know of prebuilt classes or links pages describing how implement kind of feature, huge help! i attaching animated gif illustrate trying implement. thanks! okay after posted question checked out of related questions , stumbled upon module called zdstickerview. after playing around think work application. https://

rust - Is there a way other than traits to extend structs? -

i'm trying extend grid struct piston-2dgraphics library. there's no method getting location on window of particular cell, implemented trait calculate me. then, wanted method calculate neighbours of particular cell on grid, implemented trait. something ugly , feels unnecessary seeing how i'll never use these traits other specific grid structure. so, there way in rust extend struct without having implement traits each time? as of rust 1.3, no, there no other way. it's not possible define inherent methods on type defined in crate. however, know, can define own trait methods need, implement trait external type. pattern known extension traits . name of extension traits, convention, ends ext , indicate trait not meant used generic bound or trait object. there few examples in standard library. other libraries can export extension traits (example: byteorder ). however, other trait, need bring trait's methods in scope use somethingext; .

c# - Type of conditional expression cannot be determined because there is no implicit conversion between 'lambda expression' and 'lambda expression' -

i've collection of notes. depending on ui requesting notes, i'd exclude categories. example. if project notes popup requests notes, should exclude collection notes. func<note, bool> excludecollectioncategory = (ui == uirequestor.projectnotes) ? x => x.notecategory != "collections" : x => true; //-- error: cannot convert lambda lambda i'm getting following error: type of conditional expression cannot determined because there no implicit conversion between 'lambda expression' , 'lambda expression' thanks helping the compiler doesn't infer delegate types lambda expressions. need specify delegate type using cast in first ternary clause: var excludecollectioncategory = (ui == uirequestor.projectnotes) ? (func<note, bool>)(x => x.notecategory != "collections") : x => true; the silver lining can use var instead of having specify type variable, isn't more v

Add columns in R based on condition 3 -

the issue add new column dataframe when condition fulfilled. when first columns 1 1 "hom" , when 0 1 "het" should outputted. appreciate help. example: 1 1 --> hom 1 1 --> hom 0 1 --> het 1 1 --> hom 0 1 --> het if these 2 conditions check , checking first column of dataframe sufficient df <- data.frame(num1 = c(1,0,1), num2 = c(1,1,1)) ifelse(df$num1 == 1,"hom","het") # [1] "hom" "het" "hom"

javascript - Best way to test global npm modules -

lets develop global npm module called mytool registers env variable through "bin" in package.json name mytool . so after install globally typing npm install mytool -g then can type mytool --someoption in terminal , handle cli input in javascript. lets assume mytool works lot current working directory of cli, just node index.js --someoption is bad idea. however test bugs don't want push new version of "mytool" npm , install globally npm. rather want able test locally. question: best way test global npm modules without publishing npm? npm link contrary seems, npm link can used in case, too. using in package folder " will create symlink in global folder {prefix}/lib/node_modules/&lt;package&gt; links package npm link command executed. " " it link bins in package {prefix}/bin/{name} . "

html - On a flex item with flex-grow: 1, why is padding expanding the width? -

check out snippet below. in first row, there 2 divs flex-grow: 1 . expected, each div takes 50% of screen. when adding padding left div, no longer case. can explain why? body > div { height: 50px; display: flex; } body > div > div { flex: 1; box-sizing: border-box; } #a { background-color: red; } #b { background-color: green; } #c { padding: 10px; background-color: blue; } #d { background-color: yellow; } <div> <div id="a"></div> <div id="b"></div> </div> <div> <div id="c"></div> <div id="d"></div> </div> the calculations defined in spec the size of flex item padding , flex-grow based on calculations outlined in flexbox specification . these calculations similar sizing of flex items padding , flex-shrink . frankly, math quite technical , not easiest thing in world understand.