Posts

Showing posts from February, 2010

android - App crashes when adding AutoCompleteTextView in PopupWindow? -

hello want add autocompletetextview in popup. such when type city name should come suggestion.. possible in popupwindow. trying this. view addresspopupview =addresslayoutinflater.inflate(r.layout.addressinput, null); autocompletetextview city = (autocompletetextview) addresspopupview.findviewbyid(r.id.city); string[] city ={"mumbai", "ahemadabad", "kolkata", "chennai", "thane"}; arrayadapter<string> adapter = new arrayadapter<string>(getactivity(), android.r.layout.simple_dropdown_item_1line, city); city.setadapter(adapter); popupwindow addresspopupwindow = new popupwindow(addresspopupview, viewgroup.layoutparams.wrap_content, viewgroup.layoutparams.wrap_content, true); addresspopupwindow.showatlocation(addresspopupview, gravity.center, 0, 0); logcat fatal exception: main android.view.windowmanager$badtokenexception: unable add window -- token android.view.viewro...

c++ - constexpr if and static_assert -

p0292r1 constexpr if has been included , on track c++17. seems useful (and can replace use of sfinae), comment regarding static_assert being ill-formed, no diagnostic required in false branch scares me: disarming static_assert declarations in non-taken branch of constexpr if not proposed. void f() { if constexpr (false) static_assert(false); // ill-formed } template<class t> void g() { if constexpr (false) static_assert(false); // ill-formed; no // diagnostic required template definition } i take it's forbidden use static_assert inside constexpr if (at least false / non-taken branch, in practice means it's not safe or useful thing do). how come standard text? find no mentioning of static_assert in proposal wording, , c++14 constexpr functions allow static_assert (details @ cppreference: constexpr ). is hiding in new sentence (after 6.4.1) ? : when constexpr if statement appears in templated entity, during inst...

super in python 2.7 -

this question has answer here: python super __init__ inheritance 2 answers i'm trying understand how use super in python class people: name = '' age = 0 __weight = 0 def __init__(self,n,a,w): self.name = n self.age = self.__weight = w def speak(self): print("%s speaking: %d years old" %(self.name,self.age)) class student(people): grade = '' def __init__(self,n,a,w,g): #people.__init__(self,n,a,w) super(student,self).__init__(self,n,a,w) self.grade = g def speak(self): print("%s speaking: %d years old,and in grade %d"%(self.name,self.age,self.grade)) s = student('ken',20,60,3) s.speak() the above code gets following error: --------------------------------------------------------------------- typeerror ...

C#: Save embedded Image from Outlook MailItem -

i'm trying save embedded image outlook mailitem (html-body), don't find in property embedded image stored , how can save it. i have tried image property .attachments (i have tried index 0) exception thrown array-index out of range. means, there no attachment in e-mail. but if image not stored in "attachments" image stored , how can save filesystem? thank in advance answers! best regards matthias i have found solution myself. the problem was, accessing mailitem other thread. don't know why thread can't see attachments. after putting mail-reading-part inside this.dispatcher.invoke(new action(() => { ... })); it works fine. can access inline image code... if (mail.attachments.count > 0) { (int = 1; <= mail.attachments.count; i++) { mail.attachments[i].saveasfile(@"c:\test\" + mail.attachments[i].filename); } }

stringr - R: Select strings that have the same general pattern -

i have list of strings follows: > with(providers, head(provider.name, 30)) [1] 1st care (uk) limited [2] 1st care limited [3] 229 mitcham lane limited [4] 24-7 care ltd [5] 3 dimensions care limited [6] 3 trees community support limited [7] 365 care homes limited [8] 3a care (solihull) limited [9] 3l care limited [10] 5 star tlc limited [11] 92 higher drive limited [12] & care home ltd [13] & l care homes limited [14] & n kachra [15] & r care limited [16] better carehome ltd [17] a.g.e. nursing homes limited [18] a.r.m. healthcare limited [19] aaa elderly care limited [20] aaa medics ltd [21] aadams residential care ho...

regex - Extract informations from a string in Python? -

i have string , extract information inside it. for example have this: 'won 3 oscars. 80 wins & 121 nominations.' and split in order list this: ['3 oscars', '80 wins', '121 nominations'] how do in python? thanks a number followed space , word , word boundary . should do: import re s = 'won 3 oscars. 80 wins & 121 nominations.' p = re.compile(r'\d+\s\w+\b') print(p.findall(s)) # ['3 oscars', '80 wins', '121 nominations']

angularjs - Angular material calendar enabled days and services -

i'm trying use angular material's calendar enabled / disabled days. need read enabled days using rest webservice, implemented angular service operation it. problem calendar tries use function calculates if day enabled or not before service returns data. i tried using 'resolve' in state (service called synchronously before controller rendered), value not inyected. how should it? i'm using angular 1.5 typescript. thanks in advance

json - Sorting an array of JavaScript objects according to date -

i have file json: var point = [{ "id": 1, "name": "a", "lastupdate": "2016-07-08", "position": [36.8479648, 10.2793332]},{ "id": 1, "name": "a", "lastupdate": "2016-07-07", "position":[ 36.8791039, 10.2656209]},{ "id": 1, "name": "a", "lastupdate": "2016-07-09", "position": [36.9922751, 10.1255164]},{ "id": 1, "name": "a", "lastupdate": "2016-07-10", "position": [36.9009882, 10.3009531]},{ "id": 1, "name": "a", "lastupdate": "2016-07-04", "position": [37.2732415, 9.8713665]}]; how can sort objects lastupdate(it's date) property in ascending , descending order using javascript? try this point.sort(function(a, b) { return (new date(b.lastupdate)) - (new date(a.lastup...

nightwatch.js - How to use retryAssertionTimeout in nightwatchjs -

in nightwatch api reference ( http://nightwatchjs.org/api#assertions ) show can use retry assertions, not how define it. path global variables set in nightwatch.json: "globals_path" : "data/ftm_data.js", in ftm_data.js defined: retryassertiontimeout = 2000 module.exports = { url:'https://10.99.8.81', userstocreate:[ {..... and on. doesn't work. can me? thank you! the retryassertiontimeout = 2000 should in module.exports = { module.exports = { retryassertiontimeout: 2000, url:'https://10.99.8.81', userstocreate:[ {..... }; additionaly, can configure in nightwatch.json. (further reading http://nightwatchjs.org/guide#test-settings there. "globals" in test settings place should then, per environment) if defined in nightwatch.json win! also careful: if use retryassertiontimeout globally, define in assertion, win.

django - djangocms 3.2 page level -

i've upgraded django-cms powered application 2.4 3.2 , want show submenu of djangocms page this: {% extends "layouts/base.html" %} {% load cms_tags menu_tags %} {% block 'content' %} {% page_lvl=request.current_page.level %} {% show_sub_menu 1 page_lvl 1 'menues/cms_submenu.html' %} {% endwith %} {% endblock %} however, current_page.level seems none - code worked in 2.4, seems page no longer has .level attribute. did go to? as turns out, djangocms switched mptttree to treebeard . result, information stored in .depth attribute instead .level - there offset compared .level of 1 (so .level 3 .depth 4).

sql - Select data from multiple tables and grouping in mysql -

this part of assignment working on. have database named company , there 6 tables employee departments dept_emp titles salaries dept_manager now have list number of engineers in each department. i came following query: select departments.dept_name department_name, count(titles.title) no_of_engineers departments, titles titles.emp_no = dept_emp.emp_no , dept_emp.dept_no = departments.dept_no , titles.title "% engineer %" group departments.dept_no; but gives me error unknown column 'dept_emp.emp_no' in 'where clause' but dept_emp table has column named emp_no . can see error in this? in advance you missing join dept_emp : select departments.dept_name department_name, count(titles.title) no_of_engineers departments inner join dept_emp on(dept_emp.dept_no = departments.dept_no) inner join titles on(titles.emp_no = dept_emp.emp_no) titles.title "% engineer %" group depart...

actionscript 3 - AS3: draw 2d DisplayObjects UNDER stage3ds -

Image
is there way draw 2d displayobjects under stage3ds? mean, flash' stage allways upper stage3ds: can create stage below stage3d[0]? or other way?

c# - Dialogbox bug (Xamarin Android) -

i have following code passes intent whether select_image or request_camera. in case, after adding image gallery, item added on listview. protected override void onactivityresult(int requestcode, result resultcode, intent data) { // ................ // if (resultcode == result.ok) { if (requestcode == request_camera) { // ...................// } else if ((requestcode == select_file) && (data != null)) { android.net.uri uri = data.data; string imguri = convert.tostring(uri.lastpathsegment); string senduri = convert.tostring(uri); myfilelistadapter.add(senduri); myfilelistadapter.notifydatasetchanged(); setlistviewheightbasedonchildren(listviewfiles); if (myfilelistadapter.count == 5) { btnadd.enabled = false; ...

javascript - Convert base64 to file type in React cropper js? -

i have created crop functionality using react cropper js. need send image file type. i'm able base64 string cropped image. when submit cropped image need send file type. here have included code crop function. how send cropped area image file? here code, var react = require('react'); var cropper = require('react-cropper').default; var myprofileedit = react.createclass({ getinitialstate:function(){ return { open:false, src:"", cropresult: null } }, onchange:function(e){ var self = this; $("#photo").val(''); function readurl(input) { if (input.files && input.files[0]) { var reader = new filereader(); reader.onload = function (e) { self.setstate({ open:true, src: reader.result }); } ...

c# - How to make an asp website in fullscreen? -

i want create new web site, want display pages in full screen mode , allow user achieve desktop when website running in 1 case write correct password. my opinion create single page , want opinions . how can this, suggestions? you trying go out of bounds of control of browser , force aren't allowed to. happen think when malicious site that? the best option have now, use html5 fullscreen api , leaves control @ user go out of full screen mode or deny site go full screen mode, still gives developer chance build apps used in sort of kiosk mode. if want go further, have create desktop application full control on os.

Populating a table with all dates in a given range in Google BigQuery -

is there convenient way populate table dates in given range in google bigquery? need dates 2015-06-01 till current_date(), this: +------------+ | date | +------------+ | 2015-06-01 | | 2015-06-02 | | 2015-06-03 | | ... | | 2016-07-11 | +------------+ optimally, next step weeks between 2 dates, i.e.: +---------+ | week | +---------+ | 2015-23 | | 2015-24 | | 2015-25 | | ... | | 2016-28 | +---------+ i've been fiddling around following answers found, can't them work, because core functions aren't supported , can't find proper ways replace them. easiest way populate temp table dates between , including 2 date parameters generate dates between date ranges your appreciated! best, max all dates 2015-06-01 till current_date() select date(date_add(timestamp("2015-06-01"), pos - 1, "day")) day ( select row_number() over() pos, * (flatten(( select split(rpad('', 1 + datediff(timestam...

Spring Integration Multiple Endpoints -

currently working on spring integration application has following scenario. there transformer transforms incoming message in particular object type once transformation done, need write log file , database table , send jms outbound adapter. i reading spring integration reference , found out there 2 ways can approach scenario. introduce pub-sub channel output channel of above mentioned transformer , have file-outbound, db-outbound , jms-outbound subscribers. introduce recipient list router after transformer , specify file-outbound, db-outbound , jms-outbound recipients. when comes enterprise integration patterns best way handle scenario? new suggestions , improvements welcome thanks, keth there no "best way" - both solutions equivalent , there little difference @ runtime. it's preference; use pub/sub simple case , rlr if recipients conditional (with selectors).

java - Mockito test overwritten void method -

i'm new java, unit-testing , mockito want test class. class want test: abstract class irc { command received(string data) { // parsing receivedcommand(prefix, command, parameters, trailing, tags); return new command(prefix, command, parameters, trailing, tags); } private void receivedcommand(string prefix, string command, string[] parameters, string trailing, map<string, string> tags) { string nick = getnickfromprefix(prefix); parsed(prefix, command, parameters, trailing); if (command.equals("mode")) { if (parameters.length == 3) { string chan = parameters[0]; string mode = parameters[1]; string name = parameters[2]; if (mode.length() == 2) { string modechar = mode.substring(1, 2); if (mode.startswith("+")) { onmodechange(chan, name, true, modech...

Netty : Set-Cookie in WebSocket Handshake -

my pipeline looks below channelpipeline pipeline = ch.pipeline(); pipeline.addlast(new httpservercodec()); pipeline.addlast(new httpobjectaggregator(65536)); pipeline.addlast(new websocketserverprotocolhandler(websocket_path, null, true)); i want add set-cookie http header in response of handshake. part of rfc6455 the handshake server looks follows: connection:upgrade sec-websocket-accept:t1ugq4hht3dvlnq5yi+i/gfasi8= upgrade:websocket set-cookie: ccc=22; path=/; httponly an unordered set of header fields comes after leading line in both cases. meaning of these header fields specified in section 4 of document. additional header fields may present, such cookies [rfc6265]. i don't find way. did invoking private method via reflection. netty 4.1.2.final first find source code of websocketserverprotocolhandshakehandler class. class non-public, make copy of class , modifies basing on it. class customwebsocketserverprotocolhandsha...

php - How to correctly setup the eloquent relationships for pivot tables in Laravel 5.2 -

i have 3 tables in db follows (not of columns minimised clarity): admins (id, community_id, email, password, level) community (community_id, community_name) community_results (community_result_id, community_session_id) community_sessions (community_session_id, community_id) i have setup associated models , within admin controller have following code grabs results in database laravel collection (and works fine). admin table contains 2 types of admin user - 1 'superuser' has access every single row in db, , other type 'community admin' , have access community results (defined level column in admins table). when logged admin 'community admin' want results community (admins.community_id foreign key in instance relates admin community). e.g john doe 'community admin' 'acme community' , belongs community_id 5, when logged in 'community results' of 'community sessions' relate particular community (community_id foreign key in ...

GIT command to display all user for a repo with access rights -

i newbie in git. can tell me command display users repository access rights (read, write)? git shortlog -sn displays list of users sorted number of commits list developers on project in git

mule - fetching index of an element in dataweave -

how fetch index of element of array in dataweave.(mule) ex: array --> ["a","b","c","d"] element --> c need fetch index of element "c" you can do payload find "c" that return array indexes match "c"

How to call python function from java code without use of jpython -

i trying call python code java code , without use of jpython, code contains numpy, scipy , other module not available on jpython, more on want create api of python code java. do want them run in 2 different processes? if yes, can consider inter process communication socket programming.

regex - regular expression to avoid complete match -

i want extract id , type of objects (e.g. regions , countries) available=true . used regular expression {"name":".+?","id":"(.+?)","type":"(.+?)","available":true . i'm getting complete row starting name ...{other stuff in middle}... available =true includes other ids/names available=false well. sample data below { "error":null, "data":{ "airports":[], "pocs":[], "regions":[ { "name":"central america", "id":"l04305", "type":"cruisearea", "available":false, "countries":"mexico", "group":null }, { "name":"caribbean", "id":"l04304", "type":"cruisearea", "available":false, ...

entity framework - EF6 - Lazy Loading does not work anymore -

when create new entity , save changes database, i'm not able lazy load navigation properties. lazyloading , proxycreation enabled on context. has been working in past, after refactoring, not work anymore (refactoring did no include refactoring of context class). when try load entity, navigation properties got following error: 'executereader requires open , available connection. connection's current state closed.' thanks

angular2 routing - How do I extend routerOutlet in angular 2 rc4 -

import { viewcontainerref, componentfactoryresolver, directive, resolvedreflectiveprovider} '@angular/core'; import { router, routeroutlet, activatedroute, routeroutletmap } '@angular/router'; @directive({ selector: 'router-outlet' }) export class applicationrouter extends routeroutlet { publicroutes: array; private parentrouter: router; private router: router; constructor(parentoutletmap: routeroutletmap, location:viewcontainerref, componentfactoryresolver: componentfactoryresolver, name: string) { super(parentoutletmap, location, componentfactoryresolver, name); this.router = _parentrouter; } activate(activatedroute: activatedroute, providers: resolvedreflectiveprovider[], outletmap: routeroutletmap) { debugger; // return super.activate(instruction); } } i don't know types super class instantiated, purpose move authorization router level. are interested on extending rou...

java - Classes Relationships with JPA -

Image
i have set of java classes following uml diagram: public class invoice { @id private long id; ... } public class invoicedetail { @id private long id; ... private string productname; private int quantity; private double price; } my purpose using jpa annotations establish different relationships between them. there composition relationship between invoice , invoicedetail, resolved using @embedded , @embeddable annotations invoice , invoicedetail respectively. however, problem appears establishing relationships between invoicedetail, class3 , class4. in these relationships invoicedetail must annotated @entity. however, when class annotated @ same time @entity , @embeddable, corresponding server throw runtime error during deployment. basing on information of website , have written following possible solution: @entity public class invoice { @id private long id; ... @eleme...

Kotlin recommended way of unregistering a listener with a SAM -

so have interactor performs insert operation realm , notifies insertion completed realchangelistener. this: fun insertcar(item: car) { realm.dointransaction { val car = car(...) val copy = copytorealm(car) copy.addchangelistener(...) } } i can way: fun insertcar(item: car, listener: realmchangelistener<car>) { realm.dointransaction { val car = car(...) val copy = copytorealm(car) copy.addchangelistener(listener) } } and access this: realminteractor.insertcar(item, realmchangelistener { // here }) but have no way of removing listener realminteractor.insertcar(item, realmchangelistener { // here it.removechangelistener(this) }) this point class located not actual listener i can this: fun insertcar(item: car, doafterchange (car) -> unit) { realm.dointransaction { val car = car(...

pass PHP variable from form handling generated json to javascript ajax -

i'm learning php , javascript. have little extraction project reading json url. form serves building url user inputting keyword. i want output json parsed specific fields when works , simple message when there no results. but can't pass sending json php object html javascript variable use (json.parse(myjsvar)) ajax stuck. code above doesn't seem respond using $.post ('button").click, neither when tried give id , call id. perhaps following should in php , have include or require existing php page above : $newsearch= new progsearch(); $found= json_encode($newsearch->search($search_string)); echo $found; // json expected so if correct use shorter 1 in ajax call json output. i tried tutorial using ajax nothing got return here's original+edited code process form data url , parse retrieve json response in php. extract.php <?php class progsearch { public $search_string; public function __construct() { if(isset($_post["sear...

java - RegEx Exepression not matching -

i have following text chapter 1 introduction chapter overview which did create , tested ( http://regexr.com/ ) following regex for (chapter\s{1}\d\n) however when use following code on java fails string text = stripper.gettext(document);//the text above pattern p = pattern.compile("(chapter\\s{1}\\d\\n)"); matcher m = p.matcher(text); if (m.find()) { //do action } the m.find() returns false. your document may have dos line feed \r well. can use either of these patterns: pattern p = pattern.compile("chapter\\s+\\d+\\r"); \r (requires java 8) match combination of \r , \n after digits or use: pattern p = pattern.compile("chapter\\s+\\d+\\s"); since \s matches whitespace including newline characters. another alternative use multiline flag anchor $ : pattern p = pattern.compile("(?m)chapter\\s+\\d+$");

Reading a serial port in python with unknown data length -

hello trying read data pic32 microcontroller configured serial port. the pic32 sends "binary" data variable in length (14 26 bytes long). want read in data , separate bits convert them decimal equivalent. import serial import csv #open configuartion file open('config.txt') configfile: #save config parameters array called parameters parameters = configfile.read().split() #function initialize serial port def init_serial(): global ser ser = serial.serial() ser.baudrate = 9600 ser.port = 'com7' ser.timeout = 10 ser.open() if ser.isopen(): print ('open: ' + ser.portstr) #call serial initilization function init_serial() #writes lines config file serial port counter = 0 while counter<4: ser.write(chr(int(parameters[counter])).encode('utf-8') + chr(int(parameters[counter+1])).encode('utf-8')) counter = counter + 2 #opens csv file append resultsfile = open('results.csv', ...

javascript - A simple drawing program -

i need draw circle , rectangular on picture on webpage, for this, found out programs , open source projects, zwibbler , literally canvas however, lack of features i need take coordinates of drawn circles , rectangulars i couldn't find application operation. if know , comment glad thanks in advance take code, paste in html file, run browser, , see happens, not going explain it, please take @ documentation of zwibbler , see here taken there. <html> <body> <script src="http://zwibbler.com/zwibbler-demo.js"></script> <div id="zwibbler1" style="width:800px;height:500px"></div> <script> var ctx = zwibbler.create("zwibbler1", {}); ctx.on('document-changed', function() { var firstselectednode = ctx.getselectednodes()[0]; if (!firstselectednode) return; var bounds = ctx.getnoderectangle(firstselectednode) document.getelementbyid(...

android - set marker at autocomplete search location -

i have onplaceselected(place place) method in main activity want use in map fragment, set marker position on selected location.map fragment fragment in main activity(in navigation drawer),how can here code.. @override public void onplaceselected(place place) { log.i(tag, "place selected: " + place.getname()); // format returned place's details , display them in textview. mplacedetailstext.settext(formatplacedetails(getresources(), place.getname(), place.getid(), place.getaddress(), place.getphonenumber(), place.getwebsiteuri(),place.getlatlng())); final charsequence name = place.getname(); final charsequence address = place.getaddress(); final latlng location = place.getlatlng(); appconstants.show_search_location=address; appconstants.show_search_latlng=location; log.d("placedetails",name+","+address+" "+location); charsequence attributions = place.getattributions(); if (!textu...

python - Facebook API: how to paginate comments -

i use facebook-sdk witn python 3 http://facebook-sdk.readthedocs.io/en/latest/api.html i can paginate posts time: paging_next = gp.get_connections(url, 'feed', until=timestamp_until_list[1], **kwargs)['paging']['next'] but comments doesn't have until, have ['paging']['cursors']['after'] , ['paging']['cursors']['before']. when try next paging_next = gp.get_connections(id=post_id, connection_name='comments', limit=100, **kwargs)['paging']['cursors']['after'] # working, result 'mqzdzd' then pass 'mqzdzd': paging_next2 = gp.get_connections(id=post_id, connection_name='comments', after=paging_next, **kwargs) result empty list [] what doing wrong?

Outputting environment variables from MSBuild .targets files -

suppose had .targets files called part of long chain of build related scripts, , used environment variable. suggest way debug build process , check variable's value once file reached build process? environment variables "read" msbuild @ start of build process, i.e. when invoke msbuild.exe. accessible properties same name environment variable (e.g. $(path) ). thus, sufficient list variables right @ startup, if need known values of environment variables. in general start msbuild /v:diag . output like: microsoft (r) build engine version 14.0.25420.1 copyright (c) microsoft corporation. rights reserved. c:\program files (x86)\msbuild\14.0\bin\msbuild.exe /v:diag .\clrinfo32.csproj build started 12.07.2016 14:51:35. environment @ start of build: activelanguage = en-us allusersprofile = c:\programdata appdata = c:\users\foobar\appdata\roaming ... note however, value of environment variable stay same whole build process (*), interesting question value of msb...

r - replace only date in PosixCt class -

i have large dataframe of dates in posixct format. objective simple: change of dates 1 day - 2016-05-01 - while keeping of times same. how proceed replace first 10 characters in string (of every row) if convert sample$newtime character? > class(sample$newtime) [1] "posixct" "posixt" > head(sample) newtime 1 2016-05-01 02:25:34 2 2016-05-01 02:20:23 3 2016-05-01 02:13:58 4 2016-05-01 02:10:33 5 2016-05-01 02:07:36 6 2016-05-01 02:03:01 > dim(sample) [1] 92020 1 > range(sample$newtime) [1] "2015-01-01 01:04:29 msk" "2016-06-15 12:45:03 msk" here alternatives. each changes date part 2016-06-01. no packages used. 1) sub replace leading non-spaces date , convert posixct. note sub automatically converts p character not need explicitly. no packages used: as.posixct(sub("\\s+", "2016-06-01", p)) 1a) similar alternative. replacement converts posixct: repl...

I am trying to store the csv file into an array and then compare each cell by storing it in a temp array and extract into a 1d array or a vector in C# -

var lines = file.readalllines(@"data/ap4.csv"); var pddata = new list<string[]>(); using (var stream_r = new streamreader(@ap4.csv)) { string line; while ((line = stream_r.readline()) != null) { string[] row = line.split(','); pddata.add(row); } } int k = 0; string[][] temp = pddata.toarray(); var se_state = new string[2000]; for(int = 1; i< rowlength;i++) { (int j = 1; j< totalcols; j++) { if(temp[i][j] != "0" && temp[i][j] != se_state[k]) { k++; se_state[k] = temp[i][j]; } } } the error : index outside bounds of array @ if loop , think se_state out of bounds exception. unable check element of temp array array 1-dimensional

qt - Assigning Icons to items in QTreeView -

i have class inheriting qtreeview. need assign icons different types of files , directories. there solution given this question : qvariant myqfilesystemmodel::data( const qmodelindex& index, int role ) const { if( role == qt::decorationrole ) { qfileinfo info = myqfilesystemmodel::fileinfo(index); if(info.isfile()) { if(info.suffix() == "dat") return qpixmap(":/icons/file_icon.png");//i pick icon depending on extension else if(info.suffix() == "mcr") return qpixmap(":/icons/region_icon.png"); } } return qfilesystemmodel::data(index, role); } my class not inherit qfilesystemmodel rather compose in, means cannot overide function data() . above, how icons show up? calling data() in constructor? you need add model tree root node: qstandarditemmodel* model = new qstandarditemmodel; qstandarditem * rootnode = model->invisib...

javascript - Display a sharepoint list row in a table with JS -

i have sharpoint list 1 row containing project info. projectnumber projectname projectadmin contracter , on. want display nice table in teamsite. reckon done display template or javascript. tryed code, returns undefined custom fields please help.. (function () { var itemctx = {}; itemctx.templates = {}; itemctx.templates.header = "<div><b></b></div><table>"; itemctx.templates.item = itemoverridefun; itemctx.templates.footer = "</table>"; itemctx.listtemplatetype = 100; spclienttemplates.templatemanager.registertemplateoverrides(itemctx); })(); function itemoverridefun(ctx) { var var_prnummer = ctx.currentitem.prosjektnummer; var var_prnavn = ctx.currentitem.prosjektnavn; var var_prleder = ctx.currentitem.prosjektleder; var var_endret = ctx.currentitem.endret return "<tr style='background-color: #aee33b;width: 300px;height: 24px;'><td>prosjektnummer</td><td>" +...

c# - DateTime check if it is in UTC format -

i have question date time format. have string, represents datetime: "2014-08-01t10:12:11.0z". actually, understand, datetime in utc format, because 'z' shows me offset utc. and try perform datetime.tryparseexact("2014-08-01t10:12:11.0z", "yyyy-mm-ddthh:mm:ssz", cultureinfo.invariantculture, datetimestyles.adjusttouniversal, out value_); (where value_ newly created datetime object) check if string represents utc time. expression gives me 'false'. so, wonder, format should pass instead of "yyyy-mm-ddthh:mm:ssz" or should change else? the .0 @ end of string tenths of seconds, need add parse character it: f . also, parse character z k , not z . so parse string need this: datetime.tryparseexact("2014-08-01t10:12:11.0z", "yyyy-mm-ddthh:mm:ss.fk", cultureinfo.invariantculture, datetimestyles.adjusttouniversal, out value); also note if want time zone information in string parsed (i.e. if ...

java - Spring boot integration test with SpringApplicationConfiguration doesn't seem to resolve @Value annotation -

i have integration test set like: @runwith(springjunit4classrunner.class) @springapplicationconfiguration(classes = {xmlfilesplitter.class, ...}) public class xmlfilesplittertests { .. in xmlfilesplitter have property annotated @value("${default.output.file}") , value retrieved application.properties . works fine when running app normally. when running integration test, value not resolved (it " ${default.output.file} "). when debugged through code resolving placeholder noticed org.springframework.beans.factory.support.abstractbeanfactory embeddedvalueresolvers empty in test, while containing propertysourcesplaceholderconfigurer when running app normally. i saw normal run has propertyplaceholderautoconfiguration spring-boot-autoconfigure configure propertyplaceholder , figured needed add class springapplicationconfiguration classes have configured integration test. added it: @springapplicationconfiguration(classes = {xmlfilesplitter.class, ... , pro...

Export form in php to text file -

i have project do. need export form file text. project abotu photography web-site,there section our customers can "buy" order filling order form. want save input order form. form <h3>order</h3> <form action="shop.php" method="post"> order number: <input type="text" name="onumber"><br><br> product name: <input type="text" name="product_name"><br><br> customer name: <input type="text" name="name"><br><br> customer number: <input type="text" name="cnumber"><br><br> e-mail: <input type="text" name="email"><br><br> phone number: <input type="text" name="phone"><br><br> quantity: <input type="text" name="quantity"><br><br> <input type="submit" name="add_...