Posts

Showing posts from June, 2013

linux - Where does, Carp library in Perl, print logs when run from crontab -

i have perl script uses carp (carp croak) print info , errors. when run directly can see output on console. when running script cronjob dont know messages going. already checked in /var/log/messages /var/log/cron . not found please help. man cron : when executing commands, output mailed owner of crontab (or user named in mailto environment variable in crontab, if such exists). job output can sent syslog using -s option.

jquery - Not showing data in month and year dropdown in datepicker -

Image
i using jquery datepicker month , year value. but problem is, in dropdown of month , year, white spaces visible, if hover in opened dropdown month , year respectively visible. if take mouse away, there blank white dropdown, again hover in dropdown list, month , year visible. can select then. problem is not visible. my code datepicker <script type="text/javascript"> jquery(function ($) { $("#<%= txtdob.clientid %>").datepicker({ changemonth: true, changeyear: true, dateformat: 'mm/dd/yy' }); }); </script> textbox in applying it: <div class="col-sm-5"> <asp:textbox id="txtdob" runat="server" placeholder="mm/dd/yyyy"></asp:textbox> </div> <div class="col-sm-4 no-padding">

Nginx module: how to get variables value from conf file -

i have nginx server acting reverse proxy. downstream, request sets header info ssl protocol nginx use proxy. put info in variable in nginx.conf file called "$origin_ssl_protocol". looks like: proxy_ssl_protocols $origin_ssl_protocol; now problem how nginx module (the function handler) value of variable? far know, handler proxy_ssl_protocols "ngx_conf_set_bitmask_slot", , accepts pure values tlsv1, sslv3, rather variable holding these values. i want develop own module, know how nginx value of variable in conf file (assuming variable has valid value)?

ios - Background image for iPhones and iPads of various sizes -

i add background image ios , want background image have appropriate resolutions tablet , phone versions. design considerations should take account? resolution should image in? this list of current screen resolutions variety of devices: click resolutions you create 10 different images, 5 each landscape , portrait views. alternatively, create 2 or 4 images cater landscape , portrait views , use code check devices size size them appropriately. the advantages of creating right sized images means have precise background consistent across devices, if have logo's in background distortion may occur resizing of images across devices. conversely, creating 2-4 images should reduce memory size app downloaded packaged background images instead of 10, , if resized correctly, shouldn't out of place. i test 2-4 images using simulator, checking , performance on devices plan release to. if aren't happy, either customise layouts images stretch fit appropriately, or, sym

android - SQLITE, Group by range of 1000s -

i have database of 2 columns in sqlite android id (int) | owner (varchar) 1477 jack 1578 jill : : 9277 hill 1) count of following: - (group 1000s range) range | count 0-999 0 1000-1999 5 : 8999-9999 7 2) count of following: - (group 100s range) range | count x1xx 5 x2xx 6 : x9xx 7 3) , group 10s range. i'm stuck how group by select count(*) mytable group ?? any pointers appreciated. integer division integers in sqlite3 yields integers: select id/1000 range_id, count(*) range_count mytable group range_id; to group 100 ids, change 1000 100 sqlite3 has printf() function might useful in make pretty column describe range if need prettier integer division of id group size.

jQuery - Sort array in ascending order -

i need sort nrarray array: var nrarray = nrarray.sort(); what above this: ["1", "17", "206", "22", "3", "6"] i need this: ["1", "3", "6", "17", "22", "206"] pass in comparison callback , use parseint like var arr = ["1", "17", "206", "22", "3", "6"]; arr.sort(function(a, b){ return parseint(a)- parseint(b); }); console.log(arr); update you dont need parseint a/b auto-converted numbers. because subtracting , javascript performs necessary type conversion. however, same cannot said a + b string concatenation.

sqlite - Raw Database content showing up in Rails View -

you can see here seems raw contents of db being printed page. can't see anywhere in code why there raw output of db printed view. here code index view: <div class="main"> <div="messages"> <%=@messages.each |t|%> <h2 class="subject"><%=t.subject%></h2> <p class="content"><%=t.content%></p> <% end %> <%=link_to "create message", edit_path%> </div> </div> the create form/view: <div class="formwrapper"> <%= form_for @messages |t|%> <div class ="inputs"> <%=t.text_field :subject%><br> <%=t.text_area :content%> <div class="submit"> <%=t.submit "submit"%> </div> <%end%> </div> </div> the controller: class messagescontroller &l

jsp - Vector : References to generic type Vector<E> should be parameterized -

