Posts

Showing posts from August, 2010

c# - How to get message body without downloading attachment -

i using imap4 client called: mailkit. works great, have problem on getting body of message without downloading attachments. want show mail's body text , attachments there are, if user clicks on attachment want download attachment. i've tried: var message = inbox.getmessage(uid, cancel.token); but gets entire message. also tried: uids[0] = uid; var ms = inbox.fetch(uids, messagesummaryitems.bodystructure , cancel.token); var bp1 = inbox.getbodypart(uid, ms.first().body, cancel.token); but again downloads attachment. with sample code, downloading entire message because requesting top-level body part of message. mime tree structure of "body parts". want traverse ms.first().body find part(s) want, , download them individually using getbodypart() method. take @ mailkit.bodypartmultipart, mailkit.bodypartmessage, mailkit.bodypartbasic , mailkit.bodyparttext. a bodypartmultipart contains other body parts. a bodypartmessage parts contains me

c# - Must be a non abstract type with public parameterless constructor -

i read answers similar questions mine couldn't find explanation case. please, correct me, if i'm wrong :) i have 3 classes - base abstract class, called emaildata, , 2 other classes derive base class. have not included 1 of inheriting classes , of members of other classes make example more obvious. private abstract class emaildata { public emaildata(datarow emaildatarow) { vehicleowner = emaildatarow["owner"].tostring(); } public string vehicleowner { { return vehicleowner; } } private string vehicleowner; } private class deliveryemaildata : emaildata { public deliveryemaildata(datarow deliverydata) : base(deliverydata) { ordernumber = deliverydata["ordernumber"].tostring(); } public string ordernumber { { return ordernumber; } } private string ordernumber; } i have generic class, uses 1 of 2 classes derive ba

vb.net - Code Generation Utility in C#/VB .Net -

i using c# develop enterprise level application. use vs2010 modeling project model classes there no code generation utility available free. want know if there utility/extension can generate c#/vb code uml diagrams. any appreciated. the t4 framework comprehensive code generation in visual studio.

android - A way to detect if Chromecast is on same WLAN -

is there way detect chromecast device on same wlan-network? have android app, plays video on current activity or launches seperate activity casting on chromecast. all need ist implementing logic "is there chromecast device connect to?" , "am connected chromecast device?" start playback on corresponding activity. starting reciever app , thereafter implemented , working fine far, it's little questions tripping on @ moment. media router scan discover chromecast devices on same network, if doesn't discover device, there none on network. can hook media router callbacks notified when device discovered (mediarouter.callback has callback onrouteadded()).

twitter - iOS : How to create view which is top of all screen -

Image
i know, how create view or control each time top of view, here attached music player screenshot mini music player top of screen (view controller), create kinds of control when mount on top of view controller, in background if push , pop of vc not affect of mini control (view). please provide feedback, if know kinds of control please pass link. you can try this [[[uiapplication sharedapplication] keywindow] addsubview:yourcustomview];

asp.net mvc - When upgrading from MVC 4 to 5 every razor call is beeing underlined and with an error message associated with it -

when upgrading mvc 4 5 every razor call beeing underlined , error message associated it. the pages still works nice have error messages removed , if intellisense start working again. i'we read using following don't. <add namespace="system.web.optimization" /> there might different reason such versions of refrenced assemblies setting in web.config. make sure didn't miss step tutorial: http://www.asp.net/mvc/tutorials/mvc-5/how-to-upgrade-an-aspnet-mvc-4-and-web-api-project-to-aspnet-mvc-5-and-web-api-2 and link might help http://ctsoftr.com/upgrading-from-asp-net-mvc-4-to-5/

c# - Return custom dynamic type -

