Posts

Showing posts from April, 2013

php - count in model scopes() function -

i'm trying count total matches found in scopes , scope works , returns every other column, except count() public function scopes() { return array( 'test'=> array( 'alias' => 'd', 'select'=> array('d.id, d.picture, d.store, d.address, d.postcode, d.city, d.state, count(*) totalads'), 'join' => 'join `ads` v', 'condition'=>'d.is_new="0" , v.pending!="1" , d.id = v.id', 'group'=>'v.id' ), } in view i'm trying data using $data->totalads error when use print_r($data->totalads) the error property "store.totalads" not defined. i'm using yii 1.1.15 as error states, totalads not defined. you define totalads statistical relation in class...

sql - MYSQL | Subtract one field from another but 1 field is created of subquery -

select e.`employee_id`, e.`full_name`, le.`no_of_leaves` allocatedleaves, mllt.`leave_type` leavetypename, (select count(*) leave_approval employee_id = 1 , month(approval_date) = 11 group approval_date) totalleavestaken, le.`no_of_leaves` - totalleavestaken balance employee e inner join leave_entitlement le on e.`employee_id` = le.`employee_id` inner join `ml_leave_type` mllt on mllt.`ml_leave_type_id` = le.`ml_leave_type_id` left join leave_approval la on e.`employee_id` = la.`employee_id` left join leave_application lapp on lapp.`application_id` = la.`leave_application_id` left join ml_leave_type mlltla on mlltla.`ml_leave_type_id` = lapp.`ml_leave_type_id` error code: 1054 unknown column 'totalleavestaken' in 'field list' this have tried do, got error.. le.`no_of_leaves` - totalleavestaken balance im not in databases, have subtract 1 field another, first field ok, second field generated of subquery. dont want run subquery again, possible way subtraction ...

java - Dealing with ArrayOfXsdAnyType -

my wsdl file element looks this <element name="gethemodialysishospitalresponse"> <complextype ><sequence><element name="gethemodialysishospitalreturn" type="impl:arrayof_xsd_anytype"/></sequence> </complextype> </element> when try data in soap ui i’m getting response request <soapenv:envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ser="http://serviceimpl.com.echannelling"> <soapenv:header/> <soapenv:body> <ser:gethemodialysishospital/> </soapenv:body> </soapenv:envelope> response <soapenv:envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/xmlschema" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance"> <soapenv:body> <gethemodialysishospitalresponse xmlns="http://serviceimpl.com.echannelling"...

javascript - How do I gather multiple jQuery objects into one jQuery object? -

say have these variables: var container = $("div#my-awesome-section"); var foo_input = $("input[name=foo]", container); var bar_input = $("input[name=bar]", container); i want bind event handler both inputs. hoped work: $([foo_input, bar_input]).on("keypress", function() { /* ... */ }); but alas, no. there convenient way of gathering multiple jquery objects 1 purposes this? use in add() in jquery adding jquery object foo_input.add(bar_input).on("keypress", function() { /* ... */ });

html - Encrypting src attribute of iframe control -

this question has answer here: what practice approach hide private url? 2 answers i using iframe load pdf file temporary location , looks shown below <iframe id="mypdf" width="100%" height="100%" src="config\temp\tmp_report_0.pdf"></iframe> this load pdf file browser window, inside iframe. question how can hide 'src' value being visible user when right click , select 'view source' browser. the intention here enrcypt/hide 'src' value users. suggestions? you can use generic handler hide file location. inside handler serve file base on url parameter. here basic example: <iframe id="mypdf" width="100%" height="100%" src="openreport.ashx?reportid=2129938212"></iframe> now can/must encrypt url parameter avoid download report...

database - Multi valued column in SQL -

i created table boat contains following columns: bname, type, price, oname . however, type column should 1 of following: sailboat, houseboat, or deckboat. how can reflect on create table statement. i've searched , came statement i'm not sure if it's right or not: create table boat ( bname varchar(255), btype int, price double, oname varchar(255), primary key (bname), foreign key (btype) references botype(id) ); create table botype ( id int primary key, type varchar(255) ) is best way it? you can try this: mycol varchar(10) not null check (mycol in('moe', 'curley', 'larry')) here more details on mssql "check constraints": http://technet.microsoft.com/en-us/library/ms188258%28v=sql.105%29.aspx

Adding pre-defined static SVG to a Leaflet map doesn't work -

