Posts

Showing posts from February, 2014

arrays - find a list of integers for a checksum -

i need list of n positive integers l has properties: for each possible subset s of l , if sum items of s , sum not in l for each possible subset s of l , if sum items of s , sum unique (each subset can identified sum) working example 1: n = 4 l = [1, 5, 7, 9] check: 1+5 = 6 ok 5+7 = 12 ok 7+9 = 16 ok 9+1 = 10 ok 1+7 = 8 ok 5+9 = 14 ok 1+5+7 = 13 ok 5+7+9 = 21 ok 1+5+9 = 15 ok 1+7+9 = 17 ok 1+5+7+9 = 22 ok sums unique -> l ok n = 4 as easy construct sequence, suggest using power series , e.g. 1, 2, 4, 8, ..., 2**k, ... 1, 3, 9, 27, ..., 3**k, ... 1, 4, 16, 64, ..., 4**k, ... ... 1, n, n**2, n**3,..., n**k, ... n >= 2 take, instance, 2 : neither power of 2 sum of other 2 powers; given sum (number) can find out subset converting sum binary representation: 23 = 10111 (binary) = 2**0 + 2**1 + 2**2 + 2**4 = 1 + 2 + 4 + 16 in general case, simple greedy algorithm do: given sum subtract largest item less or equal sum ;

.htaccess - Too many redirects on mobile devices (iOS, android) -

i'am trying understand while now, why rewrite rules in .htaccess file give me error. happens on mobile devices (ios , android), works fine on desktop browsers. error many redirects. i'm trying 301 redirect http traffic https. here code: <ifmodule mod_rewrite.c> rewriteengine on rewritebase / rewritecond %{http_host} ^(www\.)?example\.com$ [nc] rewritecond %{https} !on$ [or] rewritecond %{http_host} !^www\..+$ [nc] rewriterule ^(.*)$ https://www.example.com%{request_uri} [r=301,l,ne] rewriterule ^(.*/)?\.(git|svn|hg|bzr)+ - [r=404,l] rewritecond %{request_filename} -f [or] rewritecond %{request_filename} -s [or] rewritecond %{request_filename} -l [or] rewritecond %{request_filename} -d rewriterule ^.*$ - [nc,l,qsa] rewriterule ^(.*)$ index.php [nc,l,qsa] any appreciated :) try changing rewritecond %{https} !on$ [or] rewritecond %{https} off [or]

angularjs - Unit testing a recursive method that calls a promise-returning function -

