Posts

Showing posts from June, 2010

angularjs - Force recompilation of element using kcd-recompile -

i'm trying use: kcd-recompile recompile element. reason it's not working -seems break ng-repeat. one way i'd work recompile single element in ng-repeat: <ul > <li kcd-recompile='x.update_single' use-boolean ng-repeat="x in ::data">{{::x.name}}</li> </ul> or if not, update whole ul: <ul kcd-recompile='really_update' use-boolean> <li ng-repeat="x in ::data">{{::x.name}}</li> </ul> codepen any thoughts on i'm missing? thanks. edit maaan .. figured out, directive needs inside ng-repeat otherwise things break. updated codepen but need ... update li that's repeating ?

regex - Proper validation of the Name entered by a user -

i trying validate name entered user. need make sure name entered 'literally' valid. tried many regular expressions within limited knowledge, none of them seem work fully. example /^[^.'-]+([a-za-z]+|[ .'-]{1})$/ since php website i'm working on, in english, english names allowed. rules applicable filtering name are: a name may contain of these characters: [a-za-z .'-] the name may start alphabet or apostrophe any of characters in [ .'-] may not occur more once in stretch, ie., no '---' or '--' a space should not follow - or ' nor come before . or - can please provide proper regular expression implement these? here's regex solve problem (demo @ regex101 ): /^(?!.*(''| |--|- |' | \.| -|\.\.|\n))['a-z][- '.a-z]*$/gi breakdown: (?!.*(''| |--|- |' | \.| -|\.\.|\n)) negative lookahead ensure no doubled characters found ['a-z] start 1 of these characters [- '

excel - VBA iteration loop -

i need highlight cells in each row in excess of value in column au row of data; next row, cannot value of column au iterative meaning changing next row's value. let me know i'm doing wrong here. sub highlight() application.screenupdating = false dim myrange range dim long, j long set myrange = range("f11:ap20") n = 11 20 = 1 myrange.rows.count j = 1 myrange.columns.count if myrange.cells(i, j).value < range(aun).value myrange.cells(i, j).interior.color = 65535 else myrange.cells(i, j).interior.colorindex = 2 end if next j next next n end sub you have 1 loop extra aun being treated blank variable. guess want work relevant row in col au. is trying? ( untested ) i have commented code let me know if still have questions :) sub highlight() application.screenupdating = false dim myr

javascript - how do you access 'this' control's clientID or just do Bootstrap's .popover() in jscript -

the 'this' i'm talking first argument of creatediv function call below. it's linkbutton clicked. <asp:linkbutton id="btn_reportreply1" runat="server" class="btn btn-danger btn-xs" text="reportreply" onclientclick='<%# string.format("creatediv(this," + eval("uniqueno") +","+ eval("commentseqno") + "," + eval("userno") + ", \"{0}\");", eval("loginid")) %>' ></asp:linkbutton> now want 'this' button want call bootstrap .popover() it. below i'm trying btn's clientid , .popover() red underline shows under btn.clientid. , cannot use button's class because there several buttons have same class. function creatediv(btn, replyno, commentseqno,reporteduserno, loginid) { $('#' + '<%= btn.clientid %>').popover({ trigger: 'manual',

c# - Columns in DataTable Disappearing -

i have datatable has columns generated upon page load. not wish table re-created every time postback occurs, have in no-postback if statement. wit: datatable purchase_display_data = new datatable(); protected void page_load(object sender, eventargs e) { if(!ispostback) { datacolumn rownumber = new datacolumn(); rownumber.datatype = system.type.gettype("system.int16"); rownumber.autoincrement = true; rownumber.autoincrementseed = 1; rownumber.autoincrementstep = 1; purchase_display_data.columns.add(rownumber); purchase_display_data.columns.add("item"); purchase_display_data.columns.add("charge"); } } later, i'm attempting add data after pressing button. with: protected void buttonok_click(object sender, eventargs e) { datarow newline = purchase_display_data.newrow(); newline[1] = "1"; newline[2] = "2"; purchase_display_data.rows.ad

java - Standard Deployment EJB app -

is there standardized format deploy ejb apps on application servers ? i created jar file .class files of app , defaulf manifest , copied deployments directory of jboss v7.1 , deployed fine. i've read needed deployment descriptor, did not use in deployment. i mean war files, used deploy jee web apps have,i think, standard format , structure, exsist similar standard deploy ejb apps ? thanks yes, there standard format, defined in java ee specification. if you're planning on deploying ejbs within application, need generate ear file contain various modules within application. see packaging applications under java ee 6 tutorial more information.

polymer - How to make iron-a11y-keys work on the entire page? -

my keypresses (right , left keys) throw events when i've clicked in parts of page. how make iron-a11y-keys work on entire page? here's have now: <template> <iron-a11y-keys keys="left right" on-keys-pressed="onrightkey"></iron-a11y-keys> <paper-drawer-panel id="drawerpanel" responsive-width="1024px" drawer-width="{{drawerwidth}}"> ... </paper-drawer-panel> </template> it seems behave same way when set target={{}} . i'm not target parameter may problem. bit of education on appreciated. <template> <iron-a11y-keys id="a11y" keys="left right" on-keys-pressed="onrightkey"></iron-a11y-keys> <paper-drawer-panel id="drawerpanel" responsive-width="1024px" drawer-width="{{drawerwidth}}"> ... </paper-drawer-panel> </template> and in script: ready: f

tomcat7 - Liferay Web Form recaptcha issue on SSL reverse proxied site -

our installation of liferay tomcat 6.2 ee bundle behind apache httpd reverse proxy server ssl terminating @ load balancer. not have ssl configuration on tomcat 7 , not using ajp. we ran issue using web form portlet recaptcha on default site using ssl . recaptcha image not rendered on web form after configuring recaptcha in control panel , configuring web form use recaptcha . recaptcha worked on http liferay 6.2 ee installation , site without issue. there errors in console in firefox , chrome: blocked loading mixed active content " http://www.google.com/recaptcha/api/challenge?k=asabsds50 "[learn more] the recaptcha call seemed made using http not https. thanks! liferay needs have tomcat configured in server.xml specify redirectport same port tomcat listening on ex. 8080 , adding secure flag set true. restart tomcat , test. apache reverse proxy in our case points port. configuration worked. recaptcha renders , web forms submits successfully.

angularjs - How can I catch ngSantitize errors and display the html as escaped text -

we using angularjs try , display user entered content html. of time users enter valid/safe data display correctly using ng-bind-html. enter invalid html still display raw text. if use ng-bind-html attempt display invalid html error: [$sanitize:badparse] sanitizer unable parse following block of html: i don't want use trustashtml because don't trust our sanitizer , want ensure not display unsafe html on page. according ngbindhtmldirective can this: html: <div ng-if="issafehtml()"> <div ng-bind-html="invalidhtml"></div> </div> <div ng-if="!issafehtml()"> {{invalidhtml}} </div> js: $scope.issafehtml = function() { return !!$sce.gettrustedhtml($scope.invalidhtml); } modified plunkr: http://plnkr.co/edit/besix3pfq1tjueeagfca?p=preview

python - What's wrong with this dict comprehension including django objects (SyntaxError: invalid syntax)? -

here django: def get_temp_data(nid = none,qid = none,data = none): core_apps.models import temps temp_data = temps.objects.all() if nid != none: temp_data = temp_data.filter(nid=nid) if qid != none: temp_data = temp_data.filter(qid=qid) if data != none: temp_data = temp_data.filter(data__gte=data) temp_data.order_by('id_field') return temp_data here dict comprehension including or mapper objects above function: record_for_nid = {obj.qid: obj.data obj in get_temp_data(nid, none, none) if obj.data != 0.0} record_for_nid runs fine on regular situation not on crontab. little suspicion sublime text error checker picks error on "for" in list comprehension. what's wrong code? , how fix it?

node.js - Mongoose method undefined -

i'm trying create 'checkpassword' method user model, whenever call following error: user.checkpassword(password, hash, function(err, samepassword){ ^ typeerror: undefined not function i'm pretty new mongoose i'm not sure i'm going wrong. users.js (user model) var mongoose = require('mongoose'), schema = mongoose.schema, bcrypt = require('bcrypt'); var userschema = new schema({ email : {type: string, required: true, unique: true}, password : {type: string, required: true}, firstname : {type: string}, lastname : {type: string} }); userschema.methods.checkpassword = function checkpassword(password, hash, done){ bcrypt.compare(password, hash, function(err, samepassword) { if(samepassword === true){ done(null, true); } else { done(null, false) } }); } module.exports = mongoose.model('user', userschema); passport.js var passport = require('passport'), l

python - How to keep socket alive? -

should keep alive sockets on server if interact known clients long time , of them stays online , max amount of them 10? if yes best way this? like: class mysocket: '''demonstration class - coded clarity, not efficiency ''' def __init__(self, sock=none): if sock none: self.sock = socket.socket( socket.af_inet, socket.sock_stream) else: self.sock = sock def connect(self, host, port): self.sock.connect((host, port)) def mysend(self, msg): totalsent = 0 while totalsent < msglen: sent = self.sock.send(msg[totalsent:]) if sent == 0: raise runtimeerror("socket connection broken") totalsent = totalsent + sent def myreceive(self): chunks = [] bytes_recd = 0 while bytes_recd < msglen: chunk = self.sock.recv(min(msglen - bytes_recd, 2048)) i

Summarise which fields contain data for a given Solr query -

this best asked using example. an electronics store's solr index has documents cameras, printers, routers, phones, etc. there fields present in docs, , absent in others. example printers have dpi_i field, cameras might have sensor_size_f , megapixels_i field, , on. is there way summary of presence/absence of data in all fields based on results of given query? faceting on fields, paying special attention number of missing values? so when search "epson", result tell dpi_i field highly populated (maybe 90%, i'm guessing) , sensor_size_f , megapixels_i fields 0% populated (at least current products - looks used make nice rangefinder camera 10 years ago...). thanks! by of i'd want use stats component ( https://cwiki.apache.org/confluence/display/solr/the+stats+component ). just add stats=true&stats.field=dpi_i&stats.field=sensor_size_f (and on) , should go. calculate missing / count fields.

