Posts

c# - class vs static methods -

i'm new in python (come c#), trying figure out how oop works here. started begining try implement vector class. want have basis vectors (i, j, k) defined in vector class. in c#, can that: public class vector { // fields... public vector(int[] array){ //... } public static vector i(){ return new vector(new int[1, 0, 0]); } } exploring python found 2 ways how implement this: using either @classmethod or @staticmethod : class vector: def __init__(array): #... @classmethod def i(self): return vector([1, 0, 0]) since don't need have access information inside class, should use @classmethod ? i think you've confused naming of arguments bit. first argument class method receives class itself, vector, now, until have subclass. class method implemented this: @classmethod def i(cls): return cls([1, 0, 0]) generally, instance method (no decorator) calls first argument self , ins...

android - Cannot Receive App Intent Type Nearby Notification - Beacons -

i registered beacon (simulated app on android device , of type eddystone-uid) , tried set nearby notifications google beacon platform dashboard. when created notification of type "app intent", not received on device when close 1 acting beacon. however, if set nearby notification of type "web url", displayed on device within range of beacon. when setting notification of type app intent, provide following details: 1. intent scheme (same scheme in code below) 2. package name of app - same what's in app's manifest file left intent path field blank not mandatory. this intent filter in app's manifest: <intent-filter> <action android:name="android.intent.action.main" /> <category android:name="android.intent.category.launcher" /> <category android:name="android.intent.category.default"/> <category android:name="android.intent.categor...

asp.net mvc - C# MVC - Creating and uploading a zip file to FTP -

i creating xml file using following 2 methods: public string getxmlstringfromfeedmodel<t>(t feedmodel) { var builder = new stringbuilder(); using (stringwriter writer = new encodingstringwriter(builder, encoding.utf8)) { xmlserializer serializer = new xmlserializer(typeof(t)); serializer.serialize(writer, feedmodel); return writer.getstringbuilder().tostring(); } } public filecontentresult getxmlfilefromxmlstring(string xmlstring, string filename ) { return new filecontentresult(encoding.utf8.getbytes(xmlstring), "application/xml") { filedownloadname = filename }; } i zip file method public filecontentresult zipfile(filecontentresult file, string filename) { using (var compressedfilestream = new memorystream()) { //create archive , store stream in memory. using (var ziparchive = new ziparchive(compressedfilestream, ziparc...

java - Spring 4.3.10 controller throws Http 400 (Bad Request) whereas Spring 3.1.1 works just fine -

we have legacy code running spring 3.1.1. controller looks this: @requestmapping(value = "/model/save", method = { requestmethod.get, requestmethod.post }, headers = "accept=application/json; charset=utf-8") @responsebody public responsedto save(@requestbody jsonnode jsonproperty, httpservletrequest request, httpservletresponse response) throws servletexception, ioexception { myobject myobject = new objectmapper().readvalue(jsonproperty, myobject.class); // save myobject here ... } right now, controller works expected. i'm in process of upgrading spring 4.3.10. part of task, have latest spring jars , corresponding jackson jars in classpath. time, http 400 (bad request) error. just looking @ legacy code, realized reading jsonnode request body , mapping model saved. changed code this: @requestmapping(value = "/model/save", method = { requestmethod.get, requestmethod.post }, headers = "accept=application/json; charset=u...

Similar Example in Angular UI Grid -

looking similar example of angular ui grid given in http://technoscripts.com/export-html-table/ datatables - png, excel, pdf etc., angular ui grid example has export pdf , csv below content of index.html <head> <script src="angular.min.js"></script> <script src="ui-grid.min.js"></script> <script src="csv.js"></script> <script src="pdfmake.js"></script> <script src="vfs_fonts.js"></script> <link rel="stylesheet" href="ui-grid.min.css" /> </head> <body> <div ng-controller="mainctrl"> <div id="grid" ui-grid="gridoptions" ui-grid-pagination ui-grid-exporter class="grid"></div> </div> <script src="app.js"></script> </body> </html> below content of app.js var app = angular.module('app...

node.js - How can I delete/uninstall everything? I want it to be the same as the time that hadn't started react native learning -

i have been learning reach native weeks. got stuck somewhere , start beginning. need uninstall react, react native, redux, thunk , etc. have node.js. how can delete/uninstall everything? want same time hadn't started react native learning. on windows need go control panel > add remove programs , features > find node.js , uninstall. poof! remove node... far npm packages go, looks stored default in \home\appdata\roaming\npm. delete folder rid of global packages. if have project installed non global (local) project packages need delete node_modules folder in projects folder

hadoop - Hive Dynamic Partition for HDFS file -

i want create external table partition column. partition column dynamic based on application id. for example hdfs folder location is /local/test/log/appid=app1 /local/test/log/appid=app2 /local/test/log/appid=app3 /local/test/log/appid=app4 inside above folders, there multiple log files in csv format. i want create hive external table partition appid, if run below query: select * table appid='app2'; it should return me result. so far, have created hive table, seems not working. here show create table details: create external table `app_log`( `log_time` string comment 'from deserializer', `log_src` string comment 'from deserializer', `log_msg` string comment 'from deserializer') partitioned ( `appid` string) row format serde 'org.apache.hadoop.hive.serde2.opencsvserde' serdeproperties ( 'escapechar'='\\', 'quotechar'='\"', 'separatorchar'=',') stored input...