Posts

Showing posts from May, 2013

botframework - PromptDialog.Choice does not show choices -

i'm looking how can show choices user idialog<object> , promtdialog.choice method. thing below code sample doesn't show choices. difficult find code sample. looking help. thank you. list<string> botoptions = new list<string>(); botoptions.add("find program"); botoptions.add("find event"); promptdialog.choice(context, choiceselectasync,botoptions, "i didn't understand you. i'm cable with", "didn't that", 1, promptstyle.none); you need change promptstyle none. the available options are: auto generate buttons choices , let connector generate right style based on channel capabilities autotext show choices text. prompt decides if should generate text inline or perline based on number of choices. inline show choices o...

android - Navigation Drawer Item ByDefault selected not on click andorid -

i new android, using navigation drawer displaying item list. i faced issues, when come navigation activity, list name restaurant displayed. restaurant item included in drawer item similar other one. first time when come navigation activity, want highlight restaurant item. how can it? kindly tell me. this simple 1 line code: navigationview.getmenu().getitem(0).setchecked(true); and can select(highlight) item calling onnavigationitemselected(navigationview.getmenu().getitem(0)); and call , item index solution can refer link.. solve problem. navigation drawer: how set selected item @ startup? if not copy code can tell how use code.

eclipse - WizardNewFileCreationPage order -

i'm creating export wizard, including possibility user choose format of export , choose location of export wizardnewfilecreationpage. to so, i've created 3 pages, 1 extending wizardpage radio set next page call, , 2 others pages pending format , extending wizardnewfilecreationpage. it's working perfectly, problem concerns "finish" button, requires clickable export format fulfilled if overrided function ispagecomplete limit page validation function validatepage. it looks function validatepage doesn't valid it's own control control implemented class wizardnewfilecreationpage in wizard. am going wrong somewhere , know solution ? regards, waldo the wizarddialog showing dialog drives button enablement. @ various points calls updatebuttons method. in turn calls wizard canfinish method set finish button state. the default canfinish call wizardpage ispagecomplete method every page pages not active. for wizardnewfilecreationpage ...

asp.net mvc - Ajax serialize with extra data MVC -

i use webgid display records have user. load webgrid in partilal view after user clicks on ajax actionlink. @ajax.actionlink(" ", "adduserelements", "users", new { username = item.username }, new ajaxoptions() { updatetargetid = "add_research"}, new { @class = "glyphicon glyphicon-link" }) in webgrid have delete action. when click delete modal appears ask verification. click on yes , record being deleted webgrid in partial view doesn't being refreshed. update partial view use in ajax code $("#add_research").load('/users/adduserelements'); i tried pass username serialize controller no lack my ajax code $(function () { $.ajaxsetup({ cache: false }); $("a[data-modal]").on("click", function (e) { $('#mymodalcontent').load(this.href, function () { $('#mymodal').modal({ keyboard: true }, 'show'); ...

stl - Does set<pair<long long,long long> > does not supports members first an second? -

#include <bits/stdc++.h> using namespace std; #define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0); #define ll long long int #define pb push_back #define mp make_pair #define pii pair<int,int> #define pll pair<ll,ll> #define pis pair< int,string> #define test int t;cin>>t;while(t--) #define ff first // error: 'std::set<std::pair<long long int, long long int> >::iterator' has no member named 'first' #define ss second // error: 'std::set<std::pair<long long int, long long int> >::iterator' has no member named 'second' #define inf 1000000000 #define input(a,n) for(i=1;i<=n;i++)cin>>a[i]; #define output(a,n) for(i=1;i<=n;i++)cout<<a[i]<<" "; vector< vector<ll> > v(3002, vector<ll>(3002,-1)); set< pair<ll, ll> > se; set< pair<ll, ll> >::iterator it; int vis[3002]={0}; void exmin(ll a) { ll x,des,val,min=inf...

android - how to draw capital Letters and fill that alphabets by finger using Canvas? -

Image
i working on app in have draw letters , want draw line finger. when letter fill open dialog box shows completed latter "a" as shown below picture. for example have letters given in picture: but want , if know concept me...!!! you can check solution in github sample

tokumx - Locked outside mongodb replica set -

