Posts

Showing posts from May, 2013

php - IIS 404 error on existing text file -

i'm running project on server runs iis 7.5 there's strange error have never seen. project written codeigniter. i'm converting videos ffmpeg.exe , writing results in separate text files each video. , in client side reads text file progress. but server throws 404 error existing txt file. keeps throwing error until restart server. after restarting server, can able show text file. everything else works perfect. please me. edit: .txt files reachable after amount of time. it's not how time should pass. i found solution. isn't solution source of problem works me. i think, iis throwing 404 error because file being processed , locked ffmpeg. getting file contents file_get_contents() via http address , returns empty string or error message. decided use physical address of file , use read_file() function output buffering. it's working without error.

Rails 4 has many through and STI -

i assign teacher skills in case maths teacher i'm not sure if have correct set up. when try assign teacherskills teacher in console encounter errors show below. i have used railscasts episode#17 can not clear these errors. can offer advice on correct set achieve has many through associations sti. m = mathteacher.first m.math_teacher_skill_ids select `math_teacher_skils`.id `math_teacher_skills` where`math_teacher_skills`.`math_teacher_id` = 1 => [] m.math_teacher_skill_ids = [1,2] activerecord::recordnotfound: couldn't find mathteacherskills 'id': (1, 2) (found 0 results, looking 2) class teacher < activerecord::base end class mathteacher < teacher has_many :math_teacher_skills has_many :skills, :through => :math_teacher_skills end class skill < activerecord::base has_many :math_teacher_skills has_many :teachers, through: :math_teacher_skills end class mathteacherskill < activerecord::base belongs_to :skill belongs_to :math_teacher en

Java regular expressions / regex -

i have following string: $500 has been received username [rank]. i use following regex statement attempt amount paid (500) , username. "^\\$(\\d+\\.?\\d*) has been received ([^.]+)\\.$" unfortunately extracting this: "username [rank]" i have attempted modify instead of reading until '.' username variable read ' ', multiple back-slashes seem confusing me , unexpected results. what regex 'code' need use extract balance , username? (the rank of no use me). many thanks! is kind of homework? reason ask this: regex value until character anyway - according site: http://www.regexplanet.com/advanced/java/index.html this shall work: ^\$(\d+\.?\d*) has been received (.*)\s\[(.*)\].$

javascript - View multiple browsed images with unique ID -

