Posts

Showing posts from July, 2011

c++ - How to treat std::pair as two separate variables? -

there few functions in standard library, such std::map::insert , return std::pair . @ times convenient have populate 2 different variables corresponding halves of pair. there easy way that? std::map<int,int>::iterator it; bool b; magic(it, b) = mymap.insert(std::make_pair(42, 1)); i'm looking magic here. std::tie <tuple> header want. std::tie(it, b) = mymap.insert(std::make_pair(42, 1)); " magic " :) note: c++11 feature.

linux - Use grep to search for words beginning with letter "s" -

i'm trying use grep through file, , find words starting lowercase letter "s". snippet of file: sjpope pts/2 161.133.12.95 10:21am 43.00s 0.13s 0.01s man bc rmschalk pts/3 161.133.9.147 10:22am 1.00s 0.10s 0.02s vi testb jntrudel pts/4 161.133.9.11 10:23am 2.00s 0.09s 0.00s vi testb tjbanks pts/5 161.133.9.70 10:41am 8.00s 0.06s 0.04s -ksh i want output have line stating "s". for these want search words starting given letter not lines one-liner do: grep -e '\bs' file.txt # words starting s grep -e 's\b' file.txt # words ending s i know non standard grep behavior ( \b regex anchor means word break not in extended regular expressions standard) works on modern systems.

system calls - socket syscall on linux x86_32 -

