Posts

Showing posts from January, 2011

excel - Error when select multiple cells and press delete/backspace -

i have following code. stuff when [g,g,y,y,r,r] pressed , there error handling in case other keys pressed well. works fine! however, when multiple cells in column 11 selected , delete/backspace pressed "run-time error '13': type mismatch". private sub worksheet_change(byval target range) dim testcell dim re object dim rematches object dim cell1_1 string dim today string dim cell string thisrow = target.row 'action happens when typing [g,g,y,y,r,r] if target.column = 11 set re = createobject("vbscript.regexp") re .multiline = false .global = false .ignorecase = true .pattern = "[g,g,y,y,r,r]" end each testcell in target.cells set rematches = re.execute(testcell.value) if rematches.count > 0 , len(target.value) = 1 if len(cells(1, 1).value) = 1 today = now() cell1_1 = sheets("input").cells(1, 1).value range("l" & thisrow) = cell1_1 + ": " + format(toda

Coldfusion site - Chrome tries to link to https version of files that don't exist -

a couple coldfusion-based sites run having problem in chrome. i'm using <link rel="stylesheet" type="text/css" href="<cfoutput>#request.rootpath#</cfoutput>_data/styles/website.css"> refer stylesheet. when go site using chrome, stylesheet doesn't load, , when in source, link pointing https url instead of http . somehow, thinks stylesheet link should start https , when site regular-ol' http . http://www.preston-hanley.com/ , http://www.fmchosp.com/ it seems returning https time use <cfoutput>#request.rootpath#</cfoutput> ... any idea why , how can fix it? search through code base , see request.rootpath defined, since don't think defined coldfusion. deduced cgi scope , saw dave quested tweeted yesterday latest chrome reports different cgi.https . quote from: https://twitter.com/davequested/status/623968823276761089 chrome 44.0.2403.89 appears change cgi.https behaviour in #

java - Don't you have to use the same parameter names when calling a method? -

