Posts

Showing posts from July, 2014

android - Facebook App Invite not show notification? -

i have integrate facebook app invite app , invitation has been sent recipient there no notification appear. i tested new account , uninstall app device no luck here (my app on facebook in live mode , have unique namspace). are there can me solve problem notification app invite, please? thanks in advance.

asp.net mvc - Is there a way to search users of application via userId while using Identity? -

im curious if there technique search users of application using userid. im using asp.net mvc authentication enabled.i want same thing stackoveflow when visit personal page example stackoverflow_.com/users/7416543/username im not sure here seems have userscontroller userid. can scratch building own models,controllers , views no authentication enabled there way incorporate identityusers(applicationusers class). seems have own system thats obtrusive when trying pull data out of tables aspnetusers.its been giving me hard time.im curious if have make usermodel , link userid aspnetusers foreign key on new model. if knows way accomplish great. use usermanager<applicationuser> : var users = this.usermanager.users .where(p => p.userid == "yourvalue") .tolist();

java - How to add resource folder in gradle and other resource folder -

i have project structure in below manner src---- | pdstat--------------------------------------- resources/test.properties | | b c d resource[having xsd file] i need create jar file include everything.my problem after making jar file doesn't include resource folder project.jar | -----------------psdstat | ------------------test.properties[without resources folder] and not including resources[xsd file] folder inside medstat. ant project , converting gradle.i can't change structure of project please suggest me on this. i did in below way , working fine task copynonjavafile<< { copy{ from("s

C easy code with filling array -

i'm trying fill array file called data.txt . don't know what's wrong code. segmentation fault: 11 error. #include <stdio.h> #include <stdlib.h> void input(int arr[]){ file* f; int x, i=0; f= fopen("data.txt","r"); while (arr[i] != eof){ fscanf(f,"%d",&x); arr[i] = x; i++; } fclose(f); } int main(){ int arr[50]; input(&arr[50]); printf("%d", arr[0]); } you reading number x (which copying arr[i] ) , comparing arr[i+1] eof . not how has done. try this while (fscanf(f, "%d", &arr[i]) == 1) i++; but violate many safety constraints. better bound check , break if i greater limit, limit should passed function. another error how passing arguments input. pass input(arr) instead of input(&arr[50]) . if want use & use input(&arr[0]) .

pyqt - Qt WebEngine capture network package -

i porting qt app webkit webengine. in webkit code, use qnetworkaccessmanager capture network packages. in webengine, document say: qt webengine not interact qnetworkaccessmanager so can't in webengine code. this webkit code: ...... reply = qnetworkaccessmanager.createrequest( manager, operation, req, data) def _on_replyfinish(): data = reply.peek(reply.bytesavailable()).data() cookies = manager.cookiejar().mozillacookies() self.resopnsehistroylist.append({ 'reply': reply, 'url': req.url().tostring(), 'host': req.url().host(), 'filename': req.url().filename(), 'body': data, 'code': reply.attribute(qnetworkrequest.httpstatuscodeattribute), 'request_header': get_headers(req), 'cookies': cookies, 'response_header': get_headers(reply), 'time': int(time.

java - spark-submit dependency resolution for spark-csv -

i doing small scala program converts csv parquet. using databricks spark-csv. here's build.sbt name: = "tst" version: = "1.0" scalaversion: = "2.10.5" librarydependencies++ = seq( "org.apache.spark" % % "spark-core" % "1.6.1" % "provided", "org.apache.spark" % % "spark-sql" % "1.6.1", "com.databricks" % "spark-csv_2.10" % "1.5.0", "org.apache.spark" % % "spark-hive" % "1.6.1", "org.apache.commons" % "commons-csv" % "1.1", "com.univocity" % "univocity-parsers" % "1.5.1", "org.slf4j" % "slf4j-api" % "1.7.5" % "provided", "org.scalatest" % % "scalatest" % "2.2.1" % "test", "com.novocode" % "junit-interface" % "0.9" % "test",

java - How do I clean only those files from destDir that are no longer in my source dir using ant-javac -

i have requirement want clean file in destdir no longer present in sourcedir. ex: assume have class: student.java , college.java in sourcedir. running ant task first time generated student.class , college.class. now, if delete student.java sourcedir , add class 'employee.java , run ant-javac task, see new file, 'employee.class' generated in destdir, old file i.e 'student.class' still there though 'student.java' no longer exists in sourcedir. requirement delete files destdir no longer in source dir. ps: know ant clean work clean destdir before compiling, due few limitations wrt application, cannot clean destdir before running javac bit unusual point out, typical use case clean destdir directory berfore compiling... may specific clean explicitly selecting resources no longer present in sources directory. may use selectors select resources delete. following snippet should clean destdir if run before javac task : <delete> <!--

javascript - HTML Form: Programmatically Disable Remaining Checked Boxes in HTML Form -

the js script below correctly disables remaining 2 checkboxes when select large checkbox , re-enables when unchecked. however, logic, i'd need code each specific case. instead of manually labeling each checked box specific id's , coding disabling logic each case, there way programmatically disable checked boxes not checked? html <div class="checkbox" id="sizes"> <label><input id="a" type="checkbox" name="large" value="1">large</label> <label><input id="b" type="checkbox" name="medium"value="1">medium</label> <label><input id="c" type="checkbox" name="small"value="1">small</label> </div> js $(document).ready(function(){ $('input[id=a]').change(function(){ if($(this).is(':checked')){ $('input[id=a]').attr(

opencart2.x - How can I add extra content section to my opencart by using module? -

recently i'm facing problem opencart project. can add content opencart home page modifying home.tpl file but want add functionality admin -> extentions -> modules control sections. but new in opencart platform. can give me idea how can this? i in trouble few days i've found blog post describe briefly how create custom module opencart. here link. hope helpful too. http://www.php-dev-zone.com/2015/02/opencart-custom-module-development.html

amazon web services - AWS Lambda + queue length -

can use lambda send million mails via sendgrid, invoking lambda, asynchronously, million times, in quick succession? queued requests fire, eventually, assuming life of queue 6 hours.( link aws documentation ) any requests exceed concurrent limit queue until run (as long not exceed 6-hour limit). with such high volumes, should ask increase in limit of concurrent lambda functions. (and lawyer, because sending 1 million emails treated spam.)

c++ - aws-sdk-cpp: unresolved symbols -

i trying build simple example using aws sdk cpp. stumbled on building step. linking libaws-cpp-sdk-s3.so library, supposed have symbols source file. linker cannot find couple of them. source file is: #include <aws/core/aws.h> int main( int argc, char ** argv) { aws::sdkoptions options; aws::initapi(options); { // make sdk calls here. } aws::shutdownapi(options); return 0; } by using makefile: cc = g++ cflags = -g -c -wall -std=c++11 ldflags = -g executable = ex1 rm = rm -f sources = main.cpp objs = $(sources:.cpp=.o) all: $(executable) $(executable): main.o -laws-cpp-sdk-s3 $(cc) $(ldflags) main.o -o $@ main.o: main.cpp $(cc) $(cflags) $^ -o $@ .phony: clean clean: $(rm) $(executable) $(objs) $(sources:.cpp=.d) when run make, got error. why? built g++ -g main.o -o ex1 main.o: in function main': /home/username/workspace/ex1/src/main.cpp:6: undefined reference to aws::initapi(aws::sdkoptions const&)' /home

java - How to mock a Dao twice but being called with same Object? -

how mock dao being called in test method twice same object different internal state (of parameter). user user = new user(); user.setactivity(false); int prevactivity = accessdao.calculatework(user); user.setactivity(true); int predactivity = accessdao.calculatework(user); if(prevactivity==0) { //someaction } ... if(predactivity<15) { //someotheraction. } i cannot change code. there way in mockito following situation? you can use mockito's answers that. atomicinteger counter = new atomicinteger(); when(accessdao.calculatework(user)).thenanswer(new answer() { object answer(invocationonmock invocation) { if (counter.getandincrement() == 0) return somevalue; return anothervalue; } });

Searchable Option List (jQuery plugin), get selected value in php -

i'm using https://pbauerochse.github.io/searchable-option-list/examples.html plugin in website searchable dropdown. working don't know how value of selected items in php? try use below code return last selected value in dropdown: //echo count($_post['courses']); // return 1 select more 5 items if (!empty($_post['courses'])) { foreach ($_post['courses'] $select) { echo $coursename .= $select. " "; // last selected value displaying } } any 1 please help...

android - Can we Load JSON Data(Events) within Calendar? -

i able show calendar calendarview got stuck add events within it.can add events date in calendar through json data.if yes how can achieved? if not alternative solution?i got stuck in more 2 day.please calendar xml <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> <linearlayout android:layout_width="match_parent" android:layout_height="wrap_content" android:background="#2e353d" android:orientation="vertical"> <linearlayout android:layout_width="wrap_content" android:layout_height="40dp" android:layout_gravity="center_horizontal" android:orientation="horizo

javascript - How to get the value of an element by traversing to parent div -

i working on code have multiple div's generated dynamically. problem current hidden elements value on click of link particular div(e.g when click on add favorites should alert value of task_for hidden input). code working fine 1 div if there multiple divs alerts first element's value. here code- <div class="col-md-4 col-sm-4 col-xs-12"> <div class="search_box_list"> <a href="javascript:void(0)" class="add_fav"><i class="fa fa-star-o" aria-hidden="true"></i>add favourites</a> <div class="n_s">'+value.user_name+'</div><div class="n_e">'+value.user_email+'</div> <div class="n_n">'+value.user_phone+'</div> <div class="n_d">'+value.user_designation+'</div><div class="n_d"> <button type="button" id="assign" class="assign

android - Video capturing in nougat? -

i create video capturing app in nougat supported capturing video , video capture , save default camera folder result code -1. using following code. public void startrecordingvideo() { if (getpackagemanager().hassystemfeature(packagemanager.feature_camera_front)) { intent intent = new intent(mediastore.action_video_capture); file mediafile = new file( environment.getexternalstoragedirectory().getabsolutepath() + "/myvideo.mp4"); videouri = uri.fromfile(mediafile); //intent.putextra(mediastore.extra_output, videouri); startactivityforresult(intent, video_capture); } else { toast.maketext(this, "no camera on device", toast.length_long).show(); } } i putting onactivityresult code here if (requestcode == video_capture) { //if (resultcode == result_ok) { int width = 0, displaywidth = 0; //int height = 0, displayheight = 0; if (n

java - how to Add ArrayList in ArrayList -

i got problem when insert arraylist arraylist . my source code: import java.util.arraylist; public class ask { public static void main(string[] args) { arraylist<string> mentah = new arraylist<string>(); mentah.add("reza"); mentah.add("fata"); mentah.add("faldy"); mentah.add("helsan"); mentah.add("dimas"); mentah.add("mamun"); mentah.add("erik"); mentah.add("babeh"); mentah.add("tio"); mentah.add("mamang"); arraylist<arraylist<string>> result =new arraylist<arraylist<string>>(); result.add(mentah); } } how can create list based on data; like: [[data1,data2,data3],[data4,data5,data6],[data7,data8,data9,data10]] 10 div 3 3 (so 3 elements per sublist) 10 mod 3 1 (so last sublist has 4 ent

ios - What does this kind of declaration of parameters signal (swift)? -

Image
i beginner programmer , reading book on ios programming. what mean? takes parameter of cgsize, returns cgfloat, , uiimage? point of that? the following declaration more readable when that: func makeroundedrectanglemaker(_ sz:cgsize) -> ((cgfloat) -> uiimage?) { return nil } this function takes cgsize parameter method , returns closure kind of function type. here at link can read more it. also, can create typealias closures, function that: typealias customnameofclosure = (cgfloat) -> (uiimage?) func makeroundedrectanglemaker(_ sz:cgsize) -> customnameofclouse { return nil } hope helps :)

javascript - Use ng-value for radio button (angularjs) -

i'am new angularjs.. want make selection using radio button , save boolean value. when use ng-value , value save database null . code html. <label><input type="radio" ng-model="information" ng-value="true" name="maklumat">yes</label><br /> <label><input type="radio" ng-model="information" ng-value="false" name="maklumat">false</label> ng-value expects angularjs expression ngmodel be set when radio selected. and expressions being case-sensitive, if set ng-value="true" sets have in ng-model true , if have ng-value="true" , tries $scope.true doesn't find , ng-model gets set null . here's example. angular.module('radioexample', []) .controller('examplecontroller', ['$scope', function($scope) { $scope.true = "something totally different" $scope.specialvalue = {

html - Count to 100 using Javascript (in a div) -

this question has answer here: using innerhtml in loop not displaying set of json results 4 answers i wanne count 100 in div using javascript. why comes last number. here code: function test() { for (var x = 1; x < 101; x++) { document.getelementbyid("demo").innerhtml = (x + "<br />"); } }function leer() { document.getelementbyid("demo").innerhtml = "delete" } <html> <head> <script src="function.js"></script> </head> <body> <button type="button" onclick="test()">100</button> <button type="button" onclick="leer()">delete</button> <div id="demo"> </div> </body> </html> change document.getelementbyid("demo").innerhtml += (x

android - DividerItemDecoration is not applied when RecyclerView.Adapter.notifyItemInserted() is called -

i created custom divider recyclerview extending divideritemdecoration , applying calling additemdecoration on recyclerview. the recyclerview displays nicely untill data set changes , call notifyiteminserted . new item indeed inserted in recyclerview, displayed without custom divider (dividers other items in place). when scroll away newly inserted item , return - appears divider in place. edit code snippets: mrecyclerview.additemdecoration(new gapdivideritemdecoration(mcontext, linearlayoutmanager.vertical, 16)); my custom decorator (just adds space between recyclerview items provided in dp): public class gapdivideritemdecoration extends divideritemdecoration { private int mspaceinpixels; private int morientation; public gapdivideritemdecoration(context context, int orientation, float dp) { super(context, orientation); mspaceinpixels = dptopixels(dp); morientation = orientation; } private int dptopixels(float dp) { return (int) (dp * (((float) reso

sql server - Optimized query for a subquery in sql -

Image
i made query inventory of products follows: select b.productid, c.productname, (select case when sum(qty) null 0 else sum(qty) end invoicedetails productid = b.productid) sold, (select case when sum(qtyreceive) null 0 else sum(qtyreceive) end purchaseorderdetails productid = b.productid) stocks, ((select case when sum(qtyreceive) null 0 else sum(qtyreceive) end purchaseorderdetails productid = b.productid) - (select case when sum(qty) null 0 else sum(qty) end invoicedetails productid = b.productid)) remainingstock invoicedetails

angular - Angular2 how to call function on click event from another component -

i have 2 components : menu1and2 , menu3 here's menu1and2.component.html <form id="form1" runat="server" class="mainmenucontainer"> <div class="col-lg-12" id="menucontainer" *ngfor="let menu of usermenus"> <div class="panel panel-default col-lg-6 col-md-6 col-sm-12"> <div class="panel-heading">{{menu.title}}</div> <div class="panel-body"> <ul class="sub" style="display: block;" *ngfor="let submenu of menu.submenus"> <li><a href="#" (click)="getsubmenu(submenu.title)>{{submenu.title}}</a></li> </ul> </div> </div> </div> </form> it has click event calls function in menu3.component.ts retrieve datas should display in menu3.component.htm

cql - cassandra read performance is bad -

i have 1 table contains 8 millions rows data in cassandra3.10. when did query follow : select max(glass_id) poc.dream time < '2017-04-01 00:00:00+0000' allow filtering ; time property partition key of table , data size selected 70 millions. bad performance reading, took 2mins result. the primary key pk(time,glass_id); the part of tracing log showed follow: preparing statement [native-transport-requests-1] | 2017-04-07 14:58:55.598000 | 172.19.16.44 | 247 | 127.0.0.1 computing ranges query [native-transport-requests-1] | 2017-04-07 14:58:55.599000 | 172.19.16.44 | 771 | 127.0.0.1 range_slice message received /172.19.16.44 [messagingservice-incoming-/172.19.16.44] | 2017-04-07 14:58:55.599000 | 172.19.20.89 | 40 | 127.0.0.1 submitting range requests on 769 ranges concurrency of 1 (0.0 rows per range expected) [native-transport-requests-1] | 2017-04-07 14:58:55.599000 | 172.19.16.44 | 862 | 127.0.0.1 enqueuing request /17

javascript - Input type range not working on mobile devices when rotated -

i'm sitting on interesting problem: i have input type range, rotated 270deg using css transform property. on desktop browsers works fine on mobile devices, when try use range fader, screen scrolling instead. my first attempt fix using inputs focus , blur events disable scrolling function of page, these events don't seem triggered on mobile devices. has dealt problem? i made plunkr reproduce problem: https://embed.plnkr.co/frdjzqeb8zqqxjn7zs8u/ if not on mobile browser, enable device browser in top left of chrome inspector thanks edit: -webkit-appearance: slider-vertical; css property not option me because need css styles applied fader: <input type="range"> style not applies thumb when vertical edit: found solution works me, thepio proposed: var element = document.getelementbyid('range-input'); element.addeventlistener('touchmove', function(event){ //event.preventdefault(); }); interestingly works without event.

Java how to get file without full name -

i need file directory downloaded application in part of app, name of file creating dynamically. mean query_ , digits, fe. query_21212121212 , query_22412221 . need absolute file path, sth c:/dir/query_*. how that? if know path files reside, can create directorystream , files in it. see https://docs.oracle.com/javase/tutorial/essential/io/dirs.html#glob example (from link above): path dir = ...; try (directorystream<path> stream = files.newdirectorystream(dir, "*.{java,class,jar}")) { //<--- change glob //fit name pattern. (path entry: stream) { system.out.println(entry.getfilename()); } } catch (ioexception x) { // ioexception can never thrown iteration. // in snippet, can // thrown newdirectorystream. system.err.println(x); } about globs: https://docs.oracle.com/javase/tutorial/essential/io/fileops.html#glob so in case "query_*" . use speci

swift3 - App rejected due to crash on iPv6 -

recently app rejected due crash on ipv6 network. symbolicating crash report , unable crete crash on ipv6. apple says: app crashed on ipad running ios 10.3.1 connected ipv6 network when tapped on of new articles in news tab. occurred when app used: - on wi-fi have attached detailed crash logs troubleshoot issue symbolicated crash report : thread 0 name: dispatch queue: com.apple.main-thread thread 0 crashed: 0 libswiftcore.dylib 0x000000010083e2ac **swift_unknownretain (__hidden#18966_:380) 1 ******* 0x0000000100026d68 **newsdetailviewcontroller.getnewsdetail() -> ()** (newsdetailviewcontroller.swift:0) 2 ****** 0x0000000100025228 newsdetailviewcontroller.viewdidload() -> () (newsdetailviewcontroller.swift:0) method: func getnewsdetail(){ //checking reachability via apple reachability class let reachability: reachability = reachability.forinternetconnection() let networkstatus: i

html - set width to dropdown and adjust text within size as per width -

.option100{ width:100px !important; } <select id="fieldofinterestselect" name="fieldofinterest" class="form-control" required=""><option value="-1">select one</option><option value="4893" class="option100">actual(r)rrrrrrrrrrrrrrrr</option><option value="4891" class="option100">customerrrrrrrrrrrrrr</option><option value="4892" class="option100">daterrrrrrr</option><option value="4894" class="option100">forecast(r)rrrrrr</option></select> even though have fixed size of option , not applied. if text large option box expanded length of text. finally, got solution trying in various ways. best way trim text , ad full text on 'title'. [2] solution works, use ul li structure. have implemented , works fine me. solves problem of classes getting overriden default clas

python - Average data over time? -

i’d calculate average val1, val2 , signal value signal data in sample data @ 5 second intervals. in other words, using sample data included, i’d calculate average values between 1st data point (in case being) 01:45:18 through 01:45:22, 01:45:23 through 01:45:27, 01:45:28 through 01:45:32, , 01:45:33 through remainder of data. ideally, i’d store averaged information in variables such as: dec_average, ra_average, , n_average any suggestions or ideas on how achieve this? here’s code have far. import sys import os import matplotlib.pyplot plt matplotlib.dates import strpdate2num import numpy np import matplotlib.colors import matplotlib.cm sat_id,dec,ra,n = np.loadtxt("mydata.asc", usecols=(3,5,7,9), unpack=true) sample data: timestamp: 01:45:18 satid 02 val1 36 val2 188 signal 34 timestamp: 01:45:19 satid 02 val1 36 val2 188 signal 34 timestamp: 01:45:20 satid 02 val1 36 val2 188 signal 35 timestamp: 01:45:21 satid 02 val1 36 val2 188 signal 34 timestamp: 01:45

python - Excel 2016 opens differently from PyWin32 than normal opening -

i opening excel 2016 python using pywin32 package using following code import win32com.client win32 win32com.client import dispatch def openworkbook(filepath): excelobj = win32.gencache.ensuredispatch("excel.application") excelobj.displayalerts = false excelobj.visible = true wbkobj = excelobj.workbooks.open(filename=filepath) return(excelobj, wbkobj) when open workbooks in way, number of add-ins rely upon not initialized, though initialize when open excel in typical fashion. while understand can initialize them manually via filepaths, prefer open excel in such way of add-ins typically initialize included. thank you.

jQuery unexpected identifier error -

jquery code: $("#projecttype").change(function(){ alert($("#projecttype").val()); if($("#projecttype").val() == '16' || $("#projecttype").val() == '17' || $("#projecttype").val() == '18' || $("#projecttype").val() == '19' || $("#projecttype").val() == '20' ||response $("#projecttype").val() == '21' || $("#projecttype").val() == '22' || $("#projecttype").val() == '23' || $("#projecttype").val() == '24' || $("#projecttype").val() == '25' || $("#projecttype").val() == '26' || $("#projecttype").val() == '27'){ $("#bhkshow").hide(); alert('if'); } else{ $("#bhkshow").show(); } }) it's displaying unexpected identifier error in console. how can resolve error? try this:

javascript - Radar Chart (chart.js 2.5.0) Creating 2nd layer using database values -

i'm using chartjs create radar chart show scores of modules. working 1 module when enter 2nd module data placed in same dataset causing labels double. value points not changing name keeping first modules point label having different values. this function used create graph, if data undefined creates chart if not adds data dataset. <script src=//code.jquery.com/jquery-3.2.1.min.js></script> <script src=https://cdnjs.cloudflare.com/ajax/libs/chart.js/2.5.0/chart.bundle.js></script> <input id=mod_code value=set08108><button id='go'>go</button> <canvas id="mychart" width="300" height="300"></canvas> <script> var data; $(function(){ $('#go').click(function(){ $.ajax({url:'output.php', data {mod_code:$('#mod_code').val()},datatype:'json', success:function(d){ if(data===undefined) data = {labels:[],datasets:[{label:$('#mod_cod

concurrency - Concurrent Erlang Code -

from old exam, there question don't understand answer to. module question looks this: -module(p4). -export([start/0, init/0, f1/1, f2/1, f3/2]). start() -> spawn(fun() -> init() end). init() -> loop(0). loop(n) -> receive {f1, pid} -> pid ! {f1r, self(), n}, loop(n); {f2, pid} -> pid ! {f2r, self()}, loop(n+1); {f3, pid, m} -> pid ! {f3r, self()}, loop(m) end. f1(serv) -> serv ! {f1, self()}, receive {f1r, serv, n} -> n end. f2(serv) -> serv ! {f2, self()}, receive {f2r, serv} -> ok end. f3(serv, n) -> serv ! {f3, self(), n}, receive {f3r, serv} -> ok end. the question asks consider following function part of code, , result of function be. correct answer 2. think it'd 3, since "increase-call" f2(server) after response of self()!{f1r, server, 2} . test3() -> server = sta

visual studio - Programmatically building c# webapplications projects gives errors on opening project -

i want build freshly new added standard asp (mvc) webapplication programmatically in visual studio 2017. therefore use console application uses microsoft.build.evaluation.project.build() open , compile project. console application builds outlined below. project needs build standard asp mvc .net application generated wizard in visual studio. in visual studio version 2017 compiles fine. if want compile using application , @ opening of project, comes error : microsoft.build.exceptions.invalidprojectfileexception occurred hresult=0x80131500 message=the imported project "c:\program files (x86)\msbuild\microsoft\visualstudio\v15.0\webapplications\microsoft.webapplication.targets" not found. confirm path in declaration correct, , file exists on disk. now, if open csproj file of webapplication in notepad tells wants find it's imported projects in: import project="$(vstoolspath)\webapplications\microsoft.webapplication.targets" condition="&

Handling null in JSON RESPONSE -

i getting json response ["l500","success",null] how can handle it here tried jsonarray.getjsonarray(2).getjsonobject(2).equals(jsonobject.null); however, produces error: org.json.jsonexception: value null @ 2 of type org.json.jsonobject$1 cannot converted jsonarray if null need show toast message user "no records found". i solved replacing jsonarray.getjsonarray(2).getjsonobject(2).equals(jsonobject.null); with jsonarray.get(2).equals(null);

c# - Update to Azure Notification hub tags fails when tags list is empty -

i've made notification hub on microsoft azure in order send notification both in android , ios. problem when phone registers in tags , removes them, still receiving notifications tags have been removed. seems when send empty (not null) list, update fails. ideas? here on register code: protected override void onregistered (context context, string registrationid) { log.verbose (mybroadcastreceiver.tag, "gcm registered: " + registrationid); registrationid = registrationid; hub = new notificationhub (constants.notificationhubname, constants.listenconnectionstring, context); try { hub.unregisterall (registrationid); } catch (exception ex) { log.error (mybroadcastreceiver.tag, ex.message); } saveandload_droid load = new saveandload_droid (); string output_settings = load.loadtext ("settings.txt"); string [] categories = out

.NET Regex Negative Lookahead For Upper Case Letters -

trying work expression custom .net application extract zip codes addresses. the addresses in single line 12345 example street, ny 10019 united states used following expression \d{3,5}-\d{3,5}|\d{5}(?![a-z]{2}) but seems fetching both 12345 zip code 10019 . considering have mentioned 2 upper case letters in negative lookahead, shouldn't considering zip code preceded 2 letter ny code? doing wrong here? i using | operator zip codes in 12345-12345 12345 formats please check regex testing here you may use lookbehind here: \d{3,5}-\d{3,5}|(?<=[a-z]{2}\s+)\d{5} see regex demo the (?<=[a-z]{2}\s+) require 2 uppercase letters , 1 or more whitespaces before 5 digits. to make sure match specified number of digits, may use word boundaries \b : \b(?:\d{3,5}-\d{3,5}|(?<=[a-z]{2}\s+)\d{5})\b see another demo .

gradle - Task with path 'build' not found in root project -

i have multiproject , after last subproject built, i'd process jars. therefore created task in root-project: task install(dependson: 'build', type: copy) { dolast { println "exec install task" } } upon calling ./gradlew install in root directory, i'm facing error: failure: build failed exception. * went wrong: not determine dependencies of task ':install'. > task path 'build' not found in root project 'foo'. however, calling ./gradlew tasks shows me these tasks: :tasks ------------------------------------------------------------ tasks runnable root project ------------------------------------------------------------ build tasks ----------- assemble - assembles outputs of project. build - assembles , tests project. ... how can achieve desired functionality? i assume, root project organizes build, not define build action taken itself. build task defined language plugins (in cases via appl

Export jqgrid with email formatter? -

i use jqgrid v5.2.0 small problem when export data. i export data column has email formatter , column after export <a href="mailto:tommy@example.com">tommy@example.com</a> anyway display column tommy@example.com

node.js - Node, different cache rules for a particular file type -

i disabling cache app so: app.use(function nocache(req, res, next) { res.header('cache-control', 'no-cache, no-store, must-revalidate'); res.header('pragma', 'no-cache'); res.header('expires', 0); next(); }); there problem using on https when using ie: https://connect.microsoft.com/ie/feedbackdetail/view/992569/font-face-not-working-with-internet-explorer-and-http-header-pragma-no-cache how can change above code make not apply font type files? think solve issue. thanks you can check req.path against extensions web fonts (ttf, woff, eot, etc), , skip sending headers in case: const webfont_extensions = /\.(?:eot|ttf|woff|svg)$/i; app.use(function nocache(req, res, next) { if (! webfont_extensions.test(req.path)) { res.header('cache-control', 'no-cache, no-store, must-revalidate'); res.header('pragma', 'no-cache'); res.header('expires', 0); } next(); });

tortoisesvn - SVN folders are no longer under version control -

Image
during committing svn server happened power loss on side (commit not completed). after turning on pc found checked out folders (and files inside these folders) no longer under version control. thought .svn folder exist, no commit/update/etc. possibility , folders/files doesn't have green/red symbol on it. see picture. possible restore version control? make checkout in new working copy , copy data old working copy (without old .svn folder) new working copy , replace files. if status green files, last commit committed. if not, can submit still modified files in 2nd commit repository. now use new working copy , delete old one.

Make Swift UITableView's cell highlight when tapped -

how make every cell have dark layer on unless selected, , when selected make layer fade out? i have tried using subviews on cell didn't work because didn't show up. every cell has patternimage background image. one option in general when wanting customize tableview cells subclass them. so, example: class mycustomtableviewcell: uitableviewcell { var pattern: pattern? override func setselected(_ selected: bool, animated: bool) { super.setselected(selected, animated: animated) // configure view selected state } there variety of methods can override. see https://developer.apple.com/reference/uikit/uitableviewcell

javascript - Unable to load module with extention js in TypeScript and Systemjs -

get request systemjs not adding extention .js url. these typescript classes customer.ts import {address} "./address"; export class customer { private _customername: string = ""; public customeraddress: address = new address(); public set customername(value: string) { if (value.length == 0) { throw "customer name required"; } this._customername = value; } public customername() { return this._customername; } validate(): boolean { return this._customername != ''; } } address.ts export class address { public street1: string = ""; } using following systemjs init code system.config({ defaultextension: 'js', }); system.import("customer.js").then(function (exports) { var cust = new exports.customer(); }); customer.js loaded address.js not. the request address.js not contains .js extention resulting follow

Set HTML <img> element to Javascript image variable -

i have array of image variables preloaded using javascript make image sequence animation. issue have setting img element html use 1 of these images. seems properies strings? here's how set array of images in javascript: for(var = 0; < 30; ++){ anim[i] = new image(); if(i < 10){ anim[i].src = "images/anim/frame0" + + ".png"; } if(i >= 10){ anim[i].src = "images/anim/frame" + + ".png"; } } and have ^img tag = "animation"^ in html want change. your code looks valid. for(var = 0; < 30; i++){ anim[i] = new image(); if(i < 10){ anim[i].src = `images/anim/frame0${i}.png`; } if(i >= 10){ anim[i].src = `images/anim/frame${i}.png`; } } now can do: document.body.appendchild(anim[0]); i tested , works me. if want change src on fly you'd have select appended element , update src this: document.queryselectorall('im

matlab - How to overshadow build-in function with dynamic variables -

when dynamically creating variables assignin in matlab, not work when variable name conflicts existing function name. here example: function test( ) f() beta beta end function f() assignin('caller','beta',1) assignin('caller','beta',1) end evaluating beta fails, since not recognized variable. >> test beta = 1 not enough input arguments. error in beta (line 19) y = exp(betaln(z,w)); error in test (line 5) beta apparently because initial jit compilation recognizes function calls , not over-shadow existing functions (in case beta function statistics toolbox) dynamically created variables. my question whether there way force overshadowing functions using assignin , making above example code work. ps: 1 way initialize variable name adding beta=[]; on first line of test() . problem in application interested in, don't know variable names ex ante.

java - Print a pattern like AAA to ZZZ starts like AAA AAB AAC.... AAZ ABA ABB ... ZZZ? -

i have tried below code shows error.. string str="aaa"; char[] ch=str.tochararray(); int length=str.length(); for(int i=length-1;i>=0;i--) { for(int j=65;j<=90;j++) { system.out.println(str.replace(ch[i] ,(char)j)); } } all need 3 loops (one each character place): for(char c1 = 'a'; c1 <= 'z'; c1++){ for(char c2 = 'a'; c2 <= 'z'; c2++){ for(char c3 = 'a'; c3 <= 'z'; c3++){ system.out.println("" + c1 + c2 + c3); } } } at end adding string, or else numerical value, instead of string expecting: system.out.println('a' + 'b' + 'c'); // output: 198 system.out.println("" + 'a' + 'b' + 'c'); // output: abc

c# - UWP missing TextCompositionEventHandler -

i need listen public event textcompositioneventhandler textinput; (wpf), in uwp app page, seems missing. can give suggestion ? bassically need catch nfc card reader key, , check if key valid , log in user. in wpf listening the event described above.

database - JSON structure - authorize user menu -

i want showing menu user login. etc: if login user1, show menu1, menu2, menu3. if login user2, show menu2 , menu3. i create json structure per module. tiles : { module1 : [ { "header":"data peserta", "subheader":"kepesertaan", "icon":"sap-icon://log", "route":"datapeserta" }, { "header":"header1", "subheader":"kepesertaan", "icon":"sap-icon://delete", "route":"first" }, { "header":"header1", "subheader":"kepesertaan",

python - Django deafult_token_generator creates token tha is almost immediately expired -

for set/reset password in django app use built-in django resetpasswordrequestview , resetpasswordconfirmview. them working fine. i've created function that's sending email user when administrator creates account (there no registration "common users" on site). here's code: class resetpasswordrequestview(formview): template_name = "account/password_reset.html" #code template given below view's code success_url = '/account/reset_password' form_class = passwordresetrequestform @staticmethod def validate_email_address(email): """ method here validates if input email address or not. returns boolean. """ try: validate_email(email) return true except validationerror: return false def post(self, request, *args, **kwargs): """ normal post request takes input field "email_or_user