html - appearance:button not working in IE11 -

i'm trying style link if button. link: <a class="link-as-button" id="logout" href="#">log out</a> the css style applied is: .link-as-button { appearance: button; /* css3 */ -webkit-appearance: button; /* safari , chrome */ -moz-appearance: button; /* firefox */ -ms-appearance: button; /* internet explorer */ -o-appearance: button; /* opera */ cursor: default; padding: .5em; } now works in browsers except ie (what surprise). tried lot of stuff found on internet nothing helped. microsoft's documentation states support -webkit-appearance property, looks ie totally disagrees that. what's problem? the mozilla development network link here clarifies property supported in internet explorer (windows phone) ie 11 on windows phone 8.1 -webkit-appearance (only none, button, , textfield values) it's worth pointing out that, regardless of support @ present this feature non-standard , not

pointers - Passing point as a reference in C? -

in c, want pass pointer function coded following, node* list // contains linked list of nodes void function (node* list){ /*whatever here, want make sure modify original list, not local copy. + how pass original pointer 'list' function i'm working on same variable? */ } [edit] i clarify few things here, i have void function takes struct argument, void function (struct value arg){ } and in struct, i'm defining 1 of internal variables as, node* list-> list; so in function, if like, arg->list am accessing original list variable? to answer edit: no, passing structure value, function contains copy of structure. if don't return structure in function , grab called function from, lost. keep in mind c not pass reference. instead simulated passing pointer. instead this: void function (struct value* arg) { .... } and modify original structure.

