Posts

Showing posts from February, 2010

Disable output for namespaces when running tests in clojure with boot -

i using boot-clj watch test task adzerk.boot-test . it prints testing my.namespace.here console every namespace have in project. even if namespace not contain tests. no fun, since have scroll every time test fails. how disable output?

javascript - Format code in Razor section visual studio -

i have project asp.net mvc in visual studio 2017 (enterprise edition) in layout page have 3 sections <script type="text/javascript"> $(document).ready(function () { if(checkuserhavemobilephone) { @rendersection("scriptsphone", false) } else { @rendersection("scriptspc", false) } @rendersection("scripts", false) }); </script> and in view have code (and work) <script type="text/javascript"> @section scripts { $(window).resize(function () { }); } </script> http://imgur.com/ks8olfq but when add if-statement section don't work <script type="text/javascript"> @section scripts { $(window).resize(function () { if (parseint($(window).width()) <= 800) { alert("alert"); } }); } </script> http://imgur.com/a/zqiwj after syntax e

visual c++ - context::Context(void) - cs_ctx_alloc() failed -

i trying run application in debugging mode. logon screen appears , when try login "context::context(void) - cs_ctx_alloc() failed" error encountered. on debugging using break point , selecting continue when code crashes, following database access error message displayed ":ct_con_props(cs_userdata)failure". following environment setup in finding error. os: windows 10 ide: visual studio 2013, vc++ code access: elevated database: sybase ocs 15_0 the application working on following environment:- os: windows 7 ide: visual studio 2013, vc++ code access: admin database: sybase ocs 12_5

Redux / Reselect - selector reusing -

i new selectors. have created following ones: import { createselector } 'reselect'; const getvalues = (state) => state.grid; // [3, 4, 7, 3, 2, 7, 3,...] const gettiles = (state) => state.tiles; // [0, 1, 0, 1, 0, 0, 1,...] // counts selected tiles (ie. adds 1s) export const getselected = createselector( [gettiles], tiles => tiles.reduce((acc, elem) => acc + elem, 0) ); // displays values of selected tiles, rest shows 0 export const showselected = createselector( [gettiles, getvalues], (tiles, grid) => tiles.map((idx, i) => (idx === 1 ? grid[i] : 0)) ); export const addselected = createselector( [showselected] ..... ); /* export const addselected = createselector( [showselected], coun => coun.reduce((acc, elem) => acc + elem, 0) ); */ the third selector (addselected - last bottom, commented-out version) same thing first 1 (with different inputs). how can make more generic can reuse instead of writing whole 'reduce

angularjs - md-chips deletion by clicking the chip -

i'm new angularjs. i'm using md-chips create chips based on drop down selection. mobile view, delete md-chips clicking chip instead of making user click small 'x' on chip. if make read-only can't delete chip. ideas appreciated. thanks. html: <div ng-repeat="filter in sc.filters"> <md-chips ng-model="filter.value" ng-if="sc.isarray(filter.value)" md-on-remove="sc.filter()"> </md-chips> </div> you can use md-on-select="ctrl.remove($chip)" callback $chip contains element of ng-mode array has been clicked on. in remove function can remove element array. according example like follows: $scope.remove = function($chip) { var idx = self.fruitnames.indexof($chip) $scope.filters.splice(idx, 1) } a working fiddle can found here: jsfiddle

javascript - How I change a value of hidden file according which radio selected -

i have in file html.twig : 1- hidden file should take 3 values according radio selected, 1 database , 2 others hiden files values number 10, this: <input type="hidden" name="lt" value="{{ price.getlt }}"> <input type="hidden" name="lt" value="10"> <input type="hidden" name="lt" value="10"> 2- , have 3 radiobox: <input id="spa-price" name="price" class="w3-radio" value="spare {{ price.getspareprice }}" type="radio"> <input id="rep-price" name="price" class="w3-radio" value="repair{{ price.getrepairprice }}" type="radio"> <input id="rep-price" name="price" class="w3-radio" value="test {{ price.gettestprice }}" type="radio"> 3- did block javascript in same file html.twig created function value of each r

http status code 404 - jhipster - war deployed on jboss server -

i'm trying deploy jhipster .war on jboss 6.4. can access main page cannot log in. have message "failed sign in! please check credentials , try again". on chrome console have error : http://localhost:8080/myapp/api/authenticate?cachebuster=1492172408521 404 (not found) works fine mvnw command on embedded server(tomcat). what problem jboss ? edit: jhipster version : 3.12.2. monolithic application. jwt authentication. mysql database. ok started new fresh project, deployed on jboss 6.4 , still have problem, cannot authenticate. have on console when go main page : localhost:8080/myapp/api/profile-info?cachebuster=1492674235‌​919 404 (not found) , localhost:8080/myapp/api/account?cachebuster=1492674235931 404 (not found).

