Posts

Showing posts from April, 2010

android - Gradle Dependency using Make -

Image
i decided give gradle shot in latest project featuring graphics create using gimp. i use git project , refuse commit exportet .png -graphics in repository. instead want save gimps .xcf files in order able edit graphics later on. however android application need them .png files , there whole lot of them , trying automate build-process want gradle build .png -graphics .xcf files when executing gradle build . there plugin featuring imagemagick gradle not work produces images transparency-issues. example: this image created gradle: and how should (exportet gimp): there no hidden layers , not have opacity. build.gradle: buildscript { repositories { mavencentral() } dependencies { classpath 'com.eowise:gradle-imagemagick:0.4.0' } } task build(type: com.eowise.imagemagick.tasks.magick) { convert 'xcf/', { include '*.xcf' } 'png/' actions { -alpha('on') -background('none') inpu...

PHP->Python JSON issue -

what doing wrong? python3: >>> import json >>> s = "\"{'key': 'value'}\"" >>> obj = json.loads(s) >>> obj['key'] traceback (most recent call last): file "<stdin>", line 1, in <module> typeerror: string indices must integers given json string produced json_encode() php real string: {sessionid:5,file:\/home\/lol\/folder\/folder\/file.ttt} . update : problem because transfer json string command line shell_exec in php, , read using sys.argv[1] ... quotes removed shell. php code (which runs python script shell_exec ) $arg = json_encode(['sessionid' => $session->getid(), 'file' => $filename]); shell_exec('python3 script.py ' . $arg); python code: import json, sys s = json.loads(sys.argv[1]) #fails look @ json: "\"{'key': 'value'}\"" you have string containing escaped quote, followe...

javascript - Dynamic selector in .on() method -

i have form represents quiz creating page want dynamically add questions , answers question. want respond on click event on newly created buttons. problem onclick event executed on first button exists beginning. here sample of code. have form id myform , div id questioni encapsulates stuff regarding i -th question (also button class new_answer adding answers particular question), variable curr_q (current question creating). $(function () { $("#myform").on('click', "#question" + curr_q + " .new_answer", function () { alert("#question" + curr_q + " .new_answer"); }); }); here fiddle - http://jsfiddle.net/sruzic/8yt9jcqh/ (it little bit overwhelming problem when click on existing create question newly created create answer button not responing while 'old' create answer alerts selector question1 .new_answer newly created create answer button?! thanks in advance. update code...

Change Number Formatting on X-Axis Matplotlib -

Image
i'm sure easy answer, not find anywhere. want x-axis read values 2000, 2001, 2002, 2003, 2004, not 2 x e**3. import numpy np import matplotlib.pyplot plt x = [2000, 2001, 2002, 2003, 2004] y = [2000, 2001, 2002, 2003, 2004] plt.xticks(np.arange(min(x), max(x)+1, 1.0)) plt.plot(x,y) plt.show() the code returns graph represents values this. how change it? @ avinash pandey can use plt.xticks(np.arange(min(x), max(x)+1, 1.0), x) try in code space there labels needed... more follow link

python - Loss of strings when creates a Numpy Array from a Pandas Dataframe -

i sorry if basic... essentially, using pandas load huge csv file , convert numpy array post processing. appreciate help! the issue of strings missing during transformation (from pandas dataframe numpy array ). example, strings in column "abstract" complete see below print datafile["abstract"][0] . however, once converted them numpy array , few strings left. see below print df_all[0,3] import pandas pd import csv import numpy np datafile = pd.read_csv(path, header=0) df_all = pd.np.array(datafile, dtype='string') header_t = list(datafile.columns.values) strings complete in pandas dataframe` print datafile["abstract"][0] in order test held assumption homeopathic medicines contain negligible quantities of major ingredients, 6 such medicines labeled in latin containing arsenic purchased on counter , mail order , arsenic contents measured. values determined similar expected label information in 2 of 6 , markedly @ variance in remaining...

javascript - Apply complicated li to descending order with jQuery -

in demo below, orders li's according text. http://codepen.io/anon/pen/byerqd <abbr id="arti173" class="butarti">8</abbr> i want order li's according text in abbr. i appreciate help. i've been working on lately , stuck. html <body> <input type="button" id="test" value="sort list (click again reverse)" /> <ul id="list"> <li>peter<div class="yordivu"> <div> <img> </div> <div> <button id="likefuncid173" class="likebutx mybutton" onclick="likefunc(173,1,'abbr#arti173')"><abbr id="arti173" class="butarti">6</abbr><span class="fa fa-thumbs-up"></span></button><button id="unlikefuncid173" class="mybutton" onclick="unlikefunc...

Yii2 - Render form inside footer (main.php) -

in main.php layout file, of yii2, need render form located in folder contacto/_form. how can pass $model variable file main.php, inside layouts folder, , use in: <?= $this->render('_form', [ 'model' => $model, ]) ?> many thanks. you can create widget that: class formwidget extends widget { /** * @return string */ public function run() { $model = ...;// code create model return $this->render('_form', [ 'model' => $model ]); } } and in layout input widget that: <?= formwidget::widget() ?> for more read create widgets - http://www.yiiframework.com/doc-2.0/guide-structure-widgets.html#creating-widgets

javascript - Angular + bootstrap-ui, check if current tab is already active -

i hooking function onto tab click call data server. have firing when click specific tab, rid of instance of being on tab , clicking - , call server firing again (not needed). using angular + angular-bootstrap-ui. so tried hook function on tab check if if active seems once ng-click on fired, has been set active. no matter when click it return active. need kind of way check if on tab. here's tried <tabset> {{tabs.active}} <tab heading="tree" > </tab> <tab heading="xml" active="tabs.active" ng-click="checktab(tabs.active)"> </tab> </tabset> and in controller $scope.checktab = function(check){ console.log(check); } and so, no matter what, return true because seems .active set true before click fires. there way around this? thanks! update : fiddle - https://jsfiddle.net/7ognp2nj/2/ i suggest using select instead of ng-click . this: <tab h...

c# - Eternal loading time with Update statement in ASP.NET -

i have code: <asp:sqldatasource id="updatefullnamesql" runat="server" connectionstring="<%$ connectionstrings:userqueries %>" providername="<%$ connectionstrings:userqueries.providername %>" updatecommand="update users set firstname = :changefirstname, lastname = :changelastname (username = :currentusername)"> <updateparameters> <asp:controlparameter controlid="changefirstnamebox" name="changefirstname" propertyname="text" type="empty" /> <asp:controlparameter controlid="changelastnamebox" name="changelastname" propertyname="text" type="empty" /> <asp:controlparameter controlid="usernamebox" name="currentusername" propertyname="text" type="empty" /> </updateparameters> </asp:sqldatasource> afte...

xcode - Swift: share mp3 file via whatsapp -

i try share audio file app via whatsapp, xcode shows error: var controller = uidocumentinteractioncontroller() if uiapplication.sharedapplication().canopenurl(nsurl(string:"whatsapp://app")!) { var savepath = nsbundle.mainbundle().pathforresource("test", oftype:"mp3") controller = uidocumentinteractioncontroller(url:nsurl(fileurlwithpath:savepath!)!) controller.uti = "net.whatsapp.audio" controller.delegate = self controller.presentopeninmenufromrect(cgrectzero, inview: self.view, animated: true) } else { println("error") } *** terminating app due uncaught exception 'nsinvalidargumentexception', reason: '-[__nscftimer _opendocumentwithapplication:]: unrecognized selector sent instance 0x17417c980'

asp.net mvc 4 - How can I use a Knockout viewmodel inside a server loop? -

i want use html helpers , knockout create seamless transition of data server client, , server again on postback. my viewmodel has few properties , array of items. need know how can iterate on array in asp.net razor while assigning knockout bindings individual elements in array. here's have far: @for (int = 0; < model.fields.count; i++) { <div name="customformfield" data-bind="with: fields[@i]"> <div class="form-group"> @html.labelfor(m => m.fields[i].sqldatatype) @html.listboxfor(m => m.fields[i].sqldatatype, new selectlist(selectdatatypeoptions), new { @class = "form-control", data_bind = "value: sqldatatype" }) </div> </div> } my ko javascript: <script> function viewmodel() { this.addfield = function() { alert("wut"); } } $(function (){ var jsonmodel = @html.raw(json....

Gigya socialize.removeConnection cannot remove last connected account -

as in documentation in removeconnection found 2 flags need: removeloginid: if social identity being removed last social identity , associated login id last login id. in case operation fails without removing anything. lastidentityhandling: determines how handle attempts remove last login identity. may either "soft" or "fail" : "soft" - indicates gigya remove stored information related connection, except mapping between user account , social user. way gigya deletes information user account remains accessible if user ever tries login again using same social identity. using 2 flags trying remove connections exists account. lastidentityhandling:soft removeloginid:true when trying remove first 1 - ok, when last - returns {"errormessage": "not supported", "errordetails": "last identity cannot removed", ... } do have ideas go? it seems request didn't fulfi...

Have Foreign Key only in Grails Application GORM but not in the Database -

my grails application using shared legacy database. there no foreign key constraints explicitly defined in table schema. there are, logical foreign key relationships present in many of tables. not allowed change db schema (as shared db, take permission dba... ...). is there way define hasmany, manytomany , other gorm constraints without changing existing database schema? you can have hasmany , belongsto without foreign keys. cascade delete , other things work, wont fk violations errors if code thing violates fk.

Sub domain issue on Azure -

i need create sub domain follows on azure, how do that? mysite/jobs i able create job.mysite.azurewebsites.net. not want. thank you. azurewebsite.net not primary domain. azure has written code create sub domain dns have no rights create again sub domain in it

error handling - Possible to Have Multiple Try/Catch Blocks Within Each Other in a SSIS Script? -

i have project i'm working on , wanted double check before going through work of coding , testing if possible. i'm attempting along lines of: try { // stuff try { // other stuff } catch { // fail silently } // more stuff } catch (...) { // process error } is possible have try/catch's within try/catch's? languages allow when attempted search web not, life of me, find answers. thanks an ssis script task c# (or vb.net). c# allows this, ergo ssis allows this. having written few ssis script tasks in time, i'd encourage take advantage of raising events in script task . depending on version + deployment model + invocation method, might want turn on native ssis logging. project deployment model (in 2012+) provides native logging. otherwise, need specify events you'd log logging provider(s) you'd use them. need done part of package development. otherwise, dtexec call /rep ewi ensure errors, warnings , information even...

libreoffice - unoconv fails to save in my specified directory -

i using unoconv convert ods spreadsheet csv file . here command: unoconv -vvv --doctype=spreadsheet --format=csv --output= ~/dropbox /mariners_site/textfiles/expenses.csv ~/dropbox/aldeburgh/expenses /expenses.ods it saves output file in same directory source file, not in specified directory. error message is: output file: /home/richard/dropbox/mariners_site/textfiles/expenses.csv unoconv: unoexception during export phase: unable store document file:///home/richard/dropbox/mariners_site /textfiles/expenses.csv (errcode 19468) i'm sure worked initially, has since stopped. i have checked permissions , identical both directories. i translated errcode 19468 , boils down meaning errcode_sfx_documentreadonly . you can find more information specific meaning of libreoffice errcode numbers unoconv documentation at: https://github.com/dagwieers/unoconv/blob/master/doc/errcode.adoc the clue here have whitespace-character between --output= , filename (--outpu...

Lua need to read the file, which I just wrote in same program -

need write file, open reading , write lines file - in 1 script. problem is, i: open file1 in read mode (file1=io.open("my_file.txt","r")) open file2 in write mode (file2=io.open("my_changed_file.txt","w")) write changed content file1 file2 open file2 (tried open file3=io.open("my_changed_file.txt","r")) in read mode , print lines example i tried several ways, file2:flush(), or file2:close() , re-open after finished writing, returns nil when want print lines file1=io.open("my_file.txt","r") file2=io.open("my_changed_file.txt","w") line in file1:lines() file2:write(line.."changes") end file2:flush() file3=io.open("my_changed_file.txt","r") --write several lines file or --(need combine changed lanes file2 , original lines file1 based on key) i've tried script minor changes in lua 5.1, 5.2, , 5.3 , works expected in versions. sc...

WinRT API WIndows::System::Launcher::LaunchFileAsync() usage from C++ -

i'm trying launch image using winrt api windows::system::launcher::launchfileasync() . code snippet follows: roinitialize(ro_init_multithreaded); string^ imagepath = ref new string(l"c:\\users\\goodman\\pictures\\wood.png"); auto file = storage::storagefile::getfilefrompathasync(imagepath); windows::system::launcher::launchfileasync(file); i'm getting error launchfileasync() api: error c2665: 'windows::system::launcher::launchfileasync' : none of 2 overloads convert argument types can please how solve this. i'm new winrt c++ coding . the method getfilefrompathasync not return storagefile , returns iasyncoperation<storagefile>^ . have convert latter former, follows: using namespace concurrency; string^ imagepath = ref new string(l"c:\\users\\goodman\\pictures\\wood.png"); auto task = create_task(windows::storage::storagefile::getfilefrompathasync(imagepath)); task.then([this](windows::sto...

How do I set non-fixed dimensions on an angular ui grid? -

i found how turn off scrolling doesn't make rows show flat table of data. $scope.gridoptions.enablehorizontalscrollbar = uigridconstants.scrollbars.never; $scope.gridoptions.enableverticalscrollbar = uigridconstants.scrollbars.never; is there way use ng-grid inline-block element takes size of children regardless of how tall or wide are?

How to not show Visual Studio 2013 floating doc icons in taskbar? -

i using vs 2013 express, desktop. regularly tear off doc tabs , put doc on other monitor. adds icon windows taskbar each floating doc. how stop that? wasteful of space not "combine" icons on taskbar (and never will). thanks actually windows behavior rather vs-specific behavior , can see in other applications (e.g. google chrome, error pop-ups in apps, etc.) , has simple rationale behind allow user switch between application windows. makes lot of sense otherwise you'll have mess many windows in order unhide window you'd work with. i'm unaware of way change behavior of windows , per above tend believe intentionally not possible.

javascript - How to add text from a table to a textarea input with button? -

how can text table show in textarea box when press "add" button? i don't need data go away after has been added, want "add text textarea" show in textarea box. https://jsfiddle.net/bj1sh4cq/ html <div class="table-responsive"> <table class="table table-hover"> <tr> <td><button class="btn btn-success" id="addbutton">add</a> </td> <td><span id="addtext"><strong>add text textarea.</span> </strong> </td> </tr> <tr> <td><button class="btn btn-success" id="addbutton">add</a> </td> <td><span id="addtext"><strong>add text textarea.</span> </strong> </td> </tr> ...

angularjs - Why won't $http set a default header? -

$http.post('http://localhost:7001/v1/sessions', { data: { username: $scope.user.username, password: $scope.user.password, type: 'sessions' } }) .then(function(response) { if(response.data.data.token) { $http.defaults.headers.common.authorization = response.data.data.token; $state.go('app.dashboard'); } else { $scope.autherror = response; } }, function(x) { $scope.autherror = 'server error'; }); i can confirm if condition gets called , response.data.data.token present. it goes app.dashboard state intercepted ui-router : $stateprovider.state('app', { abstract: true, url: '/app', templateurl: 'tpl/app.html', resolve: { current_user: ['$http', function($http) { return $http.get('http://localhost:7001/v1/users/4/entities'); }] } }) that call, however, not have set in header. thought $http.defaults set default value in header. doing incorrectly? ...

ios - UISearchController does not trigger delegate methods and search bar delegate methods -

so have uisearchcontroller, shows bar, can enter text not trigger delegate methods. here code: @ibaction func searchtapped(anyobject) { nslog("search...") let cancelbutton = uibarbuttonitem(image: uiimage(named: "delete_sign-50"), landscapeimagephone: nil, style: .plain, target: self, action: "canceltapped:") var searchcontroller = uisearchcontroller(searchresultscontroller: nil) searchcontroller.dimsbackgroundduringpresentation = false searchcontroller.searchbar.placeholder = "enter text search" searchcontroller.searchresultsupdater = self; searchcontroller.hidesnavigationbarduringpresentation = false searchcontroller.delegate = self searchcontroller.searchbar.delegate = self self.definespresentationcontext = true; uiview.animatewithduration(0.2, animations: { () -> void in self.navigationitem.rightbarbuttonitems = nil self.navigationitem.rightbarbuttonitems = [cancelbut...

version control - IntelliJ and Mecurial: Viewing Locally Committed Changes Before Push -

does know how view locally committed changes in intellij mecurial before pushing them? seems can commit them , push through mecurial context menu. in intellij, modified files blue, deleted (and untracked) files red, , new files green. after add them commit color coding should reset because looking @ latest commit differences. alternatively can right click on file, move git (and presumably mercurial) , click of "compare" options

c# - Maintainable Conversions -

i have class inherits base class; same, difference typeparam intellisense. want provide way convert existing parent class child class. i doing way: class { public int f1; public int f2; } class b<t> : { public static b<t> create(a a) { return new b<t> { f1 = a.f1; f2 = a.f2; }; } } my concern not maintainable solution, , cause problems if new fields or properties added forgotten in create method. avoid reflection copy object. is there better way accomplish this? the typical way provide copy constructor within each class in hierarchy. example: class { private int f1; private int f2; public a() { ... } public a(a original) { f1 = original.f1; f2 = original.f2; } } class b<t> : { public b(a original) : base(original) { } // possibly overload b(b<t> original) well? } that way copying happens in class dec...

shape - Best type of collisions for this game -

i'm litte confused, because wanted create clone of 2d game ride tank , bullets can bounce walls, have irregular shapes (i paste link example @ end of post). , i'm stuck on collision detection "weird shapes", because don't know technique best. have read "bezier curve", "bresenham algorithm", "pixel perfect collision" , few other, still feel coplicate , believe there must simpler solution, don't see it. advice me should use, if want have ball bouncing shape? here video of game, want copy: https://youtu.be/dqdixlvkfvy i'm sorry quality, phone isn't there best device recording videos :p ps game called "action 2-4 players" - can search on youtube if want video better quality. :)

DLIB C++ object detection example training really slow -

i'm using dlib's object detection example , trying train using 7 images containing 14 images of bottle. these images around 200x300 pixels, although 2 larger (the 1500x2000 pixel realm). large images contain 1 example each, , although images big, bottles match same size of bottles in smaller training images. sliding window 70x240 average size of bounding boxes drew. it has been minimizing objective function 8+ hours on windows server machine 384gb of ram running windows 8 64bit. there's no way it's supposed take long. it's still going--it's on iteration 125... the documentation mentions training face detector on provided set of faces in "on order of 10 seconds." because i'm running in ms visual studio 2012 arguments passed debugger? when ran face detector example, took solid 30-45 minutes training--a lot more 10 seconds. has has similar issues , know how fix it? thanks help! did compile in debug mode? see: http://dlib.net/fa...

python - Specify path of savefig with pylab or matplotlib -

i struggling on how find correct way specify save path (or repository) when calling function savefig in matplotlib or pylab. i tried several syntaxes, everytime python console returns : filenotfounderror: [errno 2] no such file or directory: '../mydocs/resource/frames/myimage.png' currently, have written following : pylab.savefig('../mydocs/resource/frames/myimage.png') does know how it? thanks in advance! the tilde operator , variable $home entered strings , therefore not function while saving. have provide either relative path (as did) or provide full path. eg. pylab.savefig("/home/username/desktop/myfig.png") .

AppInviteDialog not working in Android Facebook SDK 4.0 -

Image
after long research , trying fix on own, haven't found acceptable working result. following this documentation i'm trying invite friends app. elements, such share buttons working properly. the problem "invite app" dialog. after selecting friend, dialog showing red alert icon , "send" button turns "retry" button. i have tried fix in many ways - configure app in fb dev page (like changing app category: game, travel .etc), adding new permission sharing (but haven't found, inviting required it), using gamesrequests (but app isn't game, it's android + canvas app). have returned again appinvitedialog. also, have trying use own instance of it, listeners, instead of static class. invitedialog = new appinvitedialog(this); invitedialog.registercallback(callbackmanager, new facebookcallback<result>() { @override public void onsuccess(result result) { log.i(tag, "mainactivity, invitecallback - success!...

ios - CALayer Subclass Repeating Animation -

i'm attempting create calayer subclass performs animation every x seconds. in example below i'm attempting change background 1 random color when running in playground nothing seems happen import uikit import xcplayground import quartzcore let view = uiview(frame: cgrect(x: 0.0, y: 0.0, width: 200, height: 200)) xcpshowview("view", view) class customlayer: calayer { var colors = [ uicolor.bluecolor().cgcolor, uicolor.greencolor().cgcolor, uicolor.yellowcolor().cgcolor ] override init!() { super.init() self.backgroundcolor = randomcolor() let animation = cabasicanimation(keypath: "backgroundcolor") animation.fromvalue = backgroundcolor animation.tovalue = randomcolor() animation.duration = 3.0 animation.repeatcount = float.infinity addanimation(animation, forkey: "backgroundcolor") } required init(coder adecoder: nscoder) { ...

Configurating Django, Heroku, and a static file server -

we used use following combination: django framework heroku application server , amazon s3 static file server. but need build system handles large amount of video data, data transfer more 10 tb per month. means amazon s3 no longer option because it's expensive. we opt set our own static file server, it's gonna django, heroku, , on-premiss file server. need suggestions: is our decision enough? other options? is nginx choice file server in application? are there documentations uploading large files django+heroku application nginx server? thanks. 1) yes, decision best possible 1 2) nginx best solution. cloudflare serves traffic nginx more major web apps altogether. netflix serves 33% media traffic nginx 3) s3 origin not expensive traffic costs lot. should https://coderwall.com/p/rlguog/nginx-as-proxy-for-amazon-s3-public-private-files large files upload should bypass kind of backend saved on disk asynchronous followed upload destination s separate pro...

Python: Error = Class 'Foo' has no 'bar' member? -

i receiving error: attributeerror: type object 'shop' has no attribute 'inventory' my class set: class shop(object): def __init__(self, name, inventory, margin, profit): self.name = name self.inventory = inventory self.margin = margin self.profit = profit # initial inventory including 2 of each 6 models available inventory = 12 # markup of 20% on sales margin = .2 # revenue minus cost after sale bike in bikes.values(): profit = bike.cost * margin and want print inventory: print "mike's bikes has {} bikes in stock.".format(shop.inventory) but keep getting same error. can make work with: print "mike's bikes has %d bikes in stock." % (inventory) but trying make switch .format() you never created instance of class, shop.__init__() method never run either. your class doesn't have such attribute; attribute defined shop class __init__ method itself. create instance ...

objective c - TypeError (can't cast ActionController::Parameters to integer) -

i'm trying update longitude , latitude in database based on alert id, when send id database typeerror (can't cast actioncontroller::parameters integer). noticed when submitted submitting string, yet when log parameters in xcode integer. -(void)updatecordinates{ nsstring *alertid = [defaults objectforkey:@"alertid"]; nsinteger alert_id = [alertid integervalue]; nsdictionary *userloc = [[nsuserdefaults standarduserdefaults] objectforkey:@"userlocation"]; nsstring *latitude = [userloc objectforkey:@"lat"]; nsstring *longitude = [userloc objectforkey:@"long"]; // create request. request = [nsmutableurlrequest requestwithurl:[nsurl urlwithstring:[nsstring stringwithformat:@"http://localhost:3000/api/v1/alerts/%ld/",(long)alert_id]]]; nslog(@"%@", request); // specify put request request.httpmethod = @"put"; // how set header fields...

C# - dll event handler -

i setting .dll file create new form , new button, want button something. possible create event handler in dll file? public static byte sbuton( string er, int by,int re) { form fg = new form(); fg.show(); button b1 = new button(); fg.controls.add(b1); b1.text = er; b1.location = new point(by, re); return 0; } this code creates form button in it. when try create new event handler, in form, error: "an object reference required non-static field, method or property". public static byte sbuton( string er, int by,int re) { form fg = new form(); fg.show(); button b1 = new button(); fg.controls.add(b1); b1.text = er; b1.location = new point(by, re); b1.click += new eventhandler(b1_click); } private void b1_click(object sender , eventargs e) { } code form want use dll private void button1_click(object sender, eventargs e) { if (richtextbox1.text.contains("add...

html - Why I can't see this immages using img tag in FireFox? -

i not confident html , css , have following problem. into table have this: <td style="border-bottom: 1px solid #76818a !important; width: 10px; text-align: center; padding: 0 !important;"> <div style="width: 90px;"> <img alt="su" src="img\freccia_up.gif" onclick="javascript: spostasu();"> <br> <img alt="giu" src="img\freccia_down.gif" onclick="javascript: spostagiu();"> <br> <br> <br> <img alt="nascondi" src="img\freccia_dx.gif" onclick="javascript: eliminacolonna()"> <br> <img alt="visualizza" src="img\freccia_sn.gif" onclick="javascript: aggiungicolonna()"> </div> </td> as can see show .gif immages stored img path of project. the problem using ...

java - pass HttpServletRequest in a hasPermission expression -

in spring security config i've got following settings: @override protected void configure(httpsecurity http) throws exception { http .authorizerequests() .antmatchers("/login.htm", "/signup.htm").permitall() .antmatchers("/page1.htm", "/page2.htm", "/page3.htm").access("@permission.haspermission(principal.username)) .... } the @permission contains method haspermission @component bean decides whether principal username has access pages. in bean use dao methods determine this. however, need more knowledge make decision because it's not single page. instance, there way know page user has requested , pass in haspermission method? in other words, want like: .antmatchers("/page1.htm", "/page2.htm", "/page3.htm").access("@permission.haspermission(principal.username, httpservletrequest http)) see 2nd parameter of meth...

Jquery checkbox does'n work (checked and unchecked) -

it's doesn't work ( why? can explain, please function checkbox() { if($('.checkbox').prop('checked', true)) { $('body').css('background','yellow'); } else if ($('.checkbox').prop('checked', false)) $('body').css('background','blue'); } fiddle: https://jsfiddle.net/7rpel2gu/4/ thats answer html: <input class="checkbox" type="checkbox" /> js: $(document).ready(function(){ $('.checkbox').on('click', function(){ checkbox( $(this) ); }); }); function checkbox($this){ if( $this.prop('checked') ){ $('body').css('background-color','yellow');} else{ $('body').css('background-color','blue'); } } p.s. code not work, because $(input).prop('checked', true) - set input checked , $(input).prop(...

java - Config SLF4J in jar file -

i have own jar file used library main application. need set slf4j logger , configure in jar. write logs file set other configurations in property file when googled, there samples web apps. 1 let me know how above functionalities or mention useful resource. for library, should include slf4j-api.jar . means in code, should use classes within slf4j's api, i.e. loggerfactory , logger . your library should not define else regarding logging. it's responsibility of application uses library define underlying logging implementation (logback, log4j, jcl, etc) , include necessary bindings , underlying logging platform's configuration, such logback.xml file. please refer slf4j manual further reference.

ruby on rails - Devise CustomFailure and mount in routes, bad redirect -

i'm using customfailure class shown in doc ( here ) redirect our sign in page when unauthenticated: class customfailure < devise::failureapp include localization def redirect_url url_for(controller: "/public/sessions", action: :new, locale: locale_to_params(i18n.locale)) end # need override respond eliminate recall def respond if http_auth? http_auth else redirect end end end so redirects http://www.acmecorp.com/en/signin , sidekiq panel in routes.rb : authenticate :user, lambda { |u| u.super_admin? } require "sidekiq/web" mount sidekiq::web => "/sidekiq" end i redirected http://www.acmecorp.com/sidekiq/en/signin instead of http://www.acmecorp.com/en/signin . reason why redirect not rid of /sidekiq part? thanks!

html - Javascript:: Play multiple audio files via HTML5 Audio Player playlist -

i'm working on code play html5 audio file(s). let start code first easier explain. here code : <style> .btn { background:#fff; border-radius:5px; border:1px solid #000; height:25px; width:25px } .play:after { content:">" } .pause:after { content:"||" } </style> <button class="btn play" id=hezigangina-gravity></button> <button class="btn play" id=hezigangina-pug></button> <script> ibtn=document.getelementsbytagname('button'); for(j=0;j<ibtn.length;j++) { ibtn[j].addeventlistener ( 'click', function() { var audio=new audio(this.id+'.mp3'); if(audio.pause) { audio.play(); ibtn[j].classlist.remove("play"); ibtn[j].classlist.add("pause"); } else { ...

After update Facebook IOS SDK generated dialogs we are consistently getting CAPTCHA's -

after facebook ios sdk update, our app generates message "a link in post might unsafe" , "security check failed" when our user try post facebook app. never had before facebook sdk update. there peculiarities in facebook sdk update should take account avoid situation in future? thank in advance help. best regards, awem games can post example of full url blocked? way can check happening. there can various reasons why content want share blocked. unlikely linked using new sdk. can due having testing; url shared high amount of times since testing new sdk? you can use following form appeal blocked content: https://www.facebook.com/help/contact/244560538958131

Android Studio can't download packages -

i can't start android studio after installing it, error: sys-img-x68-addon-google_apis-google-21, extra-android-m2repository , 3 more sdk components not installed and log: android sdk installed c:\users\vincent\appdata\local\android\sdk refresh sources: fetched add-ons list refresh sources installing archives: preparing install archives download finished wrong size. expected 159505060 bytes, got 1527 bytes. download finished wrong size. expected 1848028 bytes, got 1537 bytes. download finished wrong size. expected 271448751 bytes, got 1559 bytes. download finished wrong size. expected 41693483 bytes, got 1533 bytes. download finished wrong size. expected 39017864 bytes, got 1531 bytes. done. nothing installed. sys-img-x86-addon-google_apis-google-21, extra-android-m2repository , 3 more sdk components not installed note: on proxy server have setup proxy settings in advance help

c# - How To Determine Which Version of Excel last saved a Workbook -

this question has answer here: how can check version of excel files in c#? 3 answers i have excel files (.xls) being automatically generated system, , distributing these files users , edit fields in , send me. need know each file sent me version of excel using (is office 2003, 2007, 2010, 2013...?) because want know lowest versions need keed support for. is there way take these files , excel version saved each 1 of them ? i tried solution programmatically finding excel file's excel version didn't it... i believe looking for, @ least worked fine application. var excelwb = new oledocumentpropertiesclass(); excelwb.open(filepath, false, dsofileopenoptions.dsooptiondefault); string fileusedversion = excelwb.summaryproperties.version.tostring(); greetings

dotnetnuke - DNN Editing Icon Suddenly Disappear -

i've got dnn community edition 06.02.01 it happens that, while site management, suddenly, modules' editing icons disappear. i have no idea i'm doing make happens... someone knows what's make icons disappear? no iis reset works. only restoring previous database backup works. it seems make change db that icons disappears.... please check in top dnn panel => right side => dropdownlist control => select edit mode instead of view mode. make sure login host or admin login credential.

java - NullPointerException w/ Sound Class -

i building game engine , inside of engine there class, called sound.java. purpose of class load sound effects engine , play them. problem inside constructor of sound.java, it's throwing exception called, nullpointerexception; however, doesn't make sense referencing correct file path of said sound file. take @ below code + stack trace , please me figure out! sound.java : public class sound { private clip clip; public sound(string filepath) { try { system.out.println(filepath); audioinputstream ais = audiosystem.getaudioinputstream(getclass().getresourceasstream(filepath)); audioformat baseformat = ais.getformat(); audioformat decodeformat = new audioformat(audioformat.encoding.pcm_signed, baseformat.getsamplerate(), 16, baseformat.getchannels(), baseformat.getchannels() * 2, baseformat.getsamplerate(), false); audioinputstream dais = audiosystem.getaudioinputstream(decodeformat, ais); clip = audiosystem.getclip();...

c# - WebApi Controller: Accessing database more than once, using Controller's own method? -

i writing a, let's say, nodecontroller project of mine. linked database, , of methods take id node access in ef database. node can have dependency on node, meaning that, if want to, say, "execute" 1 node, must check whether dependency-node has been executed or not, , fail, if not dependencies have been executed. i present partial versions of 2 of methods, whereas 1 uses other, first, there our controller's constructor, mentioned later on: private readonly nodedbcontext _context; public nodecontroller() { _context = new nodedbcontext(); } is correct way use dbcontext, or should limit ourselves using "using" statements whenever perform database-related (getting or putting, in our case)? [responsetype(typeof(bool))] [httpget] [route("node/{id}/executed")] public async task<ihttpactionresult> executed(int id) { var node = await nodecontrollerhelper.getnode(_context, id); if (node == null) return badrequest("there no...

sql - Optimize the SQLite select statement to run a lot faster -

this query want optimize, seems take 30 seconds or run on database around 1.7gb 1.5million rows in peptargetentity , targetmatchentity , thousands in customer table , searchentity table. expect such simple statement take milliseconds complete. there indexes on : customer(searchid) peptargetentity(customerid) targetmatchentity(customerid) if has ideas appreciated, in advance. select customerid, rank, pepid, targetid, falsepositive (select t.customerid, t.rank, t.id pepid, null targetid, t.falsepositive, c.surname, c.firstname peptargetentity t inner join customer c on t.customerid= c.id c.searchid = 3265 or 3270 = 0 union select t.customerid, t.rank, null pepid, t.id targetid, t.falsepositive, c.surname, c.firstname targetmatchentity t inner join customer c on t.customerid= c.id c.searchid = 3265 or 3270 = 0) order surname asc,firstname asc,rank desc limit 50 offset 0

asp.net mvc - Use different solr requesthandlers for different webpages -

i using solrnet. have 2 handler. 1) /default handler 2) /mysearch handler 1st 1 used few of webpages & 2nd 1 used other webpages. so, how can use both of handlers different webpages? please advise me possible or not?

excel - How to programmatically determine current setting for Option Base in VBA -

Image
how can programmatically determine current setting option base in vba? option base can set 0 or 1 , , determines whether array indices start @ 0 or 1 (see msdn ). however, can't see easy way find out current setting is. hoping there might option() function pass parameter to, like: debug.print option("base") and tell me, doesn't seem there. while agree @jonsharpe if you're using lbound(arr) , ubound(arr) , don't need know @ runtime, think it's interesting question. first, example of looping through array. for = lbound(arr) ubound(arr) ' next now, in order exactly asked, you'll need access use vbide library. otherwise known "microsoft visual basic applications extensibility" library. provides access ide , code with-in it. can use discover if option base 1 has been declared. don't recommend trying @ runtime though. more useful kind of static code analysis during development. first, you'll n...

javascript - Get the closest sibling of the data in a form -

clicking price class "onward" should take data "i want data " <span class="onward">4518</span> <table> <tr> <td class="select_fly"> <form> want data </form> </td> </tr> </table> $(document).on('click', '.onward', function(){ var owner = $(this).closest('td').siblings('td.select_fly').html(); console.log(owner); }); but me owner coming "undefined" can me how data " want data" you can use var owner = $(this).next('table').find('td.select_fly').html(); so js : $(document).on('click', '.onward', function(){ var owner = $(this).next('table').find('td.select_fly').html(); alert(owner); }); <script type="text/ja...

string - How do I convert a deliminated file in base - R into separate columns without creating a list? -

i using following code: write(unlist(fieldlist),"c:/temp/test.txt") temp1<-cbind(fieldlist,read.delim("c:/temp/test.txt",sep=" ",header=false)) but slow because obliges app write data temp file on disk. i have tried strsplit function , "qdap" library both create lists. need able manipulate columns separately newcolumn <- substr(temp1[,5],1,1)

c# mysqlcommnand insert into mysql database -

i have program insert list of field database. when use own computer insert datetime field looks completing fine. however, when insert using windows 7 chinese edition, field become 0000-00-00 00:00:00 command mysqlcommand mycommand4 = new mysqlcommand("insert orderrecords_table values('" + orderidlabel.text + "','" + customercode + "','" + customer + "','" + telcombobox.text + "','" + licensecombobox.text + "','" + drivercombobox.text + "','" + addresscombobox.text + "','" + locationtypecombobox.text + "','" + pickupcombobox.text + "','" + customertypelabel.text + "','" + convert.todecimal(totalpricelabel.text) + "','" + status + "','" + note + "','" + sandreceiptno + "','" + ...