Posts

Showing posts from June, 2011

osx - MongoDB: `Address in use` Error even though Address is NOT in use. -

i have newly installed version of mongodb (v3.2.0) on mac. when try running command mongod error: listen(): bind() failed errno:48 address in use socket: 0.0.0.0:27017 even though result of $ lsof -i :27017 shows nothing using port. here terminal output: michaels-imac:~ michael$ mongod 2016-01-07t13:38:00.097+0000 control [initandlisten] mongodb starting : pid=11485 port=27017 dbpath=/data/db 64-bit host=michaels-imac.home 2016-01-07t13:38:00.097+0000 control [initandlisten] db version v3.2.0 2016-01-07t13:38:00.097+0000 control [initandlisten] git version: 45d947729a0315accb6d4f15a6b06be6d9c19fe7 2016-01-07t13:38:00.098+0000 control [initandlisten] allocator: system 2016-01-07t13:38:00.098+0000 control [initandlisten] modules: none 2016-01-07t13:38:00.098+0000 control [initandlisten] build environment: 2016-01-07t13:38:00.098+0000 control [initandlisten] distarch: x86_64 2016-01-07t13:38:00.098+0000 control [initandlisten]

ssas - String to MDX code -

i have following scenario: i have mdx code in cell in dimension. e.g. [mdxcode].[code].[code] contains string: "([gl account].[gl account code l1].&[abc],[measures].[amount]) + ([gl account].[gl account code l1].&[xyz],[measures].[amount])" now want cell evaluated mdx code. i tried strtomember , totuple not working. e.g. strtotuple([mdxcode].[code].[code]) however if limit example ([gl account].[gl account code l1].&[abc],[measures].[amount]) works. if add tuple sum both not.. try this: strtovalue([mdxcode].[code].currentmember.name) edit upon further info. if can make mdx formula property of ratio name: strtovalue([finance ratio].[ratio name].currentmember.properties("mdx formula"))

linux - how to untar tgz files distinctly -

i have number of .tgz files exact same name, want untar them in 1 directory uniq names. preference append name of folder .tgz came from, original location= /folder1/folder2/2015/04/08/something1.tgz original location= /folder1/folder2/2015/04/09/something2.tgz after untar, them decompressed below target_folder= 20150408_something1 target_folder= 20150409_something2 something1.tar.gz , something2.tar.gz don't have same name. assume mean contain same toplevel folder/files? in case (and assuming folder hierarchy consistent in path tarballs) should able use this. for arc in /folder1/folder2/2015/04/08/something1.tgz /folder1/folder2/2015/04/09/something2.tgz; # filename of archive. fname=$(basename "$arc") # strip off extension filename. fname=${fname%.*} # last 3 directory components. dname=$(awk -f / '{print $(nf-3)$(nf-2)$(nf-1)}' <<<"$arc") mkdir "${dname}_$fname" || { ret=$?; echo

c# - Transaction failed. The server response was: 5.7.1 Forged HELO -

transaction failed. server response was: 5.7.1 forged helo . description: unhandled exception occurred during execution of current web request. please review stack trace more information error , originated in code. exception details: system.net.mail.smtpexception: transaction failed. server response was: 5.7.1 forged helo . session["new"] = textbox1.text; mailmessage msg; string activationurl = string.empty; string emailid = string.empty; msg = new mailmessage(); smtpclient smtp = new smtpclient(); emailid = textbox1.text.trim(); msg.from = new mailaddress("******"); msg.to.add(emailid); msg.subject = "confirmation e-mail"; msg.body = str2; msg.isbodyhtml = true; smtp.credentials = new networkcredential("*********", "**********"); smtp.port = 25; smtp.host = "***********"; smtp.enablessl = false;

angularjs - Angular (ionic) ngCookies can't read cookies -

i using angularjs + ionic + django. this response of request: response-headers response-cookies this how make request: $http.get(apiendpoint.url + 'user/').then(function() { console.log($cookies.getall()); console.log($document.cookie); }); this console output: object {} undefined how can fix? thanks!

javascript - newrelic with angular application -

