Posts

Showing posts from August, 2010

javascript - No response data after call a function -

i have file called login.php , in file there box fill send login data server. when user press login button, code fired: var posturl = globalvariables.baseurl + 'application/controllers/user.php/ajax_check_login'; var postdata = { 'username': $('#username').val(), 'password': $('#password').val() }; $.post(posturl, postdata, function(response) { // stuff.. }, 'json'); the posturl valorized correctly by: http://localhost/app_name/application/controllers/user.php/ajax_check_login now have list of own controller allow me manage web app. 1 of controller user.php , how can see call ajax_check_login function. function check if data passed request exists in database , if correct. content: public function ajax_check_login() { echo "test?"; try { if(!isset($_post['username']) || !isset($_post['password'])) { throw new exception('ba

ruby - Rails renders view when redirected -

so have rails 4 app uses devise authentication. have started writing controller tests when noticed odd behaviour , confirmed in firebug. when try access controller action, has before_action :authenticate_user! , returns response 302 found header , body first database entry , after redirects new_user_session_path . therefore if open console , @ it, can see information, that's supposed hidden them. and don't understand how can render body user, when user found @user = current_user , there no current_user , or @ least there shouldn't be. i have looked found nothing. here additional info: devise version 3.5.2, rails 4.2.4 edit rails log when trying access authenticated page started "/dashboard" 127.0.0.1 @ 2016-01-28 11:07:27 +0100 processing userscontroller#show html completed 401 unauthorized in 0ms (activerecord: 0.0ms) started "/users/sign_in" 127.0.0.1 @ 2016-01-28 11:07:27 +0100 processing users::sessionscontroller#new html rendere

vb.net - Process.start in vb can't load modules -

i need start script ps1 (azure) vb, tried : process.start("powershell.exe", "-noprofile -executionpolicy unrestricted -noexit 'c:\test.ps1' ") but powershell have 1 module loaded, can't load azure module , can't import-module azure if have ideas great ! thx

sql server - How to change Date format to yyyy-mm-dd -

i want change output date format of parameter @dateissued "2013-12-31" format. you can try this: select convert(char(10), getdate(), 126) or in case: select convert(char(10), @dateissued, 126) you can cast , convert

javascript - Warning: React.createElement: type should not be null, undefined, boolean, or number -

warning: react.createelement: type should not null, undefined, boolean, or number. should string (for dom elements) or reactclass (for composite components). i putting react page , have come across error above when try use es2015 style code. when use following code error var react = require('react'); export default class storeapp extends react.component { getinitialstate() { return null; } render() { return ( <div> <p>this should display on screen</p> </div> ); } } this works fine... var react = require('react'); var storeapp = react.createclass({ render: function() { return ( <div> <p>this should display on screen</p> </div> ); } }); module.exports = storeapp; im using babel following presets ['react','es2015'] ideas whats going on here? in es6 can't use getinitialstate() . use constructor() . e.g. con

Phonegap Cordova 5.x looking for working Android QR-Code-Scanner Plugin (Google API 23) -

i looking working barcode-scanner plugin.. i´ve found one: https://github.com/phonegap/phonegap-plugin-barcodescanner ..but unfortunately doesn´t work google api 23 (there errors occurring bookmarkcolumns plugin included).. far know works api 22 or less so errors ocurr in captureactivity (src folder) > com.google.zxing.client.android.share files: apppickeractivity.java bookmarkpickeractivity.java shareactivity.java error: bookmarkcolumns cannot resolved or not field so question is, there other barcode-scanner-solution phonegap or there way fix these errors? any appreciated! thanks! barcode scanner : click on below link find multiple numbers of barcode scanner plugin. please add ever shoots api level. barcode scanner plugins

JavaScript array find fitting range -

i have following array 2 objects: var myarr = [{ id: 3, licences: 100 new_value_pr_licence: 40 }, { id: 4, licences: 200 new_value_pr_licence: 25 }] a user wish buy 150 licences. means fall category 100 because above 100 licences below 200 means pay $40 per licence. note array object values varies. order plans price per licence: myarr.sort(function (a, b) { return a.new_value_pr_licence - b.new_value_pr_licence; }) then starting start of array, take many of plan can without going on number user wants buy: var numuserwants = 150; var purchases = {}; var cheapestavailableproduct = myarr.shift(); while (numuserwants > 0 && cheapestavailableproduct) { if (numuserwants <= cheapestavailableproduct.licences) { purchases[cheapestavailableproduct.id] = math.floor(cheapestavailableproduct.licences / numuserwants); numuserwants = cheapestavailableproduct.licences % numuserwants; } cheapestavailableproduct = myarr.shi

Intellij remote debug mode is too slow -

i experiencing problems remote debugging through intellij 14. i can connect web application, based on tomcat 8, remotely. however, when have connected, set 1 breakpoint on particular code line(not method) , run on website, becomes sooo slow. why happens so? need improve situation?

tsql - Grouping by date difference/range -

how write statement make specific group by's looking @ monthly date range/difference. example: org_group | date | second_group_by 30.10.2013 1 29.11.2013 1 31.12.2013 1 30.01.2015 2 27.02.2015 2 31.03.2015 2 30.04.2015 2 as long es there isnt monthly date_diff > 1 should in same second_group_by. hope clear enough understand, column second_group_by should generated user...it doesnt exists in table. date diff between rows though? if want separate years (or months or weeks) use group datepart(....) that's sybase or sql server other sqls have equivalent. if have specific data ranges, them table start , end date-time , monotonically increasing integer, join between , group integer.

css - Semantic UI cards height issue (chrome on windows) -

Image
i'm having issue on chrome windows .card items don't seem right height. or little resulting in issue can see in screenshot below. happening on chrome windows far can tell. platforms issue doesn't happen: internet explorer 11 microsoft edge firefox chrome on mac jsfiddle <div class="ui grid stackable container"> <div class="sixteen wide column"> <div class="ui link 5 doubling cards"> <a class="ui card" href="#"> <div class="image"> <img src="http://assets19.pokemon.com/assets/cms2/img/pokedex/full//002.png"> </div> <div class="content"> <div class="header">ivysaur</div> <div class="meta">grass</div> <div class="description"> </div> </div> <div class=&quo

Make Outlook add-ins working with Office 365 shared mailboxes -

Image
i building apps new technology of office add-ins (formerly app office). the add-ins activate when registered globally office 365 tenant or individually user (mechanical gear > manage add-ins). i add-in work office365's shared mailboxes. add-ins not load in outlook desktop or in owa when shared mailbox open alone. however, managed make work when setting shared mailbox shared folder displayed under primary mailbox, explained here (see picture below). better nothing not acceptable solution, add-ins displayed when consulting mailbox in desktop client , in owa when using "open mailbox" (see link above). my question then: how make add-ins working shared mailboxes? possible solution is: shared mailbox seems related special kind of user. possible install add-in special user in order have add-ins working shared mailboxes? edited: not supported now. created feature request in office365 user voice . consider bringing vote it. outlook add-ins not suppos

javascript Bubble sort problems (probably very easy) -

<html> <script> var tal; var array = []; var element=parseifloat(); function bubblesort(a){ var swapped, len = a.length; if(len === 1) return; { swapped = false; for(var i=1;i<len;i++) { if(a[i-1] > a[i]) { var b = a[i]; a[i] = a[i-1]; a[i-1] = b; swapped = true; } } } while(swapped) } function insertnumber(){ var element=document.getelementbyid("element").value; insert (element,array); } function insert(element, array) { array.push(element); alert(array); bubblesort(array); alert(array); } </script> <body> <input type="button" value="mata in" onclick="insertnumber()" id="resultat"> tal<input type="number" id="element" autofocus> </body> </html> this code dont know how working again, problem cant read numbers correctly, trying use "var element=parseifl

python - TypeError: coercing to Unicode: need string or buffer, NoneType found -

i'm wading throught django tutorial, part 2: https://docs.djangoproject.com/en/1.9/intro/tutorial02/ , in place attach several choices 1 question # display choices related object set -- none far. >>> q.choice_set.all() [] i got error: /home/paulmad/env/local/lib/python2.7/site-packages/ipython/lib/pretty.pyc in _repr_pprint(obj, p, cycle) 692 """a pprint redirects normal repr function.""" 693 # find newlines , replace them p.break_() --> 694 output = repr(obj) 695 idx,output_line in enumerate(output.splitlines()): 696 if idx: /home/paulmad/env/local/lib/python2.7/site-packages/django/db/models/query.pyc in __repr__(self) 235 if len(data) > repr_output_size: 236 data[-1] = "...(remaining elements truncated)..." --> 237 return repr(data) 238 239 def __len__(self): /home/paulmad/env/local/lib/python2.7/site-packages/django/db/m

junit - How to pass @CucumberOptions as parameters from Jenkin's job -

i have 5 junit test classes execute test cases in parallel , have hardcoded cucumber --tags in @cucumberoptions . want pass cucumber --tags parameters jenkin's job. ex: -- tags = {@students,@courses,@faculties,@admin,@visitors} in way each tag assigned junit runner randomly when job invoked. any suggestion appreciated. . in advance.

node.js - Any simple way to create link in ExpressJS? -

sometimes need create absolute link in web site. like http://example.com/xxxx/xxxx?foo=bar not /xxxx/xxxx?foo=bar here has anyway create simple helper express manually? just like: app.locals.url = function ( pathto, opts ) { // somethings here. } i think may need ssl check, host , route check or somethings. you can create full url : var url = req.protocol + '://' + req.get('host') + req.originalurl; them can redirect url

apache spark - Loading Scala objects into RDD -

a scala class represents user . class has companion object . the class contains toxml() function, , companion object has fromxml() function. class user(val firstname:string, val lastname:string, val age:int, val profession:string){ def toxml(){...} } an xml file contains list of users, modelled scala class. a spark rdd needs created\loaded xml file, contains collection of scala objects of type of our class, i.e. rdd[user] . what best way this? thanks

html - Min Size of The File to be Uploaded -

i trying find html provide option in <input type='file' /> set minimum , maximum size of file being uploaded. yes does. theis attribute server side soft impose of limit. <input type="hidden" name="max_file_size" value="1024" /> the value in bytes. you should use html file api restrain size of uploads. preferred way.

android - DialogFragment lifecycle behavior -

i have custom dialogfragment overrides ondismiss() method: @override public void ondismiss(dialoginterface dialog) { ((myactivity) getactivity()).ondismiss(); super.ondismiss(dialog); } the problem method executed after ondetach() , in turn trigger nullpointerexception . there way safely detect dialog dismissal before it's detached? i dismissed dialog hosted in dialogfragment by: (1) calling dialog.dismiss() , (2) touching outside dialog, , (3) pressing back. in each case, when ondismiss() called, getactivity() not null (i.e. fragment attached). time when ondismiss() called when fragment not attached during restart caused configuration change. in case, ondismiss() called old fragment being destroyed. situation, not need notify activity dialog dismissed, because dialog recreated result of restart processing. in opinion, code posted, added check, acceptable , safe way handle dialog dismiss events: @override public void ondismiss(dialoginterface

Sitecore TreelistEx used as a UI for multi-link layouts -

i need present content editor interface allows editors select specific pages in order generate link list website visitors. it seems treelist/treelistex providing expected interface , have combined source path lock editors start destination rather entire sitecore tree. opted treelist ex appears efficient way doesnt render tree in full each time unless called upon. in terms of output i'm getting pipe separated list of guids- need iterate through manually using linkmanager or such obtain items title , sitecore link? or there existing process manages such multi-list , breaks components. if can provide example of code , how draw out title , url great. thanks there no built-in solution getting title , url items selected in treelist . you can treat treelist field multilist field (they both store list of pipe separated ids in background) , use getitems() method: sitecore.data.fields.multilistfield treelistfield = sitecore.context.item.fields["mytreelistfiel

Libgdx: Different profiles of Preferences -

i've searched around , haven't found related i'm trying achieve. to explain simple possible. app stores various number of values, acting settings user basically. want user have ability switch between different preference files. different profiles. on click of button instances of preferences through app start reading different file different values, example: main.preferences = gdx.app.getpreferences("prefs_2"); where first profile "prefs_1" instead loaded default when app starts. don't know if changing preference file shown above work @ all. hope gives idea of how i'm thinking. and when clicking button change preference file, app read file's values through out classes in app until restarted go default file: public class main extends game { public spritebatch batch; public shaperenderer renderer; private assets assets; //local preferences public preferences preferences; public main(utilsinterface utils){ this.utils = utils;

java - Can't decrypt Forge-encrypted data -

i use create private key , encrypt: var forge = require('node-forge'); var fs = require('fs'); var bytes = forge.random.getbytessync(16); console.log("random plaintext", forge.util.bytestohex(bytes)); var keypair = forge.pki.rsa.generatekeypair({bits: 2048, e: 17}); var encrypted = keypair.publickey.encrypt(bytes, 'rsa-oaep', { md: forge.md.sha256.create(), mgf1: { md: forge.md.sha1.create() } }); console.log("ciphertext", forge.util.bytestohex(encrypted)); fs.writefilesync('ciphertext', encrypted); var pem = forge.pki.privatekeytopem(keypair.privatekey); fs.writefilesync('prikey.pem', pem); console.log("private key", forge.util.bytestohex(pem)); i try decrypting using either: public class cryptotest { public static void main(string[] args) throws exception { pemparser parser = new pemparser(new filereader("/tmp/prikey.pem")); security.addprovider(new org.bouncycas

required php code to download a file from sub folder of a server -

say server www.abc.com in server there sub folder images in 1 excel file there i.e. a.xls; download file local computer need php code same this not php want share solution. how "wget" on linux or cygwin on windows. 1. create list files needed dowload "list.txt" (one file 1 line) 2. create shell script file "download.sh" while read file; wget $file done < /path/to/file/list.txt 3. on linux, make "download.sh" available executed. chmod +x /path/to/file/download.sh 4. execute file ./path/to/file/download.sh

R - Error: IllegalArgumentException (Java): Your InputStream was neither an OLE2 stream, nor an OOXML stream -

i use r xlconnect package. when wrote ' xlconnect ' function, such loadworkbook() , readworksheetfromfile() etc. , error message happen. error: illegalargumentexception (java): inputstream neither ole2 stream, nor ooxml stream how solve problem? before using function, took action against crashing between r , mac os x way http://www.r-bloggers.com/getting-r-and-java-1-8-to-work-together-on-osx/ link told. i have used mac os x. this message states file have provided loadworkbook has not been recognized *.xls (biff-8) or *.xlsx (ooxml) file.

amazon web services - Counting number of requests per second generated by JMeter client -

Image
this how application setup goes - 2 c4.8xlarge instances 10 m4.4xlarge jmeter clients generating load. each client used 70 threads while conducting load test on simple request (685 bytes size page). came across issue of reduced throughput after time of test run. throughput of 18000 requests/sec reached 700 threads, remains @ level 40 minutes , drops. thread count remains 700 throughout test. have executed tests different load patterns results have been same. the application response time considerably low throughout test - according elb monitor, there reduction in number of requests (and suppose hence lower throughput ) - there no errors encountered during test run. set connect timeout http request yet no errors. i discussed issue aws support @ length , according them not blocked network limit during test execution. given number of threads remain constant during test run, these threads doing? there metrics can check on find out number of requests generated (not

robotframework - REST Api usage in Robot framework -

i have rest delete call done. after deleting , verifying same url rest call. expected result : should throw - 404 err valid data dosent exists . current result- 200 - after delete , data exists !!! please let me know , rest delete api uses delay reflected ? the specification delete @ https://www.w3.org/protocols/rfc2616/rfc2616-sec9.html states: 9.7 delete the delete method requests origin server delete resource identified request-uri. method may overridden human intervention (or other means) on origin server. client cannot guaranteed operation has been carried out, if status code returned origin server indicates action has been completed successfully. however, server should not indicate success unless, @ time response given, intends delete resource or move inaccessible location. a successful response should 200 (ok) if response includes entity describing status, 202 (accepted) if action has not yet been enacted, or 204 (no content) if action has been enacted

swift - Checking the String whether it is the Number(Double) of -

question. necessary make check string whether number(double)? exemple: var s1:string = "df1231" var s2:string = "1231,3123" if s1.isdouble { println("true.this number!") } else { println("false.this not number!") //will give } if s2.isdouble { println("true.this number!") //will give } else { println("false.this not number!") } not sure needs exactly, straightforward way be: func isdouble(text:string) -> bool { guard let _ = double(text.stringbyreplacingoccurrencesofstring(",", withstring: ".")) else { return false } return true } isdouble("df1231") // returns false isdouble("1231,3123") // returns true you can copy paste playground see work.

java - Android background music service restart -

my application control music in class extents application using service. background music service called when application starts. , overriding onuserleavehint() stop service. to prevent music stop across activities, added flag intent.addflags(intent.flag_activity_no_user_action); so music isn't stopped , works fine. but problem home button. when push home button, music stopped. , open application music still stopped. because there no call start service, except application oncreate. that's why want restart service. how can check service started or stopped? thanks read question! try start service on onresume or on onstart method.

Android :Facebook sdk-4.4.1 Login without default Login button error on permissions? -

Image
i login facebook without facebook login button have find attention message: submit login review of permissions below have not been approved use facebook this code facebooksdk.sdkinitialize(getapplicationcontext()); setcontentview(r.layout.activity_login); callbackmanager = callbackmanager.factory.create(); loginmanager = loginmanager.getinstance(); loginmanager.getinstance().loginwithreadpermissions(loginactivity.this,arrays.aslist("user_photos")); loginmanager.registercallback(callbackmanager, new facebookcallback<loginresult>() { @override public void onsuccess(loginresult loginresult) { if (accesstoken.getcurrentaccesstoken() != null) { requestdata(); } } @override public void oncancel() { } @override public void onerror(facebooke

asp.net core mvc - MVC6 route choosing wrong action -

i'm trying make simple webpage more 1 parameter coming in. when click on link, takes me /links/index/1/2 instead of /links/canvas/1/2 expected. controller: public class linkscontroller : controller { public iactionresult index(int? id) { ...... return view() } public iactionresult canvas(int param1, int param2) { ...... return view() } } page link that's not working: <a asp-route="newroute" asp-route-param1="1" asp-route-param2="2">view</a> startup.cs: app.usemvc(routes => { routes.maproute( name: "newroute", template: "{controller=links}/{action=canvas}/{param1}/{param2}"); routes.maproute( name: "default", template: "{controller=home}/{action=index}/{id?}"); }); the default values specified in route used if there not value, when use route in context values populated

ios - Accessing delegate of NSURLSessionTasks wrapped in static method in separate class -

i wrote separate webservices class app - webservices.m. in it, have several static methods such setuserinput(), getuserprofile(), registernewuser(), logoutofaccount(). in methods include various nsurlrequests , nsurlsession tasks hit server's endpoints. i can call these static methods in various viewcontrollers - [webservices registernewuser]. issue is, want following: access response item task go new viewcontroller once task finished i have been using completion blocks within each completionhandler: assume i'm trying do, need using delegates instead? if so, how access delegates if i'm using static methods in other classes? how can each delegate differentiate between different tasks calling them? examples appreciated since i'm pretty new , couldn't find pertinent on stackoverflow. thank you! edit: example of static method in webservices.m completion handler. +(void)logoutaccount{ // 1 nsurl *url = [nsurl urlwithstring:@"https://my

Acces raw data in Drupal 8 view template -

in overridden template of view module (views-view-field.html.twig), i'm trying access raw data of field. in doc file, can read this: * available variables: ... * - fields: list of fields, each 1 contains: ... * - raw: raw data field, if exists. not output safe. ... but it's alway's empty. {{ dump(fields.field_myfieldname) }} print object(stdclass)[1899] ... {{ dump(fields.field_myfieldname.raw) }} print null i want raw build file path value of field. why it's empty? there other whay raw data of field in template ? edit : i'm trying this: <img src="/path/to/image/{{ fields.title.raw | escape('uri')}}.jpg" /> why hard ? instead of building stuff in twig files, should instead preprocess data , reference new variable in twig file. for example, if custom theme called mytheme, in mytheme.theme file, add following function function mytheme_preprocess_field(&$variables, $hook) { if( $variables[&

How to change google docs file owner without sending an email notice to the new owner -

i using drive api google apps script urlfetchapp change file owner. works great , sends email notice every single file new owner. how can suppress email notice? here partial code snippet var base = 'https://docs.google.com/feeds/'; var fetchargs = googleoauth_('docs', base); fetchargs.method = 'post'; var rawxml = "<entry xmlns='http://www.w3.org/2005/atom' xmlns:gacl='http://schemas.google.com/acl/2007'>" +"<category scheme='http://schemas.google.com/g/2005#kind' " +"term='http://schemas.google.com/acl/2007#accessrule'/>" +"<gacl:role value='owner'/>" +"<gacl:scope type='user' value='"+newowneremail+"'/>" +"</entry>"; fetchargs.payload = rawxml; fetchargs.contenttype = 'application/atom+xml'; var url = base + encodeuricomponent(oldowneremail) + '/private/full/'+fileorfolderid+'/

Python Tkinter Title issue -

every time write in title tkinter creates new window instead of adding title frame. using root.title('') tk stays @ top of main window you use tk() 2 times - first root = tk.tk() , second sampleapp(tk.tk) . if create class using tk don't need root = tk.tk() simple example import tkinter tk class sampleapp(tk.tk): def __init__(self, *args, **kwargs): tk.tk.__init__(self, *args, **kwargs) self.title("the title") tk.label(self, text="hello world of tkinter").pack() sampleapp().mainloop() btw: if need second window use toplevel

compiler licensing issue in scons -

am using scons renesas compiler. i able compile , link project. while linking getting following message: "software license problem:internal error in licensing or accessing feature unknown" even though have trial license of renesas compiler. i able generate executable (.abs file renesas) small application above message. when tried create executable bigger application getting following message while linking: "software license problem:internal error in licensing or accessing feature unknown" maximum link size limited 64kb code+data. i tried creating executables above appliations using scons on machine has valid renesas license. on machine saw same messages , not able generate .abs file. ( in machine able create executables without using scons) can 1 me in overcoming issue. don't have clues whether message getting scons or renesas tool chain. thanks it's possible tool chain sets environment variables telling compiler find licence fil

Elasticsearch curator - "--older-than 6" -

when try use " curator --host 127.0.0.1 delete --older-than 6 " error " error: no such option: --older-than " i'm running newest verison of curator, suggestions on how fix it? you missing sub-command 'indices' between 'delete' , '--older-than' you need other flags complete command-line based on index name pattern.

jquery not opening any window to select file in android native browser -

i trying upload file through html , jquery. it's working fine on desktop browsers on mobile works fine in chrome browser in android native browser not opening windows select file. i'm testing on samsung galaxy grand android version: 4.1. <div class="hiddeninputfile"> <form:input type="file" id="fileinput" path="imagepath" accept="image/*" /> </div> <a id ="addphotobtn" href="javascript:void(0)" class="btn_grey"> add photo </a> $(function(){ $("#addphotobtn").on('click', function(e){ e.preventdefault(); $("#fileinput:hidden").trigger('click'); }); }); // other stuff...

How to set video recording time limit and compress it to 2MB in android? -

i new android, trying develope application record video 10 seconds. code. public void startrecordingvideo() { if (getpackagemanager().hassystemfeature(packagemanager.feature_camera_front)) { intent intent = new intent(mediastore.action_video_capture); mediafile = new file( environment.getexternalstoragedirectory().getabsolutepath() + "/video.mp4"); videouri = uri.fromfile(mediafile); intent.putextra(mediastore.extra_video_quality, 1); intent.putextra(mediastore.extra_duration_limit, 10); intent.putextra(mediastore.extra_output, videouri); startactivityforresult(intent, video_capture); } else { toast.maketext(this, "no camera on device", toast.length_long).show(); } } i set in possible ways, not able achieve target. after attaining this, need compress video 2mb, haven't start working on because stuck in capturing video. kindly me. in advance.

matplotlib - imshow non unifrom matrix bin size -

Image
i trying create image imshow, bins in matrix not equal. example following matrix c = [[1,2,2],[2,3,2],[3,2,3]] is x = [1,4,8] , y = [2,4,9] know can xticks , yticks , want axis equal..this means need squares build imshow in different sizes. possible? thanks. this seems job pcolormesh . when use imshow on pcolormesh : fundamentally, imshow assumes data elements in array rendered @ same size, whereas pcolormesh/pcolor associates elements of data array rectangular elements size may vary on rectangular grid. pcolormesh plots matrix cells, , take argument x , y coordinates of cells, allows draw each cell in different size. i assume x , y of example data meant size of cells. converted them in coordinates with: xsize=[1,4,9] ysize=[2,4,8] x=np.append(0,np.cumsum(xsize)) # gives [ 0 1 5 13] y=np.append(0,np.cumsum(ysize)) # gives [ 0 2 6 15] then if want similar behavior imshow , need revert y axis. c=np.array([[1,2,2],[2,3,2],[3,2,3]]) plt.pcol

javascript - Incorrect date and time when using Date Range Picker -

i'm using plugin date range picker plugin predefined range. problem "last 30 minutes" not showing correct date range. what expect: say january 28, 2016 17:00 pm , when select last 30 minutes, expect show january 28, 2016 16:30 pm - january 28, 2016 17:00 pm . what got january 28, 2016 12:00 am - january 28, 2016 11:59 pm the rest of predefined template seems work. here's a fiddle play. you need enable timepicker feature this: $(function() { function cb(start, end) { $('#reportrange span').html(start.format('mmmm d, yyyy h:mm a') + ' - ' + end.format('mmmm d, yyyy h:mm a')); } cb(moment().subtract(29, 'days'), moment()); $('#reportrange').daterangepicker({ timepicker: true, /*add line*/ ranges: { 'last 30 minutes': [moment().subtract(30, 'minutes'), moment()], 'today': [moment(), moment()],

python - MoviePy VideoFileClip instance has no attribute 'reader' -

i've searched few days regarding issue have come no solution. have big script (i'm trying concatenate large number of videos, ~100-500), why getting error "too many files open". reading zulko's responses other issues, saw necessary delete each videofileclip instance manually this: del clip.reader del clip the issue i'm facing have simple hello_world trying this, error videofileclip instance has no attribute 'reader' here's code: from moviepy.editor import * rel_path = "main.py" file_path="hello_world.mp4" newvideo = videofileclip(file_path) del newvideo.reader del newvideo i'm using el capitan (os x), have updated moviepy, numpy, imagemagick, , packages i've seen required, i'm still getting error. problem computer ends freezing because it's using memory. i'm concatenating chunks of 25 videos, , trying delete 25 "opened files", concatenate next 25, , forth. after i'd concatenate long

python - How can I analyze a confusion matrix? -

when print out scikit-learn's confusion matrix, receive huge matrix. want analyze true positives, true negatives etc. how can so? how confusion matrix looks like. wish understand better. [[4015 336 0 ..., 0 0 2] [ 228 2704 0 ..., 0 0 0] [ 4 7 19 ..., 0 0 0] ..., [ 3 2 0 ..., 5 0 0] [ 1 1 0 ..., 0 0 0] [ 13 1 0 ..., 0 0 11]] iiuc, question undefined. "false positives", "true negatives" - these terms defined binary classification. read more definition of confusion matrix . in case, confusion matrix of dimension n x n . each diagonal represents, entry (i, i) case prediction i , outcome i too. other off-diagonal entry indicates mistake prediction i , outcome j . there no meaning "positive" , "negative in case. you can find diagnoal elements using np.diagonal , and, following that, easy sum them. sum of wrong cases sum of matrix minus

node.js - Unable to create child instance for one-to-many on Sequelize.js -

i creating parent , child instance using sequlize, throws following error. site.hasmany(group,{as:'groups'}); group.belongsto(site); //not working site.create(sitedata).then((site)=>{ site.addgroups(groupdata).then(()=>{ //also tried addgroup next(); }); }); //this works site.create(sitedata).then((site)=>{ groupdata.siteid=site.id; group.create(groupdata).then(()=>{ next(); }); }); error: unhandled rejection typeerror: val.replace not function @ object.sqlstring.escape (c:\api\node_modules\sequelize\lib\sql-string.js:61:15) @ object.querygenerator.escape (c:\api\node_modules\sequelize\lib\dialects\abstract\query-generator.js:983:22) suppose have task , different schedule can try and can create bulk of schedule or single task change bulkecreate create var ts=req.body.task_time; tasks.create(req.body).then(function (taskvalues) { //for adding taskid each object prepare object bulk

textures - CubeMap in OpenGL doesn't show at all -

i'm trying load 6 pictures texture of cube in opengl. blow loading code: gltexparameteri(gl_texture_cube_map_arb, gl_texture_mag_filter, gl_linear); gltexparameteri(gl_texture_cube_map_arb, gl_texture_min_filter, gl_linear_mipmap_linear); gltexparameteri(gl_texture_cube_map_arb, gl_texture_wrap_s, gl_clamp_to_edge); gltexparameteri(gl_texture_cube_map_arb, gl_texture_wrap_t, gl_clamp_to_edge); gltexparameteri(gl_texture_cube_map_arb, gl_texture_wrap_r, gl_clamp_to_edge); (int = 0;i < 6;++i) { int width, height, channel; unsigned char* img = soil_load_image(skybox[i].c_str(), &width, &height, &channel, soil_load_auto); glteximage2d(cubetarget[i], 0, gl_rgb, width, height, 0, gl_rgb, gl_unsigned_byte, img); delete img; } glenable(gl_texture_cube_map_arb); the rendering code passed. weird thing cube rendered white. seems texture isn't loaded @ all. change loading code see whether 2d texture work: glgentextures(1, texture); glbindtexture(

python - How to start my scrapy spider using http request? -

This summary is not available. Please click here to view the post.

javascript - How can I give a background for an object on the canvas? -

i made little canvas , create square path drawing moveto() , lineto() orders. so have square red borders , can give background color fillstyle , gets color fill(). it executes click. var c = document.createelement('canvas'); c.id = 'mycanvas'; c.style.background = "#ffffff"; c.width = "100"; c.height = "50"; document.getelementbyid('container').appendchild(c); var ctx = c.getcontext("2d"); ctx.beginpath(); ctx.moveto(0, 0); ctx.lineto(0, 80); ctx.lineto(50, 80); ctx.lineto(50, 0); ctx.lineto(0, 0); ctx.strokestyle = "red"; ctx.stroke(); var getcolor2 = 0; var getcolor = 0; c.addeventlistener("click", function(){ if(getcolor2 == 0){ ctx.fillstyle = "#ffffff"; } if(getcolor2 == 1){ ctx.fillstyle = "#ff33df"; } if(getcolor2 == 2){ ctx.fillstyle = "#bbbbbb"; } if(getcolor2 == 3){

Compile oct file with fortran openmp using LDFLAGS -

using ubuntu 14.04 octave 3.8.1. i'm attempting create .oct file makes use of multithreaded fortran program. however, mkoctfile fails use related libraries during linking. the files i'm using follows: c: #include <octave/oct.h> extern "c" { void fort5(); } defun_dld (ce5, args, ,"help here") { fort5(); } fortran: subroutine fort5() bind(c) use iso_c_binding implicit none !$omp parallel write(*,*) "hello" !$omp end parallel end subroutine fort5 i expect code result in output of 4 lines of "hello". compile following command mkoctfile cpp.cpp fortran.f90 result 1 output line, indicates multitrhreading ignored. when compiled outside octave (with minor alterations c++ file) following command: gcc -c cpp.cpp && gfortran -wall -fimplicit-none -wtabs -fdefault -real-8 -fopenmp -c fortran.f90 &&gfortran -fopenmp -o3 cpp.o fortran.o -lstdc++ -o out.out the result should be. from several tests b

visual studio 2012 - Treeview C# Click on a node for a text to appear -

i have treeview multiple nodes (eg. a, b, c). if click on "b", want word "hello" appear in textbox. i have method this: private void treelist_selectednodechanged(object sender, system.eventargs e) { this.layoutcontrolitem1.text="hello"; } the hello text appearing though i'm not clicking on node. doing right? the best event use nodemouseclick . private void treeview1_nodemouseclick(object sender, treenodemouseclickeventargs e) { this.layoutcontrolitem1.text = e.node.tag.tostring(); } the simplest way different massages each node store them in nodes' tags: somenode.tag = "some message"; note selectionchanged fire more want to, including each time selection cleared.. if need include keyboard selection should include check treeview1.selectednode != null in code..

jquery - Image Reveal on mousemove using translateX with gradient -

$(document).ready(function() { var $window = $(window), $overlay = $('.example2'), rotation = 0, transover = 0 $window.on('mousemove', function(event) { transover = (event.pagex / $window.width() * 1720) - 690; $overlay.css('transform', 'translatex(' + transover + 'px)'); }); }); .img-responsive { display: block; width: 100%; height: auto; } .stopoverflow { overflow-x: hidden; overflow-y: hidden; } #container { position: relative; width: 500px; height: 500px; } img { top: 0; left: 0; } .example3 { position: relative; z-index: -3; } .example2 { position: absolute; z-index: -2; bottom: 0; top: 0; } .example1 { position: absolute; z-index: -1; } } <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <div id="container" class="stopoverflow"> <i

php - How not to repeat array in a function to use foreach -

this works fine, it's goofy me don't know search (or if question titled correctly) learn how accomplish not repeating $slide_panels array within christina_slide_in_panels() function below , outside it. sadly, question closed answer steve in comments. question not answered reading "duplicate" post accepted answer, @ least not specifically. //* register slide panels $slide_panels = array ( 'slide-1' => 'slide panel one', 'slide-2' => 'slide panel two', 'slide-3' => 'slide panel three', 'slide-4' => 'slide panel four', ); foreach ( $slide_panels $id => $slide_panel) { register_sidebar( array ( 'name' => __( $slide_panel, 'christina' ), 'id' => $id, 'before_widget' => '<as

c# 4.0 - C# programming to get name node from XML -

how value of node "name" below xml. `xmldocument doc = new xmldocument(); doc.load(@"c:\new folder\sample_rajnish_1.xml"); messagebox.show(doc.selectsinglenode("confdata/cfgagentgroup/cfggroup/name").innertext);` below sample xml file` satrcfg_object [xml] = <confdata> <cfgagentgroup> <cfggroup> <dbid value="225"/> <tenantdbid value="101"/> <name value="cbd"/> <routedndbids> <dbid value="825"/> </routedndbids> <capacitytabledbid value="0"/> <quotatabledbid value="0"/> <state value="1"/> <capacityruledbid value="0"/> <sitedbid value="0"/> <contractdbid value="0"/> </cfggroup> <agentdbids> <dbid value="128"/> <dbid value="133

javascript - Best way to alternate constraints on two dropdowns -

i have 2 dropdown selects have same values. building converter source (left) unit destination (right) unit . doesn't make sense convert , units. know how add event on dropdown select remove selected option alternate box unclear on writing produce best ui experience. give following trimmed case: <select name="srcunit" id="srcunit"> <option value="unit 1">unit 1</option> <option value="unit 2">unit 2</option> <option value="unit 3">unit 3</option> </select> <select name="dstunit" id="dstunit"> <option value="unit 1">unit 1</option> <option value="unit 2">unit 2</option> <option value="unit 3">unit 3</option> </select> what might best practice approaching this? if choose source of "unit 2" how should destination react, remove it? need reset button, o

awk - Find letters in columns which are same like in first column and print it -

i have table values , have find match: first column others , print match. input: a:0 a:0.7541 a:0.7396 a:0.7694 a:0 0:0 0:0 0:0 c:0 c:0.8408 c:0.8459 c:0.7939 g:0 g:0.3415 g:0.3290 g:0.4228 g:0 g:0.0343 g:0.0378 t:8.237e06,g:0.02437 c:0 c:0.3895 c:0.3837 a:8.255e06,t:8.255e06,c:0.3623 output: a:0 0.7541 0.7396 0.7694 a:0 0 0 0 c:0 0.8408 0.8459 0.7939 g:0 0.3415 0.3290 0.4228 g:0 0.0343 0.0378 0.02437 c:0 0.3895 0.3837 0.3623 for last row.. if c in second column, print number after matching letter c in case, same columns, there more values separated ",". print number contain match letter c in case row. wrote : awk '{split ($1,a,":");split ($2,b,":"); split($3,c,":"); split($4,d,":"); if(a[1]=b[1] && a[1]=c[1] && a[1]==d[1]) print $0}' /home/fil/desktop/

asp.net mvc - mvc - jQuery ajax datatable actionlink -

i have datatable in data (from database) being filled ajax, want new tablerow "details" show more details of selected item, table allows data database. here view <script language="javascript" type="text/javascript"> $(document).ready(function () { $('#mydatatable').datatable({ "bprocessing": false, "bserverside": true, "sajaxsource": 'ajaxdataprovider', "aocolumns": [ { "sname": "id", }, { "sname": "student_naam" }, { "sname": "klas" }, { "sname": "adres" }, { "sname": &quo