i have mongodb replica-set of 3 members (version 2.4) in administrator user 'admin' db not have 'useradminanydatabase' role. this role required managing users on databases. the roles have are: [ "readwriteanydatabase", "dbadminanydatabase", "clusteradmin" ] i tried updating roles myself or creating new user, have no permission access db.system.users in admin db. i tried setting noauth=true did not help. when removing keyfile well, db not able sync other members (obviously) , got stuck in recovery state. i found similar question refers stand alone db (no replica set) doesn't in case. what best way add role while having minimal system downtime? i use mongodump , mongorestore backup data rebuild node right permissions , restore data. however approach should work : if have locked out need following: stop mongodb instance remove --auth and/or --keyfile options mongodb config disable authent...

ios - ERROR Internal navigation rejected - <allow-navigation> IN -

i'm getting below response in ionic app angularjs.i tried open link in angularjs iframe. error internal navigation rejected - <allow-navigation> not set url='about:blank' error internal navigation rejected - <allow-navigation> not set url='https://ap.testing.com/testing/testing.s/testing' but tried add following link in cofig.xml still i'm geeting same issue please advice how fix. <allow-navigation href="https://ap.testing.com/*" /> i having problem , turns out there 2 config.xml files. appname/config.xml <- 1 shows in xcode appname/platforms/ios/appname/config.xml i added <allow-navigation href="*" /> to both of them , worked. using 6.3.0.

java - Open Google links into new tab -