Image
i have problem(yellow line) in jsp file caused eclipse program keep no responding. although program can run, how can rid of following line of code. vector vfieldname = (vector) session.getattribute("table_vfieldname_"+table_type); vector vtable = session.getattribute("table_vtable_"+table_type) == null ? new vector(): (vector) session.getattribute("table_vtable_"+table_type); (int k=0;k<vtable.size();k++) { intseqno=vtable.size(); vector vrow = (vector) vtable.elementat(k); } i don't think these warnings hang ide, these harmless. , best practice specify type generics vectar<object> or vectar<string> or list<string> or arraylist<string> etc , not use raw types. please read updated sources , books. era of java-8 , not java-1! anyways if still want rid of these warnings then: right click on project go properties search "jsp" select jsp syntax , scroll dow

html - Input value is not respecting padding and breaking container -

Image
i'm doing contact form <input type="submit"> submit form. set padding input , have large text value . my design responsive. in mobile input set 100% of container, text value in input not respecting padding , width. text value not going 2 lines , can't see complete text. any idea how solve problem welcome! why i'm using <input> instead <button> or <a href> ? because i'm using html create custom contact form 7 in wordpress site, , cf7 uses <input type="submit"> send messages. add css rule white-space: normal button. in browsers, <input> defaults whitespace: pre whereas <button> defaults white-space: normal .

plugins - Maven Ear with two war files -

i trying develop application upon packaging generate " ear " file contain 2 war files. folders war files called " hello " , " bye " , placed on same level of parent pom contains info ear . the pom's hello , bye packages fine when ran them individually. when tried packaging pom says cannot find poms both hello , bye . here content parent pom . <project xmlns="http://maven.apache.org/pom/4.0.0" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://maven.apache.org/pom/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelversion>4.0.0</modelversion> <groupid>mr</groupid> <artifactid>mrear</artifactid> <packaging>ear</packaging> <version>0.0.1-snapshot</version> <dependencies> <dependency> <groupid>mr.hello</groupid> <artifactid>hello</artifactid&

css - Wordpress Themify Responsiveness Issue -

i running wordpress site using themify basic theme. when enable responsive feature, social links cover logo , current posts appear before content, hurting bounce rate. if turn off, looks awesome, doesn't pass google mobile friendly tests. fix recommendations? to understanding common issue responsive themes. (i not super code savvy) with responsive without responsive

java - How to Change Default Text Editor Annotation Preferences in Eclipse? -

so eclipse uses weird text annotation (i.e. highlights errors instead of underlining them). know how change this. window > preferences > general > editors > text editors > annotations but can't save settings; every time reopen eclipse work space, saved annotation settings gone. it's annoying change them every time. there way can change default annotation settings? thanks! the problem seems specific when you're using custom theme dark (does not happen default theme). able reproduce luna also, seems fixed in mars version (4.5) due release on wednesday (june 24, 2015). can try 1 of recent release candidate builds if can't wait until wednesday. this bugzilla may related changes fixed it. think dark theme looks better in mars expansion tabs looking cleaner in package explorer.

PHP Regex to remove last paragraph and contents -

i have following stored in mysql table: <p>first paragraph</p><p>second paragraph</p><p>third paragraph</p><div class="item"><p>some paragraph here</p><p><strong><u>specs</u>:</strong><br /><br /><strong>weight:</strong> 10kg<br /><br /><strong>lxwxh:</strong> 5mx1mx40cm</p><p>this paragraph trying remove regex.</p></div> i'm trying remove last paragraph tags , content on every row in table. can loop through table php enough, regex has me stumped. every preg_match i've found on stackoverflow either gives me "preg_match(): unknown modifier" error, or var_dump shows empty array. believe match content if did work think need preg_replace? the rows aren't identical in length, going last paragraph want remove. would appreciate if show me how. thanks this remove last <p>anything&

declare function's type as struct c++ -

so have class named user. inside have made struct called flights , want make function in class return struct values of flights. possible? follow. know doesn't work there way? class user { string name, surname...; struct flights { int miles; double cost; } struct add_miles(reads class); } struct user::add_miles() { return flights; } i not sure understand requirement see try: #include<iostream> class user { //string name, surname...; public: struct flights { int miles; double cost; }myflights; struct flights add_miles() { return myflights; } }; int main() { user me; me.myflights.miles=100; std::cout<<me.add_miles().miles; }

Python using function like variable -