Adobe tag manager - Direct Call Routes - Direct call rule "DCTEST" not found -

just wanted know if has ever seen error when setting adobe tag manager direct call routes. direct call rule "dctest" not found. i've logged created new direct call rule named dc test in conditions section named dctest in adobe analytic selected -> s.t(); - increment pageview then in javascript selected non-sequential , created javascript script , added window.alert("dc fired") then in localhost called _satellite.track("dctest"); i error: satellite: direct call rule "dctest" not found event based tracking works , datalayer populated expected when creating direct call rule doesn't seem find i've set up? followed adobe video still no luck? https://outv.omniture.com/?v=tvaty4zzoj087iojpjptl9npm_8qgdxu any ideas? can video tutorial work? https://outv.omniture.com/?v=tvaty4zzoj087iojpjptl9npm_8qgdxu thanks that error message output when a) direct call rule doe

excel - How do I count the number of times a value with a certian criteria occurs within an conditional index of cells -

i have below formula works great find percentage looking for: =sum((countif(b12:b10002,">=9"))/(count(b12:b10002))) what need count , countif make range conditional preceding column. range a12:a10000 indicates date range b12:b10000 indicates number between 1-10 cell a5 indicates date i know how many times 9 or 10 occurs in b12:b10000, if preceding cell in a12:a10000 equal a5 i have tried index match, renders "1" (meaning true) or gives me number 10 first cell in b12 any appreciated! :) you can use countifs() this. countif accept multiple criteria: =countifs(a12:a10000,a5,b12:b10000,">=9") if using older version of excel doesn't support countifs() can use sumproduct() instead: =sumproduct((a12:a10000=a5)*(b12:b10000>=9)*1)

sql server - How to convert a transaction SQLServer to MySQL -

use[otahara] begin transaction trans1 --código sql insert cities (name) values ('teste 1') update customers set idcity = 20 id = 1 if (@@error <> 0) begin rollback raiserror('erro fidapu', 16, 1) end else begin commit end; -- selects select * cities select * customers id = 1 ============================================================= use[otahara] declare @idcity int = 0; begin transaction trans1 --código sql insert cities (name) values ('teste 2') select @idcity = @@identity; update customers set idcity = @idcity id = 1 if (@@error <> 0) begin rollback raiserror('erro fidapu', 16, 1) end else begin commit end; -- selects select * cities select * customers id = 1 delete cities id = 18; =============================================================

php - MySQL connection gone -

