Posts

Showing posts from May, 2014

javascript - Customizing the jquery.datatables plugin to filter with a regex on two columns -

Image
i using jquery datatables plugin found here . there 2 columns named "new gl" , "old gl". datatables plugin has built in feature called search filters data in table based on keyword enter textbox. here data looks like: when type "40.88.1010.0" or "40.88.600000.05" textbox want record appear. the same rule applies of records. want search continue filter of columns using 1 single textbox columns "new gl" , "old gl"...i want user able use both "-" , "." characters. my initial thought if datatables had regex option work because "." in regex character. want rule apply 2 columns. is possible using datatables plugin? here current datatable initialization code: $(document).ready(function () { var table = $('#datatable').datatable({ "idisplaylength": 50 }); }); solution you need implement custom search function shown below. the drawback of method con...

javascript - OAuth: Is it ok to return access token as json? -

when return request token (i server), send values in body of response: oauth_token=946ccd316c&oauth_token_secret=395cfee8ca&oauth_callback_confirmed=true i trying figure out if it'd possible dance on jsonp . signing , requesting works fine, body isn't json, response fails during parsing. so, reply body coded jsonp insted (if client requested it), this: callback({oauth_token:'946ccd316c',oauth_token_secret:'395cfee8ca',oauth_callback_confirmed:true}) and work. questions are: would break standards? allowed change encoding of body? there better way? oauth specification doesn't specify format sending token. think return inside json object have shown. in fact google returns access_token inside json object shown below: response :{ "access_token" : "ya29s6zqbibqpa5rz8oty00xj-xydfdfddteerer-1em", "token_type" : "bearer", "expires_in" : 3600 }

c++ - Notifying a consumer thread before or after releasing the lock on the mutex? -

below listing 4.5 book c++ concurrency in action defines thread-safe queue using condition variables. #include <mutex> #include <condition_variable> #include <queue> #include <memory> template<typename t> class threadsafe_queue { private: mutable std::mutex mut; std::queue<t> data_queue; std::condition_variable data_cond; public: threadsafe_queue() {} threadsafe_queue(threadsafe_queue const& other) { std::lock_guard<std::mutex> lk(other.mut); data_queue=other.data_queue; } void push(t new_value) { std::lock_guard<std::mutex> lk(mut); data_queue.push(new_value); data_cond.notify_one(); } void wait_and_pop(t& value) { std::unique_lock<std::mutex> lk(mut); data_cond.wait(lk,[this]{return !data_queue.empty();}); value=data_queue.front(); data_queue.pop(); } std::shared_ptr<t> wait_and_p...

r - Determining if values of previous rows repeat in dataframe -

i have data organized this: set.seed(12) ids <- matrix(replicate(1000,sample(letters[1:4],2)),ncol=2,byrow=t) df <- data.frame( event = 1:100, id1 = ids[,1], id2 = ids[,2], grp = rep(1:10, each=100), stringsasfactors=f) head(df,10) event id1 id2 grp 1 1 c 1 2 2 d 1 3 3 d 1 4 4 b 1 5 5 d 1 6 6 b c 1 7 7 b d 1 8 8 b d 1 9 9 b d 1 10 10 c 1 there pairs of ids (id1 & id2). within row never same. there variable called grp. there 10 groups. each group considered separate sample of data. event variable goes 1-100 in each group. the first question have quite straightforward. within each group, each row, combination of 2 ids (id1-id2) same previous row, reverse of previous row, or neither of these 2 options. obviously, if there a-c combination on row 100 of 1 group, not interested in whether reversed, same or whatever on row 1 of following group. t...

java - Why does LongProperty implement Property<Number> but not Property<Long>? -

i have come across seems peculiarity in javafx api: longproperty implements property<number> , not property<long> . what reason this? sort of idea stems java's inherent problem covariance , contravariance, because generics implemented stupidly via erasure, maintain backwards compatibility bytecode; problem have arisen having longproperty implement both property<number> and property<long> ? edit: question originated problem: apply longproperty tablecolumn programmatically (vs semantically) it can't implement both. to that, need implement 2 versions of each method in interface uses generic. let's take 1 example: bindbidirectional(property<long> other) { ... } under hood, erasure means gets compiled down to: bindbidirectional(property other) { ... } so then, implements property<number> , property<long> do? have 2 methods: bindbidirectional(property<long> other) { ... } bindbidirectional(prope...

