Posts

Showing posts from September, 2013

how to join various bits of string and data together using python -

python newbie here. i've been working way through code create string includes date. have bits of code working data want, need formatting string tie in data together. this have far: def get_rectype_count(filename, rectype): return int(subprocess.check_output('''zcat %s | ''' '''awk 'begin {fs=";"};{print $6}' | ''' '''grep -i %r | wc -l''' % (filename, rectype), shell=true)) str = "my values (" rectypes = 'click', 'bounce' myfilename in glob.iglob('*.gz'): #print (rectypes) print str.join(rectypes) print (timestr) print([get_rectype_count(myfilename, rectype) rectype in rectypes]) my output looks this: clickmy values (bounce '2015-07-01' [222, 0] i'm tr

Where am I going wrong with Sentinel or break in this Python code -

okay program done keeps running. need figure out sentinel or break needs go. have far in python. program suppose read pres on list , print them. there slice removing first 2 , last two.then prints list size 6 , proceeds give me 6 pres in alpha reverse order. have working other repeating end indefinitely. there has while loop display elements in list returned playlist. pres = ['kennedy','johnson','nixon','ford','carter','reagan',\ 'bush','clinton','bush','obama'] pres2 = pres[2:8] def main(): names in pres: print(names) pr3=playlist(pres2) while playlist !='6': pr3 in pres2: print(pr3) def playlist(pr): size = len(pr) print('list size now', size) pr.sort() pr.reverse() return pr main() now should when run it. kennedy johnson nixon ford carter reagan bush clinton bush obama list size 6 reagan

php - CSV import in Yii2 -

did? i have trying upload csv file in project module.the csv format given below.at time of upload getting error message "1 row has validation error". values not inserted in db. what want? i want upload csv file data in mysql db. **my csv format** ============================================================================== model_name|imei_no|promoter_vendor_id|device_report_id|allocation_date ============================================================================== sam | 2342 | 7 | 3 |2015 ============================================================================== insert query mysql insert `dbname`.`tbl_device` (`device_id`,`model_name`,`imei_no`,`promoter_vendor_id`,`device_report_id`, `allocation_date`,`inserted_date`,`inserted_ip`,`inserted_by`,`updated_date`, `updated_ip`,`updated_by`,`status_in`,`record_status`)values (auto_inc,sam,34234,7,3,2015,?,?,?,?,?,?,?,?); model import function in m

AngularJS: $filter 'date' won't change format -

i'm trying filter current date format can accepted web api, format being 01/01/0001 00:00:00. here attempted code @ - var today = date(); var completedt = $filter('date')(today, 'mm/dd/yyyy hh:mm:ss'); however completedt hold "tue jul 14 2015 15:37:36 gmt+0100 (gmt daylight time)" can't seem find answer online, assume simple doing wrong. change today this: var today = new date();

docker - What does the DOCKER_TLS_VERIFY and DOCKER_CERT_PATH variable do? -

i new docker, using boot2docker on windows 7. while trying configure docker build through spotify maven plugin, asked set below env variables : docker_host docker_cert_path docker_tls_verify configuration successful not sure docker_tls_verify , docker_cert_path variables ? as mentioned in readme : by default, boot2docker runs docker tls enabled . auto-generates certificates , stores them in /home/docker/.docker inside vm. boot2docker up command copy them ~/.boot2docker/certs on host machine once vm has started, , output correct values docker_cert_path , docker_tls_verify environment variables. eval "$(boot2docker shellinit)" set them correctly. we recommend against running boot2docker unencrypted docker socket security reasons, if have tools cannot switched, can disable adding docker_tls=no /var/lib/boot2docker/profile file. in more dynamic environment, boot2docker ip can change, see issue 944 .

numpy - Meijer G-function in Python and scipy -

Image
i'm in need of meijer g function in scipy. read somewhere on internet due generality, meier g function not supported special function in scipy, should write according personal use case. my problem have no experience whatsoever complex integration. latex forbidden here, here's i'm trying solve numerically: (the first line being general case, second line case i'm trying compute), p(a), k, k2 given as wikipedia states , there 3 ways l : l runs −i∞ +i∞ such poles of Γ(bj − s), j = 1, 2, ..., m, on right of path, while poles of Γ(1 − ak + s), k = 1, 2, ..., n, on left. l loop beginning , ending @ +∞, encircling poles of Γ(bj − s), j = 1, 2, ..., m, once in negative direction, not encircling pole of Γ(1 − ak + s), k = 1, 2, ..., n. l loop beginning , ending @ −∞ , encircling poles of Γ(1 − ak + s), k = 1, 2, ..., n, once in positive direction, not encircling pole of Γ(bj − s), j = 1, 2, ..., m. how l , solve integral? way i'm used compute integrals on

How to reference a model instance at a given point of time in rails? -

i creating two-sided rental platform, owner sets price product freely. whenever renter creates booking, need lock in snapshot of product model sensitive information pricing locked in rental. 1 thing tried storing every information again @ rental model, seems vulnerable future changes , updates. is there better way overcome problem? --- edit, make more specific --- so in products table: def change create_table :products |t| t.integer :hourly_rate t.integer :daily_rate end end and in rental_requests table, need have similar columns. def change create_table :rental_requests |t| t.integer :hourly_rate t.integer :daily_rate end end which may cause problems when have update columns in product, means have update both tables. your product can have many prices, , expose price method returns latest price. rental can belong price.

hide - Mouseenter not works in jquery -

i have got simple script , cant figure why div doesnt show when hovering it. $(document).ready(function (){ $(".hidden").hide(); $('.moje').mouseenter(function () { $(".hidden").show("fast"); }); }); you cant find whole setup here https://jsfiddle.net/xbs75yhq/1/ class="moje" not exist in html! try using .main e,g, $(document).ready(function (){ $(".hidden").hide(); $('.main').mouseenter(function () { $(".hidden").show("fast"); }); }); https://jsfiddle.net/trueblueaussie/xbs75yhq/2/

magento - How to change page title for blog in neotheme nblog -

Image
i have magento site, have installed neotheme's nblog magento extension . extension uses " frontend url key's " value blog page title. want change title of wish. digged extension code no solution. appreciated. instead of hard coding 'title' value blog, can create option in extension's back-end configuration add blog page title. required make following changes:- 1.under community/neotheme/blog/etc/system.xml around line no. 149 add '' tag(underneath: tag) 'new blog page title option' in configuration:- <blog_page_title translate="label" module="neotheme_blog"> <label>blog page title</label> <comment><![cdata[this appear title blog page only]]></comment> <frontend_type>text</frontend_type> <sort_order>56</sort_order> <show

jquery - Inserting values to database while typing -

i have task.i want insert data database while typing values in textbox.... don't know possible.is possible. example appreciated. thanks in advance yes, possible that. here example you, in php way. can change jsp using references. html <input type="text" id="hey"> jquery $('#hey').on('keyup', function(){ $.ajax({ type : 'post', url : 'insertdata.php', // --> server side code insert data db data : { val : $(this).val() }, success : function(msg){ // msg -> return server side // code in success // if success print out 'new record created successfully' // if error print out 'error occured' console.log(msg); } }); }); php - insertdata.php <?php $servername = "localhost"; $username = "username"; $password = "password"; $dbname = "mydb"; // cr

How to remove/adjust Title in the Home.aspx with SharePoint 2010 -

Image
i looking way modify title in home page (/siteassets/home.aspx) removing "new" word sharepoint 2010. have edited in v4.master page. however, did not affect home page. besides that, cannot find file has code. please take @ image below. please let me know if miss change. <td style="color:#185591;font-size:2.0em;font-family:verdana,arial,sans-serif"> <marquee> welcome portal </marquee> </td> go site settings (click cog in top right hand corner , site settings) , click title, description , logo under look , feel . title you're trying change in there.

openedge - Using frames in progress 4gl -

can me understand how display following pattern using progress 4gl frame: 1 1 2 1 2 3 1 2 3 4 1 2 3 4 5. i have tried this: define variable integer no-undo. define variable b integer no-undo. =1 5 frame f: b = 1 frame f: display space skip. pause. end. end. /* while displaying answer overwritten, how display answer side side? */ if sending output file this: define variable integer no-undo. define variable b integer no-undo. output "output.txt". = 1 5: b = 1 a: put b. end. put skip. end. output close. using display , frame not text files or printers. when create frame , display "a" in defining single position variable displayed. every time display value placed in same position. you can make down frame , move new line each iteration of outer loop still have 1 position per line. define variable integer no-undo. define variable b integer no-undo. = 1 5 frame f: b = 1 a: displa

javascript - Making links active dynamically upon click -

i'm using bootstrap's default navbar . want active page represented dark gray block dynamically upon clicking link. can't seem work. here's code have far. it's similar question except i'm trying integrate bootstrap. codeply went down? new demo edits here . i think want $(".navbar-nav a").click(function() { $(".navbar-nav > .active").removeclass("active"); $(this).parent().addclass("active"); return false; });

php - Looking for some kind of "lookahead iteration" for grouping record sets -

as use be, if need display list of on site have use looping construct iterate on data. in case it's foreach() on <tr> of table foreach($candidates $candidate) and after getting values: $candidate->id problem 1 specific value, , enforcement. in db have data in table below, example candidates_id = 600 there enforcemement 1 , 0 id | candidates_id | enforcement ------------------------------------- 1 | 598 | 2 2 | 599 | 4 3 | 600 | 1 4 | 600 | 0 until okey, values db , echo on site. problem values 0 or 1 have no meaning end user. write if / else condition if($candidate->enfor == 0) echo "text1"; elseif($candidate->enfor == 1) echo "text2"; else echo "some default text"; in sample data there 2 records candidates_id=600 , different values enforcement. right script produces 2 separate <tr> elements. 1 containing <td>text1<

Passing Array of Bool to C++ Code from C# -

i'm working on project few other people, sadly no longer available reference material. project uses c# gui, , c++ updating our archaic database. @ moment, have function in c#: [dllimport("synch.dll", charset = charset.unicode, callingconvention = callingconvention.cdecl)] //synch bool synch(void * voidptr, const tchar * databasedir, const tchar * truckdir) static extern int32 synch(intptr psync, string databasedir, string destdir, ref bool[] wholefiles); wholefiles array of booleans used determine if files should synced or not, based on user input. the c++ supposed take in array, , able flip of bools true or false conditions met. if (numsyncrecords > 0){ log::writeverbose(_t(" %d recs, %d differences found"), (int) numrecsused, (int) numsynrecords); if(wholefiles[sourcefileid]){ cstring temppath = _t(""); temppath += destdir; temppath += filename; deletefile(temppa

encryption - Is there any way to use RSA in the Oracle/PL SQL? -

i need encrypt/decrypt data in pl/sql rsa (public/private key) not found way it. checked dbms_crypto package seems doesn't support rsa algorithm. is there way use rsa in pl sql? or asymmetric algorithm suggest use instead? problem description in case, generate random keys (few millions in each iteration) needs stored encrypted in db. then, when requested need decrypt keys , export file. also, not allowed store duplicate keys in db. rsa seems perfect case not supported in free version of oracle cryptography package. need suggestion handle requirements. my open source oracle pl/sql program crypto4ora can encrypt , decrypt messages using rsa public , private keys. see project page installation details. steps download, run loadjava , , run sql script. below full example of generating keys, encrypting, , decrypting: --generate keys. store private , public key later. select crypto.rsa_generate_keys(key_size => 1024) dual; --encrypt , store encrypted tex

javascript - hide/display filter for tablesorter -

i d able hide/display filters while using tablesorter. using table sorter went fine when added button execute : function display_hide_filter() { var filters = document.getelementsbyclassname('tablesorter-filter-row'); (var = 0; < filters.length; i++) { var filter = filters[i]; if (filter.style.display == 'none') { filter.style.display='inline'; } else { filter.style.display='none'; } } } i weird answer. hiding filter fine re displaying turn having filter cells under first header cell. since got poor english , css/js skills, hope didnt miss in documentation tried trough thousant times no success. thanks help there filter_hidefilters option minimizes filter row until user hovers on it. accessible friendly in user can use tab key gain access filter inputs ( demo ). if want hide/show filter row, basic code work ( demo ): html <button type="button&

python - How to stop a running function without exiting the Tkinter window entirely? -

i'm using python 2.7, , i'm trying write gui, having issues buttons. have running properly, assuming i've made mistake inputs or something, i'd way stop running function after hitting "go" button. code way long post here, simple example below. how make "stop" button break start function, not quit window entirely? maybe threading? i'm sort of new writing guis, , i'm not programmer, isn't area of expertise. the gui totally unresponsive while main function running. there must way simultaneously run function while allowing me change things in gui , hit buttons, i'm not sure how works. updates don't have implemented until next time "go" button hit though. import time tkinter import * class example: def __init__(self,master): self.startbutton = button(master,text='start',command=self.start) self.startbutton.grid(row=0,column=0) self.stopbutton = button(master,text='stop'

javascript - Print datatable - new page -

Image
i'm trying print datatable using javascript , css this: <h:commandbutton value="#{portal.btnprint}" type="submit" onclick="javascript: window.print();"/> <p:datatable id="tbl" var="item" value="#{myprins.model}" ... ... </p:datatable> @media print { table { font-size: 80%; } #menu, #header, #form, #form_error { display: none; } @page { size: a4 landscape !important; } .... .... } and, if understand weel, it's dom based printing, prints, set printed , visible on screen. problem is, can't handle end of pages: what i've tried , refused: styling row heigth or font size (problem happens again on next pages) print table per pages (1st page - print, 2nd page - print atc.). user-enemy big datatable print header on each page using @media print { thead {display: table-header-group;} } - works in firefox only export xls (i can't reason) page-break-inside: avoid; doe

websphere commerce - RAD - Data service layer wizard is not working -

i trying create new data service layer in rad. when select data service layer in wizard , on selecting next below exception in metadata logs !entry org.eclipse.ui 4 0 2015-07-13 16:38:49.199 !message unhandled event loop exception !stack 0 java.lang.noclassdeffounderror: com.ibm.websphere.command.commandexception @ java.lang.classloader.defineclassimpl(native method) @ java.lang.classloader.defineclass(unknown source) @ org.eclipse.osgi.internal.baseadaptor.defaultclassloader.defineclass(unknown source) @ org.eclipse.osgi.baseadaptor.loader.classpathmanager.defineclass(unknown source) @ org.eclipse.osgi.baseadaptor.loader.classpathmanager.findclassimpl(unknown source) @ org.eclipse.osgi.baseadaptor.loader.classpathmanager.findlocalclassimpl(unknown source) @ org.eclipse.osgi.baseadaptor.loader.classpathmanager.findlocalclass_lockclassloader(unknown source) @ org.eclipse.osgi.baseadaptor.loader.classpathmanager.findlocalclass(unknown source) @ org.eclipse.osgi.internal.bas

gem - Uninstall capistrano and install particular version in ruby-1.8.7 -

i working application of ruby-1.8.7 client. i got error when tried deploy on staging using cap staging deploy command. right now, installed capistrano-3.2.1 version . now, want remove , install capistrano-2.5.19 version. how change version of capistrano or uninstall , install new. how install capistrano ruby-1.8.7 compatible verions. i got every time error: error installing capistrano. highline required ruby version >= 1.9.3 thanks /.rvm/gems/ruby-1.8.7-p374/gems/capistrano-3.2.1 $ gem uninstall capistrano select gem uninstall: 1. capistrano-2.12.0 2. capistrano-3.5.0 3. versions > 2 uninstalled capistrano-3.5.0

r - ShinySky select2Input Bug -

here code basic shiny app. of requires packages shiny shinysky library github: https://github.com/analytixware/shinysky here reproducible example: testing <- function() { shinyapp(ui = fluidpage( sidebarlayout( sidebarpanel( select2input("select2input3", "multiple select 2 input", choices = c("a","b","c"), selected = c("b","a"), type = "select") ),mainpanel( )) ), server = function(input, output){}) } testing() i confused why though have choices c("a", "b", "c"), dropdown select b , have no other choices. have tried selected = "b", no luck. looked @ examples shiny sky , can't see missing. video tutorial showed same type of dropdown had "b" selected, yet user click on "a" or "c" in dropdown: https://www.youtube.c

SQL server 2012 - return variable value from a dynamic script -

i'm trying run dynamic script return variable can pass in rest of script. i've couple of ways of google, think still haven't got syntax correct, therefore getting error or null value returned. can please advise i've gone wrong. for example: return value variable @table_name asia database , set variable appended table name retrieved table , t5148 id table turn table name variable. have set variables script sits when other scripts loops thank you declare @table_name nvarchar(50) declare @database nvarchar(50) declare @id nvarchar(50) declare @sql nvarchar(max) set @database = 'asia' set @id = 't5178' set @sql = n'select @table_name = ''@database''+table_name ''@database''+tables (nolock) id = ''@id''' exec sp_executesql @sql, n'@table_name nvarchar(50) output', @table_name output select @tran_table if not wrong, need : declare @table_name nvarchar(50) decl

