Posts

Showing posts from March, 2015

php - Redirect file upload -

i'm building website in php have split project in 2 parts, api , "web application". api accessed @ http://api.localhost , other part @ http://localhost . now on http://localhost i've added dropzone form want handle request @ http://api.localhost/upload . since it's different domains, dropzone doesn't seem allow out of box. can upload file http://localhost , somehow redirect file http://api.localhost/upload ? or there else can try?

Rails delete table row via migration -

i'm trying delete several rows in table actionable_items via following migration. have debugged , can confirm variables store table row not nil. migration runs successfully, doesn't delete row table. also, know why can debug migration when run rake db:migrate:redo not when run rake db:migrate ? class removeactionableitems < activerecord::migration class actionableitem < activerecord::base attr_accessible :actionable_item, :name, :sequence, :type end class menuitemtemp < actionableitem self.table_name = "actionable_items" end class insightreportmenuitemtemp < actionableitem self.table_name = "actionable_items" end def validation_settings = menuitem.find_by_name("validation settings") identifier_lookup = menuitem.find_by_name("identifier lookup") compliance = insightreportmenuitem.find_by_name("compliance") debugger validation_settings.destroy! #unless validation...

active directory - Is Microsoft AD based on an LDAP Spec? -

ldap protocol connecting , querying directory services. when microsoft created ad did design upon ldap specification? im trying understand if ad based on ldap in form compatible ldap? or can ldap integrate backend (within reason) , configuration of ldap contains logic in how ldap connects backend directory service db/data store, ldap can used query data stored within it? i can never seem find definitive answer question when read ad/ldap based articles online. yes, if want query adsi using ldap port (in backend program) can without problem . also if want view in ldap type context can download , install "softerra ldap browser 4.5 " on windows system uses adsi , display ldap "cn=users,dc=demo,dc=com" etc if need sample code, create question specification users happy you. more ever connecting ldap doesn't require external libraries if using java. while connecting adsi may require com components

java - Accessing private members for unit testing -

usually when i'm writing unit test in c++, declare test class friend tesee. way can inspect results of operation directly inspecting member variables. java not have friends, how achieve same behavior? i'm not talking simple getters , setters here testing trivial, situations results of operation stored internally in class , it's not exposed outside world. if don't want use frameworks can java reflections accessing value of private field using reflection in java person privateryan = new person("john" , "8989736353"); field privatefield = person.getdeclaredfield("phone"); //this call allows private fields accessed via reflection privatefield.setaccessible(true); //getting value of private field using reflection string value = (string) privatefield.get(privateryan); accessing private method using reflection method privatemethod = person.getdeclaredmethod("call"); //making private method accessible using reflect...

javascript - Uncaught TypeError: Cannot set property '1' of undefined -

now wierd, calling function "sorttiles()" twice, first time, loops through, , returns beautiful array, it's supposed do. second time call it, doesn't work, , throws error stated in title specific line: tiles[y][x] = tile; . the first time around, returned array "sorttiles()" put global array called "solution". second time function called, tiles x , y coordinate solution array. what i'm doing here scans sliding puzzle, of html5 canvas , prnt_scrn+paste website. , said, first time it, take screenshot of solution, paste in, , marks out coordinates fine. second time, throws error :( function gettile(x, y) { var id = 0; (i = 0; < 2; i++) { (i2 = 0; i2 < 2; i2++) { var data = context.getimagedata(x + * 48 + 5 - (i * 10), y + i2 * 48 + 5 - (i2 * 10), 1, 1).data; id += data[0] + data[1] + data[2]; } } return id; } function findtile(number) { (y = 0; y < 5; y++) { (...

c++ - Cannot open type library file: 'msxml.dll': No such file or directory -

i'm trying reverse engineering old .net tool written c++. problem begins in line: import "msxml.dll" named_guids i understand old system dll file replaced msxml3.dll or msxml6.dll. found both msxml3.dll , msxml6.dll in system32 folder , mange import error appears: error c2653: 'msxml' : not class or namespace name please advice , spread light on issue. thank you. solution: change msxml msxml3 , change msxml msxml2

Django: Save multiple Prefetch() objects in a variable or method -