i've got python module has several variables hard-coded values used throughout project. i'd bind variables somehow function redirect config file. possible? # hardcoded_values.py foo = 'abc' bar = 1234 # usage somewhere else in module hardcoded_values import * print foo print bar what want change hardcoded_values.py , print foo transparently calls function. # hardcoded_values.py import config foo = somewrapper(config.get_value, 'foo') # or whatever can think of call config.get_value('foo') ... config.get_value function called parameter 'foo' when using variable foo (as in print foo ). i'm pretty sure can't want if import from hardcoded_values import * . what want set foo function, , apply property decorator (or equivalent) can call foo foo rather foo() . cannot apply property decorator modules reasons detailed here: why property decorator defined classes? now, if import hardcoded_values think there way wan

Text size and high contrast accessibility jQuery mobile -

i new jquery mobile , trying achieve jquery mobile accessibility. text size , high contrast. in want text size , high contrast select through select options. find not looking. "jsfiddle net/dc2ry/2" i have altered fiddle. did mean top buttons dropdowns themselves? link: http://jsfiddle net/qrf4bcj3/1/ edit check bad boy out: http://jsfiddle net/qrf4bcj3/2/

python - How to vectorize a data frame with several text columns in scikit learn without losing track of the origin columns -

i have several pandas data series, , want train data map output, df["output"]. so far have merged series one, , separated each commas. df = pd.read_csv("sourcedata.csv") sample = df["cata"] + "," + df["catb"] + "," + df["catc"] def my_tokenizer(s): return s.split(",") vect = countvectorizer() vect = countvectorizer(analyzer='word',tokenizer=my_tokenizer, ngram_range=(1, 3), min_df=1) train = vect.fit_transform(sample.values) lf = logisticregression() lfit = lf.fit(train, df["output"]) pred = lambda x: lfit.predict_proba(vect.transform([x])) the problem bag of words approach , doesn't consider - unique order in each category. ("orange banana" different "banana orange") - text 1 category has different significance in ("us" in 1 category mean country of origin vs destination) for example, entire string be: pred("us, chiquita banana

ruby - Get original array indices after #combination -

i learning ruby , 1 issue have come across in few practice problems working combinations array, getting original array indices instead of actual combination result. keep simple let's talk pairs. know fast way possible pairs is: array = [a, b, c] array.combination(2).to_a # => [[a, b], [a, c], [b, c]] now let's want iterate on these combinations , choose pair fits arbitrary condition. easy enough return pair itself: ...select{|pair| condition} # => [a, c] # assuming pair fits condition but if want return indices original array instead? # => [0, 2] is there way of doing using #combination ? or have find combinations in case? if there more elegant way following(which ended doing solve these problems)? array.each.with_index |s1, i1| array[(i1 + 1)..-1].each.with_index |s2, i2| if condition result = [i1, (i2 + i1 + 1)] end end end try this: array = ['a', 'b', 'c', 'd'] array.combination(s).to_a.redu

sharepoint 2010 - Why does this jQuery not only not work, but break all the other jQuery? -