the dto classes we're returning dapper decorated attributes provide metadata each property (used ui), e.g: public class person { [metadata("first name")] public string firstname { get; set; } [metadata("last name")] public string lastname { get; set; } } in cases objects returned table may vary customer customer. have set of "common" fields , set of custom ones e.g. person.foo . to facilitate intend use dynamic object (derived system.dynamic.dynamicobject ). public class dynamicperson : dynamicdto { [metadata("first name")] public string firstname { get; set; } [metadata("last name")] public string lastname { get; set; } } the idea can reflect on instance properties metadata , use mechanism obtain dynamic property metadata. when run following test: var query = "select 'ben' firstname, 'foster' lastname, 25 age"; var people = cn.query<dynamicperson>(que

c# - Activator.CreateInstance Exception -

dbhandler.idb dbhandler; filemanager filemanager = filemanager.getfilemanager(); string dbnamespace = filemanager.getdbnamespace(); string dbclassname = filemanager.getdbclassname(); system.reflection.assembly.loadfile(directory.getcurrentdirectory() + "\\" + dbnamespace + ".dll"); debug.writeline("before ___________________________________________________"); objecthandle handle = activator.createinstance(dbnamespace, dbnamespace + "." + dbclassname); dbhandler = (dbhandler.idb)handle.unwrap(); in code above i'm getting file name xml configuration file , trying dynamically load correct .dll (this part work fine) , after instantiate class object dbhandler . after create instance method being called i'm getting exception: before _______________________________________________ first chance exception of type 'system.io.filenotfoundexception' occurred in mscorlib.dll first chance exception of type 'system.

C/C++ regex to capture a group repeatably? -

if simple (h\w+ ?)+ on string hey hello hi i'd capture 3 instances matches. know how in c# don't know how in library compatible c/c++. what library supports , how do it? included c# code example foreach (var s in regex.match("hey hello hi", @"(h\w+ ?)+").groups[1].captures) { console.writeline(s); } result: hey hello hi

java - How to convert long to datetime in android -

this question has answer here: how convert milliseconds date format in android? 11 answers datetime value in long variable need convert format 2014-04-06t12:04:23.000z simplest approach. try way, android simpledateformat sdf = new simpledateformat("yyyy-mm-dd't'hh:mm:ss.sssz", locale.us); system.out.format("%30s %s\n", "yyyy-mm-dd't'hh:mm:ss.sssz", sdf.format(new date(0))); // 0 - "longvalue" result yyyy-mm-dd't'hh:mm:ss.sssz 1970-01-01t00:00:00.000 great android doc simpledateformat

c# - MVC.NET: define a strongly typed HTML Helper for DropDownList -

i trying find out how define own htmlhelper creating dropdownlist. have following scenarion: using select2 jquery plugin ( http://ivaynberg.github.io/select2/ ) multiple selects search , better interface. model has x id's of tags associated. understand it, these tags can value when html helper @html.dropdownlistfor() used? to write pure html , somehow tell value has stored in list of tag-id's in model or make html helper can achieve same effect. currently have this, see no way of passing selected values model when form gets posted: <div> <label>kies je thema's (maximum 2):</label> <select id="select2select" multiple style="width: 500px"> @foreach (var top in ((list<topic>)viewbag.topids).where(top => top.maintopic == null)) { <option value="@top.topicid" class="optiongroup">@top.name</option> foreach (var

android - How I can make adesign that play on any Device like this -

how design this form in ِandroid run program on more 1 device, whether mobile or tv thx...! its easy linearlayout. can see divided 3:1 horizontally, , right section 1:1 vertically. <?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="horizontal" > <view android:id="@+id/video" android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="3" /> <linearlayout android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="1" android:orientation="vertical" > <view android:id="@+id/rss1"

php - Call to a member function bindParam on a non-object -

this question has answer here: call member function on non-object [duplicate] 8 answers reference - error mean in php? 29 answers i'm trying different sql statement in case user submit search form. i'm trying code below, i'm getting error , i'm not understanding why, because code seems gode me. do see here can cause of these errors? errors im getting: call member function bindparam() on non-object in $readnews->bindparam notice: undefined variable: readnews in $readnews->bindparam(':begin', begin, pdo::param_int); fatal error: call member function bindparam() on non-object in f:\xampp\htdocs\projeto\admin\posts\noticias.php on line 53 my code: $pag = (empty($_get['pag']) ? '1' : $_get['pag']);

python - Making a pop-up keyboard in Tkinter with Toplevel -

Image
i have small module pops toplevel widget when entry widget gains focus. toplevel window keyboard, expects button clicks trigger method inserts button click entry widget. toplevel should destroyed on 2 conditions: 1) user presses key on actual keyboard, 2) parent of entry widget moved or resized. everything works, except 1 bug: if user clicks on toplevel, becomes active, , if 1 of destroy events occur, unintended results (like popup coming when entry gets focus again). my thought if can make entry retain focus throughout process, work, haven't found way make happen. here's example, it's stripped down can make while retaining structure of module. note: python 2.7 from tkinter import * class top(toplevel): def __init__(self, attach): toplevel.__init__(self) self.attach = attach button(self, text='button a', command=self.callback).pack() self.bind('<key>', self.destroypopup) def callback(self):