the documentation displays how save prefetch() object in variable: >>> prefetch = prefetch('choice_set', queryset=voted_choices, to_attr='voted_choices') >>> question.objects.prefetch_related(prefetch).get().voted_choices [<choice: sky>] however, prefetch_related accepts many prefetch() objects separated comma: >>> question.objects.prefetch_related(prefetch('choice_set'), prefetch('foo')).get().voted_choices how prefetch() sequence saved in variable -or better in method- in order reusable? i prefer add these prefetch related clauses in custom queryset , access created lists through model properties, if exist. usage: post.objects.filter(...).prefetch_comments()... class postqueryset(models.queryset): def prefetch_comments(self): inner_qs = comment.objects.order_by('-date') return self.prefetch_related(prefetch("comments", queryset=inner_qs, to_attr="comme...

php - Generate a date schedule that executes only on weekdays -

i have date schedule function in php aims execute on working days. code have @ moment generating schedule days of week while statement doesn't seem working , i'm not sure why. i'm student, i'm not experienced kind of thing. here code have far: public static function generate_date_schedule($tasksperdayschedule, $startdate) { $schedule = []; $date = clone $startdate; foreach ($tasksperdayschedule $numberoftasks) { $day = (int)$date->format('n'); // skip weekend days. while ($day > 5) { $date->add(new dateinterval('p1d')); $day = (int)$date->format('n'); } $schedule[$date->format(self::date_format)] = $numberoftasks; $date->add(new dateinterval('p1d')); } return $schedule; it small missing, appreciated! thanks i think simple logical error. inside while loop you're updating $day , foreach loop continues...

objective c - Making a custom NSButton that has an on/off state, but still handles IBActions -

so creating subclassed nsbutton has custom on/off state. to so, overrided -mousedown , -mouseup , , modified view accordingly. now in view controller owns button, have ibaction connected custom button. the problem when overrided nsresponder methods, ibaction never gets called unless call [super mousedown] within overrided -mousedown method. but if call [super mousedown] , custom button doesn't receive -mouseup event (and ui doesn't update off/unpressed state). i've tried few things, seems common thing people have customized, , should easier i'm making it. i thinking of creating block property on custom button called pressedaction , , when view controller instantiated, set block property on button code have had in ibaction . inside of custom button, execute block in -mouseup method but solution seems little weird because me subclassed nsbutton should able fire ibactions i have done couple of ways in past. instead of overriding -mou...

ruby on rails - Can I use HINCRBY/INCR in Redis to guarantee an integer response? -

i'm using redis-objects gem implement counters on rails models. of counters singular (so modeled counter foo backed single redis value) others have number of keys, modeled hash_key bar , backed redis hash hincrby . so far good, values returned hash strings, not ints, because redis-objects doesn't know hash counter. .to_i results, result in unpredictable behavior if key overwritten non-int value, example. can use hincrby myhash field 0 force redis interpret field value int64 , produce integer reply ( :1.. ) semantics compatible normal increment? cause lock or other undesirable behavior related using "write" op read? there better way cast read?

php - fetch the data who's is not visited since last 3 month -

this query. select customer.*, feedback.*, feedback.id fid feedback join customer on customer.feedbackid = feedback.id feedback.overall_rating != '' , `feedback.fb_date != '2015-05-07' , feedback.fb_date != '2015-08-05' my question : how fetch data of has visited @ least once before 3 months ago, , has not visited since. sorry english thanks in advance. if understand questions correctly, can use last_visit_date < - 90 days. have access last_visit_date?

android - ListView does not show changes until focus changes after notifyDataSetChanged -

i have alertdialog listview set multiple selection on it. has button on it. the button open alertdialog if ok'ed remove selected items data set of listview , , tell adapter of list view dataset has changed notifydatasetchanged() method. this works fine except 1 thing. listview not update it's content until interact something. updates correct data. this not big problem, listview appear correct @ once, , not after focus has changed. code: button remove = (button) view.findviewbyid(r.id.btn_remove_questions_edit_rack); final context con = this; remove.setonclicklistener(new onclicklistener() { @override public void onclick(view v) { builder warnbuild = new builder(con); warnbuild.setmessage(r.string.question_deletion_warning); warnbuild.setpositivebutton(r.string.ok, new dialoginterface.onclicklistener() { @override public void onclick(dialogint...

xcode - Calling method from another class doesn't execute the whole method -

in osx-application have main class , second class b. both run window each, @ same time. in class there button plays movie in avplayerview (called playerview) [the movie loaded playerview earlier!]: - (ibaction)runmovien:(id)sender { [playerview.player play]; } this works fine. movie played after clicking button. on other hand, in class b there button calls method in class a... - (ibaction)runmovie:(id)sender { viewcontroller *runmoviebutton = [[viewcontroller alloc] init]; [runmoviebutton runmovie]; } ...which run method in class a: - (void)playpause { nslog(@"a"); [playerview.player play]; } the problem is, log printed out fine, else in method ignored, no matter in there. content of bracket being ignored completely, except log. the solution easy, cannot come possibly work. in mainviewcontroller.h @interface mainviewcontroller : uiviewcontroller -(void)playmedia:(nsurl*)url; @end in mainviewcontroller.m @interface...

ios - Use a string variable in MFMailCopose Message -

this question has answer here: shortcuts in objective-c concatenate nsstrings 30 answers - (ibaction)sendbutton:(id)sender { nsstring *locationformatter = [nsstring stringwithformat:@"https://maps.google.com?saddr=current+location&daddr=%f,%f", self.locationmanager.location.coordinate.latitude, self.locationmanager.location.coordinate.longitude]; if ([mfmailcomposeviewcontroller cansendmail]){ mfmailcomposeviewcontroller *mailcomposer = [[mfmailcomposeviewcontroller alloc]init]; mailcomposer.mailcomposedelegate = self; [mailcomposer setsubject:@"google maps directions"]; [mailcomposer settorecipients:@[@"castro.michael87@gmail.com"]]; [mailcomposer setmessagebody:@"google maps url:locationformatter" ishtml:no]; // display mail composer [self presentviewcontroller:mailcomposer animated:yes co...

JQuery how to stop event propagation -

i'm looking stop event propagating every time click "done", alert shows once . here code: $('body').on('click', '#product', function () { var x = "hi"; $('#done').click(function () { alert(x); }); }); and fiddle: http://jsfiddle.net/s4sz29ew/1/ $('body').on('click', '#product', function () { var x = "hi"; $('#done').click(function (e) { alert(x); e.stoppropagation(); }); });

provisioning - Is there a way to replicate pwd in a volume mount for docker in a boot2docker context? -

so can do: docker -v .:/usr/src/app or specify in docker-compose.yml : web: volumes: - .:/usr/src/app but when attempt define in dockerfile : volume .:/usr/src/app it doesn't mount anything. now understand complexities in i'm using osx , have virtualize environment run docker via boot2docker, , boot2docker solves copy issue mounting /user linux machine running docker. the documentation wants me explicit, since explicitness require me name user (in case /user/krainboltgreene/code/krainboltgreene/blankrails ) seems non-idiomatic, doesn't work on other people's environments. what's solution this? mean, can technically working without (as noted above cli , compose works fine), means not being able project specific provisioning (bower install, npm install, vulcanize, etc). you can't specify host directory volume inside dockerfile, because of portability reasons mention (not have same directories , there security issues regarding mou...

java - Should Unix Daemon have a main -

trying write java daemon linux server running on aws, of have implemented daemon interface i'm not sure if should have main function in daemon? or should call daemon in different way? program entry point? assuming have used aws flow framework, need worker classes purpose. take @ documentation on running programs , daemon tasks .

c++ - Qt QSslSocket "The certificate is self-signed, and untrusted" -

i want connect server qsslsocket , on server soketsslerror "the certificate self-signed, , untrusted" , dont understand why have error. on first step generated file server , client openssl $openssl req -new -newkey rsa:1024 -keyout ca.key -x509 -days 500 -out ca.crt $openssl req -new -newkey rsa:1024 -keyout client01.key -out client01.csr $openssl ca -config ca.config -in client01.csr -out client01.crt -batch in c++ server / client on server: start server if (listen(qhostaddress::any,this->connectingport)) { std::cout<<"server start on port: "<<this->connectingport<<std::endl; return true; } else { std::cout<<"cant start server. "<<errorstring().tostdstring().c_str()<<std::endl; return false; } incomingconnection qfile keyfile("ca.key"); if (!keyfile.open(qiodevice::readonly)) { delete this->sslsocket; qdebug()<...

python - How can I create an HTML page that depends on form inputs? -

for starters - using combination of html, python+flask/jinja i have html page contains basic form. when users input data form, passed through python/flask script , populates different html template inputted form values. what need accomplish creating variations of final html template based on fields users choose in beginning form. e.g. the flow appear as: user selects fields use in html form > data passed through flask app > data populated in final html template, designed around fields selected in original form. the final html template series of tables. based on fields user selects in form, tables needed , others not. whether user selects field should determine whether or not table appears in final html templates code or not. i'm not entirely sure tools can use accomplish this, , whether need supplement flask/jinja. input. flask+jinja should work you're trying do. essentially, first page form number of form elements. when form submitted, data gets...

Django+Ajax: div update after post -

i'm new @ ajax , django. have ajax button adds "likes" database. besides button, template displays total number of likes. button works can't figure out how update "like-count" div because calling {{ post.likes.count }} displays old result. i'm guessing that's due caching? around declared like_count variable in view , add +=1 when liked. how make {{ like_count }} work in template? using return render(request, 'app/blog.html', {'like_count': like_count}) sends me blank page instead of updating div. view: @login_required def like(request): if request.is_ajax(): user = request.user post_id = request.post.get('post', none) content = contenttype.objects.get_for_model(post) like_count = like.objects.filter(content_type=content, object_id=post_id).count() if like.objects.filter(user=user, content_type=content, object_id=post_id).exists(): # remove lik...

javascript - Java script - adding times -

i'm trying add 2 times in format: hh:mm:ss eg: 12:31:32 , 01:32:39 i want write script adds times , result of must in same format. how tell script add first 2 digits before : (hours) , 2 between 2 semicolons (minutes) , seconds? i don't want make script want know how made. if strings var time1 = "1:23:25" need convert else work it. you can manually, splitting string array , adding numbers , handling overflow (>60 seconds increase minutes etc) , joining hours, minutes , seconds create new string. you can convert each date can add numbers eg: time3=time1+time2 can format result original format.

javascript - Closure Compiler: @enum, property collapsing and JSC_UNSAFE_NAMESPACE -

initial situation i have following code: var ns = {}; // namespace ns.myenum = { foo: 1, bar: 2 }; var extendedns = object.create(ns); extendedns.myalert = function (x) { alert(x); }; extendedns.myalert(extendedns.myenum.foo); it compiles command (no warnings or errors): java -jar compiler-20150609.jar --js test.js --compilation_level advanced --warning_level verbose question 1 according docs jsc_unsafe_namespace , think advanced optimisations may replace ns.myenum ns$myenum , , remove ns . so why compiler not raise warning line? var extendedns = object.create(ns); isn't unsafe reference namespace ns ? shouldn't compiler warn: "incomplete alias created namespace ns " ? @enum type breaks compiled output i mark ns.myenum enum: /** * @enum {number} */ ns.myenum = { foo: 1, bar: 2 }; according this old answer , "the compiler expects collapse enum value single variables" . think compiler may collapse ns.myen...

initialization - Why would you use `init!` instead of `init?` when implementing a Failable Initializer in Swift? -

the swift documentation initialization: failable initializers details how use init? create failable initializer, initializer returns optional of type initializes. optionals, nil or non- nil . the docs mention can use init! create failable initializer, returns implicitly unwrapped optional of type initializes (see the init! failable initializer section). unwraps optional , indicates "should" non- nil . if nil , accessed without checking, programmer may skip since marked "should non- nil ", runtime error generated. two questions: when/why use init! instead of init? when implementing failable initializer? since init! returns implicitly unwrapped optional "should" non- nil , why wouldn't use init instead of init! ? in vast majority of cases should use init rather init! . there few cases init! necessary. common in experience when "must succeed" initializer wants call failable initializer. consider case: struct...

matplotlib - Set the height and width of a mpld3 plot -

i want set width , height of mpld3 plot specific value (in pixels, fits div in). way tried looks (javascript): commands["width"]=plotwidth; commands["height"]=plotheight; mpld3.draw_figure("plotname",commands); plotwidth , plotheight values want height , width set to. now, sets size of mpld3-figure object values want, plot inside still keeps old size, looks nothing happened. so, how change size of plot itself? far looks whatever do, plot not change. you can change shape of mpld3 plot when creating figure python code plt.figure(figsize=(width,height)) (where width , height in inches). here notebook demonstrating this . there has been some interest in making mpld3 figures "responsive" , cooler , more precise way accomplish goal, far no 1 has tried making necessary code changes. patches welcome!

c# - Type of Object Template -

inherits="cms.core.objecttemplate<app.core.member> i little stuck telling me inheriting coming object template, not sure 'type' of object template. question given me in quiz , wanted ask type ? if referring object of type cms.core.objecttemplate it's type should cms.core.objecttemplate'1. generic type.

mysql - stored procedure to find the day from IN parameter date -

please me find passing in parameter give day monday or else weekday. give working code stored procedure. like example- call check_date(1982-01-10); gives -weekday. create procedure p2(dt datetime ) begin select dayname(dt); end run procedure below command : call p2('2015-08-05') result : wednesday you have pass '1982-01-10' p2 function below : call p2('1982-01-10'); it gives output -weekday.

mongodb - Disadvantage of Mongo rs.slaveOk() for master instances -

i using robomongo tool connect various mongo instances. 1 blocker faced robomongo not allow setting readpreference particular connection. however, saw can specify robomongo load .mongorc.js file @ start up. added line rs.slaveok() , can connect slave instances well. means readpreference set secondary when connecting master instances. know if there disadvantages of keeping on connections. sure there reason behind robomongo developers not allowing default setting (although setting connection preference each connection have been best solution) it because of stale read issue mentioned here - [ http://docs.mongodb.org/manual/core/read-preference/#edge-cases-2-primaries] it requires awareness of replication strategy , 'staleness' of data. link above great read regardless. edit: answer lacked brief summary mongodb docs linked above ( mentioned user 200-ok) "exercise care when specifying read preferences: modes other prim...

Bootstrap - Open modal while another modal is open and keep 'modal-open' class in body -

i want open new bootstrap modal when click button inside open modal. works fine, problem 'modal-open' class of body tag disappears, , scroll entire page appears. when click button in modal, in code-behind this: scriptmanager.registerstartupscript(upmain, typeof(updatepanel), "tipo descuento seleccionado", "$('#dtosmodal').modal('show'); $('#tipodtomodal').modal('hide');", true); what can keep class in body tag? thank much! edit: if change $(document) .on('show.bs.modal', '.modal', function () { $(document.body).addclass('modal-open') }) .on('hidden.bs.modal', '.modal', function () { $(document.body).removeclass('modal-open') }) in bootstrap.js for $(document) .on('show.bs.modal', '.modal', function () { document.body.classname += ' modal-open'; }) .on('hidden.bs.modal', '.modal', function () { document.b...

ios - Firebase crashes with 'listen() called twice for the same query' error -

i trying follow advice , remove listener when needed , register listener when needed. in uiviewcontroller.viewdidappear have following: let chatref = messagesref.childbyappendingpath(chat.objectid!) var query = chatref.queryorderedbychild("createdat") if let since = since { query = query.querystartingatvalue(since.timeintervalsince1970 * 1000) } let handle = query.observeeventtype(feventtype.childadded, withblock: completion, withcancelblock: { (error: nserror!) -> void in println("error listening new chat messages: \(error)") }); in uiviewcontroller.viewwilldisappear() have let chatref = messagesref.childbyappendingpath(chat.objectid!) if chatref != nil { chatref.removeallobservers() } but program crashes every time viewcontroller entered second time (going view controller, navigate away, come back) following error: *** assertion failure in -[fpersistentconnection listen:tagid:hashfn:oncomplete:], /users/mtse/dev/firebase/firebase-clien...

r - Why does geocode keep returning the wrong address but Google Maps works correctly -

Image
i'm in new orleans area. when open google maps in new orleans area , search "council on alcohol & drug", correct location coordinates (longitude = -90.09, latitude = 29.96). yet, when use geocode method ggmap, keep getting other coordinates not in new orleans. i've tried number of tricks work still haven't found solution. library(ggmap) geocode(location="council on alcohol & drug") # na na geocode(location="council on alcohol & drug new orleans") # na na geocode(location="council on alcohol & drug&components=administrative_area:louisiana") # -91.96 30.98 geocode(location="council on alcohol & drug&components=administrative_area:new orleans") # na na geocode(location="council on alcohol & drug&region=new orleans") # na na geocode seems squirrely me in general. advice on getting behave? converting "&" "and" corrected problem. (solv...

c++ - Segment depth image with low contrast -

Image
i trying segment hand depth image: i tried watershed, region growing, grabcut, of them failed because there not clear edge. tried sharp image well, didn't give me results either. this might not answer hoping for, might step forward bit. since provide algorithmic hints use matlab rather opencv. since not ordinary intensity image, rather depth image, should use implied geometry of scene. key assumption can here hand resting on surface . if can estimate surface equation, can detect hand easier. [y x] = ndgrid( linspace(-1,1,size(img,1)), linspace(-1,1,size(img,2)) ); x = [reshape(x(101:140,141:180),[],1), reshape(y(101:140,141:180),[],1), ones(1600,1)]; srf=(x\reshape(img(101:140,141:180),[],1)); %// solving least-squares 40x40 central patch aimg = img - x*srf(1) - y*srf(2) - srf(3); %// subtracting recovered surface using median filter "clean" bit, , applying simple thereshold medfilt2(aimg,[3 3]) < -1.5 yields not hoping for, think it...

fnr.exe regex capture groups output -

i'm using batch script fnr.exe perform bulk search , replace operations on multiple files, i'm having trouble figuring out how use capture groups in fnr.exe. can use them fine in similar utility called far uses java regex's, far can't run command line, i'm unable automate it. fnr.exe says in it's documentation uses .net regular expressions, , documentation .net regular expressions great when comes how capture group, when comes outputting captured group, it's rather lacking , assumes i'm writing c# or vb code can call things like: console.writeline("match: {0}", match.value) i have bunch of strings following, original string on left , desired replacement string on right: include "fooprintdriver.h"; | include "barprintdriver.h"; include "foosearchagent.h"; | include "barsearchagent.h"; include "fooeventlistener.h"; | include "bareventlistener.h"; in far, f...

for loop - Why won't the printing message print in my C# code? -

i trying print out message "printing..." txtmessage.text text box before loop runs never print text box before loop runs. idea why? else { txtmessage.text = "printing..."; (int = numbercopies; != 0; i--) { int paper = convert.toint32(lblpaperamount.text); paper--; if (paper == 480 || paper == 380 || paper == 400 || paper == 200) { messagebox.show("there paper jam! please remove jam , hit ok button continue!", "important message", messageboxbuttons.ok, messageboxicon.exclamation); } lblpaperamount.text = convert.tostring(convert.toint32(lblpaperamount.text) - 1); lbltoneramount.text = convert.tostring(convert.toint32(lbltoneramount.text) - 1); thread.sleep(1000); } t...

Jwt with web services in java -

i want integrate jwt token in spring service layer.i passing json object should contain token , want authentication that. how . in advance i have found out solution . instead of using spring-security-jwt usecom.nimbusdsnimbus-jose-jwt3.9and able token authentication now.

java - Why do I see multiple running instances of the same service (Elasticsearch) on Ubuntu, but only one is responsive? -

Image
i running elasticsearch (es) on small aws ubuntu box, , working on tuning performance of box overall. after recent deploy using saltstack, noticed number of running instances went 2 3 -- after being @ 2 several months. uptick in instances seems correspond uptick in memory usage. i confirmed ps there 3 java processes running on box: pid tty time cmd 9295 ? 00:02:08 java 14398 ? 00:00:12 java 26175 ? 00:40:48 java when stop es command "sudo service elasticsearch stop", still left 2 es processes running according ps: pid tty time cmd 9295 ? 00:02:08 java 26175 ? 00:40:48 java i restarted service , had 3 again. seems strange 2 me because seemed 2 of services unresponsive stop command. (could so-called zombie or orphan process?) i manually killed 3 processes , restarted es, , have single es instance. wondered if these wayward java processes related other service, after killing three, new relic confirmed large...

java - Eclipselink Modelgen processor and Spring Security -

i trying use spring security in project use eclipselink modelgen processor generate static meta model. when try strange compilation errors like: > java.lang.runtimeexception: com.sun.tools.javac.code.symbol$completionfailure: class file org.springframework.security.ldap.defaultspringsecuritycontextsource not found even though not use ldap. if add jars other errors missing sl4j, missing openid, etc etc. if exchange used modelgen processor hibernate implementation compiles without problems. i found minimal project reproduce problem: myenity.java @entity public class myentity { private string name; private long id; public string getname() { return name; } public void setname(string name) { this.name = name; } public long getid() { return id; } public void setid(long id) { this.id = id; } } securityconfig.java public class securityconfig extends websecurityconfigureradapter { } build.grad...

python - List doesn't load in django templates -

so i'm trying filter model in way in views.py: news_list = list(models.entry.objects.filter(category='news')) and problem list cant accessable django templates. way i'm trying access in home.html: {% news in news_list %} {{ news.title }} {% endfor %} and this: {{ news_list.0.title }} i'm sure way created list right beauce when loop through list in views.py show in terminal. i'm using python3.3 , django 1.8.3 views.py : #!/usr/bin/env python # -*- coding: utf-8 -*- django.views import generic . import models blog.models import entry class blogindex(generic.listview): queryset = models.entry.objects.published() template_name = "home.html" paginate_by = 3 news_list = entry.objects.filter(category='news') = 0 x in news_list: = i+1 print(x.title,i) you trying access news_list in template when infact not present in template. you need pass news_list in context data. overri...

c++ - Unhandled exception at 0x5401FA96 (sfml-system-d-2.dll) -

i trying make simple program sfml. source code same provided in example given downloaded sfml site using precompiled version visual studio 12. i configured project normally, , added correct libraries debug , release. note: there no compiler errors, , not linker errors well. added .dll libraries in .exe directory. when run program, here output (just crashes): exception thrown @ 0x50fafa96 (sfml-system-d-2.dll) in testsfml.exe: 0xc0000005: access violation reading location 0xccccccd8. if there handler exception, program may safely continued. from looked on internet, error seems related mixing debug , release libraries, think did right. note using visual studio community 2015 , don't think cause problem. the configuration inside project release , debug (all configurations) : added same directory include path (release , debug) , library path (release , debug). release on linker -> input added: sfml-window.lib sfml-system.lib debug on linker->...

authentication - CAS SSO automatically log in -

i want automaticalle login in services when user logged in cas. @ moment must click login button in every service manually login. goal when i'am logged in cas , join example jenkins service user logged in automatically without clicking log in button. can me? if you're using spring security or similar manage it, can automatically you. since seems making single page application(as you've said you're needing loggin button), , going assuption, you'd need have login anyways. except of course if you've set script check if there's valid cookie already. more details appreciated(sorry, can't comment)

intellij idea - Run git command without sudo doesn't work on applications -

i have problem git... application(intellij, smartgit, sts) when run git command without sudo doesn't work... can't push or pull branches. intellij vcs run git commands without sudo , can't integrate repository. intellij command line: [jnieto@localhost apiconsola]$ git push origin api#test fatal: repository 'http://jonatan@localhost:17990/scm/cnt/apiconsola.git/' not found [jnieto@localhost apiconsola]$ sudo git push origin api#test [sudo] password jnieto: password 'http://jonatan@localhost:17990': up-to-date thanks all, jonatan.

javascript - Changing PHP Session variables on click event -

please me on problem. small causing me lot of trouble.i have set session variable in index.php , when clicked on anchor tag , not changing session variable. relevant php part: session_start(); $_session["amount"] = "99"; now html part (in same php file). <a onclick="change('<?php echo $_session['amount']='399'; ?>')" href="#"><h4>order 399</h4></a> <a onclick="change('<?php echo $_session['amount']='200'; ?>')" href="#"><h4>order 200</h4></a> i checking value of session variable in div in same file. <td>amount: <?php echo $_session["amount"] ?> </td> the value shown 200 though clicked on "order 399". how change session variable?am mixing client side , server side? please me , suggest shortest possible way it. actually mixing up! it done this: you need ...

jbossfuse - Disaster recovery (multi data center deployments) in JBoss Fuse ESB 6.2 -

we migrating old fuse source esb jboss fuse esb 6.2 version, better deployment strategies using newer version of jboss fuse esb 6.2 disaster recovery (multi data center deployments) & in same data center - master/slave (primary/secondary) nodes automatic fail on options.how achieve in newer version? based on requirements, believe fuse fabric work well. can read more here https://access.redhat.com/documentation/en-us/red_hat_jboss_fuse/6.0/html/getting_started/files/deploy-scalable.html

javascript - Results displaying one at a time with a delay -

i have following code shuffles selection have in database. rather having results display @ one, want display result 1 @ time delay between results. ie: if have 10 items in database, want 1 item display, 3 second delay, second item display, 3 second result, way until last item (#10). possibly sort of animation it, flying screen or of item coming bag or something. (think picking numbered order 10 out of bag). i have been told setinterval() approach, have no idea how make work code or if right approach. how this? here how shuffle db results. <form method="post"> <?php foreach ($array $result) { $shuffle_firstname = htmlentities($result['firstname']); $shuffle_lastname = htmlentities($result['lastname']); $shuffle_id = htmlentities($result['id']); $shuffle_username = htmlentities($result['username']); $shuffle_email = htmlentities($result['email']); ?> ...

ms access - SQL Join operation error -

i trying write sql code in ms access 2010 follows:- select wowperformancedata_tbl.style, wowperformancedata_tbl.fy, wowperformancedata_tbl.month, printpromotions.[type of offer], printpromotions.start, printpromotions.end wowperformancedata_tbl right join printpromtions on wowperformancedata_tbl.style=printpromotions.style (wowperformancedata_tbl.style=[enter style nr:]); upon running code, access returns error in join operation pointing fourth line , selects printpromotions any feedback appreciated.. thank you. this fine clause evaluation on entire set. select wowperformancedata_tbl.style, wowperformancedata_tbl.fy, wowperformancedata_tbl.month, printpromotions.[type of offer], printpromotions.start, printpromotions.end wowperformancedata_tbl left join printpromtions on wowperformancedata_tbl.style=printpromotions.style (wowperformancedata_tbl.style=[enter style nr:]); this exclude records printpromotions not in wowperformancedata_tbl, negates right join.: ...

pivot table - Expression to create SSRS column dynamically -

i need expression take existing column , recreate column on , on before column/s column name contains either "monday" or date of column falls on monday. the reason need expression repeat header column in pivoted report pivoting start/enddate parameter. if user selects run report month, should 31 columns (for each date/day) , header repeating before every monday. make sure dataset contains dates in date range. if not create date table , cross join it. don't pivot results, let ssrs bit. once dataset has dates, can use matrix in report , drop date colum column group. give 1 column each date in dataset. i'm not @ pc @ moment if need more help, show example of dataset , i'll put quick sample report.

embed feed from yammer using access token -

how embed feed yammer using access token skipping yammer login? have access token yammer login. need yammer feed using access token. <div id="embedded-feed" style="height:800px;width:400px;"></div> <script type="text/javascript" src="https://assets.yammer.com/assets/platform_embed.js"></script> <script type="text/javascript"> yam.connect.embedfeed({ container: "#embedded-feed", network: "{rede}", feedtype: "{type}", feedid: "{id}" }); </script>

Powershell - Improve ForEach with jobs -

i have powershell script (i'm running psversion 4.0) cycles through files in particular directory , series of replaces on file's contents. script below: #set path cycle through $pathtofiles = "e:\zac's docs\files\*" # work if path exists if(test-path -path $pathtofiles) { #do replacements get-childitem -path "$pathtofiles" -include "*.csv" -exclude "cleaned - *.csv" | ` foreach-object{ # first replace changes double quotes part of text escaped double quote (i.e. "") # second replace changes single quotes (which assumed text qualifiers) custom text qualifer (i.e. |~|) # third replace changes escaped double quotes (i.e. "") single double quote (i.e. ") encode in utf8. gc $_.fullname -encoding utf8 | % {$_ -replace "`"(.*?)`"(?!`,)", "`"`"`$1`"`"" ` -replace "(?<!`")`"{1}(...

php - Yii2 restrict access by usernames -

i use yii2 login-logout , has funky database no roles. possible restrict users on database accessing website? can show me how? one of easy way, can use expression allow key following in controller class. public function behaviors() { return [ 'access' => [ 'class' => accesscontrol::classname(), // 'only' => ['logout', 'signup', 'dashboard'], 'rules' => [ [ 'actions' => ['dashboard', 'send-mail'], 'allow' => utils::isadmin(), ], ] ]; } learn more in article: https://github.com/yiisoft/yii2/blob/master/docs/guide/security-authorization.md

amazon web services - Kubernetes, Eucalyptus and A.W.S -

i did not find topic talking eucalyptus , kubernetes. , find quite weird because eucalyptus allow create hybrid cloud private cloud a.w.s. compatible s3, ebs , ec2. and, thinking eucalytpus , kubernetes, can create awesome hybrid cloud. does experiments kubernetes eucalyptus? if yes, how did setup it? and, how works private , public cloud (working or independent)? eucalyptus not yet officially support aws ecs service, there has been work done on area recently. have install eucalyptus source using custom git branch. the link below explains how aws ecs service on eucalyptus, http://jeevanullas.in/blog/aws-ec2-container-service-api-in-eucalyptus/

java - SerialSocketEvent not firing -

i have copied code: http://playground.arduino.cc/interfacing/java java project, , tried this: void setup(){ serial.begin(9600); while(!serial); } void loop(){ serial.println("test"); } on arduino uno, great results, when tried on esplora, program did not fire event listener java project. an esplora , leonardo (both use atmega32u4) require wait until cdc serial ready. uno has dedicated atmega8/16u2 controlling serial/usb comms. in code, after serial.begin() call, add loop wait until ready: serial.begin(9600); while (!serial) { ; // wait serial port connect. } cheers

objective c - why the label never replace the previous value to new value? -

Image
the label in tableview: uilabel *label1; label1=[[uilabel alloc]initwithframe:cgrectmake(500,75, 50, 50)]; label1.text=[arr_count objectatindex:indexpath.row]; [label1 settranslatesautoresizingmaskintoconstraints:no]; label1.tag=100; [cell addsubview:label1]; increment occurs here using button action - int tagvalue=[[arrcount objectatindex:click.tag] intvalue]; if(tagvalue <=5) { tagvalue++; nsnumber *num=[nsnumber numberwithint:click.tag]; [arrcount replaceobjectatindex:click.tag withobject:num]; nslog(@"increment %@",arrcount); } nsindexpath *ind=[nsindexpath indexpathwithindex:click.tag]; label2.text = arrcount[click.tag]; [self.mtableview.tableview reloadinputviews]; } increment values , stored array.the array values given label.i mentioned problem image. enter image description here [ ] 1 i've refactored bit code, , seems work: nsmutab...

html - Having trouble with layout.jade and linking to top-menu.jade -

i using express latest project. i've never used jade before, i'm trying understand why i'm having issue or if i'm going wrong way. here what's in layout.jade: doctype html html head title outpost meta(charset='utf-8') meta(name='viewport', content='width=device-width, initial-scale=1.0') link(href='stylesheets/style.css', rel='stylesheet') link(href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css", rel="stylesheet") link(href='https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css', rel='stylesheet') body block top-menu i have file called top-menu.jade following: extends layout block top-menu <!-- menu code --> unfortunately, nothing shows if replace in commented section <p>hello</p> please let me know.

How to check if a particular node is present in XML in Ruby -

i want check if node present under specific node, can present in level. (it can deeper). for xml: <main> <sub> <inner> <first></first> <second></second> </inner> </sub> </main> how check see whether sub node has inner node first or not, using nokogiri without using xpath '/sub/inner' directly? your xpath isn't correct unless know sub node @ top level. think of xpath selectors paths in os. /sub @ root of drive. i'd recommend using css selectors clarity: require 'nokogiri' doc = nokogiri::html(<<eot) <main> <sub> <inner> <first>first_text</first> <second></second> </inner> </sub> </main> eot doc.at('sub first').text # => "first_text" 'sub first' means first has exist somewhere under 'sub' . this might help: require ...

Using the same bunch of attributes in many classes in C# -

i trying use same bunch of attributes in many classes. how can achieve in c#? if unclear trying achieve, please have @ example: public class { public string property1 { get; set; } public string property2 { get; set; } public string property3 { get; set; } [attribute1] [attribute2] [attribute3] public string foo { get; set; } } public class b { public string property4 { get; set; } public string property5 { get; set; } public string property6 { get; set; } [attribute1] [attribute2] [attribute3] public string foo { get; set; } } basically foo has same bunch of attributes each time, copy-paste not option, since error-prone. in particular example work inherit a , b class: public class c { [attribute1] [attribute2] [attribute3] public string foo { get; set; } } but having more properties foo , cannot achieved, since c# not allow multi-inheritance. you might consider making c interface ,...

Setup Maven to use our dedicated server -

we maintain our own repository server totally cut-off internet because of our company policies. to achieve this, install maven in our system , executed following command force maven download dependencies offline purpose: mvn dependency:go-offline upon completion, move downloaded dependencies our tomcat server , update maven's settings.xml mirror url served tomcat (where dependencies stored). not using 3rd party repository manager now. <mirror> <id>projectscentralrepository</id> <mirrorof>*</mirrorof> <name>central repository</name> <url>http://localhost:8080/repos</url> </mirror> problem occurs when remove dependencies in our .m2\repository , try run "mvn package" package simple project not have dependencies (refers our pom.xml). many of dependencies downloaded our server not understand why following error occurs. weren't dependencies downloaded when execute mvn dependency:go-offline ? ...