below simplified version of code trying test: simple queue periodically emptied. each number in queue, http post made send (in example fictional) api address. if post successful, number shifted off queue , next number considered. class queue { queue: array<number>; processingqueue: boolean; constructor(public $http: angular.ihttpservice) { this.queue = new array<number>(); this.processingqueue = false; } startqueueprocessor() { this.processingqueue = false; setinterval(() => { if (!this.processingqueue) this.processqueue(); }, 1000); } postnumber(number: number): angular.ihttppromise<{}> { return this.$http.post('http://mydummyurl.com/givemeanumber', number); } processqueue(): void { this.processingqueue = true; // processing queue, make sure setinterval not trigger processing run if (this.queue.length !== 0) { // there

javascript - next() is not a function error Node.js -

var express = require('express'); var app = express(); var middleware = { requireauthentication: function(req, res, next){ console.log("private route hit"); next(); } }; app.use(middleware.requireauthentication()); app.get('/about', function(req, res){ res.send('you clicked on about!'); } ); var projectdir = __dirname + '/public'; app.use(express.static(projectdir)); app.listen(3000), function(){ console.log('static service started'); }; i error (when trying run server) next() not function. i've been following tutorial on nodejs , works fine them. issue having here? this line: app.use(middleware.requireauthentication()); calls method , passes return value app.use . you're not calling arguments, naturally next parameter undefined. get rid of () you're passing function, not result, app.use : app.use(middleware.requireauthentication); // no () here --

ios - printing NSURLRequest body/query always prints null -

i'm making web requests using afnetworking. subclassed nsurlprotocol , method swizzled override default nsurlsessionconfiguration , add protocol class intercept web requests. when caninit called try print request data, want body , query prints null both. know requests being correctly intercepted don't have body/query data. know why is? how go getting body data? so after doing research found apple docs nsurlrequests body , bodystream: the receiver have either http body or http body stream, 1 may set request. http body stream preserved when copying nsurlrequest object, lost when request archived using nscoding protocol. so, after checking httpbodystream found actual body being stored. had copy input stream, convert data, convert string , print. here's reference on how did that: how convert nsinputstream nsstring or how read nsinputstream

ios - Generic Swift struct: Segmentation fault: 11 -

i trying implement struct generic type conforms hashable protocol. can me understand why getting "segmentation fault: 11" error following code. i appreciate insights regarding this. struct pmf<element: hashable> { typealias distribution = [element : float] fileprivate var normalized = false fileprivate var distribution:[element : float] = [ : ] { didset { self.normalized = false } } } extension pmf { init(values: [element], withprobs probs: [float]) { pair in zip(values, probs) { self.distribution[pair.0] = pair.1 } } var probdist: distribution { mutating { if !normalized { self.normalize() } return self.distribution } } subscript(value: element) -> float? { mutating { if !normalized { self.normalize() } return self.distribution[value]

angularjs - Result not Displayed with $Scope -

here simple html angular js controller <!doctype html> <html data-ng-app=""> <head> <title></title> </head> <body> //applied controller interacting view <div data-ng-controller="simplecontroller"> <h3>adding simple controller</h3> <ul> //binded data-ng-repeat <li data-ng-repeat="cust in customers"> {{cust.name +' '+ cust.city}} </li> </ul> </div> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"></script> <script> function simplecontroller($scope) { $scope.customers = [ {name: 'john smith', city: 'pheonix'}, {name: 'alan david', c

angularjs - How can I handle isDirty in a component? -

i'm using angular 1.5 , creating custom drop-down. there no elements use ngmodel involved. want able have form know if component dirty, pristine, etc. thinking i'd use ngmodel, directive. however, since there no linking function in component, i'm not sure how this. possible? let's component template this: <div>{{model.value}}</div> my code this: angular.component('mything', { bindings: { model: '=' }, require: '^ngmodel' }) .controller('mythingcontroller', () => { // stuff , things }); i made simple example instead of of code because i'm not sure begin using ngmodel within component. didn't think served have me code dump. if more code required, please feel free ask , i'll happily expand example. i created simple pen try work through this: http://codepen.io/yatrix/pen/rwejyv?editors=1011 you can use require: { ngmodel: '^ngmodel' } on component declaratio

html - Image does not appear on site when uploaded to host server -

when viewing website on local drive, works , appears intended, when of files uploaded godaddy, 1 of images not show up. tried deleting , reuploading file, won't appear on browser or device. advice? you might use wrong path. if image example.jpg , in folder images, write src="images/example.jpg" in img tag. easier , quicker. you can use other option have write this: <img src="http:\\localhost\site\images\example.jpg"/>

java - Tomcat reloading exploded war with spring-loaded -

Image
there's alot of questions on different forums [1] [2] [3] topic none seem provide definitive answer. i've tried different combinations suggested in various posts have yet succeed. my goal make compiled source code in standalone tomcat (8) reloadable - embedded tomcat reloads newly complied sources in e.g. spring-boot or grails. there few constraints need comply with: no grails or spring-boot available no maven or gradle available the tomcat should read exploded war file external location to keep things simple use simple jee app spring mvc poc before move on real deal. setup follows (for now): exploded war builds directory target/exploded tomcat setup default settings except context.xml where 2 lines regarding watchedresource removed. context not set reloadable="true" . the tomcat server run within intellij idea (2016.3) this: "exploded" folder points target described above. , "server" tab this: the server starts , app run

swift - UINavigationController acting funny after pushViewController UPDATE 2 -

Image
i'm having weird problem, have slide menu in app, unknown reason every time go 1 view using .pushviewcontroller instruction navigation controller acts funny , resets uibarbuttonitems. (they change original tintcolor, , badgevalue disappears). this methods i'm using in slide menu transition: func openviewcontrollerbasedonidentifier(_ stridentifier:string){ let destviewcontroller : uiviewcontroller = self.storyboard!.instantiateviewcontroller(withidentifier: stridentifier) let topviewcontroller : uiviewcontroller = self.navigationcontroller!.topviewcontroller! if (topviewcontroller.restorationidentifier! == destviewcontroller.restorationidentifier!){ print("same vc") } else { var numeroproductos = string(carrito.numprod) self.navigationcontroller!.pushviewcontroller(destviewcontroller, animated: true) } } and func slidemenuitemselectedatindex(_ index: int32) { let topviewcontroller: uiviewcontroller = sel

python - how to get a saved value in redis and use it again (django) -

i'm new redis. developing django project, wonder how set value in redis in 1 function in views.py , in function , use again. can me actual example? thank much do want use redis cache backend?it's simple.first install django-redis-cache in settings.py caches = { 'default': { 'backend': 'redis_cache.rediscache', 'location': 'server:6379', }, } django.core.cache import cache >>> cache.set('my_key', 'hello, world!', 30) >>> cache.get('my_key') 'hello, world!

c# - How do I generate swagger meta data file from Azure API App solution? -

i want generate swagger meta data, can generate client code. i want azure api app #1 consume other azure api app #2 . is possible generate metadata locally hosted azure api before publishing azure ? update : swagger.json generated after running api on machine. it's located in ...appdata\local\temp\webtoolsautorest\nameofsolution... there no need specify explicitly should generate meta data, doing it. it shouldn't matter if trying use swagger on local api service or in cloud. swagger looks @ endpoints , generates artifacts based on sees there. detailed information check out: https://docs.microsoft.com/en-us/azure/app-service-api/app-service-api-dotnet-get-started

r - ggplot2 - piechart - value labels in reverse order -

Image
i trying match labels pie chart ggplot2: code: values=c(59,4,4,11,26) labels=c("cata", "catb","catc","catd","cate") pos = cumsum(values)- values/2 graph <- data.frame(values, labels,pos) categoriesname="access" percent_str <- paste(round(graph$values / sum(graph$values) * 100,1), "%", sep="") values <- data.frame(val = graph$values, type = graph$labels, percent=percent_str, pos = graph$pos ) pie <- ggplot(values, aes(x = "", y = val, fill = type)) + geom_bar(width = 1,stat="identity") + geom_text(aes(x= "", y=pos, label = val), size=3) pie + coord_polar(theta = "y") output: i read these topics, without success: ggplot, facet, piechart: placing text in middle of pie chart slices r + ggplot2 => add labels on facet pie chart starting in ggplot2 2.2.0, can use position_stack vjust = .5 center labels in stacked bars char

amazon web services - Can't Delete Empty S3 Bucket -

i have s3 bucket 100% empty. versioning never enabled on bucket. however, still cannot remove bucket. have tried via console , cli tool. on console says "error" no error message. cli , api tells me: "an error occurred (bucketnotempty) when calling deletebucket operation: bucket tried delete not empty". have tried of following: aws s3 rb s3://<bucket_name> --force -> bucketnotempty aws s3 rm s3://<bucket_name> --recursive -> no output (because it's empty) aws s3api list-object-versions --bucket <bucket_name> -> no output (because versioning never enabled) aws s3api list-multipart-uploads --bucket <bucket_name> -> no outputs aws s3api list-objects --delimiter=/ --prefix= --bucket <bucket_name> -> no output (because it's empty) it has no dependencies (it's not used cloudfront or else i'm aware of). the bucket has been empty approximately 5 days. i able delete similar bucket same

android - Disable toolbar scrolling when pressing on it -

i tried find same question didn't know search for. if else finds simliar question, let me know! i've implemented toolbar design library follows: <android.support.design.widget.appbarlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="wrap_content" android:theme="@style/apptheme.appbaroverlay"> <include layout="@layout/toolbar" /> <android.support.design.widget.tablayout android:id="@+id/maintablayout" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="?attr/colorprimary" android:minheight="?attr/actionbarsize" android:theme="@style/themeoverlay.appcompat.dark.actionbar" app:tabgravity="fill" /> </android.support.design.widget.appbarlayout>

java - Why is the "i++" a dead code here in the below snippet? -

while coding eclipse, code i++ shown dead code. mean? why being dead code? public class scorecalculator{ public static void main(string[] args) { int scorecard[] = {70,102,198, 60}; string playerslist[] = {"mukesh","suresh","shardul","nandan"}; system.out.println(displayscore(scorecard, playerslist)); } public static string displayscore(int[] scores, string[] players){ for( int i=0; <= 3; i++){ if(scores[i]>100 && scores[i]<=200){ system.out.println("\n******players moved next level******"); return players[i] + "\n"; } else { system.out.println("\n******players in danger level******"); return players[i] + "\n"; } } return "\n"; } } in possible flows exit loop before performing i

reporting services - Selecting either one or ALL the values in a parameter in SSRS 2008 R2 -

i working on reporting project in ssrs. have parameter called ' customer '. values parameter populated sql query. want restrict parameter such user should able select either one customer or all customers . there should not possibilities select either 2 or 3 customers. have option in parameter list called all customers ordered sits @ top of parameter list. if manually adding parameter options, ordering easy. if data-driven can union all in parameter value dataset correct order: select <unique value matches customer id type> value ,'all customers' label ,1 sortorder union select customerid value ,customername label ,2 sortorder customertable order sortorder ,label and in query need add logic handles new all value: select columns tables customerid = @customer or @customer = <unique value matches customer id type>

c++ - Where do I see what parts of LLVM a library contain? -

i know how see libraries component correponds command: llvm-config --libs core now, suppose linker error , wants include library resolve it. say, linker can't resolve symbol a . how i: 1) find library contains specific symbol, e.g. llvmcore.lib. 2) contents of libraries see symbols defines? i don't understand how reading documentation. as have discovered proper llvm-way using llvm-config indicating components intend link against or use, e.g. llvm-config --cxxflags --ldflags --system-libs --libs core other common non-llvm specific methods can use find symbol: on win platform (use vs native tools cmd or equivalent environment-set one): for %f in (*.lib) (dumpbin.exe /symbols %f | findstr /c:"your_symbol") if can't deal findstr's limitations gnu grep might better choice. if have unix tools installed , in path can use for %f in (*.lib) (nm -gc %f | findstr /c:"your_symbol") as baddger964 suggests. on unix syste

c++ - how to write the definition for this method i am getting error -

thanks in advance trying write definition method customer* getmemberfromid(std::string); this definition wrote getting error saying [error] 'customer' in 'class store' not name type store:: customer* getmemberfromid(std::string id) { for(int = 0; < members.size(); i++) { customer* c = members.at(i); if(c->getaccountid() == id) { return c; } } return null; } try customer* store::getmemberfromid(std::string const& id) hard full minimal, complete, , verifiable example (which should provide), i'm guess getmemberfromid member function of store , customer not member of store , , got confused naming rules. note swapped (std::string id) (std::string const& id) avoid copy of string, when didn't need it. then use standard algorithm find_if : customer* store::getmemberfromid(std::string const& id) { auto foundpos = std::find_if(members.begin(),

unity3d - Random object in Unity -

i want make endless runner game. have 2 objects, 1 on top , 1 on bottom. players have jump between or squat on objects. made script creates objects, 2 object created on same position, players can't anything. how solve that? can check other objects on axis x, not collider? basically asking give our level generator , game controller source code! have write 1 game. not because don't want give code because each game must have own. for starters can: split game area matrix have array of sort, each cell can have game object or empty. game objects can have own local position within cell. 1 cell can't contain 2 game objects. have level generator tells game controller should spawn new objects. should implement in level generator prevent overlaps. look @ psudo code: void fixedupdate() { if (player.transform.position.x + half_of_screen_width_plus_margin > nextx) { spawn(tmp[i].prefab, nextx); nextx += tmp[i].distancetonext; i+

php - WooCommerce plugin for easy checkout for schools -

does know of plugin allow list of products on single page , user needs select product in checkbox add cart before proceeding checkout? i use school stationary user can add multiple products grades given list buy. thanks you can use this plugin adding multiple products cart @ once in woocommerce purpose. hope plugin useful you.

php - Update MySQL from CSV file every day (load data is not allowed in stored procedures) -

i work in website (php language) , want update table every day csv file have write : load data local infile 'c:/wamp/www/mywebsite/data/m5.csv' table m4 fields terminated "," lines terminated "\n" ignore 1 lines (col1,col2,col3,col4,col5) and have create event in phpmyadmin when whant valid event, have error : #1314 load data not allowed in stored procedures how can update table every day csv file ? thank you in reference question: importing csv data using php/mysql the solution problem might this <?php $query = <<<eof load data infile 'c:/wamp/www/mywebsite/data/m5.csv' table m4 fields terminated ',' optionally enclosed '"' lines terminated '\n' ignore 1 lines (col1,col2,col3,col4,col5) eof; $db->query($query); ?> however, if interested in php script same thing try this <?php $dbhost = ""; $dbname = ""; $dbusername =

javascript - Can PHP echo an element into Android? -

while using html, javascript, , php, can make httpget request mysql database , echo information onto html page, including actual elements such buttons , tables. echo "<button type='button'>$name</button>"; or echo "<table><tr><td>$name</td><td>$age</td></tr></table>"; can php echo elements after httpget request onto android gui?

python - PyQt5: Want to start a specific subprocess with a button click -

Image
one day old in terms of experience pyqt, followed sample code here this, clueless how separate start download part start gui part, can instead start when press ok (startbtn)button. also, know command doesn't give error, know works. appreciated! from pyqt5.qtwidgets import qapplication, qwidget, qmainwindow, qaction, qapp, qdesktopwidget, qpushbutton, qhboxlayout, qvboxlayout, qtextedit pyqt5.qtgui import qicon pyqt5.qtcore import qthread, qprocess import sys class gui(qprocess): def __init__(self): super().__init__() # create instance variable here (of type qtextedit) startbtn = qpushbutton('ok') stopbtn = qpushbutton('cancel') #startbtn.clicked.connect() stopbtn.clicked.connect(qapp.exit) self.hbox = qhboxlayout() self.hbox.addstretch(1) self.hbox.addwidget(startbtn) self.hbox.addwidget(stopbtn) self.edit = qtextedit() self.edit.setwindowtitle("qte

regex - Regular expressions wildcard -

it's day 001 me on regular expressions sorry if bit stupid, i've done research can't find answer question; because i'm searching wrong thing. i have huge .cvs file , want delete entries containing term: subscribe newsletter: no the entries not uniform - mean -- here subscribe newsletter: no -- i've thinned .csv right down using regular expressions (i think? i'm using find , replace in sublime 3) delete elements can , i'm there. i'm looking way use wildcard ignore part don't know; this: ^.*-- **wild-card** subscribe newsletter: no.*\n if can recommend can research how fabulous, said might off here it's literally day 1 if point me in right direction great! 1st issue: dot . doesn't match newlines unless use dotall flag - need span multiple lines. you need negative ahead (?!--) assert dots don't match accross segment delimiters -- . try this: (?s)^--((?!--).)*?subscribe newslett

android - ClientCursorAdapter.getFilter()' on a null object reference -

i'm using cursoradapter , listview display list of songs , filter in searchview problem when tap searchview icon i've got error , pointing error code adapter.getfilter().filter(newtext); here code under oncreateoptionsmenu() searchview searchview = (searchview) item.getactionview(); searchview.setqueryhint("search title/artist"); searchview.setonquerytextlistener(new searchview.onquerytextlistener() { @override public boolean onquerytextsubmit(string query) { return false; } @override public boolean onquerytextchange(string newtext) { adapter.getfilter().filter(newtext); return false; } }); calling cursoradapter cursor res = db.query("songs",null,null,null,null,null,"title"); clientcursoradapter adapter = new clientcursoradapter(mainactivity.this,res, cursoradapter.flag_register_content_observer); //// //// lv.setadapter(adapter); row_layout.xml <?x

java - azure iothub device status -

Image
getconnectionstate() connected /disconnected depending on device .if sending message should see connected , if not sending should disconnected .but each time run below java program getting status disconnected irrespective of device sending messages or not registrymanager registrymanager = registrymanager.createfromconnectionstring(connectionstring); system.out.println(registrymanager.getdevices(new integer(1000))); while(true){ arraylist<device> deviceslist=registrymanager.getdevices(new integer(1000)); for(device device:deviceslist) { /*system.out.println(device.getdeviceid()); system.out.println(device.getprimarykey()); system.out.println(device.getsecondarykey());*/ system.out.println(device.getdeviceid()); system.out.println(device.getconnectionstate()); /*system.out.println(device.getconnectionstateupdatedtime()); system.out.println(device.getlastactivitytime()); system.out.println(devi

android - start listening @node but do not load data until data added -

i'm using firebase database store data. know how use firebase database. in project i've activity displays list of notices faculties students , clicking on list item open activity chat room. in activity student can ask question related given notice. now, in first list activity i've added on text view displays total number of chat messages particular notice. works when load data database initially. want change number of chat messages dynamically. so, need listnen @ chat_cnt node update value of message_cnt text view , problem is big list can not use child_added each , every notice item , if use value_event listener load data unnecessarily @ start. the code little bit big cannot post here. i've described problem. any answer appreciated, thanks. sorry english :)

hadoop - How to allocate physical resources for a big data cluster? -

i have 3 servers , want deploy spark standalone cluster or spark on yarn cluster on servers. have questions how allocate physical resources big data cluster. example, want know whether can deploy spark master process , spark worker process on same node. why? server details: cpu cores: 24 memory: 128gb i need help. thanks. of course can, put host master in slaves. on test server have such configuration, master machine worker node , there 1 worker-only node. ok however aware, worker fail , cause major problem (i.e. system restart), have problem, because master afected. edit: more info after question edit :) if using yarn (as suggested), can use dynamic resource allocation. here slides , here article mapr. long topic how configure memory given case, think these resources give knowledge it btw. if have intalled hadoop cluster, maybe try yarn mode ;) it's out of topic of question

search - Solr 5.5.0 error when overriding ClassicSimilarityFactory -

context:: getting error in solr-core 5.5.0 when overriding classicsimilarityfactory. have pasted logs , class. overriding classicsimilarityfactory throws error- context:: getting error in solr-core 5.5.0 when overriding classicsimilarityfactory. have pasted logs , class. overriding classicsimilarityfactory throws error- package com.others; import org.apache.lucene.analysis.payloads.payloadhelper; import org.apache.lucene.search.similarities.classicsimilarity; import org.apache.lucene.search.similarities.similarity; import org.apache.lucene.util.bytesref; import org.apache.solr.common.params.solrparams; import org.apache.solr.search.similarities.classicsimilarityfactory; import org.slf4j.logger; import org.slf4j.loggerfactory; public class payloadsimilarityfactory extends classicsimilarityfactory { @override public void init(solrparams params) { super.init(params); } @override public similarity getsimilarity() { return new payloadsimilarity(); } } class payl

sql - How to get lastest result for each of distinct list? -

i have postgresql table. i can distinct products , brands: select distinct product, brand list and after in django latest price: for x in query: select price list product = x.product , brand = x.brand order ... limit 1 how can of 1 query? using window functions : select distinct product, brand, first_value(price) on (partition product, brand order ...) latest_price list

java - Can I call a C function from a C program called by JNI? -

i have done research jni,and think understand how works, i've been trying call c function c func called jni. i have 2 .c , helloworld , helloworld2, , java program call helloworld. helloworld @ same time calls function defined in hellowold2 causes error when executing. java: symbol lookup error: /home/hduser/desktop/final2/libhello.so: undefined symbol: helloworld assuming have 2 files: helloworld.c helloworld2.c and helloworld supposed call helloworld2 can: put both same shared lib put both separate shared lib , make sure helloworld linked helloworld2 make sure shared libraries visible setting ld_library_path. you can find jni samples here: http://jnicookbook.owsiak.org/

swift - Want to understand a relation -

i beginner learning swift 3 in xcode 8 , building basic app called "eggtimer". code written below , don't understand how timerlabel.text linked timer didn't set connection between them. next star //* can write } else { timer.invalidate() , labeltimer.text nicely stops decreasing, how can happen? selector in timer properties mean? sorry english , answers. class viewcontroller: uiviewcontroller { var timer = timer() var time = 210 func decreasetimer() { if time > 0 { time -= 1 timerlabel.text = string(time) } else { //* timerlabel.text = string(time) } } @iboutlet var timerlabel: uilabel! @ibaction func timerstarter(_ sender: anyobject) { timer = timer.scheduledtimer(timeinterval: 1, target: self, selector: #selector(viewcontroller.processtimer), userinfo: nil, repeats: true) } } lets start bottom: selector specifies method should

c# - translate asp.net dynamic data web application into another language? -

Image
as title told, had asp.net dynamic web application & want translate labels (which fields come database)in asp.net dynamic data web pages labels languages? suppose have table called product has field called "product name=> without space" appears in dynamic web page "product name" want show label language? best solution dynamically?

bash parameter expansion not working as expected -

the below example 1 of many web pages consulted. cannot "remove beginning till marker" or "remove marker till end" work, perhaps wrong how specify pattern? final goal remove line of text, given marker till end. solution sed might found 1 annoys me. version=0.11.3-issue#18.6a0b43d.123 # 1 works expected echo ${version/\#/} 0.11.3-issue18.6a0b43d.123 # others don't, return input unchanged # trying remove 'i' syntax straight echo ${version%i} 0.11.3-issue#18.6a0b43d.123 echo ${version%\i} 0.11.3-issue#18.6a0b43d.123 ${version%%\i} 0.11.3-issue#18.6a0b43d.123 echo ${version%%i} 0.11.3-issue#18.6a0b43d.123 the problem thing after # or % isn't marker, pattern. echo ${version%i*} add asterisks match rest of value.

Is it possible to execute a service in Android only if I have an particular app that is open? -

is there way execute service (start or stop) when particular app open? case have "bubble" service (similar facebook) , want appear when open game minecraft pe. , when change or open application want put invisible bubble. possible? use code. public class checkrunningapplicationreceiver extends broadcastreceiver { @override public void onreceive(context acontext, intent anintent) { try { activitymanager = (activitymanager) acontext .getsystemservice(context.activity_service); list<activitymanager.runningtaskinfo> alltasks = .getrunningtasks(1); (activitymanager.runningtaskinfo atask : alltasks) { if (atask.topactivity.getclassname().equals("com.android.phone.incallscreen") || atask.topactivity.getclassname().equals("com.android.contacts.dialtactsactivity")) { toa

java - why we cannot rethrow InterruptedException in the Runnable? -

from article below , says " @ least, whenever catch interruptedexception , don't rethrow it, reinterrupt current thread before returning.". my question why don't rethrow interruptedexception or cannot rethrow runnable ? http://www.ibm.com/developerworks/java/library/j-jtp05236/index.html you can rethrow interruptedexception , checked exception, if (1) have outer catch block deal or (2) current method allowed throw given exception type, e.g. void read() throws ioexception . a method overrides runnable.run() not allowed throw exceptions, can rethrow interruptedexception in first case: @override public void run() { try { // logic try { // logic throws interruptedexception } catch (interruptedexception e) { // here can either rethrow "e" // dealt in outer catch block or // reinterrupt current thread throw e; } } catch (interruptedexception e)

spring - Calling refresh_token doesn't refresh resource ids in token -

flow this: we have oauth app registered specific resource ids listed, app has access those after time there need add resource id, extending features of our client app from time time client app doing refreshing of token, either due errors or access_token expiration. using check_token on new access_token gives old set of resource ids. seems taken cache or old token itself. question: shouldn't refresh token refresh resource ids? againts oauth rfc( couldnt find particular case in )? we ofcourse revoke tokens oauth app, require our users log in again want avoid. im not sure if related spring cloud security or rather oauth itself. c this answers assumes resource identifiers equivalent oauth2 describes scopes description purpose seems similar - constrain reach of access token. when issuing access token refresh request specification states can include scope parameter, however: the scope of access request described section 3.3. requested scope must not incl

ionic framework - Ion-slides with form inputs blocks page scrolling -

Image
i have few form inputs inside <ion-slide > can not scroll view fields in slide, prevents me scrolling inside slide. on device, when there ion-input, ion-list scrolling behaviour not work. there css issue labels overlapping (see img below)... using ionic v 1.3. <ion-view scroll="true"> <ion-nav-bar class="bar-light"> <ion-nav-buttons side="left"> <button class="button button-positive button-clear no-animation" ng-click="startapp()" ng-show="!slideindex"> skip </button> <button class="button button-positive button-clear no-animation" ng-click="previous()" ng-show="slideindex > 0"> previous </button> </ion-nav-buttons> <ion-nav-buttons side="right"

javascript - Add change event on hidden checkbox -

i'm trying catch change event, or @ least click event on checkbox. i've read when "visibility : hidden" or "display:none", event not fired. add eventlistener label seems not working too. can't understand how make work. document.addeventlistener("domcontentloaded", function() { var gamecount = document.getelementsbyclassname("innercount")[0]; var checklabel = document.queryselector("input[type=checkbox] + label"); checklabel.addeventlistener("onclick", function() { if (checklabel.checked) { gamecount.innerhtml = "--"; console.log("turnon"); } else { gamecount.innerhtml = ""; console.log("turnoff"); } }) }); .checkbox > input[type=checkbox] { visibility: hidden; } .checkbox { display: inline-block; position: relative; width: 60px; height: 30px; border: 2px solid #424242; } .checkbox >

excel - Right(text;5) is not the same as a 5 character text -

i have match function not working. boiled down point can't find appropriate match since values not same, apparently. i have value 21337 in cell d59. in cell s59 have function: right($d59;5), displays 21337. when enter in cell: =d59=s59 return false. i use right() function because cells in column d contain concatenated values, last 5 values of importance. example d60 contains 21337 - 21448, 21448 value want match. anyone has clue on might problem? with no formatting you'll see 21337 right aligned - showing number , treated number excel. on other hand right($d59;5) show number left aligned, indicating returned value being treated text excel. if try right($d59;5)*1 excel implicitly convert value number (due calculation performed) , both values equal. to explicit conversion, brian has pointed out, use value(right($d59;5)) .

javascript - Responsive voice jquery plugin not working inside loop -

im trying make responsive voice read out each sentences , there must 1 minute gap between each readouts. function read(){ responsivevoice.speak('قلم','arabic female'); } var = [1,2,3]; $(a).each( function(){ settimeout(function(){ read(); }, 1000); }); currently plays once , in other 2 loops getting error uncaught (in promise) domexception: play() request interrupted call pause(). i can't make read passed dynamically maybe problem used .each() method not correctly because $(a) try target selector not array. from jquery.each() doc : jquery.each( array, callback ) where array : type: array - array iterate over. callback : type: function( integer indexinarray, object value ) - function executed on every object. so, try this: $.each( a, function(){ settimeout(function(){ read(); }, 1000); }); hope you.

html - How to be sure that IE10/11/Edge do not use the "tile" icon for the address bar/tab icon? -

is there way force internet explorer , edge use particular favicon address bar/tab icon? in general i'm using different design (with wider margin) "live tile" (or whatever microsoft calls them)... , reason these browsers keep choosing 1 of images (defined in browserconfig.xml or 1 of apple icons... not sure) use in address bar. this not want, because 1 in address bar/tab icon needs have smaller margin , transparent background. is there safe , consistent method "use icon address/tab bar icon", , "use icon tile or whatever?" edit: acceptable workaround if there way specify images background/margin used "tile" others favicon(s) only? don't understand logic ie/edge use choose icon display. the favicon package generated realfavicongenerator behaves way want: in tabs, edge picks classic "desktop" icon, while uses tile icons sites added home screen. more precisely, edge using classic 32x32 png icon tab ic

android - How to keep Activity alive when its parent activity gets destroyed -

i launch activity activity b . launch , b gets destroyed. result gets displayed momentarily , gets destroyed . how keep alive after b destroyed. how launch b. intent intent = new intent(); intent.setflags(intent.flag_activity_clear_top | intent.flag_activity_single_top); intent.setclass(b.this, a.class); intent.putextra(key, val); startactivity(intent); i have mentioned launchmode activity in manifest file 'singletask'. please me how achieve . actvity b destroyed due flag intent.flag_activity_clear_top , doesnt affect activity life cycle. meaning if activity being destroyed might error in own life cycle method not chained activity b

php - how to get missed items order number from mysqldb tables -

jquery easyui data grid dynamically adding row span how pass parameters dynamically please see attached screen getting data in easy ui grid s37fw result image i want this zh9na.png reference image $rs = mysql_query("select count(*) nbs_item"); $row = mysql_fetch_row($rs); $result["total"] = $row[0]; $rs = mysql_query("select * nbs_item limit $offset,$rows"); $rows = array(); while($row = mysql_fetch_array($rs)) { array_push($rows, $row); } $result["rows"] = $rows; echo json_encode($result);

javascript - Swiper slider - weird behaviour -

i have 2 swiper sliders in page. 1 shown , other 1 first hidden , later shown on click when whole div contains other slider shown. first 1 works , when show other behaves weird. first shows 1 image in slider, although have set both 5 images in slider. when try inspect wrong in console, slider gets 5 images should have. other works can't figure out why behaving that. how initialize them: $(document).ready(function () { //initialize swiper when document ready var myswiper = new swiper ('.drawer', { // optional parameters direction: 'horizontal', loop: false, nextbutton: '.next', prevbutton: '.previous', slidesperview: 5, loopedslides: 1, simulatetouch: false }) var myswiper = new swiper ('.itemdetail', { // optional parameters direction: 'horizontal', loop: false, nextbutton: '.next', prevbutton: '.previous', slides

java - Term Aggregation ElasticSearch -

i want group status field fetching elasticsearch through java api. below code searchrequest request = requests.searchrequest(constantsvalue.indexname) .types(constantsvalue._type) .source("{\"_source\" : [\"status\"],\"aggs\": {\"group_by_status\": {\"terms\": {\"field\": \"status\"}}}}"); searchresponse response = client.search(request).actionget(); (searchhit hit : response.gethits()) { system.out.println("value :"+hit.sourceasstring()); } but shows status value in result. output getting is value :{"status":"success"} value :{"status":"success"} value :{"status":"error"} value :{"status":"error"} value :{"status":"error"} value :{"status":"waiting"} value :{"status":"waiting"

.net - IXXXOAuth2AuthenticationProvider Authenticated called but User is always null -

good day. im having trouble oauth. have code users works , others doesn't. me depends on browser, chrome+firefox works, while ie edge doesn't - no errors, no exceptions. this piece of code: appbuilder.usefacebookauthentication(new facebookauthenticationoptions { appid = cfgreader.facebookappid, appsecret = cfgreader.facebookappsecret, scope = { "email" }, signinasauthenticationtype = constantstrings.authorizationcookiename, backchannelhttphandler = new facebookbackchannelhandler(), userinformationendpoint = "https://graph.facebook.com/v2.4/me?fields=id,name,email", provider = new facebookauthenticationprovider { onauthenticated = (context) => { context.identity.addclaim(new system.security.claims.claim("facebookaccesstoken", contex