ios - How to query an NSDictionary using an expression written in NSString? -

i want able run following hypothetical function called evaluateexpression:on: , "john" answer. nsdictionary *dict = @{"result": @[@{@"name": @"john"}, @{@"name": @"mary"}]}; nsstring *expression = @"response['result'][0]['name']"; nsstring *answer = [self evaluateexpression: expression on: dict]; is possible? there's nsobject category extends valueforkeypath give valueforkeypathwithindexes . lets write this: nsdictionary *dict = @{@"result": @[@{@"name": @"john"}, @{@"name": @"mary"}]}; nsstring *path = @"result[0].name"; nsstring *answer = [dict valueforkeypathwithindexes:path]; xctassertequalstrings(answer, @"john"); the category psy, here: getting array elements valueforkeypath @interface nsobject (valueforkeypathwithindexes) -(id)valueforkeypathwithindexes:(nsstring*)fullpath; @end #import ...

How to map multiple domains to a WordPress (single install) site woring as SAAS? -

my question quite similar this question . concerns not answered there, posting separate question. i try detailed possible here. have build website (saas), abc.com wherein registered users subdomain on website, abc.com/def or pqr.abc.com. of users might want have own domains in use. eg. 123.com or xyz.com. of these websites need have identical backend (dashboard). importantly visitor should able type search term on main website (abc.com), , search should contain results websites including subdomains (abc.com/def or pqr.abc.com) , custom domains (xyz.com). i not versed other frameworks, figured out wordpress solution. approach every registered user assigned role of author, them being able create/edit own content. add custom post type exact type of content can add. use dashboard customizing plugins (like adminimize) configure admin menus can editors see. way able define/force fields can use adding content, , can restrict custom taxonomoies , terms can use. , able search through c...

c# - Orleans Specify SqlServer for Liveness -

i trying setup test environment orleans uses sql server liveness. server config file: <?xml version="1.0" encoding="utf-8" ?> <orleansconfiguration xmlns="urn:orleans"> <globals> <liveness livenesstype="sqlserver" deploymentid="42783519-d64e-44c9-9c29-111111111133" dataconnectionstring="data source=.\\sqlexpress;initial catalog=orleans;integrated security=true;" /> <!--<seednode address="localhost" port="11111" />--> </globals> <defaults> <networking address="localhost" port="11111" /> <proxyinggateway address="localhost" port="30000" /> <tracing defaulttracelevel="info" tracetoconsole="true" tracetofile="{0}-{1}.log"> <traceleveloverride logprefix="application" tracelevel="info" /> </tracing> ...

asp.net - How to hide querystring value in url -

requesting page gridview's rowcommand event, here code protected void grdclaimlist_rowcommand(object sender, gridviewcommandeventargs e) { switch (e.commandname) { case "viewclaim": response.redirect("claimstatus.aspx?id=" + e.commandargument); break; } } i hide query string url, possible? if yes, please let me know how? you can use session variables or view states instead.

java - How to insertInto() without setting values and return the newly created ID? -