i need add control contains several pre-defined svg elements. display contours of regions off-shore europe. have different zoom levels. hovering on main country should highlight corresponding off-shore regions. clicking on 1 of them moves main map region. other this, no behaviour required. the svg not render. class svg-control using l.control.extend: l.insets = l.control.extend({ options: { position: 'bottomleft' }, initialize: function () { this._insets = { "fr93":{translate: {x: 118, y:-485}, paths:["m-66 513l-76 531l-80 535l-89 533l-94 536l-99 533l-95 529l-93 521l-97 513l-98 504l-91 494l-81 498l-68 507l-66 512z"]}, "fr91_2":{translate: {x: 192, y:-353}, paths:["m-177 373l-178 370l-175 372l-177 373z", "m-179 375l-180 376l-180 371l-179 375z","m-173 394l-174 389l-170 393l-171 394z"]} } }, onadd: function (map) { // create dom elem...

c# - Validate Stored Encrypted Password in SQL Server 2012 -

in sql server run command: select hashbytes('sha2_256', '12345678') encryptedstring it gives 0xef797c8118f02dfb649607dd5d3f8c7623048c9c063d532cc95c5ed7a898a64f string output, string has 66 characters. on same side, itried encrypt password c# code, using this: public string getshaencryptedcode(string text) { //sha1 sha26 = new sha1cryptoserviceprovider(); sha256 sha26 = new sha256cryptoserviceprovider(); byte[] sha256bytes = system.text.encoding.utf8.getbytes(text); byte[] crystring = sha26.computehash(sha256bytes); string sha256str = string.empty; (int = 0; < crystring.length; i++) { sha256str += crystring[i].tostring("x"); } return sha256str; } suupose, if enter same "12345678" in c# code returns me string of 62 character long, string ef797c8118f02dfb64967dd5d3f8c762348c9c63d532cc95c5ed7a898a64f . how validate encrypted string coming sql server , other string c# code in order login user l...

google chrome - How can I open my extension's pop-up with JavaScript? -

i trying write javascript function open extension when extension icon clicked. know how open extension in new tab: var url = "chrome-extension://kelodmiboakdjlbcdfoceeiafckgojel/login.html"; window.open(url); but want open pop-up in upper right corner of browser, when extension icon clicked. the chromium dev team has explicitly said not enable functionality. see feature request: open extension popup bubble programmatically : the philosophy browser , page action popups must triggered user action. our suggestion use new html notifications feature... desktop notifications can used progammatically present user small html page popup. it's not perfect substitution, might provide type of functionality need.

javascript - How to override a Bootstrap plugin definition -

i want make adjustments (actually, fixes) bootstrap 3 button plugin, can't wait whole submit code/pull request/approval process. don't want make edits directly bootstrap.js file. thought add file called bootstrap-override.js loads after bootstrap.js , contained copy of buttons plugin code customizations, isn't working. code original buttons plugin fires. what correct pattern replacing defined plugin this: /* ======================================================================== * bootstrap: button.js v3.3.0 * http://getbootstrap.com/javascript/#buttons * ======================================================================== * copyright 2011-2014 twitter, inc. * licensed under mit (https://github.com/twbs/bootstrap/blob/master/license) * ======================================================================== */ +function ($) { 'use strict'; // button public class definition // ============================== var button = function (ele...

optimization - How can I optimize this mySQL query with JOIN or other operations? -

forgive newbie question, i'm still new mysql...just getting things run tricky. spent few hours writing monstrosity: select orders_comments.orderid, orders_comments.mediaid, orders_comments.imageurl, orders_comments_comments.comment orders_comments join orders_comments_comments on orders_comments.orderid = orders_comments_comments.orderid join ( select distinct orderid ( select * orders_comments orders_comments.orderid not in ( select log_comments.orderid log_comments join users_comments on (log_comments.userid = users_comments.userid) users_comments.userid = :userid ) , orders_comments.userid != :userid ) validorders order orderid asc limit :numorderstoreceive ) distinctorders on orders_comments.orderid = distinctorders.orderid i've read subquer...

javascript regular expression find decimal values -

i have requirement decimal values string if exists otherwise null, how can in javascript, below possibilities values want decimal value. 6pay-30d 3pay-30d 19.95-1st pay amount 3pay-30d sh3pay this regex please have look [0-9]*\.[0-9]* or refined one [0-9]+\.[0-9]+

javascript - how to disable sorting data in x axis in d3 line chart? -

i want show line graph example link .my data json this. [ { "timestamp": "23:33:58", "usage": 90 }, { "timestamp": "00:04:03", "usage": 94 }, { "timestamp": "00:54:04", "usage": 82 }, { "timestamp": "01:04:00", "usage": 100 }, { "timestamp": "01:34:02", "usage": 97 } ] but x axis didn't start 23:33:58.it start 00:00:00 mean 12.00 , draw in 23:59:00.so not requirement .i want solve problem please guide me. you can pass timestamp date can solve problem.then identify date , time.so can solve this.in example parse timestamp this. var parsetime = d3.time.format("%y-%m-%d %h:%m:%s").parse; then json format timestamp change this "timestamp": "2011-01-01 23:33:58" then ...

asp.net - Sitecore ChromesTypes ( Dynamic Placeholder ) In WebForm -

i have repeater generate dynamic placeholder. in edit mode when chose usercontrol it, send me error: "uncaught loaded unexpected element while trying rendering html server. expecting last tag closing script marker16860737917440451880.js:5353 sitecore.pagemodes.chrometypes.placeholder.sitecore.pagemodes.chrometypes.chrometype.extend._frameloaded" please me, tks , best regard it issue: http://developmentsitecore.blogspot.com/search?q=expecting+last+tag+to+be+closing+script+marker code in web application this ascx file <asp:repeater id="rpaccordion" runat="server" onitemdatabound="rpaccordion_onitemdatabound"> <itemtemplate> <asp:label runat="server" id="lblpageheading" text='<%#databinder.eval(container.dataitem,"name") %>'></asp:label> <div> <p> <sc:placeholder clientidmode="static" id="accordion_...

php - Inserting multiple images in mysql, also inserts multiple rows -

i searched google on place answer can't seem find right 1 i'll try here. i want store users' firstname, lastname , path of images in mysqli database , image in folder uploads. (the user can upload multiple images) this works , no problem. the issue is: when example type firstname , lastname , select 2 images , press upload button uploads creates 2 rows exact same values. i want store everyting in 1 row, see code below: <?php $con = mysqli_connect('localhost','root','','img_db'); mysqli_select_db($con,'img_db'); $rn = mt_rand(); if(isset($_post['submit'])&& isset($_files['image'])&& !empty($_post['firstname'])&& !empty($_post['lastname'])) { $firstname = $_post['firstname']; $lastname = $_post['lastname']; for($i=0; $i<count($_files['image']['name']); $i++) { $tmp_name = $_files['image'][...

jquery - Autocomplete select option using ajax -

i have select , input. when select option input should load autocomplete data on value of each option. <select> <option class="selectoption" value="1">option 1</option> <option class="selectoption" value="2">option 2</option> <option class="selectoption" value="3">option 3</option> <option class="selectoption" value="4">option 4</option> </select> <input type="text" name="search"> as understood need add selected value in dropdown input box. here code see if fits requirement. html code <select onchange="getval(this);"> <option value="option 1">option 1</option> <option value="option 2">option 2</option> <option value="option 3">option 3</option> <option value="option 4">option 4...

c# - cannot send emails with Amazon SES .NET SDK -

i can send emails smtp option in .net need use .net sdk send emails via amazon. gives me error says "email address not verified", event though sure verified. way, using test account(sandbox). what doing wrong? or missing anything? here code, var sesclient = new amazonsimpleemailserviceclient("akiajhxxxxxxxxxxx", "rvgdbckxilwjuiksexklwxxxxxxxxxxxx",amazon.regionendpoint.useast1); var dest = new destination { toaddresses = new list<string>() { "tayfun.ural@aryxxx.com" }, ccaddresses = new list<string>() { "arif.yilmaz@aryxxx.com" } }; var = "tayfun.ural@aryxxx.com"; var subject = new content("you're invited meeting"); var body = new body(new content("please join monday @ 7:00 pm.")); var msg = new message(subject, body); var request = new sendemailrequest { destination = dest, message = msg, source = }; var verify = sesclient.verifyemailaddress(new verifyemaila...

vb.net - Weighbridge data output format -

i'm developing weighbridge software client using vb.net 2008. don't have weighbridge device test, don't know output data format sent com port weighbridge device. please tell me how can resolve problem , weight value com port. you need 2 apps, fortunatelly both can found freeware: com port data emulator http://www.aggsoft.com/com-port-emulator.htm virtual serial ports emulator http://www.eterlogic.com/products.vspe.html first run virtual serial ports emulator , create connector type device, e.g. on com10. enables 1 app send data virtual serial port can opened , consumed second app. then run com port data emulator , setup virtual serial port created previously, e.g. com10. setup desired com port parameters , specify data , how should sent virtual serial port connector. then connect app com10 , done. if looking further inspiration, check open source project netwico .

Bash script different output when doubleclick vs. run in terminal -

Image
i have script (among others) generates wallpaper upon every login/midnight. has 755 permissions. part of code: #/bin/bash convert -size 1440x900 xc:none wall.png composite -gravity center ../pics/im256.png wall.png wall.png composite -geometry 118x67+661+578 ../pics/im-title-white.png wall.png wall.png time=`$home/bin/time.py | grep "\."` if [[ $time == *\'* ]] # <...1...> else # <...2...> fi i'm interested if $time variable has ' symbols in it. when there no ' symbols - good. now when know there @ least 1 ' symbol (or can force make way), when double-click script find myself in else statement, when run script in terminal - find myself in then statement. then statement, how? i cropped part failing (left - correct, right - wrong): it took me write post until notice shebang not shebang. #!/bin/bash fixed problem. it appears incorrect shebang defaulted /bin/sh incapable of running correctly. login shel...

How to resize text on android according to screen -

i working on android application in want set text size according screen. using following method, not re-sizing text size according screen. myrequesttext.settextsize(convertfromdp(21));//myrequesttext textview public float convertfromdp(int input) { final float scale = getresources().getdisplaymetrics().density; return ((input - 0.5f) / scale); }

httpd.conf - apache rewrite rules are not working after adding proxy pass -

i trying rewrite url in apache internally redirect requests apache tomacat here httpd.conf code <ifmodule mod_rewrite.c> proxyrequests off proxyvia off proxypreservehost on proxypass / http://localhost:8080/myapp/my.html proxypassreverse / http://localhost:8080/myapp/my.html rewriteengine on rewriterule ^/(.*)/$ http://localhost:8080/myapp/my.html?product=$1 [qsa] </ifmodule> so trying if enter localhost/myapp should redirect me localhost:8080/myapp/my.html next if enter url localhost/myapp/8 should redirect internally localhost:8080/myapp/my.html?product=8. now problem proxypass working absolutely fine. rewrite rule showing 404 error. if remove proxypass code same rewrite rule works shows modified url in browser. want know should place rewriterule make work proxypass , y rewrite rule showing modified urls? you need add [p] flag rewriterule . causes rewriterule 'proxy' same way proxypass directive does. @ ...

c# - Derived class and override method with derived arguments : how to code it better? -

i have question derivation , polymorphism , method signature i have class public abstract class paymentmethod { public abstract float getsalary (employee employee,vehicule vehicule) } and 2 others public class marinepaymentmethod : payementmethod { public override float getsalary (sailor sailor,boat boat) } public class airpaymentmethod : payementmethod { public override float getsalary (pilot pilot,plane plane) } we assume : public class sailor : employee{} public class pilot : employee{} public class boat: vehicule{} public class plane: vehicule{} so, "problem" code not compile , because signatures not same. i force keep base signature getsalary(employee employee, vehicule vehicule) and must cast in derived payment method, can use specific members of pilot , sailor , boat , plane in these specific payment method. my first question is: isn't bad smell cast continuously? my second question is: how make more elegant code design ? ...

javascript - SetTimeout inside SetTimeout not firing -

i trying create button gives feedback action performing. in angular, making put request server - @ point change button's state indicate - when receive response, change button's state again reflect success or failure 1.5 seconds , reset before button clicked. @ point message displayed reflect success or failure , after 5 seconds additional action should performed. message displaying should hidden if it's failure , page should redirect if success. it's last part not getting work. my question whether should able put settimeout inside settimeout? here code (inside function button): $scope.resetpassword = function() { $scope.showsuccessmessage = false; $scope.showfailedmessage = false; var querystring = $location.search(); var dataobject = { email1 : $scope.formemail1, email2 : $scope.formemail2, password1: $scope.formpassword1, password2: $scope.formpassword2, token: querystring.token }; var responsepromise = $http.put("/myurl/", ...

python - Feed google charts custom properties like color through gviz_api -

i'm having trouble propagating custom_properties color google chart through python layer gviz_api. i create bar chart individually colored bars such in example here: https://developers.google.com/chart/interactive/docs/gallery/barchart#barstyles but can't figure out how set throug gviz_api ( http://code.google.com/p/google-visualization-python/ ). i'm fine feeding data in way, dictionaries, lists, tuplets, 1 row @ time, long can color bars individually. here's latest non-working attempt, generate.py: import gviz_api def main(): # creating data description = {"test" : ("string", "test name"), "duration" : ("number", "duration")} data = [dict(test="test a", duration=1000, custom_properties={"role":"color:green"}), {"test": "test b", "duration": 4000}] # loading gviz_api.datatable data_table ...

php - Are there any way to check exitency of an array key inside the function -

i have project need echo $variable['key']; some times $variable['key'] not exist. , variables creates errors when echo $variable['key']; directly. my current method echo (isset($variable['key'])) ? $variable['key'] : ''; and not efficient way of doing that. not want write keys 2 times. i need function. checks $varible['key']; inside function , returns value of it. function get_ifisset(&$var = null){ if(isset($var)){ return $var; } } echo get_ifisset($vars['key']); but because of $variable['key'] not exist can not send them inside function this kind of usage throws error "undefined key". also following function approach dont like. function get_ifisset($var, $key){ if(array_key_exists($key, $globals[$var])){ return $globals[$var][$key]; } } i learn there way check exitency of array key inside function. property_exists(); array_key_exists(); isset(); you can pass a...

android - parsing json array which is returned as object using retrofit -

how can parse following response api using retrofit lib in android? { "elements": { "12": { ... }, "23": { ... }, "32": { ... } }, "more": null } here elements json object needed array. here trying public static class elementresponsedeserializer implements jsondeserializer<elementresponse>{ @override public elementresponse deserialize(jsonelement json, type typeoft, jsondeserializationcontext context) throws jsonparseexception { logger.d("json >>>> typeoft" + typeoft.tostring()); logger.d("json >>>> context" + context.tostring()); logger.d("json >>>> " + json.tostring()); jsonobject object = json.getasjsonobject(); object.get return new elementresponse(); } } and using way gson gson = new gsonbuild...

java - Catching unique constraint exception in JSF -

i have column "name" in database unique constraint. i'm trying handle database exception, catch it, , return user friendly message user. problem type of exception. cause of exception is org.postgresql.util.psqlexception but when exception (top exception javax.ejb.ejbtransactionrolledbackexception ) can't recognised psqlexception . after research found that, , tried se why can't "psqlexception" put code this: //code saving row database } catch (javax.ejb.ejbtransactionrolledbackexception e) { try { int = ((psqlexception)tisutil.getrooterror(e)).geterrorcode(); addmessagewarn("that name exists"); } catch (exception ex) { addmessageerror(ex); } } the goal see why java doesn't catch psqlexception . so, program goes section ejbtransactionrolledbackexception . getrooterror method finds root cause psqlexception , can't cast it. exception ex looks this: classcastexception", detailme...

mysql - Retrieve rows in which a coloumn doesn't contain a value -

i have mysql table below: | id | userids --------------- | 1 | 4,3,5 | 2 | 2,3 | 3 | 1,2,3 i want retrieve rows in userids doesn't contain 1. tried select * tablename 1 not in (userids) but not working. help? use find_in_set select * tablename find_in_set(1, userids) = 0 but should rather change table design. never store multiple values in single column!

android - How to close ListView's Contextual Action Mode on fragment destroy method -

i've succesfully implemented cab listview in fragment , work fine -> when hit or when change displayed fragment through navigation drawer, cab stays opened. need close cab in ondestroy method. i've tried this: listview.clearchoices(); listview.cancellongpress(); but has no effect cab. solutions here? i found pretty easy way how handle this: 1) make global variable of type actionmode: actionmode actionmode = null; 2a) assign actionmode in oncreateactionmode() method: @override public boolean oncreateactionmode(actionmode mode, menu menu) { getactivity().getmenuinflater().inflate(r.menu.action_mode, menu); actionmode = mode; return true; } 2b) put in ondestroyactionmode() method: @override public void ondestroyactionmode(actionmode mode) { actionmode = null; } 3) override ondestroy() method (you can use onpause() if want close cab every time fragment paused, may annoying users): @override public void ondestroy() { super.onde...

python - Flask-restful: How to only response to requests come with ('Accept':'application/json')? -

i have json api app, working well.now want accept , response json, not response text/html request. app looks this: class books(resource): def get(self): return json.dumps(data) someone can help? thanks. you use preprocessing request handler reject request wrong mimetype. there property of request object (not documented tought, present @ least on flask 0.10) named is_json given flask app called application, use : from flask import request, abort, jsonify @application.before_request def only_json(): if not request.is_json: abort(400) # or custom badrequest message i use flask jsonify function build reponse, ensure response formatted in json, , sets right headers. class books(resource): def get(self): return jsonify(data)

javascript - Can i force webcomponents.js to re-parse the DOM on Firefox? -

well, need re-parse @ specific time. why? i dynamically add component , doesn't "polyfilled" if know mean. stays this: <div id="componente" allowfullscreen=""><viva-card1></viva-card1></div> but viva-card have stuff , prototype etc, etc. doesn't show on firefox. yes, can force webcomponents.js synchronously upgrade elements: webcomponents.upgradeall(document.queryselector('#componente')); this synchronously upgrade entire tree, starting #componente (if it's component). for more information, see webcomponentsjs/issues/#169 .

ios8 - SpriteKit presentScene crash app -

i navigating between sk scenes using following code: skscene *newscene = [[myscene alloc] initwithsize:self.size state:state]; float duration = 1; sktransition *transition = [sktransition fadewithduration:duration]; [self.view presentscene:newscene transition:transition]; regardless type of scene trying present, app crashes every time exc_bad_access (code 1) without zombies.. looks "present scene won't work correctly on xcode6, did work before upgraded xcode5 edit: initwithsize code: -(id)initwithsize:(cgsize)size state:(gamestate)state{ if (self = [super initwithsize:size]) { [self setupscene]; if (state == gamestatelaunch) { [self setuploadingscreen]; [self switchtolaunch]; } else if (state == gamestatetutorial || state == gamestatereplay) { [self switchtotutorial]; } else if (state== gamestatemainmenu) { [self switchtomainmenu]; } } return self; } i manag...

How do I translate the loop part of Common Lisp code into Clojure? ... functional orientation -

how translate loop part of working common lisp (sbcl v.1.2.3) code clojure (v.1.6)? bit frustrated after working on hours/days without results. somewhere don't functional orientation suppose ... ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; unconditional entropy ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; probabilities (setq list_occur_prob '()) ;; init ;; set probabilities want calculate entropy (setq list_occur_prob '(1/2 1/3 1/6)) ;; ;; function calculate unconditional ;; entropy h = -sigma i=0,n (pi*log2(pi) ;; bits persymbol. (setq entropy 0) ;; init (setq entropy (loop in list_occur_prob y = (* (log_base2 i) i) collect y )) (setq entropy (* -1 (apply '+ entropy))) ;; change sign ;; print unconditional entropy in bits per symbol. (print entropy) ;; btw, here entropy 1.4591479 bits per symbol. they key operation need map transforms sequence using function. in entropy ...

javascript - Reaching maximum content in a page using image scroll then should hide image using percentage of a window -

<script> $(window).scroll(function() { if ($(window).scrolltop() > 600){ $("#bottom").addclass('show'); } else { $("#bottom").removeclass('show'); }; }); </script> <button type="button" onclick="scrollwin()"><img src="images/aerodown.png"></button> function scrollwin() { window.scrollby(0, 180); } this code. set 1 image scroll down when click it. problem when using it, in multiple devices image has been hide(but in browser image can view , click. not work mobile browsers). want hide image using percentage. means when reach 99% of page image should hide(am set opacity function). new jquery. i not recommend define height static value. because add/remove page you'll need update value manually. fetch height , multiply target percentage. jsfiddle: http://jsfiddle.net/ejdu0olf/1/ html: <a href="javascript:;" cl...

Filtering & sorting by dates in MongoDB's oplog -

i'm trying filter oplog.rs view operations logged after date. comparison operators don't seem work dates in mongodb: db['oplog.rs'].find({ts: {$gte: isodate("2014-12-15t00:00:00z")}}) what's confusing lot of online sources saying way not working. want return results ts field @ least december 15th or more recent, getting results before period. if switch $gte $lte no results @ displayed, though there entries both before , after specified date. also, can't seem sort results either. if try this: db['oplog.rs'].find().sort({ts: -1}) i this: error: { "$err" : "runner error: overflow sort stage buffered data usage of 33566005 bytes exceeds internal limit of 33554432 bytes", "code" : 17144 } if filter results make them more recent, hoping overcome sorting error, can't mongodb's basic operators. how can filter results of find operation date? comparion operators work fine date, ts ...

asp.net - Add HTML Table to Adobe FormsCentral - AdobeAcrobat XI Pro -

i want add html table adobe formscentral , create pdf template , want bind data cells using vb.net code. i not able see html table control|(field) on formscentral drag , drop on new form. kindly me how add html table thanks

c++ - template class with parameter -

class in program should use fftw library image processing. class should have possibilities work float , double types. purpose implement following construction: class myclass { ... public: template <class t> class ffttypes{ }; ... } and include *.inl file in header file "myclass.h" write template <> class myclass::ffttypes<float> { private: typedef fftwf_plan fft_plan; public: typedef fftwf_complex fft_complex; static fft_complex* fft_malloc(int size .... } and similar class double type: template <> class myclass::ffttypes<double> { private: typedef fftw_plan fft_plan; public: typedef fftw_complex fft_complex; static fft_complex* fft_malloc(int size) today find out should add function in class myclass parameter fft_complex type. surf internet , different sources not find way how can it? have ideas?

sas - Flagging the first instance in an episode without transposing -

i'm working in sas , i'm trying create column disease_flag flags first row given disease code occurs in array. in case disease code care 'a36'. ideally without first transposing. so data looks this: episode_id diagcode1 diagcode2 diagcode3 121 a36 b11 121 a36 b11 b12 121 b12 b05 b06 122 b12 122 a36 b12 b13 122 b12 b01 123 b12 b13 b11 123 b12 a36 123 b13 b12 i want add additional column called disease_flag flags first instance of a36 in array of columns diagcode1--diagcode3. thus final output this: episode_id diagcode1 diagcode2 diagcode3 disease_flag 121 a36 b11 1 121 a36 b11 b12 0 121 b12 b05 b06 0 122 b12 0...

javascript - Jquery datepicker change event trigger and input's default change event -

i have datepicker <input type='text' class='inp'> <script> $('.inp').datepicker(); $(".inp").on("change",function (){ console.log('inp changed'); }); </script> when first change '.inp' manually type there value, click on datepicker's opened calendar. 2 'change' event listeners. first manual change, datepicker change. how can avoid this? thanks! set input readonly , change value of field through icon only. <input type='text' class='inp' readonly /> then use onselect selected date, following: $(function() { $(".inp").datepicker({ onselect: function(datetext, inst) { // alert(datetext); } }); });

android - How to set the Watchface in the center of watch -

hy working on developing watch face. know there round , square watch face have designed watch face in such way not crop in round watch . on same time want set @ center of screen . so tell me how set in center of screen regardless of round , rectangular screen. have done every thing seems start adjusting left side of screen . i sharing code here rectangular layout <?xml version="1.0" encoding="utf-8"?> <android.support.wearable.view.boxinsetlayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" app:layout_box="all" android:layout_height="match_parent" android:layout_width="match_parent" android:padding="15dp"> <framelayout android:layout_width="match_parent" android:layout_height="match_parent" android:padding="5dp" app:l...

c++ - vector inside a structure if the object of struct is dynamically created then we cannot push elements in the vector -

struct node { vector<int> v; }; //case 1: struct node *t = (struct node *) malloc(sizeof(struct node)); t->v.push_back(4);// segmentation fault //case 2: struct node t; t.v.push_back(6); i know reason of segmentation fault in first case have dynamically allocated memory . trying use memory not allocated. in second case using stack memory. can explain more ? sry bad style of asking doubt , newbie use new instead of malloc . the default constructor of struct not called when using malloc , vector not initialized. as vector class non-trivial constructor , struct has non-trivial constructor, can not ignored. remember delete pointer after using avoid memory leak.

java - Skipping through elements on SVG bar graph in Selenium webdriver -

Image
i've build method in java selenium, whereby want click on svg bar graph , click on first 3 bars (screenshot below) i've done implementing below code: public static void barchartselector(internetexplorerdriver driver) { genericcontrols.waitcommands.fluentwaitonbarchartselector(driver); webelement parent = driver.findelement(by.classname("highcharts-series-group")); genericcontrols.waitcommands.fluentwaitonbarchartselector(driver); list<webelement> children = parent.findelements(by.tagname("rect")); genericcontrols.waitcommands.fluentwaitonbarchartselector(driver); children.get(0).click(); children.get(1).click(); children.get(2).click(); genericcontrols.waitcommands.fluentwaitonrelationalbargraphdisplay(driver); } however, i'm finding error: "exception in thread "main" java.lang.indexoutofboundsexception: index: 2, size: 0 @ java.util.arraylist.rangecheck(unknown source) @ jav...

sql server - Creating dynamic view? -

i working in database stores park information in table. table lists park names , components of parks , ids of component types. below... "parkname", "componentname", "componentid", "componenttypeid" -------------------------------------------------------------- smith park, north slide, 1, 12 smith park, south slide, 2, 12 smith park, swing set a, 3, 14 smith park, swing set b, 4, 14 adams park, east slide, 5, 12 adams park, west slide, 6, 12 adams park, swing set a, 7, 14 adams park, swing set b, 8, 14 adams park, sandbox a, 9, 15 adams park, sandbox b, 10, 15 the attributes of each component type stored in own table following... dbo.attributes_12 dbo.attributes_14 dbo.attributes_15 the attributes in each table different, have 4 common fields - "componentname", "componentid", "year constructed" , "comments" i did not create database, i'd able create view lists each park components , attr...

Can Visual Studio Community install TFS (Team Foundation Server)? -

our team decide use visual studio community instead of visual studio 2013. wonder can install tfs in visual studio community , work well? thanks! visual studio community edition feature equal visual studio professional except in organization can used open source projects, academic research or learning. other commercial scenarios you're allowed use community edition 5 users. team foundation server separate product. if have msdn subscription (which won't have if you're using vs community), licenses install tfs. however, instead of installing tfs can @ visual studio team services , hosted version of tfs free 5 users. so, if you're less 5 users, can use community , visual studio team services free.

angularjs - How to pass multiple parameter in angular filter function, not custom filter -

i tried hard , visit lot of similar question still unable solve issue. i want pass parameter in angular filter function. found solution below it's not working. getting undefined object have used in ng-repeat . <li ng-repeat="user in users | filter:isstatus(user,secondparam)">{{user.name}}</li> there solution angular custom filter below not working angular filter function. <li ng-repeat="user in users | filter:isstatus:user:secondparam">{{user.name}}</li> jsfiddle - can see problem here. will try: $scope.isstatus = function(secondparam, thirdparam){ return function(user) { console.log(secondparam); console.log(thirdparam); return user.status == $scope.status; } updated version http://jsfiddle.net/4pyza/282/

c# - Add Ext.Net.Gridpanel in code behind -

i'm trying build several gridpanels result of search in db. but never appears... here code, what's wrong ? http://pastebin.com/wutzwzrp edit ok, got it. have same problem, solved adding gridpanel : renderto = this.extpanel.clientid and after build : ext.gridpanel grid = this.buildgridpanel(forwarder.key, forwarder.value); grid.render(); //this.extpanel.controls.add(grid); public void addgridpanel() { ext.net.gridpanel g=new ext.net.gridpanel(); ext.net.store store1=new ext.net.store(); model model = new model(); (int = 1; < tas.gettaskde().count / 2; i++) { fields = fields + "," + tas.gettaskde()[i].fieldname; modelfield modelfield = new modelfield(); modelfield.name = tas.gettaskde()[i].fieldname; model.fields.add(modelfield); if (tas.gettaskde()[i].visibility == ...

Apache Camel Multicast notifyBuilder fails -

of reason, queue_a not has 1 exchanges - has 0, unless add thread.sleep(100) test. guess whencompleted/whendone isn't done when says it's done. how can verify done? multicast().parallelprocessing().to(queue_a, queue_b, queue_c, queue_d) and testing with: @test public void test() { notifybuilder notify = new notifybuilder(context) .from(queue_incoming) .whencompleted(1) .create(); template.sendbody(queue_incoming, streamtostring(loadresourceasstream("/data/testdata.xml"))); boolean matches = notify.matches(4, seconds); asserttrue("notify failed", matches); thread.sleep(100); //without this, fails verifyendpoints(1, context, queue_a, queue_b, queue_c, queue_d); } public static void verifyendpoints(int expectedsize, modelcamelcontext context, string... endpoints) { (string endpoint : endpoints) { browsableendpoint = context.getendpoint(endpoint, browsableendpoint.class); ...

objective c - NSTextView autocompletion delegate method not called from popup window -

i programmatically call complete: call nstextview autocompletion delegate method: - (nsarray *)control:(nscontrol *)control textview:(nstextview *)textview completions:(nsarray *)words forpartialwordrange:(nsrange)charrange indexofselecteditem:(nsinteger *)index i have 2 tables, 1 in main sheet, , other 1 in popup window. popup window modally opened sheet. both tables have column same subclass of nstextview. both tables have delegate same file owner, delegate method called table in main sheet. the strange thing other delegate methods correctly called table in popup window: - (bool)control:(nscontrol *)control textshouldendediting:(nstext *)fieldeditor - (bool)control:(nscontrol *)control isvalidobject:(id)object - (bool)tableview:(nstableview *)atableview shouldedittablecolumn:(nstablecolumn *)atablecolumn row:(nsinteger)rowindex update : about nstableview structure: the tables cell-based nstableview . column made nstextfieldcell i've subclassed. code below su...

r - handle dates and concatenate strings in dplyr (SQL) -

i have database year , doy (day of year) columns. i'd add column date , e.g. mutate(data, date = date(julianday(year || '-01-01'), '+'||(doy-1)||' day')) but not work, because sql string concatenation "||" transformed "or". how that? in case have convert string in sql date object. in r use lubridate , ymd there simple way mutate in dplyr (sql)? christof mutate in dplyr modifies result not modify table in database gather want. the question did not state database being used , important in absence of sqlite used below. 1) here code using rsqlite package update table df in database date column. (doy-1) might needed in place of doy depending on origin (0 or 1) of doy . might need cast doy integer in run worked without that. library(rsqlite) # create test database table df con <- dbconnect(sqlite()) df <- data.frame(year = 2014, doy = 15) dbwritetable(con, "df", df) # add date column ta...

php - How to extract and "compress" .phar-files using Windows -

basically need extract, edit , re-pack .phar language file using windows. have downloaded php , trying run .phar files php.exe php program-window disappears. is there easy way doing or step-by-step guide? the php releases contain phar executable can run on windows, too. you can use extract files , add files archive. $ phar help-list add compress delete extract help-list info list meta-del meta-get meta-set pack sign stub-get stub-set tree version $ phar add add entries phar package. required arguments: -f <file> specifies phar file work on. ... number of input files , directories. if -i in use files , matching given regular expression being packed. if -x given files ...

arrays - Loading Analyze 7.5 format images in python -

i'm doing work whereby have load manipulate ct images in format called analyze 7.5 file format . part of manipulation - takes absolutely ages large images - loading raw binary data numpy array , reshaping correct dimensions. here example: headshape = (512,512,245) # shape image should headdata = np.fromfile("analyze_ct_head.img", dtype=np.int16) # loads image flat array, 64225280 long. testing, large array of random numbers head_shaped = np.zeros(shape=headshape) # array hold reshaped data # set of loops problem ux in range(0, headshape[0]): uy in range(0, headshape[1]): uz in range(0, headshape[2]): head_shaped[ux][uy][uz] = headdata[ux + headshape[0]*uy + (headshape[0]*headshape[1])*uz] # note weird indexing of flat array - pixel ordering have work i know numpy can reshaping of arrays quickly, can't figure out correct combination of transformations needed replicate effect of nested loops. is there way replicate strange indexing ...

sprite kit - iOS SKSpriteKit - Flickering Caused by SKLightNode -

i using sklightnode cast shadows in gamescene. adding sprites dynamically, should cast shadows. working fine, when added sprite first 'appears' in scene, entire scene scales 50% single frame, , returns normal size. creates flickering effect invasive overlooked. happens on simulator, , on physical devices - both ipad , iphone. has else had problem, , if so, there way prevent happening? thanks.

c++11 - Run a function when number of references decrease in shared_ptr -

i developing cache , need know when object expired. possible run function when reference counter of shared_ptr decrease? std::shared_ptr< myclass > p1 = std::make_shared( myclass() ); std::shared_ptr< myclass > p2 = p1; // p1.use_count() = 2 p2.reset(); // [ run function ] p1.use_count() = 1 you can't have function called every time reference count decreases, can have 1 called when hits zero. passing "custom deleter" shared_ptr constructor (you can't use make_shared utility this); deleter callable object responsible being passed, , deleting, shared object. example: #include <iostream> #include <memory> using namespace std; void deleteint(int* i) { std::cout << "deleting " << *i << std::endl; delete i; } int main() { std::shared_ptr<int> ptr(new int(3), &deleteint); // refcount 1 auto ptr2 = ptr; // refcount 2 ptr.reset(); // refcount 1 ptr2.reset(); // refcount...

android gradle - How to disable Dexguard? -

i went through documentation looking way how disable dexguard when running gradle keeping plugin: 'dexguard'. i tried modify proguardfile getdefaultdexguardfile('dexguard-debug.pro') nothing unfortunately no luck. need set no dexguard functionality functional testing suit monkeytalk cannot instrument apk now. how turn dexguard functionality off? update zatziky's answer current android gradle plugin (v1.0+) , dexguard plugin (6.1.+) to create dexguard plugin switch may following in root build.gradle add property ext (or create if not done yet, see here why that ) ext { enabledexguardplugin = false .... } in app build.gradle add plugin this: apply plugin: 'com.android.application' if(rootproject.ext.enabledexguardplugin) { apply plugin: 'dexguard' } and if have library projects this apply plugin: 'com.android.library' if(rootproject.ext.enabledexguardplugin) { apply plugin: 'dexguard' }...

excel - Array VBA code (Data Extraction) -

current;y working on extracting data (rows) based on criteria userform code below work on individual sheets once button available on sheet can code below work , writes "slave" sheet expected, cannot life of me correct complied code arrays. i've tried different code various places including here i'm not competent enough debug fault. could me out here, or point me in right direction? sub commandbutton1_click() dim strsearch string, lastline integer, tocopy integer strsearch = cstr(inputbox("enter string search for")) 'enter code sheets in here... lastline = range("a65536").end(xlup).row j = 1 = 1 lastline each c in range("a" & & ":z" & i) if instr(c.text, strsearch) tocopy = 1 end if next c if tocopy = 1 rows(i).copy destination:=sheets("slave").rows(j) j = j + 1 en...

database - Encountering a PHP error "Illegal string offset" in fetching data using codeigniter -

so, experimenting on web app. want displaying user's list of posts in timeline matching logged-in user's id id on 'posts' database. here's model public function load_posts($user_id) { $this->db->where("user_id",$user_id); $query=$this->db->get('posts'); if ($query->num_rows()>0) { foreach($query->result() $rows) { $haha = array( 'post_id' => $rows->id, 'title' => $rows->title, 'artist' => $rows->artist, 'album' => $rows->album, 'caption' => $rows->caption, ); } return $haha; } return array(); } my controller public function welcome() { $data['title']= 'welcome'; $user_id=$this->session->userdata('user_id'); $haha['hah'] =...