i want open google search results new tab. tried code: webdriver driver = new chromedriver(); driver.get("http://www.google.com/xhtml"); thread.sleep(5000); webelement searchbox = driver.findelement(by.name("q")); searchbox.sendkeys("chromedriver"); searchbox.submit(); system.out.println("current url: " + driver.getcurrenturl()); webdriverwait wait = new webdriverwait(driver, 10); wait.until(expectedconditions.presenceofelementlocated(by.cssselector("h3.r a"))); list<webelement> results = driver.findelements(by.xpath("//h3[@class='r']/a")); (int = 0; < results.size(); i++) { string selectlinkopeninnewtab = keys.chord(keys.control,keys.return); driver.findelement(by.xpath("//h3[@class='r']/a")).sendkeys(selectlinkopeninnewtab); system.out.println("google r...

python - matplotlib plot of complex valued function -

in matlab plot of complex vector result in plot of imaginary vs real part. is there equivalent function in matplotlib? obviously work: def plotcomplex(c, *args): plot(real(c), imag(c), args) but exist? seems there no native complex numbers plotting function. build own.

c - Any possibility of using KeyBlob (stored in byte format) for crypto operations -

created key blob using openssl. need use keyblob crypto operations(like- encrypt, decrypt, signing , verifying) using openssl. code platform independent. // assume "private_key" having private key // keyblob byte array of size 2048 // e,n,p,q,dmp1,dmq1,iqmp,d of type bignum* , initialized null rsa* rsa = new rsa( ); rsa = evp_pkey_get1_rsa ( private_key ); if ( null == rsa ) { hresult = errno; printf("\n\terror:evp_pkey_get1_rsa failed\n\n"); break; } // if else { //printf("\n\trsa private key generated successfully\n\n"); } // else e = rsa->e; n = rsa->n; p = rsa->p; q = rsa->q; dmp1 = rsa->dmp1; dmq1 = rsa->dmq1; iqmp = rsa->iqmp; d = rsa->d; version = rsa->version; // convert bignum binary. // modulus (n) modulus = (unsigned char*)calloc(rsa_size(rsa), sizeof(unsigned char)); iresult = bn_bn2bin(n, modulus); if( !iresult ) { hresult = errno; printf("\n\terror:bn_bn2bin failed\n\n")...

websphere 8 - jpa 2.1 spring boot with web sphere 8.5.5.8(full version) jdk 7 -

i followed approach suggested jeff https://gist.github.com/jeffsheets/aec3e94870ef903ce7efe33e00563d3c i able overcome jpa 2.1 java.lang.classcastexception: com.ibm.websphere.persistence.persistenceproviderimpl incompatible javax.persistence.spi.persistenceprovider. but following error servlet named com.x...jerseyconfig can not dynamically added because servlet configuration same name exists. using websphere 8.5.5.8 full version jdk 1.7 spring boot 1.4.0.m3. in jerseyconfig.java @component @propertysources(value = { @propertysource("classpath:application.properties"), @propertysource("classpath:validationmessages.properties")}) @dependson("hibernatepersistenceproviderresolver") public class jerseyconfig extends resourceconfig { public jerseyconfig() { packages("com.x.package"); } } thanks hints or pointers. i did following make work (in addition @dependson mentioned previously). 1) load local class...

Get all objects where optional exists in Realm Swift -

if have optional var in realm object, how instances array of instances var has not been set. instance, instances of person not have address ? or do have address ? class person: object { dynamic var address: address? // more values } hi, maybe can use expression var personwhoaddressnil = realm.objects(person.self).filter("address = nil") i can't try moment, let me know if it's helping :) see ya

Java 8 stream and incoming data (Kafka) -

i have queue (it happens kafka not sure matters) reading messages. want create stream represent data. my pseudocode consume (kafka) queue looks this: list<message> messages = new arraylist<>(); while (true) { consumerrecords<string, message> records = kafkaconsumer.poll(100); messages.add(recordstomessages(records)); if (x) { break; } } return messages.stream(); using pseudocode stream not returned until while loop broken, i.e. until of queue has been read. i want able return stream straight away, i.e. new messages can added stream after has returned. i feel need use stream.generate not sure how, or maybe need spliterator? i want close stream @ later point in code. thanks! here commented example of how done : public static void main(string[] args) { linkedblockingqueue<integer> queue = new linkedblockingqueue<>(); // data producer runnable job = () -> { // send data stream ...

javascript - AngularJS : $timeout is not a function -

i trying add delay of 2000ms using timeout method not working if try call in function(searchfunc) inside cotroller. gives error: $timeout not function . controller code : var angularjsapp = angular.module('graphapp', ['nganimate', 'ui.bootstrap','ui.grid']); angularjsapp.controller('accordiondemoctrl', function($scope, $timeout) { $scope.searchfunc = function(search_name,$timeout) { websockettest(search_name,keyword_type); //$scope.loading = false; $timeout(function () { $scope.loading = false; }, 2000); }); you're passing $timeout parameter function $scope.searchfunc = function(search_name,*$timeout* which make undefined when call function because don't pass along. removing fix issue. scope.searchfunc = function(search_name) you can read how works (closures) here

excel - #Name? error in cells with VBA code -

i running montecarlo simulation in excel vba receive #name? errors in respective cells. when click 1 of these cells, press f2 , return error disappears , value calculated. wrong here? this code line calculating respective value: activecell.formula = "=start_rate * exp(norm.s.inv(rand())* standard_deviation * (" & & " ^1/2)) " and entire code (if necessary): sub mc_simulation() dim integer dim k integer dim startcell range dim start_row integer dim start_column integer iterations = worksheets("run_mc").range("mc_simulations").value duration = worksheets("run_mc").range("duration").value mean = worksheets("run_mc").range("mean").value start_rate = worksheets("run_mc").range("start_rate").value standard_deviation = worksheets("run_mc").range("standard_deviation").value start_row = 15 start_column = 1 = 1 duration k = 1 iterations works...

google chrome - how to set upgrade-insecur-requests based on nginx -

i have changed site https ,but used cdn of static files in code. can't work , chrome console show errors this: mixed content: page @ 'https://a.example.com/static/' loaded on https, requested insecure stylesheet 'http://cdn.bootcss.com/bootstrap/3.3.5/css/bootstrap.min.css'. request has been blocked; content must served on https. i have add add_header content-security-policy upgrade-insecure-requests; in nginx configuration file this: server { listen 80; listen 443; server_name a.example.com; add_header content-security-policy upgrade-insecure-requests; if ($scheme != "https") { return 301 https://$server_name$request_uri; #rewrite ^ https://$server_name$request_uri? permanent; } ssl on; ssl_certificate /etc/nginx/ssl/example.crt; ssl_certificate_key /etc/nginx/ssl/example.key; ssl_session_timeout 5m; ssl_protocols sslv3 tlsv1 tlsv1.1 tlsv1.2; ssl_ciphers "high:!anull:!md5 o...

ssl - soap_ssl_server_context without using pem file -

i using gsoap , compiled with_openssl . have found there api soap_ssl_server_context takes pem file. is possible provide private key gsoap layer without passing through pem files? want use hsm typically key management, hsm e.g. thales payshield 9000, provide public key in der binary format (which can converted pem format using binary->base64 conversion). however, not intended provide private key in der or pem format. private key encrypted hsm lmk (local machine key). this means hsm can translate encrypted value (often pin verification key) encryption key. point of having hsm e.g. pci compliance visa or mastercard. not meant clear data in software. if need decrypt data yourself, perhaps use software solution .net rsa or bouncycastle.

How do I rename a (work)sheet in a Google Sheets spreadsheet using the API in Python? -

i have been trying/looking solve problem long while. have read documentation gspread , cannot find there way rename worksheet. of know how to? massively appreciate it! there indeed worksheet.title gives name of worksheet, cannot find way rename actual sheet. thank in advance! this extraction of library i've coded personally: def _batch(self, requests): body = { 'requests': requests } return self._service.spreadsheets().batchupdate(spreadsheetid=self.spreadsheetid, body=body).execute() def renamesheet(self, sheetid, newname): return self._batch({ "updatesheetproperties": { "properties": { "sheetid": sheetid, "title": newname, }, "fields": "title", } }) i think little effort, can implement code , obtain want. in order make batchupdate call, need spreadsheetid initialized service explai...

javascript - How to add text into along the object using three.js -

Image
i have added text object (a shirt model) using text geometry. here code: var canvas = document.getelementbyid('mycanvas'); var ctx = canvas.getcontext('2d'); ctx.font = 'italic 18px arial'; ctx.textalign = 'center'; ctx. textbaseline = 'middle'; ctx.fillstyle = 'red'; ctx.filltext('your text', 150, 50);` my output looks this: the text not fit shirt model. if rotate shirt model means text showing irrelevant view. want fit text shirt model this: how can fit dynamic text shirt model using three.js. simply drawing text 2d canvas never give satisfactory result. have 3 possibilities tackle issue. 1) using textures loaded three.textureloader . several examples here: http://threejs.org/examples tutorial: http://www.johannes-raida.de/tutorials/three.js/tutorial06/tutorial06.htm 2) using three.textgeometry : an example: http://threejs.org/examples/#webgl_geometry_text 3) using css3d solution. a n...

javascript - How to find all tags with a specific data- attribute? -

i need find tags have 'error' data bound them using jquery. have done. it's not working because added data attribute code. $('form input').data('error',1); console.log( $('form input[data-error]') ); // empty how can retrieve of them? use filter() $('form input').filter(function(){ return $(this).data('error'); // adjust if boolean not sufficient }).dosomething();

ios - How to scroll to a section when UITableViewCell has automatic height? -

i have uitableview in uiviewcontroller multiple cell prototypes , automatic row height , multiple sections , rows. some sections has header view, others none. mytableview.rowheight = uitableviewautomaticdimension i want jump on 10th section, use: let section = nsindexpath(forrow: 0, insection: 9) mytableview.scrolltorowatindexpath(section, atscrollposition: .top, animated: true) but didn't work, because think ios cannot know 10th section start due on uitableviewautomaticdimension . what think? how can scroll particular section while cells has variable content , height? thanks reading.

php - WooCommerce - Hook when Cart Load on checkout -

i have made little plugin 1 function. function should run when cart loads in checkout. problem is, loading cart ajax , no action hook works on cart load ajax. do know any hook works when cart loads ajax ? alternatively, used filter woocommerce_cart_product_subtotal filter, replaces function of calculation of product subtotal. is there way can print/echo each product's subtotal in function? (i used wc_cart::get_product_subtotal() doesn't work. don't know why). is there initialized used wc_cart classes? thanks in advance

Spring MVC and Hibernate: NestedServletException: Handler processing failed; nested exception NoClassDefFoundError:JsonMappingException$Reference -

am trying integration spring mvc , hibernate & oracle 11g tables users & org & userorg[forgin keys userid,orgid] pom.xml <project xmlns="http://maven.apache.org/pom/4.0.0" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://maven.apache.org/pom/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelversion>4.0.0</modelversion> <groupid>com.tests</groupid> <artifactid>test</artifactid> <packaging>war</packaging> <version>1.0-snapshot</version> <name>tests maven webapp</name> <url>http://maven.apache.org</url> <properties> <spring.version>4.1.5.release</spring.version> <hibernate.version>4.3.8.final</hibernate.version> <mysql.version>5.1.10</mysql.version> <junit-version>4.11</junit-version> <servlet-api-version>3.1.0</servlet-api-version...

vb.net - Replace special characters in text file. Best way to do this? -

i've got text file lines , special characters. want replace those. best way this? i've got feeling not quickest way. dim lopenfile long dim sfiletext string dim sfilename string sfilename = "c:\test.txt" lopenfile = freefile open sfilename input lopenfile sfiletext = input(lof(lopenfile), lopenfile) close lopenfile sfiletext = replace(sfiletext, " Ç ", " c ") sfiletext = replace(sfiletext, " ü ", " u ") sfiletext = replace(sfiletext, " é ", " e ") lopenfile = freefile open sfilename output lopenfile print #lopenfile, sfiletext close lopenfile also want sum things has been changed. can me that? i guess want remove diacretics string, accents or umlauts. use method efficient since it's using stringbuilder : public shared function removediacritics(s string) string dim normalizedstring string = s.normalize(normalizationform.formd) dim stringbuilder new stringbuilder() eac...

java - Is there a way to make lombok to create an object in case of null while using @Getter @Setter annotation? -

having simple class contains class b there lombok annotation create new instance of class b in in case of null? public class { @getter @setter private b b; } i afraid feature doesn't exist. documenation lists number of configuration keys annotations, functionality after not listed. somebody asked on lombok github page : i'd love feature scenario: @getter(lazy = true) private list<string> foo = new arraylist<>(); generate this: private list<string> foo; public list<string> getfoo() { if (this.foo == null) { this.foo == new arraylist<>(); } return this.foo; } of course, use double-checked locking or atomicreference, point here i'd rather empty list null reference. it's common idiom in jaxb classes instance nice reduce in size lombok. so, feature not (yet?) implemented. if you, avoid using annotation in these cases, , instead create methods wanted hand.

c - How can I print as strings the content of a .txt file? -

like said in title don't know how print content of .txt file in c. here's incomplete function did: void print_from_file(items_t *ptr,char filemane[25]){ char *string_temp; file *fptr; fptr=fopen(filemane, "r"); if(fptr){ while(!feof(fptr)){ string_temp=malloc(sizeof(char*)); fscanf(fptr,"\n %[a-z | a-z | 0-9/,.€#*]",string_temp); printf("%s\n",string_temp); string_temp=null; } } fclose(fptr); } i'm pretty sure there's errors in fscanf because doesn't exit loop. can please correct this? you're using malloc wrong. passing sizeof(char*) malloc means giving string amount of memory take hold pointer character(array). currently, writing memory have not allocated, have undefined behavior. highly advisable perform checks on file lenght , otherwise make sure not write more string allocated it. instead, this: string_temp=malloc(100*sizeof(char)); // enough space 99 char...

Summation in Excel -

Image
i want write formula in excel works follow, cannot handle despite numerous trials. want make sum of 3 cells. of these cells may missing values (represented double dot ".."). formula has show sum of non-missing values. in particular, whether there @ least 1 non-missing value among 3 cells, result must sum of non-missing values. if there missing, result must missing (".."). to sum can use: =sumif(a1:c1,"<>..",a1:c1) but if want .. in answer use: =if(sumif(a1:c1,"<>..",a1:c1)=0,"..",sumif(a1:c1,"<>..",a1:c1)) edit : displaying 0 in answer if numbers 0 pointed out @jayvee in comment. =if(and(sumif(a1:c1,"<>..",a1:c1)=0,countif(a1:c1,"<>..")=0),"..",sumif(a1:c1,"<>..",a1:c1))

angularjs - Angular state : pass multiple parameter without changing url querystring to controller -

i want send parameter app.run logincontroller. because, call state.go() $rootscope.$on() defined inside app.run. app.run('$rootscope', '$state', '$stateparams',function($rootscope, $state, $stateparams(){ $rootscope.$state = $state; $rootscope.$stateparams = $stateparams; $rootscope.$on('unauthorized_access', function (event, args) { $state.go("page.login", {'error': args.error,'msg': args.msg}); }); }]); i have app.config(['$stateprovider','$urlrouterprovider',function($stateprovider, $urlrouterprovider, $httpprovider){ $urlrouterprovider.otherwise('/'); $stateprovider // parts omitted... .state('page.login', { url: '/login', views: { 'page': { templateurl: 'app/landingpage/login.html', controller: 'logincontroller', params: {obj : {error : ...

javascript - Cannot assign to read only property '.js' of #<Object> -

i m building application , having troubles dealing proxyquire , testing. i have following test : import proxyquire 'proxyquire' const fetchmock = () => new promise((res) => { jobs: [] }) const jenkinsservice = proxyquire('../lib/jenkins-service', { 'node-fetch': fetchmock }) describe('jenkinsservice#getproject->goodconfs', () => { let service beforeeach(() => service = new jenkinsservice({ url: 'http://jenkins.io' })) it('should call fetch method', () => { service.getall() }) }) that fails , throw me following error : cannot asign read property '.js' of # i m trying test fetch module has been called in getall method : 'use babel' import fetch 'node-fetch' import constants './constants' export default class jenkinsservice { /** * create new jenkinsservice * @param {object} configs configuration needed acc...

javascript - Font-size dropdown in CKEDITOR -

i have query related font-size dropdown provided in ckeditor. if have below text in editor, <span style="font-size:16px;">test abbreviations</span> then on selection, shows current font-size in dropdown. want font-size highlighted not when text within <span> tag, within <p> tag or other tag also. is possible?

android - Add imageView to coordinatorLayout -

here coordinator layout. ok, can see everything. but can't see imageview. in code initializing imageview correctly , have object. need image view in center of screen. if change imageview button see button in center of screen, if change other can´t seen element. please how can add imageview coordinatorlayout? this code in coordinatorlayout. thank you. <android.support.design.widget.coordinatorlayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:id="@+id/main_content" android:layout_width="match_parent" android:layout_height="match_parent" android:fitssystemwindows="true"> <imageview android:id="@+id/status_btn" android:layout_width="150dp" android:layout_height="150dp" android:layout_gravity="center" android:background="@color/red" /> <button andr...

docusignapi - DocuSign Connect Not Sending Out XML Messages -

Image
i trying docusign connect make http post request url. i have done testing postman app on google chrome , able process docusign xml messages sent through http post request. attached setup. i unable receive messages docusign (i have tried both sending , signing) , additionally not see logs under logs or failures. there possible reason this? updates: using self-signed certificate on application , hence docusign unable post xml message web service. has been resolved after installation of docusign accepted certificate. assuming account configured connect , not see in logs or failures here's possible reasons: security software or firewall on side blocking/catching message before reaches listener you filtering envelope not have permission to. your tests invalid (i.e. you've configured signing event user declining or taking other action). also, realized don't have require acknowledgement enabled in connect config- try turning on see if failures start...

java - WAR on tomcat cannot find deploy.jar in jre -

i have deployed application on tomcat war file. @ 1 point using urlencoder com.sun.deploy.net encode http parameters. message = urlencoder.encode(message); this compiles fine. deployed application tries access method receive java.lang.classnotfoundexception: com.sun.deploy.net.urlencoder why that? understand urlencoder class belongs deploy.jar of jre since java 1.3 (i using 1.7) tomcat doesn't seem find ... what have do? i being incredibly stupid it should have been import java.net.urlencoder; rather import com.sun.deploy.net.urlencoder; plain wrong. works, of course!

java - Visual Studio 2012 + Ant: diamond operator is not supported in -source 1.5 -

there many similar questions regards setting language level java when performing android build. of these answers show how set language level in eclipse or netbeans or android studio . using nsight tegra-android in visual studio 2012 building using ant , don't see anywhere in project->properties can change language level. i have codeworks android 1r4 installed latest , paths have set following packages: ndk r10e jdk 1.7.0_71 ant 1.8.2 which specified under tegra->options in visual studio. ant getting -source 1.5 from? i fixed using advice suggested in this answer . went project->properties->configuration properties->ant build->command line , added -djava.source=7 -djava.target=7 under additional options.

c# - Retrieve Custom Data Annotations for create Custom LabelFor -

i creating custom labelfor . inside want dataannotations properties linked attribute dataannotations created me , i'm not getting. example: obrigatorio i need values of dataannotations labelfor leave fields in bold when required. , depending on validation, leave customized styles. my class public class gruporisco : ientidadebase { [key] public int gruporiscoid { get; set; } [obrigatorio] [display(name="descrição")] public string descricao { get; set; } } my custom atribute public class obrigatorio : requiredattribute { public obrigatorio() { errormessage = "* obrigatório"; } } the attribute above simple, create complex attributes.

java - Apache Geode - Query performance on joins -

i using apache geode caching solution. have requirement store data within 2 different regions , retrieve them simple join query. i have tried both replicated partitioned regions have found query takes long time return results. have added indexes on both regions has improved performance still not fast enough. can please on how improve performance on query. here have tried example 1 - partitioned regions time taken retrieve 7300 records cache 36 seconds configuration in cache.xml <region name="department"> <region-attributes> <partition-attributes redundant-copies="1"> </partition-attributes> </region-attributes> <index name="deptindex" from-clause="/department" expression="deptid"/> </region> <region name="employee"> <region-attributes> <partition-attributes redundant-copies="1" colocated-with="depart...

Minimial test of database connectivity in django -

i'm writing quick little test view can get every few minutes check application , database servers online , functioning. from django.http import httpresponse, httpresponseservererror my_app.models import model def test(request): ''' returns httpresponse prove application/db servers work ''' if request.method == "get": #test database access count = model.objects.values_list('id', flat=true).count() if count: return httpresponse("ok") return httpresponseservererror("error") is there more minimal inbuilt database query test db server working , takling app server, without having fake 1 did above? you can import django connections , check databases: from django.db import connections try: cursor = connections['default'].cursor() except operationalerror: return httpresponseservererror("error") else: return httpresponse(...

javascript - How to listen for data changes at more than a particular location in Firebase? -

Image
i using firebase real-time db mobile app i'm developing (js web sdk), structure below in screenshot, key = email, each key have mobile user information, , gps coordination of mobile location inside node = "path" how listen on the "path" of emails (users)? straight firebase documents : value: read , listen changes entire contents of path. var ref = firebase.database().ref("users"); firebase.database().ref().on('value', function(snapshot) { // whatever }); this function run once when initiated , once more every change data under path. snapshot return contents of user/ lot of data returned every change. can change ref accordingly.

.htaccess - How can i use redirection for my URL in wordpress -

how can use redirection url in wordpress? my url is: mydomain.com/blog/why-logos-should-be-simple/ want redirect on: mydomain.com/why-logos-should-be-simple/ add .htaccess: rewritecond %{request_uri} ^/blog/(.*) rewriterule ^(.*)$ http://example.com/%1 [r=301,l]

Initialize Ruby codes error -

i tried run these codes: class dog def set_name(name) @dogname = name end def get_name return @dogname end def talk return "awww" end def initialize(title, description) @title = title @description = description end end doggy = dog.new doggy.set_name('sam') puts doggy.get_name puts doggy.talk bogart = dog.new('the book', 'the road not taken') puts bogart.to_s puts bogart.inspect i did make sure every argument correct. however, got following errors. c:\ruby200\bin\ruby.exe -e $stdout.sync=true;$stderr.sync=true;load($0=argv.shift) c:/users/todd/rubymineprojects/untitled1/test.rb c:/users/todd/rubymineprojects/untitled1/test.rb:15:in `initialize': wrong number of arguments (0 2) (argumenterror) c:/users/todd/rubymineprojects/untitled1/test.rb:22:in `new' c:/users/todd/rubymineprojects/untitled1/test.rb:22:in `<top (required)>' -e:1:in `load' ...

Regular Expression syntax in Windows Grep -

Image
how can search in windows grep regular expressions? example, have file has following - example file contents (c:\test\somefile.txt) void somereallyimportantfunction(void) { //do important stuff here return; } expected windows grep search ability *somereallyimportantfunction(*)*{ here's get question what error in regular expression here sees, invalid use of repeat? i have spent long debugging, give in! thoughts? i basing answer here : http://www.wingrep.com/help/html/search-regexp.htm the asterisk character reporesents 0 or more instances of preceding character. seems using pure wildcard. believe error first asterisk trying repeat nothing. past error wont result want. try '.*' '.*' 0 or more of characters. depending on how granular want check [a-za-z]* or similar.

javascript - How do I get the formatting the Current cell of the table in Word using office.js -

Image
i had asked question how formatting of cell using office.js in excel. , have same question again time ms-word possible can formatted text there in table cell created in word application. though able selected text html gives me styles needed office.context.document.getselecteddataasync(office.coerciontype.html, function (result) { if (result.status === office.asyncresultstatus.succeeded) { shownotification('the selected text is:', '"' + result.value + '"'); } else { shownotification('error:', result.error.message); } }); i want current cell formatted text thank you! excellent question pradeep. in order cell formatting need use currently-in-preview word 1.3 apis. can see how try 1.3 apis here . (note need use preview office.js cdn disclosed on page!) check of what's new here . now, once ready try 1.3, following code give cell formatti...

colorbar change text value matplotlib -

Image
given following code x = np.random.random((50))*2 -1 y = np.random.random((50)) plt.scatter(x,y,c=x**3,cmap='viridis') cb = plt.colorbar() #i want smarter (& working) version of cb.ax.set_yticklabels( [str(np.cbrt(eval(i.get_text()))) in cb.ax.get_yticklabels()] ) i want emphasize differences on small scales using x**3 set color in scatterplot, display value of x (not x**3 in shown plot) on colorbar. this believe can done changing labels using inverse function (here cube-root). problem being matplotlib typically chooses round values, while not, in general, choose such values. you can using funcformatter matplotlib.ticker module. for example: import numpy np import matplotlib.pyplot plt import matplotlib.ticker ticker x = np.random.random((50))*2 -1 y = np.random.random((50)) plt.scatter(x,y,c=x**3,cmap='viridis',vmin=-1,vmax=1) cb = plt.colorbar() def label_cbrt(x,pos): return "{:4.2f}".format(np.cbrt(x)) cb....

Instancing a CGAL::Transformation of type Reflection -

i new cgal , i'm trying instantiate 2d reflection . having defined typedef cgal::aff_transformation_2<k> transformation , works others transformations , : transformation rational_rotate(cgal::rotation, 1, 100); //ok transformation translate(cgal::translation, vector_2(-2, 0));//ok i have error message when trying this: cgal::line_2<cgal::cartesian<double>> liner(a,b); transformation reflection(cgal::reflection, liner); i've tried many kernels , i'm not sure problem in direction. any hint appreciated. an exemple of answer (no waranty): transformation getreflection(line_2 droite) { if( droite.is_degenerate() ) std::cout<< "droite dégénérée, tester avant l'appel de la fonction ..."<< std::endl; if( droite.is_vertical() ) { double xd = - droite.c()/droite.b(); return transformation(-1, 0, 2*xd, 0, 1, 0, 1.0); } else { double x = droite.x_at_y(0); ...

reading cdata with binary data in xml by java -

i have xml coming response of soap web service. xml following-- <![cdata[<?xml version="1.0" encoding="utf-8"?><pro_code>abce096</pro_code> <pdf_stream>jvberi0xljqkjeljz9mkmsawig9iajw8l0jhc2vgb250l1rpbwvzlvjvbwful1r5cguvrm9udc9f&#13;</pdf_stream>]]> by using following have picked pro_code xpath.compile("//illustrations/product_code/text()").evaluate(doc, xpathconstants.nodeset)).... but, pdf_stream bytestream. how can read , convert pdf? the content of pdf encoded in base64 . can decode using base64.getdecoder().decode(string) if use java 8. you can find more details base64 decoder here . if don't use java 8, can still use base64 apache commons codec . nb: have trailing html entity (&#13) need remove first