Posts

Showing posts from July, 2012

cql3 - Cassandra can not delete role or user which in the role or user list -

Image
create role testrole password = 'test'; create role testrole password = 'test'; list roles shows roles successfully. drop role testrole; invalidrequest: code=2200 [invalid query] message="testrole doesn't exist" drop role test1; invalidrequest: code=2200 [invalid query] message="test1 doesn't exist" image of cqlsh output. the role showed in list can not deleted. how can happen??? when not quoted, role names not preserve case, can see list roles output. if role names case-sensitive, you'll need enclose them in double quotes (like keyspace or table names). did edit output pasted? ask because shouldn't able run same create role statement twice shown. if so, else elided? suspect able drop role once, not second time (that's expected behaviour & i'm seeing).

Select2 Plugin Jquery , issues with default message -

i using select2 plugin display auto suggested drop downs , tags. below how code looks : $('.select2member').select2({ multiple: true, minimuminputlength :1, placeholder : cake.message.notice.b, ajax { url ": cake.url.a , datatype : json, quietmillis : 100, cache : true, data :function(term,page){ return{ term: term, page_limit : 10 }; } } }); everything seems working fine except when field empty .it's drop down message appears saying 'no matches found'. i want remove default message when field empty . i have tried adding below paramenters jquery: tags:[''], tokenseparators: [','], formatnomatches: function() { return ''; }, dropdowncssclass: 'select2-hidden' also added class select2-hidden display:none !important attribute. in above case , gets ...

javascript - Temporary form data to table as object in Angular -

what trying take 4-5 inputs in form, store object , when user selects 'save', temporarily store in session , able access show object in row in table on same page , allow user enter data form input again add next object. so in end, user may enter 1 object or 6 , when done, allow user submit objects array of objects or effect. so not angular power user, figure has power somewhere. questions evolve around approach , maybe trying find example or so. of able on this? thanks much. well, quite easy if have table , form on same page. can use 1 scope variable array of entered objects , 1 scope variable current object itself. i'll example without of requirements (e.g. user can enter 6 objects most), should quite straight forward implement. first take html: <form ng-controller="rolescontroller"> <label for="name">name</label> <input type="text" id="name" ng-model="current.name"> ...

Icomoon glyph on group grid Extjs action column not working? -

i have issue on showing icomoon glyph on grid action columns using sencha architect in extjs 5.0 application. using group grid here. glyphs showing nicely on ext button btw. i have made overwrite class ext.grid.column.action shown in following link ext.define('myapp.override.grid.column.action', { override: 'ext.grid.column.action', // overridden implement defaultrenderer: function(v, cellvalues, record, rowidx, colidx, store, view) { var me = this, prefix = ext.basecssprefix, scope = me.origscope || me, items = me.items, len = items.length, = 0, item, ret, disabled, tooltip,glyph, glyphparts, glyphfontfamily; // allow configured renderer create initial value (and set other values in "metadata" argument!) // assign new variable here, since if modify "v" modify arguments collection, meaning // pass incorrect value getclass/gett...

html - How do you put value or placeholder in form:input Spring MVC -

hi know how place attribute "value","defaultvalue" or "placeholder" form:input original code <form:input path="ggpath" cssstyle="width:100%"/> what want <form:input path="ggpath" cssstyle="width:100%" value="example"/> but if place value attribute. give me error. appreciated use following code <form:input path="ggpath" style="width:100%" placeholder="example"/>

Connecting to other machine in LAN MongoDB using IP -

Image
i know question somewhere similar few other questions of type couldn't find answers posted useful me. im posting again. i tried bind_ip follows make mongo instance listen other machines in lan but when trying connect in shell the 2 systems connected through lan. please answer in possible scenarios. added mongod.exe list of firewall apps , working fine.

javascript - C# ASP.NET Server Side Carousel Slider with Dynamic Number of Pages -

i working server side carousel slider , having hard time dealing manual scrolling of slider. although, automatic sliding working using data-interval="5000" data-ride="carousel" of bootstrap css , js. know how make slides work in client side scrolling. managed fetch data server slider controls <a href=""...next/> , prev doesn't work. code: slider.aspx <asp:panel runat="server" id="mycarousel" class="carousel slide" data-interval="5000" data-ride="carousel"> <ol class="carousel-indicators"></ol> <asp:panel runat="server" id="carousel_inner" class="carousel-inner"> </asp:panel> <%--- these won't work.---%> <a class="left carousel-control...

javascript - ExtJS 6: Should I use the config object? -

i'm building application extjs 6. i've read guides, tutorials , best practice tips. dont understand yet is, why should use config object? with config: ext.define('myproject.foo.bar', { extends: 'ext.window.window', ... config: { title: 'my title' } }); without config: ext.define('myproject.foo.bar', { extends: 'ext.window.window', ... title: 'my title' }); both working expected. can tell me difference , possible benefits? it's described in class system guide: configurations encapsulated other class members getter , setter methods every config property automatically generated class prototype during class creation if methods not defined. the auto-generated setter method calls apply method (if defined on class) internally before setting value. may override apply method config property if need run custom logic before setting value. if apply method ...

javascript - How to Hide multiple dynamic Columns in JS -

here have set 1 button, toggle button. if click button part of fields should hide. if hit again, hidden field should show. scenario. here html code: <!-- toggle button code here --> <td align="center"> <input type="button" id="viewbutton" style="width:80px;" class="button" onclick = "hide()" value="view more"/> </td> <!-- headers of table hide while hit above button--> <tr> <th width='120' scope='col' id='remarks'><div align="left">remarks</div></th> <th width='66' scope='col' id='lan' ><div align="left">lan mac address</div></th> <th width='70' scope='col' id='wifi' ><div align="left">wifi mac address</div></th> <th width='65' scope='col' id='scrapped' ...

javascript - Methods to introduce notifications on a webpage without page refresh -

we have webpage there notification tab. notifications taken notification table if there particular user. event fired when page refreshed. we want implement notification should displayed user instantly without refreshing page. i know signalr sql dependency. sql dependency there comes database polling overhead. you can have signalr notify clients of database changes without polling database. have @ this tutorial signalr database notifications. \ it works following way: after update database, call method update clients along data. hope helps. best of luck!

nginx - Xdebug with PHPStorm and a Docker container -

Image
setup: windows 10; docker running boot2docker on hyper-v; phpstorm 9 webserver on vm nginx. i've configured xdebug.ini php5-fpm as: zend_extension=xdebug.so xdebug.remote_enable=on xdebug.remote_port=9000 xdebug.remote_connect_back=on xdebug.remote_handler=dbgp xdebug.profiler_enable=0 if set breakpoint , reload page incoming connection xdebug in phpstorm: i wonder there 1 file shown , not entire project bigger. if accept connection can debug first line not stopping on breakpoint , creates server entry looks like: what strange host empty. added server correct mapping got ignored. so how xdebug stop on breakpoints? what strange host empty. phpstorm requires field filled uses recognize server entry (and therefore path mappings) use -- ide supports debugging same code base running on different domains / remote servers. in particular case servername field / parameter of nginx configuration empty. can fix providing value in nginx config file.

javascript - Do fancy box images in links load if not clicked? -

i use fancybox on site show secondary images if wanted user. images in question reside inside fancybox links, so: <a class="fancybox" title="click see more detail" href="media/more-detailed-image.jpg"><img src="media/image-name.jpg" alt="etc"></a> do browsers load fancybox images if they're not clicked user? no. afaik fancy box , similar scripts set css display property none in turns prevents element being rendered. so images not fetched browser unless become visible. refer this article please.

html - find auto change in next input type text in jquery -

i have 2 inputs of type text interconnected. upon entering value in 1st textbox, 2nd textbox auto completed , populated value. at moment when value in 2nd textbox changed, want value of 2nd textbox using jquery. i have tried .blur , .change function not getting called desired. you need use keyup function detect changes occurs. see sample code below.. $('#t1').keyup(function(){ $('#t2').val($('#t1').val()); }); $('#t2').keyup(function(){ $('#t1').val($('#t2').val()); }); refer link example

Keyword matching algorithm -

so i'm trying find way create algorithm matches keywords. so looking works bit linkedin. basically person creates account choosing keywords database selecting skills. ex. "adobe photoshop" , selects his/her "level of knowledge" in specific program ranging 1-5. and on other side employer puts in job posting selecting keywords relevant job. , employer has option drag keywords 2 different categories. simplicity lets call category 1 " important" , category 2 "less important" category 1 weighted x3 , cathegory 2 x1,5 example: if adobe photoshop considered "very important" , user has selected 4 on adobe photoshop skill level. he/she awarded 12 points. i'm trying details out possible. now kind of algorithm optimal matching keywords , putting users in kind of " highscore table" presenting best candidates specific posting i hope got relevant info out. thanks !

python - Wxpython doubling up underscore characters in Menu event.GetLabel() -

i load menu filenames user able choose from. if file name contains underscore character (_), event.geteventobject().getlabel(event.getid()) returns value underscore character (_) doubled up. file name of a_file.txt becomes a__file.txt can around problem using event.geteventobject().menuitems[event.getid()].getlabel() but not not know if there repercussions of using don't particularly want trawl through 1000's of lines of code hunting instances of strange issue. have explanation behaviour , how avoid it? the demonstration code below illustrates problem , work around. tests normal file name, file name spaces , file name underscore. import wx class menuproblem(wx.frame): def __init__(self, *args, **kwds): self.frame=wx.frame.__init__(self, *args, **kwds) self.menubar = wx.menubar() # self.statusbar = wx.statusbar(self-1) self.createstatusbar() self.setstatustext("demonstration of wxpython...

Extract string between the pattern1 and pattern2 in sql server -

data in column(c1): some_datadata1/by_user/some_other_other_data1/somedate1 some_datadata2/by_user/some_other_other_data2/somedate2 some_datadata3/by_user/some_other_other_data3/somedate3 some_datadata4/by_user/some_other_other_data4/somedate4 output required: some_other_data1 some_other_data2 some_other_data3 some_other_data4 i looking query so i tried following did not work: select col1, substring(col1,charindex('by user/',col1)+len('by user/'), charindex('/',col1)-charindex('by user/',col1)-len('by user/')) tablename it better split strings in application code. however, if have no choice, can use left since pattern1 first 1 on left of string: select col1, left(col1, charindex('by_user/',col1) -2) (values ('some_datadata1/by_user/some_other_other_data1/somedate1') , ('some_datadata2/by_user/some_other_other_data2/somedate2') , ('some_datadata3/by_user/some_ot...

android - White list of devices able to connect to server -

i want employees able connect server mobile application. in addition username/password type of security, pre-approved devices able connect server , try login. is there way configure kind of certificate manually on devices , server allow devices connect? ssl maybe? ideally, certificate unique each device (so can later revoke access device). you can use following code unique device id , can keep id on service side , can use revoke access server. reference see device unique id final telephonymanager tm = (telephonymanager) getbasecontext().getsystemservice(context.telephony_service); final string tmdevice, tmserial, androidid; tmdevice = "" + tm.getdeviceid(); tmserial = "" + tm.getsimserialnumber(); androidid = "" + android.provider.settings.secure.getstring(getcontentresolver(), android.provider.settings.secure.android_id); uuid deviceuuid = new uuid(androidid.hashcode(), ((long)tmdevice.hashcode() << 32) | tmserial.hashcode())...

ios - UITextInputMode.activeInputModes() crashes in Swift 2 -

i want uitextinputmode in swift 2 uitextinputmode.activeinputmodes() crashes. let x = uitextinputmode.activeinputmodes() // crash here t in x { print(t) } it bug in xcode 7 mentioned here . says: summary: prior xcode 7 gm, uitextinputmode.activeinputmodes() returned array of uitextinputmode instances. however, in xcode 7 gm, method signature in header file , documentation states returns array of strings, incorrect. result, code uses activeinputmodes correctly no longer compiles, , attempting use activeinputmodes in playground throws exception.

angularjs - How to deal with spurious type script error: types of property $timeout of types base class and derived class are incompatible? -

Image
since upgrading typescript 1.6, i've been getting appears spurious error ng.types: typescript 1.6 class 'derivedclass' cannot extend class 'baseclass': types of property $timeout of types base class , derived class incompatible here's code sample: module app.test { class derivedclass extends baseclass { // notice there's nothing in derived class } class baseclass { constructor(timeout: ng.itimeoutservice, val1: string, otherval: ng.ilogservice) { var vm = this; vm.$timeout = timeout; vm.somevalue = val1; vm.othervalue = otherval; } $timeout: ng.itimeoutservice; // angular.itimeoutservice works somevalue: string; othervalue: ng.ilogservice; } } angular.itimeoutservice works, or adding import ng= angular; in modules works. didn't used issue in previous versions of typescript. is best practice repeat alias (eg: import ng = ...

vb.net - Dynamic creation of class instances -

is there way create class instances on fly , refer them later? have class various methods , properties designed hold & calculate product data. i'd application able handle many individual products user needs. code won't work should give idea of i'm asking: for x = 1 howevermany dim product_ & x.tostring() new myproductclass next x i appreciate may not best approach (i should use lists or arrays hold product data) i'm curious whether possible technical standpoint. i'm using vb.net answers in .net language welcome. thanks. store them in list(of t) . can linq 1 or more objects in list. 'class level private products new list(of myproductclass) 'place load them x integer = 1 howevermany dim myc new myproductclass mpc.id = x 'set other properties needed products.add(mpc) next get 1 it's id: dim mpc4 = (from p in products p.id = 4).firstordefault if not mpc4 nothing 'object exists end if you can make othe...

c# - MVC 6 Post action parameter is null -

Image
i have mvc 6 application , separate mvc 6 webapi service. i send object application using code: this view part of it: the client sends webapi service: where parameter null: in fiddler log 0 content-length: what else should set? it important set encoding , media type of stringcontent. if use postasjsonasync take care of part - unfortunately can't use in dnx. so proper code of client: string content = newtonsoft.json.jsonconvert.serializeobject(blog); httpresponsemessage response = await client.postasync("api/values", new stringcontent(content, encoding.utf8,"application/json"));

jquery - insert element after another with multiple containers -

i have following html: <div class="div one"> <div class="text">one</div> <svg>object</svg> </div> <div class="div two"> <div class="text">two</div> <svg>object</svg> </div> <div class="div three"> <div class="text">three</div> <svg>object</svg> </div> and insert text div after svg object, using this: $('.div .text').each(function(){ $(this).insertafter('.div svg'); }); but output like: codepen <div class="div one"> <svg>object</svg> <div class="text">three</div> <div class="text">two</div> <div class="text">one</div> </div> <div class="div two"> <svg>object</svg> <div class="text">three</div> <div class="text">two...

swift - Xcode 7: crash on breakpoint stop -

Image
i have extremely annoying problem! xcode 7 crashes on every breakpoint when tries symbolicate. i have done several things including deleting xcode , reinstalling it... i had same issue on previous xcode 6.x any clue? wondering if should reinstall mac os scratch... i solved issue changing optimization level in build settings, make sure set none debug configuration , make sure run scheme uses debug configuration.

click - how do I distinguish between longpress and singletap in android? -

i have card game want single tap action on card, , longpress on card shows me bigger image of card. know there gesturelistener, how use it? here code: gd = new gesturedetector(this, this); gd.setondoubletaplistener(new ondoubletaplistener() { @override public boolean ondoubletap(motionevent e) { log.d("ondoubletaplistener", "ondoubletap"); return false; } @override public boolean ondoubletapevent(motionevent e) { log.d("ondoubletaplistener", "ondoubletapevent"); //if second tap hadn't been released , it's being moved if(e.getaction() == motionevent.action_move) { } else if(e.getaction() == motionevent.action_up)//user released screen { } return false; } @override public b...

javascript - how to show different icon for google map markers? -

i want show different marker icons in google map.i have enclosed code .here have different icons in markers1[7].i want show these icons in google map have added fiddle https://jsfiddle.net/h9selt22/7/ instead of default marker iconi need show dynamic marker icon angular.module('myapp', []) .controller('mapctrl', [ '$scope', '$http', '$compile', function ($scope, $http, $compile) { //------------------------------------------------------------------------------------------------------------------------------------------------- $scope.find = function () { var gmarkers1 = []; var markers1 = []; var infowindow = new google.maps.infowindow({ content: '' }); // our markers markers1 = [ ['0', 'madivala', 12.914494, 77.560381, 'computer science,electronic system,communication thoery,english', 'as12'...

php - CakePHP login issue -

stackoverflowers. meet issue while add login function cakephp website, account can added, user can not login system appcontroller: namespace app\controller; use cake\controller\controller; class appcontroller extends controller { public function initialize() { $this->loadcomponent('flash'); $this->loadcomponent('auth', [ 'authenticate' => [ 'form' => [ 'fields' => [ 'username' => 'email', 'password' => 'password' ] ] ], 'loginaction' => [ 'controller' => 'users', 'action' => 'login' ] ]); // allow display action our p...

php - Symfony Not able to save manyToOne bidirectional Entity -

i have entity called survey , have entity called creditcards creditcard linked survey using manytoone survey linked creditcard using onetomany the survey has bunch of financial related questions gets saved in survey table , asks user creditcard related details gets saved in creditcard table, since user can have more 1 card can add multiple card details , manytoone , onetomany comes play. this creditcard.orm.yml examplebundle\entity\creditcards: type: entity table: creditcards id: id: type: integer id: true generator: strategy: auto fields: surveyid: type: integer column: survey_id balance: type: integer amountdue: type: integer column: amount_due interestrate: type: integer column: interest_rate manytoone: survey: targetentity: examplebundle\entity\s...

android - How to Design image icon with text in row for supporting all devices -

Image
how design suitable size of phones..need design this thanks in advance if wrap image inside linear layout , have different resolutions of image in drawable's folder, based on device wrap image , height <linearlayout ... android:orientation="horizontal" android:layout_height="wrap_content" android:weightsum="4" ...> //for 1 image each image have 1 linearlayout <linearlayout ... android:orientation="vertical" android:layout_height="match_parent" android:weightsum="4" android:layout_weight="1" ... > <imageview> ... android:layout_height="0dp" android:layout_weight="3" ... </imageview> <textview> ... android:layout...

swift - error with Int function in Xcode 7 beta -

this question has answer here: .toint() removed in swift 2? 5 answers i have error while testing code in xcode 7 beta, error between 2 asterisk class viewcontroller: uiviewcontroller { @iboutlet weak var agee: uitextfield! @iboutlet weak var labelage: uilabel! @ibaction func findage(sender: anyobject) { *var enteredage = agee!.text.toint()* if enteredage != nil { var catyears = enteredage! * 7 labelage.text = "your cat \(catyears) in cat years" } else { labelage.text = "please enter number in box" } } @iboutlet var agee: uitextfield! @iboutlet var labelage: uilabel! @ibaction func findage(sender: anyobject) { if agee != nil { var enteredage = agee.text.toint() var catyears = enteredage! * 7 labelage.text = "your cat age \(catyears) in cat years" print(c...

java - Use 2 methods 1. Check if object exists 2. Add object -

i wondering how go create 2 methods, 1. checking, if object exists within array (based on 1 of parameters). 2. secondly add method allows user / me add objects array when previous (1st method) returns false. here try: public class book { string name; int isbn; public book(string e, int inr) throws libraryexception{ if(e.equals("")){ throw new libraryexception("blank / empty name not allowed!"); } else if(inr < 1 || inr > 9000){ throw new libraryexception("the isbn number outside allowed range (1 - 9000)! "); } setname(e); setisbn(inr); } public boolean equals(object obj){ if(obj instanceof book){ isbn = (isbn)obj; return true; } return false; } public string getname() { if(name == null || name == ""){ system.out.print("does not exist!"); } ...

sublimetext2 - Regex: how to find new line in code -

i have lot of html files text without <p>. tags in code. try find , replace adobe brackets or sublime text 2: find <br><br>\n replace </p>\n</p> but not find \n in code simplified, have: some sentence, sentence<br><br> (i have 1 space here in code) sentence, sentence<br><br> i convert: some sentence, sentence</p> <p>some sentence, sentence</p> (i know have add manually 1 <p> @ beginning, not important , not point of question) find:(.*)<br><br>\n? replace:<p>\1</p>\n input : some sentence, sentence<br><br> sentence, sentence<br><br> output : <p>some sentence, sentence</p> <p>some sentence, sentence</p>

php - array to string conversion error in codeigniter 3.0.1 -

i have following error message while updating records in database severity: notice message: array string conversion filename: database/db_query_builder.php line number: 662 backtrace: file: c:\xampp\htdocs\site\application\models\class_model.php line: 48 function: where file: c:\xampp\htdocs\site\application\controllers\class_con.php line: 107 function: update file: c:\xampp\htdocs\site\index.php line: 292 function: require_once here controller function edit($id) { $rules = [ [ 'field' => 'classname', 'label' => 'class name', 'rules' => 'trim|required' ], [ 'field' => 'inchargename', 'label' => 'incharge name', 'rules' => 'trim|required' ], [ 'field' => 'classstrength', ...

Php Mysql Display sum of 2 columns in html -

i want display result of "vendido -pagado" (2 columns of table) in html following code doesn't work, clue why? <?php //connect db include '../connect.php'; $saldo = "select vendido-pagado saldo cooks mail = '$email'"; $resultsaldo = mysqli_query($conn, $saldo); if (mysqli_num_rows($resultsaldo) > 0) { // output data of each row while($row3 = mysqli_fetch_assoc($resultsaldo) { echo '<a class="w-nav-link navlink right" href="../misaldo.php">saldo: ' .$row3['saldo']. "</a>"; }} else { echo "there error fetching total";} mysqli_close($conn); ?> for sum in mysql query, can use mysql sum aggregate function $saldo = "select (sum(vendido) + sum(pagado)) saldo cooks mail = '$email'"; or i have used $row3['col1'] , $row3['co...

mysql - optimize the query with multiple table -

i have query in data coming multiple tables. select iuserid, iuserid userid, (case vusbg when 1 'yes' when 0 'no' end) vusbg, concat(vfirstname,' ',vlastname) name, vemail, etype, estatus, taddeddate, eexpert, eadmin, (select count(iuserid) total tbl_friend iuserid = tbl_user.iuserid) count_f, (select count(*) bar_followers bar_followers.iuserid = tbl_user.iuserid) bar_follows, (select count(b.ibrandid) tbl_company_follow, tbl_brand b tbl_company_follow.iuserid = tbl_user.iuserid , b.icompanyid = tbl_company_follow.icompanyid) brand_follows, (select sum(points) totalpoints tbl_points, tbl_post p iuserid = tbl_user.iuserid , p.ipostid = tbl_points.post_id) countpoints tbl_user this query took 8.3595 seconds how can minimize time? your query reasonable, except lack of explicit join syntax. ...

collections - Fastest way to implement subset in Scala -

so according wikipedia (proposition 8) following statements equivalent: a is subset of b a intersection b equals a a union b equals b a difference b equals empty set scala gives union, intersection , difference operators, set equality. given that, efficient (runtime) way implement subset function in scala?

c++ - Try to measure times of image stitching using OpenCV Stitcher. Different times when restarting/not restarting program. Issue with memory? -

i made little application stitch few images using opencv. it's measure times of stitching. here function load photos using path in txt file: void readphotos(string sourcein){ string sourcephoto; ifstream filein(sourcein); if (filein.is_open()) { while (getline(filein, sourcephoto)){ photos[photo_number] = imread(sourcephoto, 1); photo_number++; } } else{ cout << "can't find file" << endl; } cout << "number of photos: " << photo_number << endl; //size size(480, 270); (int = 0; < photo_number; i++){ //resize(photos[i], photos[i], size); imagesvector.push_back(photos[i]); } } here makepanorama function. implemented here simple timer measure time of stitching images. need know how long takes stitch 2,3,4.. images. contains opencv stitcher class functions: void makepanorama(vector< mat > imagesvector, string filename){ tp1 = std::chrono::high_resolution_clock::now(); sti...