Posts

Showing posts from August, 2015

knockout.js - Access viewmodel in knockout mapping plugin -

i using knockout mapping plugin add computed property item in observable array. however, computed property relies on different property in viewmodel. how access viewmodel property when creating observable during mapping? please note cannot use options.parent, because property further in viewmodel. i unable change viewmodel, because generated server side. edit: here's jsfiddle shows issue. line commented out need working. http://jsfiddle.net/g46mt/2/ this have now, throwing error: var mapping = { 'collection': { create: function(options) { var model = ko.mapping.fromjs(options.data); model.total = ko.computed(function() { var result = this.price() * viewmodel.count(); // :( return result; }, model); return model; } } }; var json = { ... large json object ... }; var viewmodel = ko.mapping.fromjs(json, mapping); one possible solution use {defer

how to fill gridview with checkboxes in asp.net using vb -

i have gridview pregenerated columns <asp:gridview id="gridview1" runat="server" autogeneratecolumns="false" backcolor="white" bordercolor="#336666" borderstyle="double" borderwidth="3px" cellpadding="4" gridlines="horizontal"> <rowstyle backcolor="white" forecolor="#333333" /> <columns> <asp:templatefield headertext="menuid" > <itemtemplate> <asp:label id="label1" runat="server" text='<%# bind("menuid") %>'></asp:label> </itemtemplate> </asp:templatefield> <asp:templatefield headertext="menuparentid" > <itemtemplate> <asp:label id="l

windows - Finding the Owner of An Active Directory Group -

how can find owner of active directory group? not writing programming code - interested if possible find on iterface. thanks! in active directory users , computers: find group in question right-click , select properties selected security tab click advanced button select owner tab you should see owner of group.

php - how to display 2 different array in single array using for loop -

