Posts

Showing posts from April, 2015

c# - Splitting a JSON key based on regex to store in multiple variables -

{"key":"abc/1"} i want store value in 2 fields instead of one. can following. [jsonproperty(propertyname = "key", required = required.always)] public string value { get; set; } however, want have 2 fields use jsonproperty to serialize , deserialize them combined string. example, if define following fields: public string valuescope { get; set; } public int valueid { get; set; } i want use jsonproperty or other tag populate fields while deserializing. possible that, i.e. populate valuescope "abc" , valueid 1 ? yes, can implement get , set of 2 properties manipulate underlying jsonproperty . here's quick example of how might go (warning: wrote out in notepad, please excuse typos). public string valuescope { { var values = (this.value ?? "").split('/'); if (values.length == 2) return values[0]; else return null; } set { this.

machine learning - When doing cross validation, what changes if you ensure that the class distribution in the training and test set is equal to the whole set? -

let's take binary classification problem. when doing k-fold cross validation, when separate randomly shuffled dataset k chunks, how have same label distribution function of k? if class distribution uneven, 95% of dataset negatives , 5% positives, seems pretty there low values of k label distribution uneven. of course true values of k such k = (size of dataset), low values of k, such 5. my main fear may occur don't have enough positive examples in training set in phase of cross validation. on other hand, if go , ensure equal label distribution in chunks, seems me may bringing bias problem. basically want ask is, gain , lose, if ensure label distribution in chunks? or bad? , importantly, why? seems similar question here https://stats.stackexchange.com/questions/117643/why-use-stratified-cross-validation-why-does-this-not-damage-variance-related-b anyways, you'll have different models if have 1% 6% positives. better build on balanced data set. how the

ruby gem require_relative cannot load such file -

i've looked around online , on , of answers question should using require_relative using don't know problem might be. i'm trying build ruby gem , folder structure looks this --xmlmc-rb/ --lib/ --xmlmc-rb/ api.rb interface.rb version.rb xmlmc-rb.rb within xmlmc-rb.rb requiring 3 of files under xmlmc-rb/ directory this require_relative "xmlmc-rb/version" require_relative "xmlmc-rb/interface" require_relative "xmlmc-rb/api" require 'net/http' require 'nokogiri' require 'base64' but keep getting error /library/ruby/gems/2.0.0/gems/xmlmc-rb-0.1.1/lib/xmlmc-rb.rb:2:in `require_relative': cannot load such file -- /library/ruby/gems/2.0.0/gems/xmlmc-rb-0.1.1/lib/xmlmc-rb/interface (loaderror) /library/ruby/gems/2.0.0/gems/xmlmc-rb-0.1.1/lib/xmlmc-rb.rb:2:in `<top (required)>' /library/ruby/site/2.0.0/rubygems/core_ext/kernel_require.rb:128:in `require' /libra

google bigquery - Big query update or delete issue -