javascript - Remove MagicLine plugin CKEditor 4 -

i pulling ckeditor 4 bower directly repo. i want remove magicline feature (the insert paragraph here line): i have tried to: disable plugin with: config.removeplugins = 'magicline'; this nothing @ all. i deleted folder plugins/magicline . and line still there after removing plugin. arrow icon gone now, dashed line still appears. weird, folder magicline in plugins not responsible behaviour? how rid of it?

How to exclude subtree in Neo4j? -

i have simple tree graph in neo4j. each node of type object , has id , name properties, , can linked parent-child aggregation link other nodes (graph tree, no cycles allowed). i run simple query returns particular subtree (rooted node id 127 in example below): match network = (:object { id: 127 })-[*]->() return network but need query, excludes subtree, rooted specified node (say 131), subtree returned query above. how query like? (i tried: match network = (:object { id: 127 })-[*]->(x:object) x.id <> 131 return network , excludes single node if doesn't have children. match network = (:object { id: 127 })-[*]->(x:object)-[*]->() x.id <> 131 return network , doesn't work.) i found way through list comprehensions match network = (:object { id: 127 })-[*]->(x:object) none (n in nodes(network) n.id = 131) return network this works pretty fast, maybe better solutions exist?...

javascript - Is it possible to pass a map with not ordered integer keys as a json to UI? -

i'm trying pass map int keys ui in json format. use linkedhashmap @ server side , compose follows: { 3: "some value 3", 1: "some value 1", 2: "some value 2" } but when check coming object @ ui side map sorted key: { 1: "some value 1", 2: "some value 2", 3: "some value 3" } i tried use treemap works in same way. i'm wondering why initial order has broken when using int keys whereas order preserved when uses not integer keys.

wordpress - Correct way to back-up and restore vagrant box + Variable VVV -

i have vagrant box (ubuntu/trusty64) installed on macbook. have extended box variable vvv --> https://github.com/bradp/vv#os-x-installation enables me create fresh wordpress installs (currently have around 10 installs). ok, problem? macbook mess! reason why want clear out macbook , install fresh version. the problem don't want lose box , of projects. how can tackle problem without losing projects? greetz , many thanks! you need backup box, project directory , virtualbox folder vm. those following: ~/.vagrant.d folder together this folder has downloaded boxes (under ~/.vagrant.d/boxes folder) has references of vm active under vagrant management your project directory save folders have vagrantfile, contains .vagrant directory, under folder there file reference of vm linked vagrantfile the vm directory i not sure default value should ~/virtualbox vms . backup directory contains vms created vagrant after have cleaned macos, need make sure r

javascript - Node-fetch returns Promise { <pending> } instead of desired data -