my output : array ( [0] => array ( [0] => array ( [no] => 316198 [name] => uma ) [1] => array ( [0] => array ( [totavg] => 3.0403 [tot] => 20.2023 [id] => 27 [pid] => 710600 [adr] => local [photo] => 123.png [date] => 19930-01-06 05:40 ) ) ) ) and want show : { "no": "316198", "name": "uma", "totavg": "3.0403", "tot": "20.2023", "id": "27", "pid": "710600", "adr": "loca

c++ - boost::thread_specific_ptr slows drastically relative to simple TlsGetValue and TlsSetValue -

i had small class called wcthreadspecificprivatedata. implementation: class wcthreadspecificprivatedata { public: wcthreadspecificprivatedata(); ~wcthreadspecificprivatedata(); void* getdata(); void setdata(void*); protected: uint32_t m_datakey; }; wcthreadspecificprivatedata::wcthreadspecificprivatedata():m_datakey(0) { m_datakey = ::tlsalloc(); } void* wcthreadspecificprivatedata::getdata() { void* retval = 0; if (0 != m_datakey) retval = ::tlsgetvalue(m_datakey); return retval; } void wcthreadspecificprivatedata::setdata(void* in_data) { if (0 != m_datakey) ::tlssetvalue(m_datakey, in_data); } i used store pointers thread specific struct called targetspecificdata. @ point decided use instead of class boost::thread_specific_ptr. works me, however, experience drastic performance drop. became more slower. i checked boost implementation (for windows) , saw implemented tlsgetvalue , tlssetvalue calls, expect same b

mongodb - Mongo aggregate with multiple aggregation types -

i need aggregate following data - country: one, car: volvo, name: smith, price: 100 - country: one, car: bmw, name: smith, price: 200 - country: two, car: romeo, name: joe, price: 50 - country: two, car: kia, name: joe, price: 110 - country: two, car: kia, name: joe, price: 90 (names unique, each 1 owns cars in single country) the results, expect (pluralization not required): - name: smith, type: volvos, country: one, val: 1 // count of car-type - name: smith, type: bmws, country: one, val: 1 - name: smith, type: total, country: one, val: 2 // count of cars - name: smith, type: price, country: one, val: 300 // total car price - name: joe, type: romeos, country: two, val: 1 - name: joe, type: kias, country: two, val: 2 - name: joe, type: total, country: two, val: 3 - name: joe, type: price, country: two, val: 250 e.g. pivotized data version build report country | name | volvos | bmws | romeos | kias | total | price --------------------

c# - Particular DateTime exception -

i need convert datetime strings format "mmm-yy" . i'm working culture "{es-es}" . it works fine month except march (in spanish marzo ). throws me exception: 'convert.todatetime("mar-13")' threw exception of type 'system.formatexception' system.datetime {system.formatexception} i've tried: string format = "yyyymm"; datetime result; cultureinfo provider = cultureinfo.invariantculture; result = datetime.parseexact("mar-13", format, provider); and this: datetime date = convert.todatetime("mar-13"); this works fine example with: "jun-13" "feb-13" "nov-13" ... edit real problem with: datetime date = convert.todatetime("ene-13"); -> ok datetime date = convert.todatetime("feb-13"); -> ok datetime date = convert.todatetime("mar-13"); -> crash datetime date = convert.todatetime("abr-13"); -&g

emacs jedi - completion shows function name and creates documentation in tooltip but documentation not found for scipy -

when complete sp.integrate.quad see tooltip function documentation, accept completion, tooltip goes away. i'd prefer see the main part of doc string underneath function entire time i'm editing it's arguments. stop gap, tried getting @ documentation way. jedi:show-doc or company-jedi-show-doc promising functions @ least re-displaying docstring information, give error saying can't find documentation. why can't these procedures see documentation, yet initial completion tooltip can? has used jedi achieve close desired setup? jedi setup info: https://gist.github.com/anonymous/11180631 py-install-directory var must set correctly jedi:show-doc. can set variable directly in emacs init file following sentance. (setq py-install-directory "~/.emacs.d/elpa/python-mode directory") or following sentance case python-mode package updated (setq py-install-directory (concat "~/.emacs.d/elpa/" (car (directory-files "~/.emacs.d/elpa/&q

javascript - Is it bad practice to pass $scope to a service? -

is bad practice pass $scope service? cause memory leaks since controllers can instantiated multiple times? example: .controller('testcontroller', function ($scope, testservice) { $scope.loaddata = function() { // loaddata set properties on scope testservice.loaddata($scope); }; }); not sure memory leak part since $scope being placed on stack, yeah, want separate concerns , return data services, not bind data controller within them. also, can lead confusion if else looking @ controller code , can't figure out how field within $scope got set.

c++ - How to add Crypto++ library to Qt project -

Image
i downloaded crypto++ source , compiled cryptlib project in visual studio 2013, , added generated .lib file qt project, made .pro file this: qt += core gui qt += sql greaterthan(qt_major_version, 4):qt += widgets target = untitled template = app sources += main.cpp\ mainwindow.cpp headers += mainwindow.h \ databasecontrol.h \ test.h forms += mainwindow.ui win32:config(release, debug|release): libs += -l$$pwd/ -lcryptlib else:win32:config(debug, debug|release): libs += -l$$pwd/ -lcryptlibd else:unix: libs += -l$$pwd/ -lcryptlib includepath += $$pwd/ dependpath += $$pwd/ win32-g++:config(release, debug|release): pre_targetdeps += $$pwd/libcryptlib.a else:win32-g++:config(debug, debug|release): pre_targetdeps += $$pwd/libcryptlibd.a else:win32:!win32-g++:config(release, debug|release): pre_targetdeps += $$pwd/cryptlib.lib else:win32:!win32-g++:config(debug, debug|release): pre_targetdeps += $$pwd/cryptlibd.lib else:unix: pre_targetdeps += $$pw

Microsoft Test Manager: I have not found Do Exploratory Testing tab in Test Manager 2012 -

i have installed visual studio 2012 ultimate microsoft test manager, reviewing bibliography version allow make exploratory test, in microsoft test manager, in test tab can´t see exploratory testing tab, read version , realize tab included default, not know if necessary configure in microsoft test manager, in team foundation server or visual studio 2012. sounds using mtm 2012 tfs 2010, see mtm 2012 compatibility tfs 2010 need @ least tfs 2012. if can't upgrade tfs 2012 reason, check article using exploratory bugs . it in time waiting tfs upgrade.

php - CakePHP: Find a record and retrieve the 10 following records -

i developing tool can 10 records big table, based on input in form. example, if table has column record "number", can input 1 number , app return 10 following records record number. the porpuse of lastest 10 inputs from last fetch . the problem that, afaik, there's no way make find condition of starting search @ specific position. find neighbors quite close, unfortunately returns 2 results: previous , next 1 search. any ideas? edit: right query looks this: $data = $this->tweet->find('all', array( 'field' => array('tweet.permalink' => $param2), 'fields' => array('tweet.embed'), 'limit' => 10, 'order' => array('tweet.created' => 'desc'), 'contain' => false, // 'offset' => 1, 'conditions' => array('not' => array('tweet.embed' => null), 'tweet.status' => 'approved'

Ruby Regex: Match Until First Occurance of Character -

i have file lines vary in format, basic idea this: - block of text #tag @due(2014-04-20) @done(2014-04-22) for example: - email john doe #email @due(2014-04-20) @done(2014-04-22) the issue #tag , @due date not appear in every entry, like: - email john doe @done(2014-04-22) i'm trying write ruby regex finds item between "- " , first occurrence of either hashtag or @done/@due tag. i have been trying use groups , ahead, can't seem right when there multiple instances of looking ahead for. using second example string, regex: /-\s(.*)(?=[#|@])/ yields result (.*): email john doe #email @due(2014-04-22) is there way can right? thanks! you're missing ? quantifier make non greedy match. , remove | inside of character class because it's trying match single character in list ( #|@ ) literally. /-\s(.*?)(?=[#@])/ see demo you don't need positive lookahead here either, match until characters , print result capturing group.

why android cant find class Mission in dataBase -

i create android application show list of mission data data base database manager ...but have error tell me there no table mission in database public class dbasemanager extends sqliteopenhelper { private dbasemanager mdbhelper; private sqlitedatabase mdb; public static final string db_name = "si.db"; public static final string db_path = environment.getexternalstoragedirectory() +"/si/db/"; //**********************************table_missions************************************** private static final string table_missions = "missions"; private static final string col_id_mission = "idmission"; private static final int num_col_id_mission = 0; private static final string col_nom_mission = "nommission"; private static final int num_col_nom_mission = 1; private static final string col_date_mission = "datemission"; private static final int num_col_date_mission = 2; private static fina

boolean - Python 3 - Only numeric input -

i have trouble finishing python assignment. i'm using python 3.0 program asks user input set of 20 numbers, store them list, , perform calculation on output largest number, smallest, sum, , average. right now, working, except 1 thing! in event of non numeric input user, program ask input again. have trouble doing that, thought of boolean variable, i'm not sure. thanks lot help. here's code : import time #defining main function def main(): numbers = get_values() get_analysis(numbers) #defining function store values def get_values(): print('welcome number analysis program!') print('please enter series of 20 random numbers') values =[] in range(20): value =(int(input("enter random number " + str(i + 1) + ": "))) values.append(value) #here store data list called "values" return values #defining function output numbers. def get_analysis (numbers): print(

c# - Json.NET deserialise to interface implementation -

i'm trying use json.net serialise class transfer via http request. client server test program shares common class files. files interface ( itestcase ) , implementations of interface ( testpicture , testvideo ). serialising , deserialising testcase below within same application works fine, presumably because json.net code contained within 1 assembly. when serialise testcase , send server, try deserialise, error "error resolving type specified in json 'com.test.testcases.testpicture, graphics tester'. path '$type', line 2, position 61" with inner exception of type jsonserializationexception message "could not load assembly 'graphics tester'." in json.net documentation , when json generated $type value "$type": "newtonsoft.json.samples.stockholder, newtonsoft.json.tests" . second parameter seems reference relevant classes namespace, rather project name (namely graphics tester) happening in instance. give

android detect user switching from/to HOME -

i have appwidget @ home , updated periodically. want stop update if home not visiable. use service register screen on/off receiver start/stop updating appwidget when screen on/off. don't know how detect if screen on user focusing on else (i.e. home not @ foreground). how can detect if user switch from/to home in service or receiver (it's appwidget , don't have activity on hand when happens)? as far know, there no direct api detect whether home in foreground or background. but following snippet tell whether user @ home or not. if (mactivitymanager.getrunningtasks().get(0).topactivity.getpackagename().equals("com.android.launcher") { //home } disclaimer: above code work default launcher (com.android.launcher) . so, if user using third-party launcher, can't detect if don't know package name of launcher.

Step over Node in VB.net XML parsing -

Image
i'm trying use xml parsing capabilities of vb.net here xml returned google's traffic directions api. my vb.net code total distance value is returneddistancemeters = returnedxml...<route>...<leg>...<distance>...<value>.value but "short cutting" value in first "step" node , giving me 88 want 193108. how avoid jumping first node called "distance" ? i don't know if there better way. every time have work xml on .net prefer use xsd.exe create class. http://msdn.microsoft.com/en-us/library/x6c1kb0s(v=vs.110).aspx after adding .vb file project, can initialize class xml file using function: private function gettraficfromfile(byval path string) trafic dim stream new io.streamreader(path) dim ser new xml.serialization.xmlserializer(gettype(trafic)) dim mytrafic new trafic mytrafic = ctype(ser.deserialize(stream), trafic) stream.close() return mytrafic end function you can ac

c# - Can i create OwinMiddleware per request instead creating a global object -

i'm working on webapi project & migrating owin/katana hosting. have few doubts regarding. quest ) can create owinmiddleware per request instead creating global object? i'm able create owinmiddleware not able create them per request. wanted create them per request can insert new object in owinmiddleware dependency. i'm using unity in webapi wanted solution aligned unity. i found few links :- http://alexmg.com/owin-support-for-the-web-api-2-and-mvc-5-integrations-in-autofac/ http://www.tugberkugurlu.com/archive/owin-dependencies--an-ioc-container-adapter-into-owin-pipeline but not able adjust new ioc old unity. can suggest solution i found way achive :- app.use((iowincontext context, func<task> next) => { ilogger logger = {resolve dependency using unity}; customowinmiddleware middleware = new customowinmiddleware(context,next, logger); return middleware.invoke(); }); by way i

javascript - Custom widget defined in an HTML page loaded as dojox.layout.contentpane using href and inserted as tab page not parsing custom widgets -

i trying add new tab page using tab.addchild programmatically after creating dojox.layout.contentpane href attribute. following sample snippet of relevant code ( tabmain tab control placed in page) dijit.byid('tabmain').addchild(new dojox.layout.contentpane({ title: 'my page', href: 'country.jsp', closable: true, parseonload: true, postcreate: function () { dojo.parser.parse(); })); this country.jsp has custom widget (that contain 2 standard dijit widgets). custom widgets not parsed , hence not getting custom widget loaded, other standard dijits mentioned in country.jsp loads perfectly. to rule out problem page , custom widget declarations, put custom widget directly in page without loading inside contentpane/tab (and loaded inside dialog page), works fine. so, assume dojo parser not parsing custom widget, when load in content pane shown in above code. does mean, custom widget cannot used such typ

mongodb - Updating Mongo documents -

i update collection transforming documents form: { "_id" : "somestring made", "value" : { "a" : 0.42361499999999996, "b" : 3, "c" : "foo", "d" : "bar" } } to form (with new id's): { "_id" : objectid("77d987f6dsf6f76sa7676df"), "a" : 0.42361499999999996, "b" : 3, "c" : "foo", "d" : "bar" } so take fields out of object "value" , reset id real document id. first document , convert required format , remove old doc , again insert modified 1 . like db.collection.find({}).foreach(function(doc){ var obj = { : doc.value.a, b : doc.value.b, c : doc.value.c, d : doc.value.d}; db.collection.remove(doc); db.collection.insert(obj); });

java - Attaching ActionListener to JComboBox -

i working on program has several functions need happen based on user selection jcombobox. ideally, user selection pulled out , used in series of if/else statements change necessary values. this error getting: method addactionlistener in class jcombobox<e> cannot applied given types; classjcombobox.addactionlistener(this); required: actionlistener found: dwtools reason: actual argument dwtools cannot converted actionlistener method invocation conversion e type-variable: e extends object declared in class jcombobox and here code (at moment, have set put chosen class in name jtextfield testing purposes): import java.awt.*; import javax.swing.*; import java.awt.event.*; import java.text.*; import java.util.*; public class dwtools extends jframe { private string[] classes = { "bard", "cleric", "druid", "fighter", "paladin", "thief", "ranger", "wizard" }; public jtabbedpane m

ios - Sync with Couchbase Lite through Couchbase Sync Gateway doesn’t see any documents (Channel issue?) -

i’m trying sync couchbase bucket server ios app using couchbase sync gateway , couchbase lite ios. so far i’m working "beer-sample" example bucket comes couchbase. on ubuntu 12.04 lts vm, couchbase sync gateway started config file: { "interface":":4984", "admininterface":":4985", "log":["rest"], "databases":{ "sync_gateway":{ "server":"http://localhost:8091", "bucket":"beer-sample", "sync":`function(doc) {channel(["public"]);}`, "users": { "guest": {"disabled": false, "admin_channels": ["public"]} } } } } my intention running without worrying authentication first, therefore guest user. i’ve modified example make sure channel assignment not dependent on documents, because sample bucket doesn’

java - Artificial Intelligent patterns in an RTS environment -

this appears popular topic, question rather specific. if has been addressed before, please feel free point me articles. i'm designing ai game rts (real time strategy). player against ai, acting general, commanding various soldiers in live-time (not turn based) arena. now, other ais i've seen focus on each soldier having it's own ai. i'm looking ai general, directs soldiers towards various goals. eg go there, attack this, this, etc in turn-based game, easy enough analyse field, , act on it, issuing orders. however, in live-time environment, not case. i've setup delay, every 3 seconds ai re-analyses situation, because don't want happening 60 times second (60fps). there better way deal this? another issue have ai may see situation needs addressing, , issues "orders" troops "go location x". on next cycle/iteration of ai (after 3 seconds), if soldiers have not yet reached goal, best approach keeping track of orders , seeing completion st

javascript - getting the value of dropdown menu's and displaying choice using JS -

once user chooses flavour want, want able display message on webpage choices have made drop-downs after submit button clicked. here have far: <select name="flavour1" required> <option value="">please select flavour!</option> <option value="apple">apple</option> <option value="strawberry">strawberry</option> <option value="lemon">lemon</option> <option value="pear">pear</option> <option value="cola">cola</option> <option value="lime">lime</option> </select> <select name="flavour2" required> <option value="">please select flavour!</option> <option value="noflavour">no more flavours!</option> <option value="apple">apple</option> <option value="strawberry">strawberry<

c++ - I am writing a program in OpenGL to create an oscillating pendulum -

i have figured out rotation cannot limit rotation particular angle. i'm using idlefunc increment angle theta in background. please suggest alternative or solution limit rotation angle to, say, +90 , -90 degrees. here's code: #include<stdio.h> #include<gl/freeglut.h> #include<math.h> int n=10; glfloat v[4][3]={{0.0,0.0,1.0},{0.0,0.942809,-0.33333},{-0.816497,-0.471405,-0.33333},{0.816497,-0.471405,-0.333333}}; glfloat a[2][3]={{0.0,0.0,-0.333333},{0.0,3.0,-0.333333}}; void normalize(glfloat *p) { double d=0.0; int i; for(i=0;i<3;i++) d+=p[i]*p[i]; d=sqrt(d); if(d>0.0) for(i=0;i<3;i++) p[i]/=d; } void triangle(glfloat *a,glfloat *b,glfloat *c) { glbegin(gl_polygon); glnormal3fv(a); glvertex3fv(a); glvertex3fv(b); glvertex3fv(c); glend(); } void divide_triangle(glfloat *a,glfloat *b,glfloat *c,int n) { glfloat v1[3],v2[3],v3[3]; int j; if(n>0)

android - Passing data though multiple activities -

1- first activity(main) 2- second activity 3 - third activity i want run 2 1 , form 2 run 3 , , 3 taking data , returning 1. hope guys understand. here code: runing 2 form 1 liek : intent intent = new intent(getapplicationcontext(),messagebox.class); intent.setflags(intent.flag_activity_forward_result); startactivityforresult(intent,5); and running 3 2 this: intent intent = new intent(getapplicationcontext(),imagereceiver.class); startactivityforresult(intent,5); and in 3 have this: setresult(10); finish(); so set result in 2 result have: if(requestcode==5) { if(resultcode==10) { intent intent = new intent(getapplicationcontext(),mainactivity.class); setresult(5,intent); finish(); } } and in 1 got: if(requestcode==5) { if(result

Retrieve MySQL Database from xampp -

i using storage software ics,caps , resistors called "elela" ( http://www.mmvisual.de/ ). software based around mysql database hosted local xampp. computer crashed (blown motherboard) had re-install of it. my problem : there chance restore lost database (i know exact name: elela , username/password)? looking *.sql file load new xampp installation not lucky. thanks in advance! luke

html5 "loading but not playing" event -

i'd know if there event in html 5 when media loading can't play because it's not loaded enough, in order make loading icon appear. searched everywhere can't seem find answer :/ you can listent event loadstart in order show loading icon, , event play (or canplay or canplaythrough , depending of want/need) hiding loadding icon. those events (and many more) available html5 media elements, audio , video . can check documentation media events video here: http://www.w3.org/wiki/html/elements/video#media_events

Multiple if _name_ in python -

i'd write code execute function 2 following categories: single file multiple files what's construct it? i'm thinking multiple if _name__ . #!/usr/bin/env python def main(filename) # 1 file. if __name__ = '__main__' single_filename = "file.txt" main(single_filename) # if _name__ ?? # multiple_files = ['file1.txt', 'file2.txt'] # file in multiple files: # main(file) later i'd use argparse allow user decide whether want run on single file or multiple files. if understand correctly needs, think best way test on arguments passed program. def main(f): pass if __name__ == '__main__': files = sys.argv[1:] # first argument name of program f in files: main(f) in cmd line, may run python bar.py file1 file2

Form data not being passed through, coming back with 301 permanently moved error (using laravel) -

for whatever reason, returning 301 permanently moved error in inspector/network window. not posting form data table either. index.blade.php file {{ form::open(array('url' => '/')) }} {{ form::text('firstname' , '', array('placeholder' => 'first name'))}} {{ form::text('lastname' , '', array('placeholder' => 'last name'))}} {{ form::submit('add name', array('class' => 'btn btn-success'))}} {{ form::close() }} route file <?php route::get('/', function(){ return view::make('index'); }); route::post('/', function() { $input = input::all(); db::insert('insert donkey (firstname, lastname) values (?, ?)', array($input['firstname'], $input['lastname'])); }); any ideas? you doing wrong, use following instead: $input = input::all(); db::table('donkey')->insert( array('firstna

acl - How to route traffic (reverse Proxy) with HAProxy based on request body -

i attempting route following request appropriate servers based on url identified in post body below. hoping accomplish via reverse proxy using haproxy. e.g. direct requests haproxy, have haproxy check if values exist in post body (e.g. notification url value "pingpong"), , if case, route traffic endopint specify in configs. post /someurl/file.jsp http/1.1 host: 10.43.90.190:80 content-type: application/json connection: keep-alive accept: */* content-length: 256 {"info": {"groupname":"thisgroup1","id":"m1234r456","id2":"tup1234", "countrycode":"usa","carriercode":"usaic","e164address":"123456768789", "notificationurl":"http:\/\/www.pingpong.com\/notify", "timestamp":"2014-03-04t17:33:30.000z"}} is there way use acl search content, "pingpong" in request body, , based on value, r

sql - Mysql result include e+07, how can we escape e+07 from the result -

if export result mysql csv file value shown normal, once execute select command mysql result shown x.xxxxxe+07 exp: select mycolumn mytable mycolumn=25744130; the result following 2.57441e+07 2.57441e+07 2.57441e+07 ... is there way avoid such kind display? first of - please, note, in common case it's not true that, example, 2.57441e17 257441000000000000 - because of lack of significant digits. also, in such case won't able fractional part. assuming want output zero-filled result without fractional part, can use format() : select replace(format(f, 0), ',', '') t like: mysql> select v, replace(format(v, 0), ',', '') t; +------------+--------------------------------+ | v | replace(format(v, 0), ',', '') | +------------+--------------------------------+ | 2.57441e17 | 257441000000000000 | +------------+--------------------------------+ 1 row in set (0.00 sec) this result in

spring batch - Continually restating a job using JobExecutionListener -

we need job run continuously without need external scheduler. have extended jobexecutionlistener , follows: @autowired @qualifier("myjob") private job job; private int counter = 0; @override public void afterjob(jobexecution jobexecution) { jobexecution.stop(); jobparameters jobparameters = new jobparameters(); jobparameter jobparameter = new jobparameter((new integer(++counter)).tostring()); jobparameters.getparameters().put("counter", jobparameter); try { joblauncher.run(job, jobparameters); } catch (jobexecutionalreadyrunningexception e) { throw new runtimeexception(e); } catch (jobrestartexception e) { throw new runtimeexception(e); } catch (jobinstancealreadycompleteexception e) { throw new runtimeexception(e); } catch (jobparametersinvalidexception e) { throw new runtimeexception(e); } when run, jobexecutionalreadyrunningexception thrown. jobexecutionalreadyrunningexception: job executi

MongoDB Java Driver Replica Set Failover -

i have monogdb replica set 2 members , arbiter. problem when primary node goes down , mongo selecting new primary have data loss. believe can control on java driver level.please me find right settings don't have data loss when failover occurs during primary election writes result in exceptions , you'll have retry writes or relay messages user. there no built in logic retries you'll have write own retry handlers.

jquery - How can I show a spinner while the server generates a PDF file for the user? -

i'm using spring mvc present user form has series of options. when submit form, options used generate pdf file. in cases, generation of pdf file takes while — 30 seconds or more. when pdf generated, comes down application/pdf user can save. i'd show animation while pdf being generated. @ moment, indication server working waiting ... shown in browser.

jdo - How to write JDOQL Query to get data from multiple objects(Relational Objects) -

i want write jdoql query(jdoql delarative or jdoql single string ). here classes public class customer { string cid; string name; string email; string city; set<address> addresses=new hashset<address>(); } public class address { string aid; string city; string location; } 1-n relaitonship between customer , address objects. here's database query select c.name,c.email,a.city,a.location user.mascustomer c inner join user.masaddress on c.cid= a.cid; how can represent above query in form of jdoql (delcarative or single string)?

ios7 - How to resize UIAlertView in iOS 7 -

currently i'm using code doesn't work in ios 7. works fine in ios 6: uialertview *alertview = [[uialertview alloc] initwithtitle:title message:nil delegate:self cancelbuttontitle:@"cancel" otherbuttontitles:nil, nil]; [alertview show]; - (void)willpresentalertview:(uialertview *)alertview { [alertview setframe:cgrectmake(alertview.frame.origin.x, alertview.frame.origin.y, alertview.frame.size.width, 200)]; } how can resize in ios 7?

javascript - Google Chart - different backgrounds depends on x axis -

Image
i use google chart , on x axis have days of week , on y axis values. want change background weekends. possible in google charts? i mark on screen field should have different color:

ssas - Get next member that matches criteria mdx -

i attempting return measure 2 periods current member on time dimension need include periods match criteria (is_business_day = true) i have: ( [date].[calendar].currentmember.nextmember.nextmember, [measures].[some measure] ) which accurately returns value of measure 2 members in future, need additionally apply filter, can't quite figure out how so. edit: my thinking have similar following ( head( exists( [date].[calendar].currentmember.nextmember:[date].[calendar].currentmember.lead(6), [date].[is business day].&[true] ), 2 ).item(1), [measures].[some measure] ) as both hierarchies, [date].[calendar] , [date].[is business day] in teh same dimension, can rely on ssas "autoexists" faster exists . hence, ((([date].[calendar].[date].&[20050718].nextmember : null ) * { [date]..item(0) } ).item(0) ,[measures].[some measure] ) the : null construct builds set end of

excel - how to frame a insert query with values in A cell -

i have spreadsheet values 1000 2000 3000 4000 i want frame query like insert table_name values(a1); insert table_name values(a2); insert table_name values(a3); how can this you looking function concatenate() =concatenate("insert table table_name values(",a2,");") here a2 cell in value contained. step 1> goto column beside 1 values step 2> apply above formula step 3> copy paste formula cells in new column. take care of generating final values.

opentok - unable to see remote system video on my screen -

do have demo on video confrencing. created code unable see remote computer video on screen , video on remote system screen. here code <head runat="server"> <script src="//static.opentok.com/webrtc/v2.2/js/opentok.min.js" ></script> <script type="text/javascript"> var remotevideo = document.getelementbyid('remotevideo'); var apikey = "key"; var sessionid = "*session*"; var token = "*token*"; var publisher = tb.initpublisher(apikey, 'mypublisherdiv'); var session = tb.initsession(sessionid); session.addeventlistener('sessionconnected', function (e) { session.publish(publisher); (var = 0; < e.streams.length; i++) { if (e.streams[i].connection.connectionid == session.connection.connectionid) { return; } var div = document.createelement('div'); div.setattribute('id', 'strea

oauth - Google+ api moments insert unauthorized message -

i'm trying insert moments, using access_token, generated here https://developers.google.com/oauthplayground/ , receive "unauthorized" message. wrong? request is: { "target": { "url": "http://example.com" }, "type": "http://schemas.google.com/addactivity" } i send data on www.googleapis.com/plus/v1/people/me/moments/vault?access_token=######, ###### - access token. the response is: { "error":{ "errors":[ { "domain":"global", "reason":"unauthorized", "message":"unauthorized" } ], "code":401, "message":"unauthorized" } } i had same problem, solved adding "request_visible_actions" , make sure have login scope set on request i.e " https://www.googleapis.com/auth/plus.login "

Firefox CSS triangle render error -

Image
i have written css able create 'wonky' div ie8 compatible using css triangles , pseudo-elements. http://jsfiddle.net/9wapa/2/ this method working in ie8+ , versions of chrome. firefox proving issue. on machine edges rending perfectly, when testing on other systems running variety of oss , firefox versions, , edges of triangles become jagged (not antialiased) seemingly @ random. after investigation found style: -moz-transform: scale(0.9999); which fix jagged edge, problem when style applied , edge not jagged user, random graphical bugs start playing (flickering , colour bleeding). after research , comparing separate machines think issue machines have 'direct2d' enabled on them. tests every machine did not have direct2d running showing jagged edge. so question is: know of style fix jagged edge, without causing crazy graphical bugs in direct2d? or possibly; know way site detect presence of direct2d on machine style added in js? thanks!

c - Constantly checking for shared memory to change while in a loop -

i have loop true allow other clients connect. problem having how check shared memory see if changes know when time shut down server? while loop put in works not let other clients connect after. issue in while(1) loop, has wait client connect before going through loop need checking shared memory not when client connects. #include <sys/types.h> #include <netinet/in.h> #include <sys/socket.h> #include <errno.h> #include <stdio.h> #include <unistd.h> #include <stdlib.h> #include <strings.h> #include <sys/ipc.h> #include <sys/shm.h> #include <sys/wait.h> struct sockaddr_in sn; struct sockaddr from; int main(int ac, char** other){ int s, ns, sl, x = 22, pid; char b[256]; key_t key=137; int size=1; int shmflg=0; int id=0,ok=0; char shmstr[10]; char istr[10]; int *shmptr; size=size*sizeof(int); shmf

What is the best way to make sure this css works in all browsers? -

i taking on application has buttons css: background-image: -moz-linear-gradient(center top , #049cdb, #0064cd); it looks beautiful in firefox looks mess in ie, etc what best way take these firefox specific css , determine best way make same on browsers (just need ie8+) this tool might useful tool you. since css attribute still working draft of css , has legacy require lot of markup supported current situation. -moz- prefix 1 such isntance of providing support. other browsers required either standard, -ms-, -webkit-, -webkit- type or -o- prefix well. you should out other spots in application you've taken on code hasn't been tested on other browsers. link http://www.colorzilla.com/gradient-editor/

matlab - Decision Level Fusion of SVR outputs -

i have 2 sets of features predicting same outputs. instead of training @ once, train them separately , fuse decisions. in svm classification, can take probability values classes can used train svm. in svr, how can this? any ideas? thanks :) there couple of choices here . 2 popular ones be: one) build 2 models , average results. it tends work in practice. two) you in similar fashion when have probabilities. problem is, need control on fitting .what mean is "dangerous" produce score 1 set of features , apply labels same before (even if new features different). because new applied score trained on these labels , therefore on fits in (hyper-performs). normally use cross-validation in case have train_set_1 x1 features , label y train_set_2 x2 features , same label y some psedo code: randomly split 50-50 both train_set_1 , train_set_2 @ same points along y (output array) so have: a.train_set_1 (50% of training_set_1) b.train_set_1 (the re

Something about erlang log framework -

we have try use lager our log framework. meet problem. lager may lost date, have saw source code of lager, think reason gen_event notify async call, doesn't guarantee message receiving. lager performance not enough. guess because of lager's file backend written erlang. doesn't have performance. so, think log framework written c, , capsulated erlang may choice. do know erlang framework meet requirements? lager create event named 'lager_event' in application. for every backend, there 1 gen_event process handle it. therefore if many process generating messages @ same time, log of course lost @ 1 specific time. not related language use. sugguest: 1. control log quantity. 2. rid of erlang's event system , create jobs(tasks)'s subsystem (multi processes) handle log.

javascript - event different in "click with mouse" and "trigger" -

i have bind event like: $(document).on('click', selector, proxy); what difference between "click mouse" , " do trigger xxx.trigger('click'); " principle in calling callback function? both same, click() shorthand of trigger('click') . more info here . i found info too, in stackoverflow .

google visualization - How to change ControlWrapper Category filter ui.caption text color based on the caption? -

how change controlwrapper category filter ui.caption text color based on caption? tried following code,but not works. var category_picker = new google.visualization.controlwrapper({ 'controltype': 'categoryfilter', 'view': {'columns': [1,2,3,4,7,8]}, 'containerid': 'category_filter_container', 'options': { 'filtercolumnlabel': 'p/a', 'ui': { 'matchtype':'any', 'label': '', 'caption':'all', 'labelstacking': 'horizontal', 'allowtyping': false, 'allowmultiple': false,

c# - Generate key using Pass Phrase or AesCryptoServiceProvider? -

we using aes encryption encrypt data. generating key once in year using app(i.e console) way have choose generate key? 1. need generate key using pass phrase method? 2. or have choose default generate key provided aescryptoserviceprovider? the below method uses pass phrase generating encryption. method 1: private static readonly byte[] salt = new byte[] { 10, 20, 30, 40, 50, 60, 70, 80 }; private static byte[] createkey(string password, int keybytes = 32) { const int iterations = 300; var keygenerator = new rfc2898derivebytes(password, salt, iterations); return convert.frombase64string(keygenerator.getbytes(keybytes)); } the below method uses aescryptoserviceprovider generating key , didn't use pass phrase method 2: var key = default(string); using (var provider = new aescryptoserviceprovider()) { provider.generatekey(); key = system.text.encoding.ascii.getstring(provider.key); } edit: can use random number generation method? public

ios - OpenGL format texture -

i trying display video on screen using opengl es 2 on ios. i sum bit doing playback , display video on screen : first have .mov file recorded using gpuimagemoviewriter object. when recording completed going playback video using avplayer . therefore set avplayeritemvideooutput able retrieve frame video : nsdictionary *test = [nsdictionary dictionarywithobject: [nsnumber numberwithint:kcvpixelformattype_32bgra] forkey: (id)kcvpixelbufferpixelformattypekey]; self.videooutput = [[avplayeritemvideooutput alloc] initwithpixelbufferattributes:test]; i use copypixelbufferforitemtime function avplayeritemvideooutput , receive cvimagebufferref corresponding frame of initial video @ specific time. finally, here function created create opengl texture buffer : - (void)setuptexturefrombuffer:(cvimagebufferref)imagebuffer { cvpixelbufferlockbaseaddress(imagebuffer, 0); int bufferheight = cvpixelbuffergetheight(imagebuffer); int bufferwidth = cvpixelbuffergetwid