how can insert record without specifying values ans return newly created id? if this: private long createoffer() { return this.ctx.insertinto(storeoffer.store_offer, storeoffer.store_offer.id) .returning(storeoffer.store_offer.id) .fetchone().getvalue(storeoffer.store_offer.id); } i getting java.lang.nullpointerexception . if set null not-null-constraint gets triggered.. private long createoffer() { return this.ctx.insertinto(storeoffer.store_offer, storeoffer.store_offer.id) .values((long)null) .returning(storeoffer.store_offer.id) .fetchone().getvalue(storeoffer.store_offer.id); } i tried this: private long createoffer() { storeofferrecord storeofferrecord = this.ctx.newrecord(storeoffer.store_offer); storeofferrecord.store(); return storeofferrecord.getid(); } but id null . the table store_offer looking this: create table store_offer ( -- primary key id bigserial prim...

Python Bottle Website Automate Tasks -

i have python app pulls data , posts api. pulls data last 15 minutes , needs run every 15 minutes. i ended using bottle framework , running code in background of page , refreshing every 15 minutes (which i'm assuming isn't best way this). @route('/') def index(): <run code> return '<meta http-equiv="refresh" content="900" />' how automate task, while having user friendly way turn off , on isn't dependent on having browser open? if wanted pull data , post api every 15 minutes, wouldn't use web framework. write script infinite while loop , use sleep(). of course can bind script/function bottle url if wanted to. edit (missed of op's requirements): if want user able select date, make form user can submit date. bottle backend spawn new process (python script) takes submitted date input. process continuously run code until user hits 'end' button , bottle backend kill process. see subpro...

javascript - How to find data from html and store it using jQuery -

my html <div class="product"> <img src="#"> <div class="pricestore"> <p data="40">item 1</p> </div> </div> how, using jquery retrieve data , store it? my attempt: $('.product').mousedown(function(event) { var x = $('.pricestore').parent().find(data); console.log(x); }); thanks! there few different ways write selector value of attribute can use .attr() something works case $('.product').mousedown(function(event) { var x = $('.pricestore p').attr('data'); console.log(x); });

spring - Publish-Subscribe Channels Both Going to Kafka Result in Duplicate KafkaProducerContexts -

i attempting use spring integration send data 1 channel 2 different kafka queues after same data go through different transformations on way respective queues. problem apparently have duplicate producer contexts, , don't know why. here flow configuration: flow -> flow .channel(“firstchannel") .publishsubscribechannel(executors.newcachedthreadpool(), s -> s .subscribe(f -> f .transform(firsttransformer::transform) .channel(messagechannels.queue(50)) .handle(kafka.outboundchanneladapter(kafkaconfig) .addproducer(firstmetadata(), brokeraddress), e -> e.id(“firstkafkaoutboundchanneladapter") .autostartup(true) .poller(p -> p.fixeddelay(1000, timeunit.milliseconds).receivetimeout(0).taskexecutor(taskexecutor)) ...

python - Getting started with Django - base.py - ImportError: No module named blog -

i working through "getting started django", video series. have spend time googling , reviewing answers here , there. i on first lesson , seeing issues importing module named "blog" when i: python manage.py runserver 0.0.0.0:8000 it seems me version of django have more recent (but still, stable version). base.py file, had found on github , loaded it. reviewed , same specified in tutorial. here file using: (blog-venv)vagrant@precise64:/vagrant/microblog$ cat microblog/settings/base.py import os import dj_database_url here = lambda * x: os.path.join(os.path.abspath(os.path.dirname(__file__)), *x) project_root = here("..") root = lambda * x: os.path.join(os.path.abspath(project_root), *x) debug = false template_debug = debug allowed_hosts = ['*'] admins = ( ("supreme master", "user@email.com"), ) managers = admins databases = { 'default': dj_database_url.config() } # local time zone installation...

javascript - Contenteditable changes not seen on other devices with browsersync -

i wish make text changes in content editable div sync browsersync. i've created simple teleprompter , content editable div paste script on host machine. unfortunately pasted text not synced other screens :( anyone can push me in right direction?

python - Theano simple linear regression runs on CPU instead of GPU -

i created simple python script (using theano) performing linear regression should run on gpu. when code starts says "using gpu device", (according profiler) operations cpu-specific (elemwise, instead of gpuelemwise, no gpufromhost etc.). i checked variables, theano_flags, seems right , cannot see catch (especially when theano tutorials same settings correctly run on gpu :)). here code: # linear regression import numpy import theano import theano.tensor t input_data = numpy.matrix([[28, 1], [35, 2], [18, 1], [56, 2], [80, 3]]) output_data = numpy.matrix([1600, 2100, 1400, 2500, 3200]) ts = theano.shared(input_data, "training-set") e = theano.shared(output_data, "expected") w1 = theano.shared(numpy.zeros((1, 2))) o = t.dot(ts, w1.t) cost = t.mean(t.sqr(e - o.t)) gradient = t.grad(cost=cost, wrt=w1) update = [[w1, w1 - gradient * 0.0001]] train = theano.function([], cost, updates=update, allow_input_downcast=true) in range(1000): train() ...

node.js - Auto compilation of bootstrap less file with gulp/gulp-watch-less does'nt regenerate the css -

i've installed nodejs , gulp auto compile bootstrap less file (v 3.3.5) gulp-watch-less module. everything working fine expect 1 thing: have stop , start gulp regenerate bootstrap.css . for information, gulp detecting .less file included in bootstrap.less modified, have following message: [23:14:40] starting 'default'... [23:14:42] finished 'default' after 2.04 s [23:16:42] less saw variable-overrides.less changed [23:16:42] less saw variable-overrides.less changed [23:16:42] less saw bootstrap.less changed:by:import [23:16:42] less saw bootstrap.less changed:by:import but when open bootstrap.css file don’t see changes until stop , start gulp again. here content of gulpfile.js : var gulp = require('gulp'); var watchless = require('gulp-watch-less'); var less = require('gulp-less'); gulp.task('default', function () { return gulp.src('./../../../../drupal8/sandbox/felicity/themes/octogone/less/bootstrap.less...

node.js - Node Child Process Exec Command Failed with error code 1 -

i trying execute line using node js child process , getting error. following code: let cmd : string = "code " + projects[value]; exec(cmd, function callback(error, stdout, stderr) { console.log("started console app"); }); error : cmd:"c:\windows\system32\cmd.exe /s /c "code c:\users\shana\dropbox\code-settings-syn... (length: 82)" code:1 killed:false message:"command failed: c:\windows\system32\cmd.exe /s /c "code c:\users\shana\dropbox\c... (length: 99)" signal:null stack:undefined detail of error json. full cmd : "c:\windows\system32\cmd.exe /s /c "code c:\users\shana\dropbox\code-settings-sync"" full message : "command failed: c:\windows\system32\cmd.exe /s /c "code c:\users\shana\dropbox\code-settings-sync"\n" try simpler example .. var exec = require('child_process').exec; var cmd = 'code c:\program files'; exec(cmd, function(err, stdout, stderr) { i...

android - CardView toolbars -

Image
i have recyclerview contains cardviews. i add toolbar each of cardviews , behave main toolbar: [icon] [title] .......... [button] [button] [menu] i've seen here ( http://blog.grafixartist.com/create-a-card-toolbar/ ) possible set actual android.support.v7.widget.toolbar object inside cardview. relies on setsupportactionbar(...) inflate menu , respond actions. do think it's possible reproduce behaviour in each of cardviews? you don't need setsupportactionbar cardviews toolbars until need set actionbar specific actions up/back navigation actions. take @ fine example (link whole page below): thanks gabriele help. here working code: activity : public class mainactivity extends actionbaractivity { @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_mai); toolbar toolbar = (toolbar) findviewbyid(r.id.card_toolbar); toolbar.settitle(...

payment gateway - Paypal payflow have two recurring subscriptions in one transaction -

my website in situation allow users subscribe multiple things @ once, multiple pay periods. i'm still new to paypal payflow, i'm not 100% sure if possible. what wanting possible. way able create multiple different recurring payment profiles. example: customer wants subscribe 3 different magazines, different prices, , different billing dates. when customer submits form, make 3 http requests payflow service, creating 3 separate profiles 1 customer. able manage these profiles separately. you can go through developer guide recurring billing specifics.

java - Change lib folder when clear and build -

when "clear , build" project in netbeans creates folder called "dist" jar , folder called "lib" external jars. can change "lib" name in netbeans's configuration? change manifest of main jar not want every time compile. regards! the dist library directory name hard-coded, unfortunately. see source code relevant ant task: http://hg.netbeans.org/main/file/62bea1ba5c94/java.j2seproject/copylibstask/src/org/netbeans/modules/java/j2seproject/copylibstask/copylibs.java#l212 you might able rename folder afterwards , pull out rebasing code own custom ant task modify manifest.

ios - AFNetworking. check dowload progress for all operationqueue -

i have ios application made afnetworking. have singleton custom httpclient subclass , use consume api , download binary files server. i need dowload 100 files. safe iterate trough url array , create 1 afhttprequestionoperation each url? code this: nsmutableurlrequest* rq = [[mihttpclient sharedinstance] requestwithmethod:@"get" path:@"...." parameters:nil]; afhttprequestoperation *operation = [[afhttprequestoperation alloc] initwithrequest:rq] ; operation.outputstream = [nsoutputstream outputstreamtofileatpath:path append:no]; [operation setcompletionblockwithsuccess:^(afhttprequestoperation *operation, id responseobject) { //completion } failure:^(afhttprequestoperation *operation, nserror *error) { //manage error }]; [[mihttpclient sharedinstance] enqueuehttprequestoperation:operation]; how can receive feedback queue? don't see "httpclientdelegate" protocol or this. thanks regarding progress, see setdownloadprogressbl...

javascript - CSS Animation Fill Mode - What have I done wrong? -

i need create rotation animation. click event spins element 180° point down. click event spins same element 0° point up. i have animation-fill-mode set forwards preserve last keyframe state. not appear working. visual elements reset default state. any ideas may doing wrong? my codepen : http://codepen.io/simspace-dev/pen/rrpgmp my code : (function() { $('#btnb').on('click', function(e) { return $('.box').addclass('spin-counter-clockwise'); }); $('#btnf').on('click', function(e) { return $('.box').addclass('spin-clockwise'); }); $('.box').on('webkitanimationend', function(e) { return $(e.target).removeclass('spin-counter-clockwise').removeclass('spin-clockwise'); }); }.call(this)); .box { background: red; position: relative; width: 176px; height: 176px; margin: 40px auto; text-align: center; } .box .top { backgroun...

youtube api - Google API: Quota Limit Reset Times and Timezone -

Image
does have information on times in quota limits/rate limits reset following google apis? of apis above have daily quotas mentioning quotas reset next day - in know time , timezone, if has information. google places details google places search google places text search google news search google analytics profiles google analytics data google custom search google+ search google+ activities google+ profile youtube i have done research , some, not all, apis publish such information: google maps api work mentions daily quota resets @ midnight, pacific time, source: google maps api work also, in merchant circle api, publishes reset time 12am, pst, source: merchant circle api check quota page in google developer console of them when resets daily quota resets @ midnight pacific time (pt).

How to specify Hibernate mappings from code without JPA -

i'm using hibernate native sql queries map results pojo. however, need mapping xml file binds column names property names. possible specify mapping directly code without jpa annotations ? or/mapping in code means must use annotations in entity class. without annotation, can complete mapping in code. can use hibernate annotation instead of jpa annotation. for example, below annotations hibernate supports table mapping: javax.persistence.table jpa annotation org.hibernate.annotations.table hibernate annotation

c# - RadioButton.Checked issue -

so having bit of issue piece of code class of mine. know seems rather elementary life of me not sure why can't work. essentially have 6 radio buttons , depending on 1 selected want assign value int variable. want return value winform else. but reason returns 0. some appreciated. thank in advance.. int x = 0; public int selectiondie1() { if (die1_1.checked) x = 1; if (die1_2.checked) x = 2; if (die1_3.checked) x = 3; if (die1_4.checked) x = 4; if (die1_5.checked) x = 5; if (die1_6.checked) x = 6; return x; } i add if change void no return value , place label display value of x on buttonclick, still returns 0. i have tried using 1 radiobutton , see if work, nothing @ all. when set x = 1000; , return works fine, has radio buttons thank you if understand correctly, attempting use variable x in other form. need u...

javascript - Django ChoiceField - How to show the currently selected value? -

i have django choicefield called states defined in forms class. class stateform(forms.form): def __init__(self, *args, **kwargs): super(stateform, self).__init__(*args, **kwargs) self.fields['states'] = forms.choicefield(widget=forms.select, choices=options_state) self.initial['states'] = 'any' i set initial value 'any', since want dropdown 'any' default. in views.py , get_context_data() function, add context that's sent html. context['state_form'] = stateform() in html, can render dropdown using django's special language {{ state_form.states }} so far good. see dropdown in page, , default value 'any'. can click on select other values, @ point javascript code send http request based on form. reload page filtered data. able of done. the problem once page reloads, dropdown still says 'any'. want dropdown show selected data. i...

javascript - Creating custom components -

Image
i've been trying uitableview equivalent in react-native . screen looks (work in progress): the code quite primitive @ moment: class settingsview extends component { render() { return( <view style={styles.container}> //more view code //example of cell <touchablehighlight style={styles.tableviewcell}> <text style={styles.celllabel}>log out</text> </touchablehighlight> </view> ); } } it works fine, i've been trying create accessory - > indicator - cells. whilst doing that, stumbled upon way create custom component via code: class tableviewcell extends component { render() { return ( <touchablehighlight style={styles.tableviewcell}> <text style={styles.celllabel}>log out</text> </touchablehighlight> ); } } next, replaced initial block of code , came out this: class settingsview extends component { ren...

Extending a PHP Class with Subclasses and instantiate all functions into one object -

i using smarty template engine ( http://smarty.net ) on website have additional, custom functions handle template compiling tasks. in order able update smarty framework files (e.g. /smarty/smarty.class.php) , not having copy-paste custom function class inside smarty.class.php, thought "hey, let's make own class , extend smarty class!". however, can't work , appreciate enlightening advice :) this got @ moment: web-root/ includes/ smarty.inc.php smartylib/ smarty.class.php smarty_compiler.class.php smarty.class.php the third party vendor file , class don't wanna touch: class smarty { // various vars declarations public function __construct() { // ... } function _compile_source($resource_name, &$source_content, &$compiled_content, $cache_include_path=null) { // magic... $smarty_compiler = new $this->compiler_class; // more magic... } // more class methods declarations } ...

multithreading - Trying to receive messages from a publish/subscribe socket in the background with Python -

i'm working on tank battle ai , such, i'm trying create function updates map , player information in background receiving messages socket pub / sub formal-pattern. comm communication object in main client. this movement_strategy() function called module, keep getting error: exception in thread thread-1, zmqerror: socket operation on non-socket. any ideas on what's causing or how fix it? import communication import gamestate import json import threading import time def movement_strategy(comm): def get_gamestate(): [token, msg] = comm.pub_socket.recv_multipart() msg = json.loads(msg) if msg["comm_type"] == "gamestate": game_info = gamestate.gamestate( msg["comm_type"], msg["timestamp"], msg["timeremaining"], msg["map"], ...

r - Convert a list of lists to a character vector -

i have list of lists of characters. example: l <- list(list("a"),list("b"),list("c","d")) so can see elements lists of length > 1. i want convert list of lists character vector, i'd lists length > 1 appear single element in character vector. the unlist function not achieve rather: > unlist(l) [1] "a" "b" "c" "d" is there faster than: sapply(l,function(x) paste(unlist(x),collapse="")) to desired result: "a" "b" "cd" you can skip unlist step. figured out paste0 needs collapse = true "bind" sequential elements of vector together: > sapply( l, paste0, collapse="") [1] "a" "b" "cd"

node.js - Sessions with express and socket.io -

i'm new , trying set simple image sharing site account creation. i'm using socket.io , express , have login created. i've been told should never identify users socket ids, realize difficult if not impossible i'm having trouble implementing user information. i've been looking client-sessions packages, i've hit wall. i'm not trying have else write code me, appreciated if point me in right direction.

Why that Java program isn't painting? -

i have problem, program isn't compiling. i'm trying paint dots file have records calculate. don't know problem. when i'm trying run that, console showing errors jframe opening. there black layout 2 recentagles. it should head conture! errors: exception in thread "awt-eventqueue-0" java.lang.indexoutofboundsexception: index: 504542, size: 504540 @ java.util.arraylist.rangecheck(unknown source) @ java.util.arraylist.get(unknown source) @ rysuje.rysowanie.wezliczbe(rysowanie.java:40) @ rysuje.rysowanie.paintcomponent(rysowanie.java:57) @ javax.swing.jcomponent.paint(unknown source) @ javax.swing.jcomponent.paintchildren(unknown source) @ javax.swing.jcomponent.paint(unknown source) @ javax.swing.jcomponent.paintchildren(unknown source) @ javax.swing.jcomponent.paint(unknown source) @ javax.swing.jlayeredpane.paint(unknown source) @ javax.swing.jcomponent.paintchildren(unknown source) @ javax.swing.jcomponent...

java - ViewPager - Animate TextView on swipe -

my swipe screen work perfect, has 3 fragments few text views per fragment. i animated in flipview component, found better use viewpager problem. my problem don't know handle fragments on swipe. when swipe want know wich fragment on fragment goes. because when swipe fragmenta fragmentb want text box on fragmentb animate left right, when return fragmentb fragmenta want animate text box right left on fragmenta. all animation know how do, don't know catch , fragment i'm going. it's not problem animate each fragment in fragment code, don't know fragment goes on him , don't know on side text animates. :) my code looks this: activity: viewpager viewpager; int numberofviewpagerchildren = 3; int lastindexofviewpagerchildren = numberofviewpagerchildren - 1; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_slide_tips); viewpager = (viewpager) findviewbyid(...

How to change the sytem highlight color in a windows form in c#? -

is there way change "default windows system blue" highlight color in controls in windows form? including textbox, datetimepicker , of them. thank you. edit highlight color when user select text inside control, normaly it's blue. can't change system highlight color , don't want to. i'm interested on 3 controls: textbox, datetimepicker , numericupdown. by controls i'll assume mean of them have highlight color... use selectioncolor property of highlight-able controls. for example, can used this: richtextbox.selectioncolor = color.aqua; this set highlight color of richtextbox aqua. if wanted controls highlighted... have override drawing , force them redraw while mouse clicked , dragged on area reside.

javascript - Bind events to object in fabricJS -

using latest fabric.js, have code: var imageadded = new image(); imageadded.onload = function (img) { var imgadded = new fabric.image(imageadded, { clipname: picid, clipto: function (ctx) { return _.bind(clipbyname, imgadded)(ctx) } }); canvas.add(imgadded); imgadded.on("object:selected", function (e) { // doesn't pass function alert(e.target.clipname + " selected"); e.target.clipto = null; canvas.renderall(); }); }; i want alert when select object no alert showed because function made comment in code doesn't work. i tried this link still can't make possible. i appreciate every suggestion. thank you! if want event specific object use: imgadded.on("selected", function(){alert(this.clipname);}); if want event canvas , objects: canvas.on("object:selected", function(e){alert(e.target.clipname);});

c++ - QML TableView + PostgreSQL database error -

i have posrgresql database , need display data in tableview, error ".../qt5.5.1/5.5/gcc_64/qml/qtquick/controls/private/basictableview.qml:516: unable assign [undefined] int" every row. it redirects basictableview.qml: rowitem.rowindex = qt.binding( function() { return model.index }); the problem here. as understand, in unknown reason can set indexes rows. thought, it's tableview problem, when try open sqlite database, it's ok. thought, it's postgres problem, when display data in listview, it's ok. that's problem: sqlite + tableview = ok; postgres + listview = ok; postgres + tableview = error. i tried reinstalling qt , reinstall kubuntu, problem still exists. here code: main.cpp #include <qguiapplication> #include <qqmlapplicationengine> #include <qsqldatabase> #include <qsqlquerymodel> #include <qsqlquery> #include <qdebug> #include <qquickview> #include <qqmlcontext> #include ...