Posts

Showing posts from May, 2012

wso2esb - WSO2 ESB/GREG High Availability -

i’m attempting configure wso2 esb/greg in high availability configuration, follows: two greg-esb pairs, installed/configured on 2 separate solaris servers. each server has instance of greg 4.5.3 (port offset 0) , esb 4.7.0 (port offset 1) installed in separate installation directories. greg installations configured use oracle jdbc datasource, both connecting same database/schema, adding 1 greg visible in other. esb installations configured remote gregs above (each on same server) , pointing same oracle database/schema configuration/governance registry artifacts. tribes synchronization enabled on 4 installations. we plan use our own load balancer round-robin traffic either 1 or other esb idea if 1 of solaris servers down, still have full functionality on other. i couldn’t find example of such ha configuration in wso2 documentation. the questions are: . did attempt such configuration (did work)? . possible? you can refer docu

Automatically remove named parameters from a Python function call -

i've written python library uses lot of named parameters in function calls, , i'm wondering if there's way automatically remove of these named parameters, instead of removing them manually (which tedious task). for example, possible translate function call: getclass(lang="java", body=[ mainmethod(lang="java", body=[ println(lang="java", toprint="hello world") ]) ]) into function call below (which omits named arguments, , more concise?): getclass("java", [ mainmethod("java", [ println("java", "hello world!") ]) ]) in order this, 1 possible approach write function print own function call string - however, don't think it's possible write function this. there other approaches problem might work well? there no need. keyword arguments can still passed positionally. there added benefit, here, of being able specify 1 or none of them, if plea

jquery - javascript return statement not working -

i have bug code won't exit routine. i'm using return statement... doesn't seem working. have following code inside click event: $.getjson( url = 'myserver/controller/checkforduplicate', parameters, function(data) { if (data=='true') { alert(data); $('#verror').html("a duplicate entry exists"); return false; } } ); console.log($('#myform').serialize() ); when input data should considered duplicate , trigger click event, system doesn't exit still gets console.log statement. edit 1 i've reviewed answers found at: how return response asynchronous call? i'm reading, haven't defined callback function? thought that's doing "function(data) {}" code... in addition stackoverflow, i

r - What is the name of this syntax trick & where is it documented? -

haven't run before. page of pairs.panels in package psych , 1 finds following: data(iris) pairs.panels(iris[1:4],bg=c("red","yellow","blue")[iris$species],pch=21) i want ask argument, sets background color of circles drawn data points: bg=c("red","yellow","blue")[iris$species] clearly, argument associates 3 levels of iris$species , factor, 3 colors given. i'm not asking does. i wondering way of associating arguments passed data levels on fly called, , documented? seems r magic. if writing function, pass colors , column name of factor separately , make association manually behind scenes. trick useful. on face of [iris$species] looks data indexing itself. can't type [iris$species] in console instance, gives error. can type c("red","yellow","blue")[iris$species] , correct answer. seems there might recycling going on, i'm not sure. i'd curious documented, ,

javascript - How to get value from text input on blur of field -

