Posts

Showing posts from June, 2013

.net - Signing DKIM error with UTF8 character in body -

i'm trying sign dkim email message. with non-unicode body, work : this multi-part message in mime format. ------=_nextpart_000_0011_01cf8271.717f57c0 content-type: text/plain; charset="windows-1258" content-transfer-encoding: 7bit test email ultramailer. ------=_nextpart_000_0011_01cf8271.717f57c0 content-type: text/html; charset="utf-8" content-transfer-encoding: 7bit test email ultramailer. ------=_nextpart_000_0011_01cf8271.717f57c0-- but if content contain utf-8 character, received message gmail indicate bodyhash (bh) have wrong: dkim=neutral (body hash did not verify) this multi-part message in mime format. ------=_nextpart_000_0020_01cf8275.daaa6ba0 content-type: text/plain; charset="windows-1258" content-transfer-encoding: 7bit tieng viet ------=_nextpart_000_0020_01cf8275.daaa6ba0 content-type: text/html; charset="utf-8" content-transfer-encoding: 8bit tiếng việt <p>&nbsp;</p>

c++ - Calling `shared_ptr.get()` vs copy-initialization, what's the difference? -

first version print use_count = 2; shared_ptr<int> s{make_shared<int>(15)}; auto b = s; cout<<s.use_count()<<endl; auto c = s.get(); cout<<s.use_count()<<endl; cout<<*c<<endl; second version use_count = 3; shared_ptr<int> s{make_shared<int>(15)}; auto b = s; cout<<s.use_count()<<endl; auto c = s; cout<<s.use_count()<<endl; cout<<*c<<endl; question: why behavior different between 2 versions? introduction every time make copy of shared_ptr use-count increased since have additional handle underlying resource being tracked. in order obtain value of underlying pointer, shared_ptr has member-function named get . function return address of tracked resource, not create additional shared_ptr tracking same pointer. potential dangers in first snippet have 2 instances of shared_ptr refers same resource, in latter have three. the diff

java - GWT on AppEngine - IncompatibleRemoteServiceException after method refactoring -

i have gwt application hosted on googles app engine. running fine until renamed rpc method "test()" , following error: javax.servlet.servletcontext log: greetservlet: incompatibleremoteserviceexception thrown while processing call. com.google.gwt.user.client.rpc.incompatibleremoteserviceexception: application out of date, please click refresh button on browser. ( not locate requested method 'test(java.lang.string, long)' in interface 'de.test.client.greetingservice' ) for reason reason still looking old signature of method. compiled , cleaned project several times , redeployed it, cleared browser cache , tried different browsers. in dev-mode works fine well. is there additional cache build app engine or something? ever experience similar issues? make sure method's signature same in service, serviceasync, , serviceimpl. example, make sure it's long , not "long" everywhere.

bonsaijs - Accessing the position of simple shapes -

i have rect assigned variable myrect: var myrect = new rect (250,0,20,200); i thought writing: console.log(myrect.x); would output 250 but, says " undefined ". i know how can redraw rectangle performing arithmetic on x , y coordinates. the way access x , y properties through attr() method. console.log(myrect.attr('x')); see in documentation . have admit, documentation isn't beginner-friendly yet.

mysql - PHP store, retrieve and edit an array from database -

i have problem arrays, i'm not new in php have little experience manipulating complex arrays 1 need now. i'm building shopping cart , idea of cart database row every user have , shopping process should go this when user buys product if product doesn't exist in cart script should add product cart e.g. 1=1 or in array words $cart = [ [1]=>'1' ] means product id1 quantity 1, if product exist in cart script should update quantity e.g. 1=2 , on higher quantity. this poor attempt accomplish aforementioned php <?php session_start(); require_once('config.php'); $member_id = '1'; // test data $pr_id = filter_input(input_post, 'pr_id', filter_sanitize_string); // sending id jquery/ajax works fine of course $pr_qty = '1'; // start quantity $up_qty = '5'; // test data try { $getcart = $conn->prepare("select cart members member_id = :member_id "); $getcart->bindparam(':member_id&#

c# - Integrating ASP.NET Identity to existing database -