Image
so have been trying 1. pages on google find answer without luck. the issue i trying use newrelics browser monitor. reason have added code snippet website , added top of application: now seems working able view data: however sadly neither pages nor javascript errors being reported. and when attempt go session alot of funny data: so set out find solution: what ive tried i attempted bower install module suppose work: angular-ra-newrelic however made no changes. i attempted make own decorator using following example: sending angularjs errors new relic sadly without results. so here kinda stranded support not responding atleast few days. therefor hoping of guys might able me out. to need make custom exception handler , send there data new relic. code works me function errprovider() { this.$get = ['$log', '$window', function($log, $window) { return function(exception, cause) { // send n

"Webserver is fetching rather than executing CGI files" When trying to run Bugzilla -

disclaimer : know questions sounds lame. no n00b , have done whatever know , find this. have searched forum , tried fixes given none of them helped me hence question. the threads have visited https://askubuntu.com/questions/147348/bugzilla-testserver-pl-failing http://www.thesitewizard.com/archive/addcgitoapache.shtml bugzilla error after installation: "test-failed web server not executing cgi files" now that my exact problem i have installed bugzilla on bitnamil lampstack. lampstack has 2 other applications , running successfully. after bugzilla installation when trying visit page can see whole perl script on borwser. running it's own server check reveals me following test-ok webserver running under group id in $webservergroup. test-ok got padlock picture. test-failed webserver fetching rather executing cgi files. what have done in setup the bugzilla.conf file (which gets pulled in httpd.conf) has following settings enabled

javascript - New method for getting device type for mobile webpages -

i've been researching way devicetype trigger mobile websites , many people still use script gets screen width/height in pixels determine if mobile devices used or not. but mobile phones/tablets have extremely high resolution screens need way trigger switch between normal websites , mobile websites. screen sizes around 1,280 x 768 - 1920x1080 mobile phones , 1920x1080 2560x1600 tablets. what correct error-proof method determine mobile or not? i'd not use javascript on php, if there's easier method javascript please tell! you can make mobile website responsive trough media queries in css overwrite normal css website. media queries check resolutions , put in media query shown in resolution http://webdesignerwall.com/tutorials/css3-media-queries with javascript can check browser code found on page: http://www.abeautifulsite.net/blog/2011/11/detecting-mobile-devices-with-javascript/ with code can redirect website specially designed mobile website

vb.net - Grdview to excel and save so dialog box does not show -

i have following code. creates , saves excel file content in grdview4 great. @ end of application displays disalog box not want. there anyways dialog box not show? response.contentencoding = system.text.encoding.unicode response.contenttype = "application/vnd.ms-excel" ' response.addheader("content-disposition", "attachment;filename=""c:\echobacs\rejectedbacsbacs\rejectedbacs" & newdate & ".xls") ' response.transmitfile("c:\rejectedbacs" & newdate & ".xls") response.charset = "" me.enableviewstate = false dim ostringwriter new system.io.stringwriter dim ohtmltextwriter new system.web.ui.htmltextwriter(ostringwriter) gridview4.headerrow.style.add("background-color", "#ffffff") gridview4.rendercontrol(ohtmltextwriter) dim helpme string = ostringwriter.tostring()

geolocation - PHP: Add miles to lat/lng pair to get new pair -

what easiest way add distance (100 miles) latitude/logitude pair, , direction (north, etc) new lat/lng pair? edited add: i've been looking @ example on page cant seem work using php: http://www.movable-type.co.uk/scripts/latlong.html here working code, takes $lat/$lng , adds 75 miles east in example. $distance = 75; $bearing = deg2rad(90); $lat1 = deg2rad($lat); $lng1 = deg2rad($lng); echo $lat1 . ', ' . $lng1; echo '<br>'; $lat2 = asin(sin($lat1)*cos($distance/ 3959) + cos($lat1)*sin($distance/ 3959)*cos($bearing)); $lng2 = $lng1 + atan2(sin($bearing)*sin($distance/3959)*cos($lat1), cos($distance/3959)-sin($lat1)*sin($lat2)); echo rad2deg($lat2) . ', ' . rad2deg($lng2);

html - Can't add items to Magento cart -

when ever add item cart 500 server error http://www.supremerattanfurniture.co.uk/ first solution if you're getting blank page seems php error. steps debug be: 1. make sure error reporting turned on, write temporarily: error_reporting(e_all); ini_set('display_errors', 1); at beginning of of index.php file. 2. change theme different one. i'd suspect error in app/design/[package]/[theme]/template/checkout/cart.phtml 3. disable local , community modules. second solution this php memory limit issues. happens me. if 256 mb not work go 500m go magento root , .htaccess , change current value per , flush cache , check shopping cart , work. ## adjust memory limit php_value memory_limit 500m php_value max_execution_time 18000

Using SQL to ignore all employees without certain deduction code -

i trying pull report database using sql. of employees have multiple deduction codes, want ignore deductions on employee has deduction. i.e. want pull employees not have 33. of course can pull not 33 other deductions employees have 33. where ( ((viewpoint.dbo.preh.employee not in (select viewpoint.dbo.preh.employee viewpoint.dbo.prdt.edlcode = 33)) here 1 generic approach excluding employees have deduction 33. where empid not in (select empid mytable deductionid = 33) this approach excludes employee identifier employee has deduction 33. of course, since haven't posted sql, approach need modified suit specific scenario. update based on new information added question, here more specific answer: where viewpoint.dbo.preh.employee not in (select prdt.employee viewpoint.dbo.prdt prdt prdt.edlcode = 33) , viewpoint.dbo.prdt.prenddate &sparm01 --what this? missing equals sign? , viewpoint.dbo.preh.activeyn ='y' , viewpoint.dbo.prdt.prco ='

javascript - Submitting the form manually using Ajax -

i trying call servlet on form submit using ajax. it's not hitting ajax , page reloads. triggering form submit manually , after on submit function calling ajax method. $("#image1").on('change', function(event) { $('#myform').trigger('submit'); alert("button clicked"); // submitted $("#myform").submit(function(e) { // not happening event.preventdefault(); alert('form clicked'); //var formid=("#myform").submit(); $.ajax({ type: 'get', // or post or put or delete // verb url: "/bin/mr/controller?q=iechange", data: $("#myform").serialize(), // type // sent // // server datatype: 'json', // expected data format // server processdata: true, // true or false success: function(data) { // on successfull alert('call success'); console

computer vision - how to detect a human when crossing a line in video with matlab? -

i detect human moving in train station.but want when person near red line(warning line) creat alarm or creat red box.i want in matlab. there example in computer vision system toolbox showing how track moving objects stationary camera. can modify create alarm if person near given line.

c# - What happens with settings after deleting the executable file? -

let's made program without installer (only exe file) , save data on settings. happen if delete exe file? settings delete automatically? if no can give me suggestions? application settings stored in file name <exename>.exe.config near executable file. example if executable myapp.exe , configuration file myapp.exe.config . stored in different files. if change user-level setting (application-level settings read-only) , save settings ( settings.default.save() ), changed values stored in file named user.config in subfolder in %localappdata% folder (see this answer more information). if delete application folder, changed settings not deleted.

routing - Double NAT - connect to device via ssh -

quick question - lan @ home: internet (public ip) v isp router (192.168.0.1, no access) v personal router (192.168.1.1, full access) v device (192.168.1.200) is possible somehow "expose" device internet, remotely connect via ssh? unfortunately don't have access isp router, can't setup port forwarding etc. the cleanest solution setup vpn (i.e. openvpn) , connect vpn-server in internet. perhaps personal router has vpn-support in way? drawback is, have have endpoint in internet (a vpn-service or (virtual) server).

php - JavaScript Object -> AJAX -> wp_options -> echo theObject? -

i've been trying solve using various methods json.stringify , json.parse , json_encode() , json_decode() , stripslashes() , find , replace , etc, etc. but can't figure out , if encode js object database intact. here i'm doing @ moment: 1. send js object via ajax wp plugin: var data = { action : 'store_object', obj: myobject }; $.post(ajaxurl, data).done(function(res) { console.log(res); }); 2. save object in wp plugin's options: $myobject = $_post['obj']; $options = $this->get_admin_options(); $options['settings'] = $myobject; update_option($this->admin_options_name, $options); 3. print saved object javascript object: $options = $this->get_admin_options(); ?> <script> ;(function ($, window, document, undefined ) { $(document).ready(function() { $('#el').pluginname(<?php echo stripslashes(json_encode($options['settings'])); ?>); }); })(jquery, window, documen

regex - Htaccess : https for all except specific domains -

i have following rules redirect request https://www.mainsite.com rewriterule .* https://%{http_host}%{request_uri} [l,r=301] rewritecond %{http_host} !^www\. rewriterule .* https://www.%{http_host}%{request_uri} [l,r=301] now want redirect http://another-domain.com specific folder (blog) without https added this. rewriteengine on rewritecond %{http_host} ^(www.)?another-domain.com$ [nc] rewritecond %{request_uri} !^/blog/ rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule ^(.*)$ /blog/$1 rewritecond %{http_host} ^(www.)?another-domain$ [nc] rewriterule ^(/)?$ blog/index.php [l] even http://another-domain.com still redirected https://www.mainsite.com have way: rewriteengine on rewritecond %{http_host} !^www\. [nc,or] rewritecond %{https} off rewritecond %{http_host} ^(?!(www\.)?another-domain\.com$)(?:www\.)?(.+)$ [nc] rewriterule ^ https://www.%1%{request_uri} [r=302,l,ne] rewritecond %{http_host} ^(www\.)?another-domain\.com

javascript - Plupload filters to allow all but a few extensions -

pupload lets specify file types can uploaded, want opposite: allow filetypes except subset. possible? someone posted solution on plupload's github. have use addfilefilter method. plupload.addfilefilter('excluded_extensions', function(filter, file, cb){ var permitted = true; var exts = filter[0].extensions.split(','); //we have no excluded extensions, function presented default exclusion string, allow if(exts.length === 1 && exts[0] === "-") permitted = true; else { for(var = 0; < exts.length; i++) { var filearray = file.name.split('.'); var extension = filearray[filearray.length - 1]; if(exts[i].touppercase() === extension.touppercase()) { this.trigger('error', { code: plupload.file_extension_error,

Android GCM: duplicate push after notification dismiss -

i sending notification gcm android device , arriving correctly, there 1 case when notifications displaying after being dismissed. steps reproduce: open application starts service receive notifications. send gcm message notification payload. dismiss notification swiping left/right notification. valid click if has action_click element. open tasks , close current application. open application again. when gcm service starts again, receives dismissed notification. my code basic 1 example provided google using gcmlistenerservice . set permissions, put services in manifest , let google display notification you. being called twice in onmessagereceive on service same data when scenario provided happened. this notification payload sending gcm: { collapsekey: 'push', delaywhileidle: true, timetolive: 3600, data: undefined, notification: { body: 'test message 2 updated', title: 'notification', icon: 'myicon' }, c

c# - How to use Progressbar in MVVM -

i'm stuck on this. searched lot in net nothing helped me. in view have 1 button , progressbar, when user click on button different work , after increase currentprogress . but shows user in end of work 100% in end , not want. eachtime currentprogress increased shows , display view. the controls in view those: <button x:name="generate" content="generate" /> <progressbar value="{binding path=currentprogress, mode=oneway}" width="80" height="15"/> and code in viewmodel private int currentprogress; public int currentprogress { { return currentprogress; } set { if (currentprogress == value) return; currentprogress = value; notifyofpropertychange(() => currentprogress); } } list<article> articles; public void generate() { foreach (var art in articles) { //[..] //insert article inser

mysql - update a table from the same table. Relation between records in another table -

i have table records called garanzie_row : id_cred id_gar cd000001440 cd000001068 cd000001440 , cd000001068 defined in table , each of them has status. table named crediti id_cre status cd000001440 open cd000001068 what i'd iterate records in records in first table , set in second table status each cred b status of corresponding cred a but can't find single query select , update in 1 piece (obviously in steps works easily) if understand correctly, can update , join s: update crediti cb join garanzie_row gr on cb.cred = gr.credb join crediti ca on ca.cred = gr.creda set cb.status = ca.status;

How can I convert a list of values to a dictionary in python? -

i have (unsorted) dictionary, keys start @ 0.0 , continue 0.1, 0.2, 0.3 , on. values numbers too. have sys.argv input, called 'a', float. need new dictionary, keys should be: a a+0.1 a+0.2 a+0.3 ... until values in original dict assigned key. values should remain same. final dictionary should be: {a:first item of sorted dict, a+0.1:second item of sorted dict,...} so basically, keys should added size of float 'a'. i tried converting unsorted dictionary sorted list this: list=[] in sorted(dict.keys()): list.append(dict[i]) now have sorted list of values of original dict need assign new keys. use ordereddict maping of increment keys , values: >>> collections import ordereddict >>> d = {0.1:1,0.2:2} >>> d {0.2: 2, 0.1: 1} >>> od = ordereddict(d) >>> od ordereddict([(0.2, 2), (0.1, 1)]) >>> newordereddict = ordereddict(map(lambda (x,y): (x+5, y), od.items())) >>> newordereddict orde

c# - What does args 0 store in this program -

Image
what code in example, args[0] store? if want access path directory, can not though i'm pretty sure im making mistake on same line. string directorypath = args[0]; this code: class program { static void main(string[] args) { string directorypath = args[0]; string[] fileslist, fileslisttmp; ifileoperation[] oplist = { new fileprocnameafter10(), new fileprocenc(), new fileprocbyext("jpeg"), new fileprocbyext("jpg"), new fileprocbyext("doc"), new fileprocbyext("pdf"), new fileprocbyext("djvu") }; if (directory.exists(directorypath))

Logback - possible to get AsyncAppender's current queue's size? -

is possible logback's asyncappender's current queue size? here's relevant section of our config: <appender name="async" class="ch.qos.logback.classic.asyncappender"> <queuesize>1000</queuesize> <discardingthreshold>0</discardingthreshold> <appender-ref ref="file" /> </appender>

list - How to fill a KeyValue Pair from an IList +C#.net -

i have ilist follows: ilist<anodecharacteristicscomposite> anodenodatetimesoverall = _datacontext.getanodedetails(starttime, endtime, anodenopattern).tolist(); where anodecharacteristicscomposite class has got 2 attributes public class anodecharacteristicscomposite { [column(dbtype = "nvarchar(50)")] public string anodestamp { get; set; } [column(dbtype = "datetime")] public datetime productiondate { get; set; } } getanodedetails(starttime, endtime, anodenopattern) stored procedure give list of anodestamp , productiondate selected time period. now want form ilist<pair<string, datetime>> above list anodenodatetimesoverall , use other calculations. ilist<pair<string, datetime>> anodenodatetimes = anodenodatetimesoverall.todictionary(x => x.anodestamp, x => x.productiondate); i tried not working. can please me how this? are talking keyvalue pairs? if use dictionary<tkey,

javascript - Adding a second submit handler -

i trying modify existing web page looks this <script type="text/javascript" src="s1.js"></script> s1.js has this window.ondomready = domready; function domready(fn) { if(document.addeventlistener) { document.addeventlistener("domcontentloaded", fn, false); } else { document.onreadystatechange = function(){chstate(fn);}; } } function chstate(fn) { if(document.readystate == "interactive" || document.readystate == "complete") fn(); } window.ondomready(addhndlrs); function addhndlrs() { var forms = document.getelementsbytagname("form"); for(var = 0; < forms.length; i++) { var form = forms[i]; if(form.addeventlistener) { form.addeventlistener("submit", dovalidate, false); } else if (form.attachevent) { form.attachevent("onsubmit", dovalidate);

sql server 2008 - Sum the balance in history table -

i need i'm not able achieve desired output. have used cursor shown below. have 2 tables 1. transaction 2. history. need sum amount in transaction table id , insert in history table under revised_amount column , store amount before sum in original_amount column. below example. tran_id id amount 1066 dhan group $4,800.00 1327 dhan group $2,670.00 1329 dhan group $1,800.00 1330 dhan group $1,290.00 3953 admin group 0 2650 admin group $364368.69 2651 admin group $1604546.97 desired output in history table hist_id id original_amount revised_amount 1 dhan group $4,800.00 2 dhan group $4,800.00 $7,470.00 3 dhan group $7,470.00 $9,270.00 4 dhan group $9,270.00 $10,560.00 5 admin group $0 6 admin group $0 $36

Remove folder from Java classpath at runtime -

is there way remove folder classpath similar adding folder @ runtime ( can directory added class path @ runtime? ) please find below snippet technical example demonstrate adding / removing path. create following source files in directory import java.io.file; import java.lang.reflect.field; import java.lang.reflect.method; import java.net.url; import java.net.urlclassloader; import java.util.stack; import sun.misc.urlclasspath; public class evilpathdemo { public static void addpath(string path) throws exception { url u = new file(path).touri().tourl(); urlclassloader urlclassloader = (urlclassloader) classloader.getsystemclassloader(); class<?> urlclass = urlclassloader.class; method method = urlclass.getdeclaredmethod("addurl", new class[]{url.class} ); method.setaccessible(true); method.invoke(urlclassloader, new object[]{u}); } public static void removep

angularjs - Get ng-model in ng-repeat in ng-repeat with Protractor -

how can ng-model in ng-repeat in ng-repeat protractor ? <div ng-repeat="field in master.linker | orderby:'country.name'"> <div> <p> {{ field.country_name }} </p> <label ng-repeat="user in user_list"> <input type="checkbox" ng-model="selected_user"> <span ng-bind="user.name"></span> </label> </div> </div> i use filter() check ng-repeat : var fields = element.all(by.repeater('field in master.linker')); fields.filter(function (field) { return field.element(by.binding("field.country_name")).gettext().then(function (country) { return country === "en"; }); }).then(function (filteredfields) { var fields2 = filteredfields[0].element.all(by.repeater('user in user_list')); return fields2.filter(function (field2) { return

c# - Display two data fields' content in dropdownlist then hide one on clicking -

so want when click dropdown shows 2 items dropdownlist. left side show id , right side show text. so (98739 | smoker) when click onto item want dropdown list show "smoker" i have tried string sqlgetclass = "select [code], [snomedcode] + ' | ' + [descrip] [fulldescrip] lt__smokingstatus"; sqlcommand cmdsmoke = new sqlcommand(sqlgetclass, con); con.open(); sqldataadapter da = new sqldataadapter(cmdsmoke); dataset ds = new dataset(); da.fill(ds); ddlsmokestat.datasource = ds; ddlsmokestat.datatextfield = "fulldescrip"; ddlsmokestat.datavaluefield = "code"; ddlsmokestat.databind(); con.close(); that works fine , shows (98739 | smoker) in dropdown. wondering anyway of hiding 98739 code there after have selected item. know setting , calling that. other way combine them wish? first, i've made editing title clarify task (you not hiding other

html - How do I link <li> with local file? -

i have following code link local files. local file located in same place current html file located. how can modify following code link local file? <ul> <li><a href="#news">news</a></li> <li><a href="#q&a">q&a</a></li> <li><a href="#contact">contact</a></li> <li><a href="#about">about</a></li> <li><a href="#fun">fun</a></li> </ul> for example: if user click on news , news page should open users, , on. the code have provided correct, looking link each <li> different location not the #news , understand. first of all, have make sure want news should link to? 1. how link news specific part of website? ` for example, linking h1 has #news id: <ul> <li><a href="#news">news</a></li> </ul> <h1 id="news"&g

javascript - Multiple google visualization table on one page -

i'm having problem creating multiple google visualization tables on single page. how dynamically generate unknown number of google visualization tables on single page complete functionality? i referenced (almost identical) question how add 2 google charts on 1 page? dominor novus's solution not if not aware, prior creation of page, of number of tables. example, need have 5 tables, need have 1. my question how dynamically create page dynmically create multiple google visualization tables each own unique identifier. when user clicks on row in table able return row number unique identifier dynamically created table? in order come solution problem, must store table data , table object in arrays. first create arrays data , table object @ top of page. var tabledata=new array(); var table=new array(); var tableid=0; we generate our table storing them in arrays referenced unique identifier. in order fulfill select functionality of table add listener table object.

c# - Should I Be Using the @ or // Symbol with Providing Paths from Command Line -

i'm developing command-line utility , passing paths arguments inside batch file. need add @ symbol paths within application prevent characters "\" escaping? this link specifies using @ symbol, currently, i'm not using @ or \\ prevent escaping. when pass in path is, works fine. why this? i call this, inside batch file: foldercleaner.exe -tpath: "c:\users\someuser\directorytoclean" program: class program { public static void main(string[] args) { if(args[0] == "-tpath:" || args[0] == "-tpath:" && !isblank(args[1])) { clearpath(args[1]); } else{ console.writeline("parameter either -tpath:/-tpath: , must provide valid path"); } } clear path method: public static void clearpath(string path) { if(directory.exists(path)){ int directorycount = directory.getdirec

php - Query Builder inside entity - Doctrine -

i'm looking better way write function. it's inside doctrine entity model public function getcompanysubscriptions() { foreach ($this->subscriptions $key => $value) { if ($value->getplan()->gettype() == 'e' && $value->getactive()) { return $value; } } return null; } $this->subscriptions many-to-one collection , can have different "types" (but 1 of them type "e"). problem is: if company has many $subscriptions function slow return 1 of type "e" need check when building view twig. solution use querybuilder , haven't found way use directly entity model. you cannot use querybuilder inside entity, instead can use doctrine criteria filtering collections (on sql level). check documentation chapter 8.8. filtering collections more details on criteria . if collection has not been loaded database yet, filtering api can work on sql level make optimized a

hive - Hadoop Cluster Requirement Software /Hardware -

hi trying setup hadoop environment. in short problem trying solve involves billions of xml files of size few mb, extract relevant information them using hive , analytic work information. know trivial problem in hadoop world if hadoop solution works me size , number of files dealing increase in geometric progession form. i did research referring various books "hadoop - definite guide", "hadoop in action". resources documents yahoo , hortonworks. not able figure out hardware /software specifications establishing hadoop environment. in resources had referred far had kind of found standard solutions namenode/jobtracker (2 x 1gb/s ethernet, 16 gb of ram, 4xcpu, 100 gb disk) datanode (2 x 1gb/s ethernet, 8 gb of ram, 4xcpu, multiple disks total amount of 500+ gb) but if can give suggestions great. first suggest consider: need more processing + storage or opposite, , view select hardware. case sounds more processing storage. specify bit differently

Android Proximity Sensor [Unique Issue - Sensor Not Detecting Objects Already Near The Phone] -

i'm updating application based on users huge request. app turns screen on after happens , i'm integrating "pocket mode" functionality. if user has phone or device in his/her pocket detect via proximity sensor , act based on this. i'm experiencing lot of troubles.. so i'm registering sensor , usual. 1 thing point out i'm telling powermanager object register proximity_screen_off_wake_lock. means every time screen go automatically off when near detected. powermanager.newwakelock(powermanager.proximity_screen_off_wake_lock, "proximityscreenoff"); basically when device on table , move finger sensor screen turns off expected. the problem starts when activity launches , i'm holding finger on sensor (or in pocket - it's same). sensor doesn't detect near phone. if move finger little bit away screen turn on again. is there do, desired behavior - is, turning screen off when phone in pocket? you can manage using boolean va

javascript - How to correctly change value of input form to be noticed by "change" event? -

i'm trying create keyboard input symbols in dynamically created fields. i'm using on() function handle blur , change events of input form. i'd input special chars on caret position. possible make without using global variables? change noticed if add letters keyboard , loose focus or press enter, or if type (letter , special character) || (special character , special character) without loosing blur or pressing enter. // checking click targets var clicky; $(document).mousedown(function(e) { clicky = $(e.target); }); // handling dbclick , enter press $(document).on("dblclick", "input#word", function (){ $(this).parent().parent().css('background-color', setoneditcolor); $(this).prop("readonly", false); $(this).keypress(function(e) { if(e.which == 13) { $(this).focusout(); } }); }); // handling blur on input form $(document).on("blur", "input#word", functio

c - Macro Substitution assignment -

#define max(x,y)(x)>(y)?(x):(y) main() { int i=10,j=5,k=0; k==max(i++,++j); printf("%d %d %d",i,j,k);//11 7 0 } why output 11 7 0 instead of 11 6 0? the statement expands to k==(i++)>(++j)?(i++):(++j) let's re-write added parens emphasise how expression parsed when accounting precedence rules: ( k == ( (i++) > (++j) ) ) ? (i++) : (++j) note > has higher precedence == . now, (i++) > (++j) evaluated first, evaluates 1 , both i , j incremented. k compared equality 1 , yields 0 . conditional operator evaluates (++j) , j incremented 1 more time. in total i incremented once, j incremented twice , k not modified. , hence output describe. this example of perils of using macros. function need. some other points: your main declared incorrectly. should int main(void) . if compile warnings enabled compiler flag line in question. compiler says: c:\users\blah\desktop>gcc main.c -wall -o main.exe main.c: i

eclipse - Cannot run the code due to java.lang.NoClassDefFoundError -

i investigating jsprit library. created new project in eclipse , copied-pasted demo example class . added jars path, including log4j-1.2.17.jar . nevrtheless cannot execute demo code due following error: exception in thread "main" java.lang.noclassdeffounderror: org/apache/logging/log4j/logmanager @ jsprit.core.problem.vehicle.vehicleimpl$builder.<clinit>(vehicleimpl.java:108) @ com.test.jsprit.main(jsprit.java:49) caused by: java.lang.classnotfoundexception: org.apache.logging.log4j.logmanager @ java.net.urlclassloader.findclass(urlclassloader.java:381) @ java.lang.classloader.loadclass(classloader.java:424) @ sun.misc.launcher$appclassloader.loadclass(launcher.java:331) @ java.lang.classloader.loadclass(classloader.java:357) ... 2 more what mean , how solve issue? mean other *.jar file missed? update: the error occurs @ following line: builder vehiclebuilder = vehicleimpl.builder.newinstance("vehicle"); you

oracle - Convert T-SQL INNER JOIN on a Function to PL-SQL -

i have t-sql view this: left join fnc_assetattributebytype(3) tmp on a.assetid = tmp.assetid; is there straight forward way can translate (i'm writing tool programmatically) without creating package or modifying header of function void other calls in other dml statements? main questions: 1. can write pl function returns table? 2. if not, should do? you can create function returns table type, , work on in sql using inside table() clause. user running sql needs execute privilege on function. sql> create or replace type tp_asset object (assetid number, asset_name varchar2(100), asset_val number) 2 / type created sql> create or replace type tp_tab_asset table of tp_asset; 2 / type created sql> create or replace function fnc_assetattributebytype(p_num in number) return tp_tab_asset pipelined 2 v_tp_asset tp_asset; 3 begin 4 in 1 .. 3 5 loop 6 v_tp_asset := tp_asset(i, 'abc', * 3); 7 pipe row (v_tp_asset);

using rvest to scrape match scores from crickbuzz in R -

i scraping page crickbuzz scores getting match details. using selector gadget getting css tag. things have done far : crickbuzz <- read_html(httr::get("http://www.cricbuzz.com/cricket-match/live-scores")) matches_dates <- crickbuzz %>% html_nodes(".schedule-date:nth-child(1)") %>% html_text() i have fetched matches , scores , venues , having difficulty in fetching dates. getting below result above code > matches_dates " - " " - " " " " " " " " " " " " " " " " " " - " " - " " - " means getting 21 element , right there 21 matches , not getting text. then had seen coming in html_nodes() , giving : {xml_nodeset (21)} 1 <span class="schedule-date" timestamp="1452132000000" format="mmm d

Spinner Android link to XML items file -

i want create spinner in first app, don't know how link item list xml file. please me! update my code : <spinner android:width="wrap-content" android:height="wrap-content" /> 1: create xml file in witch have drag , drop spinner in xml layout. 2: access main xml layout in java in oncreate method setcontentview(r.layout.main); 3: create instance of spinner in java class. example spinner spinner = (spinner) findviewbyid(r.id.spinner); * r.layout.main xml layout have created spinner. here spninner <spinner android:id="@+id/spinner" android:layout_width="fill_parent" android:layout_height="wrap_content" android:prompt="@string/spinner_title"/> and here example if have problem spinner tutorial

c# - Could not load file or assembly 'RazorEngine' with Exporter class from GitHub -

i'm trying use tool found here: https://github.com/ignatandrei/exporter this should take ienumerable , generate byte[] value of excel, word, or pdf. using mvc 5.2.3.0 i’m trying use these classes: public abstract class reportbase : ireport { virtual public string reportname { get; set; } virtual public icollection<ireportsection> reportsections { get; set; } } public abstract class reportsectionbase : ireportsection { public string reportsectionname { get; set; } public icollection reportitems { get; set; } } and in controller trying this: public virtual actionresult processreport() { if (session["reportdata"] != null) { var report = session["reportdata"] reportbase; // error here export<reportbase> export = new exportexcel2007<reportbase>(); var data = export.exportresult(new list<reportbase>() {report}); return new downloadfileactionresult(data, "test.

sql server - Convert columns to rows by ID -

looking way convert columns rows in sql server. i have table columns below: [id] [action] [note] [resolution] here want result columns: [id] [notes] , result values be: '1' 'action1' '1' 'note1' '1' 'resolution1' '2' 'action2' '2' 'note2' '2' 'note2.1' '2' 'resolution2' etc any ideas how in t-sql? note field there multiple entries. thanks! assuming source table , data looks this: -- select * t: id action note resolution --- ------- ------- ----------- 1 action1 note1 resolution1 2 action2 note2 resolution2 2 action2 note2.1 resolution2 this query: select distinct id, notes (select * t) source unpivot (notes ids in ([action], [note], [resolution]) ) unpivotted_table will produce result: id notes --- ------ 1 action1 1 note1 1 resolution1 2 action2 2 note2 2 note2.1 2 resolution2 which looks lot asking for. y

Android Wifi Direct WifiDirectServiceDiscovery on API level 15? -

i need compile wifidirectservicediscovery sample of android 4.2.2 (api 17) on 4.0.3 (api 15), possible? if yes, best/fast way it? is possible? no, because requires apis introduced in api level 16, such removeservicerequest() .

javascript - react-native onChangeText this.value is undefined -

i adding simple masking text input, date in dob field looks dd/mm/yyyy. i have function handle that: dateformat(text) { if (text.match(/^\d{2}$/) !== null) { this.value = text + '/'; } else if (text.match(/^\d{2}\/\d{2}$/) !== null) { this.value = text + '/'; } this.setstate({birthdate: this.value}); } i call function with: onchangetext={(text) => this.dateformat(text)} the text passed correctly. however, this.value undefined , setting whatever, makes no difference. what doing wrong? i don't think need reference this.value, declare var value = text: onchangetext(text){ if (text.match(/^\d{2}$/) !== null) { var value = text + '/'; this.setstate({birthdate: value}) } else if (text.match(/^\d{2}\/\d{2}$/) !== null) { var value = text + '/'; this.setstate({birthdate: value}); } else {this.setstate({birthdate:text})} } i've set on rnplay here , , seems working fine:

Bitbucket - Groovy Pre-receive Hook -

i trying understand following code snippet following site . <% refchanges.getcommits(repository).each { commit -> %> - ${commit.author.name} | ${commit.displayid} | ${commit.message} | ${commit.authortimestamp} <% } %> the script using getcommits method, when @ the documentation refchange interface not see such method. i consider myself expert java developer, have no workable knowledge in groovy, assume misunderstanding groovy or bitbucket documentation (or both). in groovy it's possible add methods class or interface @ run-time via meta-programming . since refchange interface not include getcommits() , must method being added after-the-fact. based on example code, looks they're using meta-class. where getcommits()? for example, in groovy collection interface gets method findall() (along many other methods). can confirm follows: assert collection.metaclass.metamethods*.name.contains('findall') == true the code above grab

html5 - How does the YouTube mobile site prevent skipping video on iOS? -

when go m.youtube.com on iphone (chrome) watch videos, assume youtube using html5 <video> tag display them. however, when watch video commercial, dragging seek button makes jump it's original position before seek. in other words, impossible control position in commercial. it feels violation of divide between browser content , browser. isn't native app, website. how ios video control elements being manipulated html? seems should impossible, should impossible webpage access phone's photos or switch applications. if it's running inline in browser, site have full script access controls - , it's standard nowadays prevent skipping/changing playhead during ads. rid of controls completely. though html5 video native browser function, it's still subject javascript hooks. 1 has add return false onchangeplayhead event lock controls down. it's when remove video inline web , bring native ios app becomes untouchable scripts.

Bad File Name when using Excel to find words in a Word Document -

i'm using code below loop through data on excel spreadsheet , open word document. want cycle through word document , find of words on excel sheet. works okay until try , find words on excel sheet , "bad file name" message. i've highlighted line below error occurs. i'm sure syntax error, don't know correct syntax is. help....... dim mydb() string dim mycol() string dim mydbcnt integer dim mycolcnt integer dim dbcnt integer dim resrow integer dim r integer dim x integer dim prevrow integer resrow = 1 r = 5 x = 1 prevrow = 4 until len(trim(cells(r, 4))) + len(trim(cells(r, 5))) = 0 doevents redim preserve mydb(1 x) if (trim(cells(r, 4)) & "." & trim(cells(r, 5))) = (trim(cells(prevrow, 4)) & "." & trim(cells(prevrow, 5))) ' nothing else mydb(x) = trim(cells(r, 4)) & "." & trim(cells(r,

putty - I can't transfer files using pscp to amazon AWS ec2 instances. Key refused -

i can connect server command line using putty using same private key. but when try use same key transfer file pc on server": pscp -i c:\xxx.ppk "c:\xx\somefile.yy" ec2-xx-xx-xxx-xxx.compute-1.amazonaws.com:/home/(some location) i receive following error: server refused our key fatal: disconnected: no supported authentication methods available (server sent: publickey) could me fixing problem please? you may want review error: server refused our key or no supported authentication methods available section of troubleshooting connecting instance document. try this: add -l user name option pscp command line, proper username instance. pscp -i c:\xxx.ppk -l user ec2-user "c:\xx\somefile.yy" ec2-xx-xx-xxx-xxx.compute-1.amazonaws.com:/home/(some location) the -l option allows connect specified username. may have username mismatch.

doctrine2 - Filtering of associated entity collection in Symfony / Doctrine -

if have associated object collection, can restrict results? for example: producer entity has property translations, contains collection of other entities (producertranslation). class producer { protected $id; // arraycollection protected $translations; } producercontroller: $producers = $this->getdoctrine() ->getrepository('producerbundle:producer') ->findall(); result: producer id: 1 translations: en: producertranslation de: producertranslation it's alright. want 1 entity of language. expected result: $producers = $this->getdoctrine() ->getrepository('producerbundle:producer') ->findbylocale('en'); producer id: 1 translations: en: producertranslation how it? to restrict sub collection can use querybuilder (assuming locale property of producertranslation): $qb = $this->getentitymanager()->createquerybuilder(); $qb->select('p,

javascript - Is it possible to define an image map area by radial coordinates? -

Image
i familiar online imagemap generators use in html pages. convenient when creating rectangular or circular areas. however, if area pie-shaped, makes things little more complicated. example, if have shape , wanted make each pie slice separate area, image map code looks when use online imagemap generator. <img src="url/to/your/image.jpg" alt="" usemap="#map" /> <map name="map" id="map"> <area alt="slice1" title="slice1" href="#" shape="poly" coords="149,2,146,294,40,250,4,172,14,85,73,23" /> <area alt="slice2" title="slice2" href="#" shape="poly" coords="153,1,251,38,286,86,299,148,287,207,244,264,206,283,155,295" /> </map> this downside when you're using rectangular coordinates on circular shape: takes more points define pie slice need radial coordinates. example define pie slice (cente