this question has answer here: jqueryui datepicker fires input's blur before passing date, avoid/workaround? 7 answers i'm trying write javascript value 2 text inputs, should straightforward. amiss. here code: <script> jquery(function() { jquery('#frompicker, #topicker').datepicker({ dateformat : 'yy-mm-dd' }); jquery('#submit').attr('disabled', 'disabled'); jquery('#topicker').on('blur', function() { var fromdate = jquery('#frompicker').val(); var todate = jquery('#topicker').val(); console.log(todate); if (fromdate !== '' && todate !== '') { if (isvaliddate(fromdate) && isvaliddate(todate)) { jquery('#submit').removeattr(

r - All combinations of all sizes? -

there thousands of results on when search "vector combinations in r" can't find answer question. apologies if duplicate: i have vector (1,2,3,4) , want find combinations (n choose 2) (n choose n). in other words, vector want: 1,2,3,4 1,2,3 1,2,4 1,3,4 2,3,4 1,2 1,3 1,4 2,3 2,4 3,4 and code generalizable once have larger vector, able generalize. thanks! if prefer compact code map(combn, list(x), seq_along(x)) ## [[1]] ## [,1] [,2] [,3] [,4] ## [1,] 1 2 3 4 ## [[2]] ## [,1] [,2] [,3] [,4] [,5] [,6] ## [1,] 1 1 1 2 2 3 ## [2,] 2 3 4 3 4 4 ## [[3]] ## [,1] [,2] [,3] [,4] ## [1,] 1 1 1 2 ## [2,] 2 2 3 3 ## [3,] 3 4 4 4 ## [[4]] ## [,1] ## [1,] 1 ## [2,] 2 ## [3,] 3 ## [4,] 4 to avoid repetition, you'll have deal nested list can simplify result using unlist res <- map(combn, list(x), seq_along(x), simplify = false) unlist(res,

ruby - Error when running rails server for the first time in a new dev environment -

i trying run rails server for first time in new dev environment (os x) , getting following error: => booting webrick => rails 4.0.0 application starting in development on http://0.0.0.0:3000 => run `rails server -h` more startup options => ctrl-c shutdown server exiting /users/me/.rvm/gems/ruby-2.0.0-p247@railstutorial_rails_4_0/gems/railties-4.0.0/lib/rails/railtie/configuration.rb:95:in `method_missing': undefined method `action_mailer' #<rails::application::configuration:0x007fe4fe066c70> (nomethoderror) /users/me/me/rails_projects/first_app/config/environments/development.rb:17:in `block in <top (required)>' /users/me/.rvm/gems/ruby-2.0.0-p247@railstutorial_rails_4_0/gems/railties-4.0.0/lib/rails/railtie/configurable.rb:24:in `class_eval' /users/me/.rvm/gems/ruby-2.0.0-p247@railstutorial_rails_4_0/gems/railties-4.0.0/lib/rails/railtie/configurable.rb:24:in `configure' /users/me/me/rails_projects/first_app/config/environments/dev

Django retrieving users from tuples -

auth_user_model = getattr(settings, 'auth_user_model', 'auth.user') class friend(models.model): """ model represent friendships """ to_user = models.foreignkey(auth_user_model, related_name='friends') from_user = models.foreignkey(auth_user_model, related_name='_unused_friend_relation') created = models.datetimefield(default=timezone.now) objects = friendshipmanager() class meta: verbose_name = _('friend') verbose_name_plural = _('friends') unique_together = ('from_user', 'to_user') def __unicode__(self): return "user #%d friends #%d" % (self.to_user_id, self.from_user_id) class friendshipmanager(models.manager): def unread_requests(self, user): """ return list of unread friendship requests """ key = cache_key('unread_requests', user.pk)

php - Codeigniter - load a model in my library -

i'm write own library in codeigniter check if logged in user admin or not. need compare value value of typeaccount in db. because i'm still learning mvc pattern had question before starting write library. can load model in library? or should communicate directly db in library? or there better way approach this? since library kind of logic, can see piece of controller. controller loads model use it. so yes load model codeigniter instead of connecting database yourself. makes code more dry too.

jQuery jPlayer play remote url: "NetworkError: 403 Forbidden" -

i using jquery jplayer circular skin on site play remote urls, following code works fine, except if url particular domain, (call http://prob.lem ), getting "networkerror: 403 forbidden - http://prob.lem/upload_music/7154816.mp3" , although have no problem either use browser, or use wget, download mp3. knowledge on jquery limited, best guess jquery jplayer sends request differently usual browser or wget (wrong?), other detects , refuse serve content. the question is: assuming guessed right, there work around site jplayer still gets content? if guess wrong, else should at? thanks, <script type="text/javascript"> //<![cdata[ var $j = jquery.noconflict(); $j(document).ready(function(){ var mycircleplayer = new circleplayer("#jquery_jplayer_1", { mp3: "http://prob.lem/upload_music/7154816.mp3" }, { cssselectorancestor: "#cp_container_1", supplied: "mp3", swfpath: "wp-content/plugins/magic-media-box/js/jplaye

postgresql - pg_restore asking for password for database when there isn't one -

i'm setting rails app on fresh ubuntu installation , created postgres databases using rake db:create:all. in databases.yml, password field databases left blank. i'm trying pg_restore of dump captured app's production deployment, keep being prompted password. have feeling settings in pg_hba.conf file, can't remember how had them set in previous ubuntu installation. how postgres trust pg_restore local connections? or there different causing issue? set trust (or peer if want match postgresql user names unix user names) local connections in pg_hba.conf . pretty answered in question. if you're specifying -h localhost explicitly you're using tcp/ip, you'll need either omit -h localhost , use -h /tmp or wherever unix_socket_directory configured live, or set trust host connections 127.0.0.1/32 in pg_hba.conf well. see pg_hba.conf , client authentication .

python 2.7 - Add an image button to top level window Tkinter -

i'm building small gui application, once button clicked new top level window open , should display images buttons. i can image button work on root window, not on top level window. blackbox appears. i have generic button on both windows , work. i'm new python. import tkinter tkinter import * pil import imagetk, image root = tkinter.tk() root.title("first window") root.configure(background = "black") def new_window(): win2 = toplevel(root) win2.geometry("650x350+50+40") win2.title("second window!") win2.configure(background = "white") def close1(): win2.destroy() img1 = imagetk.photoimage(image.open("./images/close.gif")) c1 = button(win2, image = img1, bg ="black", command = close1) c1.grid(row = 1) c2= tkinter.button(win2, text='close', command = close1) c2.grid(row = 2) nw = tkinter.

ruby on rails - Rails4 : Referencing associated model in fields_for partial -

i broke out form fields associated model partial. want reference associated model in partial i'm not sure how that. @position , @position_fields both nil. see render ..., object: @something not sure how reference current position model pass in. apps/views/events/_form.html.erb <%= f.fields_for :positions |builder| %> <%= render 'position_fields', f: builder %> <% end %> apps/views/events/_position_fields.html.erb fields <%= @position.name %> <%= f.text_field :name %> how reference associated model in fields_for partial? in apps/views/events/_position_fields.html.erb , can following: fields <%= f.object.name %> <%= f.text_field :name %> this because builder has reference each of position object , passing builder local position_fields partial name f . reading through doc useful: http://apidock.com/rails/actionview/helpers/formhelper/fields_for .

Debugging PHP Unit without IDE/xdebug -

how debug phpunit tests without ide or xdebug? fact phpunit buffers output seems mean must use debugger or ide or use $this->expectoutputstring + print_r() (or whatever) , bunch of comments (since exepcts assertions evaluated last, i've had comment out (failing) assertions). what's best practice here? imo xdebug + ide best way debug tests. if want use old fashion method printing on screen use stderr output instead stdout. for example: fprintf(stderr, "some label\n"); fprintf(stderr, "array dump: %s\n", var_export($somearray, true)); cheers!

oracleforms - Suppress/clear messages in oracle forms 10g -

i have validation code that, when user tries save, run through complex business rules , determine if current data entered matches rules enough allow save. if not, error message telling them rule in violation put @ bottom of screen using message('all foos of type bar must qux.') . when exit form, runs against validation, , if successful, asks them if want save (using built in question). if not successful, have alert informs them data lost , asks if still wish exit. trouble is, when click 'exit anyway', validation message pops up. once click ok, form closes expected. i'm attempting suppress/clear messages popup doesn't happen. i've tried changing message level still pops up. i've tried sticking in message('', no_acknowledge) lets me control in if/else chains want message popup. is there clear_messages or such can cancel messages on form waiting displayed? edit: mind explaining downvotes or why doesn't show understanding of h

javascript - Extjs Displayfield is not getting populated from the store -

i new ext js , little stuck on appears easy dont know how go achieving it. i trying retrieve data store should appear in field.displayfield format not able so. example: name: machine 45 machine 45 should retrieved store procedure when define: store:abc, value: 'program_id' instead of displaying value under program_id column displays 'program_id' , i.e name: program_id. any idea how can link store procedure , ext.form.field.display ? have tried every possible suggestion found online. my code in view file is: var name = ext.create('ext.form.field.display', { xtype: 'displayfield', id: 'program_name', name: 'name', fieldlabel: 'name', labelwidth: '250px', width: 450, height: 20, store: programassetarray, value: 'o_program_id' }); me.items.push(name); and store code is: ext.define('availability.store.programdata', { extend: 'ext.data.arra

How do I write Query code while I use Jquery in PHP -

i new php , mysql. project bio "dictionary". want find word , it's definition , couple more columns has related information regarding word m looking for. want dictionary data in nice table. i have wrote query retrieve data related word mysql database. data 4 different tables. i have wrote index.php , data.php code posted below. problems>>>>>> 1) when running inded.php file m getting error function get() { $.post ('data.php', { word: form.name.value }, function (output) { $('#defination') .html(output).show() ; }); } " 2) having difficult in writing code data.php file, please give me suggestion. m retrieving data multiple tables confusing. please me out, m struggling , appreciate help. thank you index.php <!doctype html public "-//w3c//dtd html 4.01//en" "http://www.w3.org/tr/html4/strict.dtd" <html lang="en"> <head> <title></title> <s

c# - PropertyGroupDescription not working as expected -

i using linq sql in c# wpf application , trying use propertygroupdescription group listview lastnames sql server db . my db linq designer mapping column looks this: [global::system.data.linq.mapping.columnattribute(storage="_lastname", autosync=autosync.always, dbtype="varchar(max)", isdbgenerated=true, updatecheck=updatecheck.never)] public string lastname { { return this._lastname; } set { if ((this._lastname != value)) { this.onlastnamechanging(value); this.sendpropertychanging(); this._lastname = value; this.sendpropertychanged("lastname"); this.onlastnamechanged(); } } } the table name in db contacts , thought linq code table bit post gave name. i have observable collection of d

php - Warning: mysqli_fetch_assoc() expects parameter 1 to be mysqli_result, array given in -

this question has answer here: mysqli_fetch_array()/mysqli_fetch_assoc()/mysqli_fetch_row() expects parameter 1 resource or mysqli_result, boolean given 33 answers i getting error "warning: mysqli_fetch_assoc() expects parameter 1 mysqli_result, array given in" out of code snippet "searchcar.php" $modelmake = $_post['model_make']; $result = $db->select('car_information','*', 'model_make \'%$modelmake%\''); while($row = mysqli_fetch_assoc($result)) { echo 'model'.$row['model_make']; } here code snippet "database.php" select function public function select( $table, $fields = '*', $where = '1=1', $order = '', $limit = '', $desc = false, $limitbegin = 0, $groupby = null,

How to create an zip file which contains gzip file in java? -

i able generate zip/gzip using gzipoutputstream/zipoutputstream but no clue how use zipentry gzip file thanks there no zipentry gzip because gzip format not support multiple entries. hence, see files ".tar.gz" or ".tgz" combination of 2 formats: "tar" (for sticking multiple files together) , "gzip" (for compressing them). update: if want generate gzip file within zip file, need wrap gzipoutputstream around zipoutputstream (after calling .putnextentry ). make sure don't call close() on gzipoutputstream, call .finish() .

c# - While creating the directory I'm getting some sub directories instead? -

this code : namespace testing { public partial class form1 : form { private string contentdirectory = ""; public form1() { initializecomponent(); string[] filescontent = directory.getfiles(@"c:\windows\minidump\"); string currentdate = datetime.now.toshortdatestring(); contentdirectory = path.getdirectoryname(application.localuserappdatapath) + "\\wm_" + currentdate; directory.createdirectory(contentdirectory); } what want in end directory name : c:\users\bout0_000\appdata\local\testing\testing\wm_27-03-13 instead im getting : c:\users\bout0_000\appdata\local\testing\testing\wm_\23\97\13 why ? and how can format current date : 27-03-13 , not 27/03/13 ? why ? because date format of regional settings uses slashes separate parts. when concatenate file system path, subdirectories. and how can format c

exception - a cleaner way to approach try except in python -

so, let have 3 different calls called something , something1 , something2 . and right now, im calling like try: something1 something2 except keyerror e: print e note in above code, if fails, something1 , something2 not executed , on. the wanted outcome is try: except keyerror e: print e try: something1 except keyerror e: print e try: something2 except keyerror e: print e how can achieve above code without many try except blocks. edit: so, answer chose correct worked. of others worked well. chose because simplist , modified little. here solution based on answer. runs = [something, something1, something2] func in runs: try: func() except keyerror e: print e you try this, assuming wrap things in functions: for func in (something, something1, something2): try: func() except keyerror e: print e

javascript - JS Regex: Replace all but first -

this question exact duplicate of: use regex replace first occurrence of substring of blanks 1 answer how can make regex replaces occurrences of word first? have webpage loads of text , header @ top. want make regex replaces occurrences of word first because don't want header change. var count = 0; text = text.replace(myregex, function(match) { count++; if(count==1) { return match; } else { return myreplacedvalue; } });

hadoop - Reading Hive managed table from Java Map Reduce code -

i want read managed hive table data form map reduce job. have managed hive table created table created external hive table. want run map reduce job on final managed hive table. read managed have tables have separator defaults "char 1" ascii character. did this: public static final string separator_field = new string(new char[] {1}); and later did in loop: end = rowtextobject.find(separator_field, start); but when run map reduce jar, illegal argument exception @ above line , line given below: public void map(longwritable key, text rowtextobject, context context) throws ioexception, interruptedexception ps: looked project on github reading managed hive table in mapreduce job, cannot make sense of @ https://github.com/facebook/hive-io-experimental . suppose have input file below (say xyz.txt):- 111 \001 222 121 \001 222 131 \001 222 141 \001 222 151 \001 222 161 \001 222 171 \001 222 \001 hive default delimiter(say). now in order parse file loa

math - How to find if an array of numbers is a geometric sequence in javascript -

i don't know start this. missing knowledge need know? hints give me or solution dissect? a geometric sequence ar 0 , ar 1 , ar 2 , ... yes? function isgeometric(arr) { if (arr.length <= 2) return true; // special cases var = arr[1], // dont need test before r = / arr[0], // ratio of first 2 i; (i = 2; < arr.length; ++i) if ((a *= r) !== arr[i]) return false; return true; } isgeometric([2, 4, 8]); // true isgeometric([2, 4, 5]); // false

I try to deploy my Yeoman AngularJS static site to Github pages but the git subtree command always gets rejected -

i trying deploy angularjs static site (which began yeoman) github page , following steps provided in yeoman deployment guide . succeed in steps 1 , 2 when arrive @ step 3, things go bad. step 3 tells me run git subtree push --prefix dist origin gh-pages when run see $ git subtree push --prefix dist origin gh-pages git push using: origin gh-pages git@github.com:siddhion/maxmythic_angular.git ! [rejected] 5db3233d7c0822eedc5500409ce6a2d4b73ad427 -> gh-pages (non-fast-forward) error: failed push refs 'git@github.com:siddhion/maxmythic_angular.git' hint: updates rejected because pushed branch tip behind remote hint: counterpart. check out branch , merge remote changes hint: (e.g. 'git pull') before pushing again. hint: see 'note fast-forwards' in 'git push --help' details. i follow hint , try $ git pull origin master github.com:siddhion/maxmythic_angular * branch master -> fetch_head up-to-date. and tried git su

Adapting GCS_Auth code example to Google Calendar -

i created github repo sbt project contains modified gcs_auth code example . modifying works google calendar. when run project console app, oauth token valid 3600 seconds, terrific. my question is: else must in order enable app create new calendar user, , modify , delete events in user's calendar? user create events in calendar created app. understand there 'enterprise setting' have not been able find documentation on means. oauth overview : "an application has oauth consumer key , secret (roughly equivalent role account username , password) allowed act user in domain when accessing google data apis." found "additional claims" on this page , i'm puzzling out. seems capability possible if each user accesses google calendar via domain administered via google's services. random gmail accounts not intended able grant write permission service apps. unfortunately, not meet project's needs , have write own calendar facility.

c++ - Using QThread and QTimer to run a methode -

hi have class function run according qtimer (run every 30ms example ) class testclass { public slots: void dosomthing(); } testclass::testclass() { qtimer *timer = new qtimer(); connect(timer , signal(timeout()) , , slot(dosomthing()); timer->start(30); } but want dosomthing() function run in separate thread , that's mean make dosomthing() function in separate thread , control function using timer (run function in thread every time). class testclass { public slots: void dosomthing(); } testclass::testclass() { qthread thread = new qthread (); connect(thread , signal(started()) , , slot(dosomthing()); qtimer *timer = new qtimer(); connect(???, signal(?????) , ????, slot(?????); // how can continue code timer->start(30); } how can ? class testclass : public qobject { q_object public q_slots: void dosomething(); }; int main(int argv, char** args) { qapplication app(argv, args);

datetime - How to get an UTC date string in Python? -

i trying utc date string "yyyymmdd" for following, nowtime = time.gmtime(); nowdate = date(nowtime.tm_year, nowtime.tm_mon, nowtime.tm_mday) print nowdate.strftime('%y%m%d') i used do: datetime.date.today().strftime() but gives me date string in local tz how can utc date string? from datetime import datetime, timezone datetime.now(timezone.utc).strftime("%y%m%d") or davidism pointed out, work: from datetime import datetime datetime.utcnow().strftime("%y%m%d") i prefer first approach, gets in habit of using timezone aware datetimes - j.f. sebastian pointed out - requires python 3.2+. second approach work in both 2.7 , 3.2 branches.

c# - Informix database via odbc connection - Issue with insert stored procedure -

this stored proc. - sp_insertinfo inserts entry table. i connecting via odbc dsn informix database. this code, 1 doesn't throw me error or doesn't insert record. i connected via sequelink 3.10 32-bit driver, application runs on 64-bit os. trying identify why data not getting inserted(when put breakpoint, parameterized statement actual db, there inserts same data, fails when run application code). int rowsinserted = command.executenonquery(); //this line returning -1 , data doesn't inserted. any thoughts/idea helpful? private void insertinfo() { try { using(var connection = new odbcconnection("dsn=mydsn;uid=myusername;pwd=****;")) { var command = connection.createcommand(); command.commandtype = commandtype.storedprocedure; command.connection = connection; command.commandtext = "execute proc

c++ - Constructing result in operator vs operating on default-constructed object -

i have class array labelled contents, , i'd define operators it. i'd in such way changing number of elements in class easy, expect future users change variables tracked, i'd ensure basic arithmetic operations on class efficient possible. i can see 2 way of implementing operators. taking example of vector2d class: struct vector2d { //members const static int nelem = 2; double x; double y; //constructors vector2d() {} vector2d(double x, double y) : x(x), y(y) {} //operators double& operator[] (int index) { switch(index) { case 0: return x; case 1: return y; default: return std::out_of_range ("oops"); } } // option 1: operator+ constructing result vector2d operator+ (const vector2d & rhs) const { return vector2d(x + rhs.x, y+rhs.y); } // option 2: operator+ using loop , [] ope

ssl - gsoapssl Undefined reference error -

i trying user gsoapssl in web service client , have been using gsoap out ssl now. have included gsoap++ ssl crypto , gsoapssl , tried including stdsoap2.h in main class.my issue still getting /home/user/cppworkspace/xxxxxproject/debug/../api.cpp:494: undefined reference `soap_ssl_init' can 1 point me check. i using eclipse cdt in ubuntu 12.04 lts. openssl version 1.0.1 according documentation http://www.cs.fsu.edu/~engelen/soapdoc2.html#tth_sec19.22 . need install openssl first (or ) , compile sources of application option -dwith_openssl . if error still exists, try add stdsoap2.cpp project.

Convert string of numbers to different divs with classes. Either Jquery or Ajax -

so have string of numbers echo'ed database. string of numbers like: var numbers = "12,156,4,198,759" i want string printed in different divs such as <div class="div-12"></div> <div class="div-156"></div> <div class="div-4"></div> <div class="div-198"></div> <div class="div-759"></div> this string create massive number of divs, few thousand. this either done ajax or pure client side jquery. however, ajax preferred. i have no idea how go doing this. not quite ajax, not have go in detail. please me out :) assuming you've got data ajax call comma-separated list of number, can this: http://jsfiddle.net/rra3u/1/ var numbers = "1,2,3,4,5,99"; var list = numbers.split(","); $.each(list, function(index, value){ $("#container").append("<div>").class("div-" + value).text("di

python - Specify DataType using read_table() in Pandas -

i loading text file pandas, , have field contains year. want make sure field string when pulled dataframe. i can seem work if specify exact length of string using code below: df = pd.read_table('myfile.tsv', dtype={'year':'s4'}) is there way without specifying length? need perform action on different columns vary in length. i believe enabled in 0.12 you can pass str , np.str_ , object in place of s4 convert object dtype in event or after read in df['year'].astype(object)

NumberPicker on ScrollView doesn't scroll on Android 4.0.4 -

i trying use number picker on activity parent scrollview. since there 2 number pickers arranged vertically. number picker doesn't scroll on android 4.0.4; though works on android 4.1.2 i tried remove 1 number picker, scroll view hides itself, see behavior. still seeing same. numberpicker doesn't change values , stuck. though , down arrows work well, in both cases. without scrollview in place, works well. please help. i know old question, still... this works me: numberpicker.setontouchlistener(new ontouchlistener() { @override public boolean ontouch(final view v, final motionevent event) { if (event.getaction() == motionevent.action_move && v.getparent() != null) { v.getparent().requestdisallowintercepttouchevent(true); } if (event.getaction() == motionevent.action_up) { v.performclick(); } v.ontouchevent(event); return true; } });

html - Ajax call delete cakephp -

i'm trying use ajax delete delete records that, when clicked, confirms before sending request. record deleted , work problem after deleting nothing change in view until after reload page manually. want show result in view after click "ok" in dialog my ajax code : $(document).ready(function() { if($('.confirm_delete').length) { $('.confirm_delete').click(function(){ var result = confirm('are sure want delete this?'); $('#flashmessage').fadeout(); if(result) { $.ajax({ type:"post", url:$(this).attr('href'), data:"ajax=1", datatype: "json", success:function(response){ } }); } return false; }); } }); in view : echo $this->js->link('delete', array('controller' => 'publications', 'action'=>'

javascript - Simple counter with a listener and callback -

i have simple class below starts , updates count every second. how go adding functionality listen specific value , fire callback? function counter() { this.currentcount = 0; } counter.prototype.start = function() { setinterval(this.update, 1000); }; counter.prototype.when = function(value, callback) { callback(value); }; counter.prototype.update = function() { this.currentcount++; }; in mind work this. var counter = new counter(); counter.when(50, function(value) { console.log('we arrived @ ' + value + ', requested value.'); }); counter.start(); this nice homework, i'll ;) please have on solution: function counter() { this.currentcount = 0; this.conditions = []; this.interval = undefined; } counter.prototype.start = function() { if (!this.interval) { var = this; this.interval = setinterval(function () { that.update(); }, 1000); } }; counter.prototype.stop = function

need help in parsing mime subject perl -

i managed emails gmail subject contains utf-8 characters , subject: =?utf-8?b?5l2g5aw9ios9oowlvq==?= i searched interent found encoded quoted-printable i tried using shown code decode subject use mime::quotedprint; print decode_qp("?utf-8?b?5l2g5aw9ios9oowlvq==?="); but prints same message , tried removing ?utf-8? no use, can 1 me in converting above subject utf-8 characters instead of encoding above use encode::mime::header module, in $ perl -mencode -le 'print encode::encode("utf8", \ encode::decode("mime-header", "=?utf-8?b?5l2g5aw9ios9oowlvq==?="))' 你好 你好 or #! /usr/bin/env perl use v5.10.0; use strict; use warnings; use encode qw/ decode /; $subject = "=?utf-8?b?5l2g5aw9ios9oowlvq==?="; binmode stdout, ":encoding(utf-8)"; decode "mime-header", $subject;

mysql - Using a value from one mysqli query in a second query for PHP -

i'm trying build registration page. i'm trying associate kiddies going camp parent paying camp. i've established foreign key, , these queries run fine in phpadmin. the first query inserting new kid database works fine. -the second query asking kidid added returns correct value. however third query, requires result of second query not work. i'm pretty new world , appreciate offered. require_once 'login.php'; //sending data server. $mysql = new mysqli($db_hostname, $db_username, $db_password, $db_databasename); $mysql->query("insert `kid`(`first_name`, `last_name`, `parent1_first_name`, `parent1_last_name`, `parent2_first_name`, `p2_last_name`, `p1_phone`, `p2_phone`, `p1_email`, `p2_email`, `emergencycontact_fname`, `emergencycontact_lname`, `emergencycontact_phone`, `kidstreetaddress`, `kidzip`, `specialneeds`, `dob`, `pickupid`, `kidsex`, `swimid`) values ('$kidfirstname','$kidlastname','$p1firstname','

Can I keep the terminal as the active window, even if it's in the background? - Python 3.3 -

g'day, i've posted question here . following on that, there means lock keyboard user input terminal, when it's running behind window? system requires user scan barcode (barcode scanner acts keyboard. ie. outputs string of letters , presses enter) inside terminal. however, system requires log csv file displayed on attached monitor. such, terminal in background, cursor automatically reverts log csv file when opened, disables users' barcode scan being entered terminal. i'm still relatively new python, , haven't figured out functionality of system. set such when system boots, log file automatically open on top, terminal (and cursor input) running in background. again, don't have code demonstrate attempts, have done extensive research. thing i've found may offer functionality xdotool. automatically rearrange windows such terminal @ back, , somehow automatically allocate terminal 'active' window? any here great! thanks!

How to insert data via php to multiple mysql databases? -

i trying insert username, password, , email 1 database's table, , insert same username instead of password , email, set 1 (to notifications row). here's code: <?php **$con= new mysqli("localhost","root","","users"); $con2 = new mysqli("localhost","root","","notification");** // check connection if (mysqli_connect_errno()) { echo "failed connect mysql: " . mysqli_connect_error(); } $hpassword = hash( 'sha512', $_post['password'] ); $eusername = mysqli_real_escape_string( $con, $_post['username'] ); $eemail = mysqli_real_escape_string( $con, $_post['email'] ); $fusername = str_replace(' ', '', $eusername); $check = "select * users username='$fusername'"; $result = mysqli_query($con, $check); $data = mysqli_fetch_array($result, mysqli_num); if($data[0] > 1) { echo "user in exists<br/>"; }

c++ - No matching constructor for initalization of 'ostream_iterator<int>' -

for code, why error, osteam_iterator template class ,why no matching constructor initalization of 'ostream_iterator', please give , thank you. define ostream_iterator template > class _libcpp_visible ostream_iterator int main(int argc, const char * argv[]) { vector<int> sentence1; sentence1.reserve(5);// 设置每次分配内存的大小 sentence1.push_back(1); sentence1.push_back(2); sentence1.push_back(3); sentence1.push_back(4); sentence1.push_back(5); int c = 5; copy(sentence1.begin(), sentence1.end(), ostream_iterator<int>(cout, 1)); cout << endl; the ostream_iterator class definition looks like: template< class t, class chart = char, class traits = std::char_traits<chart>> class ostream_iterator /*...*/ whereas respective constructor declared as: ostream_iterator(ostream_type& buffer, const chart* delim) since second template argument of ostream_iterator required of character type canno

git - Github release from maven-release-plugin -

i have multimodule project aggregator in root of project , parent in subdirectory, next other modules pom.xml (aggregator, inherits parent) |---parent |---module1 (inherits parent) |---module2 (inherits parent) i'm trying release project using maven-release-plugin-2.4.1 i run mvn release:prepare -ddryrun=true , works fine, if run real run, not dryrun problem @ end when trying push tag github: ... [info] checking in modified poms... [info] executing: /bin/sh -c cd "/home/hilikus/dev/eclipse workspace/jrobocom" && git add -- jrobocom-parent/pom.xml jrobocom-core/pom.xml jrobocom-simple-gui/pom.xml jrobocom-samples/pom.xml jrobocom-samples/legends/pom.xml jrobocom-samples/simple/pom.xml jrobocom-samples/simple/4lunch/pom.xml jrobocom-samples/simple/black-jacks/pom.xml jrobocom-samples/simple/bank-jumper/pom.xml pom.xml [info] working directory: /home/hilikus/dev/eclipse workspace/jrobocom [info] executing: /bin/sh -c cd "/home/hilikus/dev/eclipse wo

c# - Match Multiline & IgnoreSome -

i'm trying extract information jcl source using regex in c# basically, string can have: //jobname0 job (blablabla),'some text',msgclass=yes,ilike=potatoes, grmbl // ialsolike=tomatoes, garbage // finally=bye //other stuff so need extract jobname jobname0 , info (blablabla) , description 'some text' , other parms msgclass=yes ilike=potatoes ialsolike=tomatoes finally=bye . i must ignore after space ... grmbl or another garbage i must continue next line if last valid char , , stop if there none. so far, have managed jobname, info , description, pretty easy. other parms, i'm able parms , split them, don't know how rid of garbage. here code: var regex = "//([^\\s]*) job (\\([^)]*\\))?,?(\\'[^']*\\')?,?([^,]*[,|\\s|$])*"; match match2 = regex.match(test5, regex,regexoptions.singleline); string cartejob2 = match2.groups[0].value; string jobname2 = match2.groups[1].value; string jobinfo2 =

web services - Is it possible to run an application from a remote server on a website? -

i have website customers navigate page runs program wrote. however, program on separate server. how might run application remote server onto server hosts website? it looks ideally i'll have web host godaddy.com , i'd run application website. any thoughts? what kind of technology employing deploy apps? asp? php? it seems trying "window" app on server current site, if that's case can link app inside iframe of site. reference - http://www.w3schools.com/tags/tag_iframe.asp