i'm new entity framework stuff, excuse me in advance. i'm trying integrate asp.net identity project. i've got existing database, mapped , ready, , i'm using code first automatic migrations. i'm trying have identity store username, password , other fields , rest of information needs stored in table, called contact, need 1:1 connection identity table. what i've tried far merging in 1 context, i've got is: public partial class pmdb02context : identitydbcontext { static pmdb02context() { database.setinitializer<pmdb02context>(null); } public pmdb02context() : base("pmdb02context") { } --- lots of dbsets --- public dbset<applicationuser> applicationusers { get; set; } protected override void onmodelcreating(dbmodelbuilder modelbuilder) { base.onmodelcreating(modelbuilder); --- lots of mappings --- modelbuilder.entity<identityuserlogin>().has

angularjs - Passing parameters to the route on button click -

i new angularjs. have search box button hits route defined in config of angular application. <div class="search-block clearfix"> <div class="input-group"> <input type="text" placeholder="search here..." class="form-control input-sm"> <div class="input-group-btn"> <button type="button" class="btn btn-default btn-sm" go-click="search.htm">search</button> </div><!-- /btn-group --> </div><!-- /input-group --> </div> adding code snippet of route config: myapp.config(function ($routeprovider){ $routeprovider. .when('/search.htm', { controller:'controllers.searchctrl', templateurl:'/partials/search/searchpage.html' }) .otherwise({ redirectto: '/' }); .... adding directive(go-click) code well: myapp.directive( 'goclick', f

linux - Cannot run ANY shell scripts even when root -

this question has answer here: bash: /bin/myscript: permission denied 2 answers when trying run teamspeak server , minecraft server on newly rented vps ran big troubles. whenever try run shell script when root not work. one script: spigot.sh #!/bin/sh bindir=$(dirname "$(readlink -fn "$0")") cd "$bindir" java -xms5g -xmx7g -xx:maxpermsize=128m -jar spigot.jar error after trying use root root@vps23946:/home/user/minecraft# ./spigot.sh -bash: ./spigot.sh: permission denied error after trying use user user@vps23946:~/minecraft$ ./spigot.sh -bash: ./spigot.sh: permission denied results ls -l root@vps23946:/home/user/minecraft# ls -l total 22616 drwxr-xr-x 16 user root 4096 jun 6 22:39 backups -rw-r--r-- 1 user root 2 jun 7 13:54 banned-ips.json -rw-r--r-- 1 user root 110 may 25 17:32 banned-ips.txt.convert

android - onCreate Null Pointer Exception -

this question has answer here: nullpointerexception accessing views in oncreate() 11 answers i don't understand why code not running: protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_matchpage); seekbar sb1 = (seekbar) findviewbyid(r.id.seek1); sb1.setenabled(false); if (savedinstancestate == null) { getsupportfragmentmanager().begintransaction() .add(r.id.container, new placeholderfragment()).commit(); } } sb1 null. why? you using fragment . should have in code class called placeholderfragment , has oncreateview method. in project have 2 xml layout, 1 named activity_matchpage , other fragment, fragment_main . need modify latter , keep first this: <framelayout xmlns:android="http://schemas.android.com/apk/re

notifications - How can I use MySQL alias in Where condition -

i have column date of months in table, table_date 17 13 12 04 check these date lesser current date trying, or there other better way. select concat(date_format(now(),'%y-%m'),'-',table_date) duedate dhr due date < curdate() have error as unknown column 'duedate' in 'where clause' i found concatenating must done in condition select table_date table_name concat(date_format(now(),'%y-%m'),'-',table_date) < curdate()

java - Database Update & Sortable JTable Issues -

i've written custom jtable show contents of sqlite database in java program. here's code: public class sortablejtable extends jtable{ public sortablejtable() { super(); } public sortablejtable(defaulttablemodel dtm) { super(dtm); } @override public void setvalueat(object obj, int row, int col) { super.setvalueat(obj, row, col); prgview.dbc.updateorderswithticketrequestid(this.getcolumnname(col).tostring(), obj, (integer)this.getvalueat(row, 0)); } @override public class getcolumnclass(int c) { switch (c) { case 0: return integer.class; case 1: return integer.class; case 2: return string.class; case 3: return string.class; case 4: return double.class; case 5: return double.class; default: return string.class; } } } as can see, i'd whenever edits cell in custom jtable (which when setvalueat method

ios - In swift, how do I make layers of a view programmatically? -

in swift, have view 3 objects. want button , label on top of image. concept maybe layers in photoshop. currently, image on top of button , label, can not see button , label. how done? my code here: import uikit class viewcontroller: uiviewcontroller { override func viewdidload() { super.viewdidload() // additional setup after loading view, typically nib. let myfirstlabel = uilabel() let myfirstbutton = uibutton() let myfirstimage = uiimage(named: "1792614.jpg") let myfirstimageview = uiimageview(image: myfirstimage) myfirstlabel.text = "i made label on screen #toogood4you" myfirstlabel.font = uifont(name: "markerfelt-thin", size: 45) myfirstlabel.textcolor = uicolor.redcolor() myfirstlabel.textalignment = .center myfirstlabel.numberoflines = 5 myfirstlabel.frame = cgrectmake(15, 54, 300, 500)

python - Kivy Popup or Eventloop Interaction? -

the first screen of app has small menu (in gridlayout) of 3 buttons. 2 supposed open popups. 1 , 1 about. third 1 changes screen. only 1 popup works. first 1 called (in kivy file) works, second doesn't open popup. if switch order in cdd.kv, other 1 works. excerpt cdd.kv: cddmainmenulayout: helpbutton: size_hint: .5,.5 metadatabutton: size_hint: .5,.5 on_release: app.root.current = 'metadata' aboutbutton: size_hint: .5,.5 excerpt main.py: class cddmainmenulayout(gridlayout): """ provides layout 3 buttons on home screen. """ def __init__(self, *args, **kwargs): super(cddmainmenulayout, self).__init__(*args, **kwargs) self.rows = 1 self.cols = 3 self.size_hint = (.5,.5) ... class cddbutton(button): def __init__(self, **kwargs): super(cddbutton, self).__init_

Proguard and Cordova via CLI -

it possible compile cordova app proguard via cli ? how can this? helps appreciated. for record: here can find more information matter, hope helps https://iphonedevlog.wordpress.com/2014/12/05/adding-proguard-to-your-android-cordova-project/

javascript - requirejs dependency function's this is window -

i use requirejs , 1 dependency is define(function(){ ..... fusionchart = function(){ this.xxxx = ....;//the statement catch wrong,this window not object } return fusionchart; }); i'm new requirejs,i don't know why,and how avoid it there nothing wrong require here. "this" in inner functions points window. read http://javascriptweblog.wordpress.com/2010/08/30/understanding-javascripts-this/ if fusionchart meant constructor function then: define(function(){ var fusionchart = function(){ this.x = 0; }; return fusionchart; }); elsewhere in code: define(function(){ var fusionchart = require('fusionchart'); var fusionchartinstance = new fusionchart(); }); you can make fusionchart behave singleton returning new fusionchart(); won't have create instance when require it. requirejs point same reference. define(function(){ var fusionchart = function(){ this.x = 0; }; retur

java - How to get two Primefaces panels next to each other? -

is there way in primefaces place 2 primefaces panel adjacent each other ? panels getting rendered in vertical alignment. couldn't them rendered in horizontal alignment , next each other. tried using h:panelgrid also. no luck. here code fragment: <h:panelgrid> <p:row> <p:column> <p:panel id="panel22" header="new bill"> <p:inputtext>aaa</p:inputtext> </p:panel> </p:column> <p:column> <p:panel id="panel222" header="chart"> <p:inputtext>bbb</p:inputtext> </p:panel> </p:column> </p:row> </h:panelgrid> try below code. show both panels side side same height. <h:panelgrid columns="2"> <p:panel id="panel22" header="new bill" style="height:200px"> <p:inputtext>aaa</p:inputtext> </p:panel> &

smallbasic - How do I make a fast refreshing counter? -

i'm trying make refreshing counter... take example - let's use position of mouse (within window). i've tried clearing , redrawing bugs out when there many elements draw. a = 1 while(a = 1) program.delay(10) graphicswindow.clear() graphicswindow.drawtext(10,10,mouse.mousex) graphicswindow.drawtext(10,20,mouse.mousey) endwhile which works... except flashes because refreshing fast... if increase delay, not work correctly, when doing stopwatch. thing cannot support large amount of commands... like: a = 1 while(a = 1) program.delay(10) graphicswindow.clear() graphicswindow.drawtext(10,10,mouse.mousex) graphicswindow.drawtext(10,20,mouse.mousey) graphicswindow.drawtext(100,100,"text") graphicswindow.brushcolor = "#ff0000" graphicswindow.drawtext(100,200,"text") graphicswindow.brushcolor = "#00ff00" graphicswindow.drawtext(100,300,"text") graphicswindow.brushcolor = "#0000ff" gr

regex - how replace string repeated pattern at his start ,linux terminal? -

i want edit string using regular expression in linux shell failed. the thing want @ start of string change repeatedlly occurrence of "00" "1" let : 00000120001 110100001 failed that. i tried: echo 00000120001 | sed 's/^\`\<00/1/g' but got 1000120001 not sure can single regex; have solution juggling hold , pattern spaces of sed . in 1 line: sed 'h;s/[^0].*//;s/00/1/g;x;s/^0*//;x;g;s/\n//' <<< '00000120001' with details: sed 'h # copy input line hold space s/[^0].*// # keep 00..0 preffix in pattern space s/00/1/g # replace double 0s 1s in pattern space x # swap hold , pattern spaces (hold 110, pattern 00000120001 s/^0*// # remove 00..0 prefix pattern space x # swap hold , pattern spaces (hold 120001, pattern 110 g # append hold space pattern space (pattern 110\n120001) s/\n//' # remove \n pattern <<< '

Is it possible to suppress certain activities from the activity feed messages in Alfresco? -

i trying suppress messages in activities feed document library , tried following "chain of events" speak cannot find in alfresco suppress, instance, deleted files activity feed. the fastest approach (globally) weed out types of events drop copy of activity.post.json.js in classes/alfresco/extension/templates/webscripts/org/alfresco/slingshot/documentlibrary/activity.post.json.js , tweak postactivity ignore events want rid of. alternatively, can override activitypostservice defined in alfresco/web-inf/classes/alfresco/subsystems/activitiesfeed/default/activities-feed-context.xml , filter out events there. finally, if need weed out activities @ user level, might want override feedtaskprocessor .

unity container - PRISM 5, StockTraderRI, NewsController: Injection magic? -

in prism 5 stocktrader example class called newscontroller . usage in application in articlenews.xaml.cs : public partial class articleview : usercontrol { // note - import here controller created , gets wired article , news reader // view models, shared instances [import] #pragma warning disable 169 private inewscontroller newscontroller; #pragma warning restore 169 ... } i don't understand when , why instance of newscontroller created. thx the prism 5 stocktrader uses mef di container resolve dependencies. in case, newscontroller class decorated export attribute. [export(typeof(inewscontroller))] and articleview has inewscontroller field decorated import attribute. view created, mef inject dependency. you might find following articles useful: imports & exports attributes stock trader reference implementation using prism library 5.0 wpf managing dependencies between components using prism library 5.0 wpf hope helps. ez

php - fputcsv does not work with large arrays -

i'm using fputcsv (obviously) create csv file of table in application. post 2d array of data to: function formatoutput(&$vals, $key){ foreach($vals $row=>&$cell){ $cell = str_replace('"', '""', $cell); $cell = str_replace(array("\n",','), '', $cell); } } function outputcsv($array) { $outstream = fopen("php://output", "w"); function __outputcsv(&$vals, $key, $filehandler) { fputcsv($filehandler, $vals); } array_walk($array, "formatoutput"); array_walk($array, "__outputcsv", $outstream); fclose($outstream); } outputcsv(unserialize($_post['data'])); so, each line in array, appends csv file. well, works fine until pass in array around 500 or more lines. is there size limit when using function? documentation doesn't mention anything. or there php setting limit size? there question here: is the

javascript - set own value to ng-options and have the first checked -

ok i'm having following: $scope.test = [ {"value" : 0, "text" : "00:00"}, {"value" : 900, "text" : "00:15"}, {"value" : 1800, "text" : "00:30"} ]; and in select i'm doing following: <select ng-model="monday.morning" ng-options="obj.value obj.text obj in test"> with following results: <select ng-model="monday.morning" ng-options="obj.value obj.text obj in test"> <option value="?" selected="selected"></option> <option value="0">00:00</option> <option value="1">00:15</option> <option value="2">00:30</option> </select> what i'm trying accomplish having value out of json options value. , have first 1 selected. possible below? <select ng-model="monday.morning"

How can I change QT listview background from delegate? -

i have listview in form , have item delegate it. need changing item's background color in terms of something, item delegate. ok let's have listview , filled list "blue", "red", "green" on other hand have item delegate listview. need change items' background colors own colors. you have overwrite paint(self, painter, option, index) function in delegate in order change way items painted. for instance: class mydelegate(qitemdelegate): #... def paint(self, painter, option, index): painter.save() # can restore original painter later. painter.setbrush(qbrush(qt.red)) # set background color. painter.restore() # restore original painter. what now? now know how paint background need value of item being painted can decide color be. can use last argument of paint function, index , qmodelindex instance can use getting value you're looking for.

php - Cannot upload .CSV via form on Mac computer -

i have script takes .csv , uploads , processes via php. works fine on browsers via windows. on otherhand, osx, fails uploads. instantly posts form without loading data. i've tried making sure .csv file has extension on osx. thank in advanced if can help. <form name="batchupload" id="batchupload" class="navbar-form pull-left" method="post" enctype="multipart/form-data"> <input name="uploadcsv" id="uploadcsv" type="file" class="button" accept=".csv"> <input name="companyid" type="hidden" value="<?php echo($_session['companyid'])?>"> <input name="action" type="hidden" value="batchupload"/> <button type="submit" class="btn btn-medium btn-info" id="submit-upload" style="margin:5px 0 0 20px;">upload</button> </form&g

internet explorer - Dynamically generate mixin using LESS -

how change mixin dynamically. i'd call less file this: .sprite-resize(facebook); then i'm trying setup mixing this: .sprite-resize(@file) { @ret: '@sprite-retina-@{file}'; @norm: '@sprite-@{file}'; .sprite-ret(@ret); .sprite-norm(@norm); } .sprite-ret(@ret) { @sprite-image: ~`"@{ret}".split(', ')[8].slice(1, -2)`; background-image: url(@sprite-image); } .sprite-norm(@norm) { .lt-ie9 & { @sprite-image: ~`"@{norm}".split(', ')[8].slice(1, -2)`; background-image: url(@sprite-image); } } // @sprite- , @sprite-retina values automatically generated me grunt plugin: "grunt-spritesmith": "~1.23.0" @sprite-facebook: 425px 142px -425px -142px 24px 24px 453px 410px '/@{images-dir}/spritesheet-icons159.png'; @sprite-retina-facebook: 25px 147px -25px -147px 24px 24px 209px 189px '/@{images-dir}/spritesheet-icons-retina159.png'; but keep getting error

html - Footer for a page with a variable length main section -

the content of main article on site changes dynamically ajax. want add footer site because can't set static height footer appears @ same position article (as if article didn't take space @ in dom). i guess easiest way show visually happens: my site here if @ footer when page loads you'll notice it's stuck behing article. delete line #mainsection .mainarticle: position: absolute; absolute positioning takes article out of flow, deleting line make positioning static, , make elements on top of each other intended.

How push on as one item to another in ListView android? -

item.xml <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/listcountry_root_relative" android:layout_width="match_parent" android:layout_height="150dp"> <imageview android:id="@+id/listcountry_item_fragment_imageview_background" android:layout_width="match_parent" android:layout_height="150dp" android:scaletype="centercrop"/> <textview android:id="@+id/listcountry_item_fragment_namecountrytextview" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="test" android:textsize="25sp" android:textcolor="@android:color/darker_gray" android:layout_marginleft="30dp" android:layout_margintop="30dp"/> </relativelayout

postgresql - How to branch SQL query statement using conditions? -

Image
let's have table customer column subject_type_fk . need find name of customer can in table person or enterprise . subject_type_fk defines of 2 tables search in. subject_type_fk can 0 or 1. subject_fk defines primary key of record person or enterprise . both tables have name column need retrieve (actually enterprise.enterprise , person.last_name ). customer.customer given input parameter. how write kind of query postgresql? update select p.last_name customer c join person p on c.subject_fk = p.person , c.subject_type_fk = 0 union select e.full_name customer c join enterprise e on c.subject_fk = e.enterprise , c.subject_type_fk = 1 (edited after op's edit)

Integration of Vaadin Charts with Grails. Compiling a widgetset and not able to use charts -

build.xml <?xml version="1.0"?> <project name="widgetset compiler" basedir="." default="compile-widgetset"> <target name="compile-widgetset"> <path id="classpath"> <pathelement path="grails-app/vaadin"/> <pathelement path="src/java"/> <pathelement path="target/classes"/> <fileset dir="libs-widgetset"> <include name="*.jar"/> </fileset> </path> <echo>compiling ${widgetset}...</echo> <property name="module" value="app.appwidgetset" /> <property name="module.output.dir" location="web-app/vaadin/widgetsets" /> <property name="localworkers" value="2" /> <mkdir dir="${module.output.dir}" /> <java classname="com.google.gwt.dev.comp

json - Android JSONObject cannot be converted to JSONArray -

i'm new in android. i'm trying json got error. trying following tutorial http://www.androidhive.info/2012/01/android-json-parsing-tutorial/ i search solution, still don't how use jsonarray. here json example [{"id":"152","category_id":"14","item_name":"restaurant1","cuisine_id":"3","cuisine_name":"chinese"},{"id":"161","category_id":"14","item_name":"restaurant10","cuisine_id":"17","cuisine_name":"middle eastern"},{"id":"153","category_id":"14","item_name":"restaurant2","cuisine_id":"17","cuisine_name":"middle eastern"},{"id":"154","category_id":"14","item_name":"restaurant3","cuisine_id":"7"

java - Set boolean from outside Thread, inside the Thread-run -

i've got boolean outside thread. use method requires thread around returns boolean. how can set boolean outside thread returned boolean? code: // handle automatic e-mail sending in new thread new thread(new runnable() { @override public void run() { // since want display toast within different thread, // need use runonuithread display runonuithread(new runnable() { @override public void run() { toast.maketext(checklistactivity.cactivity, d.t_sending_email, toast.length_long).show(); } }); /*todo: emailsuccessfullysent = */emailsender.sendemail(); } }).start(); i've read somewhere final array so: final boolean[] array = new boolean[1]; // handle automatic e-mail sending in new thread new thread(new runnable() { @override public void run() { // since want display toast within different thread, // need use runonuithread display runonui

html - display:inline-block and display:inline Property Clarification Do what to use -

as trying move subscribe button little more should in centre of text @ left side. if use display:inline can able achieve expecting for but same thing want achieve in display:inline-block and used width:400px for .panel3 #cont if zoom in browser text not wrapping inside width:400px, need responsive of text should break down automatically inside div when zoomed also. here fiddle http://jsfiddle.net/mohamedmusthafac/gbgb4/10/ html <div class="panel3"> <div id="wrap" style="padding:0.4in"> <div id="button"> <input type="submit" value="subscribe"/> </div> <div id="cont" align="left"> lorem ipsum dummy text of printing , typesetting industry lorem ipsum. </div> </div> </div> css .panel3 { width:100%; min-height:120px; background-color: #233247; border-top: 5px solid #fff; color: white; } .panel3 div

Lock users out of Active Directory with ASP.NET application -

we have intranet asp.net 4.0 application , use forms authentication employees authenticate against active directory log in. we need lock users out of ad after many failed password attempts (number set in domain policy). as works now, users locked out of application not out of ad. need lock them in ad , need call desk unlock them. i saw http://msdn.microsoft.com/en-us/library/ms998360.aspx , stated under "account lockout" activedirectorymembershipprovider locks users out of provider not out of ad. but how lock users in ad then? web.config: <membership defaultprovider="myadmembershipprovider"> <providers> <add name="myadmembershipprovider" type="system.web.security.activedirectorymembershipprovider, system.web, version=4.0.0.0, culture=neutral, publickeytoken=b03f5f7f11d50a3a" connectionstringname="adconnectionstring" connectionusername="administrator" conn

c++ - Dealing with compilation times when editing headers -

i'm working on huge project uses system that, when running make, generates header files contain constants used everywhere in code. due size of project if 1 of headers changed (a constant removed or added) whole project must recompiled (which takes several hours). my initial solution write sort of constantmanager class has map each code-value pair , getter returns given code string returns value (pretty straight forward) , change header generator define constants #define s expand instance of constantmanager , call getter. problem not work switch statements (well... case statements actually) because return values not constant expressions. my question is: there alternative solutions problem or trick make mine work switches? you split huge header smaller ones , include those. might lot of initial work straight forward , compatible current solution. another option create make constmanager class have constexpr members. not need cannot use map. constmanager.h na

PowerShell Read Form Pipe - not blocking one or even both sides? -

the powershell-script start namedpipe server: $enc = [system.text.encoding]::ascii $buf = new-object byte[] 4096 $basename = "testpipe" $n = 0; { $n++ $pipename = "$basename$n" $delpipe = [system.io.directory]::getfiles("\\.\pipe\")|where{$_ -match $pipename} } while ( $delpipe.length -gt 5 ) $pipedir = [system.io.pipes.pipedirection]::inout $pipemsg = [system.io.pipes.pipetransmissionmode]::message $pipeopti = [system.io.pipes.pipeoptions]::asynchronous $pipe = new-object system.io.pipes.namedpipeserverstream( $pipename, $pipedir, 1, $pipemsg, $pipeopti ) if ( !$pipe.isconnected ) { $pipe.waitforconnection() } echo "connected pipe: $pipename" $pw = new-object system.io.streamwriter $pipe $pw.autoflush = $true $pr = new-object system.io.streamreader $pipe the pipeclient sends message: writeline(pipehandel,"hi message"); fileflush(pipehandel); now want read pipe , have found 2 ways 1) client

javascript - Create new <li> element with textarea onclick of button -

html: <li><textarea></textarea></li><br><a id="newpoints"></a> <input type="button" value="+ add new point" onclick="newpoint();"> css (if need it): textarea { font-family: georgia, 'times new roman', times, serif; vertical-align: text-top; width: 300px; height: 60px; resize: vertical; padding: 10px; } and javascript: function newpoint() { var = document.getelementbyid("newpoints"); a.innerhtml += '<li><textarea placeholder="to delete point, select textbox , press &quot;delete&quot; button on keyboard." onkeydown="if(event.keycode == 46) { this.parentnode.nextsibling.parentnode.removechild(this.parentnode.nextsibling); this.parentnode.parentnode.removechild(this.parentnode); }"></textarea></li><br>'; } to better visualise, here's fiddle . so basically, code above,

Let TeamCity track warnings from IAR-Compiler via command line runner -

i working teamcity's latest version. have configured teamcity compile iar embedded workbench projects via command line runner follows: run: executable parameters command executable: %iar_path%\common\bin\iarbuild.exe command parameters: project1/example_project/_build/example.ewp -build debug svn structure is: <root>---- tags | +--------- branches | +--------- trunk | +---- example_project | +---- _build in order highlight "todo-notes", have function generates warnings todo notes can see in compile log. examples: file_main.cpp(353) : warning[todo]: "this should done tomorrow." main.cpp(99) : remark[ga826]: parameter "foobar" never referrenced. debug.cpp(123) : remark[pe192]: argument incompatible corresponding format string conversion how can make teamcity track these warning messages? want show them in overview-tab, or if impossible, in warning tab. i've tried figure o

How do I setup session replication in Sakai 10? -

the recent open apereo 14 conference had session distributed caching , session replication in sakai 10: http://lanyrd.com/2014/apereo/sdbbct/ what steps need take sakai 10 allow session replication? session replication part of sakai 10, turned off default. enable it, need: terracotta installed, configured, , running (version 3.7.6 required http://fossies.org/linux/misc/terracotta-3.7.6.tar.gz ) multiple tomcat servers behind load balancer the following sakai.properties settings set (found here https://source.sakaiproject.org/svn/config/trunk/configuration/bundles/src/bundle/org/sakaiproject/config/bundle/default.sakai.properties ): # cluster caching (knl-1184) # warning: requires external distributed caching server # enable distributed caching # default: false #memory.cluster.enabled=true # urls of distributed cache servers #memory.cluster.server.urls.count=2 #memory.cluster.server.urls.1={cache_server_url_1}:9510 #memory.cluster.server.urls.2={cache_server_ur

spring - Why can't @Value inject a JNDI value from the Environment? -

i'm having trouble injecting jndi values tomcat spring java config using @value annotation whereas have no trouble retreiving values via environment class. using java 1.7.0_17, spring 4.0.3, , tomcat 7.0.52 . i have in context.xml following variables defined: <environment name="user_name" value="initech" type="java.lang.string" /> <environment name="user_password" value="1n3+3ch!" type="java.lang.string" /> in java configuration file have following code working : @bean public foo foo( environment env ){ return new foo( env.getproperty("user_name"), env.getproperty("user_password") ); } when server log see: 12:50:45.214 [rmi tcp connection(3)-127.0.0.1] debug o.s.c.e.propertysourcespropertyresolver -> searching key 'user_name' in [servletconfiginitparams] 12:50:45.214 [rmi tcp connection(3)-127.0.0.1] debug o.s.c.e.propertysourcespropertyresolver -> search