Posts

Showing posts from January, 2013

iphone - get all fb person name same as given name in facebook ios -

friends developing facebook related application. in application user can able search person name. first have tried graph-api search. got list of peoples peoples missing, because have set privacy setting. when type name in facebook shows person name same given name. and list of peoples order different. so issue is 1)not getting users list same given name 2) why ordering of data different?. i using code getting person name list nsmutabledictionary *variables = [nsmutabledictionary dictionarywithcapacity:2]; [variables setobject:@"priya" forkey:@"q"]; [variables setobject:@"user" forkey:@"type"]; // [variables setobject:@"post" forkey:@"type"]; fbgraphresponse *fb_graph_response = [fbgraph dographget:@"search" withgetvars:variables]; nslog(@"raw html: %@", fb_graph_response.htmlresponse); is other way same result?

python - Naming a file the content of a Text Entry Widget -

i trying create program in tkinter allows people rename log file whatever typed text entry box. not going plan. edited bryan oakley. i have slaved rename function button new issue values contents weird set of numbers. these appear randomly generated every time run rename function. these numbers like 44499952get 44452520get 46401376get 46400496get 44688048get 44697440get can please or explain these numbers mean? look @ code: newname_ent = entry(self,width = 50,) contents = newname_ent.get() it seems highly unlikely user able type in in millisecond or between creating widget , getting value. you need create button or set event binding call function after user has chance enter information. function put code rename.

c# - dropdown SelectedIndexChanged event is not triggering if index is changed in page_load event -

