Posts

arrays - Porting IDL code, lindgen function to Python -

afternoon everyone. i'm porting on idl code python , it's been plain sailing until point far. i'm stuck on section of idl code: nsteps = 266 ind2 = ((lindgen(nsteps+1,nsteps+1)) mod (nsteps+1)) dk2 = (k2arr((ind2+1) < nsteps) - k2arr(ind2-1) > 0)) / 2. my version of includes rewritten lindgen function follows: def pylindgen(shape): nelem = numpy.prod(numpy.array(shape)) out = numpy.arange(nelem,dtype=int) return numpy.reshape(out,shape) ... , ported code k2arr array of shape (267,): ind2 = pylindgen((nsteps+1,nsteps+1)) % (nsteps+1) dk2 = (k2arr[ (ind2+1) < nsteps ] - k2arr[ (ind2-1) > 0. ]) / 2. now, problem code makes ind2 array where, looking @ idl code , errors thrown in python script, i'm sure it's meant scalar. missing feature of these idl functions? any thoughts appreciated. cheers. my knowledge of idl not used be, had research little. operator ">" in idl not equivalent of python (or other la...

visual studio - Keep common functions in separate cs file? (C#) -

i have common functions apppath() used in several windows forms of application, instead of declaring in each form, place in separate cs file. i have created separate class cs file, gave different namespace (modutilities) , put functions inside modutilities class. namespace modutilities { public class modutilities { // functions such apppath().... } } but can't figure out how use function modutilities inside different windows forms need it. trying use "using modutilities", instead of creating new instance (modutilities modu = new modutilities()) can me? if methods static within class, can do using modutilities; then var = modutilities.apppath(); if not, you'll need create instance of class. modutilities mod = new modutilities();

Android: view local html file not showing all browsers -

my app generating html file, want show user, code follows - uri uri = uri.parse("file://" + filename); intent browserintent = new intent(intent.action_view); browserintent.setdataandtype(uri, "text/html"); browserintent.addcategory(intent.category_browsable); startactivity(browserintent); it shows me "complete action using" lists firefox browser. have chrome, opera & dolphin browsers installed well. why dont choose of them ? thank you. you can use rooted phone, grab chrome apk, use apktool take inside manifest. there see chrome support schemes http/https/about/javascript usually, , file scheme once in following intent filter: <intent-filter> <action android:name="android.intent.action.view"/> <category android:name="android.intent.category.default"/> <data android:mimetype="multipart/related" android:scheme="file"/> </intent-filter> so can try change mime t...

android - Generating new objects from findViewById() method -

i create new xml file (beside main one) in layout folder describe views. my idea use findviewbyid method find view style want (differentiating them id) , generate instance of object. is possible android api means? i feel maybe not 'correct design' choice, save me pain create styles programmatically. i know can create copy method, trying avoid because managing xml files simpler.

c# - Call view javascript function from javascript file -

i have jquery template being loaded values after ajax call done , not on view load. on page load javascript calls , function script.js file. need script.js file call function view. how call listload function script.js var limit = 5, dir = ' desc', sort = 'created', index = 0, autoscroll = false; function getdataurl(index, action) { return '/team/linking/listitemlinks/@model.itemid/?type=@model.itemtype'; } function listload() { alert('test'); } corey, as per understanding, invoke function in js file view , after js file invokes function residing in same view. i think can achieve (by theoritically) because, when page loads, clubs js. consider, if js file points master/layout page , when inner page loads have cumulative js (from page,outside js files , master/layout pages). can call function residing in page js (need verify). i think jquery may have similar kind of stuffs, because calling jquery using external file, ...

ios - I need to format and display specified contents from the URL in webView -

i creating rss feed app , need format feeds in webview , display description . here code: - (void)viewdidload { [super viewdidload]; nsurl *myurl = [nsurl urlwithstring: [self.url stringbyaddingpercentescapesusingencoding: nsutf8stringencoding]]; nsurlrequest *request = [nsurlrequest requestwithurl:myurl]; [self.webview loadrequest:request]; } instead of loading contents of specified url need format , display "description" of rss feed. have parsed data need format in web view . code parsing (prepareforsegue): - (void)prepareforsegue:(uistoryboardsegue *)segue sender:(id)sender { if ([[segue identifier] isequaltostring:@"showdetail"]) { nsindexpath *indexpath = [self.tableview indexpathforselectedrow]; nsstring *string = [feeds[indexpath.row] objectforkey: @"link"]; nslog(@"description : %@" , string); [[segue destinationviewcontroller] setur...

Can we override methods in WCF or web services? -

i want know if can override wcf methods or web service methods. if so, how? try overloading wcf service methods [servicecontract] public interface imycalculator { [operationcontract(name="addfloats")] float add(float operand1, float operand2); [operationcontract(name="addintegers")] int add(int operand1,int operand2); }