Posts

Showing posts from April, 2013

postgresql - What's the unit of buffers_checkpoint in pg_stat_bgwriter table? -

i'm using postgresql-9.1.6 , trying build monitoring application postgresql server. i'm planning select physical , logical i/o stat pg_stat_* information tables. according manual unit of fields in pg_stat_database block means size of 8kb . postgres=# select * pg_stat_database datname='postgres'; -[ record 3 ]-+------------------------------ datid | 12780 datname | postgres numbackends | 2 xact_commit | 974 xact_rollback | 57 blks_read | 210769 blks_hit | 18664177 tup_returned | 16074339 tup_fetched | 35121 tup_inserted | 18182015 tup_updated | 572 tup_deleted | 3075 conflicts | 0 i figure out size of physical read usging blks_read * 8kb. however, there no comments on unit of stats in pg_stat_bgwriter . postgres=# select * pg_stat_bgwriter; -[ record 1 ]---------+------------------------------ checkpoints_timed | 276 checkpoints_req | 8 buffers_checkpoint | 94956 buffers_clean | 0 maxwrit...

javascript - How to remove index.html from url on website based on angularjs -

i didn't find way remove index.html url, because looks ugly. mydomain.com/index.html#/myview1 mydomain.com/index.html#/myview2 is there way remove part, url clear user is. mydomain.com/myview1 mydomain.com/myview2 tnx in advance time. edit: find way work like: mydomain.com/#/myview1 mydomain.com/#/myview2 which pretty better index.html. but still if there way shorter solution let me know. maybe approach help: add $locationprovider.hashprefix(); , removes index.html in url, in app.js config. don't forget add new dependency. after app.js similar this: angular.module('myapp', [ 'ngroute' ]). config(['$locationprovider', '$routeprovider', function($locationprovider, $routeprovider) { $locationprovider.hashprefix(); // removes index.html in url $routeprovider.otherwise({redirectto: '/someroute'}); }]); note not remove hashtag. can find new route at: .../app/#/someroute

python - wxgrid cell renderer set col size -

i made class whic extends pygridcellrenderer , can set size of columns self.colsize = some_size, sets same size columns, how can set size specific column? try this: setcellsize(row, col, num_rows, num_cols); thissets cell @ coordinates row, col flow on num_rows rows , num_col columns. if not want , want work pixel then: setcolsize(col, width); setrowsize(row, height); you can determine current size of row or column using : getcolsize(col) getrowsize(row) let me know if not work.

asp.net mvc - Format BalloonText with amCharts.AmGraph jquery -

i trying format tag [[value]] in balloontext using amcharts , jquery. need show number tag [[value]] without decimals , thousand comma separator, example 64578 64,578. how can format balloontext? thanks!. // creates graph , adds actual chart var creategraph = function (title, valuefield, color, unit) { try { var graph = new amcharts.amgraph(); graph.title = title; graph.labeltext = "[[value]]"; graph.balloontext = title + " of [[value]] " + unit + " \nrepresents [[percents]]% of total [[category]]"; graph.valuefield = valuefield; graph.type = "column"; graph.linealpha = 1; graph.fillalphas = 0.6; graph.linecolor = color; chart.addgraph(graph); } catch (err) { showmodalmessage("error in creategraph() method: " + err); } } you should set chart.numberformatter = {precision:0, decimalseparator:'.', thousandsseparator:','...

ios - UTF8 encoding in NSString -

i used following code encode unicode character "\u1000" utf8 encoding. nsstring *unicodestring = @"\u1000"; nslog(@"%s", [unicodestring utf8string]); the expected result \u00e1\u0080\u0080 getting \u00b7\u00c4\u00c4. am missing here?

javascript - My app crashes with a java.lang.IllegalArgumentException -

i crash report every few weeks java.lang.illegalargumentexception , don't know start looking. have never had app crash while testing far can tell app gets opened around 300 times week crash doesn't happen still fix it. says on dialog dismissal have multiple dialogs in app. can 1 tell me more crash report means , how arrived @ conclusion? java.lang.illegalargumentexception: view not attached window manager @ android.view.windowmanagerglobal.findviewlocked(windowmanagerglobal.java:402) @ android.view.windowmanagerglobal.removeview(windowmanagerglobal.java:304) @ android.view.windowmanagerimpl.removeview(windowmanagerimpl.java:79) @ android.app.dialog.dismissdialog(dialog.java:325) @ android.app.dialog$1.run(dialog.java:120) @ android.os.handler.handlecallback(handler.java:725) @ android.os.handler.dispatchmessage(handler.java:92) @ android.os.looper.loop(looper.java:137) @ android.app.activitythread.main(activitythread.java:5293) @ java.lang.reflect.method.invokenative(...

javascript - Change background of navigation on change of section in single page website -

i have keep background of navigation on "home" section transparent. when viewport change on selection of other sections. background color of navigation permanent black. <header class="clearfix"> <nav> <a href="#fbsection1">home</a> <a href="#fbsection2">about us</a> <a href="#fbsection3">events</a> <a href="#fbsection4">contact us</a> </nav> </header> here fiddle as understand it, want header background change based on section of site user on, correct? look @ jquery waypoints plugin -- allows dynamically set classes elements based on scroll position. see here: http://imakewebthings.com/jquery-waypoints/#about or, if want pure css solution, take @ following codepen: http://cdpn.io/kftam you use separate element background , use z-index layer these things correctly. have black background element z-index of...

Informix: UPDATE with SELECT - syntax? -

i wanna update table persons whoes activity lasted toooo long. update should correct 1 time , subsequent rows need deal new result. thought like update summary_table st set st.screen_on=newscreenonvalue st.active_screen_on=st.active_screen_on-(st.screen_on-newscreenonvalue) --old-value minus thedifference ( sub-select rowid, newscreenonvalue ... join ... where.... ) nv (st.rowid=nv.rowid) i know can update first , second value directly, rerunning same query. problem costs of subselect seems quite high , therefore wanna avoid double-update resp. double-run of same query. the above select informal way of writting think get. know st doesn't work, left here better understanding. when try above statement syntaxerror @ position from ends. this can achieved follows: update summary_table st set (st.screen_on, st.active_screen_on) = ((select newscreenonvalue, st.active_screen_on-(st.screen_on-newscreenonvalue) ... join... where..)) [...

javascript - AngularJS $http not firing get call -

i have question firing $http.get multiple sources in angularjs. code below quite simple: have $scope.test function click handler 1 button in html. $http.get works ok. have $http.get gets data server , creates basic primitives chart. simple , works well. , then, append button on every chart node , on button handler execute $http.get call. 1 doesn't work! here code: $scope.test = function () { console.log('klic na id 1'); $scope.commoncontroller.getdata('orgunit/1?jsondepth=3') .success(function(workpositiondata,status,headers,config) { console.log('klic na id 1 ok'); $scope.workpositions = workpositiondata.workpositions; }).error(function(data,status,headers,config) { commoncontroller.error('pri branju delovnih mest je prišlo napake: '+data.description); }); }; var options = new primitives.orgdiagram.config(); var itemb, itemc, itemd, iteme; var rootitem = new pri...

ruby on rails - Login in to main app from active admin -

i have app, , connected active admin. i'm trying let admin user login user via active admin without password using devises's sign_in @user method. possible achieve out of box? i can make redirect username in params/session, isnt secure, if wouldnt pass outside active admin. any ideas? i'm not sure mean "not secure"; devise internals can make sure admin user, etc, , need pass around username of new user. said, code below entirely within activeadmin , achieve want. n.b. can't think of easy way sign admin user in (i use same devise users , use role-based auth). member_action :sign_in_as, :method => :put user = user.find(params[:id]) sign_in user, bypass: true redirect_to root_path end action_item :only => :show link_to('sign in as', sign_in_as_admin_user_path(user), method: 'put') end

database - ASP.NET MVC 4 How to edit data that comes from a foreign key -

here problem : i have database contains several attributes name etc. have 2 specifics attributs, iissettings , sqlsettings. public class environment { public int id { get; set; } public string name { get; set; } public virtual sqlsettings sql { get; set; } public virtual iissettings iis { get; set; } ... } iissettings , sqlsettings contains both name , id foreign keys. when try update environment, , change attributs in iissettings or sqlsettings, visual studio telling me nothing has changed, because in "standards" attributs, nothing has changed. thing changed values inside iissettings or sqlsettings. so, wanted know how save changes database, when want update iissettings or sqlsettings? my viewmodel : public class environmentviewmodel : viewmodelbase { public environment environment { get; set; } public iissettings iissettings { get; set; } public sqlsettings sqlsettings { get; set; } //create/details/delete functions et...

java - SSL issue with HttpGet probably because server is requesting client authentication -

we using following versions of diff libraries apache-httpcomponents-httpcore = 4.1; apache-httpcomponents-httpclient = 4.1.1; jdk = 1.6_64; and started facing sslpeerunverifiedexception ( http failing https javax.net.ssl.sslpeerunverifiedexception details). i tried different things don't know why unable connect https://www.google.com after accepting certificates (though explained in comment, cause man in middle attack). could case google started expecting certificate client? if yes, should do? thanks, could case google started expecting certificate client? if yes, should do? if understand right , google need certificates, should use cryptoprovider , make signatures stunnel. maybe smth wrong code ? settings works me public httpclient getnewhttpclient() { try { keystore truststore = keystore.getinstance(keystore.getdefaulttype()); truststore.load(null, null); sslsocketfactory sf = new mysslsock...

simple form - Rails 4 simple_form collection_select -

how translate following simple form? <%= form_for(@bill) |f| %> <%= f.label :location_id %> <%= f.collection_select(:location_id, @locations, :id, :location_name, {:selected => @bill.location_id}) %> i can't use simple association because @locations result of query. try <%= simple_form_for @bill |f| %> <%= f.input :location,:collection => @locations,:label_method => :location_name,:value_method => :id,:label => "location" ,:include_blank => false %> <%= f.button :submit %> <%end%> hope help

javascript - How to create layount elements depending on data context in protovis-js? -

i @ beautiful sample , so , can't wonder how create lemements like: bg.add(pv.wedge) .angle(smallangle) .startangle(function(d) this.proto.startangle() + smallangle) .outerradius(function(d) radius(d.penicillin)) .fillstyle(drugcolor.penicillin) only if d.penicillin > 0 call bg.add(pv.wedge) (so have more or less ui elements depending on data, not params)?

asp.net mvc - how to define a GroupName for Html.RadioButtonfor -

i working on asp.net mvc 4 .but got confused on how can specify group name table of radio-buttons . each group of radio buttons can have on button checked @ certian time. using html.radiobuttonfor . the "group name" determined name attribute of field: radio buttons same name attribute value in same "group". so, purposes of using html.radiobuttonfor , specify same property each radio in group unique value button, i.e: @html.radiobuttonfor(m => m.animaltype, "cat") @html.radiobuttonfor(m => m.animaltype, "dog") @html.radiobuttonfor(m => m.animaltype, "chicken")

c# - How do I set properties in a class with a parameterless constructor on instantiation in one statement? -

i'm 103% sure possible , i've seen it, can't remember or syntax was. i thought var obj = new thing({id=3, name="the thing"}); that's not working. if i'm crazy, tell me so. don't think am...or maybe i'm crazy realize. this should work var obj = new thing{id=3, name="the thing"};

python - NDB querying results that start with a string -

working google app engine's ndb, i'm looking query items start user-inputted string. example: abc_123 abcdefg 123abc querying "abc" should return abc_123, abcdefg (however, not 123abc doesn't start "abc") i used code below similar different purpose: q = q.filter(order._properties[kw].in(values_list)) which filtered values in values_list in kw, looking filter values start string in kw. try: kind.query(ndb.and(kind.property >= "abc", kind.property <= "abcz"))

java - Wrapping a JDBC Connection singleton in a ThreadLocal -

i'm working on small crud application use plain jdbc , connection enum-based singleton, after reading first part of java concurrency in practice liked threadlocal approach write thread-safe code, question : when wrapping global jdbc connection in threadlocal considered practice ? when wrapping global jdbc connection in threadlocal considered practice ? depends lot on particulars. if there large number of threads each 1 of them going open own connection may prohibitive. going have connections stagnate threads lie dormant. it better use reentrant connection pool. can reuse connections open not in use limit number of connections minimum need work concurrently. apache's dbcp example , thought of. to quote docs: creating new connection each user can time consuming (often requiring multiple seconds of clock time), in order perform database transaction might take milliseconds. opening connection per user can unfeasible in publicly-hosted interne...

javascript - return substring match -

i trying part of string regex this string testing class1 container _box _box_cec493 the string series of classes applied element. what cec493 changes since regex applied bunch of different elements (therefore string 1 above) the regex using is /\s_box_([0-9a-za-z]+)/ which returns _box_cec493, cec493 how can modify in order second value ( cec493 )? thank you you split string: var str = "class1 container _box _box_cec493"; var match = str.split('_').pop(); alert(match); demo

javascript - Use a Canvas to select a portion of a pdf document -

i have request select portion of pdf document , save/email generated image in asp.net website. initial thought load pdf document , utilize draggable/resizable canvas select portion of document , save out. know how accomplish or know of alternative method of doing this. i visualize draggable/resizable box can move around multipage document , select save portion of it. i suggest looking @ mozilla's pdf.js project . renders pdfs canvas you. can capture section want mouse, , copy out image data: var context = canvas.getcontext("2d"); var image = context.getimagedata(x, y, width, height); in order mouse positions inside of canvas, checkout thess questions: getting mouse position javascript within canvas , draw on html5 canvas using mouse

cuda-gdb crashes with thrust (CUDA release 5.5) -

i have following trivial thrust::gather program (taken directly thrust::gather documentation) #include <thrust/gather.h> #include <thrust/device_vector.h> int main(void) { // mark indices 1; odd indices 0 int values[10] = {1, 0, 1, 0, 1, 0, 1, 0, 1, 0}; thrust::device_vector<int> d_values(values, values + 10); // gather indices first half of range // , odd indices last half of range int map[10] = {0, 2, 4, 6, 8, 1, 3, 5, 7, 9}; thrust::device_vector<int> d_map(map, map + 10); thrust::device_vector<int> d_output(10); thrust::gather(d_map.begin(), d_map.end(), d_values.begin(), d_output.begin()); // d_output {1, 1, 1, 1, 1, 0, 0, 0, 0, 0} return 0; } i compile /usr/local/cuda/bin/nvcc -ccbin g++ -i../../common/inc -m64 -g -g -gencode arch=compute_30,code=sm_30 -o thrustgather.o -c thrustgather.cu /usr/local/cuda/bin/nvcc -ccbin g++ -m64 -g -g -o thrustgather thrustgather.o nex...

c# - Get all images from a folder in my project/solution -

a quick question. how in easiest , securest way images folder in solution without having copy them debug folder. so lets folder structure: project resources (folder) images (folder) helpicons (folder) icon1.png icon2.png how icon1 , icon2 code? (without copy debug) you can use getfiles directory specified. string[] filenames = system.io.directory.getfiles("project\\resources\\images\\helpicons"); filenames contains list of filenames in directory, here can ".png" --edit 12:13-- this starting directory executable is. can specify full path if needed. string[] filenames = system.io.directory.getfiles("c:\\project\\resources\\images\\helpicons");

c++ - Replacing the goto Statement -

i have limited experience c++ , wanted replace "goto" construct code. suggestion refactoring too int main() { int count; int countsub = 0; int usercount = 0; int rolecount = 0; int parentgroup; cout<<"enter number of parentgroup"<< endl; cin>> parentgroup; int subgroup; cout<<"enter number sub group"<< endl; cin>> subgroup; int rolepergroup; cout<<"enter number role per sub group"<< endl; cin>> rolepergroup; int userpergroup; cout<<"enter number user per role"<< endl; cin>> userpergroup; { if (parentgroup == 0) { cout<<"error"<<endl; exit(exit_failure); } else { for(count=1;count <= parentgroup; count ++) { { if(subgroup =...

Autohotkey script - Combining two keypresses into one -

i have question regarding combining 2 key presses alt , ` into 1 key press ` i have tried fiddle around , search similar examples none have worked me unfortunately! i want have script hold down alt key (ralt preferably) , press ` once (backtick character - located on same key tilde). triggers menu in game used accessible pressing ` 1 time. i've tried following code segment doesn't work. `:: keywait ralt send, {`} return any , appreciated! thanks. this should simple mapping keys this: `::!` if use ralt specifically: `::send {ralt down}{``}{ralt up}

c# - Different Timer for each item in List on ViewModel -

i have list of actions need performed company representatives , open timer if on edit x minutes. , 10 minutes page refreshed. the problem many company agent can access , edit action. colored item on view, if agent "sleepee" x minutes - underprocess field reset false; so start adding model field tell me action "underprocess" (i love codefirst :) , add viewmodel static dictionary on edit thare , add row kay-actionid , datetime of edit. after in view on foreach if item.underprocess style=color:red .. course after edit remove dictionary , change bool flag. but not working - stay red after x minutes, think problem on static dictionary because when debug empty. hare viewmodel: public class agentactionviewmodel { public supplieraction action { get; set; } public list<supplieraction> actions { get; set; }//= new list<supplieraction>(); public static dictionary<int, datetime> underprocessfrom; public static agentactionviewmode...

asp.net - Is there a way using javascript not C# to change the text color of a list view? -

i wondering if there way change text color of specific line in list view based value, using javascript only, no c#. want able this, if twa value less 90 text should green, else red. here code: <asp:listview id="yourlistview" runat="server" datasourceid="sqldatasource3" enableviewstate="false" editindex="0" selectedindex="0"> <itemtemplate> plant name: <asp:label id="plantlabel" runat="server" text='<%# eval("plant") %>' /> <br /> department #: <asp:label id="column1label" runat="server" text='<%# eval("column1") %>' /> <br /> department name: <asp:label...

variables - multicolliarity test in R -

i'm working large data set suspect have multicollinearity issues because var-covariance matrix has negative eigenvalue (and small when comparing rest); ratio max eigenvalue/min eigenvalue > 3000; my question is: there test routine in r identify variables redundant (i don't work regression models); might linear regression pair graphs or use pairs(data) command appreciate numerical tests because have 200 variables , graphs aren't decision support in matter. if undesrtood correctly looking for: if have in mind correlation threshold want use exclude variables try following in example here i'm generating random matrix > set.seed(3) > data <- data.frame(v1=rnorm(20),v2=rnorm(20),v3=rnorm(20),v4=rnorm(20),v5=rnorm(20)) > cor.mat <- cor(data) > diag(cor.mat)=0 this correlation matrix , variables v1, v2, v3, v4, v5 > cor.mat v1 v2 v3 v4 v5 v1 0.00000000 -0.14464568 0.09047839 -0.120086...

Understanding listing fie in nasm program -

i don't understand why following program outputs: 356 , how connected listing file understanding. question,why segmentation fault happens when add "section .text" in second line? 1 global _start 2 3 section .data 4 00000000 03000000 x: dd 3 5 6 00000004 8b0d[00000000] _start: mov ecx, [x] 7 0000000a 000d[16000000] r: add byte [l+6], cl 8 00000010 c605[00000000]30 l: mov byte [x], 48 9 00000017 51 push ecx 10 00000018 b804000000 mov eax,4 11 0000001d bb01000000 mov ebx, 1 12 00000022 b9[00000000] mov ecx, x 13 00000027 ba01000000 mov edx,1 14 0000002c cd80 int 0x80 15 0000002e 59 pop ecx 16 0000002f e2d9 loop r,ecx 17 00000031 bb00000000 mov e...

arrays - PostgreSQL HSTORE GIN query -

i can't figure out how re-write query using arrays test cases: --explain select count(id) ( select t.id product2 t (ext @> 'p01=>1' or ext @> 'p01=>2') , (ext @> 'p02=>1' or ext @> 'p02=>2' or ext @> 'p02=>3') , (ext @> 'p03=>2' or ext @> 'p03=>3' or ext @> 'p03=>4' or ext @> 'p03=>5' or ext @> 'p03=>6') ) t i'm looking ext @> 'p01=[1,2]' . documentation doesn't indicate if possible. note: if ranges possible, don't want them. the following extract values key 'p01' , return true if matches found in array. after? select ('p01=>1,p01=>2,p02=>1,p02=>3,p02=>5'::hstore -> 'p01')::integer = any(array[1,2,3,4,5]) modified original query select count(*) ( select t2.id product2 t2 (ext::hstore -> 'p01...

sql - What transactions diminish data integrity? -

i've learned decent bit database integrity, , know should using transactions if "require multiple statements performed unit keep data in consistent state." database development mistakes made application developers (point 16, chosen answer) wikipedia uses example: debit $100 groceries expense account credit $100 checking account if try credit non-existent account id, , i'm using constraints properly, exception thrown , can catch , roll back. if there power outage these 2 changes guaranteed atomic. however, if understand properly, transactions won't me in cases: (example php , mysql) mysql: start transaction mysql: select data table php: compute state selected data php: if state valid, insert data php: otherwise, don't insert data mysql: commit transaction this won't work because queries can executed atomically without failing (it's php decides there's error, not sql constraint). secondly, , tested, transactions comm...

Unexpected Behaviour shown while opening the pop up screen in iPad usingjquery mobile -

Image
i opening pop screen on clinking header button after open of pop fill field keyboard open. along black screen open. how remove unnatural behaviour. the theme move upward when open keyboard. used simple code : http://jsfiddle.net/ravi1989/jdkdw/ <div data-role="page" id="home" > <div data-role="header" data-theme="b" data-position="fixed" data-tap-toggle="false" > <h1 class="ui-title" id="hdr" style="text-align:left;margin-left: 100px;">my cases</h1> <div class="ui-btn-right" id="headerbuttons" data-role="controlgroup" data-type="horizontal"> <a href="#usersettingscreen" data-transition="none" data-role="button" data-inline="true" data-iconpos="notext" data-icon="gear" data-theme="b" id="setting...

SQL Server Temp table to update Fields -

i have code, when run following: declare @consumption float = 2211, @billingmonth datetime = '2012-11-01 00:00:00.000', @sitename varchar(100) = 'aldr', @type int = 1 select consumption, meterid, siteid tblmep_sites join tblmep_meters on tblmep_meters.siteid = tblmep_sites.id join tblmep_monthlydata on tblmep_monthlydata.meterid = tblmep_meters.id projectid = 40 , tblmep_sites.name @sitename , type = @type , billingmonth = @billingmonth result: consumption meterid siteid 25900 13274 1622 i want update consumption field using the update statement: update tblmep_monthlydata set consumption= @consumption and meterid , siteid result following: consumption meterid siteid 2211 13274 1622 is temptables solution problem? if yes, how convert above code temp tables? you want first update , select of data. update md set consumption = @consumption tblme...

excel - VBA - Counting the number of filled cells in a row -

the following code far. tips? wsheet colcount = .range(1 & .columns.count).end(xltoright).column end what doing wrong? try: colcount = wsheet.usedrange.rows(1).columns.count (revised)

c# - Add none UserPrincipal field to AD entry -

i trying add none userprincipal field small application, cannot work. tried several ways simple task, cannot work me. trying add field called company inserted active directory, company not field can inserted... any ideas? please post code example if have one. have far: public bool createnewuser(string susername, string spassword, string sgivenname, string ssurname, string email, string phone) { if (!isuserexisting(susername)) { string sou = "ou=users,ou=external,dc=external,dc=rootteck,dc=com"; principalcontext oprincipalcontext = getprincipalcontext(sou); userprincipal ouserprincipal = new userprincipal(oprincipalcontext, susername, spassword, true /*enabled or not*/); //user log on name ouserprincipal.name = susername; ouserprincipal.userprincipalname = susername + "@external.rootteck.com"; ouserprincipal.givenname = sgivenname; ouserprin...

html5 - How to reload the webpage when orientation changes? -

i'm trying trigger event jquery mobile automatically reloads page when device's orientation changes. have media queries written max-device-width, orientation:landscape, , orientation: portrait . since <video> wont scale properly...the solution can think of refresh page correct media query device rotated. how go doing this? thanks. thanks guys answered found , used , worked perfectly. <script type="text/javascript"> // reloads webpage when mobile orientation changes window.onorientationchange = function() { var orientation = window.orientation; switch(orientation) { case 0: case 90: case -90: window.location.reload(); break; } };

highcharts - Date not showing on highstock chart -

Image
why isn't date on xaxis showing? i can't seem find wrong. update data: [ [1104966000000, 1.94, 1.99, 1.91, 1.95], [1104793200000, 1.9, 1.95, 1.9, 1.9], ] jsfiddle requested you can use label formatter , dateformat edit: http://jsfiddle.net/sbochan/usrca/3/ xaxis: { labels: { formatter: function () { console.log(this); return highcharts.dateformat('%d/%m/%y', this.value); } } }

http - Download Redmine Gantt Chart PNG using Curl? -

i'm attempting obtain copy of redmine's gantt chart png export using curl. seems http basic auth not allow me access , every request made returns "http/1.1 406 not acceptable" curl -u <user>:<pw> -h 'accept: image/png' -v http://redmine/projects/devprocess/issues/gantt.png if put url browser not logged redmine, same thing (well blank window)...so i'm assuming has authentication. there way "login" redmine , maintain consistent session via curl can download png file? note: end solution ruby script, i'll accept ruby answers too. curl "least common denominator" client. ended doing in app/controllers/gantts_controller.rb : class ganttscontroller < applicationcontroller menu_item :gantt before_filter :find_optional_project + accept_api_auth :show seems work. add plugin somehow.

swing - Hide a JTable row with click event [ java ] -

Image
i have jtable this i want hide row whenever respective clear button(jbutton) pressed.and other task such delete row mysql table populated form database. as have 2 override function :- one: public component gettablecellrenderercomponent(jtable table, object value, boolean isselected, boolean hasfocus, int row, int column) two: public component gettablecelleditorcomponent(jtable table, object value, boolean isselected, int row, int column) where , how have change achieve this.or other implementations details me.thanks table button column shows 1 way add actionlistener column of table.

Functions in matlab -

this looks simple. want define function: syms x f = x^2 i want able f(4) , spits out 16. want avoid having write new m-file. when dealing symbolic variables, substitute in numeric value, use subs() , i.e. symbolic substitution: syms x f = x^2 subs(f,4)

arrays - If in_array then include - newbie -

i'm starting php now, , i'm not sure why isn't working: <!-- begin homepage ads --> <?php $homepage = array("/", "/?subtopic=latestnews"); $currentpage = $_server['request_uri']; if(in_array($homepage==$currentpage)) { include('pages/newsticker.php'); } ?> <!-- end homepage ads --> any ideas why isn't working? being messing witht code time , couldn't solve it in_array needs 2 parameters, needle , haystack. change if statement following: if(in_array($currentpage, $homepage)) for in_array reference, see http://php.net/manual/en/function.in-array.php

java - CSVReader cannot read a line correctly -

i have .csv file 12 columns , read file csvreader class. list<string[]> rows = reader.readall(); but found string[] have less 12 elements. when debugged, found csv text format problem. there 2 problems: some columns end backslash. for example, "column content\", "column b content" read 1 column \" seen escape character. some cells' contents have \" in them. for example, in 1 row, column a's content command line: "d -r u+rwx \""${mytmp}\"" > /dev/null 2>&1; rm -fr \""${mytmp}\"" >" so cannot think of replacement strategy deal format problem. (e.g replace \ \\ , works "contenta\","contentb" situation, don't work \" when cell's content ) any suggestions? welcome discuss bad formatting problems , solutions experienced in csv files reader has problem reading correctly. i think if replace \", \\", solve p...

Coldfusion: how get value of the radio button to do the loop? -

for example: how many item want select? 1 2 3 4 if 3 selected then loop 1 3 do something end loop i want process in same page. can let me know need do? tried cfselect , radio buttons no luck. thank you. i think you're on thinking problem. form return value of selected radio button. html: <form method="post" action=""> <p>how many want?!? choose now!</p> <input type="radio" name="varname" value="1" onclick="this.form.submit();">1 <input type="radio" name="varname" value="2" onclick="this.form.submit();">2 <input type="radio" name="varname" value="3" onclick="this.form.submit();">3 <input type="submit"> </form> coldfusion: <cfif isdefined("form.varname") , form.varname gt 0> <cfloop index="i" from...

python - compiling .py into windows AND mac executables on Ubuntu -

i have been trying hours figure out how going through pyinstaller's docs, haven't had luck. i have single .py file, , need made .exe file executable in windows 7, , .app (or ever works) executable in os x lion. problem when ever use python pyinstaller.py my_code.py it compiles linux executable. from pyinstaller faq : can package windows binaries while running under linux? no, not supported. please use ​wine this, pyinstaller runs fine in wine. may want have @ ​ this thread in mailinglist . in version 1.4 had build in support this, showed work half. require windows system on partition , work pure python programs. want decent gui (gtk, qt, wx), need install windows libraries anyhow. it's easier use wine. in other words, cannot run command in linux build windows executable (or mac executable matter) trying do. workaround have provided windows (and windows) install wine . wine program allows windows programs run on linux. creates...

linq - counter in lambda expression streamwriter -

i have follow expression: mygrid.foreach(sub(model) mystreamwriter.writeline(function(x integer) (x + 1))) of course it's not working. want write in text file (writeline) sequential number (1, 2, 3, etc.) each record collected in variable vargrid type: list (of mytable) any idea? it's fine csharp code too. regards. you declare counter outside of foreach lambda, declare outside of scope of foreach loop. var x = 1; mygrid.foreach(model => mystreamwriter.writeline(x++.tostring()));

Facebook Application Group Limitations -

i investigating building application heavily leverage facebook's app/game groups. during prototyping noticed following limitations: 1) number of groups - there seems limit on number of groups application may have, limit seems tied number of users participating in application. example 1 user participating in application, can create 1 group. if add few more user can add several more groups. know if specific limitations documented. cannot seem find them , know can develop application around these constraints. 2) number of groups user can invited to - when try add user more 5 groups (through consecutive api calls), following error: oauthexception: (#4002) attempt invite user group failed. does know if there limitation how many groups user can member of within given application? limitation based on time, example can user join 5 groups every hour, etc?? if there such limitation constraints documented somewhere? thanks in advance help. --steve

jquery - attr not working in chrome, but working in IE -

below code, not working in chrome, working in ie. tried methods given in other threads, no use. hence attaching full code further suggestions. var changelink = $("<a />").text(res_buttonedit).click(function () { showpopupform(q, action); return false; }); var deletelink = $("<a />").text(res_buttonremove).click(function () { $(function () { if (confirmdeleteactiondialog.css("visibility") == "hidden") { confirmdeleteactiondialog.css("visibility", "visible"); } confirmdeleteactiondialog.dialog({ resizable: false, position: ["center", 150], width: 300, height: 160, modal: true, buttons: [ ...

python UDF version with Jython/Pig -

when python udf pig, how know version of python using? possible use specific version of python? specifically problem in udf, need use function in math module math.erf() newly introduced in python version 2.7. have python 2.7 installed on machine , standalone python program runs fine when run in pig python udf, got this: attributeerror: type object 'org.python.modules.math' has no attribute 'erf' my guess jython using pre-2.7 version of python? thanks help! to version using can this: myudfs.py #!/usr/bin/python import sys @outputschema('bar: chararray') def my_func(foo): print sys.version return foo if run script locally version printed directly stdout. see output of sys.version when run remotely you'll have check logs on job tracker. however, right jython being pre-2.7 (kind of). current stable version of jython right 2.5.3 , version pig using. there beta version of 2.7.

c++ - C++11 range-based for loops without loop variable -

in c++ need iterate number of times, don't need iteration variable. example: for( int x=0; x<10; ++x ) { /* code goes here, not reference "x" in code */ } i realize can replacing "code goes here" lambda or named function, question loops. i hoping c++11's range-based loops help: for( auto x : boost::irange(0,10) ) { /* code goes here, not reference "x" in code */ } but above gives "unreferenced local variable" since never explicitly reference x. i'm wondering if there more elegant way write above loops code not generate "unreferenced local variable" warning. there may way very doubt more elegant. have in first loop correct way it, limiting scope/lifetime of loop variable. i ignore unused variable warning (it's indication compiler may wrong, after all) or use compiler facilities (if available) turn off warning @ point.

wpf - does invokecommandaction use canexecute? -

i new wpf , interactivity. trying execute command based on event trigger. in code below, when doubleclick event trigger, canexecute invoked , return false execute function still called. default behavior invokecommandaction? think when can execute returns false, execute not called. <usercontrol x:class="..." xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"> <i:interaction.triggers> <i:eventtrigger eventname="mousedoubleclick"> <i:invokecommandaction command="{binding path=displayreportcommand}"/> </i:eventtrigger> </i:interaction.triggers> ... yes use canexecute , command not execute if return false. have posted code example. here command in viewmodel class relaycommand _showmessagecommand; public icommand showmessagecommand { { if (_showmessagecommand == null) { _showmessagecommand = new relaycommand(param =...

windows - how to use __stdcall to qualify C++ lambda? -

foreword--i love c++ lambda, if possible use everywhere. now have lambda requirement, need __stdcall lambda. following error message: error c2664: 'enumwindows' : cannot convert parameter 1 '`anonymous-namespace'::<lambda1>' 'wndenumproc' 1> no user-defined-conversion operator available can perform conversion, or operator cannot called anybody can me? here code( enumwindowsproc in function scope ): auto enumwindowsproc = [&](hwnd hwnd, lparam lparam) mutable -> bool { return true; }; enumwindows(enumwindowsproc, null); i noticed have visual studio 2010 tag. stateless lambdas implemented in vc11. reference : after lambdas voted working paper (v0.9) , mutable lambdas added (v1.0), standardization committee overhauled wording, producing lambdas v1.1. this happened late implement in vc10, we've implemented in vc11. lambdas v1.1 wording cla...

wordpress - Not Loading proper Css on shared ip hosting server/ check images on server via ip -

i've uploaded wordpress site on new server via shared ip. makes changes in localhost working fine uploaded files (css, php) on server. css not working on server.(my css in themes of wordpress folder) every time browser(s) loading pervious css i've deleted already. i've flushed dns cache, cleared browsing history. checking site this: don't have domain yet. http://174.121.38.115/~username/ this hosting server ip. told me how check images using ip whether placed , working or not????

iphone - get coordinates of animated UIImageview -

i animating uiimageview in horizontal position purpose have used below code have used nstimer timer = [nstimer scheduledtimerwithtimeinterval:0.2 target:self selector:@selector(ontimer) userinfo:nil repeats:yes]; -(void)ontimer { [uiview animatewithduration:10.0f animations:^{ //moving_cloud image view moving_cloud.frame = cgrectmake(200.0f, 150.0f, moving_cloud.frame.size.width, moving_cloud.frame.size.height); }]; } now problem facing need coordinates of "moving_cloud" after animate duration please me in advance. abhijit chaudhari comment in previous post understand want not position "after animate duration" instead position during animation. if still didn't right please clarify question. (or buy me new brain) -(void) animateme(){ nstimer *timer = [nstimer scheduledtimerwithtimeinterval:0.01 target:self selector:@selector(ontimer:) userinfo:nil repeats:yes]; [uiview animatewithduration:10.0...

openerp - Copy one2many field SNAFU -

i need show record notebook project on notebook sheet , showed record not according project my py : class notebook_project(osv.osv): _name = "notebook.project" _description = "notebook project id" def onchange_project(self, cr, uid, ids, project, arg, context=none): if project : proj = self.pool.get('project.project').browse(cr, uid, project, context=context) return {'value': {'name': proj.name}} return {} _columns = { 'name' : fields.char('name', size=64), 'project' : fields.many2one('project.project', 'project'), 'notebook_project_lines' : fields.one2many('notebook.project', 'notebook_project_id', 'members lines'), 'notebook_project_id': fields.many2one('notebook.project', 'parent project', ondelete='cascade', select=true), 'member...

ios - What things needed to add APN in .NET server -

Image
as have serch on google not sure things needed implement apn in .net server. in php server create .pem file .net developer ask me .p12 file confuse. as nice tutorial raywenderlich suggest thing need generate php server .pem file .net? as tutorial suggest have the csr (of developer certificate) the private key p12 file (myapp.p12) (of development certificate) the ssl certificate, aps_development.cer and want send app adhoc distribution p12 file distribution certificate? or tht have give .p12 file of distribution certificate , ssl certificate ? i think have things need. you have aps_development.cer add in keychain access. display this... after export certificate in .p12 file add password if want and mac ask user password verify after thing got .p12 file of ssl certificate. add code appdelegate - (bool)application:(uiapplication *)application didfinishlaunchingwithoptions:(nsdictionary *)launchoptions { // let device know want receiv...

hadoop - Hive External table in MySQL -

currently, i’m executing following steps(hadoop 1.1.2, hive 0.11 , sqoop-1.4.3.bin__hadoop-1.0.0) : import data mysql hive using sqoop execute query in hive , store output in hive table export output mysql using sqoop i wondering if possible combine steps 2 & 3 – output of hive query written directly mysql database. i read external tables couldn’t find example location clause points jdbc:myql://localhost:3306//. possible? this thread talks jdbc storage handler couldn't find hive example same(i guess unimplemented!) the link provided, seems bug unresolved. problem understand that, want select query in hive , output of query needs written in mysql. correct me if wrong ? if case can use sqoop export this. please check answer of mine: https://stackoverflow.com/a/17753176/1970125 hope help.

objective c - how to integrate camera application in app -

i new ios. integrated camera application in app. want crop taken image. i got error while running. solve this cgimagecreatewithimageprovider: invalid image size: 0 x 0. this code: - (ibaction)camera:(id)sender { if ([uiimagepickercontroller issourcetypeavailable: uiimagepickercontrollersourcetypecamera]) { uiimagepickercontroller *imagepicker = [[uiimagepickercontroller alloc] init]; imagepicker.delegate = self; imagepicker.sourcetype = uiimagepickercontrollersourcetypecamera; imagepicker.mediatypes = [nsarray arraywithobjects: (nsstring *) kuttypeimage, nil]; imagepicker.allowsediting = no; [self presentmodalviewcontroller:imagepicker animated:yes]; newmedia = yes; } } - (ibaction)gallery:(id)sender { if ([uiimagepickercontroller issourcetypeavailable: uiimagepicker...