in code below, i've written 2 methods: one has variable test defined string one returns 2 different outcomes depending on typed i have variable named test in userinputhere while parameter in hello named message . in userinputhere use test instead of message - why work? does parameter not matter when invoke hello method? i when entering method returns something, has defined , parameters define further method going work on, so, had assumed that, when calling said method method, have use same parameters, doesn't seem case. import java.util.scanner; public class methodsandparameters { static scanner input = new scanner(system.in); public static void main(string[] args){ userinputhere(); } public static void userinputhere(){ string test = input.nextline(); system.out.println(hello(test)); } public static string hello(string message){ if (message.equalsignoreca

angularjs - Are Angular directive controllers only meant for exposing publicly? -

from angularjs directive documentation: best practice: use controller when want expose api other directives. otherwise use link. is case use controllers inside directives? what init functionality such defaulting variable , scope values? should go link, unless publicly exposed? i use "link" when have implement deeper dom manipulation. "regular" component should use controllers. idea use "link" when don't have other option it's more involved , requires deeper understanding of how angular sj works.

bash - Pipe One Serial Port to Another in Linux -

i looking means pipe 1 serial ports data (regardless of data type) serial port. in case trying take in data 1 serial port , output through radio connected serial port in real time. i know ports using , have looked program called socat, should able handle there no examples of how , have not been able figure out how it. has been able use socat or bash scipt/some other method accomplish in linux?? i running ubuntu 14.04. assuming serial port reading /dev/ttys0 , , other writing (where radio connected) /dev/ttys1 shall do: cat /dev/ttys0 > /dev/ttys1 or dd if=/dev/ttys0 of=/dev/ttys1 bs=1 of course before should set serial ports' parameters using stty command.

c# - Getting one or more error occured exception in downloading via HttpClient and Parsing with XElement -

i creating news app need support news of multiple language in visual studio xamarin c#. using code below. list<feeditem> feeditemslist = new list<feeditem>(); try { httpclient wc = new httpclient(); var html = wc.getstringasync(new uri(url)).result; xelement xmlitems = xelement.parse(html); // need create list of elements list<xelement> elements = xmlitems.descendants("item").tolist(); // we're putting informations got in our listbox in xaml code // have use foreach statment able read elements // description , link , title attributes in rssitem class i've added list<feeditem> aux = new list<feeditem>(); foreach (xelement rssitem in elements) { feeditem

c# - Shorter syntax for List construction -

with c# 6.0, given static method: public static list<t> list<t>(params t[] items) => new list<t>(items); and appropriate using : using static listtest.listutils; i can use list construct lists: var lsint = list(10, 20, 30); var lsstr = list("abc", "bcd", "cde"); without list method, construction can done via: var lsintinitializer = new list<int>() { 10, 20, 30 }; the name list being used both class , method. seems work fine, besides not being considered idiomatic, there technical reasons why shouldn't use list method name here? i can use list , that's not idiomatic in different way, in methods tend capitalized. note, have no problems going non-idiomatic route, if there's accepted practice in area, i'd know it. of course, c# 6.0 using static brave new world, perhaps there's not yet enough community experience around sort of thing. the language-ext project uses similar approach

java - Class not found error when running sonarrunner -

i getting class not found error. the class not accessible through class loader , error being prompt when running sonarrunner gradle. these classes included dependencies in compile time in gradle , gradle build works fine. how include these classes sonar ? 14:53:24.322 info - load module settings 14:53:24.335 info - base dir: /users/srao1/documents/gradletest/lds_warehouse/lds_warehouse_base 14:53:24.335 info - working dir: /users/srao1/documents/gradletest/lds_warehouse/build/sonar/lds_warehouse_lds_warehouse_base 14:53:24.336 info - source paths: src 14:53:24.336 info - test paths: test 14:53:24.336 info - binary dirs: build/classes/main 14:53:24.336 info - source encoding: utf-8, default locale: en_us 14:53:24.336 info - index files 14:53:24.444 info - 50 files indexed 14:53:24.593 info - quality profile java: sonar way 14:53:24.604 info - sensor javasquidsensor 14:53:24.620 warn - sonar.binaries , sonar.libraries deprecated since version 2.5 of sonar-java-pl

c# - Label Text proprety would not change -

so trying show progress of application form2 form1, using huge label(located on form1), text proprety of label doesn't change using code. there download process on executed via form2 , when finishes want label on form1 updated notify user of completion. here code: in form1: public string labeltext { { return this.label1.text; } set { this.label1.text = value; this.refresh(); } } in form2: private void dlclient(string link, string saveloc) { webclient = new webclient(); webclient.downloadprogresschanged += new downloadprogresschangedeventhandler(webclient_downloadprogresschanged); webclient.downloaddatacompleted += new downloaddatacompletedeventhandler(webclient_downloaddatacompleted); webclient.downloaddataasync(new uri(link)); } private void webclient_downloadprogresschanged(object sender, downloadprogresschangedeventargs e) { double bytesin = double.parse(e.bytesreceived.tostring()); double to

algorithm - Break an Array of Integers into the Maximum Number of Subarrays with Exact Sums -

if have array of integers like... {3,5,5,6,6,6,6,6,6,7,7,8,8,8,9,9,9} i want create maximum number of subarrays add 40 each element being used once. repeat numbers fine long not repeats have been used. it's easy finding maximum number of subarrays , finding subarrays of 40, problem finding subarrays provide 40 , doesn't prevent other subarrays of 40 being formed. i need output of subsets formed. it sounds similar partitioning problem. is there name problem? have solution? not efficient perhaps can following -- find multiples of 40 subset-sum problem can solved, starting largest multiple of 40 <= total sum , working down. once find subset sums multiple of 40, solve appropriate k-partition problem subset. example, if multiple of 40 120 solve (if possible) 3-partition problem of breaking 3 sets of equal size. note isn't enough identify single subset sums 120 before ruling out solution 120 -- have @ subsets sum 120 since 1 such subset might have solv

javascript - How to change Uptick Increments in HTML Number Input -

i have number input form: <input type='number' id='select-number'>pick number i have following questions: 1: default uptick increment 1 (when click arrow on number input, goes value of 1 per click.) how can change that? want go in values of 0.1 (tenths). how do that? 2: secondly, have 2 variables: feet=true; meters=false; one true, , other false. how change "max" attribute (using javascript) based on of these 2 variables true? 2 variables come code this: <input type='radio' id='feet' name='unit_of_measurement'>feet <input type='radio' id='meters' name='unit_of_measurement'>meters <script> feet=document.getelementbyid('feet').checked; meters=document.getelementbyid('meters').checked; </script> if variable "feet" true, maximum value of input (id='select-number') needs 3. if meters, needs 8. how can that(^), , how can change uptick

python - indexing with list comprehensions? Is it possible? -

the way i'm doing seems clunky. there better way index array? this code works: dem = np.empty((number_of_dem_files, demfile.shape[0], demfile.shape[1]), 'float') t in range(number_of_dem_files): dem[t] = np.load(dem_filename_list[t]) i tried doing list comprehensions this: dem = np.load([dem_filename_list[t] t in range(number_of_dem_files)]) but syntax error. possible? there reason or slow i've got? there better way? edit: dem_filename_list looks this: dem_filename_list = (d:/documents/data/grand_canyon_2015/03-11/dem1.npy, d:/documents/data/grand_canyon_2015/03-11/dem2.npy, d:/documents/data/grand_canyon_2015/03-11/dem3.npy, etc) the first line creates empty 3d array. ultimately, i'm trying load , store time series of arrays in 1 3d array, can index dem[t,i,j] where t time, row number, , j column number. this testable example, workes fine: import numpy np

javascript - Thymeleaf page refresh followup - Now with AJAX -

as followup earlier question using thymeleaf , preventing page refresh: http://forum.thymeleaf.org/preventing-page-refresh-thymeleaf-amp-spring-mvc-td4029155.html basically had working spring mvc app uses thymeleaf save form data. when user saves data page refresh (since wanted leave them on page more edits) , wanted eliminate page refresh. i have coded javascript use jquery ajax post data spring mvc controller. trick seemed to not use submit button, regular button , bind js function sending data server. it seems work perfectly, want make sure understand happening. in particular i'm wondering if thymeleaf redundant. don't think because when load page thymeleaf still bound data bean. using debugger on server side in controller looks post request calls mapped method , passes in data model. i appreciate comments on whether or not correct way accomplish this. finally, how handle error, example repository fails persist data reason? thanks much. here important par

LEFT JOIN Query with JPA not working (select new entity with users that have n documents) -

may me task... persistence provider eclipselink 2.6. i want retrieve list of users may have 0 or n documents. because both tables have few columns want use select new entity (userid, amountdocuments) , need user-id , amount of documents task. if user hasn't documents yet, "0" should shown, e.g.: userid:            1 2 3 4 amountdocs:  0 1 0 3 mapping documents in entity user follows: @onetomany(fetch=fetchtype.lazy, cascade=cascadetype.all,mappedby = "user", targetentity = userdocument.class) @orderby("sortorder asc") @joinfetch(joinfetchtype.outer) protected list<userdocument>documents; mapping user in entity userdocument follows: @manytoone(cascade=cascadetype.all) protected user user; and here jpa-query: select distinct new user.entity.user(u.id,count(doc.user)) user u left join u.documents doc on doc.user = u , doc.active = 't' group u.id problem is, only retrieve 2 users have documents

java - JSON inner field parsing with GSON -

i new json , love how incredibly potent , straight-forward gson api can be, compared other parsing methods i've researched. want parse rather complex json(using gson) resembles following 1 in terms of structure: [ { "name": "steve", "age": 42, "description": null, "email1": "steve@example.com", "email2": null, "address1": { "type": "home", "shippingmethod": "charge quantity", "street": "sunrise ave", "streetno": 17 }, "address2": { "type": "office", "shippingmethod": null, "street": "sunset ave", "streetno": 71 }, "anotherfield": "another value" }, { "name": "johnny", ... "anotherfield": "some other value" } ] i can

Filenames for custom vim-snippets snippets -

i've started using https://github.com/garbas/vim-snipmate https://github.com/honza/vim-snippets , having issues getting own snippets work. my plugins managed vundler , i've created custom .vim/snippets folder i've put own javascript.snippets , loading correctly setup. i create bunch of smaller snippet files like: javascript.karma.snippets , javascript.angular.snippets me organize them better. issue snippets not load unless in file named javascript.snippets . i've looked through honza/vim-snippets repo , noticed able namespace snippets way, not sure how configure system load different filenames. the github repo has in faq, not know how check it: check snippets file in scope either filetype matching path of snippet file or scope explicitly loaded. i read docs again, file needs named javascript_angular.snippets autoload: from docs : taking "scopes" these options, looks in each snippets/ directory in 'runtimepath' files name

jquery - Get the value li item clicked on -

i have following html. <div id="programsdata"> <ul id="programsdataitems"> </ul> </div> i populate list using jquery code snippet. let's appends list items (item1 , item2) list. $.each(data, function (i, val) { $("#programsdataitems").append("<li><a href='#'>" + val.value + "</a></li>"); }) here function list item clicked on: $("#programsdataitems").click(function (e) { var selectedli = $(this).text; e.preventdefault(); }); when click on list item, above function returns: item1item2. need 1 list item. can tell me how 1 list item clicked on? need modify how loading list items? replace $("#programsdataitems").click(function (e) { with $("#programsdataitems").on("click", "li", function (e) { this way you'll right context ( this ) in callback, , delegation ensure can still dy

syntax highlighting - How to highlight calls to object methods and user-created functions? (SublimeText, python) -

Image
i tried using both python3/pythonimproved .tmlanguage syntaxes, neither reason. supposed same color variables in editors? here's screenshot of random function: and here's how want like: to sum want called parentheses function() or object.method() highlighted. i'm author of python improved. sublime's default monokai theme lacks ability highlight many of scopes in pi (as bunch of other languages - it's quite bare-bones). 1 of other projects, neon color scheme , contains rules of pi's new scopes, scopes number of other languages, both built-in , third-party package control. if don't colors, i've tried keep neon.tmtheme pretty organized, should able adapt rules wish. if have questions or problems, feel free submit issue python improved or neon .

LibreOffice Error "1: Unexpected token: UNQUE in statement" -

i ran sql command create table test( key char(10) unique not null, primary key(key) ); and gave me error: 2: unexpected token: unique in statement [create table test( key char(10) unique] i'm trying create simple table sql command. error got, seems strange, because run on ms access. anyway fix this? //edit due "key" restricted word in sql, gave try. create table test( mlp char(10) unique not null, primary key(mlp) ); however, seems got broken again. 5: unexpected token: unique in statement [create table test( mlp char(10) unique] key reserved word in sql. choose name column , should work fine. the official tutorial uses following syntax: create table test( mlp char(10) not null primary key );

Empty lines removed and added according to GIT -

Image
this started happening without clear reason: pic source tree gui, same issue can seen in terminal view. my intuition has line endings, don't know how confirm it. suggestions? probably you're using editor automatically removes trailing whitespace. when you've edited file earlier editor keeps trailing whitespace on newlines (to keep indentation) behavior may occur. edit: may able ignore whitespace changes in github appending ?w=1 url ( https://github.com/blog/967-github-secrets )

Assistance with ActionScript 3.0 statement -

i'd write statement tests see if user has key , has more 20 experience points. if user has both key , points test see if user's name "joe", "harry", or "susan". actionscript 3.0 please! thanks! your question not clear have not provided sample code, , type user object is. assuming instance of 'object' class, here's sample code like: private var user:object; if (user.key == 'valueforkey' && user.experiencepoints >=20) { if (user.name == 'joe' || user.name == 'harry' || user.name == 'susan') { // code here } } this assuming user object has these properties of key, name , experiencepoints. hope helps.

PHP array problems - grouping array -

i'm trying convert array values (group actually), don't know how that. i have this: [ { "nsr": "000086310", "type": "3", "date": "2015-07-18", "time": "00:06", "pis": "12138790985" }, { "nsr": "000086313", "type": "3", "date": "2015-07-18", "time": "00:33", "pis": "16073736879" }, { "nsr": "000086316", "type": "3", "date": "2015-07-18", "time": "00:58", "pis": "16634402451" }, { "nsr": "000086316", "type": "3", "date": "2015-07-19", "time": "00:58", "pis": "98127981729" }, { "nsr": "000086316", "type&

matlab - my svr-model doesn't work for another data -

i have written program estimate image quality assessment. in code @ first extract features image , later sent them target value svm-train make model regression. after making model call image database , extract it's feature , send svm-predict value. code work database , has little error dosen't work image out of database , image me baias value. problem code? feature extraction: function f=feature_extraction (im) addpath(genpath('.\features')); tic if size(im,3)==3 im=rgb2gray(im); end f1=dog_features(im); f2=entropy_features(im); f3=gradient_features(im); f4=phasecong_features(im); f=[f1 f2 f3 f4]; toc (svr-mode:) cost =16384 ; gamma = 2; c_str = sprintf('%f',cost); g_str = sprintf('%.2f',gamma); libsvm_options = ['-s 3 -t 2 -g ',g_str,' -c ',c_str]; model = svmtrain(target,f,libsvm_options); after make model, read image this: im = imread('image.bmp'); f = feature_extraction(im); quality = svmpredict(ones(1,1),f,

angularjs - preventing angular to run in non displayed DOM elements -

lets have html structure this <myhandler> <element_1 ng-controller="..." ng-init=""> content </element_1> <element_2 ng-controller="..." ng-init=""> content </element_2> </myhandler> so, css saying element_2 has display: none; how tell angular not run on these lements, hidden? , run (once) when visible? to clarify case more, myhandler handling authorization , displaying element_1/element_2 depending on permissions. so don't want initialized element_2 if has no permissions instead of keeping display none ,just keep attribute ng-if flag variable because if use ng-if no element added dom or if no element added no controller instantiated. <myhandler> <element_1 ng-controller="..." ng-init=""> content </element_1> <sample ng-if="isdisplay"> <element_2 ng-controller="..

sql - Function to update a status flag for validity of other column? -

how create function compares card_id allowed_cards array elements? if it's in array, column status must updated true . create table client_1 ( id bigint not null, "time" timestamp without time zone default now(), status boolean, card_id character varying(10), constraint client_1_pkey primary key (id) ); create table allowed_cards ( allowed_cards character varying(10)[] ); insert allowed_cards values ('{dd3234,ff2342}'); enforce valid card_id @ times first of all, if need table card_allowed , use plain varchar or text column (with multiple entries), not array: create table card_allowed ( card_id varchar(10) not null primary key ); insert card_allowed values ('dd3234'), ('ff2342'); next, enforce valid cards, use fk constraint : create table client_1 ( client_1_id bigint not null primary key, tstz timestamptz default now(), -- card_valid boolean, card_id varchar(10), constraint

Create new folder using URL for name - Java -

i trying create empty folder name http://www.example.com/ , reason can't. tried: file dir = new file("http://www.example.com/"); dir.mkdir(); but nothing happends. why? file file = new file("c:\\directorydata"); if (!file.exists()) { if (file.mkdir()) { system.out.println("directory created!"); } else { system.out.println("failed create directory"); } } file files = new file("c:\\directory2\\subdir\\subdir"); if (files.exists()) { if (files.mkdirs()) { system.out.println("directories created!"); } else { system.out.println("failed create directories!"); } }

powerpoint - VBA assignment causing program to crash but only in presentation view -

i trying debug user form powerpoint. seems working when run directly using run button in editor. when try run presentation mode using button fixed in masterslide program seems crash suddenly. form run , when press ok first message box used debugging show , nothing. here code private sub okbut_click() ' message box working msgbox ("okbut running") dim oslide slide dim lcurrentview long ' current view type. lcurrentview = activewindow.viewtype 'these message boxes not appear msgbox ("test") msgbox (cstr(lcurrentview)) thanks in advance guys activewindow.viewtype applicable in design mode. when running slide show there no active windows , throw error thats why not hitting message box calls.

objective c - UIApplication is nil within didFinishLaunchingWithOptions -

application object passed onto didfinishlaunchingwithoptions nil when attach process through xcode6. when ran within simulator works fine. i tried explicitly getting uiapplication* uiapplication* app = [uiapplication sharedapplication]; but returns nil. idea doing wrong? started happening after updating base sdk ios8.4. thanks. i found causing issue. using 'xcodebuild' command workaround generate ipa archive since wasn't able through xcode6 (because starting xcode 6 requires ad hoc distribution provisional profile generate ipa ad hoc distribution). once created ios distribution certificate , ad hoc distribution provisional profile. able export archive create ipa through xcode , no longer had issue.

java - Spring Boot 1.2.2 application deployed on Tomcat 7.0.57 does not start -

i wrote spring boot app. when put war webapps folder of local test tomcat 7.0.57 (xampp) gets deployed , starts right away. when same on dedicated test server same tomcat version server deploys application not start it. when try reach application via browser 404 in response. someone got idea hinder server starting application? catalina.out log: jul 23, 2015 3:16:12 pm org.apache.catalina.core.aprlifecyclelistener init info: loaded apr based apache tomcat native library 1.1.30 using apr version 1.3.9. jul 23, 2015 3:16:12 pm org.apache.catalina.core.aprlifecyclelistener init info: apr capabilities: ipv6 [true], sendfile [true], accept filters [false], random [true]. jul 23, 2015 3:16:12 pm org.apache.catalina.core.aprlifecyclelistener initializessl info: openssl initialized (openssl 1.0.1e 11 feb 2013) jul 23, 2015 3:16:12 pm org.apache.coyote.abstractprotocol init info: initializing protocolhandler ["ajp-apr-5009"] jul 23, 2015 3:16:12 pm org.apache.catalina.startup

python - Introducing the login required decorator on my pagelogin view -

how can protect the login_dash.html page redirected on login after being successful. not sure apply @login_required decorator since redirect html page. help/contribution community highly appreciated. below views code snippet: def logins(request): context =requestcontext(request) if request.method == 'post': username = request.post['username'] password = request.post['password'] user = authenticate(username=username, password=password) if user not none: # account active? have been disabled. if user.is_active: # if account valid , active, can log user in. # we'll send user homepage. login(request, user) return render(request,'login-dash.html') #if accounts.accttype == business: #return render_to_response('business.html') #else: #return render_to_response('login-dash.html') else: # ina

angularjs - How to send search id to `$resource` prodiver? -

when user lick on element, changing search params. after updating search params, url location changing : http://localhost:3000/#/projectsummary/1?id=3 now how send $routeparams this? http://localhost:3000/#/projectsummary/1/3 here try : $scope.conractorinfo = function ( contractor ) { $location.search('id', contractor.id); //setting id console.log($routeparams.id) //getting `1` not 1/3 !? server.contractor.get({id:$routeparams.id+'/'+contractor.id}).$promise.then(function (data) { console.log(data); }); } here server.js (function () { "use strict"; angular .module("tcpapp") .factory("server", ['$resource', function ($resource) { var base = 'http://azvsptcsdev02:678/_vti_bin/cpmd.webservice/projectinfoservice.svc/'; console.log(base + 'getprojectdetails')

javascript - How to show hidden div after hitting submit button in form? -

i have simple html form submit button. after hitting button see div#my_id not visible before. <input type="submit" name="xxx" value="yyy" onclick="document.getelementbyid('my_id').style.display = 'block' ;"> <div id="my_id" style="display: none"> text </div> how can make work? is html contained within <form> tag? submit button submitting form , causing page refresh before javascript executed. if case, try changing input type button see effect. for example: #my_id { display: none; } <form> <input type="button" name="xxx" value=" show text! " onclick="document.getelementbyid('my_id').style.display = 'block' ;" /> <div id="my_id"> text </div> </form>

javascript - Revolution Slider - Advance once per mouse scroll -

edit: revolution slider updated version 5 default supports mouse scrolling between slides without need additional javascript user , i've found work flawlessly. original question: i'm using full screen revolution slider , using code found on developers site i've managed slides advance using mousewheel scroll. the problem slider advancing more 1 slide @ time depending on how user scrolls. need slide scroll once per mousewheel event. tried using solution found here couldn't work: removing event after 1 scroll i'm new javascript appreciated. here code using (function() { var slider = revapi1; slider.parent().on('mousewheel dommousescroll', function(event) { if(event.originalevent.wheeldelta > 0 || event.originalevent.detail < 0) { slider.revprev(); } else { slider.revnext(); } }); })() revprev() , revnext() moves happen. deeper should find speed , steps_length ...

android - Fragment BackStack doesn't work properly -

overview hi there, i'm trying develop android app new material design , compatipility api15. time use 1 activity , multiple fragments replacing them in activity. while doing so, i've run in multiple problems i've either solved or didn't reappeared... however, still have problem backstack in fragmentmanager. seems button , icon in toolbar (not actionbar!) not working properly. have feeling, problem somehow caused due use of appcompatactivity. btw: since find hard understand whats right way code api22 android app one activity/ multiple fragments , every tip/critique guys welcome! problem back button , icon in toolbar not working. when open settings via toolbar, neither button nor icon in toolbar brings me previous fragment. icon in toolbar doesn't , (software) button closes app code mainactivity public class mainactivity extends appcompatactivity { @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedi

How to prevent Android Material DatePickerDialog from selecting future dates -

Image
i trying create datepickerdialog not allow user select in future. see many solutions should use setmaxdate(system.currenttimemillis()); not work material dialog thing. prevent user select beyond current month, future dates in month grayed out still selectable. see code below. datepickerdialog dialog = new datepickerdialog(rootview.getcontext(), new datepickerdialog.ondatesetlistener() { @override public void ondateset(final datepicker datepicker, final int year, final int monthofyear, final int dayofmonth) { datetime = datetime.withyear(year); datetime = datetime.withmonthofyear(monthofyear + 1); datetime = datetime.withdayofmonth(dayofmonth); if (datetime.isafter(datetime.now())) { datetime = new datetime(); snackbar.make(rootview, r.string.future_date_not_allowed, snackbar.length_long).show(); } setdatetime(datetime); } }, datetime.getyear(), datetime.getmonthofyear() - 1, datetime.getdayof

java - How to create a Multipart request using WLResourceRequest in Android -

i've created java adapter accepts multipart form data. want create multipart request native android app. i'm not able figure out how construct multipart request using wlresourcerequest class in mobilefirst api. example or pointer in direction appreciated. in advance! you needn't via wlresourcerequest in client-side. imo should similar this: // create request send final httppost post = new httppost("your-destination"); // construct body of object... ... ... // send request , response httpresponse response = client.execute(post); if have security involved, may want read following documentation (think post instead of get): http://www-01.ibm.com/support/knowledgecenter/sshs8r_7.0.0/com.ibm.worklight.dev.doc/dev/c_custom_request_to_resource_java.html?lang=en

Match x out of y groups in Java regex -

is possible write regex pattern in java match, example, 2 out of 3 (or 3 out of 4 etc) groups? for example, have following regex: ((?=.*\d)(?=.*[a-z])(?=.*[a-z])) which allow patterns match 3 groups - i.e. must contain number , lowercase character , uppercase character. i'd make validate pattern contains @ least 2 out of 3 groups (e.g. number , uppercase character or lower , uppercase characters). is doable in single statement or going have write separate regexes , loop through them? you need alternations account possible scenarios: ((?=.*\d)(?=.*[a-z])|(?=.*\d)(?=.*[a-z])|(?=.*[a-z])(?=.*[a-z])) see demo matches whole string matches() : ((?=.*\d)(?=.*[a-z])|^(?=.*\d)(?=.*[a-z])|^(?=.*[a-z])(?=.*[a-z])).*

neo4j - GrapheneDB vs Graph Story on Heroku -

i have no experience graph db applications i'm trying write one. intend host on heroku . i can see there 2 graph db service providers free plans can't decide 1 use, both marketing using different attributes, , can't compare ! example: graphenedb mentions node , relationship count limit, , query time limit. nothing storage limit. graph story mentions ram limit, `storage limit , data transfer limit. other properties mentioned aren't comparable between both providers. has tried of these services on heroku , share experience please ? edit : found this page give idea how space neo4j need. i'll take spin @ answering question staying as objective possible, as, , other frequent answerers here, have relationships both providers. both have own pro's , con's, , think looking @ heroku side maybe not choice. there 1 difference between both need know, graphstory provide neo4j enterprise while graphenedb provide neo4j community, fact. thin

javascript - PHP JSON Post string from Textbox (Searchbox) and return result in textbox as string -

i trying create simple webpage goggle, user type there search e.g "what england?" , json post string searchbox specified url (for e.g. goggle search api) username , password authentication , return result given url webpage answer. i need simple idea of sample code. new in php you can using ajax, can in jquery easy search jquery docs, can in many other ways pure js... edit: here simple example , <html> <head> <title>search example</title> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script> <script src="./content.js"></script> </head> <body> <input type="text" id="searchinput" /> <input type="submit" id="searchsubmit" value="click search" /> </body> </html> and jquery code (content.js): $(document).ready( function() { $('#searchsubmit').on(&#

How to reinitialize the LoggingSystem in Spring Boot? -

spring boots loggingsystem abstraction has no reload/reinitialize method. there way of reinitializing loggingsystem (regardless of underlying implementation)? what want achieve: registering sighup-signalhandler triggering loggigsystem-reinit log-filhandles closed , reopend logrotate can rotate logfiles.

ofbiz - Get SQL command from EntityCondition -

i have entitycondition , want sql it. for ex: entitycondition: partyid = 'admin' -> sql: party_id = 'admin' i have tried find in ofbiz project, have not found anything. there's general rule in ofbiz: entities , fields defined in camelcase, partyattribute or productid. entities begin uppercase letter (like java class) , fields begin lowercase letter (like java class attribute). an uppercase letter inside entity or field converted "_[lowercase]". so entitycondition: partyid = 'admin' -> sql: party_id = 'admin' a full select entity partyattribute be select * party_attribute party_id = 'admin' you may try makewherestring(modelentity modelentity, list<entityconditionparam> entityconditionparams, datasourceinfo datasourceinfo) to achieve programmatically, haven't tried it.

ios - Adding user before app actually start -

i'm trying add user first time app opened. adding response me sort of password, call access token. token using reaching api services. anyway, beside story, problem first time app open, can add user , token , saved nsuserdefault, can't reach api services since tries reach services null. after refreshing or reopening app or switching view , view solve issue. first time, can't reach service. the problem here, obviously, when app opens first time, before adding operation finished, try reach service cause stay null. here code have: - (void)viewdidload { [super viewdidload]; //adding user. nsuserdefaults *defaults = [nsuserdefaults standarduserdefaults]; // user informations. nsstring *accesstoken = [defaults objectforkey:@"accesstoken"]; if(accesstoken == nil) [apiclient adduser]; //adding inital viewcontroller. uiviewcontroller *vc = [self viewcontrollerforsegmentindex:self.typesegmentedcontrol.selectedsegmentindex];

SharePoint Development using Angular JS and .Net Web Api -

i creating site in sharepoint using angular js , communicate .net web api. the web api pull data database , give sharepoint site. but not getting response .net web api. goes inside web api call , returns data no response coming in sharepoint site. the error "xmlhttprequest: network error 0x80070005, access denied". have tried sending data web api in jsonp format of no success. if try make call through html page outside of sharepoint server, response. below code snippet using in code make call. $http.get('url') .success(function (response) $scope.members = response }).error(function (status) { })

ip address - retrieve client IpAddress in WCF service -

i trying utilise wcf service built in .net 4.0 custom business functionality in html page (using jquery) , want retrieve client ipaddress in wcf service whoever trying access service through defined html page. wcf service , html page (utilising wcf service) setup/ hosted on same windows server machine(s) virtuals in iis. in process using below code in wcf service retrieve ipadress information of client. code: operationcontext context = operationcontext.current; messageproperties properties = context.incomingmessageproperties; remoteendpointmessageproperty endpoint = properties[remoteendpointmessageproperty.name] remoteendpointmessageproperty; string address = endpoint.address; there load balancer configured (where service deployed on 2 server machines) , utilising virtual url access wcf service. when trying access wcf service through machine name, service able retrieve client ipaddress correctly, when use virtual url (where requests can processed load balancer on of conf

php - Opencart frond-end works well but admin returns blank page -

Image
i confused opencart website, migrated website ftp server localhost using mamp couldn't work since /admin returns me black page. have checked php logs: [23-jul-2015 12:48:16 europe/paris] php notice: undefined index: in /applications/mamp/htdocs/uta/admin/index.php on line 151 [23-jul-2015 12:48:16 europe/paris] php notice: undefined index: in /applications/mamp/htdocs/uta/admin/index.php on line 152 [23-jul-2015 12:48:16 europe/paris] php notice: undefined index: in /applications/mamp/htdocs/uta/admin/index.php on line 156 [23-jul-2015 12:48:16 europe/paris] php notice: undefined index: in /applications/mamp/htdocs/uta/admin/index.php on line 157 [23-jul-2015 12:48:16 europe/paris] php notice: undefined index: in /applications/mamp/htdocs/uta/system/library/translation.php on line 371 [23-jul-2015 12:48:16 europe/paris] php notice: undefined index: in /applications/mamp/htdocs/uta/system/library/translation.php on line 371 [23-jul-2015 12:48:16 europe/paris] php n

malloc - In C, free half of the memory chunk, without freeing the other half -

if have allocated memory chunk char *a =(char*)malloc(sizeof(char)*10); and strcpy( "string of len 5",a); then there way free left on part of memory chunk? in other scenario if strcpy("string of len5", (a+5)); then first half empty. there way free() first part without deallocating second half? please don't suggest realloc() allocates new chunk of memory copy content there , release previous.(akaik). no, there no way can free() half or part of dynamically allocated memory. need free() all @ time. while getting memory through dynamic memory allocation, pointer. need pass exact pointer free() . passing pointer free() not returned malloc() or family, undefined behaviour . fyi, see related answer .

javascript - Angular drag and Drop to iframe -

i'm beginner (and not english) need tutorial or angular drag , drop iframe , generate html not use jquery, same http://78.110.163.229/angdnd/outer.html tks all let me share 2 simple , great toturiol make application drag , drop angularjs https://www.codementor.io/angularjs/tutorial/how-to-build-drag-and-drop-directives-library http://marceljuenemann.github.io/angular-drag-and-drop-lists/demo/#/nested

google crawlers - What happens when GET robots.txt returns an unrelated html file? -

i have web server capable of serving assets of various web apps. when requested asset doesn't exist, sends index.html. in other words: get /img/exists.png -> exists.png get /img/inexistent.png -> index.html this means that: get /robots.txt -> index.html how google (and other) crawlers handle this? detect robots.txt invalid , ignore (same returning 404)? or penalize ranking serving invalid robots.txt? acceptible, or should make point of returning 404 when app i'm serving has no robots.txt? every robots.txt handler know of deals invalid lines discarding them. html file (which presumably not contain valid robots.txt directives) treated if blank file. not part of official standards, though. (semi-)official standard assumes robots.txt file contain robot.txt directives. behavior robots.txt file contains html undefined. if care crawlers, bigger problem not serve invalid robot.txt file, it's have no mechanism tell crawlers (or else) when resource

Averaging multiple images in python -

i'm trying average 300 .tif images code : import os, numpy, pil pil import image # access png files in directory allfiles=os.listdir(os.getcwd()) imlist=[filename filename in allfiles if filename[-4:] in[".tif",".tif"]] # assuming images same size, dimensions of first image w,h = image.open(imlist[0]).size n = len(imlist) # create numpy array of floats store average (assume rgb images) arr = numpy.zeros((h,w,3),numpy.float) # build average pixel intensities, casting each image array of floats im in imlist: imarr = numpy.array(image.open(im),dtype=numpy.float) arr = arr+imarr/n # round values in array , cast 16-bit integer arr = numpy.array(numpy.round(arr),dtype=numpy.uint16) # generate, save , preview final image out = image.fromarray(arr,mode="rgb") out.save("average.tif") and gives me typeerror : imarr = numpy.array(image.open(im),dtype=numpy.float) typeerror: float() argument must string or number, not 'tiffim

ios - CTCallCenter callEventHandler is never called -

i try use ctcallcenter receive incoming call iphone. while application active call device , nothing happens calleventhandler not invoked. what can reason? i use ios9.0 beta3 installed on iphone 5 , xcode7. my code: - (void)viewdidload { [super viewdidload]; ctcallcenter *callcenter = [[ctcallcenter alloc] init]; callcenter.calleventhandler = ^(ctcall* call) { if (call.callstate == ctcallstatedisconnected) { nslog(@"call has been disconnected"); [self showmessage:@"call has been disconnected"]; } else if (call.callstate == ctcallstateconnected) { nslog(@"call has been connected"); [self showmessage:@"call has been connected"]; } else if(call.callstate == ctcallstateincoming) { nslog(@"call incoming"); [self showmessage:@"call incoming"]; } else { nslog(@"none of conditions"); [self showmessage:@&quo

html - 1px vertical lines appearing on website using Chrome on rMBP -

Image
when browsing website developed on chrome on retina macbook pro, these vertical lines appear on page. website uses cool parallax techniques, , these vertical lines make background transparent, can see background layer beneath them, annoying. if turn off background, can still see lines, they're white, not background colour. website www.1000days.me , below have included screenshot (from chrome emulator don't have rmbp). there container inside each <section> (every time background colour changes, it's new <section> ) these lines outside boundary lines of container. also, can't confirm this, on different resolutions, lines seem in different places. edit: appears on opera (i assume because uses blink), doesn't appear on safari, firefox or internet explorer.