i using cleardb database windows azure based php application. getting intermittent error on mysql connections. have 2000 online customers . , have 30 connections database. how can scale website , overcome situation? i taking care of closing connection of times. have prevented server errors this: try { $this->_conn = $this->dbh = new pdo('mysql:host=' . db_server . ';dbname='. db_name, db_user, db_pass); $this->dbh->setattribute(pdo::attr_errmode, pdo::errmode_exception); } catch (pdoexception $e) { die("couldn't connect database. please try again!"); } so, if there no connections left, it'll show appropriate message. but, it's not feasible customer facing websites. how can solve problem? edit how can analyse data: array ( [0] => array ( [variable_name] => connections [value] => 505369 ) [1] => array ( [variable_name] => threads_cached [value] =&g

python - Remove the new line "\n" from base64 encoded strings in Python3? -

i'm trying make https connection in python3 , when try encode username , password base64 encodebytes method returns encoded value new line character @ end "\n" , because of i'm getting error when try connect. is there way tell base64 library not append new line character when encoding or best way remove new line character? tried using replace method following error: traceback (most recent call last): file "data_consumer.py", line 33, in <module> auth_base64 = auth_base64.replace('\n', '') typeerror: expected bytes, bytearray or buffer compatible object my code: auth = b'username@domain.com:password' auth_base64 = base64.encodebytes(auth) auth_base64 = auth_base64.replace('\n', '') any ideas? thanks instead of encodestring consider using b64encode . later not add \n characters. e.g. in [11]: auth = b'username@domain.com:password' in [12]: base64.encodestring(auth) out[

javascript - Display some li's with next and previous buttons -

i'm creating bootstrap tabs. in each tab have selects different options. want place each select option in <li> , , @ beginning in active tab 4-5 li's enabled. for remaining <li> want make "next" button (and of course "previous" button well) , transition animation. does know how in javascript or jquery?

Command to launch visual studio code not recognized on windows 8.1 -

i have installed visual studio code on windows 8.1 pc. after installing launches correctly. when try launch command prompt "code .", prompt command isn't recognized. if install vs code through setup, code.cmd placed automatically in c:\users\<your name>\appdata\local\code\bin . please verify command there!

java - Auto reload with play2 -

this play2 project having maven nature: pom.xml relevant code: <packaging>play2</packaging> <plugin> <groupid>com.google.code.play2-maven-plugin</groupid> <artifactid>play2-maven-plugin</artifactid> <version>${play2.plugin.version}</version> <extensions>true</extensions> <configuration> <!-- if using database evolutions --> <serverjvmargs>-dapplyevolutions.default=true</serverjvmargs> </configuration> <executions> <!-- if there assets in project --> <execution> <id>default-play2-compile-assets</id> <goals> <goal>closure-compile</goal> <goal>coffee-compile</goal> <goal>less-compile</goal> </goals> </execution> </executions> </plugin> i run proje

java - Spring Integration SFTP: removing or noving multiple files -

with spring integration want move or remove multiple files or non-empty folders @ once on remote sftp server. can't seem find support in official spring docs , seems unsupported. although documentation isn't correct anyway. i thinking using int-sftp:outbound-gateway rm command payload directory name. doesn't seem work. haven't tried mv yet, i'm wondering if has experience behaviour in spring integration. it's not clear question : files want remove local application or remote, on sftp server ? below example of have in 1 app, maybe can : incoming messages (with file name in payload) first sent remote sftp server, , deleted locally <integration:publish-subscribe-channel id="sftpchannel" /> <!-- processed file sftped server --> <sftp:outbound-channel-adapter id="sftpoutboundadapter" session-factory="sftpsessionfactory" channel="sftpchannel" order="1" charset="utf

javascript - Kendo chart x-axis not displaying with given data -

i'm trying render chart based on this example. i'm receiving data json formatted so: [{"date":"2015/06/01","count":4588}] however, given data, when try dates displayed on x-axis using categoryfields nothing displayed. appreciated. controller: [route("apiaggregate")] [httpget] public ienumerable<apidto> get(datetime? start = null, datetime? end = null ) { var datedata = b in session.query<calltracker>() group b b.calldatetime.value.date g g.key.date >= datetime.today.adddays(-3) && g.key.date <= datetime.today.adddays(3) orderby g.key select new apidto{date = g.key.tostring("yyyy/mm/dd"), count = g.count()}; return datedata; relevant code: function chartdata(dataapi) { var containdata = []; (i = 0; < dataapi.length; i++) {

BigQuery completed job returns 404 on getting query results (immediately after) -

we run set of queries on 2 hour interval have been running week without issues. on 2015-06-04 00:00:26 utc had job (job_oy8g2_i-f6dbxfw93gdb94wc_w0 ) marked done, received 404 http exception when trying query results. i understand results last 24 hours in case query results obtained right after job status 'done'. bq wait job_oy8g2_i-f6dbxfw93gdb94wc_w0 claims job success. is situation should code (e.g. wait job completion, test query make sure results can accessed before paginating through results , resubmit entire job on 404?) there brief period yesterday (june 3) small percentage of requests bigquery rejected 404 response. should have cleared 8pm pacific time. this due problem configuration change caught before rolled out widely, took while undo. pentium10 if have seen similar before, unrelated.

c# - How to exit full screen mode for media element in windows 8.1 store app -

hi guys have added video application plays automatically when page loads , when video double tapped goes full screen. here code. c# private void mediasimple_doubletapped(object sender, doubletappedroutedeventargs e) { mediasimple.isfullwindow = true; } xaml <mediaelement x:name="mediasimple" source="ms-appx:///videos/1-learning-how-to-manage-things-yourself.mpg" horizontalalignment="stretch" verticalalignment="stretch" autoplay="true" doubletapped="mediasimple_doubletapped" /> what can add code guys allow me exit full screen mode when touch screen of device? modify code : mediasimple.isfullwindow = !mediasimple.isfullwindow;

java - JUnit report to show test functionality, not coverage -

one of problems of team lead people on team (sometimes including myself) create junit tests without testing functionality. it's done since developers use junit test harness launch part of application coding, , either deliberately or forgetfully check in without assert tests or mock verifies. then later gets forgotten tests incomplete, yet pass , produce great code coverage. running application , feeding data through create high code coverage stats cobertura or jacoco , yet nothing tested except ability run without blowing - , i've seen worked-around big try-catch blocks in test. is there reporting tool out there test tests, don't need review test code often? i temporarily excited find jester tests tests changing code under test (e.g. if clause) , re-running see if breaks test. however isn't set run on ci server - requires set-up on command line, can't run without showing gui, prints results onto gui , takes ages run. pit standard java mutat

web services - Java webservices Tomcat Jax-WS ssl, How to set up Client to authenticate certificate -

hell everyone, have set java webservices on tomcat + ssl connection link below http://www.mkyong.com/webservices/jax-ws/deploy-jax-ws-web-services-on-tomcat-ssl-connection/ . works fine. my question here in code client part not authencticate certificate or ssl connection, have part check hostname,by hostname verifier,but have self-signed certificate, , not sure should do. how extend class. find few codes forum not entire idea, keystore or truststore come from. reference blog or link guide me appreciated. my client code below public iexample create() throws malformedurlexception{ try{ trustmanager[] trustallcerts = new trustmanager[] { new x509trustmanager() { public x509certificate[] getacceptedissuers() { return null; } public void checkclienttrusted(x509certificate[] certs, string authtype) { // trust } public void checkservertrusted(

python - bypass proxy using tor and torctl -

i looking how bypass pass proxy using tor , torctl, looked on various steps , wrote script in python. after starting tor, ideally should work proxy_support = urllib2.proxyhandler({"http" : "127.0.0.1:8118"} ) opener = urllib2.build_opener(proxy_support) urllib2.install_opener(opener) #urllib2.urlopen('http://www.google.fr') data = json.load(urllib2.urlopen("https://www.google.co.in/trends/hottrends/hotitems?geo=in&mob=0&hvsm=0")) which again gives message : file "/usr/lib/python2.7/urllib2.py", line 528, in http_error_default raise httperror(req.get_full_url(), code, msg, hdrs, fp) urllib2.httperror: http error 503: service unavailable i have started tor , enabled control port using tor --controlport 9051 do need make other change? edit treaceback after change per new answer of running tor on 1080 port >>> import urllib2 >>> proxy_support = urllib2.proxyhandler({"http" : &quo

javascript - How to use line chart extender attribute in primefaces 5.2 -

i'm using primefaces 5.2 latest version , tried line chart,its working fine. am trying change line chart axes color,background,border...etc.but extender attribute not working in latest primefaces version. my xhtml: <p:chart type="line" model="#{chartviewline.linemodel1}" styleclass="legendpos" extender="chartextender" style="height:300px; width:570px;"/> javascript: function chartextender() { this.cfg.grid = { background: 'transparent', gridlinecolor: '#303030', drawborder: false, }; } is alternative 'extender' attribute or code have wrong syntax? you should set extender model in chartviewline bean. linechartmodel model = new linechartmodel(); model.setextender("chartextender"); attribute extender has been removed in primefaces 5.0 (see list of p:chart attributes primefaces 5.0 documentation )

Magento/PHP - Get phones on all members in a customer group -

i working on custom magento extension. working around adminhtml part , i've created custom form there. here form code: <?php class vivasindustries_smsnotification_block_adminhtml_sms_sendmass_edit_form extends mage_adminhtml_block_widget_form { public function _preparelayout() { $extensionpath = mage::getmoduledir('js', 'vivasindustries_smsnotification'); $head = $this->getlayout()->getblock('head'); $head->addjs('jquery.js'); $head->addjs('vivas.js'); return parent::_preparelayout(); } protected function _prepareform() { $form = new varien_data_form(array( 'id' => 'edit_form', 'action' => $this->geturl('*/*/save', array('id' => $this->getrequest()->get

jquery - How to change Html of a particular cell in jqGrid? -

Image
in jqgrid implementation, have subgrid dropdown , want change icon in cell on change of dropdown. have used formatter generate icons shown in picture below. want add/remove icon images cell. possible do? i'd appreciate help/ideas that? using jqgrid asp .net in project. function formatactiongridicons(cellvalue, options, rowobject) { if (cellvalue.indexof("_") == -1) return ''; var arr = cellvalue.split('_'); var icon1 = arr[0]; var icon2 = arr[1]; var icon3 = arr[2]; //if (icon1 == "r") var cellhtml = geticonhtml(icon1) + geticonhtml(icon2) + geticonhtml(icon3); return cellhtml; } function geticonhtml(icon) { if (icon == null || icon == "") return ""; var result = geticonpath(icon); if (typeof (result) === "undefined" || result == "") return ""; else return "<img src='" + geticonpath(icon) + "'

sql - exists condition in a trigger -

i'm quite new pl/sql, sorry if question obvious according trigger documentation , there when ( condition ) triggers. wanted use exists condition , requires subquery, however, have following error : ora-02251 00000 - "subquery not allowed here" *cause: subquery not allowed here in statement. *action: remove subquery statement. what did miss? my condition following : create or replace trigger mytrigger after update of column on this_table each row when (new.status = 'approved' , exists ( select * junction_table this_table_id=new.this_table_id , other_table_id = 'something')) declare begin end; i want check whether row associated given value, can find in junction table. i surely in pl/sql part of trigger, : it related trigger rather business logic in itself i'd understand missed in documentation , why not possible. if condition might this, i'm interested. i write conditional elemen

mysqli - What are the advantages of sqli over sql? -

i know more security perspective. advantages of sqli on sql? i assume talking php mysql extensions mysql , mysqli. besides fact the mysql extension deprecated since php 5.5.x , should not used in new projects anymore, the mysqli docs list important improvements: the mysqli extension has number of benefits, key enhancements on mysql extension being: object-oriented interface support prepared statements support multiple statements support transactions enhanced debugging capabilities embedded server support from security perspective , support prepared statements strongest argument new extension. prepared statements best defense against sql injections .

wordpress - Restrict posting in one taxonomy -

i have 2 taxonomies custom post type. 1 categories , other called types. restrict author able select 1 of 2 taxonomies. for example, if author selects 1 of "types" taxonomy, not able select "categories" is possible? you need create custom taxonomy custom post type only: here working code me. display custom taxonomy custom post type. // registers new post type , taxonomy function wpt_packages_posttype() { register_post_type( 'packages', array( 'labels' => array( 'name' => __( 'packages' ), 'singular_name' => __( 'packages' ), 'add_new' => __( 'add new packages' ), 'add_new_item' => __( 'add new packages' ), 'edit_item' => __( 'edit packages' ), 'new_item' => __( 'add new packages' ), 'view_item' => __( 'view packages' ), 

Any sample Cordova Apps available for visual studio developers -

i'm new mobile app development. please post links, sample or cordova apps visual studio developers . you have blank app in visual studio. can import cordova app there (but careful plugins). check more corodva templates online, know ionic has own @ least . and yes, question should closed. edit: have checked, visual studio 2015 has number templates , samples uses cordova. me, samples weird.

MySQL Conditional count based on a value in another column -

i have table looks this: id rank 2 1 b 4 b 3 c 7 d 1 d 1 e 9 i need distinct rank values on 1 column , count of unique id's have reached equal or higher rank in first column. so result need this: rank count 1 5 2 4 3 3 4 3 7 2 9 1 i've been able make table unique id's max rank: select max(rank) 'toprank', id mytable group id i'm able distinct rank values , count how many id's have reached rank: select distinct toprank 'rank', count(id) 'count of id' (select max(rank) 'toprank', id mytable group id) tablederp group toprank order toprank asc but don't know how count of id's rank equal or higher rank in column 1. trying sum(case when toprank > toprank 1 end) naturally gives me nothing. how can count of id's toprank higher or equal each distinct rank value? or looking in wrong way , should try running totals instead? tried similar questions think i'm on wrong t

Solving bison conflict over 2nd lookahead -

i'm writing parser project , got stuck on issue. here's self contained example of problem: %error-verbose %token id %token var %token end_var %token constant %token @ %token value %% unit: regular_var_decl | direct_var_decl; regular_var_decl: var constant_opt id ':' value ';' end_var; constant_opt: /* empty */ | constant; direct_var_decl: var id @ value ':' value ';' end_var; %% #include <stdlib.h> #include <stdio.h> yylex() { static int = 0; static int tokens[] = { var, id, ':', value, ';', end_var, 0 }; return tokens[i++]; }; yyerror(str) char *str; { printf("fail: %s\n", str); }; main() { yyparse(); return 0; }; one build bison test.y && cc test.tab.c && ./a.out . it warns me constant_opt useless due conflicts. this ambiguity solved using lalr(2), since after id find ':' or at ... how solve issue on bison? a simpl

mpich - Executing MPI commands using PHP -

Image
i trying execute mpi program using php have provide web-interface user.php executes command , return output if have 1 process, i.e $output = system(" mpiexec -hostfile /data/hosts -np 1 /data/./hello",$returnvalue); but have need more 1 process , have tried following ways results same i.e no response mpi program. using system () $output = system(" mpiexec -hostfile /data/hosts -np 2 /data/./hello",$returnvalue); using shell_exec () $output = shell_exec(" mpiexec -hostfile /data/hosts -np 2 /data/./hello"); if use these methodes run simple c program receive response. $output = system("/data./hello",$returnvalue); please assist me. many thanks. problem seem trying store output of "system()" "$output" while it's storing value on "$returnvalue". try this: exec('mpiexec -hostfile /data/hosts -np 2 /data/./hello', $var); var_dump($var); for odd reason php doesn't along mu

windows 7 - Unable to connect Oracle 11g via Visual Studio 2015 -

Image
we have project built on .net 4.0 framework in visual studio 2010. database on oracle 10g server. trying migrate project visual studio 2015. in meantime encountered oracle 10g client not suitable windows 7 , windows 7 must vs 2015. installed 64-bit oracle 11g enterprise manager client in windows 7 , trying connect visual studio 2015. through oracle 11g sql developer able connect respective database. through visual studio getting unexpected error, (if not able see image, error text ) ocienvcreate failed return code -1 error message text not available configurations: windows 7 professional service pack 1 - 64bit visual studio 2015 oracle 11g enterprise manager - 64 bit tnsnames.ora file like, dphpro = (description = (address_list = (address = (protocol = tcp)(host = dphserver)(port = 1521)) ) (connect_data = (sid = dph) (server = dedicated) ) ) could please me resolve this.

unity3d - How to draw multiple 3d object on unity? -

Image
i want draw 3d circle , 3d cube @ center of circle on unity3d. create 6 faces of cube below code : mesh.vertices = new vector3[]{ // face 1 (xy plane, z=0) new vector3(0,0,0), new vector3(1,0,0), new vector3(1,1,0), new vector3(0,1,0), // face 2 (zy plane, x=1) new vector3(1,0,0), new vector3(1,0,1), new vector3(1,1,1), new vector3(1,1,0), // face 3 (xy plane, z=1) new vector3(1,0,1), new vector3(0,0,1), new vector3(0,1,1), new vector3(1,1,1), // face 4 (zy plane, x=0) new vector3(0,0,1), new vector3(0,0,0), new vector3(0,1,0), new vector3(0,1,1), // face 5 (zx plane, y=1) new vector3(0,1,0), new vector3(1,1,0), new vector3(1,1,1), new vector3(0,1,1), // face 6 (zx plane, y=0) new vector3(0,0,0), new vector3(0,0,1), new vector3(1

javascript - Node.js http.request append header -

hi piping readable stream x var req = http.request object . thing want append header after read data x . can append headers req object after creation (headers given in option parameter http.request(options, callback) function. i want asynchronously each read x thats why cannot send header in option. ok seems i've found solution. since http.request returns http.clientrequest object has setheader(name, value) method, can use after create request. now think nooby question, moderators decide it.

compiler construction - Do critical characters of a python encoding ever come outside of quotes? -

i working on python scanner library , came across encodings . guess, lexical scanner never have problems 'critical' characters because come inside quoted strings. i.e. in unicode, characters of form 0x00000000 - 0x0000007f: 0xxxxxxx 0x00000080 - 0x000007ff: 110xxxxx 10xxxxxx 0x00000800 - 0x0000ffff: 1110xxxx 10xxxxxx 10xxxxxx 0x00010000 - 0x001fffff: 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx 0x00200000 - 0x03ffffff: 111110xx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx 0x04000000 - 0x7fffffff: 1111110x 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx , code above x80: not mix ' , ". not have care encoding. right or not? references: https://www.python.org/dev/peps/pep-0263/ https://docs.python.org/2/tutorial/interpreter.html#source-code-encoding there other encodings, simple assumption isn't true. 1 byte encodings, seems correct, multi byte encodings other utf-8 wrong.

database relations - how to define a relationship in Yii2 with orOnCondition -

i logging changes in database table called audit_field. given model retrieve audit_fields model of related models. for example: <?php class job extends activerecord { public function getauditfields() { $link = []; // put here "1=1" ? return $this->hasmany(auditfield::classname(), $link) ->oroncondition([ 'audit_field.model_id' => $this->job_id, 'audit_field.model_name' => get_class($this), ]) ->oroncondition([ 'audit_field.model_id' => arrayhelper::map($this->getjobteches()->all(), 'id', 'id'), 'audit_field.model_name' => 'app\models\jobtech', ]); } public function getjobteches() { return $this->hasmany(jobtech::classname(), ['job_id' => 'job_id']); } } what want: select * audit_field (...my or

google apps script - Stylesheet for .html document not imported -

Image
i have form created in html (called form.html) written in google apps script , have stylesheet (css) go that. working when have css in same html-file form. if want put stylesheet in separate html-file (called stylesheet.html) , include in form.html using scriplet <?!= htmlservice.createhtmloutputfromfile('stylesheet').getcontent(); ?> or creating 'include' function: function include(filename) { return htmlservice.createhtmloutputfromfile(filename) .setsandboxmode(htmlservice.sandboxmode.iframe) .getcontent(); } and in form.html <?!= include(stylesheet) ?> ..it doesn't seem work. what's worse scriplet shows on form. maybe there basic overlooking, can't wrap head around this. ideas ? here code far... function doget() { return htmlservice.createhtmloutputfromfile('formulier') .setsandboxmode(htmlservice.sandboxmode.iframe); } function include(filename) { return htmlservice.createhtmloutputfr

http - Make it possible to download .rtf file -

Image
i able make pdf file downloadable when use clicks download link. did this: sqldatareader reader = command.executereader(); if (!reader.read()) return; response.clear(); string fileextension = reader["fileext"].tostring().trim(); if (reader["documentdata"] != dbnull.value) { switch (fileextension) case "pdf": response.contenttype = "application/pdf"; break; ... case "rtf": response.contenttype = "application/rtf"; break; i tried same .rtf, when user clicks link browser instead shows image attached below (weird symbols). want promt user save file. user right clicks on link, , says save (somename.rtf), works fine. old generation of people not

ruby on rails - Customize blank errors in Devise -

now error this: email can't blank i can change part can't blank errors: messages: blank: cannot empty but after shows as: email cannot empty can change field name too? make like e-mail_something_else cannot empty? how can it? my field in form: <div class="field"> <%= t('registration.email') %><br /> <%= f.email_field :email, autofocus: true, :class => "form-field" %> </div> try in devise_en.yml file: en: errors: format: "%{message}" the default format "%{attribute} %{message}".

Logstash filter section -

could please advise how filter specific words logstash 1.5? example, it's necessary filter following words: critical, exit, not connected. remember, in previous versions of logstash (i.e 1.4 , earlier) has been possible grep filter. currently logstash.conf contains: input { file { path => ["c:\exportq\export.log"] type => "exporter-log" codec => plain { charset => "cp1251" } start_position => "beginning" sincedb_path => "c:\progra~1\logstash\sincedb" } } filter { } output { stdout { codec => rubydebug } zabbix { zabbix_host => "vs-exp" zabbix_key => "log.exp" zabbix_server_host => "192.168.1.71" zabbix_value => "message" } } } many in advance! use conditional , drop filter delete matching messages. filter { # simple substring condition if "boring&q

php - SQL Delete Duplicate rows find same text in a field -

i using phpmyadmin - joomla cms. have many articles same title. want delete articles having same title. please tell me query how delete same articles having same title. i used command shows me count of articles having same title. select title, id, count(title) q3ept_k2_items group title having count(title) > 1 please try this, for keep lowest id value, delete item1 q3ept_k2_items item1, q3ept_k2_items item2 item1.id > item2.id , item1.title = item2.title for keep highest id value, delete item1 q3ept_k2_items item1, q3ept_k2_items item2 item1.id < item2.id , item1.title = item2.title if want improve little bit performance, can change style, where item1.title = item2.title , item1.id > item2.id or where item1.title = item2.title , item1.id < item2.id

javascript - (How) Can i use 'or' in a switch statement? -

is following code right: var user = prompt("is programming awesome?").touppercase(); switch (user) { case 'hell yeah' || 'yes' || 'yeah' || 'yep' || 'yea': console.log("that's i'd expected!"); break; case 'kinda'||'cant say': console.log("oh, you'd when you'll pro!"); break; case 'hell no'||'no'||'nah'||'nope'||'na': console.log("you can't that!"); break; default: console.log("wacha tryna mate?"); break; } i tried it. didn't work wanted to. worked if input 'hell no' or 'hell yeah', later strings ignored! i approach using dictionary (object) containing answers can check function in switch statement. it's lot neater having multiple case checks: var user = prompt("is programming awesome?").touppercase(); // 

Android: pass data from activity with 3 fragments to previous activity -

i'm building android app using android studio. let's have activity1 , activity2. activity2 has 3 fragments (3 tabs). managed pass data activity1 activity2 , activity2 it's fragments using fragment adapter. 1) want opposite: gather data 3 fragments , pass activity sitting in (activity2), , pass data activity2 activity1. i have implemented interface passes data 1 fragment activity2, how (and when) can pass data 3 fragments activity2? method wrote sends object fragment activity2. method in activity2 gets 1 object... or perhaps there's way can send data fragments activity2 fragment adapter? (this can best think...) 2) best way pass data activity2 activity1 overriding "onbackpressed" , using startactivityforresult , setresult? (i don't have button besides actionbar "back button"). thanks! 1) can create interface 3 methods like: setresult1() , setresult2() , setresult3() , make activity implement interface can collect results o

How To Create a Plugin at Backend in Wordpress -

i have made simple contact form plugin , want show on backend page (wp-admin page). you can use add_menu_page() function adding new menu in backend(admin). add_action('admin_menu', 'my_menu_pages'); function my_menu_pages(){ add_menu_page('my page title', 'my menu title', 'manage_options', 'my-menu', 'my_menu_output' ); } function my-menu(){ // code /// }

html - Wrap 3 divs in 1 div - In order to share background -

im making small website, created divs have question, have 1 div "header" , next that, have 2 divs side side, wanna wrap 3 divs in 1 container. i tried things saw, till isnt want. body { margin: 0; width:100%; } body > div { height: 200px; padding: 50px; } .header { background-color: grey; height: 50px; color: white; } .product { margin-top:0px; height: 500px; background-color: red; color: white; float:left; width:50%; margin:0; padding:0; } .product2 { height: 500px; margin-top:0px; background-color: blue; color: white; width:50%; float:left; margin:0; padding:0; } .crew { clear:both; background-color: tomato; color: darkgrey; } .tour { background-color: black; color: darkgrey; } .pricing { background-color: gold; color: black; } .contact { background-color: black; color: white; } .menu{ margin-top: 4%; margin-right: 5%; fo