i have drop down & label, drop down binded dictionary. when user changes selected value of drop down want update label. following code works want set initial value of label, set value of selected index in page_load, event not trigger. how fix it? there page event can me solve issue. know can fix using javascript not want use js. public partial class webform1 : system.web.ui.page { dictionary<string, string> mydictionary = new dictionary<string, string>(); protected void page_load(object sender, eventargs e) { if (!this.ispostback) { mydictionary.add("1", "test address 1"); mydictionary.add("2", "test address 2"); mydictionary.add("3", "test address 3"); mydictionary.add("4", "test address 4"); mydictionary....

Exponential Fit to Data Points in Matlab -

i'm trying fit exponential curve of first order (i'm going make 1 of second order well) data points in matlab. i've been trying use method described in other question here @ stackoverflow message: 'error in ==> fit @ 115 errstr = handleerr('curvefit:fit:xdatamustbecolumnvector', ...'. this code: hold on x = (1x8-vector containing data); y = (1x8-vector containing data); error = (1x8-vector containing data); yerror = y.*error; ft = fittype('exp1'); f = fit(x, y,ft); errorbar(x, y, yerror, 'squarek','markerfacecolor','k') plot(f,x,y) i know 'fit' should return coefficents of exponential curve i'm aware last 'plot' not going work. right can't coefficents out. a 1x8 vector row vector. 8x1 vector column vector. may seem trivial distinction, have effect on workings of code, fit requires size(x,2) either 1 or 2 (you can see typing edit fit.m @ command line). granted, error got ...

javascript - Jasmine.js - Spec not running -

i have been configure jasmine/karma/require setup few days now. have karma server watching spec file. when spec file changes, can see server logging files running, never inside spec, beginning of it. here spec file: require(['models/patient'], function(patient) { describe('patient', function () { it('cannot null', function () { var patient = new patient(); expect(patient).not.tobeundefined(); expect(3).tobe(2); }); }); }); if put debugger before require statement, gets hit, never makes past require statement. causes make code stop there? generally problem describing result of module "models/patient" never getting loaded requirejs. advice post require configuration , snippet of folder structure can help.

java - Calling servlet to load the data using jquery ajax? -

i new jquery. have servlet fetch data database , result kept request , same result retrieved in jsp file. have call servlet using ajax jquery load data. doing below. not loading. please me. $('#myform #revert').click(function() { $.ajax({ type: "get", url: "./mycontroller", success: function(msg) { <span style="color:green;font-weight:bold">successful</span>'); }, error: function(ob,errstr) { //todo } }); }); servlet code: //service call gets data , result kept in request scope below request.setattribute("myresult", result); request.getrequestdispatcher("/web-inf/myscreen.jsp").forward(request, response); thanks! ajax not normal httprequest ,you canot forward or sendredirect ajax request since asynchronous,you need write response ajax request printwriter out...

jQuery - select multiple classes including object -

my html looks like: <div class="class1 class2">text</div> the related jquery select: var obj$ = $('.class1'); how select .class2 part of object obj$ without repeating $('.class1.class2') ? far understand obj$.find('.class2') should not work find() not includes obj$ ? thanks. you can use .filter() subset of matched elements, e.g. var $foo = $('.class1'); $foo.filter('.class2').css( 'color', 'blue' );

java - how to call javascript function when I click on a node in jquery tree -

i ask help. i write code following when click node call java action method : <sjt:tree id="treedynamicajax" jstreetheme="apple" rootnode="#session.unt_list" childcollectionproperty="children" nodetitleproperty="title" nodeidproperty="id" openallonload="true" nodehref="popuntsel!selectunit.action" nodehrefparamname="g_selected_uid" ></sjt:tree> it ok call action method. have no idea call javascript function when click node , how can know unit id value in javascript??? here ref link struts2 jquery tree : http://struts.jgeppert.com/struts2-jquery-showcase/index.action thanks in advance !!!

ado.net - Read XML from SQL Server using OleDbDataReader -

i'm stuck trying read xml data sql server using oledb. private static void main(string[] args){ var con = new oledbconnection("provider=sqlncli11.1;data source=localhost;integrated security=sspi;initial catalog=temp"); var cmd = new oledbcommand( "select [id] ,[description] [temp].[dbo].[sometable] [id]= 1 xml path, root('root')", con); con.open(); byte[] result = null; oledbdatareader reader = cmd.executereader(commandbehavior.closeconnection); while (reader.read()){ result = (byte[]) reader[0]; } memorystream stream = new memorystream(result); stream.position = 0; xmldocument doc = new xmldocument(); doc.load(stream); console.out.writeline(doc.outerxml); } it fails saying data malformed. if convert byte array string see lot of "strange " characters. i'm doing wrong? since result direct xml believe facing issue.you need result in row-set instead of scalar. r...

c++ - Is everything cleaned up when using 'goto'? -

this question has answer here: will using goto leak variables? 1 answer for (int = 0 ; < 10 ; ++i) { (int j = 0 ; j < 10 ; ++j) { goto label; } } label: // stuff after goto i , j variables freed? recall goto doesn't unwind stack or cleanup screw in case? yeah, gets cleaned up. because c++ frees variables go out of scope.

playframework - Play framework template parameter - pass a subclass -

i have view template accepts following parameter: @(groups: list[models.groups.academicgroup] i have academic group class: @mappedsuperclass public abstract class academicgroup extends model and subclass this: @entity public class schoolclass extends academicgroup calling view template within template works: @views.html.panels.groups(schoolclasses.asinstanceof[java.util.list[models.groups.academicgroup]]) what isn't working, passing sublass directly via controller: public static result schoolclasses() { list<schoolclass> schoolclasses = schoolclass.find.all(); return ok(groups.render(schoolclasses)); } with approach, error message: the method render(list<academicgroup>) in type groups not applicable arguments (list<schoolclass>) typecasting list doesn't work. there missing or there way implicitely accept subclass template parameter can java generics: list<? extends academicgroup> thanks serejja! passing l...

html - Joomla. Parent menu which won't redirect -

Image
i want create menu in joomla won't redirect show submenu. menu: ->home ->docs -->link1 -->link2 it should looks that. when im @ home link , when click on docs, still stay @ home can see link1 , link2 how that? best regards, sheryf i think need non-clickable menu, user can not click on can access sub-menu. can use "text-separator" menu type menu manager. can refer image also see link further help: help25:menus menu item text separator hope you.

classloader - ClassCastException by cast to owe type -

in implementation of org.dozer.beanfactory.createbean(object, class<?>, string) try cast object type of it. if deploy bundles, shut down , start bundles got classcastexception: java.lang.classcastexception: de.xxx.configuration cannot cast de.xxx.configuration i suspect problem classloaders of karaf and/or dozer. class 1 time exists in jars , isn't modified. configuration doesn't implement serializeable , has no serial version id. how avoid exception? kind regards if have exception someclass can not cast someclass signal these 2 classes have different classloaders. means loaded 2 different classloaders. example if have bundle , b, both contains someclass, each class different , object of class loaded bundle can not cast type loaded bundle b. since pointing have class in 1 jar recommend check if have no entries in lib/ directory (dozer can load through sun.misc.appclassloader). put breakpoint in dozer beanfactory , inspect object instance class , c...

java - JaCoCo and Aspectj -

i've bean using jacoco in maven multimodule project , want add aspectj magic , i'm getting following error during test run start java.lang.instrument.illegalclassformatexception: error while instrumenting class de/../loggingaspect. underneath message stack trace once more shows: caused by: java.lang.illegalstateexception: missing or invalid stackmap frames. how can use jacoco aspectj? i had same problem when using java 1.6. aspectj compile-time weaving produced class files jacoco found invalid. the combination of java 1.7 + aspectj 1.7.3 + jacoco 0.6.3.201306030806 works me.

ios - open a new view inside app delegate -

the app delegate.h file follows #import <uikit/uikit.h> @class afaviewcontroller; @class openinchromecontroller; @class afabarcodescanner; @interface afaappdelegate : nsobject <uiapplicationdelegate,uialertviewdelegate> { openinchromecontroller *openinchromecontroller_; afabarcodescanner *bs; } @property (strong, nonatomic) uiwindow *window; @property (strong, nonatomic)afaviewcontroller *viewcontroller; @property(strong,nonatomic)afabarcodescanner *bs; @end the app delegate.m file follows #import "afaappdelegate.h" #import "afaviewcontroller.h" #import "openinchromecontroller.h" #import "afabarcodescanner.h" @implementation afaappdelegate @synthesize bs; @synthesize window; - (bool)application:(uiapplication *)application didfinishlaunchingwithoptions:(nsdictionary *)launchoptions { self.window = [[uiwindow alloc] initwithframe:[[uiscreen mainscreen] bounds]]; if ([[uidevice currentdevic...

c# - Parallel.For loop does not execute code after finished -

after parallel.for loop finished code below loop not executed. return statement not going executed if i'll set breakpoint program not reach it. have ideas why? thank you c canvas way. here code: parallel.for(0, playfield.last().field.getlength(0), x => { parallel.for(0, playfield.last().field.getlength(1), y => { if (playfield.last().field[x, y] == 1) { c.children.add(createrectangle(lengthx, lengthy, x, y)); } }); }); return c; you exception on "c.children.add" because it's trying add controls crossthreaded. thats not allowed in wpf.

algorithm - Locating point on a closed path to maximize sum of distances to a sample of weighted points (Game AI) -

i'm doing ai simple puzzled game , need solve following problem efficiently (less 1 sec range specified since need many iterations in game). a sample of n (1 100,000) monsters strength 1 10,000 distributed on sides of square (0 200,000,000) @ 1 unit interval starting upper left corner. move hero point x on square maximize sum of weighted distances monsters. weighted distance each monster calculated monsterstrength*shortestdistancetox (by going clockwise or anticlockwise). x must on 1 unit interval mark , monsters , hero move on sides of square only i have tried several approaches none fast or accurate enough. the possibly complementary of problem (minimizing sum of distances set of points @ furthest distance each corresponding monsters in original set) seems related finding geometric median, facility location problem, weber problem etc. linear programming possible might slow , overkilled. does have idea approach? here illustration on square of ...

Drupal — staging version for content? -

we want replace our organisation's existing custom-built cms , on of systems we're looking @ drupal (7. seems have lot of features need not sure if 1 thing absolutely need possible (either through core or module). need add lot of new content our website , publish @ same time. example, might have load of new news items, new publications, etc, published on 1st september. i can see can create pages , leave them unpublished until date in question. might want update existing content (create new revision not publish yet). my question is, there way editor see website appear once both new content published , latest revisions of existing content published , if necessary make changes content (again without publishing it)? suppose call staging version of website, though not on separate server. thanks you use 1 of revisioning/workflow modules this. these allow set process or workflow creating / updating content in new revision while keeping old content live until ready...

Controller not working in zend framework -

i have run zend framework project downloaded live site, in localhost. working fine. in front page, following errors shown. there error. exception information: message: action helper name getenvpath not found stack trace: #0 d:\xampp\htdocs\hyperspace_dev\library\zend\controller\action\helperbroker.php(293): zend_controller_action_helperbroker::_loadhelper('getenvpath') #1 d:\xampp\htdocs\hyperspace_dev\library\zend\controller\action\helperbroker.php(323): zend_controller_action_helperbroker->gethelper('getenvpath') #2 d:\xampp\htdocs\hyperspace_dev\application\controllers\customercontroller.php(390): zend_controller_action_helperbroker->__call('getenvpath', array) #3 d:\xampp\htdocs\hyperspace_dev\application\controllers\customercontroller.php(390): zend_controller_action_helperbroker->getenvpath() #4 d:\xampp\htdocs\hyperspace_dev\library\zend\controller\action.php(516): customercontroller->accountaction() #5 d:\xampp\htdocs\hyperspace_d...

javascript - How do I access a particular model in the templateHelper of a Collection View (or Layout)? -

roughly have this: my collection; //a collection of models ids layout = backbone.marionette.layout.extend({ templatehelpers: { myfunc: function() { //this.items array of serialized models in collection } } }) layout = new layout({ collection: collection, }) the problem in myfunc() can see model data in collection: available array this.items. there no key cannot this.items.get("the_one_i_want") . how can access individual model in case? ( in case doesn't suit use composite view , item view , put template helper on item view. ) correct me if i'm misunderstanding, seems me maybe you're looking "container methods" of in marionette, listed here: http://marionettejs.com/docs/backbone.marionette.html under "container methods". so if have collection of models ids, rather than this.items.get('the_one_you_want') you'd write like this.items.findbyindex('my_index...

php - Assign all custom fields to variables with the same name? -

if have custom fields in wordpress post, there way set custom fields variables of same name automatically? i.e instead of $custom_fields = get_post_custom(); if (isset($custom_fields['field_1'][0])) { $field_1 = $custom_fields['field_1'][0]; } if (isset($custom_fields['field_2'][0])) { $field_2 = $custom_fields['field_2'][0]; } etc..... is there way skip ifs , assign every valid custom field var automatically? you try this: $custom_fields = get_post_custom(); foreach($custom_fields $k => $v) { ${$k} = $v[0]; } it works using variable variables , setting new variable key value, , value 0-th index in array, show in question.

vb.net - Handle more than 64 thread at the same time -

i reading tutorial thread pooling in vb . there example fibonacci calculations: imports system.threading module module1 public class fibonacci private _n integer private _fibofn private _doneevent manualresetevent public readonly property n() integer return _n end end property public readonly property fibofn() integer return _fibofn end end property sub new(byval n integer, byval doneevent manualresetevent) _n = n _doneevent = doneevent end sub ' wrapper method use thread pool. public sub threadpoolcallback(byval threadcontext object) dim threadindex integer = ctype(threadcontext, integer) console.writeline("thread {0} started...", threadindex) _fibofn = calculate(_n) console.writeline("thread {0} result calculated...", threadindex) _doneevent.set() end sub public function calculate(byval...

c - How does a socket event get propagated/converted to epoll? -

i curious how epoll_wait() receives event registered socket (with epoll_ctl()) ready read/write. i believe glibc magically handles it. then, there document describing how following events can triggered socket? epollpri epollrdnorm epollrdband epollwrnorm epollwrband epollmsg epollerr epollhup epollrdhup p.s. trying paste enum epoll_events in sys/epoll.h on box here; stackoverflow thinks don't format code block correctly although wrapped pre , code tag, idea? the glaring problem epoll documentation failure state in "bold caps" epoll events, are, in fact, identical poll (2) events. indeed, on kernel side epoll handles events in terms of older poll event names: #define pollin 0x0001 // epollin #define pollpri 0x0002 // epollpri #define pollout 0x0004 // epollout #define pollerr 0x0008 // epollerr #define pollhup 0x0010 // epollhup #define pollnval 0x0020 // unused in epoll #define pollrdnorm 0x0040 // epollrdnorm...

Define image src tag using portion of an URL using JavaScript -

with code below, able variable without slash url html. var patharray = location.pathname.split( '-' ); var urlwithoutdashes = patharray[0]; var urlwithoutslash = urlwithoutdashes.substring(1); document.write(urlwithoutslash); now i'd use img src tag (with extention .png), can't figure out how it. code below doesn't seem work. var patharray = location.pathname.split( '-' ); var urlwithoutdashes = patharray[0]; var urlwithoutslash = urlwithoutdashes.substring(1); document.write("img src=\""urlwithoutslash".png\">"); how can solve this? this line: document.write("img src=\""urlwithoutslash".png\">"); should be: document.write("<img src=\"" + urlwithoutslash + ".png\">");

Nginx load balancer websocket issue -

i'm new in nginx , websocket systems per project requirements need check complex things finish. i'm trying create 1 example using nginx, handles websocket (port: 1234) , http requests (port: 80) using same url (load balancer url). i'm using 3 nginx server, 1 load balancer (10.0.0.163) , other 2 application server have installed real apis, 10.0.0.152 , 10.0.0.154 respectively. right now, have configured websocket on application servers. as per above configuration, requests pass on 10.0.0.163 (load balancer) , it's proxy setting pass request (http/websocket) application server (10.0.0.152/154). note : each application server contain separate nginx, php, websocket here default (location : /etc/nginx/sites-available/) file 10.0.0.154 server, handles websocket , http requests on same domain. server{ listen 80; charset utf-8; root /var/www; index index.html index.htm index.php server_name localhost 10.0.0.154 ; location ...

android - One month restiction for application free use -

requirement: in application want allow user free use features 1 month day of application's first run. have store first run date in application database , compare first run date current date every time when application launch. implementation: getting current date have several function calendar.getinstance(); date date=new date(); these function return date\datetime of standard "wall" clock (time , date). according document which can set user or phone network. the problem: every thing seems work fine if user change date setting , set past date. example user have first run application on 7 june 2013 after 6 july 2013 application must show have purchase subscription, if user change date of device 30 june etc. restriction not work. there why implement correctly? there why actual time of device not editable user? edit: application can work offline, user can turn off internet connectivity. how storing 2 dates - date app first used , date last used. 30 ...

sql server - Top 1 for each joined record -

in sql server query, want return @ 1 lostreason each booking. however, sub-query seems returning first record lostbusiness table every booking. let me know if need clarify. select bookings.bookingnumber, lost.lostreason bookings left outer join(select top (1) bookingnumber, lostreason lostbusiness) lost on bookings.bookingnumber = lost.bookingnumber if need more 1 column select bookings.bookingnumber, lost.* bookings outer apply ( select top 1 lost.bookingnumber, lost.lostreason, --other columns lostbusiness lost bookings.bookingnumber = lost.bookingnumber order -- put order here ) lost or ;with cte ( select *, row_number() on (partition bookings.bookingnumber order /* ??? */) row_num bookings left outer...

asp.net mvc - How will model binder deals with Readonly & disabled -

i have following 2 items , 1 readonly:- @html.textboxfor(model => model.technology.tag, new { @readonly = "readonly" }) while other disabled:- @html.dropdownlistfor(model => model.customer.name, ((ienumerable<tms.models.accountdefinition>)viewbag.customers).select(option => new selectlistitem { text = (option == null ? "none" : option.org_name), value = option.org_name.tostring(), selected = (model != null) && (model.customer != null) & (option.org_name == model.customer.name) }), "choose...", new { disabled = "disabled" }) so asp.net mvc model binder bind 2 items? , or ignore read-only , disabled fields ? readonly , disabled effects client-side only, meaning behavior on server not change based on parameters. if tried before posting question, have noticed posted data doesn't model, because form data not include disabled , readonly fields (or @ least, on common browsers)....

c++ - DirectWrite text position different by font size -

Image
i'm using directwrite render text window. seems work except positioning when using different font sizes: i'd expect 2 texts font size v1 , v2 , both (x, y) = (0, 0) @ top left can see: neither "test" nor "x" @ top left. is there way make work? welcome world of fonts. fonts difficult thing use, because there surprises in font ( there many new standards supposed solves , confuse more because no font support @ 100%, 'classic' font have partial/bad information in them) gdi, gdi+, directdraw don't draw font @ same position in pixels because of math, coordinate rounding, anti-aliasing... ( can have 1 more bonus if math freetype ). when try print font there other pb. way around me. don't try draw font @ pixel coordinates. job @ drawing font, picture, lines on screen render well, best convert them printing coordinate exports never expect control pixel in fonts, round approximates. ps : don't trust internal fields in fonts. ...

ibm mobilefirst - Error on real device . White screen and error:multiple define and script error on dojo.js -

worklight 5.06 , dojo 1.8. app works on android emulator , web browser doesn't works on real device. logcat: 08-08 14:58:35.520: d/dalvikvm(4470): gc_concurrent freed 437k, 8% free 6855k/7431k, paused 1ms+1ms 08-08 14:58:36.880: d/dalvikvm(4470): gc_concurrent freed 520k, 9% free 6851k/7495k, paused 1ms+2ms 08-08 14:58:37.330: d/dalvikvm(4470): gc_concurrent freed 381k, 9% free 6858k/7495k, paused 1ms+1ms 08-08 14:58:37.890: d/dalvikvm(4470): gc_concurrent freed 435k, 9% free 6856k/7495k, paused 1ms+1ms 08-08 14:58:38.530: d/dalvikvm(4470): gc_concurrent freed 404k, 9% free 6856k/7495k, paused 2ms+2ms 08-08 14:58:39.390: d/dalvikvm(4470): gc_concurrent freed 501k, 9% free 6861k/7495k, paused 1ms+2ms 08-08 14:58:39.870: d/dalvikvm(4470): gc_concurrent freed 504k, 9% free 6861k/7495k, paused 1ms+2ms 08-08 14:58:40.590: d/dalvikvm(4470): gc_concurrent freed 406k, 9% free 6869k/7495k, paused 2ms+2ms 08-08 14:58:40.630: d/dalvikvm(4470): gc_concurrent freed 523k, 9% free 6855k...

Access Matlab classes in MEX/C-code -

i have rewrite matlab code c embedded matlab using mex once again. far, i've read tutorials , examples in how works simple data structures. (i've never done before, though consider myself experienced in both matlab , c). so here problem: i have given that classdef myclass properties foo; bar; blub; somethingelse; end methods function obj = myfun(obj) % random example code obj.foo = obj.bar; obj.blub = 42; = 1:length(obj.somethingelse) obj.somethingelse(i) = i*i; end; end end end i want rewrite myfun mex/c-function. if pass class mex-function, how can access different properties of class? thanks you have following functions in mex api: mxgetproperty , mxsetproperty their use equivalent to: value = pa[index].propname; pa[index].propname = value; note these functions create deep copies...

ANDed-ORed query in django -

i want execute following query in django filters out model based on both anded , ored states collectively. the query in sql this: select * webreply (conversation_id = conversation_id , (user_id = ids or sent_to = ids)) this wrote in django, throws error saying non-keyword arg after keyword arg django web_reply_data = webreply.objects.filter(conversation_id = conversation_id, (q(user_id = ids) | q(sent_to = ids))) where going wrong? try this: web_reply_data = webreply.objects.filter(conversation_id = conversation_id).filter( q(user_id = ids) | q(sent_to = ids))

php - SQL - Count how many itmes in a GROUP also using SUM -

i'm using pdo (still learning) , have current sql query. works perfectly, merging duplicate entries , adding value. there way see how many duplicate entries there were? $sql = "select col1, sum(col2) table date > :fromdate , date < :enddate group col1"; my table looks this col1 col2 ----- ------ abc 2 aba 3 add 1 aed 3 abc 2 aba 3 add 1 aed 3 aed 0 at moment, after loop through, result looks this col1 col2 ---- ---- abc 4 aba 6 add 2 aed 6 but i'd value of how many times occured in db before grouped end with col1 col2 times appeared ---- ---- -------------- abc 4 2 aba 6 2 add 2 2 aed 6 3 use count() that. counts records in group if used group by select col1, sum(col2), count(*) 'times appeared' table date > :fromdate , date < :enddate group col1...

wpf - TextBlock and TextBox objects alignment depending on width of border container -

what have when size of border container wide enough: textblock textbox textblock textbox then size of border gets smaller , have this: textblock textbox textblock tex there not enough space fourth textbox need this: textblock textbox textblock textbox how can achieve it? wrappanel + container around units.

c# - Add and remove CssClass ASP.NET -

i have weird behavior asp.net application. want change color of current selected row in grid view. my gridview defined : <asp:gridview [..] onselectedindexchanged="supresultlist_selectedindexchanged"> [..] <rowstyle cssclass="datagriditem" /> <alternatingrowstyle cssclass="datagridalternateitem" /> </asp:gridview> in code-behind, have : protected void supresultlist_selectedindexchanged(object sender, eventargs e) { gridview grid = sender gridview; // remove class "selected" older row foreach (gridviewrow row in grid.rows) { row.cssclass = row.cssclass.replace("adminrowselected", string.empty); } grid.selectedrow.cssclass = string.join(" ", grid.selectedrow.cssclass, "adminrowselected"); } may there better way want ? anyway, when gridview first rendered, rows have classes. when select row , enter in supresultlist_selectedindexchanged...

php - Integrity constraint violation: 1062 Duplicate entry '4974-134' for key 'UNQ_CATALOG_PRODUCT_SUPER_ATTRIBUTE_PRODUCT_ID_ATTRIBUTE_ID' -

Image
i getting above error in magento when adding configurable product (before creating simple products) this has worked reason failing. the key value 4974-134 doesn't exist in table: i've tried re-creating table. i''ve cleare cache/log tables/re-indexed , nothing seems work - each time 4974 (product/entity_id) increments 1 implying being created in catalog_product_entity table isn't: the way resolve extend/overwrite product model _aftersave function in new module (make sure new class extends extends mage_catalog_model_product ). like so: /** * saving product type related data , init index * * @return mage_catalog_model_product */ protected function _aftersave() { $this->getlinkinstance()->saveproductrelations($this); if($this->gettypeid() !== 'configurable') { $this->gettypeinstance(true)->save($this); } /** * product options */ $this->getoptioninstance()->setproduct(...

vba - Access2010: Opening screen to display animation while linking tables -

when access 2010 application loads, need link couple oracle tables security reasons before show logon screen. show animated gif if possible while tables being linked in background. have created form has animated gif webbrowser control. when screen opens, animated gif works great. thought open form , call animated gif form me.repaint doevents and subroutine linktables, after wish close both forms. the animated gif form opens, shows frozen image, links , closes. is there anyway show animation while occuring in background? multithreading in access isn't possible can similiar: split animated gif series of still images can viewed sequentially: a,b,c, etc. split background process series of tasks: 1,2,3 etc. make loading form. show image a. when background process finishes task 1, replace image b. when background process finishes task 2, replace image b c. repeat. does make sense?

c++ - deque vs vector guidance after C++11 enhancements -

this question has answer here: how can efficiently select standard library container in c++11? 4 answers back in pre-c++11 days, many book authors recommended use of deque situations called dynamically sized container random access. in part due fact deque move versatile data structure vector , due fact vector in pre-c++11 world did not offer convenient way size down capacity via "shrink fit." greater deque overhead of indirect access elements via brackets operator , iterators seemed subsumed greater vector overhead of reallocation. on other hand, things haven't changed. vector still uses geometric (i.e., size*factor) scheme reallocation , stil must copy (or move if possible) of elements newly allocated space. still same old vector regard insertion/removal of elements @ front and/or middle. on other hand, offers better locality of reference, alt...

c# - Handling WCF Rest Service exceptions only in one place -

i'm developing wcf rest service i'm going host on iis. now i'm implementing service contract, , see i'm repeating same code on of methods when i'm trying handle exceptions. this 1 of service contract method: public void deletemessage(string message_id) { int messageid; outgoingwebresponsecontext ctx = weboperationcontext.current.outgoingresponse; if ((message_id == null) || (!int32.tryparse(message_id, out messageid)) || (messageid < 1)) { ctx.statuscode = system.net.httpstatuscode.badrequest; ctx.statusdescription = "message_id parameter not valid"; throw new argumentexception("deletemessage: message_id not valid", "message_id"); } try { using (var context = new adnlinecontext()) { message message = new message() { messageid = messageid }; context.entry(message).state = entitystate.deleted; context.savechanges...

php - How to add a product category in woocommerce wordpress -

i hope can me problem asap. ok building costum script users publish new product, have working , inserting (event photo) cant seem find anywhere code should used update post category, not normal category because has taxonomy of "product_cat" (woocommerce product category). any ideas? non of following work: ($term_id term_id relates "product_cat" of product) wp_set_post_terms($post_id, array($term_id), "product_cat"); wp_set_post_terms($post_id, (int)$term_id, "product_cat"); update_post_meta($post_id,'product_cat',$term_id); i have tried others dont seem @ all, functions create new category id... well test wp_set_post_terms($post_id, array($term_id), "product_cat"); , worked me.

css - background-color on specific div appearing on whole page -

i'm working on page: http://broadcasted.tv/ my headings have following (i know should class, doing testing) #title-container { background-color: #333; color: #fff; margin-top: 15px; } it works fine everywhere except there http://broadcasted.tv/user/2/albertmarch/ and can't figure out why heading whole page... missing div ?? any appreciated thanks! the background goes away if add clear: #title-container { background-color: #333; color: #fff; clear: both; margin-top: 15px; }

c - Storing Pointers difference in integers? -

this code: #include<stdio.h> #include<conio.h> int main() { int *p1,*p2; int m=2,n=3; m=p2-p1; printf("\np2=%u",p2); printf("\np1=%u",p1); printf("\nm=%d",m); getch(); return 0; } this gives output as: p2= 2686792 p1= 1993645620 m= -497739707 i have 2 doubts code , output: since 'm' int, shouldn't take p2-p1 input since p1 , p2 both pointers , m integer should give error "invalid conversion 'int' 'int' " isn't. why? even after takes input, difference isn't valid. why it? since 'm' int, shouldn't take p2-p1 input since p1 , p2 both pointers , m integer should give error "invalid conversion 'int' 'int' " isn't. why? this type of error or warning depends on compiler using. c compilers times give programmers plenty of rope hang with... even after takes input, difference isn...

datetime - PHP Sorting files by Date/time and file size -

i working on modifying simple website. website has page shows clients files available download(if applicable). @ moment these files in random order no specific details. able have them in decending order based on time stamp made available. including file size. using php show files, need have directory sorted before displaying them? if separate script , when run? or can sort them displayed in follwoing code? <div id="f2"> <h3>files available download</h3> <p> <?php // list contents of user directory if (file_exists($user_directory)) { if ($handle = opendir($user_directory)) { while (false !== ($entry = readdir($handle))) { if ($entry != "." && $entry != "..") { echo "<a href='download_file.php?filename=".urlencode($entry)."'>".$entry."</a><br/>"; } } closedir($handle); } } ?> </p> ...

css - how should I change the sequence of a list -

this code creates list of year + month var currentdate = datetime.now; var list = new list<archiveviewmodel>(); (var startdate = currentdate; startdate >= new datetime(2012, 8, 1); startdate = startdate.addmonths(-1)) { list.add(new archiveviewmodel { month = startdate.month, year = startdate.year, formatteddate = startdate.tostring("mmmm, yyyy") }); } return partialview("_archivesidebar", list); and code in razor @foreach (var archive in model) { <ul> <li> @html.actionlink(archive.formatteddate, "post", "archive", new { year = archive.year, month = archive.month }, null) </li> </ul> } in case result august, 2013 july, 2013 june, 2013 may, 2013 april...

Is there a way to run a command on a different git branch? -

i have large rails project several feature branches active @ 1 time. have long running task (rebuild db, run tests). i able run test task on 1 feature branch while changing code on another. there way run particular command on branch, have branch active in terminal? some git commands can operate on reference, doesn't have branch checked out working copy: git log <branch> git diff <branch-one> <branch-two> other git commands operate on branch have checked out in working copy: git reset --hard head@{1} if tests depend on there being branch checked out working copy, far know, can't have more 1 branch checked out working copy, can have 1 working copy. as alternative, possibly clone local repo again second working copy way: git clone <path local repo> second-repo

active directory - Accessing ActiveDirectory properties belong to objectClass=posixGroup -

i trying update memberuid property of posixgroup . i directory search , find record. if loop through searchresults.property can list values (it defined multi-value) of field. i define directoryentry using searchresults.getdirectory method. if property directoryentry , instance check if exists ( property.contain ), or list or try update unknown error x'8000500c' . the fields cn , description ' not cause problem. if add other user defined properties error. how can work properties belonging type of schema? your error looks is: 8000500c active directory datatype cannot converted to/from native ds datatype this seems imply data returned not native ad datatype. there seems workaround @ article.

android - "onClick" in AutocompleteTextView causes an error -

i have autocompletetextview. want method run "onclick". here xml: <autocompletetextview android:id="@+id/givenbybox" android:layout_width="fill_parent" android:layout_height="wrap_content" android:onclick="setupmiranda" android:gravity="left" /> when run, errors. doesn't matter onclick set to, cause error. if remove android:onclick line works fine, not want. here excerpt logcat: 08-07 13:56:36.040: e/androidruntime(32735): fatal exception: main 08-07 13:56:36.040: e/androidruntime(32735): java.lang.runtimeexception: unable start activity componentinfo{com.itsmr.dre_android_clean/com.itsmr.dre_android_clean.mainactivity}: android.view.inflateexception: binary xml file line #46: error inflating class <unknown> 08-07 13:56:36.040: e/androidruntime(32735): @ android.app.activitythread.performlaunchactivity(activitythr...

php - Datamapper and CI: is not a valid parent relationship -

i have 2 models tables need relate, campus: class campus extends datamapper { var $table='campi'; var $has_many=array('boleto'); function __construct() { parent::__construct(); } } and boleto: class boleto extends datamapper { var $table='boletos'; var $has_one=array('campus'); function __construct(){ parent::__construct(); } } i have been working these tables 5 months, have relation table: | id | boleto_id | campus_id | everything ok, recently, every time need make includes relation got error message: datamapper error: 'boleto' not valid parent relationship campus. relationships configured correctly? do know what's happening? can't find error. strange that, said, working. thanks in advance! table boletos : | id | folio | table campi : | id | nombre_campus | table boletos_campi : | id | boleto_id | campus_id | i'm trying code (as wo...

Powershell array values, concatenating data -

this kind of painful question ask, here goes. i'm creating powershell script report on filer shares on netapp. i've gotten point can create report of shares, want take array i've created csv output , extract sharename value. want append in front of value servername "\filer\" creates unc path. i'm intending @ unc , use generate information on filer shares. ntfs permissions, path info, etc etc.. here's code: $sharelist = import-csv z:\shares.csv foreach ($item in $sharelist) { $sharelist += $item | add-member -name "filer" -value "\\<filername>\" -membertype noteproperty } this creating array , adding new property array match unc info... i run select object clean output: $sharelist | select-object mountpoint,filer,sharename,description | export-csv z:\sharereport.csv -notypeinformation this produces new csv that's nice , organized when open in excel. however want take objects "filer" , "sha...

java - Reversing a String using a for loop -

this question has answer here: reverse string in java 33 answers i want reverse inputted string using loop. have tried following code below. [ full of mistake think.. cause dont know how convert things array or string in problem ]. please me coding here... public class main extends activity { @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.main); textview tv = (textview) findviewbyid(r.id.textview1); edittext input_string =(edittext) findviewbyid(r.id.edittext1); final string orig = input_string.gettext().tostring(); button rev = (button) findviewbyid(r.id.button1); rev.setonclicklistener(new onclicklistener() { @override public void onclick(view arg0) { int limit = orig.length(); ...

Ruby empty parameter in function -

i'm trying enqueue various functions in generic way code : { object.const_get(object_name).new(job[:params]||={}).delay(:queue => queue).send(method_name)} job hash name, objects parameters etc... my problem in case : class foo def initialize puts 'bar' end end foo doesn't take parameters instanciation. so if use previous line foo object_name i'll error : argumenterror: wrong number pf arguments (1 0) and absolutly don't want write : if job.has_key?[:param] object.const_get(object_name).new(job[:params]||={}).delay(:queue => queue).send(method_name) else object.const_get(object_name).new().delay(:queue => queue).send(method_name) end what write instead of job[:params]||={} works every case? thanks in advance. you can achieve using foo.send , using array. for instance object. const_get(object_name). send(*(job.has_key?(:param) ? ['new', job[:param]] : ['new']))... i think not w...

asynchronous - Async Server handling many clients and messages in C# -

i create server handles multiple clients , handles them in async fashion. based on link below created code : http://msdn.microsoft.com/en-us/library/w89fhyex.aspx after inspection of msdn code realized manual event code blocking. my query solution if server designed accept many connections many clients won't making thread wait until connectcallback tells it finished cause potential connecting clients connecting @ time of waiting timeout or drop?