Posts

Showing posts from August, 2010

php - Session data not getting destroyed from cache in CodeIgniter -

i new codeigniter. in website have logout option. have written code destroy session , logout works first time in both ie , chrome. if login again logout not work till clear cache , manual refresh. both ie , chrome showing problem. have tried writing cache clear method not working. known issue or doing wrong. my logout code class logout extends ci_controller { public function __construct() { parent::__construct(); } function index() { $this->home_model->unsetsessions(); redirect('', 'refresh'); }} my home model function unsetsessions() { $newdata = array( 'session_id' => '', 'user_id' => 0, 'user_name' => null, 'user_type' => null ); $this->session->unset_userdata($newdata); }

spring - org.hibernate.QueryParameterException -

i newbie in spring. i'm trying perform add,delete,edit operation on database through spring , hibernate.delete , add operation executed when trying edit clicking on edit. i'm getting error: full stacktrace: org.hibernate.queryparameterexception: not locate named parameter [userid] @ org.hibernate.engine.query.parametermetadata.getnamedparameterdescriptor(parametermetadata.java:75) @ org.hibernate.engine.query.parametermetadata.getnamedparameterexpectedtype(parametermetadata.java:81) @ org.hibernate.impl.abstractqueryimpl.determinetype(abstractqueryimpl.java:413) @ org.hibernate.impl.abstractqueryimpl.setparameter(abstractqueryimpl.java:383) @ userdao.userdaoimpl.getuserbyid(userdaoimpl.java:48) @ userservice.userserviceimpl.getuserbyid(userserviceimpl.java:41) @ sun.reflect.nativemethodaccessorimpl.invoke0(native method) @ sun.reflect.nativemethodaccessorimpl.invoke(nativemethodaccessorimpl.java:57) @ sun.reflect.delegatingmethodaccessorimpl.invoke(delegatingmethodacces

mysql - PHP Display hours until a certain event from a time given -

so basically, wanted happen was, wanted submit article submits current time() , amount of hours until event. wished calculate amount of time in hours time() in database amount of hours since article posted. if posted article event happening @ 3pm, , current time 12pm, "event in 3 hours". , if check again @ 2pm, "event in 1 hours". sorry if seems noob question, quite stupid person when comes maths , stuff. in advance input, appreciate it! presuming store time of article timestamp, , retrieve value in variable $articletime: $hoursleft = floor(($articletime - time()) / 3600);

Python script not triggering jQuery form reset via ajaxForm -

i've searched no luck, please forgive me if redundant. i'm new python, , have simple html form (on submission) clears form, sends email via action.py script, , alerts message (alertify js) on same form page. email gets sent correctly, form not clear , not receive alert message. (stripped down) html form is: <form id="myform" method="post" title="contact info request form" action="action.py"> <fieldset> <input type="text" title="field entering name" name="name" id="name" maxlength="50" placeholder="name" /> <input type="text" title="field entering email address" name="email" id="email" maxlength="50" placeholder="email" /> <textarea title="field entering message" name="message" id="message" rows="5" cols="4"

c# - How to display xml string in a Label? -

i trying html method below, encode string , display on label, keep getting blank page, on client-side. i have checked viewsource , shows no html output also. public partial class : page { protected void page_load(object sender, eventargs e, string data) { if (!ispostback) { string = createxmlpub(data); // label1.text = httputility.htmlencode(a); label1.text = server.htmlencode(a); } } public static string createxmlpub(string data ) { xelement xeroot = new xelement("pub"); xelement xename = new xelement("name", "###"); xeroot.add(xename); xelement xecategory = new xelement("category", "#####"); xeroot.add(xecategory); xdocument xdoc = new xdocument(xeroot); data = xdoc.tostring(); return data; } html <asp:content runat="server" id="bodycontent" contentplaceholderid="maincontent"> &l

How to disable connection pooling with PostgreSQL in flask-sqlalchemy? -

i want use pgpool or pgbouncer external connection pooler flask app. flask-sqlalchemy extension not seem expose way change connection pooler nullpool . there way this? while should possible apply_driver_hacks method, recommend against it. the tcp overhead negligible on local machine, authentication , negotiation (encoding example) isn't. keeping pool useful within flask , if needed can configured sqlalchemy_pool_size , sqlalchemy_pool_timeout , sqlalchemy_pool_recycle , sqlalchemy_max_overflow settings . if want cut down on overhead (albeit negligible) , 1 instance flask app thing connecting postgres, removing pgbouncer/pgpool mix better.

asp.net - Update command not throwing any errors, but not working either -

update button executes onclick="updatelogo", nothing shows in database. know executes because can put other instruction refresh or redirect page, , executes, doesn't update. tried using commandname property instead of onclick property, no luck there either. thoughts why? i've moved in , out of updatepanel , can see i've got inside formview right now. i've tried couple of variations on variables @atty_id or ? , can't seem work. here markup: <asp:updatepanel id="updatepanel19" runat="server"> <contenttemplate> <asp:accessdatasource id="chamberlogodatasource" runat="server" datafile="~/app_data/attorneys.mdb" selectcommand="select attorneys.chamber attorneys atty_id = ?" updatecommand="update attorneys set chamber = ? att_id = ?">

Java API for calculating percent -

i'm having troubles finding java api calculate percentages. eg. assert theapi.percentofnumber(10.0, 200.0) == 20.0 assert theapi.percentofnumber(25.0, 200.0) == 50.0 i know it's easy calculate, want find api it. here is public static double percentofnumber(double x, double y) { return x * 100 / y; } note, method name longer code have write. say want calculate percentage of x in 200, can simplify further. double tenin200 = 10 / 2.0 double twentyfivein200 = 25 / 2.0; btw answer should be assert percentofnumber(10.0, 200.0) == 5.0; assert percentofnumber(25.0, 200.0) == 12.5;

email - Encoding issue in preheader in iphone native mail client -

i have problem special characters in preheader in iphone 5. when send email shown below (code , headers taken hotmail webclient) shows special characters (æøå) correct in both subject , body itself, however, when it's displayed in preheader shows ? sort of incorrect interpretation of encoding. the problem occurs when opening email in iphone (tested iphone 5) using native mail client , when it's linked hotmail account. if it's sent other acount e.g gmail , opened in same client it's rendered correctly. problem has been reproduced on 3 different iphones (two of running 7.1.2 not know last 1 running). in example shown here characters html entities, in other tests i've tried actual characters same result. i've tried without meta headers, still same result. the example basic can make it, i've tested more realistic emails , have same issue. has else seen similar issue, or know cause problem ? subject: =?utf-8?b?w6bdumol?= content-type: multipart/mixe

Rails statistics gem not joining filters -

i using rails gem 'statistics' , have added gem in other projects , have not had problem. using line add filters: define_statistic :sum_charged, :sum => :all, :column_name => "timelogs.charged_amount", :conditions => "subscription_opt_in = true" or using filter_all_stats_on(:created_after, "timelogs.created_at > ?") add additional filters on statistics... however whenever call puts timelog.get_stat(:sum_charged, :created_after => 1.year.ago) example, sum() query gets run on database, without statements... select sum(timelogs.charged_amount) sum_id `timelogs` what missing in order add filters query? thanks. looks issue of using gem in rails 4.1.x -- reverted app 4.0.9 , works great. there issue base.send() function gets sent without filter parameters.

python dictionary error when getting value from a given key -

i'm starting coding in python since yesterday , i'm going without problems. context program read rfid card , use readed tag associated username. work in embedded linux (debian gnu/linux 7 (wheezy)) on terra board. python version (python 2.7.3). i create dictionary fill key/value pairs (both strings). when try value using 1 key exception don't understand. def findtagbynumber(self, key): global tags value = "" try: print("all dictionary: " + str(self.tags)) print("get name key: " + str(key)) value = self.tags[key] print("found name key: " + str(value)) except exception ex: print("exception: " + str(ex)) return value the result this: root@ariag25:/home/python# python main.py rfid::initialize rfid::get tag configurations rfid::serial port opened dictionary: {'4d0055ab3a': 'test1', '4d0055b6e4j': 'test2'} name key: 4d0055b6e

android - SharedPreferences does not apply() or commit() inside a service with its own process -

i have service has own process: <service android:name=".services.commander" android:label="@string/commander" android:process=":commander_process" > </service> inside service asynctask executed using executeonexecutor . inside onpostexecute method want write data using following code: sharedpreferences prefs = getsharedpreferences("my_app_key", context.mode_private); prefs.edit().putstring(constants.pref_key_app_password, md5.get(password)).apply(); but, code has no effect , prefs won't update. tried commit() rather apply() , didn't work, too. tried mode_multi_process instead of mode_private : sharedpreferences prefs = getsharedpreferences("my_app_key", context.mode_multi_process); it didn't work. my code works on android 2.3.6, wouldn't work on android 4.2.2. how can fix it? unfortunately, sharedpreferences not process-safe after using mode_multi_process . ran s

objective c - SKScene's update method gets a "currentTime" that is different from CFAbsoluteTimeGetCurrent() -

the problem can reproduced in freshly created spritekit project. after creating new project, add 2 lines update: method of myscene class: -(void)update:(cftimeinterval)currenttime { nslog(@" currenttime = %f", currenttime); nslog(@"cfabsolutetimegetcurrent() = %f", cfabsolutetimegetcurrent()); } running shows currenttime several orders of magnitude smaller time returned cfabsolutetimegetcurrent() . searched possible reasons, found none. possibility think of currenttime time frame since other date 00:00:00 01.01.2000, have no idea other reference point using, , found nothing when searching online either. what can current time, calculated same rules used calculate currenttime ? nothing, unless you're willing disassemble , understand sprite kit framework code. though problem explained sprite kit taking cfabsolutetimegetcurrent @ earlier point in time, passed update: method. overhead of sending message scene means 2 t

Presenting Access query result to user for them to edit which changes the original table data -

i want present results of select query (table 36 records , 4 fields) user , allow them modify data. having modified data changes made original table upon query acting. put allows user inspect query results , make changes results see fit. how best achieved? thanks

c# - How to convert an event to an IObservable when it doesn't conform to the standard .NET event pattern -

i have delegate looks this: public delegate void mydelegate(int arg1, int arg2); and event looks this: public event mydelegate somethinghappened; is there easy way create iobservable sequence event? i'd (but doesn't compile): var obs = observable.fromeventpattern<int, int>(this, "somethinghappened"); var subscription = obs.subscribe(x,y => dosomething(x, y)); .... private void dosomething(int value1, int value2) { ... } there way using observable.fromevent follows. lets create class test encapsulate delegate , event definition: public class test { public delegate void mydelegate(int arg1, int arg2); public event mydelegate somethinghappened; public void raiseevent(int a, int b) { var temp = somethinghappened; if(temp != null) { temp(a, b); } } } now, because delegate has 2 arguments not neatly packaged subclass of eventargs , must use conversion functio

android - ArrayAdapter getView method trigger only first element -

i try use listfragment create list.i created custom array adapter listfragment. can see first item on activiy when launch project.but i've noticed when drag , drop fist item can see second item on 1 line.you can see below fragment layout , list item layout.also attached custom adapter class.thanks in advance. fragment layout <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:baselinealigned="false" android:orientation="horizontal" > <fragment android:id="@+id/menufragment" android:name="com.example.fragment.menulistfragment" android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="1" /> list item layout <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_wi

how to print String one after another in java -

i want know want print string 1 after in particular time interval. everything fine. i want know when second string print override first 1 , third override second , on.. how can this? this code : public class stringtest { public static void main(string args[]) { string arr[] = { "mahtab", "hussain", "yasir", "azmi", "saif" }; int l = arr.length; (int = 0; < arr.length; i++) { system.out.print(arr[i]); try { thread.sleep(5 * 1000); } catch (interruptedexception e) { e.printstacktrace(); } } } } you can carriage return \r . system.out.print(arr[i]+"\r")

java - When should I pass a class as an argument? -

i confused undrestand when should pass class argument instead of instance. example: mymethod(classa.class); could make example of when , how should pass class argument? a classic example when creating instance of class through reflection: //avoiding exception handling, leave static <t> t make(class<t> clazz) { return clazz.newinstance(); } //... a = make(a.class); also, when want make sure @ compile time references belong specific class, used in collections#checkedxxx .

asp.net mvc - Azure AD versus .NET Identity 2 -

what pros/cons of using .net identity 2.1 versus azure active directory (premium)? we have mvc 5.x application using identity 2.1 registration, sign-in, password resets, etc. microsoft consultant suggesting should swap azure active directory remove complexity of "maintaining own security". what reasons make swap , why wouldn't you? i wouldn't 2 mutually exclusive. asp identity has functionality built in don't have use it. actually, create own userstores, managers etc. poll azure ad info. identity allows use it, override it, or skip entirely. why wouldn't want this? not has ad. not needs it. bare-bones approach templates use application managed users , claims. if targeting multiple applications , want sso , have ad can take advantage of it. developing own @ point redundant , more work/maintenance consultant pointed out. you still have users table , possibly others in app database because may have business functions unrelated ad boilerpl

httprequest - how to pass a php variable from one page to another using post method -

this question has answer here: how keep post information while redirecting in php? 6 answers i know how bind variable in request this; header("location:../dashboard.php?name=name"); but want variables hidden in url, this; header("location:../dashboard.php"); and send variable using post method how can without using sessions or cookies? thank you. it not possible. thing can create html form , invoke using javascript. merely hack solution. please describe want achieve, not how.

c++ - From Makefile to Cmake -

because of clion release i'd move make cmake. have source folder bunch of .cpp , .hpp files , main.cpp uses classes source above - far had easy makefile compile, link , make exec out of main.cpp : c_objs := $(shell find source/*/ -name '*.cpp') sources=source/main.cpp $(c_objs) objects=$(sources:.cpp=.o) executable=bin/main $(executable_t): $(objects_t) $(cc) $(ldflags) $(objects_t) -o $@ $(executable): $(objects) $(cc) $(ldflags) $(objects) -o $@ %.o: %.cpp $(cc) $(cflags) $< -c -o $@ all: $(executable) in cmake came that: cmake_minimum_required(version 2.8.4) project(main) #grab file need compile file(glob src "source/*.h" "source/*.hpp" "source/*.cpp" ) #compile .o files need add_library( mylib ${src} ) set(source_files source/main.cpp) #compile .o main.cpp add_executable( main ${source_files} ) #link them target_link_libraries( main mylib ) but keep getting "undefined reference to" class

Jssor slider change mouse pointer -

using jssor slider how change mouse pointer different arrows up.down/left/right. possible have no change @ when mouse hovers? it's you. please find , modify code here <div u="slides" style="cursor: move....

ios8 - iOS 8 iPad tab bar height is different than iOS 7 -

does 1 know if official documentation tells height of tab bar on ios 8 ipad applications? my app's tab bar frame (0, 719) (1024, 49) on landscape ipad app on ios 8. ios 7, it's (0, 712), (1024, 56). i read in https://developer.apple.com/library/ios/documentation/userexperience/conceptual/transitionguide/bars.html height on ios 7 ipads 56 pixels. i'm guessing it's not same ios 8? apple have changed ipad tab bar height 49pt in ios 8. an apple engineer has confirmed change. documentation seems have not updated however. so ipad, uitabbar heights per ios version are: ios 6 , earlier - 49pt ios 7 - 56pt ios 8 , later - 49pt the tab bar has been 49pt on iphone , remains way.

call back for javascript animation -

i have java script animation scrolling unto top of page smoothly.at end of animation have .focus() function focus on form field. focus causing jerkiness. upon researching found out can fix having call animation , having focus in that. not sure how that. appreciated. $(".scroll").click(function(event){ event.preventdefault(); //calculate destination place var dest=0; if($(this.hash).offset().top > $(document).height()-$(window).height()){ dest=$(document).height()-$(window).height(); }else{ dest=$(this.hash).offset().top; } //go destination $('html,body').animate({scrolltop:dest}, 1000,'swing'); $('input#name_first').focus(); }); http://jsfiddle.net/1kbph7q3/ both comments on question correct. heres working js fiddle: http://jsfiddle.net/got29e9v/1/ the first error anchor link need class of .scroll . also js fiddle wasn't using jquery, javascript trying us

c# - Properly using parameterized Factory.Create() method using DI -

my factory using method injection because thought best way make far. besides, doubt thing after having call on create method within dependent object. the way might think of whilst continuing use parameterized factory create method, inject dependencies directly in mainpresenter may provide dependencies method, , dislike it. dislike because not mainpresenter depends on icustomermanagementview , icustomerdetailpresenterfactory , it's dependency. feel i'm sabotaging own code doing so. mainpresenter public class mainpresenter : presenter<imainview>, imainviewuihandler { public mainpresenter(imainview view , icustomermanagementpresenterfactory customermanagementfactory) : base(view) { this.customermanagementpresenterfactory = customermanagementpresenterfactory; } public void managecustomers() { // following line causing trouble. // can see per icustomermanagementpresenterfactory code sample, // create(

java - error to integrate restful web service with spring and gdata api -

short version: restful spring web service crashes when include dependency: com.google.gdata: core: 1.47.1 long version: i trying make restfull web service consume information spreadsheet in google drive this sequence of steps: preparing classes made connection , data obtained drive (not web, backend classes, unit , integration tests included): ok prepare restfull web service spring, download spring tutorial ( http://spring.io/guides/tutorials/rest/3/ ) , execute: ok then remove tutorial's business classes , include components, change controllers invoke components, plus add gdata dependence in file graddle.build, try execute: houston have problem it's strange, when start app context, log print this:   c:\users\grubhart\documents\proyectos\error_rest_gdata\complete\src\main\java\com\yummynoodlebar\config\webappinitializer.java:39: error: can not find symbol      servletcontext.setinitparameter ("defaulthtmlescape", "true");             

wpf - Binding a DataTemplate to ContentControl with ContentTemplateSelector -

Image
i have 3 datatemplate in window.resources, typed 3 different classes: <datatemplate x:key="mytemplatea" datatype="{x:type local:sampleclassa}"> <grid> <textblock text="{binding path=sampleproperty1}"></textblock> <textblock text="{binding path=sampleproperty2}"></textblock> <textblock text="{binding path=samplepropertya}"></textblock> </grid> </datatemplate> <datatemplate x:key="mytemplateb" datatype="{x:type local:sampleclassb}"> <grid> <textblock text="{binding path=sampleproperty1}"></textblock> <textblock text="{binding path=sampleproperty2}"></textblock> <textblock text="{binding path=samplepropertyb}"></textblock> </grid> </datatemplate> <datatemplate x:key="mytempl

ngresource - How to pass headers on the fly to $resource for angularjs -

right now, way know setting tokens in headers dynamically angularjs call via $http so: return $http.get({ url: 'https://my.backend.com/api/jokes', params: { 'jokeid': '5', }, headers: { 'authorization': 'bearer '+ $scope.myoauthtoken } }); but want figure out how pass via $resource, here's pseudo-code doesn't work: ... .factory('myfactory', ['$resource', function($resource){ return { jokes: $resource('https://my.backend.com/api/jokes', null, { query: { method: 'get' } }) }; } ] ); ... return myfactory.jokes.query({ 'jokeid': '5', 'headers': { 'authorization': 'bearer '+ $scope.myoauthtoken } }); how can pass headers on fly $resource angularjs? i don't think can done way trying, config object not available on action method. action config method

c# - ASP.NET MVC Response.Cache VaryByHeaders -

i have controller delivers response , trying set cache shown below, if(string.equals( request.query["cached"] , "true", cultureinfo.ignorecase)){ response.cache.setcacheability(httpcacheability.private); response.cache.setmaxage(timespan.fromdays(1)); response.cache.varybyheaders["cookie"] = true; } when see response in chrome, see header, cache-control: private, max-age=86400 vary: accept-encoding vary header default, , changing. i not want use outputcache because cache enabled querystring parameter cached=true. when using asp.net mvc 4, used see response vary:* and have upgraded project asp.net mvc 5, no longer working. want response cached @ browser (client) based on login , cookies. since december 2013 may able activate iis dynamic compression without compromising vary header. depending on os version, may need apply hotfix. see following kb hotfix. http://support.microsoft.com/kb/2877816 this information founded

node.js - Node using OAuth 2.0 for Server to Server Applications -

i interested in accessing files (or folder) google drive - , having access created (and granted) through server-side code. not interested in logging in via browser. i've created oauth service account, downloaded p12 file , converted .pem file.. but can't see examples in node.js this. i've seen few examples on github use oauth access google drive - in fairness lot of them not work - frustrating. google not have node.js client api library this. i love or pointing in right direction if has thoughts. appreciate help... pandafinity this guidance , code got me through when integrating google analytics api in same manner. should work drive too: https://gist.github.com/paquitosoft/4451865

gulp - variable directory followed by known one -

i want copy files from /plugins/system/name/language/en—gb/* /language/en-gb/* /plugins/test/whatever/language/fr-fr/* /language/fr-fr/* i have tried that gulp.task('copy:plugins:lang', function () { return gulp.src('./plugins/**/**/language') .pipe(gulp.dest('language')); }); but copies directories inside language directory /language/system/name/language/en—gb/* /language/test/whatever/language/fr-fr/* i have tried flatten() files there copied directly inside language folder instead of en-gb or fr-fr . note en-gb or fr-fr variable, pt-br . using placeholders, trying achieve copying files like: /plugins/{type}/{name}/language/{locale}/* inside /language/{locale}/* i think may able achieve want using gulp-rename , path . if it's safe assume there no directories inside each locale directory, use: var rename = require('gulp-rename'); var path = require('path'); gulp.task('copy:plugin

Application Icon Visual Studio 2010 c++ -

i wanted clear confusion here. i changed application icon .exe file using the solution here . when locate .exe file in explorer see change in icon. however, when run on debug mode visual studio 2010, changed icon not show - shows generic white box. so wondering if an expected behavior or not? application still have new icon when generate .exe file in release build right? as hans passant said in comment: it expected. google "reset shell icon cache"

javascript - Node.js: cannot call method 'use' of undefined -

i'm trying learn node.js , i'm getting error. app.use(morgan('dev')); //log request console typeerror: cannot call method 'use' of undefined @ object.<anonymous> (/root/authproject/server.js:21:5) @ module._compile (module.js:456:26) @ object.module._extensions..js (module.js:474:10) @ module.load (module.js:356:32) @ function.module._load (module.js:312:12) @ function.module.runmain (module.js:497:10) @ startup (node.js:119:16) @ node.js:901:3 what causing it? you're going need code setup express: var express = require('express'); var app = express(); and you'll need import morgan similarly. i'm presume you're copying code somewhere - perhaps it's not complete example?

c# - Visual Studio Profiler "Calling thread must be STA" PRF0025 -

i'm working on c# console app uses several tasks implement threading. when try , profile program using visual studio 2013 profiler in "instrumentation" mode, profiler collects data , writes program runs, when run completes, following error output: data written c:\...\console140910.vsp. profiling finished. calling thread must sta, because many ui components require this. prf0025: no data collected. surely can connect profiler multithreaded applications. see problem before? in advance help.

VsVim keyboard shortcut to switch between files/tabs? -

i installed vsvim. it's great, find myself reaching mouse in order switch between files. is there built in solution? cannot find list of vsvim shortcuts anywhere. found answer here: tab/window group movement: (ctrl-w)(ctrl-l), etc use gt or gt go , forth between tabs.

c# - How to test an async exception handler -

i have method task<details> getdetails(int number); . it's called async mvc controller: var details = _provider.getdetails(input); details details = null; try { details = await getdetails; } catch (exception ex) { // code needs testing } attempt test in custom, non-async testing framework. getdetails method stubbed, using rhinomocks: provider.stub(provider => provider.getdetails(input) .return(new task<details>(delegate { throw new exception {}; })); the result deadlock of unit test, runs forever. advice on how fix this? the cause of deadlock you're creating new task without starting it. for exceptions, it's better use taskcompletionsource : var tcs = new taskcompletionsource<details>(); tcs.trysetexception(new exception()); provider.stub(...).return(tcs.task); however, @servy says, won't far in testing asynchronous metho

Defining an alternate connection pool in Grails 2.3.6 -

i know that, @ point between grails 1.x , grails 2.x, default connection pooling library changed commons-dbcp tomcat-dbcp . now, i'm trying configure either bonecp or hikaricp connection pooling library grails application. however, see this answer offers solution might apply grails 1.x. i found this gist , again, don't know grails version applies to. so, possible define custom connection pool inside grails 2.3.6 application? thanks! update: ok need tell grails not pool datasources, since hikaricp taking care of this. i saw connection weirdness in apps if left switch on. instead say: pooled = false ok yeah, @joshua moore right. i tried doing updated grails methods , relevant section of resources.groovy file. far can understand, configuration values in datasource.groovy pulled resources.groovy @ runtime, after target runtime environment has been identified ( development , test or production ). def config = holders.config def datasources = co

c# - How do I echo into an existing CMD window -

so program i'm working on can launched using command lines in cmd using following code. string[] commandlines = environment.getcommandlineargs(); however want able return message cmd window command lines came after handling them. appreciated. edit: i'm running program windows application, not console application. i ended solving problem using 1 of answers renniepet posted comment question. i'll list solution down here trying reproduce it. [system.runtime.interopservices.dllimport("kernel32.dll")] private static extern bool attachconsole(int dwprocessid); private const int attach_parent_process = -1; streamwriter _stdoutwriter; // must called in program public void guiconsolewriter() { // needs happen before attachconsole. // if output not redirected still valid stream doesn't appear write anywhere // guess write somewhere, can find out var stdout = console.openstandardoutput(); _stdoutwriter = new streamwriter(stdout

architecture - Should you store current application state in a database? -

i have started working on project postgres database used integral component in system architecture. has forced me abandon previous notions database well, store things. there api translates incoming requests database queries/updates. causes triggers in database notify application update actual system accordingly. to me seems unnecessary. in system critical architecture, , yet have no way guarantee knowledge of underlying systems failure making chain since async. in short don't @ all. view should restart scratch using direct communication between api , underlying system, using database store persistant state updates / user information etc. what i'm looking here explain me why i'm wrong before end falling out team, views welcome. the reason support such integration low cost, if 2 integrated systems uses own proprietry technologies comminucating bad each other. also, db integration presents old style of integration. what want acheive (or @ least increase) c

How to render a Fuid view template without Extbase? I. e an email template by eID -

i want send email typo3 eid script using fluid template file render mail body. not find simple way how initialize fuid view outside of normal mvc extbase context. sources found seemed outdated , complex. so needed render fluid template? here simple function wrote render templates. /** * renders fluid email template * @param string $template * @param array $assign * @return string */ public function renderfluidtemplate($template, array $assign = array()) { $templatepath = \typo3\cms\core\utility\generalutility::getfileabsfilename('ext:myextension/resources/private/templates/' . $template); $view = \typo3\cms\core\utility\generalutility::makeinstance('typo3\\cms\\fluid\\view\\standaloneview'); $view->settemplatepathandfilename($templatepath); $view->assignmultiple($assign); return $view->render(); } echo renderfluidtemplate('mail.html', array('test' => 'this test!')); and fluid template in

html - Aligning images with text -

this question has answer here: vertically align text next image? 20 answers i'm having trouble aligning image text. want image on left, , text inline on right, centered vertically image. <div class="container"> <span class="icon"> <img ... /> </span> <span>555-1212</span> </div> right now, text hugs top of container. how can center vertically middle of container? .container span { display: inline-block; vertical-align: middle; } this should it. jsfiddle

css - Wordpress: I want to set p max-width but images to ignore it -

this on portfolio website (using side full width theme , ebor portfolio) on wordpress 4.0. my text full width images. makes line-length far long comfortable. have added p {max-width: 800px;} custom.css file, includes images (which placed inline in portfolio edit page , fall under p tag). i want images remain full width. how can this? edit thank tplummer. didn't work though. went text editor, entered wrote. img writeup however, not inside same p tag text. edit 2 i tried placing images inside unused h6 tag , left full width. seems have worked! floating in center....which doesn't bad actually...but titles still left....ahhh code tricky... if they're nested within <p> tags you're going have bad time. if it's content based, try wrapping text want style inside span, inside <p> tag. css .limit-size { max-width: 800px; } html <p><span class="limit800">text text text</span><img src="pic.

c# - How to avoid getters in aggregate internal collection? -

i'm trying follow advice whereby "using getters/setters in classes evil". so, have aggregate class invoice following signature: public class invoice{ iset<line> _lines; public void changelineamount(int lineid, double newamount){ //your answer here } } how can find specific line change, if line class has no getters? reason behind phrase "using getters/setters in classes evil" in matter of ddd getters , setters not representing ul(ubiquitous language) , leading anemic entities. if in ul there "i need amount of line", can create getter name according ul, like: invoice.lineamount(lineid) . inside of method can access property charlesnrice answered. if feel need special treatment reading/setting lines, can create private getter use inside of domain logic methods. update: getters , setters needed in first place because later in project could've want add additional validation/convertin

sql - Different select result for exists ? -

i scratching head figure out why these 2 delete results different in sqlite3. the problem "if 2 students , b friends, , likes b not vice-versa, remove likes tuple. " here , q2. (along actual data ) the schema friend , likes are .schema friend create table friend(id1 int, id2 int); and .schema likes create table friend(id1 int, id2 int); the 2 solutions have come are: -- correct delete likes not exists (select 1 likes l2 l2.id1=likes.id2 , l2.id2=likes.id1) , exists (select 1 friend likes.id1=friend.id1 , likes.id2=friend.id2); and -- combinng 2 select 1 incorrect delete likes not exists (select 1 likes l2, friend f l2.id1=likes.id2 , l2.id2=likes.id1 , likes.id1=f.id1 , likes.id2=f.id2); you see, difference combined 2 selects one. the incorrect version wrong because tuple (1782, 1709) incorrectly deleted, should not because tuple not in friend . in correct query, first subquery uses not exists, while second

php - Wordpress custom post type encoding -

i have problem encoding on saving custom post type in wordpress. when hit update, utf-8 characters (č, š, ž, ø, etc.) tranformed "u010d" , others. the problem seems form. recieve broken characters through post. i have saved file utf-8 encoding , have meta tag encoding in head of html. what can fix this? thank you! edit: i have accept-charset="utf-8" in form. head: <meta http-equiv="content-type" content="text/html; charset=utf-8"> function: add_action( 'save_post', 'layered_images_save_info' ); function layered_images_save_info( $post_id ) { // verify nonce if ( ! wp_verify_nonce( $_post['layered_images_box_nonce'], basename( __file__ ) ) ) { return $post_id; } // check autosave if ( defined('doing_autosave') && doing_autosave ) { return $post_id; } // check permissions if ( 'layered_images' == $_post[ 'post_type'] && current_user_can( &#

android - Google Map API v2 Heatmap not showing all locations -

i'm trying out google api v2 heatmap (android) introduced february , it's not working entirely. i'm not sure if it's same problem google maps api v2 heatmap won't reliably display (and can't contact him comments because don't have enough rep.. :c ). using locations file anyway, trying app googlemap , same locations in guide ( https://developers.google.com/maps/documentation/android/utility/heatmap ) , when launch it, can see 3/5 locations. i tried adding more points , still, it's consistently not showing them all, can't see pattern or something. code same in guide. private void addheatmap() { list<latlng> list = null; // data: latitude/longitude positions of police stations. try { list = readitems(r.raw.police_stations); } catch (jsonexception e) { toast.maketext(this, "problem reading list of locations.", toast.length_long).show(); } // create heat map tile provider, passing lat

javascript - How get only the styles declared in a stylesheet's declaration and not the computed ones? -

if loop through document.stylesheets find css rule matched .myclass , more style values ones declared. for example, css: .myclass { border: none; } i of these rules: border: medium none borderbottom: medium none borderbottomcolor: -moz-use-text-color mozborderbottomcolors: none borderbottomstyle: none borderbottomwidth: medium bordercolor: -moz-use-text-color borderimage: none borderimagesource: none borderimageslice: 100% 100% 100% 100% borderimagewidth: 1 1 1 1 borderimageoutset: 0 0 0 0 borderimagerepeat: stretch stretch borderleft: medium none borderleftcolor: -moz-use-text-color mozborderleftcolors: none borderleftstyle: none borderleftwidth: medium borderright: medium none borderrightcolor: -moz-use-text-color mozborderrightcolors: none borderrightstyle: none borderrightwidth: medium borderstyle: none bordertop: medium none bordertopcolor: -moz-use-text-color mozbordertopcolors: none bordertopstyle: none bordertopwidth: medium borderwidth: medium color: rgb(200, 200,

spring - I want my controlleradvice to always produce JSON when handling exceptions -

i have centralized exception handling rest service neat controlleradvice. i returning regular transfer-objects, in hope of cool mapping-jackson-converter convert json end client. now here's thing. if don't set accept-header "application/json", don't converted json, default html instead, in tests seemingly generated jetty. have admit i'm not sure why, guess it's default spring resolver comes effect. this got me thinking. clients call rest url's should know return json, service return json regardless. is there way configure reqeustmappinghandleradapter produce json? my current config: <beans:bean class="org.springframework.web.servlet.mvc.method.annotation.requestmappinghandleradapter"> <beans:property name="messageconverters"> <beans:list> <beans:ref bean="jsonconverter"/> </beans:list> </beans:property> </beans:bean

javascript - Is the 'catch' method name of JS Promises/A+ invalid since it's a JS keyword? -

i started use js promises in project recently. noticed every time use .catch js linter complains. run , should looked ecmascript spec , looks right: since catch keyword can not used identifier. understand method names identifiers, invalid: promise.reject("duh").catch(alert); it should instead: promise.reject("duh")['catch'](alert); what missing? what missing? a property name not identifier, can use identifier name. spec on property accessors : memberexpression : memberexpression . identifiername callexpression : callexpression . identifiername and identifiers : identifier :: identifiername not reservedword you can use arbitrary identifer name (but not things integers) in dot property access, can't use [reserved] keywords identifier, e.g. in variable or function name. however, did change es5, in ecmascript 3 property names required identiers. that's why still need use bracket notation keywords if want support

slice - Pre-processing Source Code before slicing using Frama-c -

iam trying compare source code sliced code, frama-c normalizes code @ parsing time makes sliced code statements not identical source code statements. is possible pre-processes code using frama-c when slice using criteria resulting sliced statements can compared pre-processed statements? thanks. is possible pre-processes code using frama-c … yes! use frama-c … -print -ocode prep.c pre-process. here example: original: static uint32_t func_1(void) { int64_t l_9 = 0xa9d6923607a98815ll; int32_t *l_10 = &g_11; int32_t *l_12 = (void*)0; int32_t **l_13 = (void*)0; int32_t **l_14 = &l_12; uint16_t l_15 = 0ul; int16_t *l_16 = &g_17; uint16_t l_25 = 0x7847l; uint8_t *l_36 = &g_37; uint32_t *l_335 = &g_92; uint32_t *l_336[2]; uint8_t *l_522 = &g_523; int i; (i = 0; < 2; i++) l_336[i] = (void*)0; … normalized version obtained frama-c original.c -print -ocode prep.c : stat