javascript - $location.search() makes angular-ui-bootstrap's tooltip disappearing -

when implemented in code mechanism change url's query in background (using $location.search ), caused disappearing tooltips have option tooltip-append-to-body , @ moment of changing url value. need tooltip-append-to-body attribute because of reasons (the simplest solution remove that's not solution me). my code looks this: js: angular.module('mapp', ['ui.router', 'ui.bootstrap']) config(['$stateprovider', '$urlrouterprovider', function($stateprovider, $urlrouterprovider) { $urlrouterprovider.when('', '/'); $stateprovider .state('home', { url: '/', reloadonsearch: false, templateurl: 'home.html' }); } ]) .controller('myctrl', ['$scope', '$timeout', '$location',function($scope, $timeout, $location) { var value = 0; var runtimeout = function() { $timeout(function() { $location.search('start', value++);

multithreading - Can one OpenCL device host multiple users on different threads? -

we're using intel opencl 1.2 inside large commercial program, running on single intel haswell cpu/gpu. conceivably, number of threads may want use gpu different functions @ different times. so questions: is idea @ allow multiple users single device? complications may face? i considering setting common context against device , platform users. set own programs, kernels , queues. i'm nervous device behaviour: can create non interacting silos of buffer, programs, queues, kernels , kernel args on 1 context? @ least, see clsetkernelarg not thread safe. from personal experience, can there no problems multiple threads, using same device context, shared between threads. there ideas on it: create multiple kernels single programm - each kernel each thread. quote khronos: clsetkernelarg safe call host thread, , safe call re-entrantly long concurrent calls operate on different cl_kernel objects though, creating separate command queue each thread may not re

python - Binary integer programming with PULP using vector syntax for variables? -

new python library pulp , i'm finding documentation unhelpful, not include examples using lists of variables. i've tried create absolutely minimalist example below illustrate confusion. import pulp identifiers = ['a','b','c','d','e'] prices = dict( zip( identifiers, [100.0, 99.0, 100.5, 101.5, 200.0 ] ) ) n = len( identifiers ) x = pulp.lpvariable.dicts( "x", indexs = identifiers, lowbound=0, upbound=1, cat='integer', indexstart=[] ) prob = pulp.lpproblem( "minimalist example", pulp.lpmaximize ) prob += pulp.lpsum( [ x[i]*prices[i] in identifiers ] ), " objective sum of prices of selected items " prob += pulp.lpsum( [ x[i] in identifiers ] )==2, " constraint choose 2 items " prob.solve() ident in identifiers: if x[ident]==1: print ident + " in basket " the output is: a in basket b in basket c in basket d in basket e in basket the op

asp.net mvc 4 - BetterCMS Security options -

hi i've started new build bettercms, theres issue, within cms.config ive added following code: <security accesscontrolenabled="true" fullaccessroles="owner" encryptionenabled="false" encryptionkey="bettercmstest"> <defaultaccessrules defaultaccesslevel="readwrite"> <add identity="everyone" accesslevel="read" isrole="true" /> <add identity="authenticated users" accesslevel="read" isrole="true" /> </defaultaccessrules> </security> now should identity="everyone" have default access level set read. when ever create new page or blog set no access. has had sort of issue before , if there i'm missing out. here site documentation: https://github.com/devbridge/bettercms/wiki/cms-configuration#security-configuration so code looks good, bettercms inheriting properties master class news or blog pages. if new

c++ - Automatically Pass Parent Pointer to its Variables? -

this functionality have, wondering if there way able pass parent pointer it's variables without having = this ? struct location; struct parent { std::vector<location*> locations; }; struct location { location(parent* p) { p->locations.push_back(this); } }; struct specialparent : parent { location = this; location b = this; location c = this; location zabazoo = this; // etc }; the point of can still specialparent->zabazoo still batch process locations operations. location = b = c = zabazoo = this; the quick brown fox jumps on lazy dog.

python 2.7 - How to remove the duplicate lines retaining first occurences -

let's input text file "input_msg.txt" file contains follwing records.. jan 1 02:32:40 hello welcome python world jan 1 02:32:40 hello welcome python world mar 31 23:31:55 learn python mar 31 23:31:55 learn python smart mar 31 23:31:56 python scripting language jan 1 00:00:01 hello welcome python world jan 1 00:00:02 hello welcome python world mar 31 23:31:55 learn python mar 31 23:31:56 python scripting language the expected output file ( let's outputfile.txt ) should contain below records... jan 1 02:32:40 hello welcome python world jan 1 02:32:40 hello welcome python world mar 31 23:31:55 learn python mar 31 23:31:55 learn python smart mar 31 23:31:56 python scripting language jan 1 00:00:01 hello welcome python world jan 1 00:00:02 hello welcome python world note: need records (including duplicate) starting "jan 1( )" , don't need duplicate records not starting "jan 1( )" i have tried following program duplicat

python - Verbatim-tag in Google App Engine not working -

i want serve polymer -code via django in google app engine . the problem is, polymer uses double curly braces, django . in newer django versions, 1 can use verbatim-tag , in version used in google app engine , this tag not implemented . is there alternative? i ended using jinja2 instead

java - JimFS: what is the purpose of /work directory -

i started use google jimfs , doing ls found there work directory in root of fs. purpose of folder? it's arbitrary directory working directory (the directory relative paths resolved against) isn't root directory, since typically isn't in real situations. can change working directory whatever want (including root) customizing configuration . here's example of setting working directory root (in case /work directory won't created): configuration config = configuration.unix().tobuilder() .setworkingdirectory("/") .build();

c# - Dynamically query entity framework with linq -

i need function key-value pair of id , description entity model populating fields on user control , i'd find way make dynamic in order avoid repeating code. my pseudo-code: public list<object> getdata(string modelname, string modelid, string modeldescription) { using(dbentities context = new dbentities()) { return (from d in context.modelname select new { id=d.modelid, description = d.modeldescription } ).tolist<object>(); } } a possible partial solution this , table needs dynamically defined too. in context have similar to public dbset<myentity> thepropertyname {get; set;} when call function modelname = "thepropertyname" so retrieve dbset via reflection run tolist on it. use foreach on entities , via reflection retrieve properties modelid , modeldescription.

javascript - how to resize images inside a div inside another div with css? -

i want resize images in div specific class, inside other div other specific class. images inside div inside other div should not resized. this works if want resize images inside classed div: div.classname>img { width:something; } but doesn't work: div.classname2 > div.classname > img { width:something; } markup <div class="classname2"> <div class="classname"> <img> </div> </div> but can't refer inside class name. so, make clear, need resize these images: <div class="classname2"> <div class="classname"> <img> </div> </div> but not these: <div class="classname"> <img> </div> i feel css rule should work div.classname2 > div.classname > img { width:something; } does fiddle show you're trying illustrate? if so, perhaps have overriding css rules somewhere?

java - PDFBOX 1.8.9 Overlay two PDF documents: Layout pages with COSArray currently not supported -

i want use apache pdfbox (1.8.9) library print white/invisible text on existing pdf documents, therefore create new document, add text in color.white , use "overlay" method merge 2 documents together. doing encountered following problem: java.lang.unsupportedoperationexception: layout pages cosarray not supported. @ org.apache.pdfbox.overlay.collectlayoutpages(overlay.java:269) @ org.apache.pdfbox.overlay.overlay(overlay.java:224) @ com.db.jocr.main.overlay(main.java:194) @ com.db.jocr.main.main(main.java:91) the code looks this: realdoc = pddocument.load(pathinputdoc); string pathwatermarkdoc = createwhiteonwhitedoc(text, pagecount, color); watermarkdoc = pddocument.load(pathwatermarkdoc); overlay overlay = new overlay(); overlay.overlay(realdoc,watermarkdoc); line 194 code throws exception "overlay.overlay(doc1, doc2)" command i found similar question on apache mailinglist (from 2009, apparently no answer, https://mail-archives.apache.org/mod_mbox/p

java - jdbc connection string with c3p0 -

i have jdbc configured c3p0. however, worried possible conflicts, since of parameters in jdbc string , c3p0 similar. here jdbc string: jdbc:mysql://1.1.1.1:3306/db?usessl=true&requiressl=true&connecttimeout=15000&sockettimeout=30000&autoreconnect=true we decided include connecttimeout, sockettimeout, autoreconnect because otherwise took long switch replica if master crashes. ( using mysql rds multi-az ). here c3p0 properties: <property name="acquireincrement" value="3"/> <property name="minpoolsize" value="5"/> <property name="maxpoolsize" value="10"/> <property name="maxidletime" value="3600"/> <!-- 1 hour --> <property name="maxconnectionage" value="7200"/> <property name="maxidletimeexcessconnections" value="600"/> <property name="idleconnectiontestperiod" value="180"/&

openerp - Using with_context in super call turns into infinite call in odoo -

in odoo context dictionary frozen no 1 can update it, 1 solution available calling method using with_context . ctx = self.env.context.copy() ctx.update({'additional_parameter' : value}) self.with_context(ctx).methodname() but when use same pattern call super method result turns infinite call. ctx = self.env.context.copy() ctx.update({'additional_parameter' : value}) super(product_product, self).with_context(ctx).create(vals) any highly appreciated. i think should try @ respective line: super(product_product, self.with_context(ctx)).create(vals)

ruby on rails - Pass a PORO from view to controller -

what best way pass plain old ruby object have in view controller method? it not object persisted in db. rather not refactor things , want ideas on best way pass object. view link_to "activate", activate_apis_path(my_ip_instance: @my_ip), class: "btn btn-primary btn-xs" controller @my_ip = params[:my_ip_instance] @my_ip string... want whole object (rails 4.2) usually best way through form. consider creating form hidden fields of @my_ip attributes. <%= form_tag activate_apis_path %> <%= hidden_field_tag "my_ip_instance[foo]", @my_ip.foo %> <%= hidden_field_tag "my_ip_instance[tomato]", @my_ip.tomato %> <%= submit_tag "activate", class: "btn btn-primary btn-xs" %> <% end %> (extra credit: loop on @my_ip 's attributes generate hidden fields.) another way serialize @my_ip json , deserialize in controller. think messier though. link_to "activate"

Android : Using multiple WebViews in one activity -

i making simple note taking application in i'm saving notes in html format support rich text formatting. far viewing notes concerned, i'm using webview show html formatted text. but, want show multiple notes on same activity. increases number of different webviews. will affect performance of app? option use webviews achieve this? i'm confused , unaware of better methods this. no, not option use webviews here. if want show spanned text can use textview, e.g.: spanned spanned = html.fromhtml("<b>your string tags here</b>"); textview.settext(spanned);

Solr Admin UI Error 500 #/Object Expected -

i need here. used solr , process 2 commands: start , create core. when try access admin ui, pops error 500 error #/object expected and cannot see dashboard. commands used 2 simple steps: bin\solr start bin\solr create -c test the cmd shows core created successfully. knows why? using solr 5.1.0 , java version 1.7. lot.

c++ - Why Does Boost Use a Global Function Override to Implement Custom Validators in "Program Options" -

this example shows function named validate defined @ global scope overloading function in boost::program_options namespace. what justifies design using global function overload? why more tightly-scoped design not implemented boost::program_options instead (e.g. overriding class method, or other scheme)? as noted in comments below, main concern user might surprised find 1 of global functions being called library. it should emphasized namespaced free functions extremely important (as opposed global-scope free functions, see this link provided chris drew). indeed, namespaced, non-class (free) functions imo major benefit of c++. my company considering major adoption of boost, seems highly regarded. but, particular design decision has me concerned. i think main surprise function defined in namespace can overloaded (hidden) function defined @ global scope. i'm going ask why c++ allows , whether considers flaw unless have brief explanation handy. user21411

Calculate % using OVER() for each row in SQL Server 2012 -

i needed guidance question on how calculate percentage between 2 cells on each row. on sql server 2012. below structure of current dataset. customer_number price_last_year price_today --------------------------------------------------- 909523 154 190 20175808 154 100 21808187 154 190 22792798 184 284 23256155 154 230 basically, trying include additional column calculates percentage of (price_today)/price_last_year) each specific row. using windowing over() function , has not worked properly. this how want new dataset like: customer_number price_last_year price_today percentage_as oftoday% 909523 154 190 23.3% 20175808 154 100 -35.1% 21808187 154 190 23.3% 22792798

android - Gradle : Error retrieving parent for item: No resource found that matches the given name '@style/SomeTheme' -

i've library project has java source , resources. in application i'm referring resources library project. working fine, add product flavours in library project following error. error:(1) error retrieving parent item: no resource found matches given name '@style/sometheme'. please see flavours added. productflavors { production { } staging { } } if remove these flavours, things working fine. what other things should make sure resources available application project when new flavours added library project ? i not want add defaultpublishconfig "dev1production" entry library project. what else can fix problem ? build.gradle of library project apply plugin: 'com.android.library' android { compilesdkversion 22 buildtoolsversion "22.0.1" defaultconfig { minsdkversion 14 targetsdkversion 22 versioncode 1 versionname "1.0" } // defaultpublishcon

github - Make changes on Git project but dot nor overwrite file on project without approval -

i'm new git , wanted ask question. i'll tell scenario here. 2 friends , working on project. owner of project. have given permissions friends edit project, source code etc, , when sync project, new files must not overwrite old 1 without (the owner) approval. is possible? github have this? if not other git page? thanks. there many ways this, perhaps easiest way implementing following work flow: collaborators fork repo, make there changes , push them master on fork. can issue pull request. review code in pull request , if satisfied merge pull request master.

python - With Celery Canvas, what is the difference between chord() and chain(group(), task) -

we're implementing workflow celery. first need run tasks in parallel, , when finished need run single task. it seems can use chord, or group , chain: chord(tasks, task) vs group(tasks) | task what exact difference between two? seem same thing. the canvas docs chaining group task automatically upgrade chord: c3 = (group(add.s(i, i) in xrange(10)) | xsum.s()) res = c3() res.get() 90

android - Hide app from Device Administration in system settings security -

i programmatically gave android application device administration access. can enable , disable admin access through application. app showing in android settings-> security -> device administrators. through application able enable , disable. please me provide way hide app in device administrators can enable , disable application's admin access through application. but app showing in android settings-> security -> device administrators. which totally normal. you can't. , security issue if "hide administrator application"...

jquery - Setting Id not working when iterating through -

var = 0; @foreach (var item in model) { <text> $('#jp_audio_' + i).attr("id", "#jp_audio_@item.id") i++; </text> } i++ seems stop working. if i++ not there set #jp_audio_0 new id, need set of ids new value, not first one. ideas why? html i++ (id's not being set new value); <audio id="jp_audio_0" preload="metadata" src="http://localhost:6060/music/streampublishedsongs/95"></audio> <audio id="jp_audio_1" preload="metadata" src="http://localhost:6060/music/streampublishedsongs/96"></audio> without i++ in code (first 1 being set working); <audio id="#jp_audio_96" preload="metadata" src="http://localhost:6060/music/streampublishedsongs/95"></audio> <audio id="jp_audio_1" preload="metadata" src="http://localhost:6060/music/streampublishedsongs/96"></aud

php - PDO ORDER BY not working on fields that are not auto increment -

this question has answer here: syntax error due using reserved word table or column name in mysql 1 answer here code: $q = $db->prepare("select * slider page = :page order index asc"); $q->bindvalue(':page', basename($_server['php_self'])); $q->execute(); if ($q->rowcount() > 0){ $result = $q->fetchall(pdo::fetch_assoc); ($i=0; $i < $q->rowcount(); $i++) { $path = $result[$i]['path']; echo "<div><img src=\"$path\"></div>"; } } as is, there no result being shown. if order different field, namely 'id' auto increment , primary key of table, results ordered correct field. ' index ' reserved word in mysql. if want use column name , in queries must surround ticks. select * `slider` `page` = :page order `index` asc

python - RemovedInDjango19Warning: Model doesn't declare an explicit app_label -

have gone through django 1.9 deprecation warnings app_label but answers couldn't fix problem, asking again. i have app added installed_apps in settings. when ever run manage.py runserver , warning, [trimmed path project]/catalog/models.py:9: removedindjango19warning: model class catalog.models.category doesn't declare explicit app_label , either isn't in application in installed_apps or else imported before application loaded. no longer supported in django 1.9. class category(models.model): the code app, signals.py from django.db.models.signals import post_save django.dispatch import receiver models import category @receiver(post_save, sender=category) def somesignal(sender, **kwargs): pass apps.py from django.apps import appconfig class catalogconfig(appconfig): name = 'catalog' verbose_name = 'catalogue' init.py import signals default_app_config = 'catalog.apps.whosconfig' django version 1.8.2 on pytho

c++ - OpenCL 2-D array multiply -

i've begun experiment opencl. i'm trying make kernel multiply 2 2-d arrays. i've done vectors, in 2-d results first row. i've tried implementing of solutions found every single of them keeps messing first row. image execution: http://i.imgur.com/ljqsurv.png here host file: #include "stdafx.h" #include <cl/cl.hpp> #include <vector> #include <iostream> #include "util.hpp" // utility library #define __cl_enable_exceptions #define rows (5) #define columns (5) #include "metrics.h" /*start main()*/ int main(void) { int = 4; /*define vectors operands , result*/ float** h_x = new float*[rows]; float** h_y = new float*[rows]; float** h_s = new float*[rows]; (int = 0; < rows; ++i){ h_x[i] = new float[columns]; } (int = 0; < rows; ++i){ h_y[i] = new float[columns]; } (int = 0; < rows; ++i){ h_s[i] = new float[columns]; } // fill ve

amazon web services - AWS ECS - Images from S3 -

i setting ec2 container service task looking use private container images. int docker registry container, can choose interface s3 storage backend. possible point task definition image reference s3 bucket instead of running full private registry/hub? save me having run little micro instance registry on it. seems thing since aws services reference each other well, can't find info on it. thanks. docker images can served @ moment private registry/hub , not standalone if want use amazon s3 backend have run registry somewhere , believe can use cheap vps other amazon ec2 micro if want run more cost efficiently have somewhere :)

Press javascript button on webpage using curl & bash -

my first post here, please if topic answered elsewhere let me know. found similar posts didn't manage use them solve problem. background: use iptv service provider offers possibility watch tv channels on rpi running kodi. provider promotes usage of iptv simple client playlist urls. making thinks shorter, playlists generated account , bound public ip address. problem, don't have , want have fix public ip address, everytime isp resets dsl connection have login on iptv provider page , press on called "update ip" button. that's annoying!! want automate bash script triggered dynamic dns service update runs on regular basis on rpi. what managed far: - use bash command curl login on webpage , save cookie text file. this: curl -c cookie.txt -d "user=mymail@mail.com" -d "pass=mypass" http://www.spicetvbox.ro/user/login and tried several ways press "update ip" button with: curl -b cookie.txt -d "press=updateip" http:

C/C++ code with GNU Scientific Library (GSL) gives different results to GNUPlot - possible floating point instabilities? -

Image
sshort: gnuplot gives better fit data gsl code does. why? short: i confused @ moment, question might not particularly worded... edit understanding improves. the original title of question was: "g++ compiling code either -o1 -o2 or -o3 flags , floating point precision" i believe code suffering numerical instabilities. gnuplot gives better fit data gsl code does, surprising since believe gnuplot uses gsl libraries? long: i have written c / c++ code makes use of gnu scientific library (gsl). code fits non-linear functions sets of non-linear data. algorithms can highly sensitive order in floating point operations take place, due nature of numerical inaccuracies result accumulation of numerical round-off errors. question: "could these caused effect of running 1 of optimization flags, -o1 , -o2 or -o3 ?" partial answer: turned off -on flags , recompiled code, results may have changed small amount, ie: delta_x / x ~= 1.0e-3 . fit still poor in com