Posts

Showing posts from January, 2013

php - WordPress update post meta data (custom field) by post link -

i have post in wordpress website, has lot of custom fields. have excel sheet "post link" - "custom field data" combination. custom field(video url) set each post, need change , update links appropriate excel sheet. not have "post_id - post metadata" combination, link , appropriate metadata value. is there way update these data plugin or code? you need write , execute wp command . save spreadsheet csv file , use fgetcsv() iterate through it. each entry find post using url_to_postid() , update metadata needed.

ajax - Is this C# await superfluous? -

i understand threading extent, in practice have little experience. in looking @ code maintaining, seems await provides no benefit. calls method via ajax , happen when user clicks export link. since method nothing else, don't see advantage await , instead imagine introduces overhead. believe other users clicking export entering method own thread, right? might useful if single user clicked export many times, quickly? thank you. [preventlogging] [httppost] public async task<jsonresult> getactivityreportcallsasync([datasourcerequest] datasourcerequest request) { try { var result = await getallcallsasync(); return json(result.todatasourceresult(request)); } catch (exception exc) { return jsonshowmessage(false, servermessagetype.error, exc.message); } } it seems await provides no benefit you may want take @ async on asp.net msdn article . in it, enumerate number...

regex for input number and . allowing commas -

i have form submission have person enter amount. i have working fine reject $ , numbers allowing commas , cannot seem stop doing this. the code coldfusion not cf issue regex one. <cfinput type="text" name="sp_price" value="0" message="add-on price - numbers only" validate="regular_expression" pattern="^[0-9].*$" required="no" size="5"> accepts 1000 1000.00 , 1,000.00 , 1,000 , don't want commas accepted. thanks in advance andy if want exclude characters, format [^,] example: pattern="^([0-9]|[^,$\w])*$" edit: excludes dollar , word characters https://regex101.com/r/tk5zu7/1

chef - knife-windows is definitely installed but bootstrap still fails -

i have installed knife-windows. chef gem list shows knife-windows when run bootstrap i'm told it's not installed. sudo -u user -h sh -c "cd /home/user/chef-repo/; chef gem list" sudo -u user -h sh -c "cd /home/user/chef-repo/; knife bootstrap windows winrm $vmip -r 'role[build_server]' -x 'domain\user' -v -p 'password'" output first command shows: knife-windows (0.8.5, 0.8.3) second: info: using configuration /home/user/.chef/knife.rb warning: hostname containing 'windows' specified. please install 'knife-windows' if attempting bootstrap windows node via winrm. doing old-style registration validation key @ /home/user/.chef/myserver-validator.pem... delete validation key in order use user credentials instead is there obvious i'm missing? cheers looks chefdk setup incomplete, because sudo command calls /usr/bin/knife looks rubygems-based knife , not chefdk. please make sure add chefdk $...

sql - Comparing consecutive rows using oracle -

i have table looks this: | id | from_date | to_date | ------------------------------ | 1 | 1/1/2001 | 2/1/2001| | 1 | 2/1/2001 | 3/1/2001| | 1 | 2/1/2001 | 6/1/2001| | 1 | 3/1/2001 | 4/1/2001| | 2 | 1/1/2001 | 2/1/2001| | 2 | 1/1/2001 | 6/1/2001| | 2 | 2/1/2001 | 3/1/2001| | 2 | 3/1/2001 | 4/1/2001| it sorted id , from_date , to_date . what want delete rows from_date earlier to_date previous line , id equal id previous line. in example, delete 3rd , 6th rows only. i know need kind of looping structure accomplish this, don't know how since i'm looking @ 2 rows @ time here. how can accomplish within oracle? edit: using 'lag' function quicker , easier, end deleting 4th , 7th rows - not want do. example, when gets row 4 , should compare 'from_date' 'to_date' row 2 (instead of row 3, because row 3 should deleted). you use lag window function identify these rows: delete mytable rowid in (select rowid ...

How to make python interprets foo a b c as foo('a','b','c') -

i new python , used matlab command window's auto interpretation. is there anyway can make python interpreter interpret >>> foo b c as >>> foo('a','b','c') ps, know user input , parsing want python shell/idle/console/interpreter understand this. ipython might provide closest solution. manual: you can (after enabling %autocall magic command) in [1]: callable_ob arg1, arg2, arg3 which equivalent callable_ob(arg1, arg2, arg3) this not possible in regular python interpreter or scripts however.

regex - New line character representation in Java -

this question has answer here: how split java string @ backslash 6 answers i have field in database looks this abcd.\nefgh on java side, variable (message), , need split variable on 2 parts: first , second. something this: message="abcd.\nefgh" ;//this not happens ??? first = //anything before '\n' second = //anything after '\n' i tried following if(message.indexof('\n')>-1){ first = message.substring(0, message.indexof('\n')); second = message.substring(message.indexof('\n')) ; } however, code never enters body of if statement. checked debugger, , reveals message variable indeed abcd.\\nefgh so, tried use of string.split method, string rabit = "abcd\\nefgh" ; system.out.println("results \n "+ rabit.split("\n")) ; //1 //and alternative system.out.println("...

version control - Update files from an exported Git repository offline -

let me describe scenario first , of needs occur without connecting internet. windows method preferred on linux. a client has version of our software hand delivered cd. after number of pushes made on our repository, client receive these updates files without having redeliver files. have deliver copy of repository , have git update older files current state. access history or branches not necessary, current version of each file required copied. so question, best (easiest) method update separate offline files current external repository state? i have read of few possibilities not understand differences or capabilities of them or exact process , commands. furthermore, every example have found uses https: transfer files. 1) remote add, remote update, merge 2) clone repository user pull 3) git archive create tarball 4) bundle appears un-pushed commits. it extremely helpful have cmd commands written out if possible. if understood case can generate patch file usi...