this question has answer here: how return response asynchronous call? 21 answers i trying fetch json website using node-fetch module, , have made following function: var fetch = require("node-fetch"); function getjson(url) { return fetch(url) .then(function(res) { return res.json(); }).then(function(json) { //console.log(json) logs desired data return json; }); } console.log(getjson("http://api.somewebsite/some/destination")) //logs promise { <pending> } when printed console, receive promise { <pending> } however, if print variable json command line last .then function, desired json data. there way return same data? (i apologize in advance if misunderstanding issue on part, rather new javascript) a javascript promise asynchronous. function not. when print return value of function retur

mysql - Forming my ERD, couple of issues with it -

Image
okay, partners , myself created these while ago. going transferring sql through visual basic soon, want make sure ready go. 2 major complaints not able fix was... "by having transaction , product directly connected unable allow multiple products on same order (customer can't order both latte , cappuccino on same order)." "membership table: not sure data in discounttypetotal means - have multiple pieces of data in same field? (then table isn't on 1nf). it looks need allow each member have multiple discounts - need table capture that." how correct these? how else connect transaction products? understand customer can purchase 1 item per transactions, have products , table multiple items? allowing multiple customers have discounts, lost. appreciated.

java - Javacc How can i make a variable accessible to scanner and parser -

im trying create map containing function names. can in scanning phase or parsing phase can't seem same variable accessible both. what need have function names saved in map before begins parsing, function can declared below point called. need check that function exists. i have tried using token mgr declarations allows me add tokens map each time seen. need funcs variable seen parser can check function exists. token_mgr_decls : { public static map funcs = new hashmap(); } token : { <fname: (["a"-"z"])+ > { funcs.put(matchedtoken.image, "..");} } this closest have got, have tried global variable in .jj file, below parser_begin(..), , declared within main function. both of lead 'symbol can't found' error when trying add function names map. thanks help. first have recommend against having variables shared between parser , lexer. because lexer can ahead of parser meaning that: if var

android - How to know is there user added libraries into the project programmatically? -

in project, have included user created libraries. want check there libraries present in project. how this? below code may help public static void checklibrary(){ try { log.e(" in","checklibrary"); set<string> libs = new hashset<string>(); string mapsfile = "/proc/" + android.os.process.mypid() + "/maps"; bufferedreader reader = new bufferedreader(new filereader(mapsfile)); string line; while ((line = reader.readline()) != null) { if (line.endswith(".so")) { int n = line.lastindexof(" "); libs.add(line.substring(n + 1)); } } log.e("ldd", libs.size() + " libraries:"); (string lib : li

Reconstruct original 16-bit Raw pixel data from the HTML5 canvas -

if 16-bit single channel (gray-scale) raw pixel data losslessly encoded image format(e.g.png, webp , jpeg-2000 or jpeg-xr) , image rendered html5 canvas, there way retrieve original 16-bit raw pixel data canvas? no. when drawn canvas image uncompressed, , pixels data pre-multiplied , converted 24-bit data + 8-bit alpha channel (rgba). in process image looses original, same color depth original image because of various rounding errors (see canvas fingerprinting .) so lossless formats loosy on canvas. if need raw data, you'll need write parser , treat directly images files arraybuffer.

javascript - angular inject $http to service -

i use inject inject $http .factory here code: 'use strict'; app.factory('myservice', myservice); function myservice () { let service = { myfunc: myfunc, }; return service; } myfunc.$inject = ['$http']; function myfunc ($http) { $http.get('api/data') .success((res) => { return res; }) .error((e) => { console.log('error' + e.message); }); } but, when call function have error: typeerror: e.get not function. missed? thank's. i reconfigure app follows: (function () { "use strict"; angular.module('app').factory('myservice', myservice); myservice.$inject = ['$http']; function myservice($http) { function myfunc () { $http.get('api/data') .then(function(success){ return response.data; }, function (failure){ return failure; });

ffmpeg - Manually generate "empty" h264 p-frame -

let's call p-frame frame empty if doesn't change pixels in decoded video (i.e. no motion vectors, nothing). what need able manually insert empty p-frame video stream on request (need send frames streaming client constant framerate, frame source on streaming server can supply frames different/lower one). so need able correctly form byte sequence represents empty p-frame current resolution (i wonder other parameters needed?) ideally, prefer have encoder-independent solution, since use 2 different ones: nvenc via nvidia video sdk , x264 via ffmpeg. where should to? i think there h264 nal unit dedicated data padding (nal_unit_type: 12 : filler_data_rbsp( )). might useful you.

google spreadsheet - Is it more efficient to make one calculation N times, or to create a cell containing the result of that calculation and reference it N times? -

consider 2 below spreadsheets. produce same data, first makes calculation twice, whereas second has column dedicated result of calculation it's made once. 0 | | b | c | d | e | f | g 1 | xx | yy | zz | nn | qq | =sum(a1,b1,c1) * d1 | =sum(a1,b1,c1) * e1 0 | | b | c | d | e | f | g | h 1 | xx | yy | zz | nn | qq | =sum(a1,b1,c1) | =f1 * d1 | =f1 * e1 if high-traffic spreadsheet, configuration more efficient? programmer in me says second way more efficient since doesn't duplicate code, ui engineer in me says first way more efficient because adding column requires more memory running calculations. i'm not sure more correct, , unsure how test it. thanks!

javascript - Selection box model with typescript and knockout -

i new typescript , convert following knockout+js knockout+typescript. knockout+js working, still failing make work typescript.... view: <select data-bind="options: choices, value: selectedchoice"></select> model: var mymodel = { choices: ["blue", "white", "black", "yellow"], selectedchoice: ko.observable("yellow") }; mymodel.selectedchoice.subscribe(function(newvalue) { alert("the new value " + newvalue); }); ko.applybindings(mymodel); typescript: import basevm = require("./basevm"); class mymodel extends basevm { choices = ko.observablearray(["one", "two", "three"]); //here selectedchoice subscribe in typescript... } export = mymodel; in typescript within class you'll need put subscription code inside of constructor function. can use "this" access property want subscribe to. class mymodel extends base

c# - Create console app client to access the controller action ASP.NET MVC 5 -

i new web development , in asp.net mvc-5 project , have made 1 action accepts request. want on console desktop application hit action of controller. below novice attempt. please guide me. in controller added below action public class securitycontroller : basecontroller { [httpget] public actionresult cacheclear(testmv viewmodel) { // code return view(); } } my testmv public class testmv { public int locationid { get; set; } } now, when go browser , type http://localhost:5271/security/cacheclear/?locationid=28463 able hit breakpoint , able capture value. question 1: it? or need fancy stuff me console app hit action method. need create web api or something. or above code work fine? question 2: how access controller action via desktop app. i googled wrote below code: using system; using system.collections.generic; using system.linq; using system.text; using system.threading.tasks; namespace console

javascript - RequireJS is loading scripts that are not needed on all pages -

require.js loads every module on every page, javascript errors on pages don't need loaded scripts. specifically, news-filter.js loading on search page, , causing error: jquery-1.12.3.min.js:2 uncaught error: syntax error, unrecognized expression: "li." line in news-filter.js $("ul.medialisting").children("li."+chosenyear).filter("."+chosencategory).each(function(c) { am missing somthing how reqire.js determines scripts needed on each page? main.js file is: requirejs.config({ baseurl: [system-view:internal]"/render/file.act?path=/assets/scripts/"[/system-view:internal] [system-view:external]"/assets/scripts/"[/system-view:external], paths: { "jquery": "libs/jquery/jquery-1.12.3.min", "velocity": "libs/velocity/velocity", "bgstretch": "plugins/background-stretch/background-stretch", "campus-map": "m

outlook - vba delete email from sent folder -

i want delete email sent items folder after email forwarded rule. i tried use "brettdj" code post: macro delete email it's not working me @ . what i'm looking it's vba macro can delete email when run script rule. any idea how can accomplished that thanks in advance you don't have corresponding entry in contacts folder (address book). add method of recipients class accepts name of recipient; can string representing display name, alias, or full smtp e-mail address of recipient. sub forwardemail(itm outlook.mailitem) dim oexplorer outlook.explorer dim omail outlook.mailitem dim ooldmail outlook.mailitem set oexplorer = application.activeexplorer if oexplorer.selection.item(1).class = olmail set ooldmail = oexplorer.selection.item(1) set omail = ooldmail.forward omail.recipients.add "test@gmail.com" omail.recipients.item(1).resolve if omail.recipients.item(1).resolved 'delete f

python - Group rows in Pandas DataFrame based on complex condition -

i have basic dataframe, structured this: col1 ind1 ind2 0 key1 12 key2 35 1 key3 56 key4 24 key5 65 ...and 1 this: cola 0 key1 1 else 2 else 3 key3 what need mean value of df1, grouped based on whether ind2 in df2 or not. tried without success; message sais "lengths must match compare" -- of course, don't. df1 = pd.dataframe({'ind1': [0, 0, 1, 1, 1], 'ind2': ['key1', 'key2', 'key3', 'key4', 'key5'], 'col1': [12, 35, 56, 24, 65]}, ) df1.set_index(['ind1', 'ind2'], inplace=true) df2 = pd.dataframe({'cola': ['key1', 'else', 'else', 'key3']}) print (df1.groupby(df1.index.levels[1] in df2.get_values()).mean()) thanks in advance hint! you want check whether element of df1.index.levels[1] in df2.cola (since need value each row). syntax wrote won't that. instead, should

c++ - Creating a text editor in Qt with QTableWidget -

i want create gui allow user open desired .txt file pressing browse button. text file should loaded gui further processing @ later stage. void dictionary::on_browsebutton_clicked() { qstringlist filenames = qfiledialog::getopenfilenames(this, tr("open file"),"/path/to/file/",tr("txt files (*.txt)")); ui->tablewidget->additems(filenames); } the error class 'qtablewidget' has no member name 'additems' . what 'qtablewidget' ? i new working classes , hoping explain went wrong. i'm assuming gui has table widget, hence qtablewidget. take @ qtablewidget class documentation ; there's no additems() method, why you're getting error. whatever code you're working expecting additems() method add data qtablewidget you'll have implement yourself, , rewrite code doesn't try call additems() qtablewidget. so, you'll need use qtablewidgetitem class , setitem() method, in example co

dictionary - iterate at a function input in python -

i need transfer values in dict (dict1 in example below) function in element element manner (func1 in example below, function can not changed) def func1(input1,input2,input3): print input1 print input2 print input3 dict1={"a":1,"b":2,"c":3} keys=["a","b","c"] func1(dict1["a"],dict1["b"],dict1["c"]) how can improve last line of array keys? have tried func1([dict[key] key in keys]) and func1(dict[key] key in keys) your func1([dict[key1] key in keys]) worked, need unpack before sending function using * func1(*[dict1[key] key in keys])

schema.org - Additional Product Info on a page -

i'm developing page contains multiple products on recommendations on product page. of recommendations not present on page unless user takes action, preloaded in dom. schema.org data on these products muddy water seo or there presence benign?

android - How do I make my activity use testing data? -

i have application displays data (posts) web api. a background service syncs data @ unknown time , saves it. when visiting main activity loads data , displays in recyclerview the loading handled via singleton class i test main activity follows @rule public activitytestrule<mainactivity> mactivityrule = new activitytestrule<>(mainactivity.class); @test public void testdataload() { int poststotal = datasingleton.getinstance().getpostscount(); viewinteraction empty = onview(withid(r.id.empty_view)); viewinteraction recycler = onview(withid(r.id.recycler_view)); if (poststotal == 0) { empty.check(matches(isdisplayed())); recycler.check(matches(not(isdisplayed()))); } else { empty.check(matches(not(isdisplayed()))); recycler.check(matches(isdisplayed())); recycler.check(new recyclerviewitemcountassertion(greaterthan(poststotal))); } } i know can't right way write tests. want able test both empty

php - Symfony forms - setting an empty value for an entity with OneToOne bidirectional relationship -

i have user entity bidirectional relationship passport entity /** @entity */ class user { /** * @onetoone(targetentity="passport", mappedby="user") * @joincolumn(name="passport_id", referencedcolumnname="id") */ private $passport; // plus other fields // plus getters , setters of above... } /** @entity */ class passport { /** * @onetoone(targetentity="user", inversedby="passport", cascade={"persist", "remove"}) * @joincolumn(name="user_id", referencedcolumnname="id") */ private $user; } and have formtype /** @usertype */ $builder->add ( 'passport', 'entity', array( 'class' => 'appbundle\passport', 'empty_value' => 'please choose passport' ) ); so when submitting form chosen passport user, need set user in passport entity

DocuSign Bulk Email -

is there way send in bulk recipients in salesforce? update envelope status account , attach document notes , attachment. 2. planning use libraries store docusign document. possible when docusign completed save signed document in salesforce libraries thank

.net - Nest elasticsearch index refresh -

i have 1 question refresh time on index. m referring es 5.2.0 version. i've seen warmers removed in version. knowledge when refresh index takes time , if query executed against index response slower. have set refresh -1 indices time time have queries indices not used , response time awful elasticsearch. i'm talking stuff more 1 second. default refresh time on index 1s keeps index warmed ? !

ruby - CodeCademy 4.6 bonus exercise -

hello guys tryng bonus exercise 4.6 "what make sure redactor redacts word regardless of whether it's upper case or lower case?" (link = https://www.codecademy.com/courses/ruby-beginner-en-mzrz6/0/6?curriculum_id=5059f8619189a5000201fbcb ) this code puts "tell me text for" text = gets.chomp puts "tell me word censor" word = gets.chomp text_array = text.split(" ") text_array.each |parole| if parole == ( word.downcase || word.capitalize ) puts "censure".upcase else puts "#{parole}" end end why wrong? plz not give me total different code understand why mine uncorrect, , how correct, thanks i think main thing here you're misunderstanding how || or operator used. if parole == ( word.downcase || word.capitalize ) isn't way check if parole either equal word.downcase or equal word.capitalize . || operator says overall expression considered true if either side of || true. need write out b

database - Relational algebra: selecting range (between numbers) -

i can't seem find on internet, find weird. question: how show range in relational algebra ? i being asked this: find user numbers of users had points in range of 500-1700. i checked this: http://www.marcoullis.com/knowledge/databases/marcoullisp_knowledge_databases_relational_algebra.html and came with: Ï€ user_numbers(σ points >= ‘500’ ^ points <= ’1700’ (user ⋈ point table)) is correct? if not, how should this? ps: ^ symbol stands and. if allowed use , in condition expression of restrict , tables how can guess question expression wrote correct. you write like Ï€ number (σ points >= 500 (user ⋈ point)) ⋈ Ï€ number (σ points <= 1700 (user ⋈ point)) or use intersect instead of (natural) join there.

shipping - UPS Rating API C# .Net -

i trying ups rating api supports time in transit work. have latest wsdl (ups api). keep getting exception error "an exception has been raised result of client data." , can not figure out problem. note: "rate" requestoption works no issues - when timeintransit , deliveryinformation data commented out. what wrong? appreciated, thank you. here c# code: upsratews.requesttype request = new upsratews.requesttype(); string[] requestoption = { "ratetimeintransit" }; request.requestoption = requestoption; request.subversion = "1601"; raterequest.request = request; upsratews.shipmenttype shipment = new upsratews.shipmenttype(); upsratews.shippertype shipper = new upsratews.shippertype(); upsratews.shipmentratingoptionstype shipmentratingoptions = new upsratews.shipmentratingoptionstype(); shipmentratingoptions.negotiatedratesindicator = ""; shipmentratingoptions.ratechartindicator = ""; shipment.shipmentratingop

python - matplotlib graph fill 2 colors above and below axis -

Image
i have line graph partly above , below x-axis of 0 . how can color area above line green, , below red? here's code: hydropathy_dict = {"i":-0.528, "l":-0.342, "f":-0.370, "v":-0.308, "m":-0.324, "p":-0.322, "w": -0.270, "h": 2.029, "t": 0.853, "e": 3.173, "q": 2.176, "c": 0.081, "y": 1.677, "a":-0.495, "s": 0.936, "n": 2.354, "d": 9.573, "r": 4.383, "g": 0.386, "k": 2.101 } seq = 'chcrrscysteysygtctvmginhrfcc' hydropathy_list = [] plot_x_axis = [] aa in seq: hydropathy_list.append(hydropathy_dict[aa]) print(acc,hydropathy_list) in range(len(hydropathy_list)): plot_x_axis.app

c# - Deserialization of an Ajax -

i have ajax webmethod. from webmethod getdate() "var" returning json: var json2 = "[{\"id\":1,\"datetime\":04/10/2017,\"col1\":1,\"col2\":2,\"col3\":3}]" error code: invalid object passed in, ':' or '}' expected. (23): [{"id":1,"datetime":04/10/2017,"col1":1,"col2":2,"col3":3}] my jquery code seems right: <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <script type="text/javascript"> $(document).ready(function () { $("#<%= button1.clientid %>").click(function () { var mo1 = $("#<%= textbox1.clientid %>").val(); var dy1 = $("#<%= textbox2.clientid %>").val(); var yr1 = $("#<%= textbox3.clientid %>").val();

Python random.sample() -

from random import random random.sample(list_variable,number) this code generates attribute error:built-in function or method object has no attribute sample. i python beginner. please help. you importing random function random package. need import sample function. from random import sample sample([1, 20, 3], 2) or import random package , explicitly call sample function like import random random.sample([1, 20, 3], 2)

rest - NullPointerException while making an asmx web service call for JSON data object from Android App using Volley in Android Studio -

i working on arnab's tutorial on volley site . getting nullpointerexception while making asmx web service call json data object android app using volley in android studio. "req" variable causing error in line 84 declare before offending line of code run. here error monitor: fatal exception: main process: com.caduceususa.app.myapp, pid: 14603 java.lang.nullpointerexception: attempt invoke virtual method 'void com.caduceususa.app.myapp.applicationcontroller.addtorequestqueue(com.android.volley.request)' on null object reference @ com.caduceususa.app.myapp.consumews$1.onclick(consumews.java:84) @ android.view.view.performclick(view.java:5637) @ android.view.view$performclick.run(view.java:22429) @ android.os.handler.handlecallback(handler.java:751) @ android.os.handler.dispatchmessage(handler.java:95) @ android.os.looper.loop(looper.java:154) @ android.app.activitythread.main(activitythread.java:6119) @ java.lang.reflect.method.invoke(native method) @ com.andro

How do I shuffle an array in Swift? -

how randomize or shuffle elements within array in swift? example, if array consists of 52 playing cards, want shuffle array in order shuffle deck. this answer details how add fisher-yates (fast uniform) shuffle in various versions of swift. swift 3 & 4 versions permissive, @ least work arrays. naming , behavior each swift version matches mutating , nonmutating sorting methods version. swift 4 these extensions add shuffle() method mutable collection (arrays , unsafe mutable buffers) , shuffled() method sequence: extension mutablecollection { /// shuffles contents of collection. mutating func shuffle() { let c = count guard c > 1 else { return } (firstunshuffled, unshuffledcount) in zip(indices, stride(from: c, to: 1, by: -1)) { let d: indexdistance = numericcast(arc4random_uniform(numericcast(unshuffledcount))) let = index(firstunshuffled, offsetby: d) swapat(firstunshuffled, i) }

javascript - creating and setting domain of cookie in webextesnion -

i developing web extension , in background script want create cookie same name existing cookie "user" in localhost domain edit data. able create cookie without specifying domain when try add domain(localhost) in cookie, not created. can tell me wrong. here manifest.json , background-script(background.js) manifest.json { "manifest_version": 2, "name": "xyz", "description": "abc", "version": "1.0", "browser_action": { "default_icon": "icon.png", "default_popup": "popup_page.html", "default_title": "xyz" }, "permissions": [ "activetab", "tabs", "cookies", "*://localhost/*", "<all_urls>", "http://localhost/php_extension_new/jquery.js" ], "background": { "scripts": ["background.js&qu

SVN checked out file icon in Eclipse -

Image
my workspace in sync svn repository 1 of files' icon not reflect that. first icon proper unable find meaning of second icon. team sync says there neither outgoing changes nor incoming changes. i have gone through answer , not have explanation second icon.

android - How do I play a sound only while an animated TextView is playing? -

the sound i'm using keys being typed , has been removed video => https://www.youtube.com/watch?v=pcnlc0ztmuu duration of sound => 2.577 seconds i added raw folder of project in question , would know how make sound play , repeat long animated textview not played . typewriter (class textview animation made): package genesysgeneration.animatedtext; import android.content.context; import android.os.handler; import android.util.attributeset; import android.widget.textview; public class typewriter extends textview { private charsequence mtext; private int mindex; private long mdelay = 1; public typewriter(context context){ super(context); } public typewriter(context context, attributeset attrs){ super(context, attrs); } private handler mhandler = new handler(); private runnable characteradder = new runnable() { @override public void run() { settext

c# - add circle(points) to canvas from a ObservableCollection to view using mvvm -

this question has answer here: how display items in canvas through binding 1 answer i absolute newbie c#, wpf , mvvm , , trying create canvas can add points based on observable colletion's points x , y coordinates. created custome user control , view model: not understand binding how bind data on viewmodel view. more specifically. public class viewmodel : inotifypropertychanged { public event propertychangedeventhandler propertychanged; public viewmodel() { points = new observablecollection<point>(); this.testdata(); } public observablecollection<point> points { get; set; } private void testdata() { points.add(new point(0, 50) ); points.add(new point(50, 0)); points.add(new point(13, 73)); points.add(new point(12, 23)); points.add(new point(34, 80)); points.add(new point(322, 225)); points.

python - Calling a hook function every time an Exception is raised -

let's want able log file every time exception raised, anywhere in program. don't want modify existing code. of course, generalized being able insert hook every time exception raised. would following code considered safe doing such thing? class myexception(exception): def my_hook(self): print('---> my_hook() called'); def __init__(self, *args, **kwargs): global backupexception; self.my_hook(); return backupexception.__init__(self, *args, **kwargs); def main(): global backupexception; global exception; backupexception = exception; exception = myexception; raise exception('contrived exception'); if __name__ == '__main__': main(); if want log uncaught exceptions, use sys.excepthook . i'm not sure see value of logging all raised exceptions, since lots of libraries raise/catch exceptions internally things won't care about.

Datatables.js bootstrap breaks modal form -

Image
im using datatables generate table button opens modal window on click. modal form looks broken this: but without dt looks wanted to: im using datatables that: var table = $('#productsadmintable') table.datatable({}); could me?

sql - Only inserting a row if it's not already there -

i had used similar following achieve it: insert thetable select @primarykey, @value1, @value2 not exists (select null thetable primarykey = @primarykey) ...but once under load, primary key violation occurred. statement inserts table @ all. mean above statement not atomic? the problem impossible recreate @ will. perhaps change following: insert thetable (holdlock, updlock, rowlock) select @primarykey, @value1, @value2 not exists (select null thetable (holdlock, updlock, rowlock) primarykey = @primarykey) although, maybe i'm using wrong locks or using locking or something. i have seen other questions on stackoverflow.com answers suggesting "if (select count(*) ... insert" etc., under (perhaps incorrect) assumption single sql statement atomic. does have ideas? what "jfdi" pattern? begin try

codeigniter - Mysql query is not showing required result please find the mistake in this. the query is given below -

select * `organizations` `added_by` = 1 , `deleted`= 0 , ( 'name' '%s%' escape '!' or 'phy_country' '%s%' escape '!' or 'phy_state' '%s%' escape '!' or 'phy_city' '%s%' escape '!' or 'phy_email' '%s%' escape '!' or 'phy_phone' '%s%' escape '!' or 'date_added' '%s%' escape '!' or 'date_modification' '%s%' escape '!' or 'status' '%s%' escape '!' )

c# - Edit a copy of ContextMenu template? -

i'm trying copy of default template (not style) contextmenu - i'd choose edit copy option in blend - can menuitems not contextmenu itself. how copy of default template contextmenu? this close gets style this gets style

caching - Still seeing old file version after CDN and browser cache purge -

for our project have javascript asset loads onto our page. updated js file frequently, , when deploy purge cdn caches file ensure users served newest file. recently, have found though purge cdn cache, , purge our local browser cache (for testing), still see old version of file in browser. here longer list of things we've done try ensure we're covering our bases: we verified correct file deployed checking origin (the s3 url real file lives behind cache) , see correct file there... thumbs up! we verified cdn cache purge worked, accessing file directly @ file's cdn cache url, , see correct file there... thumbs up! we clear our browser cache , load our website, , our updates not there... thumbs down ! we in dev tools, find our js file in source/debug tab (tried chrome, firefox, ie, safari, etc), , inspect code find our updates not there... thumbs down ! tried in incognito mode (and analogs in respective browsers) , still saw old code... thumbs down ! we went f

php - The page you requested was not found -

404 page not found i visiting page link: www.mypage.com/job i had developed website in codeigniter. working fine on local server when use xampp, problem when upload online. error facing 404 page not found . directory structure this: public_html (host main folder) job (my website folder) the remaining files , folder in main folder job. config/config.php file $config['base_url'] = ''; $config['index_page'] = ''; config/route.php file $route['default_controller'] = ''; please me out. in advance fill part true address $config['base_url'] = ''; for example "http://example.com/" if dosen't work check .htaccess file

Azure Data Factory - Use GetRunRecord(runid) to get complete Error Details -

i tried running first data copy job inside azure data factory - failed immediately, , displays message: failed execution: error message large returned. use getrunrecord(runid) complete error details. can tell me i'm supposed use getrunrecord command? googling error brought me 1 relevant result, , no help. thanks. do have runid in error messages pass getrunrecord(runid)? if yes, might try api call described here , pass in runid: https://docs.microsoft.com/en-us/rest/api/datafactory/data-factory-slice-run#save-run-log

mongodb - Receiving the titled error for a Meteor Galaxy deploy: MongoError: not authorized on admin to execute command -

i trying deploy locally developed meteor app galaxy (provided meteor). i've used 1 of recommended mongodb providers, atlas mongodb. have overcome several connection issues, cannot figure out cause of below. user associated has atlasadmin, dbadmin, dbadminanydatabase,readwriteanydatabase on admin db "@admin". /app/bundle/programs/server/node_modules/fibers/future.js:313 throw(ex); mongoerror: not authorized on admin execute command { listindexes: "users", cursor: { } } object.future.wait (/app/bundle/programs/server/node_modules/fibers/future.js:449:15) [object object].mongoconnection._ensureindex (packages/mongo/mongo_driver.js:832:10) [object object].mongo.collection._ensureindex (packages/mongo/collection.js:677:20) setupuserscollection (packages/accounts-base/accounts_server.js:1493:9) new accountsserver (packages/accounts-base/accounts_server.js:51:5) meteorinstall.node_modules.meteor.accounts-base.server_main.js (packages/accounts-base/server_main

stream - Firefox: Offers download when streaming mjpeg -

i habe ip camera providing mjpeg stream. can play stream in chrome , opera using iframe , setting src streams url: <iframe src="http://user:pwd@domain/video/mjpg.cgi" width="640" height="480"> however in firefox stream displayed after time ff asks whether open or download file confusing , annoying visitor. there better way play such stream without using plugin or addon? i'm not sure whether using iframe solution. when use img tag still image displayed , there no streaming.

jquery - Parse an integer (and *only* an integer) in JavaScript -

prompt possible translate string number variant except integer produced error. func('17') = 17; func('17.25') = nan func(' 17') = nan func('17test') = nan func('') = nan func('1e2') = nan func('0x12') = nan parseint not work, because not work correctly. parseint('17') = 17; parseint('17.25') = 17 // incorrect parseint(' 17') = nan parseint('17test') = 17 // incorrect parseint('') = nan parseint('1e2') = 1 // incorrect and importantly: function work in ie, chrome , other browsers!!! you can use regular expression , ternary operator reject strings containing non-digits: function intornan (x) { return /^\d+$/.test(x) ? +x : nan } console.log([ '17', //=> 17 '17.25', //=> nan ' 17', //=> nan '17test', //=> nan '', //=> nan '1e2', //=> nan '0x12' //=> nan

Visibility of "Restore Purchases" for in-app purchase -

i have free application need create account or use facebook. 1 time in-app purchase allow "unlock" app (remove ads, additional features...). classic. when logged , not yet purchased (ie. locked), display button "unlock vip pass". open dialog "purchase $xxx" , "restore previous purchases". note when purchase or restore done, store bought product ids in file. when app purchased (ie. unlocked), prefer not display button "unlock vip pass". in case note no "restore purchase" visible in application. also note when not logged, no "restore purchase" visible in application. i know apple ask applicaiton in-app purchase must have "restore purchase". means button must available in situation ? or description enough (ie. restore visible when not find purchase) ?