Java class to give the long string format of a date? (In words, as if spoken) -

after looking through calendar , date classes, seeems though there no conventional way of turning time word alternative. xample, if time 12:20 pm, converted twelve forty 5 p.m. is there premade class this? half methods in date class deprecated. while there no class want, happen have example similar this: /** * class take integer value, positive or negative, , translate * printed single digit values. * i.e. 142 = 1 4 2 * -12 = negative 1 2 */ public class numbertranslator { final private static string[] txt = {"zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine"}; static int tempnumber; static string finalstring; static int tempnumber1; public static stringbuilder num = new stringbuilder(); public static void main(string[] args) { if(args.length == 0) { system.out.println("you need pass number argument"); return

Doxygen not generating documentation for java interfaces -

i'm trying use doxygen create documentation java, have small problem... i classed doxygen not create documentation interfaces... can me? the doxyfile i'm using here , version i'm using 1.8.6 thanks! maybe this can you. not insert tag end of file without empty line.

How to make theme elements customizable in wordpress? -

in wordpress there's menu option called 'appeareances'. want add (e.g.) submenu 'header' there , able customize header within wordpress (administration page). from understood have have 'functions.php' file in theme folder. in 'functions.php' file write this: <?php add_submenu_page( $parent_slug, $page_title, $menu_title, $capability, $menu_slug, $function); ?> of course adapted arguments (which i'm not entirely sure should since feel quite lost in this). codex best friend .. and codex say, if want add entry 'appearance' menu , use for appearance: add_submenu_page( 'themes.php', ... ); or adapted case : add_submenu_page( 'themes.php', 'header', 'header', 'edit_theme_options', 'customize_header','my_callback'); but ..: also see > add_theme_page() like : add_theme_page( $page_title, $menu_title, $capability, $menu_slug, $function );

objective c - How to update UI, wait some time and update it again using threads in iOS? -

i have app need blue button text 'hello' glow red , show word 'alert'. revert blue , text 'hello'. how can it? i know how use threads model-based tasks, not ui-based tasks, apparently have on main thread. not in using blocks though. basically thing want (in pseudo-code): - (void) animateuiandrevertaftersometime { // update button title @"alert" using settitle: forstate: [self.thisbutton settitle: @"alert" forstate:uicontrolstatenormal; // set buttons' backgroundcolor redcolor self.thisbutton.backgroundcolor = [uicolor redcolor]; // start timer 10 seconds // once time { // update button title @"hello" using settitle: forstate: [self.thisbutton settitle: @"hello" forstate:uicontrolstatenormal; // set button's backgroundcolor bluecolor self.thisbutton.backgroundcolor = [uicolor bluecolor]; } } can above in objective-c without hanging app interface 10 seconds? :p

c - Uninitialized variable put into program memory area. AVR programming -

in xxx.h file have declaration: const struct menuitem menuitema; in xxx.c file have definition: const struct menuitem menuitema progmem = {texta, menuitemafunction, &menuitemb, 0}; i include xxx.h file in main.c file. while building project warning: uninitialized variable 'menuitema' put program memory area [-wuninitialized] when had declaration , definition in same .c file ok, have no idea wrong now. joachim correct, definitions in header files need extern - otherwise every time use header (in different source file) you'll create copy of variable. answer original question, suspect variable in code section because constant, if remove const it'll go bss or data section depending on how it's defined. you're main problem lack of extern

select list displayed with authrority not with id role in grails -

i have 2 class role , user package tachemanagement.secu class role { string authority static hasmany = [users: user] static mapping = { cache true } static constraints = { authority(nullable:true) } } package tachemanagement.secu class user { transient springsecurityservice static belongsto = [rol: role] string username string password boolean enabled = true boolean accountexpired boolean accountlocked boolean passwordexpired static transients = ['springsecurityservice'] static constraints = { username blank: false, unique: true password blank: false } static mapping = { password column: '`password`' } set<role> getauthorities() { userrole.findallbyuser(this).collect { it.role } set } def beforeinsert() { encodepassword() } protected void encodepassword() { password = springsecurityservice.encodepassword(password) } def beforeupdate() { if (isdirty('password')) { encodepassword() }

search - Embedded List Query Performance In OrientDB -

maybe simple question orientdb, because i'm using few days. my question is, have million documents(let's called classa) in orientdb, , every document has field(let's called fielda). fielda's type embedded list, , item in embedded list string. so, data in orientdb this: [ { fielda: ['a','b','c'] }, { fielda: ['c','d','e'] }, ] what want query document fielda. so query this: select classa 'c' in fielda because, there millions of records in database, created index fielda, script created index this: create index classa.fielda not unique but when explain select query, got this: { "@type":"d","@version":0, "involvedindexes":["classa.fielda"], "current":"#11:960477", "fetchingfromtargetelapsed":160596, "documentreads":959211, "documentanalyzed

How to apply easing animation function on view in android -

Image
i want apply translate animation on android view (button).. using custom interpolator ..where easing function is: public static float easeout(float t,float b , float c, float d) { if ((t/=d) < (1/2.75f)) { return c*(7.5625f*t*t) + b; } else if (t < (2/2.75f)) { return c*(7.5625f*(t-=(1.5f/2.75f))*t + .75f) + b; } else if (t < (2.5/2.75)) { return c*(7.5625f*(t-=(2.25f/2.75f))*t + .9375f) + b; } else { return c*(7.5625f*(t-=(2.625f/2.75f))*t + .984375f) + b; } } i have example uses custom interpolator this: the intreplator : public class hesitateinterpolator implements interpolator { public hesitateinterpolator() { } public float getinterpolation(float t) { float x = 2.0f * t - 1.0f; return 0.5f * (x * x * x + 1.0f); } } and used : scaleanimation anim = new scaleanimation(0.0f, 1.0f, 0.0f, 1.0f); anim.setinterpolator(new hesitateinterpolator()); my question is: these values b,c

php - laravel create omits/skips fields -

i'm trying seed couple of databases laravel seeder, seems skips fields.. i'm doing way: item::create(array( 'name' => 'category 2', 'photo' => 'description of category 2', 'order' => 1 'price' => 2.30 'category_id' => 1, )); the fields 'category_id' , order not setup in database.. i'm calling seeder way artisan::call('db:seed',array('--database' => 'tenant_'.$user, '--class' => 'tenantseeder')); any idea why happen? if use standard $item = new item; $item->allfields = "its_value"; $item->save(); it works perfectly update here comes model: <?php class item extends model { //============================================================================ // parent variables //============================================================================ protected $table = "

android - Access All Media Files on Internal Storage -

i'm using following example try load saved images , video on android device customized gallery activity: access ordered images , video in same cursor while works images , video created using default android camera app, doesn't seem find media files saved locally in folder app (located in pictures/name_of_app) how can fetch media files on device? private string[] projection = { mediastore.files.filecolumns._id, mediastore.files.filecolumns.data, mediastore.files.filecolumns.date_added, mediastore.files.filecolumns.media_type, mediastore.files.filecolumns.mime_type, mediastore.files.filecolumns.title }; // used query contentresolver mediafiles private string selection = mediastore.files.filecolumns.media_type + "=" + mediastore.files.filecolumns.media_type_image + " or " + mediastore.files.filecolumns.media_type + "="

web services - Webservice response message can't be handled in Ksoap2 of android -

i have webservice method returns value in list response application.in key value pairs <"item"," http://www.codegeeks.com/ ">. when response @ application end,it shows me problem related casting of soapobject list. simple code response :- soapobject request = new soapobject(namespace, operation_name); // request.addproperty("menu", "menu"); // request.addproperty("pass",password); soapserializationenvelope envelope = new soapserializationenvelope(soapenvelope.ver11); envelope.dotnet = true; envelope.setoutputsoapobject(request); httptransportse ht = new httptransportse(url); ht.call(soap_action, envelope); soapobject result = (soapobject)envelope.getresponse(); please me change soapobject value list.i in big trouble due it.help please.

c# - How to retrieve a blog/website recent posts from other blogs -

how retrieve blog/website recent posts other blogs http://www.indiblogger.in get recent post websites or blogs , store db ... how achieve in asp.net c# the recipe answer question is: retrieve feeds create database context create entity class create dbset add feeditems dbset create webpage add gridview , button add code in codebehind retrieve feeds based on link first step find can find feed of posts enable retrieve those. feed url provided feedburner. next use load method of syndicationfeed. method accepts xmlreader unfortunately date format used in rssfeed not understood have use helper provided micorosft: xmlreader helper class myxmlreader : xmltextreader { private bool readingdate = false; const string customutcdatetimeformat = "ddd mmm dd hh:mm:ss z yyyy"; // wed oct 07 08:00:07 gmt 2009 public myxmlreader(stream s) : base(s) { } public myxmlreader(string inputuri) : base(inputuri) { }

jquery - flatten a deep json structure with jq for pandas -

i trying flatten json file pandas dataframe , found solution here . in case json has many different attributes seems tedious spell out rule every field manually. isn't possible flatten every attribute in json file automatically? i made solve similar problem. might not work in case, maybe take similar approach. def nested_dataframe(d): assert type(d) dict # may nested dict types = map(type, d.values()) if dict not in types: # 1 un-nested dict. make dataframe. return dataframe.from_dict({k: list([v]) k, v in d.items()}, orient='index') if all([t dict t in types]): # dict of dicts. # call nested_dataframe on each item, , concatenate results. return pd.concat([nested_dataframe(a) in d.values()], keys=d.keys()) else: raise valueerror("this doesn't work on dicts unequal depths.")

what is the difference between executing For loop Java -

could tell me, difference between loop java in code , b? while both of them gives same result in executing? , know doing, why loop written way in code * a * thanks the code //code public class myarray { public static void main (string[] args){ int[] ={1,10,30,40,50}; (int : a) { system.out.println(i); } } } //==================================== //code b public class myarray{ public static void main (string[] args){ int[] ={1,10,30,40,50}; (int i=0;i< a.length; i++) { system.out.println(a[i]); } } } iterating on collection uglier needs be. consider following method, takes collection of timer tasks , cancels them: void cancelall(collection<timertask> c) { (iterator<timertask> = c.iterator(); i.hasnext(); ) i.next().cancel(); } the iterator clutter. furthermore, opportunity error. iterator variable occurs 3 times in each loop: 2 chances wrong. for-each construct gets rid of clutter , opportunity er

coding style - Struct Name Standards in C -

what naming standards data structures in c language? for example, following code snippet picked http://www.sparknotes.com/cs/searching/hashtables/section3.rhtml : typedef struct _hash_table_t_ { int size; /* size of table */ list_t **table; /* table elements */ } hash_table_t; why _*_ used naming struct, not typedef? _t stand for? , on... a link pointing correct guide perfect. i've been searching google , looking coding style guides, couldn't find relate that. you should never copy naming conventions of c implementation or third party libraries . use naming convention not interfere (have name clashes) your code. the use of tag names starting underscore expressly forbidden in iso c99, 7.1.3: — identifiers begin underscore reserved use identifiers file scope in both ordinary , tag name spaces. personally, believe using typedefs structs silly, since saving writing struct keyword in few places--information should rather not hid

linux - Backup files in pre-folders of a certain size -

i want backup nas on multiple dvd's. had in mind script following: -create folder each dvd -copy files , filestructure dvd folders -stop / goto next dvd folder when first dvd folder full i.e. trigger 4 gbyte (which calculates easy example) i have datasrouce 10 gb of data., 3 dvd's. script first create 3 folders: dvd-1, dvd-2 , dvd-3. next copy start copy 4 gb dvd-1 folder. after that, remaining files must come in dvd-2 , dvd-3. as far know, rsync , cp doesn't bother calculating this. know option using archives zip, tar or gz @ first want try unpacked files. is above option standard linux bash commands or insane? no, there isn't standard tool out of box. it's pretty simple code up, , there few projects it: https://unix.stackexchange.com/questions/18628/generating-sets-of-files-that-fit-on-a-given-media-size-for-tar-t

PHP: Captain Oh Captain, My Switch Case Sucks -

i'm trying build simple switch case demo here , had working on school server , trying carry on server quarter over. don't know happened, switch case working no longer , trying repair it. paths good, , i've gone through file forwards , backwards trying find error in logic, looked missing semicolons, , else can think do. i'm stumped , not sure issue seems switch case isn't delivering , somehow broken. the switch case, when working, ideally display date, poster graphic , unique background image client (browser). jpg of how page display: http://school.max-o-matic.com/itc240/_img/img_240a010sm.jpg link page: http://school.max-o-matic.com/itc240/itc240_a020/index.php <?php /* * a3_dates-conditionals.php * * create page following functionality: * use php deliver different image , bit of content * each weekday (sunday saturday) using 1 php file. * * stage1 - build static (check) * stage2 - build variables (test, check) * stage3 - build conditi

javascript - goog.provide() - Uncaught SyntaxError: Unexpected token ILLEGAL -

so decided today play around limejs bit, i've never used closure before new me well. i've run small problem right off bat , not sure wrong. so far project 3 files: firstgame.html , firstgame.js , `player.js firstgame.html: <!doctype html> <html> <head> <title>firstgame</title> <script type="text/javascript" src="../closure/closure/goog/base.js"></script> <script type="text/javascript" src="firstgame.js"></script> <script type="text/javascript" src="player.js"></script> </head> <body onload="firstgame.start()"></body> </html> firstgame.js: goog.provide('firstgame'); //get requirements goog.require('lime.director'); goog.require('lime.scene'); goog.require('lime.layer'); goog.require('lime.circle'); goog.require('lime.label'); goog.require(&

javascript - Node JS: storing music metadata on JSON -

i'm begginer in node js , i'm trouble trying build json object. i've found module find metadata of mp3 file , want store information on json obj. the behaviour of applicaiton following: read "music" directory. for each file on directory, extract info , store in structure "jsonsong". push "jsonsong" structure called "jsonobj". make console.log of "jsonobj" see result. here's code: var fs = require('fs'); var mm = require('musicmetadata'); fs.readdir('./music/', function(err,files) { if(err) throw err; var jsonobj = { songs: [] }; files.foreach(function(file){ var jsonsong = { title:"", artist:"", duration:"", pic:"" } var parser = new mm(fs.createreadstream('

io - Python runs but won't write to file -

i want print variable file word_filter_output.txt. code runs fine , variable e prints console if want not print file. no errors come up. file left 0 bytes. >>>with open("word_filter_output.txt", "w") f: >>> print(e, file = f) it works given me (python 3.3.4); depending on else doing, may need force-flush it, ie with open("word_filter_output.txt", "w") f: print(e, file=f, flush=true)

For Loops not running inside If statement Excel VBA -

i'm writing code update inventory spreadsheet on first of every month. have little knowledge of vba understand basics of programming. please excuse poor code. the problem after initial if statement check, when true runs line directly below (adding new line) , not execute loops after edit data. sub auto_open() dim stock(21) if date - day(date) + 1 = date range("'monthly office inventory'!a2").entirerow.insert = 0 21 stock(i) = range("current office inventory'!a2").offset(0, i).value next x = 0 21 range("'monthly office inventory'!b14").offset(0, x).value = stock(x) next x end if end sub probably easiest way changing condition to: if day(date) = 1 then now, i'm writting on mac, think you'll idea (and correct if detail wrong).

r - ScatterPlot and ONLY one Histogram plot together -

Image
i want visualize time series data 'scatter plot' , histogram on right side, haven't been able figure out how turn off histogram on upper side. code example: install.packages("psych") library(psych) data = matrix(rnorm(n=100000,mean=2,sd=1.5), nrow = 100, ncol=1000) fs = list() fs$p_z = 1*(data>2) n_p = 1; for(i in floor(seq(1,dim(data)[2],length.out=n_p))) { scatter.hist(x = rep(1:length(data[,i])), y = data[,i], xlab = 'observations', ylab = 'log(tpm)', title = 'mixture plot', col = c("red","blue")[fs$p_z[,i]+1], correl = false, ellipse = false, smooth = false) } result: expected result: same 1 have no histogram on upper side. i.e., histogram on right side log(tpm). note: using psych package, scatter.hist function seemed easy , nice use, couldn't find how turn off 1 histogram. where flexibility ends, hacking

Thymeleaf fails on gradle build -

using spring-boot , thymeleaf build application. works fine in intellij, when build via " gradle clean build " errors. here directory structure: src - generated - main -- java -- resources --- assets ---- css/js ---- templates ----- *.html -- webapp - test -- groovy --- unit & integration tests here -- resources -- unit here gradle file: apply plugin: 'java' apply plugin: 'groovy' apply plugin: 'idea' apply plugin: 'spring-boot' apply plugin: 'jacoco' apply plugin: 'war' apply plugin: 'maven' def generatedresources = "$builddir/generated-resources/main" configurations { querydslapt } buildscript { repositories { maven { url "http://repo.spring.io/libs-snapshot" } mavenlocal() } dependencies { classpath("org.springframework.boot:spring-boot-gradle-plugin:1.0.0.rc4") } } repositories { mavencentral() maven

c++ - Reading in data from a text file using while loop -

this question has answer here: why iostream::eof inside loop condition considered wrong? 4 answers so reading in data text file in vector using while loop. originally had code set way : iftream infile; while(infile) // or if while(!infile.eof()) { infile>>data; vector1.push_back(data); //adding data in vector } - caused 1 small problem read in last item in text file twice reason. but if have code set way works fine : iftream infile; while(infile>>data) { vector1.push_back(data); //adding data in vector } why first code reads in last item twice? it looks data structure not entirely aligned within file, i.e. when program tries read last fragment, hasn't reached end of file yet, there isn't enough data read. infile >> data fails, means contents of data haven't been changed, , therefore ad

matlab - How to terminate a task based on time, regardless of trial number (Psychtoolbox) -

i need make timer starts counting @ beginning of multi-phase delay task, , ends delay task after period of time has passed, moving on next part of experiment. now, i'd end task after 2 seconds have passed. in code below, included example can paste editor. used part of stroop task delay task consists of 1 phase (in actual code there 3 phases, simplified task question)-- press 1 key red, 2 key green, , 3 key blue. each phase runs 6 trials. (just 1 set of 6 trials 1 phase now). i'd task (all phases together) last period of time, , terminate @ time set regardless of trial number. if 2 seconds have passed, task should end if on phase 1, trial number 3 of 6. the code below commented out (while loop numsecondsstart , numsecondsend) current attempt. i'm not sure such loop go (around phase loop, around trial loop?) thanks! code: clear close kbname('unifykeynames'); %%%%%%%%%%%%%%%%%%%%%%%%%%%% [window, rect]=screen('openwindow',0); red=kbname('

Emacs regex: add quote in middle of line -

i'm trying build sql statement, need have varchar fields quoted, of course. far emacs regex (with wonderful re-builder) has got me far: ('0d69b2','pool chem room,'b69e08','spaces'), ('113243','weight room,'b69e08','spaces'), ('175118','custodial closet 3,'b69e08','spaces'), ('1baa68','life fitness,'b69e08','spaces'), but right before second comma, need insert single quote. normal regex has me identify blob ^('\\w+','\\w+ then refer group \1 sub in group ' good, problem can't figure out how more

sorting - How sort XML using XSLT ascending order -

i have write xslt view bus stop information want ask how can make order in ascending stop number. can give me hand in how sorted <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/xsl/transform"> <xsl:template match="/"> <xsl:element name="html"> <xsl:element name="body"> <table style="width:720px" border="3"> <tr> <td>stop #</td> <td>route #</td> <td>name</td> <td>latitude</td> <td>longitude</td> </tr> <xsl:apply-templates select="//stop" /> </table> </xsl:element> </xsl:element> </xsl:template> <xsl:template match="stop"> <tr> <td> <xsl:value-of select="@number" />

asp.net - SignalR: How do I dynamically register a Hub? -

i'm creating .net library has signalr hub inside of it. programmer import library inside his/her asp.net web application , need hub available. normally people register hubs using iappbuilder.mapsignalr apparently doesn't work hubs different assemblies. how do this? can't find related in signalr documentation.

c - fgets function returning wrong value -

my file has first line below: axx00.data but when call below function, stores xx00.data in ll fgets(ll,10,keysfile); why weird thing happening? kindly check code below. whole code confuse that's why didn't keep before, remove confusion editing question code. .... putting complete code on request..... #include <stdio.h> #include <string.h> #include <stdlib.h> #include <unistd.h> int n=192; int l=8; int s[192]; int i,j; int k[8]; int x,y; int keycounter[192]; int fmsattack(int,int,int,int,int, int); int fms(char[], int); int max(int[]); /*void ksa(int *, int); ksa(int *s,int n) { i,j; for(i=0;i<b+3;i++) { } }*/ int main() { int i,j,b=0,nextkey; for(b=0; b<5;b++)//(l-3);b++) { /*int scurr[n]; (int = 0; < n; i++) { scurr[i]=s[i];

json - using ngInfiniteScroll on $resource? -

i've looked @ examples of using nginfinitescroll on @ demo site ( http://binarymuse.github.io/nginfinitescroll/demos.html ) seem using lower level $http service in order build scroll. issue have have resources built in factories using ngresource because i'm passing in other parameters in other controllers around app. i'd know if still possible use nginfinitescroll using $resource instead of $http? i've yet find 1 example far request new page rest api have down below. code examples or ideas how done? .factory('allupcomingfactory', function($resource) { return $resource('http://www.test.com/api/v1/channel_listings.json?page=:pageid&channel_id=:channelid', {channelid: '@channelid', pageid: '@pageid'}, {'query': {method:'get', isarray:false}}); }) angular ui has infinite scroll directive in ui-utils package allows creation of service drive object retrieval scroller. can check out her

if and & statement in R -

i have data.frame 4 columns that: > bb v1 v2 v3 v4 1 arfgef2 arfgef2 arfgef2 <na> 2 sfrs5 <na> srsf5 <na> 3 ensg00000215104 <na> <na> chmp1b2p 4 edf1 edf1 edf1 <na> 5 loc100133678 <na> <na> <na> 6 cd3g cd3g - <na> 7 gnai2 gnai2 gnai2 <na> i want create new column according values on columns 2, 3, , 4. trying : if bb[,2] na and bb[,3] has value bb[,5] value of bb[,3] , if bb[,2] na and bb[,3] na , df[,4] has value bb[,5] value of bb[,4] , else bb[,5] df[,1] . here expected output: > bb v1 v2 v3 v4 v5 1 arfgef2 arfgef2 arfgef2 <na> arfgef2 2 sfrs5 <na> srsf5 <na> srsf5 3 ensg00000215104 <na> <na> chmp1b2p chmp1b2p 4 edf1 edf1