favicon - Bookmark Icon for a website -

Image
i have favicon on website, , shows on address bar. curious how these big icons when bookmark page. different thing or did favicon wrong? as can see, behance, linkedin, , others have big icon when bookmarked , website on left has none. <link rel="icon" href="icons/favicon.ico"> you need different icons: safari on mac os yosemite (apparently, using): takes apple touch icon . @ least, make sure create 180x180 icon. chrome: since few versions, chrome takes open graph image (the same icon use indicate facebook image use when visitor shares page). note chrome might take else if can't find og image. rules not clear. some other browsers: apparently, browsers, such firefox, have default icons famous web sites generate miniatures other bookmarks. can't 100% sure of this, couldn't find documentation that. guess work.

xcode - Sprite Kit SKS file not working -

every sks file in every game project has problem. when open it, default color doesn't show. shows previous file yellow rectangle. can't see nodes make, or edit them. can select them. when double-click sks file, new window says "no editor" yellow rectangle. if run mac in vmware, happen. if upgrade el-capital, , install xcode (from 6.4 7.3.1), xcode shutdown if click .sks file. , shutdown if create .sks file (in resource). sometime, can open .sks file still nothing there. emitternodes no way exist in vmware. so, when run app in real iphone, make error cametallayer: calling display has no effect. i think not vmware, because of mac retail installed. the author of mac retail make explore osx, not osx. and, applications know have mistakes (that need updates). or wait new mac retail or not use .sks file (it not change game anymore) or buy macbook. (or imac certainly)

javascript - Hide an element in a class - where do I add the code to hide the element? -

i've discovered post want accomplish on owncloud server - hide second element within class from suggested answers (there many), last comment said following needed: .fileactions > a:nth-child(2) { display: none; } my question is...where put bit of code? can't tell answer put this? have .js file in owncloud called fileactionsspec.js. it's place i've found code words action-download in them. add code: .fileactions > a:nth-child(2) { display: none; } to end of .js file? thanks. you not supposed put in js file. need add in css file, say: style.css , style.css file should referenced as: <link rel="stylesheet" href="style.css" /> the above code has added <head> section of html page. if need js approach, need add this: var css = '.fileactions > a:nth-child(2) {display: none;}', head = document.head || document.getelementsbytagname('head')[0], style = document.createeleme...

html - Responsive Design resizing on desktop, not on mobile -

i'm using media queries resize site elements based on width. developing , testing on desktop works perfectly, launched , tested on mobile (an iphone 5) not resize @ - displays @ full width. i have searched around responses , general consensus seems to set viewport. have done — in header have: <meta name="viewport" content="width=device-width, initial-scale=1"> is there may have may overriding this? my media queries this: @media (min-width:320px) { /* smartphones, iphone, portrait 480x320 phones */ #rlanguage {position: relative; right:0; border:red solid 0px;} #ix-nav {position: relative; right:0; border:red solid 01px;} #infoemail {display:none} #mainmenu {display:none} #mobilemenu {display:inline} #desktoponly {display:none;} #menuspacing {width: 1px;} #ix-footer {width: 100%; height:auto} .greenmenuline {background:#000} .rootvoices td....

Netlogo- Creating agents with traits from .csv files -

Image
i'm attempting populate world agents traits csv file. file looks this: i'm pretty fluent in other areas of netlogo first time diving in external data inputs. i've looked in other places , other topics populating list of data. official , dictionary seem have big differences pre-and post- v 5.1 i'm not sure if guides i'm finding accurate latest version. i don't particularly care if large list (or list of lists) produced or if while reading data line-by-line, wipes previous lines' data after producing agent. i've tried using given here: http://netlogoabm.blogspot.com/2015/05/connecting-or-linking-turtles-from-csv.html but seems throw errors since data not numbers. appreciate assistance. i believe can modify example match problem, in summary first read file global list, extracted number of agents, assigned properties of agents @ each tick , ran simulation: extensions [csv] breed [drivers driver] turtles-own[ name ...

jquery - How to access MVC PartialView Model in Javascript? -

for accessing model of view javascript can use var additional = '@html.raw(json.encode(model))'; but how model of partial view main view? the problem i'm facing load partial view keno ui window widget via jquery ajax call, inside partial view have upload widget , has event ( ie: onupload event ) , if put onupload event inside partialview, doesn't recognize it. had put in main view. in case '@html.raw(json.encode(model))' return model of main view , not partial one. any ideas on how resolve problem? this way have access of model: var model = function () { return @html.raw(json.encode(model)) }(); the partial view has model: @model somemodel <script type="text/javascript"> $(document).ready(function() { var model = function () { return @html.raw(json.encode(model)) }(); }); </script>

html - Bootstrap 3, retina displays and col-lg -

i using twitter bootstrap 3 , have 2 different column settings on div: <div class="col-md-10 col-lg-8 col-centered"> i set col-lg-8 large desktop screens , col-md-10 medium screens , laptops. issue when using retina macbook 13", large screen detected due high resolution , wrong column class applied. how fix col-md-10 used on retina macbook? you're going have customize , download suitable version of bootstrap 3.3.4 modify media query breakpoints encompass correct resolutions. right now, bootstrap's breakpoints defined as: @screen-xs: 480px; @screen-sm: 720px; @screen-md: 992px; @screen-lg: 1200px; if visit http://getbootstrap.com/customize/#media-queries-breakpoints , can customize these values fit macbook correctly.

java - Jython JTable PrepareRenderer Runtime error Maximum Recursion Depth -