after searching in stackoverflow, found code can browse multiple images , preview them one-by one. however, when inspected element in browser, id each image same. so, hope can me how modify code each image browsed has own unique id. here fiddle: and here html form: <input id="imginput" type="file" name="file[]" multiple style="display:none;"/> <input type="button" onclick="$('#imginput').click();" value="choose file" /> <output id="result" ></output> <div style="margin-top:150px;" id="uploadedcontent"></div> here js code: var ftype = new array(); $("#imginput").change(function () { readurl(this); }); function readurl(input) { var files = input.files; var output = document.getelementbyid("result"); var count = 0; var count1 = 0;

html - Why these objects aren't in right order? -

Image
my problem html , css. feel topic confusing , thinking disappointing me creating idea in web. want create; draw in paint now. this html code own project first page: <?php include("includes/classes/mysession.php"); mysession::start(); ?> <!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title>untitled document</title> <link rel="stylesheet" type="text/css" href="includes/css/style_mainpage.css" /> </head> <body> <div id="container"> <div id="header"> <div id="loginpart"> <form action="pages/userspage/checkuser.php" method="post" name="form_login" id="fo

php - Two issues while trying to update wordpress user meta -

i have form submitting data php script. here of code in script. foreach ($newuser_values $key => $value) { echo $key; echo $value; switch ($key) { case "show_name": echo "1"; switch ($value) { case "first": $update_val = $current_user->user_firstname; break; case "first_initial": echo "hi"; $update_val = $current_user->user_firstname . " " . substr($current_user->user_lastname,0,0) . "."; break; case "first_last": $update_val = $current_user->user_firstname . " " . $current_user->user_lastname; break; default:

ember.js - Ember-cli calling php methods -

i have ember.js application running in apache calls php methods, hits mysql , data returned. i created new ember-cli application , copied js, handlebars , php code cli structure. run "ember build" "ember server" , can access home page via localhost:4200. when hit link that's supposed data, i'm getting "304 not modified" returned php call along contents of php file. when setup apache had install php. there special have run php in ember-cli structure?

ios - App crashing without stacktrace on pickerview with textfield -

i'm still working on getting uipickerview when trying edit textfield, app crashes without stacktrace. instead of stacktrace shows usual ((lldb)) , nothing #import "testviewcontroller.h" #import "findclasses.h" @interface testviewcontroller () @property uipickerview *picker; @property nsarray *pickerarray; @property (nonatomic, strong) findclasses *finder; @end @implementation testviewcontroller @synthesize finder = _finder; - (findclasses *)finder { if (!_finder) _finder = [[findclasses alloc] init]; return _finder; } - (void)viewdidload { [super viewdidload]; self.pickerarray = [self.finder findclassesintimetable]; self.classfield.delegate = self; self.picker = [[uipickerview alloc] init]; self.picker.delegate = self; self.picker.datasource = self; self.classfield.inputview = self.picker; // additional setup after loading view. } - (bool)textfieldshouldbeginediting:(uitextfield *)textfield { [textfield

android endless gridview logic wrong? -

follow lazy download images gridview write code add more data after 5 row scroll. mygridviewadater extend baseadapter seem normally. , in page include gridview: int current_page = 0; @override public void oncreate(bundle savedinstancestate) { listdishentity = dishdatabase.getalldishs(); //421 size listdishdisplay = new arraylist<dishentity>(); (int = 0; < 15; i++) { listdishdisplay.add(listdishentity.get(i)); // 15 component //first iniate gridview } } // , display initiate data dishimagegridviewadapter adapter = new dishimagegridviewadapter( mcontext, listdishdisplay, ""); adapter.notifydatasetchanged(); gridnutri.setadapter(adapter); gridnutri.setonscrolllistener(new onscrolllistener() { @override public void onscrollstatechanged(abslistview view,

swift - Apply vertical alpha gradient to UITableView -

i'm new ios development , trying learn swift. i'd apply vertical alpha gradient uitableview, having trouble. originally following this post , did following: var gradientmasklayer:cagradientlayer = cagradientlayer() gradientmasklayer.frame = mytableview.bounds gradientmasklayer.colors = [uicolor.clearcolor().cgcolor, uicolor.blackcolor().cgcolor] gradientmasklayer.locations = [0.0, 0.05] mytableview.layer.mask = gradientmasklayer after getting error array element cannot bridged objective-c , reading this post modified 2 arrays used: var gradientmasklayer:cagradientlayer = cagradientlayer() var gradientmaskcolors:nsarray = [uicolor.clearcolor().cgcolor, uicolor.blackcolor().cgcolor] var gradientmasklocations:nsarray = [0.0, 0.05] gradientmasklayer.frame = mytableview.bounds gradientmasklayer.colors = gradientmaskcolors gradientmasklayer.locations = gradientmasklocations mytableview.layer.mask = gradientmasklayer and error value failed bridge swift type objective-c

Drupal Content Type: how to add a checkbox that hides an object if checked? -

i working on drupal site , want add checkbox within content type hide object if checked. i not worried how hide it, can figure out js or css later on need know how add checkbox has ability modify display. i think going along lines of adding new field don't know type of field add. any appreciated :) i have done adding form alter, you need write form alter can add states property field need show or hide $form['your_showhide_field']['#states'] = array( 'visible' => array( ':input[name="you_checkbox_name"]' => array('checked' => true), ), ); or you can use field condition state module this.

cocoa - How can you tell what namespace constants have been put in in swift? -

in swift, lot of cocoa , framework constants have been put namespaces. example, nscompositesourceover nscompositingoperation.compositesourceover . this thing. however, it's hard work out apple have put constants. example, need kcgdesktopwindowlevel , , can't find damn thing. (there kcgdesktopwindowlevelkey , that's not same thing.) is there reference this, or set of files can grep? in original cgwindowlevel.h , kcgdesktopwindowlevel macro defined cgwindowlevelforkey(kcgdesktopwindowlevelkey) . macro not imported, latter works fine in swift long add type conversions: int(cgwindowlevelforkey(cgwindowlevelkey(kcgdesktopwindowlevelkey))) . (you might wish file bug since these type conversions required.) can see of these things ⌘-clicking on cgwindowlevelforkey function, or using :print_module coregraphics swift -integrated-repl .

java - build-time weaving with openjpa at using spring created persistence unit -

this documentation states: note: prereq running enhance task, copied persistence.xml file /build directory. might not need this, persistence.xml has in classpath. this implies me task needs determine through persistence.xml file files need enhancing. currently runtime weaving not work. may need that, preferrably classes pre-enhanced making heavy use of entity classes. can pre-enhancement performed on entity classes assembled in spring-built persistence unit?

ios - AFNetworking returns no connection despite internet connectivity -

i'm using afnetworking determine whether user has internet connection. returns false on both wifi , 4g lte , have checked make sure they're operational. have following code: -(void)viewdidload{ [[afnetworkreachabilitymanager sharedmanager] startmonitoring]; if ([self connected]) [self dosomething]; else [self noconnection]; } - (bool)connected { nslog(@"this returns 0 %hhd", [afnetworkreachabilitymanager sharedmanager].reachable); return [afnetworkreachabilitymanager sharedmanager].reachable; } -(void)noconnection{ uialertview *alert = [[uialertview alloc] initwithtitle:@"no internet!" message:@"sorry, don't have internet connection @ time. please try again later." delegate:self cancelbuttontitle:@"ok" ot

codeigniter - php Invalid argument supplied for foreach() -

i don't understand happen there. got problem @ line 87 $this->data['option_pengujian'][$row->id_penguji] = $row->penguji; this code of function public function tambah() { $this->data['breadcrumb'] = 'pengujian > tambah'; $this->data['main_view'] = 'view_pengujian/pengujian_form'; $this->data['form_action'] = 'pengujian/tambah'; $penguji = $this->penguji->cari_semua(); if($penguji) { foreach($penguji $row) { $this->data['option_pengujian'][$row->id_penguji] = $row->penguji; } } else { $this->data['option_pengujian']['00'] = '-'; $this->data['pesan'] = 'data penguji tidak tersedia. silahkan isi dahulu data penguji.'; // if submit if($this->input->

Cannot get wildcard search working with Sphinx Real Time indexes -

there several questions here on this, on google. however, repeated attempts , plenty of googling has not netted me answer far. doesn't seem difficult, i'm missing something. i've added combinations of following: enable_star = 1 dict = keywords min_infix_len = 3 min_prefix_len = 3 note: did not prefix , infix @ same time. i have blown away , re-created indexes, re-started searchd , still no luck. if insert value such "wildcardtest" can following hit select * rtindex match('wildcardtest'); but else such as select * rtindex match('wildcardt*'); returns 0 results. i using 2.1.4 upgraded 2.1.9 no change. i upgraded 2.2.7 , tweaked config bit , working. the essential config option needed dict=keywords min_prefix_len/min_infix_len work, seem change behavior compared dict=keywords on own. searching same pattern various config options yields different results. i did have re-build disk-based indexes , attach (af

php - WooCommerce + Xero: Passing through the cart total issue -

we have site running at: http://www.presentu.co.nz the site running wordpress, woocommerce , xero plugin. the site has feature if user buys glass , uploads logo site, passes through 1 off fee. added in functions.php file as: add_action( 'woocommerce_before_calculate_totals', 'cp_add_custom_price' ); function cp_add_custom_price( $cart_object ) { global $woocommerce; foreach ( $cart_object->cart_contents $key => $value ) { //$proid = $value['product_id']; //$variantid = $value['variation_id']; //$price = $value['data']->price; $cartitemdata = $woocommerce->cart->get_item_data($value); // menu covers add logo $99 fee if (preg_match("/upload logo/i", $cartitemdata)) { $excost = 99; $woocommerce->cart->add_fee( 'logo set fee', $excost, $taxable = true, $tax_class = '' ); } // glassware add logo $35 fee if (preg_match("/yes, add log

reflection - AspectJ - Is is possible to extend an enum's value? -

say have enum public enum e {a,b,c} is possible add value, d , aspectj? after googling around, seems there used way hack private static field $values , call constructor(string, int) reflection, seems not working 1.7 anymore. here several links: http://www.javaspecialists.eu/archive/issue161.html (provided @wimdeblauwe ) and this: http://www.jroller.com/velkavrana/entry/modify_enum_with_reflection actually, recommend refactor source code, maybe adding collection of valid region ids each enumeration value. should straightforward enough subsequent merging if use git , not old-school scm tool svn. maybe make sense use dynamic data structure altogether instead of enum if clear in future list of commands dynamic. should go upstream code base. sure devs accept patch or pull request if prepared cleanly. remember: trying avoid refactoring bad smell, symptom of illness, not solution. prefer solutions symptomatic workarounds. clean code rules , software craftsmanship a

extjs - Generate Sencha Touch App Failed -

i'm having problem generating new sencha touch application. downloaded sencha sdk, ruby , sencha cmd. when use sencha sencha version , printed. when use ff command generate sencha touch application encountered build failed: sencha -sdk [sencha sdk location] generate app -name myapp -path [project location] issue: sencha cmd v5.0.1.231 [inf] processing build descriptor : default [inf] loading app json manifest... [err] failed resolve dependency ext.app.application file myapp.app.$application [err] [err] build failed [err] com.sencha.exceptions.exnotfound: unknown definition dependency : ext.app.application [err] @ org.apache.tools.ant.project.e [err] xecutesortedtargets(project.java:1399) [err] [err] total time: 1 second [err] [err] build failed [err] (installation dir)\bin\sencha\cmd\5.0.1.231\plugin.xml:303: following error occurred while executing line: [err] (installation dir)\bin\sencha\cmd\5.0.1.231\plugins\touch\2.3\plugin.xml:334: following error occurr

xml - Use a variable in XSLT select -

i trying make named template or function pass in node name , select last level of xpath expression. returns string pass in param. in below example value returned "name" xslt: <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/xsl/transform"> <xsl:output indent="yes"></xsl:output> <xsl:template name="get-prefered"> <xsl:param name="field-name"/> <xsl:variable name="vcondition" select="name"/> <xsl:variable name="x" select="sources/source[@type='c']/$field-name"/> <xsl:value-of select="$x"></xsl:value-of> </xsl:template> <xsl:template match="/"> <xsl:call-template name="get-prefered"> <xsl:with-param name="field-name">name</xsl:with-param> </xsl:call-temp

php - need help removing action from plugin file -

hello trying remove action wordpress plugin file. plugin called woocommerce points , rewards. have found action want remove in 1 of class files. when comment out "add_action" want. trying remove action functions.php in child them. have been reading on , think problem need "globalize" class variable action in; not sure class variable is… here code adds action (part of file): class wc_points_rewards_cart_checkout { /** * add cart/checkout related hooks / filters * * @since 1.0 */ public function __construct() { // coupon display add_filter( 'woocommerce_cart_totals_coupon_label', array( $this, 'coupon_label' ) ); // coupon loading add_action( 'woocommerce_cart_loaded_from_session', array( $this, 'points_last' ) ); add_action( 'woocommerce_applied_coupon', array( $this, 'points_last' ) ); // add earn points/redeem points message above cart / checkout add_action( 'w

linux - How to map a symbolic directory link to different directories based on user id -

is there way map symbolic link directory different directories based on user id in linux. instance if user x executes cd /var/www/html/ his/her directory gets changed /var/www/webx/ , while user y /var/www/weby . purpose of doing make web document directories transparent different apache users. thanks one line answer: no . linux filesystem not support conditional symlink evaluation of type envisioning. alternatives: => (programmatically) create symlinks in each user's home directory point required location in /var/www/ . example, in user x's home directory: ln -s /var/www/htmlx htmldir in user y's home directory: ln -s /var/www/htmly htmldir so each user can go cd htmldir , appropriate location. => use the per-user directory feature assign ~user/public_html or more generically, ~user/<some-name-consistent-across-users> html dir user .

uialertview - How to add buttons in alertView in different lines? -

i want create alertview shows 2 buttons- delete photo , cancel. want buttons appear in different lines. whenever try, them in same line. there no sdk support this. button appear in 1 per line if have more 2 button. 2 button in 1 line. but possible subclassing uialertview . apple says: the uialertview class intended used as-is , not support subclassing. view hierarchy class private , must not modified.

python - Flask templating and redirect issue -

i have page can click pre-selected image or upload own image. send users new page after either of actions completed. same page both actions. this code when user uploads image , subsequently sent new page, presents image: @app.route('/', methods=['get', 'post']) def upload_file(): if request.method == 'post': file = request.files['file'] if file , allowed_file(file.filename): filename = secure_filename(file.filename) file.save(os.path.join(app.config['upload_folder'], filename)) return redirect(url_for('uploaded_file', filename=filename)) return render_template('index.html') @app.route('/photo/<filename>') def uploaded_file(filename): return render_template('uploaded.html', filename=filename) to try , fit these images functions, tried changing url_for images, so: <img href="{{ url_for('uploaded_file') }}&quo

java - Tomcat connector architecture, thread pools and async servlets -

i understand tomcat's thread model bio , nio connectors. referencing official tomcat 7 documentaion connectors can found here . based on it, have in doubt: acceptorthread(s) : single or @ 2 threads (as mentioned in doc) responsible accepting in-coming connections. can configured using acceptorthreadcount , , it's suggested more 2 can used multi-cpu machine - why ? does imply number of simultaneous open connections scales number of cpus versus number of open file descriptors allowed on server system ? maxconnections(s) : what relation between setting , acceptcount , number of open file descriptors on system. why default value higher nio connector ( 10000 ) bio ( = maxthreads ) ? acceptcount : queue requests when request processing threads busy. when requests put queue, file descriptor assigned ? or when request being actively processed, consume file descriptor ? request processing threads : number of threads in pool configured maxthreads , minspa

regex - how to replace a string into an anchor tag in php -

i having of problem on how replace text anchor tag in text has text similar in href property of tag. the text should display below: //input $string = "text1 text2 text23 text24"; $tofind = "text2"; //output <a href="welcome_to_text2.php">text2</a> i used code below wrong output: <?php $fulltext = "text1 text2 text23 text24"; $tofind = "text2"; $string = explode(" " , $str); foreach($string $value){ $href = "welcome_to_{$tofing}.php"; $fulltext = preg_replace('/('.preg_quote($tofind, '/').')/i', "<a href=\"{$href}\">"."\\1"."</a>", $fulltext ); } echo $fulltext ; //it outputs <a href="welcome_to_<a href=""">text2</a> ?> text23 , text24 replaced since text2 occurs on both string. want replace text2 alone since match

php - Extract the date and month in codeigniter -

how extract date , month in codeigniter <?php echo $row->order_date; ?> this code return date in yyyy-mm-dd format .i want change format in mm-dd in codeigniter view. use datetime class try way $date = datetime::createfromformat('y-m-d', $row->order_date); $new_date_format = $date->format('m-d'); ps : suppose, order_date comming db recommand convert date in sql query.

AngularJS - select with zero(0) value -

select options are: `[ {statusid: 0, statusdesc: "new"}, {statusid: 10, statusdesc: "enabled"}, {statusid: 30, statusdesc: "inprogess"}, {statusid: 70, statusdesc: "done"} ];` in order display values have added option "all" value "" <select id="statusid" name="statusid" ng-model="search.statusid" ng-options="status.statusid status.statusdesc status in statuslist"> <option value="">all</option> </select> problem on selecting new value 0 display values while selecting all displays nothing. you can find sample code here. you need make 2 changes.. in itemslist json, status ids in string, convert them numbers. you have angular want strict comparaison. that's easy angular 1.1.5, because filter filter has third parameter, comparator, true useful shorthand. e.g. <tr ng-repeat="item in it

Elasticsearch Pattern_capture filter emits a token that is not matched with pattern also -

i have case have extract domain part emails found in text. used uax_url_email tokenizer create emails single. , have pattern_capture filter emit "@(.+)" pattern string. uax_url_email return words not email , pattern capture filter not filter that. suggestions? "custom_analyzer":{ "tokenizer": "uax_url_email", "filter": [ "email_domain_filter" ] } "filter": { "email_domain_filter":{ "type": "pattern_capture", "preserve_original": false, "patterns": [ "@(.+)" ] } } input string : " my email id xyz@gmail.com " output tokens: my, email, id, is, gmail.com but need gmail.com "if none of patterns match, or if preserveoriginal true, original token preserved." https://lucene.apache.org/core/4_4_0/analyzers-common/org/apache/lucene/analys

compare file content in folder using windows batch -

i've been struggling several days... there 1 folder lot txt files random names generated server timestamps, content of files must not identical 2 files in folder! ideas? option using windows batch @echo off setlocal set "sourcedir=u:\sourcedir" pushd "%sourcedir%" %%a in (*.*) ( %%c in (*.*) if /i "%%~nxa" lss "%%~nxc" if "%%~za"=="%%~zc" ( fc "%%a" "%%c" >nul if not errorlevel 1 echo "%%a" , "%%c" identical ) ) goto :eof you need change setting of sourcedir , of filemask *.* suit circumstances. revision only-one-mention-of-a-duplicate-file @echo off setlocal set "sourcedir=u:\sourcedir" pushd "%sourcedir%" %%a in (*.*) ( set "reported=" %%c in (*.*) if not defined reported if /i "%%~nxa" lss "%%~nxc" if "%%~za"=="%%~zc" ( fc /b "%%a" "%%c" >nul if not

php - Custom autoloader for project vs Composer PSR-4 -

i'm working on small framework has following directory structure: / -- app -- vendor -- framework-vendor -- framework-package -- src currently have in framework's composer.json 2 psr-4 instances: "autoload": { "psr-4" : { "frameworkname\\" : "src/", "": "../../../app" } } the goal of actual project located @ app can use classes in framework using \frameworkname\foo\bar\class own classes using \foo\bar\class . limitation relative depth between vendor directory , app directory. what's best way this? include second autoloader or enforce directory structure , let composer take care of generating autoloader? the solution not force relative path depth use autoloader returned composer this: $loader = require 'vendor/autoload.php'; $loader->add('', __dir__ . '/app/');

hadoop - Use of Group and roles in HDFS -

i new hdfs, when run hadoop fs -ls /tmp/data command , below output -rw-r--r-- 2 root root 52784 2014-08-01 09:52 /tmp/data/sample1.pdf -rw-r--r-- 2 root root 52784 2014-08-01 09:52 /tmp/data/sample2.pdf output wanna know which group? , use of group ? user? 1st root user , 2nd root group. group used group users under restrict access hdfs directories based on groups.

jQuery attribute name contains -

i'm trying target attributes names contains word & not in kind of way you're thinking. lets have: <div data-foo-bar="hello"></div> how can target elements have 'data-foo' in attribute name? i don't think can target attribute names same way target attribute values. can, however, use .filter() efficiently: $('div').filter(function() { (var property in $(this).data()) { if (property.indexof('foobar') == 0) { return true; } } return false; });​ notice data-foo-bar has been converted foobar . demo: http://jsfiddle.net/tyj49/3/

How to update ListView dynamically on each iteration of a sorting process in android? -

i have arraylist of 9 integer values. want sort arraylist based on ascending order of values. after each iteration, want display list in listview . after next iteration, listview should update result of new iteration. used below code sorting. dont know how refresh listview on each iteration. integer[] numbers = new integer[] {9,8,7,6,5,4,3,2,1}; arraylist<integer> numberlist = new arraylist<integer>(); numberlist.addall( arrays.aslist(numbers) ); list list = numberlist; //method sorting list dosort(numberlist); // create arrayadapter using number list. listadapter = new arrayadapter<integer>(this, r.layout.listdata, numberlist); // set arrayadapter listview's adapter. mainlistview.setadapter( listadapter ); } public static void swap(list<integer> sort, int i, int j) { int tmp = sort.ge

orchardcms - Taxonomies relation -

we new orchard. , we've created 3 taxonomies company , brand , model . brand has company field , model contains brand. now, defining contenttype named car has brand , model fields , in view: @* shape displays term , content items associated it. *@ @{ model.contentitems.classes.add("content-items"); } @display(model.contentitems) we can company's logo this: model.contentitem.companyterm.companylogo 2 questions: how possible access company's brands? and having brand how can retrieve brand's cars. first, please aware there high potential select n+1 squared issues here. your company terms content items, can parts , fields. should work if taxonomy field brands called brands , attached part same name term's type: model.contentitem.companyterm.companyterm.brands.terms each of terms content item, in same way, , if cars taxonomy field called cars on part named brandterm on brand taxonomy term type, should list of cars: bra

c# - MaxMind GeoIP Reader Dispose Issue - UnauthorizedAccessException on mmdb file following Reader.Dispose() -

i using maxmind.db.reader class access geolite2-city.mmdb file , having file access issues performing actions on file after calling dispose on reader. the simplest way reproduce issue have console application, similar maxmind.db.benchmark project, has static instance of reader class, in case called _cityreader. now, if set _cityreader variable new instance of reader call dispose on (i set null) move file (moving works fine) call delete on file's new location unauthorizedaccessexception on delete operation... _cityreader = new reader(@"c:\temp\maxmind\active\geolite2-city.mmdb", fileaccessmode.memorymapped); _cityreader.dispose(); _cityreader = null; file.move(@"c:\temp\maxmind\active\geolite2-city.mmdb", @"c:\temp\maxmind\active\geolite2-citymoved.mmdb"); file.delete(@"c:\temp\maxmind\active\geolite2-citymoved.mmdb"); what i've found if use reflection call dispose _cityreader._stream.value property in scenario before calling

php - Can't echo different from each row -

i attempting echo piece of information database. each row has different value , need able echo each value. having trouble doing so. had got working before get it. $query = "select itemname,defindex,maxamount,sellprice,buyprice,stock,image,type pricestorage order `itemname` asc"; $result = mysqli_query($con,$query); $resultset = mysqli_fetch_array($result, mysqli_both); foreach ($resultset $id => $row) { echo $row["itemname"]; } i know stupid, have been trying figure out couple of hours , can't. from docs : fetch result row associative, numeric array, or both mysqli_fetch_array fetchs 1 row, should like: while($row = mysqli_fetch_array($result, mysqli_both)) { echo $row['itemname']; } in way rows fetched in while loop , echoed, can iterate row values foreach if that's want.

java - Parsing XML attributes from Complex Empty Elements -

i have xml file in following pattern contains few complex empty elements (elements no content, attributes). <items> <item id="0" name="a" /> <item id="1" name="b" /> </items> i'm @ lose parse attributes them. have done far : documentbuilderfactory factory = documentbuilderfactory.newinstance(); documentbuilder builder = factory.newdocumentbuilder(); document document = builder.parse(inputstream); element itemselement = document.getdocumentelement(); if (itemselement.gettagname().equals(tag_items)) { nodelist nodelist = itemselement.getchildnodes(); (int = 0; < nodelist.getlength(); i++) { // process each item node node node = nodelist.item(i); if (node.getnodetype() == node.text_node) { // right way? text text = (text) node; // stuff attributes } } } i cannot cast these text nodes element nodes , attributes, cannot attributes n

java - Null pointer exception in an if statement in JSP? -

i have jsp program deducts stocks given user input. there 3 branches available (example b1, b2, , b3). form given user ask item code, branch borrow , number of stocks borrowed. connected database update tables after deduction. i have if statement compares user's choice of branch borrow , real branch determine query executed. i no errors until go update form says have nullpointerexception on if statement. i've been trying solutions nothing seems me solve problem. it appreciated if me on one. here's code if statement. if (strbranch.equals("binangonan")) { ps_binang.executeupdate(); ps_aupdate.executeupdate(); } else if (strbranch.equalsignorecase("tanay")) { ps_tanay.executeupdate(); ps_aupdate.executeupdate(); }

c# - Report if one value is null don't show other value -

Image
i'm trying build report asp.net report. if check image: i'm showing table tickets , charge. charge column has these value: =fields!charge.value what want achieve show charge value if ticket value not null. see in image, there 4 tickets visible , want show charge 4 tickets not charges. any idea how can achieve that? you can use following in charge column =iif(isnothing(fields!ticket.value), "", fields!charge.value) it should have worked otherwise can try fields!ticket.value == "" or fields!ticket.value.tostring() == ""

css - vertically align for floated element -

fiddle i've following markup: <div id="all"> <div id="one">one</div> <div id="two">two</div> <div id="main">main para goes here</div> </div> and following css: #all{ height: 300px; background: red; } #one{ float: left; } #two{ float: right; } #main{ margin: 0 auto; width: 250px; } i wanted align vertically no success after using pseudo technique. vertical alignment should work @ least ie8. please note: can't change markup. means can't avoid using float. so, there way make success? well, using css floats gives no chance align floated element vertically in container (regardless of using css flexible box method) . hence i'd go inline-block s can align them vertical-align: middle declaration. so far good, #two element must positioned @ right side of container without using css floats. hence have specify width of columns to reorder

python - admin.autodiscover() throwing TypeError in urls.py class -

i'm running strange error don't know how fix. upgraded ubuntu 14.04 (which apparently upgraded python well) , django started throwing typeerror when have admin.autodiscover() method uncommented in urls.py file. when comment it, site works fine, however, lose admin access edit admin interface. traceback , requirements below. thanks! traceback file "/home/bram/.virtualenvs/viso_project/local/lib/python2.7/site- packages/django/core/handlers/base.py" in get_response 99. resolver_match = resolver.resolve(request.path_info) file "/home/bram/.virtualenvs/viso_project/local/lib/python2.7/site-packages/django/core/urlresolvers.py" in resolve 337. pattern in self.url_patterns: file "/home/bram/.virtualenvs/viso_project/local/lib/python2.7/site-packages/django/core/urlresolvers.py" in url_patterns 365. patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)

java - org.w3c.dom.DOMException: WRONG_DOCUMENT_ERR: Web Service error. Soap Exception -

by using wsdl2java, executed methods wsdl. these methods include remote exceptions. when run program, gives error written on tittle. expecting soap exception because when made request on soap ui, see soap exception in xml format. code snipped that: try { enrollresponse = server_service.enroll(enrollparameters); } catch (remoteexception e) { logger.fatal(e.getmessage); } error: org.w3c.dom.domexception: wrong_document_err: node used in different document 1 created it. i think problem program respects determined xml format, soap exception in different format. therefore gives error. under remoteexception cannot reach xml format of soap exception. how can reach exception? please check version of axis jar. this issue had been patched axis 1.3 not axis 1.4. please refer link https://issues.apache.org/jira/browse/axis-2705

php - Autoloading two vendor projects with composer at the same time -

i've 2 projects (project1, project2) composer set correctly, own composer.json { "require": { "wp-cli/wp-cli": "0.15.1" } } now, in php file autoload them via require_once 'project1/vendor/autoload.php'; require_once 'project2/vendor/autoload.php'; and error fatal error: cannot redeclare cli\render() (previously declared in /private/tmp/php/project1/vendor/wp-cli/php-cli-tools/lib/cli/cli.php:26) in /private/tmp/php/project2/vendor/wp-cli/php-cli-tools/lib/cli/cli.php on line 28 is problem of wp-cli or issue composer? i've tried library such monolog fine. any idea? you shouldn't use composer autoloader twice. there simple solution: in third project, create new composer.json , include 2 other projects there. then include autoloading of third project. there no duplicate classes involved. should work if configured correct autoloading not libraries use in of 2 projects, classes in th