i can't update or delete operation big query api via php. have techniques complete task. 2016-08: bigquery support update , delete :) does bigquery support update, delete, , insert (sql dml) statements? you can achieve updates , deletes bigquery - it's not native operation. to delete rows table, re-materialize without un-desired rows: select * [my.table1] not id in (19239,192392139,129391) (set options "allow large results" , "write results my.table1") to update rows, can similar: select * ( select * [my.table1] not id in (select id [my.updated_rows] ), ( select * [my.updated_rows] ) in other words: bigquery analytical database, delete , update not optimized operations - pull them off single select statement overwrites original table.

playframework 2.4 - (Play 2.4.2, Play Slick 1.0.0) How do I apply database Evolutions to a Slick managed database within a test? -

i write database integration tests against play slick managed database , apply , unapply evolutions using helper methods described in play documentation namely, evolutions.applyevolutions(database) , evolutions.cleanupevolutions(database) . these require play.api.db.database instance not possible hold of can see. jdbc library conflicts play-slick how database instance slick? use following slick database def running slick queries: val dbconfig = databaseconfigprovider.get[jdbcprofile]("my-test-db")(fakeapplication()) import dbconfig.driver.api._ val db = dbconfig.db thanks, leanne here how dow guice: i inject guice: lazy val appbuilder = new guiceapplicationbuilder() lazy val injector = appbuilder.injector() lazy val databaseapi = injector.instanceof[dbapi] //here important line (you have import play.api.db.dbapi.) and in tests, following (actually use other database tests): override def beforeall() = { evolutions.applyevolutions(databasea

css - How to make centered fixed width body responsive? -

i have simple css layout, restrict body width , center on screen: body { max-width: 38em; margin: auto; } i expected responsive: on huge screens lines stay short , body centered, on small screens body take hold of of screen can get. works in web browser's "responsive design view". on mobile devices, page displayed if huge screen: tiny text, big margins on side. how can tell mobile browsers stop behaving stupid? you need specify viewport width when working mobile browsers. <meta name="viewport" content="width=device-width, initial-scale=1"> read more: mdn

create usercontrol using javascript or winJS or angularJS for Windows8 -

i developing windows 8.1 application using html5/javascript. need create usercontrols create in native windows application. reason:single page has code of multiple pages/modules, code cleanup , better understanding. how create usercontrols or there other way same? yes there possibility same. winjs has fragments can load , unload, in same manner usercontrols in windows forms. pages behave in same way, if using windows javascript template application "navigator.js"-file. here image msdn site how navigator.js switches pages default.html example: in main html file define button loads fragment testing purpose , div id fragment loaded: <div class="box"> <button class="win-button action" id="basicfragmentloadbutton">load fragment</button><br /> <div id="basicfragmentloaddiv"></div> <br /> <div id="status"></div> </div> in javascript

java - Android: dismissing dialogs containing listeners -

i'm working 2 classes, , model class , dialog class in android. model class keeps list of listeners, dialog adds to. public class smartchannelmodel { private list<onresultschanged> monresultschanged public interface onresultschanged { void onresultschanged(int changed); } public smartchannelmodel() { monresultschanged = new list<onresultschanged>(); } public void addresultlistener(onresultschanged listener) { monresultschanged.add(listener); } } and dialog class: public class infodialog extends appcompatdialog { private smartchannelmodel model; public infodialog(context context, smartchannelmodel model) { super(context); this.model = model; } public void update() { //do stuff } @override protected void onstart() { super.onstart(); model.addonresultschanged(new onresultschanged() { @override void onresultschanged(in

javascript - Purpose of through2-map -

can please explain through2-map package of `node.js? i have read package npm page, still purpose of through2-map not totally clear. thanks in advance. its in docs. through2-map gives more concise way achieve want. instead of having: function (chunk, encoding, callback) { // in through2 this.push(chunk.slice(0, 10)) return callback() } you have shorter version: function (chunk) { // in through2-map return chunk.slice(0, 10); } no explicit callback calling.

css - jquery fade out sliding left -

i want make divs fade out , sliding left @ same time, dismissing notification cards on android. i searched , found jquery codes. $('#clickme').click(function(){ $('#book').animate({ opacity: 'hide', // animate slideup margin: 'hide', padding: 'hide', height: 'hide' // animate fadeout }, 'slow', 'linear', function() { $(this).remove(); }); }); but code makes div(#book) fade out sliding up, not left (or right). read document .animate() couldn't find how that. check if helps $(document).ready(function(){ $("#flip").click(function(){ $("#panel").hide("slide", { direction: "left" }, 1000); }); }); #panel, #flip { padding: 5px; text-align: center; background-color: #e5eecc; border: solid 1px #c3c3c3; } #panel { padding: 50px; display: block; } <script src=&quo

What does "=>" mean in import in scala? -

i new scala. looking through code , came code imports com.infinite.usermanagement.controllers.{ securityservice => basesecurityservice } package. wondering => sign means in import. as others have mentioned, it's import rename. there 1 further feature proves astoundingly-useful on occasion highlight: if "rename" _ , symbol no longer imported. this useful in few cases. simplest you'd wildcard import 2 packages, there's name that's defined in both , you're interested in 1 of them: import java.io.{ file=>_, _ } import somelibrary._ now when reference file , unambiguously use somelibrary.file without having fully-qualify it. in case, have renamed java.io.file name out of way, not want name visible @ all. case packages contain implicits. if not want particular implicit conversion (e.g. if you'd rather have compile error) have delete name completely: import somelibrary.{richfile => _, _} // files won't become surprise

asp.net mvc - Mapping fields to certain users in mvc -

i creating mvc application in vb.net in trying map fields users specific individual users. have 4 sql tables connected involved in mapping. usertable, clienttable, projecttypetable , issuetable. what trying this: user id of 1 log on, id , match userid in clienttable correct user client. once get clientid , match projecttypetable multiple correct projecttypes, eg client can have 1-8 projects available them. issuetable have selected projecttype. i have created viewmodel looks this: public class clientviewmodel public protable list(of projecttype) public ctable clienttable public utable usertable public itable issuetable end class what planned retrieve userid when user logs on , pass other views in session state correct userid kept through out project until log out. here have tried: dim utable sqldatabase = new sqldatabase() dim getuserid = (from data in utable.usertables data.username = user.username andalso data.userpassword = user.userpassword select

excel - How to reintroduce weekend days into a date difference that is currently calculated on weekdays? -

Image
this question knowledge isn't duplicate - i've looked around , haven't found exact question. question this: using today's date , number of days (that's measure of weekdays origin date) want find number of total days (including weekend days) between today , previous date. i'm assuming m-f weekdays , sa-su weekend days. want add in weekend days count backward towards origin date can figure out true origin date is. example: origin date # weekdays today's date ?? 5 8/7/2015 ?? 20 8/7/2015 ?? 100 8/7/2015 etc... this need dynamic solution since today's date change. answer needs in excel because client uses/understands excel. i don't want approximate solution (e.g. # weekdays * 7/5 ) understand lack of exact answer in instances origin date occurs on weekend. in these cases, i'm willing round monday. realize may beyond powers of excel interested see if of ha

ember.js - How to pass arbitrary data to render in an Ember template? -

so we're trying render custom content template. we have template: <div class="modal-container"> <div class="popup modal error"> <header> <p>error!</p> <div class="close" {{action 'closemodal'}}> <i class="fa fa-close"></i> </div> </header> <div class="content"> {{message}} </div> </div> </div> .. application route: app.applicationroute = ember.route.extend actions: displayerror: (message) -> @render 'error-modal', into: 'application' outlet: 'error-modal' model: ember.object.create message: message and in our controller we're calling: @send 'displayerror', 'error message.' the modal pops fine, message isn't being rendered. doing wrong? you use common controller (to template , m

encoding - Problems retrieve strings with accents WSO2 DSS DataServices -

i'm testing wso2 dss tool, hoping use in business. first proof of concept, i'm having problems encoding , xml output. explain. i have table in sql server simple: create table [dbo].[usuarios] ( [nombre_usuario] varchar(20) collate sql_latin1_general_cp1_ci_as not null, [password] varchar(20) collate sql_latin1_general_cp1_ci_as not null, [entidad_persona] varchar(60) collate sql_latin1_general_cp1_ci_as not null ) on [primary]; the dss tool hosted on windows 2003 datasource configured. data service xml is: <data name="sqlserver_frontal" transports="http https"> <description>queries frontales_web</description> <config id="sqlserver"> <property name="carbon_datasource_name">sqlserver</property> </config> <query id="getuser" useconfig="sqlserver"> <sql>select entidad_persona dbo.usuarios nombre_usuario = :iduser</sql> <result element=&q

java - Android app button not getting disabled/unclickable -

this question has answer here: how compare strings in java? 23 answers the button defined in mainui thread here part of code causing trouble- button.setonclicklistener(new onclicklistener() { public void onclick(view v){ new thread(new runnable() { public void run() { try { outputstream outtoserver = client.getoutputstream(); dataoutputstream out = new dataoutputstream(outtoserver); out.writeutf("hello " + client.getlocalsocketaddress()); final string msg = edi.gettext().tostring(); out.writeutf("client: " + msg); runonuithread(new runnable() { @override public void run() {

How to implement MVC pattern in Polymer 1.0? -

can define controller polymer element? example, have listview element.now want implement onclickevent() in controller keep business / other logic separate view. there view-controller binding available in polymer.? the basic structure of polymer element embeds mvc solution you, doesn't it? for example, general structure is: <dom-module id="my-module"> <!-- imports go here --> <link rel="import" href="../bower_components/example-imported-element/example-imported-element.html"> <style> ... </style> <template> <paper-button on-click="myfunc"></paper-button> </template> <script> (function() { polymer({ is: "my-module", ... myfunc: function() { // stuff }, ... }); }() </script> </dom-module> so inside <template> tags views , inside

MobileFirst APNS push notifications fails with java.net.SocketException (Connection closed by remote host) -

i have mobilefirst application trying send push production apns certificate. i exception when push submitted : info: failed send message message(id=2; token=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx; payload={"aps":{"alert":{"body":"blah blah blah","action-loc-key":null},"sound":"","badge":1},"payload":"{\"alias\":\"news_fr\",\"custom\":\"data\"}"})... trying again after delay java.net.socketexception: connection closed remote host @ sun.security.ssl.sslsocketimpl.checkwrite(sslsocketimpl.java:1510) @ sun.security.ssl.appoutputstream.write(appoutputstream.java:123) @ java.io.outputstream.write(outputstream.java:75) @ com.notnoop.apns.internal.apnsconnectionimpl.sendmessage(apnsconnectionimpl.java:240) @ com.notnoop.apns.internal.apnsconnectionimpl.sendmessage(apnsconnectioni

java - How to Check if paginate button is enabled or disabled -

i have webpage there options navigate other pages @ bottom. example, previous,1,2,3,4,next. want check if 'next' button enabled or disabled using java selenium webdriver. can me in scenario? please refer following html snippet <div id="paginate"> <ul class="pagination"> <li id="paginate_previous" class="paginate_button previous" tabindex="0"> <a href="#">previous</a> </li> <li class="paginate_button " tabindex="0"> <a href="#">1</a> </li> <li class="paginate_button " tabindex="0"> <a href="#">2</a> </li> <li id="paginate_next" class="paginate_button next disabled" tabindex="0"> <a href="#">next</a> </li> </ul> find element pagina

Create 2D array from existing 1D arrays in C? -

in perl can create 1d arrays , create 2d array them, following way: @a1=(a,b,c) @a2=(d,e,f) @a3=(g,h,i) @m23_v1=(\@a1,\@a2,\@a3) here way (assuming @a1 , @a2 , @a3 same in previous example): @m23_v2=([@a1],[@a2],[@a3]) the difference between 2 ways when backslashes used changing $a[0][0] change $a1[0] . on other hand when brackets used value copied changing $a[0][0] not change $a1[0] . bellow memory addresses of variables should clarify mean: print \$a1[0] scalar(0x2006c0a0) print \$m23_v1[0][0] scalar(0x2006c0a0) print \$m23_v2[0][0] scalar(0x2030a7e8) how achieve same in c? i've tried following code: # include <stdio.h> int main(){ int a1[3] = {1,2,3}; int a2[3] = {4,5,6}; int m23[2][3] = {a1, a2}; printf("%d\n", a1[0]); printf("%d\n", m23[0][0]); } but gives me following compilation warnings: 2d.c: in function ‘main’: 2d.c:4:3: warning: initialization makes integer pointer without cast [enabled default] 2d.c:4:3: wa

asp.net web api - Can't get Empty WebAPI project to read web.config setting -

i created empty webapi project vs 2013. added following web.config: in controller class, trying read setting , null exception. public bool getconnstring(string basecode, string scope) { try { string connstring = system.configuration.configurationmanager.connectionstrings["isroak1"].tostring(); } catch (exception ex) { string msg = ex.message.tostring(); } return true; } i tried again create new empty webapi project , same null exception thrown. think empty webapi missing something. how can fix read conn string setting? thanks help. try this: system.configuration.configuration rootwebconfig1 = system.web.configuration.webconfigurationmanager.openwebconfiguration(null); if (rootwebconfig1.appsettings.settings.count > 0) { system.configuration.keyvalueconfigurationelement customsetting = rootwebconfig1.appsettings.settings["isroak1"]

makefile - Matching % in a path -

how can make target match this: efl_class_bundles = \ efl_class_returnszero \ efl_class_cmd_regcmp \ efl_class_expression .phony: $(efl_class_bundles) $(efl_class_bundles): version syntax \ test/$@/efl_main.json \ test/$@/01_$@.json \ test/$@/02_efl_test_simple.json prove t/efl_class_$@_csv.t prove t/efl_class_$@_json.t test/%/efl_main.json: test/%/efl_main.csv $(csvtojs

Error overloading method using an enum - C# (Error CS0663) -

i've got error , can found on web reason. have 3 methods: public enum go { thatgo, parent, child }; public static void fadeout(this gameobject go, float fadetime) { task t = new task(fadeout(go, fadetime, false, go.thatgo)); new task(taskkiller(20f, t)); } public static void fadeout(this gameobject go, float fadetime, bool destroy) { task t = new task(fadeout(go, fadetime, destroy, go.thatgo)); new task(taskkiller(20f, t)); } public static void fadeout(this gameobject go, float fadetime, bool destroy, go wichdestroy) { task t = new task(fadeout(go, fadetime, destroy, wichdestroy)); new task(taskkiller(20f, t)); } the first 2 methods works fine, error, when write last (the 1 enum parameter), error: error cs0663: overloaded method `extensions.fadeout(this unityengine.gameobject, float, bool, extensions.go)' cannot differ on use of parameter modifiers only i've been searching

Deleting Data each 24 hours in Database with PHP and MYSQLi -

i know how this: i have made sort of chatbox automatic updates self script , loads latest 50 chat messages database. now wonder, how delete messages after each 24 hours keep first new 50 messages , delete older ones after that. is possible mysqli , php or must better solution? update followed advise lund , fast response provider: not able cron jobs or mysql events current plan. not have money upgrading it, erm.... if there solution, thank helping me out on matter folks. i have table called: chatbox , have in it: c_id chattext name date pseudo code (won't work without edits fit code , idea) - don't know how data stored, or variable names. or table name. or information need work. $sql = ("select * chatlog order timeadded desc"); //order descending should show newest ones first. $index = 1; //set index loop through while($row = mysqli_query($con, $sql) { //use while loop go through table if($index <= 50) { //for first 50 records

wordpress - Woocommerce customer quit before Paypal redirect -

i setup woocommerce website paypal , linked pdt token it. when customer buy paypal redirect paypal -> pay items -> redirect thank page of woocommerce. during last step of client quit paypal website before redirect woocommerce. order stuck on pending payment. is normal ask customer wait 10 seconds or click here have order completed. when using paypal standard (which comes woocommerce default) yes, it's normal user have wait "up 10 seconds" redirect, auto-return enabled in paypal account. if want provide better experience recommended enable paypal express checkout instead of paypal standard. can done using free paypal woocommerce plugin.

android - How to fill tableRow with editText in all row -

Image
i have table layout rows. 1 row description next 1 edittext values. how can force edittext fill table row? thought did android:layout_weight="1" when type edittext grow side , crush layout. when i´m not reaching max lenght of word can put edittext. here code: <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingleft="@dimen/activity_horizontal_margin" android:paddingright="@dimen/activity_horizontal_margin" android:paddingtop="@dimen/activity_vertical_margin" android:paddingbottom="@dimen/activity_vertical_margin" tools:context=".mainactivity"> <scrollview xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_paren

NuGet Source Control Integration for VS 2015 -

with visual studio 2013 (nuget 2.8) have been using following approach disable source control integration nuget: add following section nuget.config file exists relative solution: solutiondir\.nuget\nuget.config. <solution> <add key="disablesourcecontrolintegration" value="true" /> </solution> however, after upgrading visual studio 2015 (nuget 3.0) directive doesn't seem work more. new , upgraded packages added source control. i have tried adding configuration ...\users\user.name\appdata\roaming\nuget\nuget.config file doesn't change anything. i wonder if there new way specify behaviour in nuget 3.0. it seems bug. reported on nuget github site , should fixed in coming release. from deepakaravindr (assignee): we work on fix. time being, there 2 possible workarounds first 1 move nuget.config solution folder .nuget solution level , directory second 1 undo changes packages folder

gdb - What is the difference between dprintf vs break + commands + continue? -

for example: dprintf main,"hello\n" run generates same output as: break main commands silent printf "hello\n" continue end run is there significant advantage using dprintf on commands , e.g. considerably faster (if why?), or has different functionality? or convenience command? source in 7.9.1 source, breakpoint.c:dprintf_command , defines dprintf , calls create_breakpoint break_command calls, both seem use same underlying mechanism. the main difference dprintf passes dprintf_breakpoint_ops structure, has different callbacks , gets initialized @ initialize_breakpoint_ops . dprintf stores list of command strings of commands command, depending on settings. are: set @ update_dprintf_command_list which gets called on after type == bp_dprintf check inside init_breakpoint_sal which gets called create_breakpoint . when breakpoint reached: bpstat_stop_status gets called , invokes b->ops->after_condition_true (bs); breakp

android - Is it possible to write to the sd card without a file picker on kitkat+ -

i want delete files sd card root without file picker. after searching around couple of days,i haven't found way this.but files apps es file explorer have no problem,does know why is? the closest thing found how use new sd-card access api presented lollipop? have use file picker manifest <uses-permission android:name="android.permission.kill_background_processes"/> <uses-permission android:name="android.permission.read_external_storage"/> <uses-permission android:name="android.permission.write_external_storage"/> <uses-permission android:name="android.permission.get_package_size"/> <uses-permission android:name="android.permission.clear_app_cache"/> <application android:allowbackup="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:theme="@style/apptheme" > <activity android:name

save - Writing to File Internal Storage Android -

given code: final string dir = environment.getexternalstoragepublicdirectory(environment.directory_documents) + "/"; string file = dir + "info.txt"; file newfile = new file(file); //environment.getexternalstoragedirectory().tostring()= /storage/emulated/0 string msgdata="p1000"; fileoutputstream outputstream; try { newfile.createnewfile(); outputstream = openfileoutput(file, context.mode_private); outputstream.write(msgdata.getbytes()); outputstream.close(); } catch (exception e) { e.tostring(); //e.printstacktrace(); } when open file /storage/emulated/0/documents/info.text, find empty while should have string "p1000"; why that? note: not have external storage (external sd card). thanks. do have write_external_storage permission in manifest? try this: fileoutputstream outputstream = new fileoutputstre

html - Problems with centering divs -

i have 2 divs in page end want center second 1 between first , end ofthe page. this: | | | | | | | | | | | | | | div1 | |div2| | | | | | | | | | | | | | "div 2" supposed centered between "div 1" , end of page. tried know , nothing worked. my html: <!doctype html> <html> <head> <link rel="stylesheet" type="text/css" href="teste.css" /> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script> <script type="text/javascript" src="teste.js"></script> <title>example</title> </head> <body> <div id="header"> <div class="title"">example</div> </div> <div id="main-body"> <ul class="nav-tabs"> &l

ios - The app references non public selectors in payload: queryString -

Image
i'm trying validate app xcode gives me warning. there facebooksdk and afnetworking frameworks included. how can remove warning? affect on reject binary? you using non public apple api's. try of figure out , remove them. apple reject app if submit app uses private apple api's. if think in facebook or afnetworking try updating them. altho don't think problem if not using old versions of those.

php - Does the galera cluster have to have an even number of nodes? -

i have 8 nodes in galera cluster, saw video suggests have odd number of nodes (3,5,7,9,ect). is true? , have issues having 8 nodes in cluster? no, 8 ok. "quorum" mechanism needs majority. if have @ least 3 nodes (and 1 fails), remaining nodes can establish quorum. if 8 nodes split 4 in each of 2 datacenters, datacenter outage kill entire cluster. protect against datacenter failure, should spread nodes 'evenly' across 3 (or more) datacenters. 8 nodes: 3+3+2 safe split. 4+3+1 or 4+2+2 kill cluster if '4' datacenter went down. how 8-node cluster working? (that's biggest 1 have heard of.)

java - Cannot instantiate the type List -

i getting erorr "cannot instantiate type list" when use below code: list = new list(floatshell, swt.border | swt.multi | swt.h_scroll | swt.v_scroll); but example given here: https://gist.github.com/suxiaogang/6311176d2c5b9a8d1867 what mistake have made? you did import java.util.list; when need import org.eclipse.swt.widgets.list;

javascript - How do I set data in an unrelated ViewModel -

i have sign in process i've roughed fiddle (the part i'm stuck on starts @ line 110). here's copy of code: ext.define('myapp.mypanel',{ extend: 'ext.panel.panel', title: 'my app', controller: 'mypanelcontroller', viewmodel: { data:{ email: 'not signed in' } }, width: 500, height: 200, renderto: ext.getbody(), bind:{ html: "logged in as: <b>{email}</b>" }, buttons:[ { text: 'sign in', handler: 'showsigninwindow' } ] }); ext.define('myapp.mypanelcontroller',{ extend: 'ext.app.viewcontroller', alias: 'controller.mypanelcontroller', showsigninwindow: function (b,e,eopts){ ext.widget('signinwindow').show(); } }); ext.define('myapp.signinwindow',{ extend: 'ext.window.window', tit

postgresql - Provide me samples on Spring Security OAuth2.0 Jdbc token store for potgresql -

im new spring security oauth2. please provide me samples on spring security oauth2 jdbc token store postgresql.give samples above requirement understand spring security oauth2 jdbc token store.thanks in advance. you can find db schema here . add support code can create bean: @bean public tokenstore tokenstore() { return new jdbctokenstore(datasource); } and postgresql use bytea type instead of longvarbinary

android - webview, using loadData at onResume loses history -

i have app reads articles in webview. when articleactivity first started, html of webpage downloaded string , parsed make mobile site, use wb.loaddata(html, "text/html; charset=utf-8", null); . downloading occurs in asynctask since can't internet activity on ui thread, now, whenever link on page clicked, defaults loadurl() per webviewclient. can use goback() in history this, no problem. the problem lies search bar widget. call searchresultsactivity, opens webview , loads url. when user clicks on article, searchresultsactivity sends articleactivity through intent. problem want use loaddata() new article link, , try in onresume() , nothing happens if i'm still on loaded page. log statement shows url extra_return_result did make it, think intent good. think due javascript "same origin" thing, that's why if use loaddatawithbaseurl() , page loads. if try button now, loaded page blank! do preserve history when load new page? class searchwebviewclie

rabbitmq - In Celery 3.1.18, rpc backend fail to avoid creating resulting queue per task -

i found amqp backend in old celery 3.0.24, creates resulting queue per task, after reading this: http://docs.celeryproject.org/en/master/whatsnew-3.1.html#new-rpc-result-backend upgrade celery 3.1.18, it's said: new rpc result backend new experimental version of amqp result backend alternative use in classical rpc scenarios, process initiates task process retrieve result. it uses kombu send , retrieve results, , each client uses unique queue replies sent to. avoids significant overhead of original amqp result backend creates 1 queue per task. but not case when tested below: tasks.py celery = celery('tasks', backend='rpc') @celery.task def mul(x, y): return x * y test_tasks.py result = mul.delay(2, 3) print "mul.delay(x, y)={0}".format(result.get()) start worker celery -a tasks worker -l info observe queues in rabbitmq sudo rabbitmqctl list_queues run test python test_tasks.py so every time run test, see new resulti

django multiple models save single commit -

in view, saving data in multiple models: def myview(request): #do processing model1.save() model2.save() how ensure there rollback of model1.save() in case model2.save() raises error. or how commit after both models saved? in other words, "only save model1 , model2 if both save() successful" use atomic transaction : atomicity defining property of database transactions. atomic allows create block of code within atomicity on database guaranteed. if block of code completed, changes committed database. if there exception, changes rolled back. examples: from django.db import transaction transaction.atomic(): model1.save() model2.save() and from django.db import transaction try: transaction.atomic(): model1.save() model2.save() except integrityerror: handle_exception()

c# - Combine two bytes to short using left-shift -

i have high byte , low byte convert short. i have implemented this, seems work, bit confused on why. both high_byte , low_byte cast byte s. short word = (short)(high_byte << 8 | low_byte); in code, should high_byte << 8 zero? tried this: (byte)1 << 8 which equals 256 , thought should 0 . guess missing something. could please explain? from c# language specification , section 4.1.5: the integral-type unary , binary operators operate signed 32-bit precision, unsigned 32-bit precision, signed 64-bit precision, or unsigned 64-bit precision: ... for binary << , >> operators, left operand converted type t , t first of int , uint , long , , ulong can represent possible values of operand. operation performed using precision of type t , , type of result t . that is, whenever apply operators integral types in c#, result minimum of 32-bits. there other rules (given in ... ) other operators, define how final types det

c# - Call signature of Func<TResult>.BeginInvoke -

i trying write async operation using c# , .net 4.5/4.6, , trying use func.begininvoke() here's msdn's begininvoke page says: public virtual iasyncresult begininvoke( asynccallback callback, object object ) unfortunatly there's no information on second parameter (object) is, , primary msdn async tutorial page shows: // initiate asychronous call. iasyncresult result = caller.begininvoke(3000, out threadid, null, null); which isn't supported function definition! looks .net documentation has gotten substantially worse since last time looked @ it. help appreciated! in begininvoke object argument pass callback. available property in parameter callback. pass delegate itself, call endinvoke on it.

Spring integration kafka 1.2.1.RELEASE : Consumer context error -

i getting error below consumer configuration details: note: producer working fine details: spring integration kafka 1.2.1.release (internally uses kafka_2.10-0.8.2.1.jar). if replace kafka_2.10-0.8.1.1.jar,the error disappears(by overriding in pom.xml) <int:channel id="inputfromkafka"> <int:queue/> </int:channel> <int-kafka:inbound-channel-adapter id="kafkainboundchanneladapter" kafka-consumer-context-ref="consumercontext" auto-startup="false" channel="inputfromkafka"> <int:poller fixed-delay="10" time-unit="milliseconds" max-messages-per-poll="5" /> </int-kafka:inbound-channel-adapter> <bean id="consumerproperties" class="org.springframework.beans.factory.config.propertiesfactorybean"> <property name="properties"> <props>