i have been working on burp suite extension jython library. new working java swing , jtables. have been trying debug error quite time. not sure issue is. invoking objects , methods correctly. here snippet of code in question: def build_tasks_table(self): class taskstable(jtable): def preparerenderer(self, renderer, row, column): #print(type(renderer)) print("{} , {}".format(row, column)) component = super(taskstable, self).preparerenderer(renderer, row, column) the error appears when navigate tab in question in extension is: runtimeerror: maximum recursion depth exceeded (java stackoverflowerror) the error happens on last line, never makes past. recursively calls preparerenderer method again , again. any appreciated, can provide info needed debug problem. solved: i calling super methods incorrectly. the fix was self.super__preparerenderer(renderer, row, columns) cheers

hudson - Jenkins: Post build actions on conditions -

Image
i want run post build actions in jenkins job on condition if string or regular expression present in console log. plugin available this? one solution use logparser plugin , create regexp rules parse log. this plugin can change build status unstable: next, create downstream job , use parameterized trigger plugin pass build status upstream downstream job. if status unstable (= logparser find something), execute specific post build actions. you can use conditional buildstep plugin condition downstream build step according upstream build status.

mocking - Supressing or Whiteboxing issue -

i have logger private static final utilizes server. suppress logger method debug, or suppress , interactions variable. declare logger in loggingclass private static final logger logger = loggerfactory.getlogger("loggingclass"); the javadoc debug : public abstract void debug(string s, object aobj[]); in test class have tried: powermockito.suppress(powermockito.method(logger.class, "debug", string.class, object[].class)); problem : throws toomanymethodsexception =========== logger nulllogger= null; loggingclass lc= new loggingclass(); //this class uses logger whitebox.setinternalstate(lc, "logger",nulllogger); problem: throws whitebox can not find instance field logger. any assistance appreicated try below suppress(everythingdeclaredin(loggerfactory.class)); the import statements are import static org.powermock.api.support.membermodification.membermatcher.everythingdeclaredin; import static org.powermock.api.suppor...

javascript - bootstrap input dropdown keyboard arrow -

i working combobox ( input + dropdown ) built around bootstrap on accessibility project. i ran change made dropdown.js part of bootstrap between v3.3.0 , v3.3.1 breaks code. when focus input , or down keyboard arrow used trigger dropdown menu want since goal make keyboard-only navigation possible doesn't work anymore. when compare : https://maxcdn.bootstrapcdn.com/bootstrap/3.3.0/js/bootstrap.js and https://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/js/bootstrap.js the change ( 3.3.0, line 798 ) dropdown.prototype.keydown = function (e) { if (!/(38|40|27|32)/.test(e.which)) return to ( 3.3.1, line 799 ) dropdown.prototype.keydown = function (e) { if (!/(38|40|27|32)/.test(e.which) || /input|textarea/i.test(e.target.tagname)) return so, know can work around jquery there real reason change ? if not, can regarded bug report. below bootply demo of widget. works bootstrap 3.3.0 , below if change bootstrap version popup above 3.3.0, doesn't respond arrows key...

javascript - Disable Tooltip Gradient -

Image
i pass multiple parameters tooltip , , wrote following code placeholder. however, tooltip background color not uniform, there gradient. how disable ? chart.options.tooltip.template = "name : anyname<br> first value: value 1 <br> second value: value 2"; i believe k-chart-tooltip specifying background-image: try adding css rule: .k-chart-tooltip { background-image: none !important; }

jquery - Change css background color of body, everytime button is clicked -

i webpage background color change between few colors (possibly more have input here) every time button clicked. here code have far: var colors = ["rgba(86,175,99,0.6)", "rgba(86,175,222,0.6)", "rgba(0,0,0,0.6)"]; var randomcolor = colors[math.floor(math.random() * colors.length)]; jquery(".rotator").click(function () { jquery('body').css("background", randomcolor); }); it seems code not repeat itself. stuck how this. thanks your random color generation execute once because declare variable outiside of click event. generate random color inside click event. jquery(".rotator").click(function() { var randomcolor = colors[math.floor(math.random() * colors.length)]; jquery('body').css("background", randomcolor); }); fiddle

javascript - How do I get ng-select to update when scope is changed? -