i trying hook socket system call on linux x86_32. system call not exist gated through socketcall. man socketcall: socketcall() common kernel entry point socket system calls. call determines socket function invoke. args points block containing actual arguments, passed through appropriate call. i hooked syscall (__nr_socketcall 102 on system stated on http://docs.cs.up.ac.za/programming/asm/derick_tut/syscalls.html ) own function prints , calls original function afterwards. however, function never called. furthermore, strace shows socket() syscall called. the basic question: how can hook socket syscalls on linux x86_32? subquestion: why strace show socket() syscall , not socketcall()? everything works expected on x86_64 socket syscall exists.

php - Format column number to currency -

i'm pulling number mysql database column , i want format number currency. instance, column value '85000000' , want formatted '$85,000,000' . i've tried few methods can't seem work. help. <?php $value = 85000000; echo "$".number_format($value, 2, '.', ','); ?> if don't want decimal places, change 2 0.

c# - Why can't MonoDroid find my assemblies? -

i made simple android helloworld app using xamarin studio 4.2.3 doesn't except prints out message if random number greater 0.5. works great on nexus 4 , nexus 5. the next thing i'm doing extract .dll code app's apk (from assemblies folder) using 7zip. using .net reflector , reflexil i'm modifying single instruction, brfalse.s gets generated if statement in "if(rand.nextdouble()>0.5){dostuff()}" such branches instruction right in front of call dostuff(), thereby making if statement useless , ensuring method gets called. next i'm saving patched .dll, replacing original 1 in .apk patched one, sign , zipalign .apk , i'm installing using adb. when i'm launching app on phones crashes directly , logcat shows following: 03-20 10:12:08.709: i/activitymanager(764): start proc hellomonolvl.hellomonolvl activity hellomonolvl.hellomonolvl/hellomonolvl.hellomonolvl.trialsplashscreen: pid=23099 uid=10128 gids={50128} 03-20 10:12:08.729: d/dalvikvm

aptana - Github error when pulling and pushing -

i have been working on github while now, had problem msys-1.0.dll file, fixed problem , working fine have problem statement "received disconnect 192.33.232.526: 11: bye bye" appears everytime gitpull makes pc take more time pull. how can solve problem :received disconnect 192.34.252.665: 11: bye bye thank you i found best solution use terminal easier, , faster pull , push or git commands there or generate new ssh key doing take out received disconnect 192.34.252.665: 11: bye bye message , refreshing current repository

php - pagination in custom post type issue -

i faced weird issue. make post type "insight" , want pagination (no plugin). when click on next post shows me 404 error here code <?php if ( get_query_var('paged') ){ $paged = get_query_var('paged'); } else { $paged = 1; } query_posts(array('post_type'=>'insight','posts_per_page'=>'1','order'=>'desc', 'paged' => $paged)); ?> <?php while (have_posts()) : the_post(); ?> <?php endwhile; ?> <div class="navigation"> <div class="alignleft"><?php next_posts_link('&laquo; new entries') ?></div> <div class="alignright"><?php previous_posts_link('&laquo; older entries') ?></div> </div> i don't no why happen because think code right. foy blog use this: functions.php: if ( ! function

javascript - Header and Footer tamplate in CKEditor -

i have implemented ckeditor in project per requirement. need covert html file word document @ end on user input , system creating document file perfectly. client wants me implement header , footer functionality same word in ckeditor edit area. options available implement such header footer functionality in ckeditor.? hi made patch solution. i have created table inserted information related file full path, header text , footer text , created 1 .net processes pick file path , add header , footer file , @ end application replace new file existing one. .net has nice functionality implement it.

SSRS drop down list displays no data -

i have ssrs report drop down list active,inactive , all. when select active , inactive displays data when select 'all' displays no data. have tried many possibilities did not worked me. here condition in main procedure where ( (@status = 'all') or (disableddate null , @status = 'active') or (disableddate not null , @status = 'inactive') ) and parameter query is select 'all' status union select distinct (case when disableddate null 'active' else 'inactive' end) status table change your, parameter query to: select 'all' status union select 'active' status union select 'inactive' status where condition in main procedure to: where @status = coalesce( case when status = 'all' 'all' end, case when status = 'active' 'active' end case when status = 'inactive' 'inactive' end )

c# - groupby count and percentage -

is there simple way show percentage of total within linq groupby ? i have: private static object getpageusers(ienumerable<pagehit> getpagelog) { return getpagelog .groupby(g => g.userid) .select(x => new { user = getuserfname(x.key.tostring()), numberofhits = x.count(), percentage = x.count() / total }) .orderbydescending(o => o.numberofhits); } in line percentage = x.count() / total how total? getpagelog ienumerable, has no count property. should have count() extension method. you using: private static object getpageusers(ienumerable<pagehit> getpagelog) { return getpagelog .groupby(g => g.userid) .select(x => new { user = getuserfname(x.key.tostring()), numberofhits = x.count(), percentage = (100 * x.count()) / getpagelog.count() + "%"

Unable to create new project in android -

i've update adt , android sdk 22.6.1 thereafter come across 1 weird problem. during creating new project in android there drop down menu selecting minimum required sdk in first screen below application name, project name , package name. unable open dropdown menu. skip option , in final screen shows error "navigation type "none" requires minimum sdk version of @ least 1, , current min version 0". any 1 have faced issue before?

php - Yii CActiveDataProvider returns wrong data -

i'm using 2 tables 1 many relation: campaign , group this code returns relevant campaigns in group. $models = campaigns::model()->with(array( 'campgroupassoc' => array('condition' => "groupid=$id"), ))->findall(); while code: $dataprovider = new cactivedataprovider('campaigns', array( 'criteria' => array( 'with' => array( 'campgroupassoc' => array( 'condition' => "groupid=$id" ) ), ) )); returns campaigns not in same group.. what doing wrong? thx 'campgroupassoc' => array( 'condition' => "groupid=:id", 'params'=>array(':id'=>$id) ) also better specify model groupid belongs to. , of cou

php - Wordpress: How to add additional folder for articles, besides draft and published/unpublished? -

i automatically add articles drafts wordpress script, moderator approves articles , publishes them or sends "storage" folder, able train machine learning algorithms on them. i've used use folder "trash" storing unapproved articles define( 'empty_trash_days', 999 ); in wp-config.php not seem work, articles getting deleted anyway. think should add additional category articles besides "draft", "published", etc. i've read wordpress codex seems topic isn't covered , googling yields nothing useful, "101 wordpress tips" types of pages. another question, how implement additional category in such way further updates won't break it? or may i'm doing wrong? using custom post type best solution in situation. here references creating , managing custom post types in wordpress: http://www.wpbeginner.com/wp-tutorials/how-to-use-custom-post-types/ http://blog.teamtreehouse.com/create-your-first-wordpre

time series - How to make Dummies with R -

i'm trying forecast daily electricity market price, dataset of 3 years before of daily prices, , want correct seasonal effect because cannot predict prices, want dummy diferentiate everyday of week, everymonday, everytuesday , on. can explain me how make dummies in r in order diferentiate days on week? dataset daily price, dates. thank much. you don't have that, in r, can use as.factor() treat variable categorical: set.seed(784) week <- sample(1:7, 50, rep=t) y <- rnorm(50) # treat week factor: m1 <- lm(y ~ as.factor(week)) summary(m1) results: coefficients: estimate std. error t value pr(>|t|) (intercept) 0.3148 0.3417 0.921 0.362 as.factor(week)2 0.2059 0.5029 0.410 0.684 as.factor(week)3 0.3623 0.5293 0.684 0.497 as.factor(week)4 -0.1308 0.4678 -0.280 0.781 as.factor(week)5 0.6916 0.4678 1.478 0.147 as.factor(week)6 -0.3285 0.4832 -0.680 0.500 as.factor(w

filenames - Generate file name from SHA hash -

i want use output of sha hash generate filename. recommended way that? tried base64 encoding, input results in filename containing forward slashes. prefer method output never contain characters reserved file systems. converting each byte two-digit hex number work, produces shorter output preferable. you can use this function getfilename(){ mt_srand((double)microtime()*10000); $token=mt_rand(1, mt_getrandmax()); $uid=uniqid(md5($token),true); if($uid!=false && $uid!='' && $uid !=null){ return $filename =sha1($uid);} } //create file name $filename=getfilename(); $filename = substr($filename, 0, 10); the above code uses current system time generate file name , uses mt_rand , md5 create unique file name every time code run. final filename 10 characters, , can adjust whatever number of characters want.

python 2.7 - error happens during installation of pyipopt in Ubuntu 12.04 -

having installed ipopt , trying install pyipopt in ubuntu 12.04 box, encountered following error: python setup.py install results in following error: running install running build running build_py running build_ext building 'pyipoptcore' extension gcc -pthread -fno-strict-aliasing -dndebug -g -fwrapv -o2 -wall -wstrict-prototypes -fpic -i/usr/lib/python2.7/dist-packages/numpy/core/include -i/usr/local/include/coin/ -i/usr/include/python2.7 -c src/callback.c -o build/temp.linux-x86_64-2.7/src/callback.o in file included src/callback.c:36:0: src/hook.h:5:29: fatal error: ipstdcinterface.h: no such file or directory compilation terminated. error: command 'gcc' failed exit status 1 ideas ? this interface ipopt library required compile. stated in setup.py file # have edit file in unpredictable ways # if want pyipopt work you, sorry. the easiest way handle adjust setup.py accordingly: # when installed ipopt source, used # --prefix=/usr/local # o

string - Python : extract all items that match a pattern -

is there strait forward way in python extract items match pattern, items between 2 characters (for example $$) i have tried using split("$""$") on string looks string = "$this$ $is$ $some$ $data$" with aim of getting looks this string = [ $this$, $is$, $some$, $data$ ] however doesn't work, there strait forward way extract matches pattern in python? how following code? >>> import re >>> s = "$this$ $is$ $some$ $data$" >>> re.findall(r'\$[^$]*\$', s) ['$this$', '$is$', '$some$', '$data$']

scheme - how to do a count in RACKET -

i'm trying write code in racket , know how solve i'm having trouble , can use . the function list , specific symbol , , need return number of times symbol shown in list . in test - i'm comparing result number i'm asking , should return true if number same . i've tried (if / cond / , tried acc ) - there missing . here code including test . please me find out how write . the idea of solution , take head of list , check if it's equal symbol wrote , if - n plus 1 , empty list equal 0 . ( : counts : (listof symbol) -> integer ) (define (counts n ) ; = list of symbols. (cond [(null? a) 0]) [(eq?(first a) 'x) (= n(+ n 1))] (counts( (rest a) n))) ;test: (test (eq? (counts ('a 'b 'x) )1)) there several problems code: the cond expression being incorrectly used, , else case missing there erroneous parentheses, example @ end of second line in counts , when call counts in fourth l

android - NullPointerException when saving Bitmap to SD card -

i'm trying take picture , save sd, @ point (after photo has been taken) nullpointerexception. here's code: package com.social.bearv2; import java.io.file; import java.io.ioexception; import java.text.simpledateformat; import java.util.date; import android.net.uri; import android.os.bundle; import android.os.environment; import android.provider.mediastore; import android.annotation.suppresslint; import android.app.activity; import android.content.intent; import android.graphics.bitmap; import android.view.menu; import android.view.view; import android.view.view.onclicklistener; import android.widget.button; import android.widget.imagebutton; import android.widget.imageview; import android.widget.toast; @suppresslint("newapi") public class articolo extends activity { private static final int capture_image_capture_code = 0; intent i; private button ib; private imageview imview; @override protected void oncreate(bundle savedinstancestate) { super.onc

javascript - Have useful "Red" and "Green" tests for a View Model with throttled observables -

with of another question , relevant qunit documentation can create unit tests deal async nature of throttled knockoutjs observables . however, haven't yet found elegant way have both red , green tests behave nicely in both test runners use: the qunit browser based test runner the visual studio test runner (combined chutzpah run javascript tests) suppose following view model: var person = function(firstname, surname) { var self = this; self.firstname = ko.observable(firstname); self.surname = ko.observable(surname); self.fullname = ko.computed({ write: function(val) { var parts = val.split(" "); self.firstname(parts[0]); self.surname(parts[1]); }, read: function() { return self.firstname() + " " + self.surname(); } }).extend({throttle: 20}); }; and suppose these 2 basic tests: test("can read full name", function(){ var john = new person("joh

vba - Add file path of attachment to body of email -

my work inbox has small size limit. what want do: every time user attaches file email, path location user pulls file automatically added bottom of body of email , linked. way, attachments can deleted email (saving space), link file remain intact, when you're looking through emails can still find related attachment. if more 1 file added, more 1 link added. if files added deleted, links follow suit. this macro distributed work , running every email have links every attachment. you may want take @ this code better alternative. in scenario, need expected attachment not on users local pc when uploaded. in link provided, save attachment defined location, removes attachment email, , edits email file saved.

c# - How to retrieve parent objects without children -

i have parent class person , child class employee parent class manager class person { private int _personid; private string _fullname; .... .... } class employee : person { private int _salary; .... .... } class manager : employee { private project _project; .... .... } now, need employees without managers. tried: var employees = employee e in db select e; but noticed have managers inside collection because of inheritance. thought this: var employees = employee e in db manager m in db e.personid != m.personid select e; but donэt have managers inside collection have twice same information in collection because of inheritance. need parents without children. i using db4o object database , not familiar linq. update: embeddedobjectcontainer db = db4oembedded.openfile(path_to_database); i figured out how this, have query twice not best solution. var employees =

Showing Android keyboard when activity/fragment first appears -

it seems in recent versions of android, focusing input automatically shows soft keyboard (which i'd happen). when activity/fragment first appears, if input focused, keyboard isn't onscreen. i've gone through bunch of posts seem provide solutions, can none of them work. this feels 1 of one-liners haven't managed dig up...what's answer? sometimes gave , : final inputmethodmanager imm = (inputmethodmanager) getactivity() .getsystemservice(context.input_method_service); textview.postdelayed(new runnable() { @override public void run() { imm.showsoftinput(textview, inputmethodmanager.show_implicit); textview.selectall(); } }, 200);

powerpoint - Formatting images without select -

i'm want perform variety of formatting options on images in slides. the macro runs on images i've selected in slide, i'd run macro without selecting images. here's how i'm manipulating images (in case aligning image horizontal center of slide) , piece of code i'm looking replacing: with activewindow.selection.shaperange .align (msoaligncenters), msotrue end here's entire code body far: sub testcenterimage() dim osld slide dim oshp shape each osld in activepresentation.slides if osld.slideindex > 1 exit sub 'i don't know if need line each oshp in osld.shapes if checkispic(oshp) = true 'making sure we're working images activewindow.selection.shaperange 'the portion of code need .align (msoaligncenters), msotrue end end if next oshp next osld end sub function checkispic(oshp shape) boolean if oshp.type = msopicture checkispic = true if oshp.type = msoplaceholder if oshp.placeholderformat.containedtype

racket - Change literal dynamically in scheme -

i want write method takes literal, lets say turn end returns this (my turn) so, after that, if call eval , scheme call defined method my parameter turn . i did manage return literal or string, didn't manage wanted. , didn't find specification this. i assume have somehow use this: `(my,@param) doesn't work. turn symbol sounds xy problem me, perhaps there's simpler way achieve really intend do… anyway, answering question: ; need prevent evaluation of parameter, ; normal procedure won't work here - need macro (define-syntax method (syntax-rules () ((_ x) '(my x)))) ; sample input (define turn 9) (define (my param) (+ 1 param)) ; setup evaluation namespace (define-namespace-anchor a) (define ns (namespace-anchor->namespace a)) ; first test: `method` returns non-evaluated expression (method turn) => '(my turn) ; second test: evaluate returned expression (eval (method turn) ns) => 10

Rspec uninitialized constant NameError, when not requiring Rails -

i'm trying speed tests not requiring rails. moving things modules , testing separately. things faster, yay (if little confusing)... the issue have right when module requires module. my guard tests pass however, when running rspec, following: uninitialized constant useralerts::usermailerhelper (nameerror) my useralerts module looks this: module useralerts include usermailerhelper def state_events(params) .. stuff ... state_events_email(emails, params) end def state_events_email(emails, params) emails.each |email| send_message(email, params) end end and usermailerhelper so: module usermailerhelper def send_message(email, params={}) send... end end in spec/lib/user_alerts.rb test, have this: require file.expand_path("../../../app/lib/user_alerts", __file__) class biscuit include useralerts end describe useralerts context "finds users send emails to" "should return users email"

How to read first line of files in a directory using java cascading? -

i'm working on project learn cascading, , i'm stumped on problem. cascading doesn't seem have read first line of each individual file in directory, need in order discover content type text analysis. i've looked through cascading api documentation several hours, , nothing has jumped out me useful, , google doesn't produce similar question on forum. i'd avoid running jar each file individually. so, instead of: hadoop jar myapp.jar this.package.myapp inputpath/file.txt outputpath/ i'd this: hadoop jar myapp.jar this.package.myapp inputpath/ outputpath/ i'll answer own question here. turns out using cascading libraries read first line single file @ time in directory not best use. ended switching org.apache.hadoop , wrote following code (this inside main method): string inputpath = args[0]; path inputdir = new path(inputpath); filesystem lfs = filesystem.get(new congifuration()); filestatus[] files = lfs.liststatus(inputdir); for(int x=

Python PyQt4 update data on widget every 1 min -

i have pyqt4 application reads information local sqlite3 database , display data using qtablewidget . the data stored on sqlite3 changes time time.so, want update table widget once every 1 min. to simplify matters, let's assume have function called ' refresh() ' refresh contents in table widget. how make function ' refresh()' execute every 1 min? have done in tkinter using time.after() . have no idea how in pyqt . your function should called paintevent . make qtimer so: self.timer = qtcore.qtimer() self.timer.timeout.connect(self.update) self.timer.start(60000) #trigger every minute. that unless need reason update in backed , not in front end (in other words function not used drawing. otherwise should allmost without question called paintevent ). do: self.timer.timeout.connect(self.refresh)

eclipse - ADB sees my phisycal device, logcat output is present. Android device chooser doesn't -

i'm trying hook samsug galaxy ace plus eclipse testing. i'm running mac os x. have latest sdk. have 2 versions of eclipse, new 1 , indigo. neither of them see device. i checked through terminal "adb devices" see if device present , is. eclipse shows logcat output phone does. problem when try run app android device chooser window doesn't see phone. i found many posts of problem none these details. i've tried every suggestion find. please help. thanks! is minsdk param of application less or equals android version of galaxy ace? you can check minsdk in manifest , api level here

java - Register JPanel in radioButtonActionPerfomed -

Image
can catch panel name actionlistener ? here code: void models (int panenum, int tabnum, string equery, string str, string title) throws sqlexception { intomodels[panenum] = new jpanel(); intomodels[panenum].setbackground(c); intomodels[panenum].setlayout(new gridlayout(6, 2)); resultset rs = database.setconnection().executequery(equery); buttongroup modelradiogroup = new buttongroup(); while (rs.next()) { jradiobutton radio = new jradiobutton(rs.getstring(str)); radio.addactionlistener(new radiobuttonactionperformed()); modelradiogroup.add(radio); intomodels[panenum].add(radio); } intomodels[panenum].setborder(borderfactory.createtitledborder(borderfactory.createetchedborder(), title)); panelstab[tabnum].add(intomodels[panenum]); } and listener code: public class radiobuttonactionperformed implements actionlistener { public void actionperformed(actionevent e){ system.out.println("selec

java - Casting NaN value -

i learned nan unordered , playing float , double nan , tried following snippet: system.out.println("comparing isnan method: " + float.isnan((float)double.nan)); i got question if nan not-a-number why casting of nan allowed. want know happen @ architectural level when cast nan value . in javadoc can see double.nan constant of type double, can cast! double.nan valid number. http://docs.oracle.com/javase/7/docs/api/java/lang/double.html

multithreading - Why does my python socket in a thread not always close properly (i.e. if i run the program many times in a row) -

i have following code (with may debugging messages). if run few times in row (within seconds of each-other), address in use error. doesn't happen every time. socket.error: [errno 98] address in use when don't error here output: trying recv ('127.0.0.1', 38041) recved client --> none genuine without seal! shutting down con closing con done closing con shutting down running server shutdown running server close done closing done shutting down the following code: import socket threading import thread time import sleep subprocess import popen, pipe, stdout def shutdown_thread(t): print "shutting down" t.shutdown() while t.isalive(): sleep(.1) print "done shutting down" def send_with_netcat(msg): nc = popen( ['nc', '127.0.0.1', '8000'], stdin=pipe, stdout=pipe, stderr=stdout) result = nc.communicate(msg) return result class server

html - PHP mail function doesn't complete sending of e-mail -

<?php $name = $_post['name']; $email = $_post['email']; $message = $_post['message']; $from = 'from: yoursite.com'; $to = 'contact@yoursite.com'; $subject = 'customer inquiry'; $body = "from: $name\n e-mail: $email\n message:\n $message"; if ($_post['submit']) { if (mail ($to, $subject, $body, $from)) { echo '<p>your message has been sent!</p>'; } else { echo '<p>something went wrong, go , try again!</p>'; } } ?> i've tried creating simple mail form. form on index.html page, submits separate "thank submission" page, thankyou.php , above php code embedded. code submits perfectly, never sends email. please help. there variety of reasons script appears not sending emails. it's difficult diagnose these things unless there obvious syntax error. without 1 need

php - Extending SonataAdmin User with ManyToMany field -

i trying extend sonatauserbundle's user add new manytomany relationship existing entity. i extended user based on answer found here - extending sonata user bundle , adding new fields user.php /** * @orm\manytomany(targetentity="foo\barbundle\entity\pledge", inversedby="pledgedusers") **/ private $pledgedon; // (...) generated getters , setters here pledge.php /** * @orm\manytomany(targetentity="foo\userbundle\entity\user", inversedby="pledgedon") **/ private $pledgedusers; // (...) generated getters , setters here the first thing noticed when sync schema, creates 2 pivot tables, instead of one: pledge_user , user_pledge . tried adding @orm\jointable in, that's changing name of one. when add same @orm\jointable both, 'table exists' error. when try access user list in admin, getting big sql error an exception occurred while executing 'select count(distinct u0_.id) sclr0 user u0_ left join fos_user_us

shell - How to replace a sentence with space on the basis of a pattern if it occurs in the middle of a sentence -

suppose have line this: aaaa ---- bbbb i want erase ----bbbb part, want keep aaaa part in file. how can it? using sed: s='aaaa ---- bbbb' echo "$s"|sed 's/--* bb*/foo/' aaaa foo

jquery - Find all elements of specific object from object array -

i had posted question here did not answer worked me (may wasn't clear enough question). i'm posting here again want. below code while can see in console (its coming server don't know how structured). result : {object} course : {object} name : english list : {object} 1 : {object} attr1 : value1 attr2 : value2 3 : {object} attr1 : value1 attr2 : value2 other : value-other id : 1 course : {object} name : spanish list : {object} 1 : {object} attr1 : value1 attr2 : value2 3 : {object} attr1 : value1 attr2 : value2 other : value-other id : 2 based on suppose structure be: results = { other: 'something', id: '1', courses: {list:{...},name:'english'} }, { other: 'again-something', id: '2', courses: {list:{...},name:'spanish'} }, { other: 'again-something', id: '3', courses: {list:{...},name:'german'} };

Adding custom HTTP header in Mule HTTP endpoint -

i trying add custom header in mule's http endpoint: <flow name="flow"> <poll frequency="60000"> <http:outbound-endpoint address="http://user:pass@example.com" followredirects="true" method="get" exchange-pattern="request-response"> <properties> <spring:entry key="custom-header-name" value="custom-header-value" /> </properties> </http:outbound-endpoint> </poll> <echo-component /> </flow> but way of using <spring:entry> element adding custom header not seem work. i tried replacing <properties> <spring:entry key="custom-header-name" value="custom-header-value" /> </properties> with <property key="custom-header-name" value="custom-header-value"/> but not work either.

extjs - Sencha Touch insert item into TreeStore / NestedList -

is there way insert new record treestore? treestore data source of nestedlist, @ end point need add new item nestedlist here example https://fiddle.sencha.com/#fiddle/4f4 var datastore; var dataobj; ext.application({ name: 'testapp', launch: function() { // data dataobj = { items: [ { field1: '1', items: [{ field1: '1.1', items: [{ field1: '1.1.1 last', leaf: true }, { field1: '1.1.2 last', leaf: true }] }, { field1: '1.2 last', leaf: true }] }, { field1: '2', items:

wysihtml5 - Attributes are removed in HTML code -

i use wysihtml5. when insert image <img alt src="src" media_img_id="123" data-title="title" data-author="author" /> the result is <img alt src="src" /> rules img "img": { "remove": 0, "check_attributes": { "width": "numbers", "alt": "alt", "src": "url", // if compiled master manually change 'url' 'src' "height": "numbers", "media_img_id": "numbers" }, "add_class": { "align": "align_img" } }, how make attributes not removed? i have same task today extend abilities of editor. should add attributes in special object: i'm using additionaly bootstrap3-wysihtml5 - https://github.com/schnawel007/bootstrap3-wysihtml5 . object s

excel vba - VBA: How to programmaticaly create named range pointing to programmatically created sheet? -

it seems question contains proper answer, excel unfathomable reason won't execute without error. question has changed bit: why 1004? basically want use (this give me 1004): dim rngtmp range each offer in sanitizedconstinfo("offers").keys() set rngtmp = sheets(offer).range(cells(1, 1), cells(2, 2)) activeworkbook.names.add name:=offer, referstor1c1:=rngtmp activeworkbook.names(offer).referstorange.cells(1, 1) = offer next offer offer string containing name (yeah, want have both sheet , named range same name - @ least). have unknown number of those, loop for each . q: how add sheet information referstor1c1 , named range refers sheet? (i know 'sheetname'!a1:a10 syntax want sheet/range/cell objects if possible) it's because aren't qualifying ranges, need explicit: with sheets(offer) set rngtmp = .range(.cells(1, 1), .cells(2, 2)) end dots before cells important.

facebook - FB.ui method send -

fb app request working on phonegap using facebook connect phonegap plugin, "send" method not. example: fb.ui({ method: 'send', link: 'http://www.etobb.com', to: '' }, function(response) { console.log(response); }); the console.log(response) not giving me data. the reason connectplugin.java file, comes phonegap plugin (url: https://github.com/phonegap/phonegap-facebook-plugin/blob/master/src/android/connectplugin.java ) check oncomplete method @ line 240 , compare local version of java file. when adding plugin via "phonegap plugin add [long facebook github url]", seems not use latest master, 1 of releases (or likewise). oncomplete method not hand on data javascript in outdated version. so did, latest master project , it's working now, though it's not best thing do. :)

cmake - Missing trailing slash for path variable -

i have following variable in cmake: set(local_drop "~/mydrop/" cache path "path drop folder.") and works expected. same if change cmake-gui. but if try set cmake -dlocal_drop=/my/path/to/folder/ trailing slash missing. any hints? i think it's done on purpose cmake itself. can suppress changing variable type string , what's problem behavior?

database - Mysql Trigger Explicit Implicit Command Not allowed -

i m trying create trigger showing "explicit , implicit command not allowed". have tried refer other topics here i'm not clear. trigger code. use `vms`; delimiter $$ create trigger `trg_bookingdetails` after insert on `bookingdetails` each row begin declare int default 1; declare v_ga int default 0; declare v_bid varchar(20); declare v_bdate date; declare v_sdate date; declare v_sid varchar(20); declare v_bcode varchar(10); declare v_q int; declare v_vid int; declare v_jj int; declare v_ss int; declare v_mj int; create temporary table if not exists temp_boo ( `bid` varchar(50) null default null, `bdate` date null default null, `sdate` date null default null, `sid` varchar(20) null default null, `bcode` varchar(20) null default null, `vid` varchar(20) null default null ); begin select bm.bid,bm.bdate,bm.sdate,bm.sid,bd.bcode, bd.quantity v_bid,v_bdate,v_sdate,v_sid,v_bcode,v_ga bookingmaster bm, bookingdetails bd bm.sdate=new.sdate , bm.bid=bd

javascript - jQuery/Ajax success method implementation -

i have following jquery function on dom ready: $.ajax({ url : '/weather/', type: 'get', //datatype : "json", success : function(data) { alert("success"); var jsondata = object.keys(data); alert(jsondata); location = "testing"; alert(data.weather); weather = data.weather; $("location").text(location); } }).settimeout(executequery, 500); the ajax call returns proper json using change values of html. however, when line executes, $("location").text(location); the page gets redirected url appends value of 'location' above line. have used these lines elsewhere, without using success function call. can me should prevent redirect happening? no, problem lies in variable name using. don't use location since, if assign string location , redirects given string. like location="http://nettpals.com"; redirect site. use other variable name loc

mysql - Dividing count(*) sql statements to get ratios -

i have table 1 column web site name , 1 column action can done website. so, 1 row - site action ----- ------ yahoo view i trying find ratio of 1 action another. know how can entire table statement below, wondering if there statement write return ratios on site-level. yahoo 15%, google 20%, etc, listed out wouldn't have have different statement each site. thanks select (select count(*) practice action='like') / (select count(*) practice action='view') dual; the keyword need group by . not knowing field table names little hard this select sum(case when action = 'like' 1 else 0 end) countlike, sum(case when action = 'view' 1 else 0 end) countview, (sum(case when action = 'like' 1 else 0 end)/count(action)) ratioliketotal , (sum(case when action = 'view' 1 else 0 end)/count(action)) ratioviewtotal , site tbllinks group site with breakdown site can calculate ratios in app o

Android: why signing configs in Gradle require clear passwords? -

there must missing. it looks in order sign release apk in android studio, need hardcode in gradle configuration file signature password , exact location of signature file. is secure? in eclipse asked type password, , prefered way. you need hardcode in gradle configuration file signature password no. need supply build.gradle keystore password. can supply via environment variable, separate properties file (e.g., 1 not committed part of repo), or other means choose groovy can handle. in eclipse asked type password, , prefered way. you can too .

How to translate a mathematically described algorithm to a programming language? -

Image
given algorithm, described in paper of choice bunch of symbols , special notation. how learn read such algorithm descriptions , turn them computer program? the following picture describes algorithm calculate incremental local outlier factor : what best approach translate programming language? your answer can me pointing articles describe symbols being used, notation in general , tutorials on how read , understand such papers. you seem asking described part of course in first-order predicate calculus. general introduction (including notation) can found here or in library. generally, notation means "for in set ..." , implemented in programming language using for loop or similar looping structure, depending on particular language. introductory books on algorithms useful in answering questions have. example sedgewick's book algorithms in c if target computer language c.

Java constructor does not look the way it should -

i referencing y. daniel liang's book "introduction java programming, comprehensive version, ninth edition" when ask question. every time see object created using constructor, goes : car engine = new car(). but in daniel liang's book, found following code (only first 9 lines written here): public class simplegeometricobject { private string color = "white"; private boolean filled; private java.util.date datecreated; /** construct default geometric object */ public simplegeometricobject() { datecreated = new java.util.date(); } what don't understand how come object "datecreated" not created in normal way, ie.: simplegeometricobject datecreated = new simplegeometrciobject(); i'm confused. actually datecreated object class date in package java.util , inside object defining simplegeometricobject in other words java guys wrote this: package java.util; public class dat

.htaccess - URL rewrites issues -

we having problem url rewrites on apache server using .htaccess. goal: have following url stripped of category & subcategory while leaving generic redirect in place. test 1: redirect 301 /category/subcategory/product http://www.site.com/product redirect works perfectly. single redirect desired page. test 2: redirectmatch 301 ^/category/subcategory/.*$ http://www.site.com/category/subcategory redirect on own works urls desired. the problem when have both urls in clean .htaccess file, , redirects in proper order (specific first, general), general redirect being used. test 3: redirect 301 /category/subcategory/product http://www.site.com/product redirectmatch 301 ^/category/subcategory/.*$ http://www.site.com/category/subcategory when visit www.site.com/category/subcategory/product, result www.site.com/category/subcategory/product, not desired result. instead, want url www.site.com/category/subcategory/product, we have tried modified redirect to:

documentation - Is it possible to generate static HTML document from Dart source code? -

i know docgen outputs documentation in either json / yaml , can use --serve flag download , run web viewer documentation. but there way convert documentation static html files? if there isn't built in way this, there maybe third party tool suggestion accomplishes this? to view doc locally have use docgen --serve . to deploy documentation web, following: docgen --compile . copy output available in dartdoc-viewer/client/out/web/ on web server.

opencv - Documentation of CvStereoBMState for disparity calculation with cv::StereoBM -

the application of konolige's block matching algorithm not sufficiantly explained in opencv documentation. parameters of cvstereobmstate influence accuracy of disparities calculated cv::stereobm. however, parameters not documented. list parameters below , describe, understand. maybe can add description of parameters, unclear. prefiltertype: determines, filter applied on image before disparities calculated. can cv_stereo_bm_xsobel (sobel filter) or cv_stereo_bm_normalized_response (maybe differences mean intensity???) prefiltersize: window size of prefilter (width = height of window, negative value) prefiltercap: clips output [-prefiltercap, prefiltercap]. happens values outside interval? sadwindowsize: size of compared windows in left , in right image, sums of absolute differences calculated find corresponding pixels. mindisparity: smallest disparity, taken account. default zero, should set negative value, if negative disparities possible (depends on angle between camera

c# - How To Check Deadline Of a Task in Wpf Application? -

i have wpf application in application want check deadline of task without simultaneously checking of database . example - have assign 5 hrs task. want check deadline of task 5 hrs complete or not ? how perform condition ? i'm assuming task object has at least 2 properties - duration , starttime . without these 2 properties don't see possible how determine if task instance should or should not completed yet. also, duration should of type timespan . now, task _task = ... // task instance bool ispasttaskdeadline = (datetime.now - _task.starttime) > _task.duration;