Posts

Showing posts from February, 2015

database - How to design product category and products models in mongodb? -

i new mongo db database design, designing restaurant products system, , design similar simple ecommerce database design each productcategory has products in relational database system 1 (productcategory) many products. have done research understand in document databses. denationalization acceptable , results in faster database reads. therefore in nosql document based database design models way //product { name:'xxxx', price:xxxxx, productcategory: { productcategoryname:'xxxxx' } } my question this, instead of embedding category inside of each product, why dont embed products inside productcategory, can have products once query category, resulting in model. //productcategory { name:'categoryname', //array or products products:[ { name:'xxxx', price:xxxxx }, { ...

java - How to handle system.exit in the cucumber test case -

newbie cucumber , selenuim in java i calling method in cucumber test case , there if goes else part send mail , exit system.when running method cucumber send mail , exit test case. how resolve that and after using selenium want open browser , check mailbox check mail has sent code or not. you can use runtime.getruntime().addshutdownhook(hook); when invoke method, thread hook called whenever vm wants shutdown (including when system.exit() called). can add validation in hook thread. check java doc more information shutdown hook.

Tesseract "Failed loading language..." on windows cmd -

windows 7, tesseract 3.02 all i'm trying run "tesseract img.jpg img" cmd.exe. i'm running c:\...\tesseract-ocr directory. but error: error opening data file c:\...\tesseract-ocr\tessdata/tessdata/eng.traineddata please make sure tessdata_prefix environment variable set parent directory of "tessdata" directory. failed loading language 'eng' tesseract couldn't load languages! could not initialize tesseract. how can fix this? this problem has been brought many times seems (around web), no answers i've come across have done me good. i've tried doing "set tessdata_prefix=c:\...\tesseract-ocr" nothing changes. does have reversal of backslashes|forward slashes in path? reinstalled.... works fine :b correct output: tesseract open source ocr engine v3.02 leptonica

grails - OutOfMemoryError: Java heap space to upload 8 MB size file -