i have table above form, when row selected populates form data. form has select element. upon first row in table being selected, data populates correctly , correct selected option shown. on second , subsequent selection correct selected option not shown. in chrome dev tools can see values update properly, not visually shown. what missing? how correct option visually shown? <select name="updatecategory" ng-model="selectedpermission.permission.category_id"> <option value="{{cat.id}}" ng-selected="cat.selected" ng-repeat="cat in selectedpermission.permission_categories"> {{cat.name}} </option> </select> here function in controller updating scope. $rootscope.$watch('toolbarselectedvalue',function(){ if($rootscope.toolbarselectedvalue >0){ permissions.getitem($rootscope.toolbarselectedvalue).then(function(res){ ...

osx - Installing Homebrew from process running as root -

i have process running in client's mac root able run commands in it. need have process install homebrew in machine , subsequently install other packages using brew command. the problem having brew not allow me install , seems cannot use brew command using root. i appreciate this. thanks. install stuff using homebrew in account other root, , put path created homebrew root's path.

Celery worker with Redis broker can't execute Django task -

i'm learning python(2.7)/django(1.5) these days via developing own reddit clone (on ubuntu 14.04 lts). i'm trying incorporate celery(3.1) redis mix, using periodically run ranking algo task (on local set up). unfortunately, can't simple task execute once! can me spot i'm doing incorrectly? here's directory structure : -unconnectedreddit (manage.py here) -links (tasks.py, models.py, views.py, admin.py) -unconnectedreddit (celery.py, __init.py___, settings.py, urls.py) -static -templates celery.py : from __future__ import absolute_import import os celery import celery django.conf import settings os.environ.setdefault('django_settings_module', 'unconnectedreddit.settings') app = celery('unconnectedreddit', broker='redis://localhost:6379/0', backend='redis://localhost:6379/0',include=['unconnectedreddit.links.tasks']) app.config_from_object('django.conf:settings') app.autodisc...

OpenShift, Node.js and Forever -

good day. i know if exist way of using node.js forever module in openshift. try install due don't have root permissions, cannot make global install, , using locally doesn't work. as additional information, i'm using custom node.js cartridge, 1 found here https://github.com/ramr/nodejs-custom-version-openshift . thanks.

Is this correct (JavaScript prototype property)? -

here created function used constructor other clones. aside properties arguments, caller, length, name, __proto__(link function.protoype) created, prototype property created. property points object assigned prototype instances created when function invoked when using new keyword. function clonetrooper(id, rank, yearsofservice, type){ if (!(this instanceof clonetrooper)){ return new clonetrooper(id, rank, yearsofservice, type); } this.id = id; this.rank = rank; this.yearsofservice = yearsofservice; this.type = type; } so when this: clonetrooper.prototype.hasutilitybelt = true; clonetrooper.prototype.haslightsaber = false; i adding properties on clonetrooper prototype property. 1 one. but if this afterwards: clonetrooper.prototype = { name: null hasdroid: null }; i have overwritten link clonetrooper's constructor replacing new object links object.prototype. so question is, last syntax indeed overwriting prototype property? so 1 should plan o...

c++ - Configured TTL for A record(s) backing CNAME records -

i'm using libresolv fetch list of authoritative nameservers domain , query 1 of nameservers directly resolve host. that way, can configured ttl record , choose refresh dns records in code @ ttl. however, i've run snafu in i'm not sure how handle hosts refer cnames. example, output www.microsoft.com looks this: ; <<>> dig 9.7.3 <<>> www.microsoft.com ;; global options: +cmd ;; got answer: ;; ->>header<<- opcode: query, status: noerror, id: 3870 ;; flags: qr rd ra; query: 1, answer: 5, authority: 8, additional: 7 ;; question section: ;www.microsoft.com. in ;; answer section: www.microsoft.com. 5 in cname toggle.www.ms.akadns.net. toggle.www.ms.akadns.net. 5 in cname www.microsoft.com-c.edgekey.net. www.microsoft.com-c.edgekey.net. 5 in cname www.microsoft.com-c.edgekey.net.globalredir.akadns.net. www.microsoft.com-c.edgekey.net.globalredir.akadns.net. 5 in cname e10088.dspb.aka...

swift program to get files from url to play as well as for download -

i'm want play files url, , url saved in array , play them online . no idea how appreciable. fatal error coming `override func viewdidload() { super.viewdidload() let url = nsurl(string: " http://royalwap.net/48-740090s/na%20na%20na%20na.mp3 ") let urlrequest = nsurlrequest( url: url! ) var error: nserror? = nil nsurlconnection.sendasynchronousrequest(urlrequest, queue: nsoperationqueue(), completionhandler: {response, data , error in if error != nil { println("there error") } else { self.player = avaudioplayer(contentsofurl: url , error: nil ) self.player.play() }}) }` use avplayer stream audio url, wont able avaudioplayer unless download it. let url = nsurl(string: "http://royalwap.net/48-740090s/na%20na%20na%20na.mp3")! let playeritem = avplayeritem(url: url) player = avplayer(playeritem: playeritem) player.play()

linux - Sudden PHP parse error on RHEL -

i have various php files, none of have been modified prior app working , breaking. problem reason, these files throwing php parse errors things 'unexpected' square brackets in seemingly random places throughout file, upon manually checking file, syntax correct. the thing did have 'altered' files various chmod operations change permissions. how/why change actual content of files? the files called on boot have been, , have worked fine in past, until recent chmod changes. is permanent, or have restore system earlier time? rhel 6.5, php 5.4. edit: example of error: php parse error: syntax error, unexpected '[' in /var/ptc/crm-dev/tools/init on line 122 what's on line 122: $files = []; another example: php parse error: syntax error, unexpected '[', expecting ')' in /var/ptc/crm-dev/vendor/react/promise/src/functions.php on line 68 what's on line 68: return resolve([]); but these files haven't been changed...

c# - :Set project application settings to defaults -

i'm trying use application setting in c# project. however, properties.settings.default.reset() sets properties system defaults (a string set null , not value set base). is there way set default values properties can call method set them default? edit : question concerns setting default individual properties, not of them together. you can specify defaults user settings visual studio, in properties window of project, in settings tab. enter in value column. the values specify saved in app.config, in usersettings section (you can edit them there, too), , used when calling properties.settings.default.reset() . to understand happens: when call save() , current values of user settings saved in file under user profile folder in windows, , when call reset() values app.config file application folder used overwrite them. if want reset individual setting (somesetting) default, do: settings.default.somesetting = settings.default.properties["somesetting"].de...

svn - How can I skip special kind of files while cloning a remote subversion repository? -

how can skip on fly static files images or documents don’t need while cloning remote subversion repository? i guess, mean checkout when 'clone'? if have unwanted files in 1 directory, can use sparse checkout ( http://svnbook.red-bean.com/en/1.7/svn.advanced.sparsedirs.html ). but if unwanted files scattered around repository, then... don't think possible

ios - Get the upcoming month from NSArray -

i have array month , year.for ex array {jan 2015,feb 2015, june 2015, september 2015}. want index of current month , getting it. if there no current month, want upcoming recent month.in above example want index of september 2015. help appreciated. below code index of current month. if ([titlemonth isequaltostring:currentmonth]) { indexnumber=[[self.databymonth valueforkey:@"title"]indexofobject:currentmonth]; } here getting current month nsdate. create nsdatacomponents first, need fill array nsdatecomponents objects. @ this method in particular. for example. create nsdatecomponents current month. nsdatecomponents *datecomponents = [[nscalendar currentcalendar]components:(nscalendarunitmonth | nscalendarunityear) fromdate:[nsdate date]]; then fill array these components. loop through array until current month , year equal or lesser looping month , year. if equal, have current month. if lesser, item in array next month/year. ...

ios - what laguages needed for making music app? -

i new programming world , want make ios music app, wondering programming languages need learn? databases can use store music , languegs need fetch data? i suggest use: xcode - program programming in. swift or objective-c - language used ios. swift new language there more tutorials , stackoverflow questions search on objective-c. parse - parse.com offers free(in beginning) , easy use backend mobile development. there tones tutorials learn from: this site: http://www.appcoda.com/ios-programming-course/ and maybe 1 you. http://www.raywenderlich.com/69369/audio-tutorial-ios-playing-audio-programatically-2014-edition

Can the constants be defined inside a model file of a framework in PHP? -

i'm using phpfox framework. i've define 2 constants used 2 functions present within model class file. can define constants @ beginning of model class file or cause issue or against coding standards? please me in regard. following 1 method model class file. i want write following code : <?php /** * [phpfox_header] */ /*header('content-type: text/event-stream'); header('cache-control: no-cache');*/ defined('phpfox') or exit('no dice!'); /** * * * @copyright [phpfox_copyright] * @author raymond benc * @package phpfox_service * @version $id: service.class.php 67 2009-01-20 11:32:45z raymond_benc $ */ class notification_service_process extends phpfox_service { /** * class constructor */ public function __construct() { $this->_stable = phpfox::gett('notification'); } public function add($stype, $iitemid, $iowneruserid, $isenderuserid = null) ...

SQL Server 2012 Results Grid -

is possible perform basic calculations on results grid, such column totals? this make easier compare results when editing queries. i'm assuming results grid, mean when select query such 'select * table' in sql management studio. if case, no, can't. best thing can is, use 1 of aggregate functions on column(s) want calculation on such 'select sum(columnname) table' give sum of values in column. list of sql aggregate functions: https://technet.microsoft.com/en-us/library/ms173454(v=sql.110).aspx

Netlogo giving attribute value of agent based on value of patch and slider parameter (2) -

Image
so, previous question want make buycapability attribute of agents. attribute consists of 3 categories high middle , low. there 3 threshold values of buycapability >= 50 (low), 50>m<=100 (middle) , >100 (high) determined 2 sliders. besides, agent stays on patch has land-price attribute. so, buycapability determined land-price , threshold values. example, if land-price of agent's patch greater 100(slider buycapability_high value) agent's buycapability high , on in procedure to-set-income-resident. below code code use far, create or make buycapability categorization. unfortunately, result of code buycapability attribute af agents low, there no other that. though land-price greater 100 should high it's not. please me find might wrong code or other possibility. patches-own [value empty] turtles-own [income myhouses ] setup ca ;;check inputs let total-prob prob-rendah + prob-sedang + prob-tinggi if (total-prob != 100 ) [ ...

sql server - Multiple Indexes vs Multi-Column Indexes -

i've been adding index table in sql server 2005 , got me thinking. difference between creating 1 index , defining multiple columns on having 1 index per column want index. are there reasons why 1 should used on other? for example create nonclustered index ix_indexname on tablename (column1 asc, column2 asc, column3 asc) versus create nonclustered index ix_indexname1 on tablename (column1 asc) create nonclustered index ix_indexname2 on tablename (column2 asc) create nonclustered index ix_indexname3 on tablename (column3 asc) i agree cade roux . this article should on right track: indexes in sql server 2005/2008 – best practices, part 1 indexes in sql server 2005/2008 – part 2 – internals one thing note, clustered indexes should have unique key (an identity column recommend) first column. helps data insert @ end of index , not cause lots of disk io , page splits. secondly, if creating other indexes on data , constructed cleverly reused. e.g. im...

javascript - update native google maps app from a web app -

can have web app running, , native google maps app launched web app running on droid, , have actions performed user on web app automatically update native map app? ex. user clicks link on web app. query string values in address feed maker points maps app , launches in native app rather browser if user chooses that. then, user goes web app, makes changes. when user goes map app, changes on web app reflected in map app via sort of push notification system web app native map app. is @ possible do? if talking web app runs on same devices, can @ least use url scheme open native maps app. there seems have no way returning information web app. (well, sign-in app, there seems connection , data sharing between signed in devices, not sure how works.) but ultimate solution can think of question develop own version of maps app, should app use google maps api same thing google maps does, sync data backend web server.

windows - start-dfs.sh namenode start name or service not knownstname 0.0.0.0 -

Image
i want install hadoop on windows cygwin , can see interface localhost:8088, problem start-dfs.sh , see error : name or service not known .. , , can't acces localhost:50070 or :50030 . the first error fine , i've worked in linux , problem second error . add when type hadoop namenode , fine except in end : thank you.

java - CipherInputStream how to turn on/off the cipher for different bytes you are reading -

i trying read file has data encrypted , not encrypted. start of each message has unencrypted header contains byte size of encrypted message follows. my class read extends fileinputstream , override read operation. when create stream class, pass in cipher constructor. in read(), need able turn cipher on/off different bits in file buffer. is there way turn on/off cipher when performing read? thank you as far know, can't this. you'd have split data.

How to call Form_Load of one form from another form in Access VBA -

i have ms access form displays list of records in grid . each row having detail buttton. when clicked on , opens new form details of particular selected row. when click on close button of detail form , the values saved database. now , on click of close , to execute form load of main form . because need refresh values after update made in detail form i have tried thing : call forms!frm_package!form_load please suggest on how accomplish . have tried various ways not worked. please let me know if further information required. the reason not " re-call " load because private sub , when inside form can access method. one way hack " external procedure call " move code inside form load public sub (withing same form) , calling newly created sub outside form. like, private sub form_load() msgbox "hello world" end sub to private sub form_load() newpubmethod end sub public sub newpubmethod() msgbox "hello wo...

tfs - using Visual Studio Community with Team Foundation Server -

can use visual studio community team foundation server express? our development team looking low cost ways of developing applications , wondering if possible? team of 5. thanks yes can, still need installed on server. should use visual studio online (cloud based tfs) provides 5 users free... http://tfs.visualstudio.com

angularjs - Directive inside a angular-translate translation -

i'm using angular-translate i18n , want use directive inside translation: var translations = { test_1: 'hello <a href="/test">test</a>', test_2: 'hello <user></user>' }; app.directive('user', function() { return { template: '<a href="/test">test</a>' }; }); full plnkr example: http://plnkr.co/edit/jcccvx7ieaayuwyaq7uh?p=preview so <p translate="test_1"></p> <p translate="test_2"></p> should same. first (without directive) works, second doesn't. transcludes <user></user> , angular doesn't seem aware of , doesn't directive magic. try use translate-compile directive: <p translate="test_2" translate-compile></p> from docs : starting version 2, translation can post processed in context of current scope (using $compile). means directive used in translation value ...

ruby on rails - Mongoid pluck function not working as expected on subdocuments -

i have mongo shell query working , im trying duplicate mongoid. here works in mongo shell db.getcollection('accounts').find({field1: 'test'}, {'field1': 1, 'subdocs.field2': 1}) according this answer, pluck method should work, returns nil subdocs.field2 though there value in document. >>account.where(field1: 'test').pluck(:field1, 'subdocs.field2') [['test', nil], ['test', nil]] does know i'm doing wrong?

php - .htaccess mod_rewrite for dynamic url which has domain names -

i want convert url ex:( example.com/link.php?url=facebook.com ) ( example.com/facebook.com.php ) how can using .htaccess. or there other process make job easier ? i tried adding script .htaccess file options +followsymlinks rewriteengine on rewriterule url-(.*)\.htm$ link.php?url=$1 but converting url adding "url-" ( example.com/url-facebook.com.php ) i want remove "url-" , want make ( example.com/facebook.com.php ) rewriteengine on rewritecond %{the_request} ^get.*link\.php\?url\= [nc] rewritecond %{request_uri} !/system/.* [nc] rewriterule (.*?)link\.php\?url\=/*(.*) /$1$2 [r=301,ne,l] not sure how above work edit of used use remove index.php url

Java Android Eclipse - Resize/Scale image from directory storage -

this question has answer here: android: resize large bitmap file scaled output file 20 answers i have string this string path = "storage/sdcard0/pictures/location/img.jpg"; that string location file img.jpg. how can scale/resize image. thanks.. /* * resizing image size */ public static bitmap decodefile(string filepath, int width, int hight) { try { file f = new file(filepath); bitmapfactory.options o = new bitmapfactory.options(); o.injustdecodebounds = true; bitmapfactory.decodestream(new fileinputstream(f), null, o); final int required_width = width; final int required_hight = hight; int scale = 1; while (o.outwidth / scale / 2 >= required_width && o.outheight / scale / 2 >= required_hight) scale *= 2; bitmapfactory.opt...

javascript - What's the purpose of `root=...` code in Async library? -

there's snippet of code in async library : if (typeof window == 'object' && === window) { root = window; } else if (typeof global == 'object' && === global) { root = global; } else { root = this; } is there reason code? why didn't author use root = this ? the first condition valid when this === window , root = window , root = this should equivalent. same thing in second condition, root = global should equivalent root = this . am missing here? not redundant, seems buggy. just before snippet, there's : // global on server, window in browser var root, previous_async; so goal assign root global object. such library should coded work in strict mode (not in strict mode should @ least compliant). , in strict mode, context of iife execution undefined . code fail find root object in strict mode, both on node , in browser. note there reliable ways find root object. standard 1 indirect call : var root = (...

Using PHP to replace JSON encode key -

so here of php grabs data , creates json data im having issues outputting verify-purchase , think because of "-" hyphen want replace before echo script verify_purchase instead think issue here not working , think im doing wrong, can me @ please? your see attempt @ bottom fo code php // make curl request $ch = curl_init(); curl_setopt($ch, curlopt_useragent, "mozilla/5.0 (iphone simulator; u; cpu iphone os 4_3_2 mac od x; en-us) applewebkit/535.17.9 (khtml, gecko) version/5.0.2 mobile/8h7 safari/6533.18.5"); $url = 'http://marketplace.envato.com/api/edge/'.$envato_author_username.'/'.$envato_author_apikey.'/verify-purchase:'.$envato_purchase_code.'.json'; curl_setopt($ch, curlopt_url, $url); curl_setopt($ch, curlopt_connecttimeout, 5); curl_setopt($ch, curlopt_returntransfer, true); $ch_data = curl_exec($ch); curl_close($ch); if ( empty( $ch_data ) ) { # no data returned - timeout or simil...

ios - Today Extension deleting data in sqlite -

i have added today extension in existing app , setup separate core data stack(reusing same code used setup core data main app). app data gets deleted when run today extension if setting of today core data stack deletes existing data. refer below code returning persistentcoordinator : let options = [nsmigratepersistentstoresautomaticallyoption:true, nsinfermappingmodelautomaticallyoption:true, nssqlitepragmasoption:["journal_mode":"memory"]] var coordinator: nspersistentstorecoordinator? = nspersistentstorecoordinator(managedobjectmodel: self.managedobjectmodel) if coordinator!.addpersistentstorewithtype(nssqlitestoretype, configuration: nil, url: storeurl, options: options, error: &error) == nil { nslog("unresolved error \(error)") } return coordinator after lots of debugging, , reading googled blogs , docs, think issue because of mer...

Aggregate queries on MongoDB array elements -

how query mongodb array greater than($gt), less than($lt) queries? {{ "rank": 600, "installs": [100-500], "reviewers" : [ 122, 233 ], "category" : [ "sports" ], "url" : "https://play.google.com/store/apps/details?id=com.transylgamia.kingofspeed3dautoracing" } { "rank": 900, "installs": [100-500], "reviewers" : [ 50, 100, 200 ], "category" : [ "sports" ], "url" : "https://play.google.com/store/apps/details?id=com.b2w.cricket_2014" }} i want this: db.col.find({rank: {$gt:500}, **reviewers.0**: {$gt:50}}, {_id:0, reviewers:1, category:1, url:1}) and first document because first element of array 1st document qualifies. tried different searches not able find help. edit: changed integer.

c - Start of thread changes already set global variable -

i have ran strange behavior of code, basic flow of code is main () parses file , sets global variables accordingly.. such as int frame_size, version; typedef struct//file parsing variables { int frame, int version; } configuration; ***//the function init_parse calls*** static int handler(void* user, const char* section, const char* name, const char* value) { configuration* pconfig = (configuration*)user; #define match(s, n) strcmp(section, s) == 0 && strcmp(name, n) == 0 if (match("protocol", "version")) { pconfig->version = atoi(value); } else if (match("basic", "frames")) { pconfig->frames= atoi(value); frame_size=pconfig->frames; } else { return 0; /* unknown section/name, error */ } return 1; } main (){ configuration config; if (ini_parse("test.i...

python - Setting size for windows that are opened from command line -

i writing genetic algorithm airfoil optimization in python, using program called xfoil aerodynamic calculations. program run within python script using: fnull = open(os.devnull,'w') ps = sp.popen(['xfoilp4.exe'], stdin=sp.pipe, stdout=fnull, stderr=none) the program xfoil (i have .exe, no source code) calculating aerodynamic properties , opens window showing them, before closing , starting again next iteration. these information pop-up windows regularly opened xfoil (running on command line) small. there way size them (make them larger) in order monitor process better? windows can resized hand, in iteration procedure multiple windows open in short time takes long time. kind regards.

php - MySQL - Count all article visitors based on their IP address and access timestamp -

i've got table filled each user's access. 1 line 1 access. in each row there field id, timestamp, ip_address, article_id,... now, problem application used logging users can't modified me, adds 3 rows instead of 1 - logging not desired article 1 on left , 1 on right (based on article_id). i want count article visits eliminating ballast around. how can that? overall need count in middle row's article_id access leave surroundings out. my original idea have php function (but open ideas): $logged_article_ids = $wpdb->get_results("select article_id " . $table_name . " group article_id", array_a); foreach($logged_article_ids $article) { // count in each visit if ip , timestamp unique or if in middle of 3 lines equal ip , timestamp. } thank help. update based on comments: article_id unique in entries? no, not. suggested here sample structure: +---+-----------------+-------------+------------+---- |id | time | ip_address | a...

Website Login Issue developed in magento -

i have website developed using magento . able login. right now, login failed. infact operations interacts user table failing. need know issue. how figure out? first clear try clear log file second make sure have not upgraded magento and 3rd make sure db accessible in magento -harry p

utf 8 - Python 2.6.6 Encoding Error -

here's get. programmingerror: must not use 8-bit bytestrings unless use text_factory can interpret 8-bit bytestrings (like text_factory = str). highly recommended instead switch application unicode strings. here's line of code throwing error. cursor.execute("select path, filename, size, state, modified, created file path=? , filename=?", (path,filename)) i tried other way searching here. , made code like. cursor.execute("select path, filename, size, state, modified, created file path=? , filename=?", (path.decode('utf-8'),filename.decode('utf-8'))) but giving error: unicodedecodeerror: 'utf8' codec can't decode byte 0xf6 in position 1: invalid start byte how solve it? when decode 8bits string, must use actual encoding, not database encoding. if using latin1, have (tested on 2.7.3) : >>> txt = "\xe9\xe8" >>> txt '\xe9\xe8' >>> print txt éè >>> ut...

png - GNUPLOT: pngcairo terminal crop does not completely crop -

i printing png pictures png cairo terminal: set terminal pngcairo enhanced transparent size 1440,900 crop font "palatino,27" as splot: set tmargin @ screen 1; set bmargin @ screen 0; set lmargin @ screen 0; set view map; set size ratio -1; unset border; set output 'pic.png' splot 'datafile.bin' binary pm3d so want picture absolutely no border. both use crop options , set margins 0. nevertheless, small white border remains around picture. any idea rid of it? many thanks generally, give problems if explicitely set margins , constrain plot ratio ( set size ratio -1 ). the following self-contained script (doesn't need additional data file), shows same problem. set terminal pngcairo transparent crop size 1440,900 unset border unset tics unset colorbox set size ratio -1 set pm3d map unset key set output 'pic.png' set isosamples 20 set samples 20 set yrange [-10:10] set xrange [-20:20] splot x**2 + y**2 pm3d with pngcairo ...

c++ - Find total number of 1s -

given number n , find total number of 1s present in pow(11, n) 1 < n < 1000,000 . solving using basic approach land overflow issues since n large. ways can solve efficiently? see calculate count of ones in result of 11^n multiplication 11 equal multiplication 10 (i.e. putting 0 right of number) , adding original number. using can work strings, , don't need additional library.

php - Accessing Class Properties with Spaces -

stdclass object ([sector] => manufacturing [date found] => 2010-05-03 08:15:19) so can access [sector] using $object->sector how can access [date found] ? you can way: $object->{'date found'}

javascript - Text breaks inside slidetoggle JS element -

Image
i have problem on website http://riskby.com/features/ if scroll down bit, , click on myriskby menu-element, text looks this: here js: ;(function ($) { $("#text-6").css({ "display": "none" }); $('#menu-item-990 a').click(function (event) { $('#text-6').slidetoggle("fast"); }); $('#text-6').click(function (e) { e.stoppropagation(); }); $(document).click(function () { $('#text-6').slideup(); }); $(window).scroll(function () { var = 1; var pos = $(window).scrolltop(); if (pos > a) { $("#text-6").css({ position: 'fixed', top: '45px' }); } else { $("#text-6").css({ position: 'fixed', top: '89px' }); } }); })(jquery); can prevent hap...

symfony - Twig template file not found in service -

rendering twig template inside controller works charm. have render template inside service, , won't work: "unable find template file ..." the service container-aware , has "container" injected. i've tried different ways set template file: $this->container->get('templating') ->render('appbundle:email:mytemplate.html.twig'); $this->container->get('templating') ->render('src/appbundle/resources/views/email/mytemplate.html.twig'); always same error... template file exists in /src/appbundle/resources/views/email/mytemplate.html.twig (double-checked!) this controller call works: $this->get('templating') ->render('appbundle:email:mytemplate.html.twig'); why won't work in service...?  

javascript - Plot real time data into line chart -

i have data collected in real time want plot line charts. i plot data received in last 60 calls line chart(pause plotting when not pulling data), each name:value pair gets 1 chart(so there 6 charts in case). of course need update charts every second or every time httpget() gets called. i not sure how proceed next step after have got response(the data plot) server...the end looking pretty "cpu usage history" style. here javascript file collecting data aggregation server: //httpget() adopted so/247483 function httpget() { var xmlhttp = new xmlhttprequest(); xmlhttp.open( "get", "foo.com/sensordata", false ); xmlhttp.send( null ); console.log(xmlhttp.responsetext); return xmlhttp.responsetext; } var interval; //this called button in html file function start(btn) { if(btn.value=="start"){ interval = setinterval(httpget, 1000); btn.value="stop"; } else { btn.value="star...

Custom naming of Aeroo report filename in Odoo -

is there way report output aeroo named custom naming pattern? i.e., invoice: [year]_[invoice number]... @raffaele, i'd recommend taking here , this forum post . you'll need use basic python logic in report_custom_filename module create file name need according requirements. using following example can create output filename sales order/quotation : ${(object.name or '').replace('/','_')}_${object.state == 'draft' , 'draft' or '' +'.xls'} that looks this: so039_.xls you can add field document/report you're printing out adding section, example: ${(object.client_order_ref or '').replace('/','_')}_ this add field client_order_ref in front of document name this: [here's client order reference]_so039.xls have @ fields available in model you're trying information (eg. in case sale.order ) , think you'll find need there. i have still not figured out how...

regex - Regular expression for street address? -

this question has answer here: regular expression street address 3 answers i need regular expression street address example: test 123 - valid 123 test -not valid so need letters(required) space , number(required) tried without success @"^[a-za-z ][0-9 ]" you need include quantifiers, anchors. @"^[a-za-z]+ [0-9]+$" + repeats previous token 1 or more times. you may use if space optional. @"^[a-za-z]+ ?[0-9]+$"

optimization - SAS drop multiple variables indexed by tens -

my question stupid have not found answer yet. have variable var index tens : var10 , var20 ... var90 . @ point of code want drop of them. i can data want(drop=var10 var20 var30 var40 var50 var60 var70 var80 var90); set have; run; i wondering if there more condensed way of doing that. know if there variables indexed 10, 11, 12, 13... use (drop=var10-90) but not have them, if use instruction still job, warning, not acceptable me (i have create programs used people little nothing programming knowledge, report warning one). thanks in advance if var<xx> variables multiples of ten, i.e. there no other variables beginning var , can use colon-operator, acts wildcard, e.g. drop var: ; /* drop variables beginning 'var' */ alternatively, can dynamically generate list of variables : proc sql noprint ; select name :varlist separated ' ' dictionary.columns libname = 'work' , memname = 'have' , compress(name,...

Url configuration in django always executs the same view -

i want achieve following behavior http://localhost/ runs index view in app http://localhost/myview runs myview in app so in main urls.py have following setup urlpatterns = [ url(r"^", include("myapp.urls")), url(r"^admin/", include(admin.urls)), ] and in myapp urls.py urlpatterns = [ url(r'$', "myapp.views.index"), url(r'myview/$', "myapp.views.myview") ] but both links execute index view , myview gets never executed. missing something? you should add ^ start of app url patterns: urlpatterns = [ url(r'^$', "myapp.views.index"), url(r'^myview/$', "myapp.views.myview") ]