i doing "fancy" hiding (slideup , slidedown) of elements on sharepoint webpart. i added handler, though, button: $(document).on("click", '[id$=btnaddfoapalrow]', function (e) { alert('you mashed foapal button'); if ($('[id$=foapalrow3]').css('display') == 'none') { $('[id$=foapalrow3]').slidedown(); } else if ($(['id$ = foapalrow4]').css('display') == 'none') { $('[id$=foapalrow4]').slidedown(); } }); ...but not fails work (the htmltablerows not display when button clicked), other jquery (checkbox change event handlers, etc.) fail work after adding code. commenting out, , old code work still. why code obliterate whole shebang? $(['id$ = foapalrow4]') <- seems there typo here it should be $('[id$ = foapalrow4]') your code after edit: $(document).on("click", '[id$=btnaddfoapalrow]', funct

pom.xml - Maven: How do I activate a profile from command line? -

this snippet pom.xml. tried following, profile not activated. mvn clean install -pdev1 mvn clean install -p dev1 when tried mvn help:active-profiles no profiles listed active. if set <activebydefault> dev1 true , , run mvn help:active-profiles , shows me profile activated. <profile> <id>dev1</id> <activation> <activebydefault>false</activebydefault> </activation> <build> <plugins> <plugin> <groupid>org.apache.maven.plugins</groupid> <artifactid>maven-surefire-plugin</artifactid> <configuration> <systempropertyvariables> <env>local</env> <properties.file>src/test/resources/dev1.properties</properties.file> </system

api - Oauth into Office 365 Unified (preview) - server error - non-retryable error has occurred -

i'm trying oauth office 365's unified api read calendar information , believe have configured correctly. however, when after user logs in , provides consent, redirected reply url following error in params: "server error - non retryable error has occurred". i've setup ad app have office 365 unified (preview) delegated permission - read users calendar, , using endpoints , client ids specified. seems can consent screen, after that, breaks. find if remove resource param, i'm able code. when try post token, response https://graph.microsoft.com/ not available app (though through ad). there place/setting need make graph.microsoft.com available ad app? code snippet: var oauthoptions = { client_id: '<my client id value>', redirect_uri: '<my reply url>', response_type: 'code', prompt: 'admin_consent', resource: encodeuricomponent('https://graph.microsoft.com/') }; var oauthurl = 'htt

python - SQLAlchemy: How to change a MySQL server system variable using SQLAlchemy? -

i want set general_log , general_log_file variables using sqlalchemy, there way this? i've been googling around , can't find on topic. you can execute raw sql query need (of course have appropriate rights in session). change variable run this: # change variable name , values need connection.execute("set session query_cache_type = off")

Getting server error 400 while connecting server using cookie stored in browser JAVA -

url url = new url("url"); urlconnection conn = url.openconnection(); // conn.setrequestmethod("get"); string mycookie = "value; jnat=value; " + "ltpatoken2=value"; conn.setrequestproperty("cookie", mycookie); conn.connect();

Improper rounding with PHP round() and a 14 decimal float -

i have age-old floating point rounding issue many people before me have, can't seem find solution situation. i'm doing math operations in mysql , returning result php float, using round() round result. problem i'm running numbers 10.50499999999977 seem trip round() , rounding number 10.5 instead of expected 10.51 . is there consistent way have php round number correctly? found quick solution, i'm afraid wouldn't hold in long run: echo round(10.50499999999977, 2, php_round_half_up); // 10.5 echo round(round(10.50499999999977, 5, php_round_half_up), 2); // 10.51 i'm worried if use solution , try round number 10.50444449 end rounding wrong (10.5 vs 10.51). so there solution can use consistently correct rounded number php? you're seeing expected behavior: php> echo round(10.50499999999977); 11 php > echo round(10.50499999999977, 1); 10.5 php > echo round(10.50499999999977, 2); 10.5 php > echo round(10.50499999999977, 3); 1

javascript - Meteor routing & rendering error -

getting strange error in meteor: route dispatch never rendered. did forget call this.next() in onbeforeaction? and none of content rendering when sign in. same codebase working on friend's machine macbook. works fine code when deploys pull code , deploy same code , throw same error. can see here http://streetscenestest.meteor.com/ , router.js below. how can fix this? appreciated. here's router.js: router.configure({ layouttemplate: 'layout', }); router.route('/', function() { this.render('home'); }); router.route('/user/:_username', { name: 'user_profile', data: function() { return meteor.user();} }); router.route('/create', function() { this.render('createevent'); }); router.route('/insert', function() { this.render('insertevent'); }); router.route('/events/:name', { name: 'event', data: function() { return events.findone({name: this.params.name

ios - Error SIGABRT while trying to delete multiple selected cells in UICollectionView: -

i trying delete series of selected images in uicollectionview on clicking delete button. here delete button action: - (ibaction)deletevideos:(id)sender { if(deleteenabled){ if([selectedvideos count]>0){ for(nsarray *indexpath in self.memorymirrorsessioncollectionview.indexpathsforselecteditems) { [videoimagesarray removeobjectatindex:indexpath]; [image_array removeobjectatindex: indexpath]; nslog(@"%@", indexpath); [self.memorymirrorsessioncollectionview deleteitemsatindexpaths:indexpath]; } } } } and these declarations , definitions: @interface xvzuicollectioncontroller(){ nsmutablearray *videoimagesarray; bool selectenabled; nsmutablearray *selectedvideos; bool deleteenabled; bool shareenabled; nsinteger *indexstack; } - (void)viewdidload { image_array = [nsmutablearray arraywithobjects: @"testimage1.jpg", @

jquery - I am trying to get items in my dialog box selectable and on selection run more ajax -

i have button form search on click ajax , appending data dialog box. wanting make elements selectable , on selection open dialog box drilled more detail. using jquery appreciated. html <div class="row"> &nbsp; <button onclick="return search_all_forms()" type="button" class="btn btn-primary btn-sm">search forms</button> </div> <div id="dialog" title="search forms"> </div> javascript function search_all_forms() { //if (getcookievalue('payreg') != '99') { $.ajax({ type: "get", url: baseazureserviceurl + "/api/dynamicforms/formheader/search", //data: { add_userid: getcookievalue('userid'), empl_id: getcookievalue('emplid'), location: getcookievalue('location'), status: 'started' }, data: { add_userid: 'ujcockr' }, datatype: "json", success: function(da

Pagination with Redis sets vs sorted sets -

we storing users , friends (relationships) in redis sets. easy can't figure out how results when paginating. example: when showing logged in users's friends, need first 20 results, on following click, next 20 results, etc.. don't care order, provided don't repeated data following queries. prefer use sets vs sorted sets, sets lets use cheap sinter other queries. recommended aproach be? storing them both sets , sorted sets? sounds bit redundant. you can paginate through set using sscan , note can return same result twice though. alternatively, sorted sets best kind of task. lastly, lists can work lrange expensive operation.

javascript - Facebook JS SDK returning 'unknown' when expecting 'not_authorized' -

i'm having trouble detecting when user has authenticated fb, clicked 'cancel' when asked permissions. what's happening is: 1) application loads , checks login status... user 'unknown'. great. 2) user clicks "sign in" button calls fb.login() permissions birthdate , address. user shown fb login dialog, enters credentials, , taken permissions dialog. 3) decide cancel. dialog closes , returns status of 'unknown'. 4) refresh page, status check runs again, user 'not_authorized'. i'm assuming means login portion @ step 2 successful because can open tab fb , user logged in. makes sense since user able login , see permissions dialog, when cancelled, why did remain 'unknown' when in fact are known fb @ point? i tried add getloginstatus follows: var login = function(){ console.log('logging in user via fb...'); var dfr = $q.defer(); fb.login(function(response){ if(response.status == '

Qt with Python size of headeritem in Qtablewidget -

i developping gui using python , qt. problem can't set , fix value columns. i created table called "tablewidget_segment_list" 2 columns (using qt designer) i set first width column 100px , second 1 50px. and fixed values against user. thank you you can in either way: in qtdesigner, right click on widget, select "changestylesheet" in script code, do table.setcolumnwidth(1, 100) table.setcolumnwidth(2, 50)

android - Changing drawable in RecyclerView updates all rows -

i trying 'like' button functionality in application facebook. want whenever user clicks on button, color of drawable on button should change grey blue. using recyclerview feeds. since, recyclerview enforces use viewholder pattern, color of buttons changed thereafter. appreciate solve me problem. this code adapter public class facebooktimelineadapter : recyclerview.adapter { context mcontext { get; set;} list<facebookmodel> mdata; layoutinflater inflater; facebookviewholder holder; public facebooktimelineadapter (context context,list<facebookmodel> data) { this.mcontext = context; this.mdata = data; this.inflater = layoutinflater.from (context); } #region implemented abstract members of adapter public override void onbindviewholder (recyclerview.viewholder viewholder, int position) { holder = viewholder facebookviewholder; holder.username.text = mdata [position].username;

javascript - adjusting canvas to fit screen on scroll -

i have canvas element dynamically created overlays every other element. on resize, canvas fits screen without trouble. figured same principle work scrolling, not: var = document.createelement('canvas'); createcanvas(); function createcanvas(){ a.height = $(window).height(); a.width = $(window).width(); a.id = "some_canvas"; a.style.opacity = "0.8"; a.style.position = "absolute"; document.body.insertbefore(a,document.body.firstchild); context = a.getcontext("2d"); context.fillstyle = "#000000"; context.fillrect(0, 0, a.width, a.height); } $(window).resize(function(){ $("some_canvas").remove(); createcanvas(); }); $(window).scroll(function(){ $("#some_canvas").remove(); createcanvas(); }); https://jsfiddle.net/9mfxytoz/1/ the canvas remains @ it's last size adjustment, not follow through scrolling. i'm tryi

data visualization - Customized Parallel sets in R using ggparallel -

Image
i trying create similar chart in r using ggparallel can't gaps between values e.g in case between "yes" , "no" in visualization. not sure if possible in ggparallel or have write seperate customized function this? thanks in advance! if still interested , willing consider non- ggparallel option, built htmlwidget parallel sets in r . see example vignette # devtools::install_github("timelyportfolio/parsetr") library(parsetr) # using defaults parset(titanic)

r - Minimize a function with two variables -

i minimize function 2 variables. first have made function (rba) , needed inside function (kvasum) need minimize. values minimized on part of rba . # data vpk = data.frame(v1 =c(3650000000, 19233, 2211.2, 479.47, 168.46, 83.447, 52.349, 38.738, 32.34, 29.588), v2 = 1:10) n = nrow(vpk) # functions minimize # function returns vector 10 values rba = function(par){ v <- matrix(ncol = 1, nrow = 10) (p in 1:10){ k<- ifelse (par[1] < 1-1/p && par[1]>0 && p > par[2] && par[2]>0 && par[2]<2, par[2]*p, ifelse(par[1] < 1-1/par[2] && par[1] > 0 && p < par[2] && par[2]>0 && par[2]<2, -1+(par[1]+1/par[2]), ifelse(par[1] > (1 - 1 / max(p,par[2])) && par[2]>0 && par[2]<2, -1+p, "error"))) v[p] <- k } return(v) } # function uses function rba, , returns value kvasum =

dll - Do windows services log why they wont start? -

Image
i have windows service not start on brand new windows server 2012 installation. when attempt start service, error. the foobar service on local computer started , stopped. services stop automatically if not in use other services or programs. i come linux background, , don't use windows much. in troubleshooting attempts, have been able gather following logs. the requested performance counter not custom counter, has initialized readonly.\u000d\u000a @ system.diagnostics.performancecounter.initializeimpl()\u000d\u000a @ system.diagnostics.performancecounter..ctor(string categoryname, string countername, string instancename, boolean readonly)\u000d\u000a @ system.diagnostics.performancecounter..ctor(string categoryname, string countername, boolean readonly)\u000d\u000a @ foobar.sage.onstart(string[] things have tried front page of google. https://stackoverflow.com/a/2081976/1626687 ps c:\users\sowen> lodctr c:\windows\microsoft.net\framework\v4.0.30319

css3 - How do I target a first-child that is visible (after children that are set to display:none), with only CSS -

i need target first <td> element in table row visible--meaning not have inline styling of display:none . here's gotchyas: they not hidden sometimes more 1 hidden. i can't edit html or use javascript/jquery--this needs pure css solution (hopefully) here quick sample of code looks like: <table> <thead> <tr> <th style="display:none">header1</th> <th>header2</th> <th>header3</th> <th>header4</th> </tr> </thead> <tbody> <tr> <td style="display:none">body1</td> <td>body2</td> <td>body3</td> <td>body4</td> </tr> </tbody> </table> i tried messing no avail: table > tbody > tr > td:first-of-type:not([style*="display:none"])

serialization - reconstruct python method with kwargs with marshal and types? -

i using marshal module serialize python methods, , reconstruct them using types module ( is there easy way pickle python function (or otherwise serialize code)? ). having trouble getting work optional kwargs. e.g. import marshal import types def test_func(x, y, kw='asdf'): return x, y, kw serialized_code_string = marshal.dumps(test_func.func_code) # in real code there bunch of file i/o here instead unserialized_code_string = marshal.load(code_string) new_func = types.functiontype(code, globals(), "deserialized_function") when run new_func(1,2) error new_func() takes 3 arguments (2 given), though kwarg optional. think issue arises in reconstructing function func_code, not sure how fix this. if there isn't way, interested in alternative way reconstruct function keeps kwarg functionality. after more searching discovered dill package, allows pickle more things cpickle (the reason using marshal). when directly reconstruct serialized function (not

regex - Regular Expression to Modify Title on Autoblogged Plugin -

i need rid of words every feed title. example: titles: vans model 10 . 390 random data nike model 982 . errant default data timberland old school whatever now, need remove after "from" the result should be: vans model 10 . 390 nike model 982 . errant timberland old school i cannot use search/replace fields because same data present in %content%, solutions custom fields title regex dont know how. if cannot use search/replace, can use regex lookahead capture content want this: (.+?)(?=\sfrom) working demo however, in case use search/replace use regex: from.* working demo

datetime - Can I plot times when they're given as UNIX timestamps with added milliseconds? -

i'm using gnuplot 4.4 on centos 6.6. i've found many example s online showing following (note use of %.3s ) enable timestamps " 12:42:51.047 " parsed , used x axis values: set xdata time set format x "%h:%m:%.3s" set timefmt "%h:%m:%s" however, input not hh:mm:ss.mmm ssssssssss.mmm , integral part unix timestamp. i tried following, parsing appeared have failed since datapoints rendered @ "00:00:00": set xdata time set format x "%.3s" set timefmt "%h:%m:%s" the manual doesn't give indication possible but, again, doesn't %h:m:%.3s going work, either. possible want do? if so, how? the precision must given output. parsing, seconds (or timestamp) treated floating numbers. reading in time stamp milliseconds seems supported since version 4.6.4 (tested here). but, there workaround: specifying ($1) instead of 1 in using statement makes gnuplot treat value normal floating point number. no

Is this possible to automate the JMeter scripts running schedule? -

is possible schedule jmeter scripts.for example want run same script every hour , want automate process.is possible? yes, there many options: linux : use cron windows task scheduler jenkins

javascript - How can I have faye-websockets code running in the browser? -

i'm new node.js/express , , want able notify clients in browser new message received algorithm in back-end. publisher algorithm connect websocket , writes message. as far i've looked there examples recommended websockets haven't been able run code in browser in console. example client code: var websocket = require('faye-websocket'); var ws = new websocket.client('ws://localhost:1234'); var http = require('http'); var port = process.env.port || 1235; var server = http.createserver() .listen(port); // receive message server ws.on('message', function(event) { alert(json.parse(event.data)); }); thank you found answer after trial/error iterations. the algorithm post url in turn triggers write sockets connected clients via socket.io. client code: var socket = io('http://localhost:7777'

php - How to load a webpage to refresh data using Cron Job in Cpanel -

i have webpage in php domain.com/page/ , need page load automatically every month refresh data because pulling data on page app. can me on cron command load webpage? go shell , type crontab -e add line contab 0 0 1 * * wget http://domain.com/page/ >/dev/null

ios - Invalid IAP product identifiers -

Image
i understand that, in-app purchases, make request store, , app loads ui, , user taps "buy" , makes purchase, , app delivers it. this question first step: making request. for game, i'm making iap remove advertisements $1.00. my confusion lies in product identifier. can't use bundle id in scenario, because contains hyphens. put? reverse domain? alphanumeric identifier? i tried using noads in both itunes connect , code, returns invalid. would use com.example.noads ? some other information related predicament: i'm testing on iphone 6. signed out of "itunes , app store." (screenshot below) i use same thing between code , itunes connect. i have test account. think sign when make purchase. make sure sales contracts in effect. kept returning identifiers invalid until set up.

c - How to update a SQL Server database from Labwindows CVI -

i trying update sql server database cvi. have code: update [ebob].[dbo].[tblvessel] set [ebob].[dbo].[tblvessel].[contents] = [labic].[dbo].[tolvassabamex2].[material] [labic].[dbo].[tolvassabamex2] [ebob].[dbo].[tblvessel].[vesselid] = [labic].[dbo].[tolvassabamex2].[id] i use code sql server , works, when used in cvi not update: int cvicallback actualizar_i (int panel, int control, int event, void *callbackdata, int eventdata1, int eventdata2) { switch (event) { case event_commit: conexion2(); int tolva; char material[26]; //float valor; getctrlval(panel, panel_2_ring, &tolva); getctrlval(panel, panel_2_string, &material[0]); //getctrlval(panel, panel_2_numeric, &valor); char comando[500]={0}; sprintf(comando, "update tolvassabamex2 set contents = %s id = %u", material, tolva); int hstmt; hstmt=dbpreparesql(hdbc, com

c++ - Using custom seekable source boost::iostreams::stream -

what methods required implemented if want use custom seekable source boost::iostreams::stream? i've looked @ boost's tutorial source buffers aren't seekable , , tried modifying tag input_seekable , adding seek function in this tutorial . unfortunately, causes compiler complain missing get function can't find documentation (from compiler error message, can figure out signature is, that's it). should function do? there other functions need implement? also, compiler wants me have 3 input parameters seek ; first 1 being *dev thought provided stream itself. header device: class sourcebuffer { private: file *file; public: typedef char char_type; typedef boost::iostreams::input_seekable category; sourcebuffer(const char *filename); sourcebuffer(); ~sourcebuffer(); std::streamsize read(char *s, std::streamsize n); boost::iostreams::stream_offset seek(boost::iostreams::stream_offset off, std::io

javascript - force maximum browser size on page load -

i'm wondering if @ possible use javascript detect if user's browser minimized (not minimized -- reduced size smaller maximize) @ all, , if > force full screen > upon page load of website. $( document ).ready(function() { if (smaller max screen) { screen = 100%; // general idea }); yes possible detect change of size, here's how it,using jquery: $(window).resize(function() { //... }); and here's how maximize browser window : window.moveto(0, 0); window.resizeto(screen.availwidth, screen.availheight); but really, not encourage it, it's better user controls browsing experience.

Android Design Support Library Secondary Drawer Menu -

Image
i've switched official google design support library. now, want use secondary menu divider this: but android using menu inflater have no idea now. can add second group, items have same size , there no divider. drawer.xml: <?xml version="1.0" encoding="utf-8"?> <menu xmlns:android="http://schemas.android.com/apk/res/android"> <group android:checkablebehavior="single"> <item android:id="@+id/overview" android:checked="true" android:icon="@drawable/ic_action_dashboard" android:title="@string/drawer_overview" /> <item android:id="@+id/social_evening" android:checked="false" android:icon="@drawable/ic_action_brightness_3" android:title="@string/drawer_social_evening" /> <item android:id=

asp.net - Using Entity Framework with no defined keys -

i having problems keys when trying make controllers, reading of questions posted in here, , found needed explicitly define key in variable, , did so.. problem still persist , don't know how fix it. error this: "entity type 'product' has no key defined, entityset 'products' has no keys defined" code: using system; using system.collections.generic; using system.componentmodel.dataannotations; using system.componentmodel.dataannotations.schema; using system.data.entity; using system.linq; using system.web; namespace mvc_catalogo.models { public class product { private string descripcion { get; set; } private string barras { get; set; } private string alterno { get; set; } private double precioc { get; set; } private double preciop { get; set; } private string imagen { get; set; } [key] private guid productoid { get; set; } private guid idproveedor { get; set; } private int activo { get; set; } p

javascript - Implement the Function.prototype.apply function? -

i not care context , not want use function(). function should take function , array of parameters. example apply(fn, args) => fn(args[0], args[1], ..., args[args.length-1]); is possible? var apply = function(fn, args) { var _fn = fn; args.foreach(function(arg) { _fn = _fn.bind(null, arg); }); return _fn(); }; apply( function() { console.log(arguments); }, [ 'arg 1', 'arg 2', 'arg 3', 'arg 4' ] );

android - Inflating ImageButton programatically changes width & height params to wrap_content. Why? -

in app i'm using android.support.v7.widget.toolbar . left half of toolbar acts button. right half different different activities. it's text, button. inflate right half views programmatically. toolbar <android.support.v7.widget.toolbar> ... ... <linearlayout android:id="@+id/left_ll"/> ... <linearlayout android:id="@+id/right_ll" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignparentright="true" android:layout_centervertical="true" android:orientation="horizontal" /> </android.support.v7.widget.toolbar> i'm inflating view in right_ll: child_button.xml <?xml version="1.0" encoding="utf-8"?> <imagebutton xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/right_ib" android:layout_width="30d

Transfer data Javascript to PHP (on click on confirm box) -

i wanted when user clicks on 'ok', write string in file (.txt) on server. <script> if(confirm('capteur') == true){ /*write on file*/ } </script> i thought can write javascript it, doesn't work way. so, want transfer data javascript php, indicates if php must write (or not) in file. <script> if(confirm('capteur') == true){ /*send data php*/ } </script> <?php $var = //data send javascript if($var==1){ $fichier = fopen("log.txt",'a'); $puts($fichier,"restart"); fclose($fichier); } ?> i tried solutions (ajax, redirection, post/get, jquery) never managed transfer data. here test jquery: <script> if(confirm('capteur') == true){ var variabletosend = 1; $.post('jv.php', {variable: variabletosend}); } </script> <?php $var = $_post['variable']; ?> and here get/post : <script&g

python - removing rows from an array if first entry in row is particular string -

i want remove rows array y have 'copy' first entry i tried this for in range(len(y)-1): if y[i][0] == 'copy': n.delete(y,i,0) i don't error rows haven't been deleted when print y. i tried y[y[:,0] != 'copy'] but error indexerror traceback (most recent call last) <ipython-input-36-b03bdf03aa31> in <module>() ----> 1 y[y[:,0] != 'copy'] indexerror: many indices if explain why not working , suggest solution appreciated thanks with list comprehension : [x x in y if x[0] != 'copy'] with filter() , lambda: list(filter(lambda x: x[0] != 'copy', y))

javascript - Angular google Map will not render and throws no errors -

i new angular think have right. pretty simple setup. here app var applocations = angular.module('locations', ['uigmapgoogle-maps']).config(function(uigmapgooglemapapiprovider) { uigmapgooglemapapiprovider.configure({ // key: 'i not providing key', v: '3.17', libraries: 'weather,geometry,visualization' }); }); applocations.controller('locationscontroller', function($scope, $http) { $http.get('/json/locations/') .then(function(res){ $scope.locations = res.data; }); }); applocations.controller('mapcontroller', function($scope, $http) { $http.get('/json/locations/') .then(function(res){ $scope.locations = res.data; }); $scope.map = { center: { latitude: 45, longitude: -73 }, zoom: 8 }; }); here markup <div class="main1-in" ng-app="locations"> <div ng-controller="ma