i using grails 2.4.4 , trying upload .xlsx file using 'apache poi' plugin getting java heap size exception when file size around 8 mb. my controller has following action , methods:- def uploadform() { string filename = "d:\\file.xlsx" map excelsheetmap = process(filename) } map process(string filename) { excelbuilder excelbuilder = new excelbuilder(filename) //getting java heap size exception here when trying create object //of excelbuilder file } excelbuilder.groovy class file looks this class excelbuilder { workbook workbook excelbuilder(string filename) { new file(filename).withinputstream { -> workbook = new xssfworkbook(is) } } } i have tried using grails-excel-import plugin getting same exception. can please suggest how import big size excel files in grails. in advance. poi have high memory footprint. please see: http://poi.apache.org/spreadsheet/index.html...

Inverse of Python's unicodedata.name? -

there built-in method unicodedata.name given unicode character return human readable name, e.g.: unicodedata.name(chr(0x2704)) == "white scissors" is there out there provide inverse? i'm looking like: unicodedata.name("white scissors") == chr(0x2704) or 0x2704 i loop on possible values, build map, seems inefficient , hoping exists. using python 3 open 3-only solutions. you're looking unicodedata.lookup : in [5]: unicodedata.lookup("white scissors") out[5]: '✄' this returns character, use ord integer ordinal: in [7]: ord(unicodedata.lookup("white scissors")) out[7]: 9988 # hex(9988) 0x2704

Writing a complex Java boolean expression -

i trying write code if following conditions met marry me otherwise lost. conditions need met: 22 27 year old male, non-smoking, under 72 inches tall, under 160 pounds, good-looking, able relocate.” this code have far written. however, prints lost though believe matches given criteria? wrong? furthermore, how can put in terms of single boolean? public class marry { public static void main(string[] args) { int weight = 150; int age = 24; int height = 71; boolean isasmoker = false; boolean ismale = true; boolean isgoodlooking = true; boolean isabletorelocate = true; if (((weight < 160 && (age <= 27 && age >= 22)) && ((height < 72) && ((isasmoker = false) && (ismale = true))) && ((isgoodlooking = true) && (isabletorelocate = true)))) { system.out.println("marry me!"); } else { system.out.pri...

Twice-interrupted circular path in SVG -

i want create circular path multiple "holes" in it, preferably without using masks , like. currently, i've got this : <svg xmlns="http://www.w3.org/2000/svg" width="600" height="600" viewbox="0 0 400 400"> <path d="m 100 100 90 90 0 1 0 200 100 m 110 90 90 90 0 0 1 190 90" stroke="#424242" stroke-width="5" fill="transparent" /> </svg> as can see, relies on manually moving start of new arc, results in arc being off. i'd rather not have lot of math position move just right , there sort of "arc move" can use? if not, how math work (i'm rusty in geometry stuff) the simplest way achieve want use dash array. <svg xmlns="http://www.w3.org/2000/svg" width="600" height="600" viewbox="0 0 400 400"> <path d="m 100 100 90 90 0 1 0 200 100 m 110 90 90 90 0 0 1 190 90" stroke=...

php - Error in Database Connection -

i have created phplogin name database giving me error as parse error: syntax error, unexpected '=' in c:\xampp\htdocs\login\log.php on line 7 i using xamp server having version xampp-win32-1.7.7-vc9-installer <?php $username=$_post['username']; $password=$_post['password']; if($username&&$password) { connect = mysql_connect("localhost","root","root") or die ("couldn't connect"); mysql_select_db("phplogin") or die ("couldn't find"); } else { echo "you in"; } ?> missing $ . connect variable & need defined $connect . should - $connect = mysql_connect(...

asp.net core - Accessing project.json webroot value from a npm script command? -

i trying use npm asp.net 5 (vnext) build tool use build js/cs files not want duplicate configuration values in npm , asp.net 5 config files. in project have following files package.json "scripts": { "build:js": "browserify assets/scripts/main.js > $npm_package_config_aspnet5_webroot/main.js" } project.json { "version": "1.0.0-*", "webroot": "wwwroot", } and want able extract webroot value asp.net 5 json file , use in npm scripts commands following the json npm package cool cli tool i've been using things this. can use extract individual values of json file. combining bash scripts means trivially extract asp.net webroot project.json. assuming project.json looks this: { "webroot": "www/" } you can use json tool, so: $ json -f project.json webroot www/ now, case of combining build:js command: "scripts": { "build:js": ...

angularjs - Access parent controller data from main controller -

i have following maincontroller: function maincontroller($scope, dataservice) { $scope.model = { data: null } $scope.init = function () { dataservice.getbyid(2) .success(function (data, status, headers, config) { $scope.model.data = data; }) }; $scope.init(); } i have child controller need access parent scope: function childcontroller($scope) { $scope.model = { data: null } $scope.init = function () { #scope.model.data = $scope.$parent.model.data; }; $scope.init(); } i error saying $scope.$parent.model.data null. if check console $scope.$parent.model.data seems null if click see not , has correct data ... i believe problem defining data in childcontroller before has been defined in maincontroller due dataservice.getbyid queries database ... am right? how can solve this? you right: problem have, parent controller populates "data" inside promise. to understand promise is, ...

sql - MySQL group_concat() ordering by case statement values -

in mysql group_concat() clause, i'm trying order resulting values of case statement. following query configuration orders things.name not order 'non-us' or 'unknown' values within same context. select things.id ,group_concat(distinct case when things.name <> 'united states' 'non-us' when things.name null 'unknown' else things.name end order name separator ', ') things group things.id i want this, it's not working: select things.id ,group_concat(distinct (case when things.name <> 'united states' 'non-us' when things.name null 'unknown' else things.name end) new_name order new_name separator ', ') things group things.id is there way sort "new_name" without using sub-queries/ nested queries? you can accomplish ordering column position instead of column name . for case order 1 should work. select ...

remoteapi - Accessing Docker ( installed with Kitematic/MacOSX) via Remote API -

how can access docker artifacts installed via kitematic on macosx using remote api ( http ) currently see availble via tcp ... my docker env. details docker_host=tcp://182.159.98.120:2375 docker_cert_path=/users/iamuser/.docker/machine/machines/dev docker_tls_verify=1 navigating http://182.159.98.120:2375/version not work.

python - cx_freeze no module named 'pkg_resources' -

Image
i'm using python 3.3.5 cx-freeze 4.3.3 on windows 8.1. i'm trying cx_freeze program uses pkg_resources. i had in setup file under packages, when tried freeze processes stopped error import error: no module named 'pkg_resources' . i moved in setup file packages includes. cx_freeze process completed time when tried start application got error message. if go ide , try import pkg_resources works fine. >>> import pkg_resources >>> pkg_resources <module 'pkg_resources' 'c:\\python33\\lib\\site-packages\\setuptools-18.0.1-py3.3.egg\\pkg_resources\\__init__.py'> there's similar question asked here, , solution re-install setuptools. downloaded setuptools 18.0.1 , installed via cmd, did not solve problem , i'm still getting same errors cx_freeze. any getting work appreciated. edit: solution (hack) has been write dependency out of yagmail. yagmail's original _innit__.py... from pkg_resources import get...

c# - term frequency of documents with Nest Elasticsearch -

i new in elasticsearch , want top n term frequency of "content" field of specific document using nest elasticsearch. i've searched lot find proper answer works me, got should use terms vector , not term facet since counts terms in whole set of documents. know should settings term vector below; [elasticproperty(type = nest.fieldtype.attachment, termvector =nest.termvectoroption.with_positions_offsets, store = true)] public attachment file { get; set; } i searched getting term frequency of specific document using nest elasticsearch lot found lucene , solr. need example in nest elasticsearch. appreciate help. one more question; solution(suggested rob) works when want term frequency of string title of documents. when change target field content of documents, gain no results back! in order able search content of documents, followed answer in link: elasticsearch & attachment type (nest c#) , works fine , can search term through content of document getting t...

PHP Json array in array -

i want catch code=10720 in php .but can't.thanks. { "orderid":"6597943", "extorderid":"extorderid0", "merchantposid":"kampushg", "status":{ "statuscode":"openpayu_error_value_invalid", "code":"10720", "codeliteral":"transaction_invalid_params", "location":"installmentpayment", "statusdesc":["invalid_card_no","invalid_card_expiration_date","invalid_card_cvv"] } } $json = '{ "orderid":"6597943", "extorderid":"extorderid0", "merchantposid":"kampushg", "status":{ "statuscode":"openpayu_error_value_invalid", "code":"10720", ...

c# - What's the difference between Registry font list and .NET FontFamily class Families property? -

i'm trying create instance of fontfamily class , pass argument names registry: registrykey keysystemlink = registry.localmachine.opensubkey(@"software\microsoft\windows nt\currentversion\fontlink\systemlink"); foreach (string fontname in keysystemlink.getvaluenames()) { var fontfamily = new fontfamily(fontname); <...> } but fontfamily constructor doesn't these names @ , throws argumentexception. wrong way? , why so?

java - debug spring-boot in docker -

for reason have issues connecting remote debug spring-boot app running inside docker. start java app with: java -xdebug -xrunjdwp:server=y,transport=dt_socket,address=8000,suspend=n -jar app.jar for docker expose these ports on docker-compose: ports: - "8080:8080" - "8000:8000" however, debugger not able connect on port 8000. works when run server locally not inside docker. idea why? docker ps output: container id image command created status ports names 0d17e6851807 pocmanager_manager:latest "/bin/sh -c 'java -d 3 seconds ago 2 seconds 0.0.0.0:8000->8000/tcp, 0.0.0.0:8080->8080/tcp pocmanager_manager_1 35ed2e2c32bc redis:latest "/entrypoint.sh redi 14 seconds ago 13 seconds 0.0.0.0:6379->6379/tcp pocmanager_redis_1 hi...

maven 3 - Unable to run mvn install -

i getting below error while trying execute mvn install command. [warning] error injecting: org.sonatype.plexus.build.incremental.defaultbuildcontext java.lang.noclassdeffounderror: org/codehaus/plexus/util/scanner @ java.lang.class.getdeclaredconstructors0(native method) @ java.lang.class.privategetdeclaredconstructors(class.java:2493) @ java.lang.class.getdeclaredconstructors(class.java:1901) @ com.google.inject.spi.injectionpoint.forconstructorof(injectionpoint.java:245) @ com.google.inject.internal.constructorbindingimpl.create(constructorbindingimpl.java:99) @ com.google.inject.internal.injectorimpl.createuninitializedbinding(injectorimpl.java:653) @ com.google.inject.internal.injectorimpl.createjustintimebinding(injectorimpl.java:863) @ com.google.inject.internal.injectorimpl.createjustintimebindingrecursive(injectorimpl.java:790) @ com.google.inject.internal.injectorimpl.getjustintimebinding(inject...

oracle - SQL Grouping by Ranges -

i have data set has timestamped entries on various sets of groups. timestamp -- group -- value --------------------------- 1 -- -- 10 2 -- -- 20 3 -- b -- 15 4 -- b -- 25 5 -- c -- 5 6 -- -- 5 7 -- -- 10 i want sum these values group field, parsed appears in data. example, above data result in following output: group -- sum -- 30 b -- 40 c -- 5 -- 15 i not want this, i've been able come on own far: group -- sum -- 45 b -- 40 c -- 5 using oracle 11g, i've hobbled togther far. know wrong, i'm hoping i'm @ least on right track rank() . in real data, entries same group 2 timestamps apart, or 100; there 1 entry in group, or 100 consecutive. not matter, need them separated. with sub_q (select k_id , grp , val -- rank timestamp separate groups same name , rank() over(partition k_id order tmstamp) rnk my_table ...

twitter bootstrap 3 - How to Output Wordpress Theme Customizer changes into .less file? -

i'm trying build wordpress theme bootstrap 3 less. managed setup wordpress customizer options color changing work outputting css theme header, classic way, wondering if there way output these options .less file , compile style.css lessphp compiler, managed integrate theme , seems work when manually update less files. right i'm outputing css head placing function functions.php: <?php //change colors function le_libertaire_register_theme_customizer($wp_customize) { $colors = array(); $colors[] = array( 'slug' => 'header_text_color', 'default' => '#fff', 'label' => __('header text color', 'le-libertaire') ); $colors[] = array( 'slug' => 'navbar_bg_color', 'default' => '#dc3023', 'label' => __('navbar bg color', 'le-libertaire') ); foreach( $colors $color ) { // settings ...

linux - Zigbee kernel driver -

i'm trying understand how implement zigbee module(ti cc2530) linux. module connected through spi development card (a80 pro merrii). at point, i'm not sure have do. have write kernel driver cc2530 ? or simple spi controller driver ? also if have website can more informations, great. you have number of options here: the zigbee linux ha gateway reference design (hw/sw): http://www.ti.com/tool/cc2531em-iot-home-gateway-rd http://www.ti.com/tool/z-stack - z-stack-linux-gateway out of box connects cc2531 via cdc usb. modifying npi_gateway.cfg , zigbeehagw script files can reconfigure use uart or spi. cc2530 need preogrammed znp fw available in http://www.ti.com/tool/z-stack - z-stack-home sdk under z-stack home 1.2.2.42930\projects\zstack\znp\cc253x, prebuilt binaries in z-stack home 1.2.2.42930\projects\zstack\zap\znp-hexfiles\cc2530. this option linux, uses 4 application space servers manage data plane, control plan , field upgrade, offering high le...

java - How to pass object field in DAO? -

Image
i created daos entities. , have problem: need pass object's field in methods. example: @override public void updatebyid(pricetrack pricetrack, int id) throws dbexception { preparedstatement ps = null; try { conn.settransactionisolation(connection.transaction_serializable); conn.setautocommit(false); ps = conn.preparestatement(update_by_id); ps.setint(1, pricetrack.getoldprice()); ps.setint(2, pricetrack.getnewprice()); ps.setdate(3, new java.sql.date(pricetrack.getlastupdatedprice().gettime())); // todo - pass appartment id ps.setobject(4, new apartment()); ps.executeupdate(); conn.commit(); } catch (sqlexception e) { jdbcutils.rollbackquitely(conn); throw new dbexception("cannot execute sql = '" + update_by_id + "'", e); } { jdbcutils.closequitely(ps); jdbcutils.closequitely(conn); } } here need pass corresponding a...

python - Installing modules with pip, "failed to parse CPython sys.version" -

this first post, if i'm leaving out key information or formatting off, please let me know. i'm reinstalling python on pc, , haven't used since getting started in enthought canopy. have since uninstalled canopy, , reinstalled python 2.7.10. i'm trying install numpy, scipy, , handful of similar science based packages, using following in cmd: pip install numpy i following traceback: traceback (most recent call last): file "c:\users\chris\appdata\local\enthought\canopy\user\scripts\pip-script.py", line 8, in <module> pip import main file "c:\python27\lib\site-packages\pip\__init__.py", line 17, in <module> pip.commands import get_summaries, get_similar_commands file "c:\python27\lib\site-packages\pip\commands\__init__.py", line 6, in <module> pip.commands.completion import completioncommand file "c:\python27\lib\site-packages\pip\commands\completion.py", line 4, in <module> pip.basecommand import co...

Retrieving form to create issue in JIRA Rest Java Client -

i trying create program display mandatory fields particular issue type project. far able display values projects , issues using jrjc. not able figure out how display default screen. face same issue ? thanks thats right - need call createmeta call project key, issue type key , expand fields - curl -d- -u fred:fred -x -h "content-type: application/json" http://kelpie9:8081/rest/api/2/issue/createmeta?projectkeys=qa&issuetypenames=bug&expand=projects.issuetypes.fields this give list of fields , can check if field required or not. the jrjc equivalent getcreatemetadata call getcreateissuemetadataoptions options = new getcreateissuemetadataoptionsbuilder() .withexpandedissuetypesfields() .withprojectkeys("cgim") .build(); list mylist=(list) restclient.getissueclient().getcreateissuemetadata(options, pm); // getting issue creation metadata relatively project im searching java.util.iterator<cimpro...

php - Export BIG mysql table to JSON -

i have mysql table 2.8 million records , want convert of these json. wrote script convert stops memory warning. then tried create smaller files (file1 0, 100000 records, file 2 100000 1000000 records etc ) , combine windows copy command. works, each file json array (like [{...}]) , when merges, becomes separate sections [{}][{}] (where want [{................}]) is there better solution ? i suggest change 'memory_limit' in php.ini configuration. if takes time can handle cron job(if possible) or you can decode json files , merge in single array , again encode in json , put in json file.

css - How to make Google Picker iFrame responsive? -

following link: http://stuff.dan.cx/js/filepicker/google/ a demo of google picker, 1 can see picker iframe here has minimum size 566 * 350, when browser resized dimensions smaller. i want iframe in proportion browser being resized, i.e., responsive. can me , change need make happen? sorry not know lot css...

wcf - Ajax POST request to ODATA service throws Invalid HTTP status code 501 -

i have following code wish use inserting record entity of odata service. post request throws xmlhttprequest cannot load invalid http status code 501. apparently request works fine. can suggest way find out problem ? wcf service has problem ? var data = { application_id: 777 , user_id: 'test' }; var data = json.stringify(data); $.ajax({ type: 'post', contenttype: 'application/json; charset=utf-8', datatype: 'json', url: odataurl + 'application_admins', data: data, beforesend: function (xmlhttprequest) { xmlhttprequest.setrequestheader("accept", "application/json"); }, success: function (data, textstatus, xmlhttprequest) { account = data.d; }, error: function (xmlhttprequest, textstatus,...

Regex PHP: Get specific content from a block of code from another website -

i have site want specific content 7 posts. 7 seven posts have same html layout (see below) <div class="eventinfo"> <h3>z's(矢沢永吉)</h3> <h4>z's tour 2015</h4> <dl> <dt><img src="/event/img/btn_day.png" alt="公演日時" width="92" height="20"> </dt> <dd> <table width="99%" border="0" cellpadding="0" cellspacing="0"> <tbody><tr> <td width="9%" nowrap="nowrap">2015年6月</td> <td width="74%">4日 (木) 19:00開演</td> </tr> </tbody></table> </dd> <dt><img src="/event/img/btn_price.png" alt="料金" width="92" height="20"> </dt> <dd>s¥10,500 a¥7,500 (全席指定・消費税込)<br><span class="attention">※</span>注意事項の詳細を<a href="ht...

spring mvc application to navigate flow from controller to jsp or servlet of another application -

i using spring mvc application. want redirect controller or jsp second application developed in plain servlet , jsps. how can navigate flow 1 apps servlet/jsps apps jsp. i have used following lines in controller navigate: first: return new modelandview("redirect:/http://localhost:9090/marathiinput/test.jsp"); second: response.sendredirect("http://localhost:9090/marathiinput/test.jsp"); currently controller : @requestmapping(value = "/transfercertificate", method = requestmethod.get) public modelandview get(modelmap map ,httpservletresponse response) { response.sendredirect("localhost:9090/marathiinput/test.jsp"); } and in jsp calling : <a href="/transfercertificate" class="sis_nav_link">generate tc</a> link you have small errors in both tries, both can used. assuming method controller declared return modelandview can use : return new modelandview("redirect:http://local...

java - How to compile Zxing barcode scanner as a shared library to use in Android projects? -

i writing in delphi xe7 android platform, need , fast 2d barcode scanner. finding zxing's pretty good, not offer object pascal translation. is possible compile whole zxing project shared library, call barcode reader intent ? i think wise implement bar code functionality in app. stumbled on easy library. seem union of zxing , zbar easier interpret. visit git-hub repo https://github.com/dm77/barcodescanner how start: add following dependency build.gradle file. compile 'me.dm7.barcodescanner:zxing:1.7.2' or compile 'me.dm7.barcodescanner:zbar:1.7.2' then make simplescanneractivity , add code. public class simplescanneractivity extends activity implements zxingscannerview.resulthandler { private zxingscannerview mscannerview; @override public void oncreate(bundle state) { super.oncreate(state); mscannerview = new zxingscannerview(this); // programmatically initialize scanner view setcontentview(mscannerview); ...

javascript - AngularJS property not bound on first call -

i'm brand new angularjs , i'm trying implement simple binding. i have html (simplified): <html ng-app> <div id="divcontroller" ng-controller="myctrl"> <input type="button" ng-click="getnumbers();" /> <input type="text" value="{{numbers.total}}" /> </div> </div> and controller this: function myctrl($scope) { $scope.numbers = new object(); $scope.getnumbers = function() { $.ajax({ type: "post", url: "page.aspx/getcurrentnumbers", data: '{name: "test"}', contenttype: "application/json; charset=utf-8", datatype: "json", success: onsuccess, failure: function (response) { alert(response.d); } }); } function onsuccess(response) { var returnvalue = json.parse(response.d); alert(returnvalue.total); $scope.numb...

android - ViewPager showing preloaded fragment instead of current fragment -

i using tablayout(android.support.design.widget.tablayout) viepager instantiating 4 fragments fragmentstatepageradapter. when scroll through fragments loaded perfectly.but when select tab randomly pre-loaded fragment(i know view pager instantiate neighbor fragments along current fragment) shown instead of current fragment. [in case when click 3rd tab fragment in 4th position being shown,same fragment shown in 4th position too]. how can correct situation. in advance. adapter public class orderstatusadapter extends fragmentstatepageradapter { private final list<fragment> mfragments = new arraylist<>(); private final list<string> mfragmenttitles = new arraylist<>(); public orderstatusadapter(fragmentmanager fm) { super(fm); } public void addfragment(fragment fragment, string title) { mfragments.add(fragment); mfragmenttitles.add(title); } @override public fragment getitem(int position) { return mfragments.get(position); } @overri...

how to create 65 lags in SaS without copying and paste 65 times -

i got panel data. symbol company names. date , hour represent time. want create upto 65 lagged return variable. can achieve target using following code. however, have copy , paste 65 times messy. can tell me how can improve code please. data data (drop=i count); set data; symbol date hour; array x(*) rlag1-rlag65; rlag1=lag1(return); rlag2=lag2(return); rlag3=lag3(return); rlag4=lag4(return); rlag5=lag5(return); rlag6=lag6(return); rlag7=lag7(return); rlag8=lag8(return); rlag9=lag9(return); rlag10=lag10(return); /* reset count @ start of each new by-group */ if first.symbol count=1; i=count dim(x); x(i)=.; end; count + 1; run; i want run following regression 65 times. can teach me how loop regression , auto change output file name please. essentially, want lag of independent variable should same last/last 2 digit of name of output file. proc reg data=data noprint outest=lag1; model return = rlag1; date hour;;; run; quit; y...

grails - How to access config.groovy values in your controller? -

i have set login endpointurl in config.groovy as grails.plugin.springsecurity.rest.login.endpointurl = "/api/login" how access endpointurl values in controller ? personally, i'm not big fan of holders because makes code bit harder test. instead, prefer inject config avoid having dependency on holders class: @value('${grails.plugin.springsecurity.rest.login.endpointurl}') def endpointurl

ubuntu 14.04 - How do I resolve a "No repository found" error when attempting to install E-P-I-C? -

i have vm running ubuntu 14 , downloaded version: luna service release 2 (4.4.2). running eclipse root /opt/eclipse folder. after adding install url http://e-p-i-c.sf.net/updates during installation of components following error pops up. error? how resolve it? an error occurred while collecting items installed session context was:(profile=epp.package.java, phase=org.eclipse.equinox.internal.p2.engine.phases.collect, operand=, action=). no repository found containing: osgi.bundle,org.eclipse.egit,4.0.1.201506240215-r no repository found containing: osgi.bundle,org.eclipse.egit.core,4.0.1.201506240215-r no repository found containing: osgi.bundle,org.eclipse.egit.doc,4.0.1.201506240215-r no repository found containing: osgi.bundle,org.eclipse.egit.mylyn.ui,4.0.1.201506240215-r no repository found containing: osgi.bundle,org.eclipse.egit.ui,4.0.1.201506240215-r no repository found containing: osgi.bundle,org.eclipse.jgit,4.0.1.201506240215-r no repository found containing: osg...

string - Reading data in python? -

i trying read data in python 1 way states = """ alabama alberta alaska arizona arkansas bob tom ted william """ states_list = [w.strip().lower() w in states.splitlines() if w] now if trying read similar data file not working. file1 = open('dictionary_file.txt','r') data = file1.read() file1.close() and iterate on items in data here entire code, related part @ end. def _get_child_branches(tree): """ method return branches of tree """ return tree[1:] def _get_child_branch(tree, c): """ method returns specific branch of tree given character """ branch in _get_child_branches(tree): if branch[0] == c: return branch return none def _retrive_branch(k, tree): """ method used getting branch given word """ if not k: return none c in k: child_...

android - Convert string to activity name C# -

i using listview in xamarin android display list of restaurants, , when 1 clicked on navigate new activity. activity each named using convention: [restaurantname]activity. i'm trying use intents: protected override void onlistitemclick(listview l, view v, int position, long id) { string t = items[position] + "activity"; var intentplace = new intent(this, typeof(???)); startactivity(intentplace); } string t gives correct format, wrong type put inside typeof(). however, have no idea put in place of '???', wasn't able use settitle in order create activity name. able point me in right direction? you need attach full path activities. var acttype = type.gettype("part of full path" + items[position] + "activity") i haven't tested it, should work :) protected override void onlistitemclick(listview l, view v, int position, long id) { var acttype = type.gettype("part of full p...

c# - Authenticatioin of user in wp8 app using google login -

i want authenticate user wp8 app using users google login credentials. can profile info of user. found 2 articles in web source code. unable want. first code i've found in link . after getting authentication code didn't have code profile. may not understand. second code i've found in link . following mvvm pattern, totally blank understand code. if have used properly, please me. want after getting client id , client secret in app user's profile info. helps appreciated. in advance. here code protected override void onnavigatedto(navigationeventargs e) { base.onnavigatedto(e); idictionary<string, string> parameters = this.navigationcontext.querystring; string authendpoint = parameters["authendpoint"]; string clientid = parameters["clientid"]; string scope = parameters["scope"]; string uri = string.format("{0}?response_type=code&client_id={1}&redirect_uri={2}&scope={3}", authendpoint...

python - where is the unexpected character? -

dcm.set(\["motion/position/sensor/lanklepitch", "merge", \[[1.0,dcm.gettime(10000)]] ]) no spaces after last ")" unexpected character after line continuation character: c:\users\ady\desktop\untitled-1.py, line 12, pos 88 you have backslash @ start, after dcm.set( . can use @ end of line, called line continuation character. have 1 after "merge", string. you don't need 'escape' square brackets here, nor need use line continuations inside parentheses anyway . the following should work, example: dcm.set([ "motion/position/sensor/lanklepitch", "merge", [[1.0, dcm.gettime(10000)]] ])

c++ - OpenProcess vs CreateProcess -

can please explain me differance between: openprocess , creatprocess. (i trying inject dll program , dont know 1 use.) openprocess passed process id existing process, , returns process handle process. createprocess creates brand new process, returning handle new process (amongst other things). if want inject process running, need openprocess .

Setup c# web api in vb.net Website -

i have website built in vb.net using asp.net web forms , want add web api , using c# , possible? if how it. i did tried , getting message "no type found matches controller named 'get' " , suspect may not possible mixing languages on web api's , want confirm. maybe need write csharp method in project, , using @ vb.net project.

Three.js (r71) - Assigning the animation name to import it to three.js -

i wondering if blender file contains many animations, how three.js library know animation want open on browser? because since three.animationhandler.add() deprecated, should use three.animation ( mesh , geometry.animation ) function, not requires animation name. does know how three.js it? i have figured out. when calling three.animation (mesh, geometry.animations[0]) function, calling first animation in array 'animations', there no need call name.

sql - Rails query the last of each type -

i using sti , have table widget bunch of other subclasses inherit using sti. want query gets last created of each object uniq type. i have predefined array of types want lets say: types = ["type1", "type2", "type3"] so query like: (this doesnt work) widget.where(type: types).uniq.reverse my goal last of each object matches 1 of types.. not 100% sure, might work (untested): ids = thing.where(type: types).group(:type).maximum(:id).values last_per_type = thing.find(ids)

c# - Save 100000 file (1MB file) in SQL Server 2008 -

i have idea create application in c# save files pdf , doc , image on server , have sql server 2008 enterprise. can save 100'000 files (of 1mb size each) in database yearly? so need me disadvantages , database become slow there's paper microsoft research called to blob or not blob . their conclusion after large number of performance tests , analysis this: if pictures or document typically below 256k in size, storing them in database's varbinary column more efficient if pictures or document typically on 1 mb in size, storing them in filesystem more efficient (and sql server 2008's filestream attribute, they're still under transactional control , part of database) in between two, it's bit of toss-up depending on use for filegroups, check out files , filegroup architecture intro. basically, either create database separate filegroup large data structures right beginning, or add additional filegroup later. let's call large_data . no...

android - How to change navbar to match colour of app? -

can kindly share how change colour of virtual navbar (the 1 back, home , menu icon) android 5.0 , above such seen in gmail , hangouts app? you can in styles. <style name="apptheme" parent="theme.appcompat.light"> ... <item name="android:colorprimarydark">@color/mycolor</item> ... </style> you can find out more changing color theme in 5.0 in official docs

javascript - How to test $element in AngularJS controller using Karma? -

i having problem have controller in app use <div ng-controller='logbookeditctrl'> </div> , controller has $element provider in need modify element. describe('logbookeditctrl', function(){ 'use strict'; beforeeach(module('logbooks.edit')); it('should create "logbook" model', inject(function($controller) { var scope = {}, ctrl = $controller('logbookeditctrl', {$scope: scope}); //this explodes because says $element provider not found, because there no html element of course..the controller being created on own. })); }); i have tried following, again says $element provider not found : beforeeach(inject(function(_$element_) { var element = compile('<div></div>'); $element = element; })); you need pass dependency itself, since refers bound element of controller. , there no $element provider available in angular (much similar $scope these dynamic special de...

android - groovy error - cannot find matching method - how to solve -

Image
i have simple activity in android class. anyway looks this: package com.example.groovy import android.os.bundle import android.support.v7.app.actionbaractivity import com.example.r import groovy.transform.compilestatic @compilestatic public class mainactivity extends actionbaractivity { @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); mymethod(); } public void mymethod(){ data data1=new data(); data1.setaddress("37 ibm blvd."); data1.setpostalcode("mc42l8") data1.setdate("feb 19"); data data2=new data(); data2.setaddress("38 oriole"); data2.setpostalcode("mc72l9") data2.setdate("feb 12"); data data3=new data(); data3.setaddress("37 skyway"); data3.setpostalcode("mt82l9"); ...

ios - Threading loading images from a device to a tableView in swift -

i can't find online threading loading image device , scrolling smoothly through tableview. there 1 on ray wen this, doesn't me situation. does have advice or code allow tableview scroll smoothly , load images device's temporary directory? i did mentioned @ tutorial, modification nsoperation subclass this methods fetch -(void) updatedata { [self.pendingoperations.downloadqueue addoperationwithblock:^{ nsarray *paths = nssearchpathfordirectoriesindomains(nsdocumentdirectory, nsuserdomainmask, yes); nsstring *documentsdirectory = [paths objectatindex:0]; nsarray *filepathes = [self recursiverecordsforresourcesoftype:@[@"png", @"jpeg", @"jpg",@"pdf"] indirectory:documentsdirectory]; @synchronized (self) { self.documents = filepathes; nslog(@"documents count %@", @([self.documents count])); } dispatch_async(dispatch_get_main_queue(),...

java - How to correct change encoding of post query? -

when send post page without setcharacterencoding on server-side, фыв . setcharacterencoding(utf-8) , ыва . how correct change character encoding of post query? p.s.: read data servletinputstream. code below. dopost req.setcharacterencoding("utf-8"); bufferedreader r = new bufferedreader(new inputstreamreader(req.getinputstream())); string line; while ((line = r.readline()) != null) { system.out.println(line); } bufferedreader r = new bufferedreader( new inputstreamreader(req.getinputstream(), standardcharsets.utf_8)); with getinputstream have binary data without encoding. hence binary-to-text bridging class inputstreamreader needs correct encoding. otherwise uses system default system.getproperty("file.encoding") .

python - Connect to redis from another container in docker -

i have app, used tornado , tornado-redis . [image "app" in docker images ] start redis: docker run --name some-redis -d redis then want link app redis: docker run --name some-app --link some-redis:redis app and have error: traceback (most recent call last): file "./app.py", line 41, in <module> c.connect() file "/usr/local/lib/python3.4/site-packages/tornadoredis/client.py", line 333 , in connect self.connection.connect() file "/usr/local/lib/python3.4/site-packages/tornadoredis/connection.py", line 79, in connect raise connectionerror(str(e)) tornadoredis.exceptions.connectionerror: [errno 111] connection refused i have tested code local tornado , redis, , works. problem in c = tornadoredis.client() c.connect() why app cant connet redis-container? how fix that? use standart port 6379. thanks! tornadoredis attempts use redis on localhost . (see source here ) so need inform tornadoredis ...

Count number of input fields with value with jQuery -

i have script automatically generates new text field when previous 1 being filled, automatically advances cursor next when user types in exclamation mark. works well. now, i'd add line below last text field shows number of these input boxes have been created , have content. help? <div id="mydiv"> <input type="text" name="qr[]" id="txt_1" class="qr" autofocus /> </div> <script> $('#mydiv').on('keyup', 'input', function(e) { if ($(this).val() == '') { $(this).next().remove(); return; } else if ($(this).next().val() == '') { if (e.keycode === 49 && e.shiftkey) { $(this).next().focus(); } return; } addnewtxt($(this)); }); $('#mydiv').on('paste', 'input', function(e) { e.preventdefault(); var text = (e.originalevent || e).clipboarddata.getdata('text/plain'); if (!text) { retur...

Java Positive flow and negative flow exception handling -

i writing java code fetch object information passing object id. case this: 1. not necessary object id's have information means returns null. 2. if id has information, return object. doing null check here. if write else condition throws kalturaapiexception, throwing exception saying entryid not found , stopping execution there. problem should continue positive flow , should log ids no information. how handle scenario , how catch exception. please me resolving this. in advance. try { entryinfo = getmedia(entry); if (entryinfo != null) { //here retrieving information object , setting 1 more object. } }catch(kalturaapiexception e){ e.getmessage(); } inside getmedia method: try { entryinfo = mediaservice.get(entryid); if (entryinfo != null) { return entryinfo; } } catch (kalturaapiexception e) { e.getmessage(); } return entryinfo; if understand right, mediaservice.get throw kaltur...

SaltStack: Create a server via salt-cloud and set endpoints autmatically in Azure? -

i'm bit stuck server deployment recipes... far, can create , provision servers via commandline: first run salt-cloud , afterwards provision via salt-ssh... but since i'm using special ports (https,...) have set/open input/endpoints (=ports) on microsoft azure. this stuck: there way of telling salt-cloud, automatically execute script, opens endpoints automatically? my preferred result be: run salt-cloud => sets new machine , opens necessary ports run salt-ssh provision them i have looked @ salt orchestration, looks it's more server fleets, instead of single (external) server configuration. any hints? you write custom bootstrap script open ports want.

jython - Python os.walk() failing -

Image
i have created script give me list of files in folder directory. yet, getting error. mean? portion of error: script failed due error: traceback (most recent call last): file "<script>", line 12, in <module> file "c:\program files\nuix\nuix 6\lib\jython.jar\lib\os.py", line 309, in walk file "c:\program files\nuix\nuix 6\lib\jython.jar\lib\os.py", line 299, in walk file "c:\program files\nuix\nuix 6\lib\jython.jar\lib\genericpath.py", line 41, in isdir file "c:\program files\nuix\nuix 6\lib\jython.jar\lib\genericpath.py", line 41, in isdir java.lang.abstractmethoderror: org.python.modules.posix.pythonposixhandler.error(ljnr/constants/platform/errno;ljava/lang/string;ljava/lang/string;)v @ jnr.posix.basenativeposix.stat(basenativeposix.java:309) @ jnr.posix.checkedposix.stat(checkedposix.java:265) @ jnr.posix.lazyposix.stat(lazyposix.java:267) the script: import os import codecs import shu...

vb.net - Why doesn't this code replace my string? -

ok.. has been asked here 10 times , immutable issue. code looks this: for = 0 filterlist.length - 1 dim s = filterlist(i) if s.length > 2 dim ts = xmlstring.replace(s, "<temps>" + s + "</temps>") xmlstring = ts end if next filterlist array(n) of strings. in case wants know i'm replacing.. xml has bad formatting , looks this: <property>g_defaultpbsconversionparams<bool>false</bool></property> <property>g_metallicconversions<vector4>0.025 0.355 1.373 2.913</vector4></property> <property>g_glossconversions<vector4>0.185 0.478 0.588 0.735</vector4></property> <property>g_albedoconversions<vector4>0.05 0.65 0.513 0.5</vector4></property> <property>normalmap <texture>vehicles/american/tracks/t54_e2_track_nm.dds</texture></property> <property>diffusemap <textur...

mysql - Delete duplicate rows if two variables match PHP -

i have 2 variables $faceplateinstalled , $faceplateexists , print them 2 columns faceplate exists faceplate instaled 1 1 1 0 1 1 0 0 1 1 1 0 1 1 1 1 0 0 0 0 1 0 is there way remove entries have 1 , 1 in same row? this query use: "select f.id faceplateid, pr.premiseid, composeaddressfrompaf( pr.postaddressid ) fulladdress, " . " if( f.id not null, 1, 0 ) faceplateexists, " . " ifnull( f.installed, 0 ) faceplateinstalled, " . " pr.siteid, s.name sitename " . "from ho_crm_premise pr " . " left join ho_faceplate f on f.premiseid = pr.premise...