Posts

Showing posts from May, 2014

Override a Django generic class-based view widget -

say have basic createview form, this, allow new users register on site: from django.contrib.auth import get_user_model django.http import httpresponse django.views.generic import createview user = get_user_model() class signup(createview): model = user fields = ['first_name', 'last_name', 'email', 'password'] i tried this, , found password field rendered in plain text; how go overriding view uses forms.passwordinput() instead? (i realise it's easiest define form hand, i'm curious how you'd that.) you override get_form() , , modify form change widget on password field: from django import forms class signup(createview): model = user fields = ['first_name', 'last_name', 'email', 'password'] def get_form(self, form_class): form = super(signup, self).get_form(form_class) form.fields['password'].widget = forms.passwordinput() return form b

asp.net mvc - request a javascript variable into razor -

i have problem, request function not working here code razor @{ int = 0; list<abono> ab = model.tolist(); int inicio = convert.toint32(request["inic"]); int fin = convert.toint32(request["ffin"]); var xx = ab.skip(inicio).take(fin); } script var inic=0; var ffin=20; function siguiente() { //debugger; var ini = @html.raw(json.encode(@viewbag.inicio)); var fi=@html.raw(json.encode(@viewbag.fin)); $.post("/reportes/getsiguiente", { fin: fi }, function (data) { var dato = data.dias; //alert(dato); debugger; var inic=dato[0]; var ffin=dato[1]; }); } i traying change razors values. thanks remove @viewbag front of variables.

java - Injecting properties into Spring Rest Controller via XML -

right have spring based restful web-app. i'm new rest , followed tutorials online. built web.xml, rest-servlet.xml uses component-scan tag , loads restcontroller class uses @restcontroller annotation. (all of code posted below) my issue none of these tutorials show me how inject beans controller via applicationcontext.xml. i've found ways inject using annotations, want use xml configuration. in example below have 3 database clients want wired in restcontroller when starts up. any suggestions on how load applicationcontext.xml on startup restcontroller servlet receives correct instances of database clients? web.xml <servlet> <servlet-name>rest</servlet-name> <servlet-class> org.springframework.web.servlet.dispatcherservlet </servlet-class> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>rest</servlet-name> <url-pattern>/*</url-pattern> </servlet-m

java - How should a custom Guice scope be integrated with TestNG? -

we use custom guice scope, @testscoped , of our junit tests lasts single test method, , junit @rule enter , exit scope appropriately. looks this: public class myjunittest { @rule public customrule customrule = new customrule(mymodule.class); @inject private thing thing; @test public void test1() { // use "thing" } @test public void test2() { // assuming "thing" @testscoped, we'll have new instance } } we're starting use testng of our tests in other projects, , we'd have similar pattern. far we've come this: @listeners(customtestnglistener.class) @guice(modules = mymodule.class) public class mytestngtest { @inject private provider<thing> thingprovider; @test public void test1() { thing thing = thingprovider.get(); // use "thing" } @test public void test2() { thing thing = thingprovider.get(); // assuming "thing

php - How to keep logs of your users in Laravel 4? -

i have users table in database lay out : id username firstname lastname email photo as of now, since admin user have admin right , , can create, update, , delete. want allow users have same right me later on. before release feature, want keep track on edit - things doesn't lost, , it's keep history of things. what best practice feature ? know have programming logic in update function in controller function. know have create logs table on database store user_id : make change created_at : when change made old_data: string new_data: string for someone, had experiences feature, can please give me advice ? appreciate concern. thank you. i think best approach problem each action user takes want log should fire event. event::fire('some.event', array(auth::user())); then can register listeners each event , log appropriately. event::listen('some.event', function($user) { // create new item in logs table here. });

node.js - supertest: test the redirection url -

with supertest, can test redirection code 302 var request = require('supertest'); var app = require('../server').app; describe('test route', function(){ it('return 302', function(done){ request(app) .get('/fail_id') .expect(302, done); }); it('redirect /'); }); how can test url objetive redirect ? it('redirect /', function(done){ request(app) .get('/fail_id') .expect('location', /\//, done); });

c# - Linq query from IEnumerable of integers -

i have logical problem within asp.net mvc project. i'm developing social media app looks facebook. got work except 1 thing. the application has table called follow , contains loggedinuser_id , usertofollow_id . have ienumerable of integers contains list of userstofollow_id logged in user, method looks like: public ienumerable<post> postsforflow(int userid, string username) { ienumerable<int> usertofollowid = db.follow.where(a => a.loggedinuser.id == userid).select(b => b.usertofollow.id); return null; } how foreach on integers of posts loggedinuser want follow? can resolve linq query? would work? assuming user has 1 many relationship posts : public ienumerable<post> postsforflow(int userid) { var useridstofollow = db.follow.where(a => a.loggedinuser.id == userid).select(b => b.usertofollow.id); return db.users .where(u => useridstofollow.contains(u.id)) .selectmany(u =&g

javascript - Unrecognised Json object -

i creating simple app user clicks on button , json object returned database. structure of object shown bellow. however, object not recognized , execution failing. ideas why happening? response array php passed js array(2) ( [success] => (bool) true [cnt] => array(2) ( [2014-11-28] => array(2) ( [visits] => (string) 1115 [searches] => null ) [2014-11-29] => array(2) ( [visits] => (string) 493 [searches] => 0 ) ) ) json object { "success":true, "cnt":{ "2014-11-28":{ "visits":"1115", "searches":null }, "2014-11-29":{ "visits":"493", "searches":0 } } } function parsing object $.post(jobk.ajaxurl, data, function (resp) { if (resp.success) { // append rows $.each(resp.cnt, function (datec

rest - Azure Mobile Services Latency -

i noticing latency in rest data first time visit web site being served via azure mobile services. there cache or timeout of connection after set amount of time, because worried user experience while waiting 7-8 seconds data load (and there not lot of data, testing 10 records returned). once first connection made, subsequent visits appear load quickly... if don't visit site while, 7-8 seconds on first load. reason: reason latency "shared" mode . when first call service made, performs "cold start" (initializing , starting virtual server etc) described in question, after while when service not used, put "sleep mode" again. solution: if not want waiting-time, can set service "reserved" mode , forces service active time when not access while. aware requires pay fees.

java - How to compare a variable to see if it's the right class type? -

i've been learning java scratch again since 2 years of rust, , playing around simple random generator code. issue here when user asked wants highest die roll, must number (int) class type. i trying create if statement , compare variable class, rather letting ide stop , show me error message in case user typed letters. here code (it's simplest code ever it's safe i'm new , motivating myself learn java again.) : package firstguy; import java.util.random; import java.util.scanner; public class randomnum { public static void main(string[] args){ random dice = new random(); scanner userin = new scanner(system.in); int number; int highnum; system.out.println("what's highest roll want? \n"); highnum = userin.nextint(); for(int counter=1; counter<= highnum; counter++){ number= 1 + dice.nextint(highnum); system.out.println("this number " + number); } } } i

c# - Entity Framework 4 and Async/TPL/Multi Threaded calls -

i looking advice calling entity framework 4 model using modern tpl (task parallel library). appreciate looks implemented in ef6 not have option upgrade entity framework 6 yet. hoping there within code manage , getting grips tpl. i typically calling loads triggered treeview. however, nature of tree calling data access same entityobject types. doing follows in node expanded event: var synchronizationcontext = taskscheduler.fromcurrentsynchronizationcontext(); task.factory.startnew(() => explorerviewmodel.getcontracts(parentnode.tag project).tolist()) .continuewith(cw => { populatecontracts(parentnode, cw.result); }, synchronizationcontext); where explorerviewmodel.getcontracts call dbcontext. explorerviewmodel single instance within windows form. explorerviewmodel has single dbcontext instance. it throwing following exception: system.argumentexception unhandled user code hresul

java - Get specific characters in a string -

i have string can vary : string filepath = "/this/is/my/file.txt"; i need string other strings information : "/this/is/my" , "file.txt" i tried method failed(crash) : int counter = 0; filepath = "/this/is/my/file.txt"; string filepath2 = filepath.substring(filepath.lastindexof("/") + 1); // return "file.txt" (int = 0; < filepath2.length(); i++) { counter++; // count number of char on filepath2 } string filepath3 = filepath3.substring(filepath.lastindexof("") + counter); // remove "file.txt" filepath2 depending of character numbers on filepath2 backwards anyone know better method? thanks! 12-05 15:53:00.940 11102-11102/br.fwax.paulo.flasher e/androidruntime﹕ fatal exception: main process: br.fwax.paulo.flasher, pid: 11102 java.lang.runtimeexception: unable start activity componentinfo{br.fwax.paulo.flasher/br.fwax.paulo.flasher.mflasher}: java.lan

sql server - Messed up SQL data - Select within update statement -

i accidentally ran query twice , points in database have messed (3000 records). top 4 each result has fixed results points between last , 5th calculated (last 100pts). click here more info i need statement converting sql: points = 100 + ((100 / (numberofresults - 4)) * (numberofresults - positionofresult)) how can select statement refer select , update table separately. doesn't work: update results r1 set r1.points = 100 + ((100/((select top 1 r2.position results r2 r2.date = r1.date , r2.contestid = r1.contestid order r2.position desc)-4) * ((select top 1 r2.position results r2 r2.date = r1.date , r2.contestid = r1.contestid order r2.position desc)-r1.position))) r1.contestid > 11 , r1.position > 4 , r1.position < (select top 1 r2.position results r2 r2.date = r1.date , r2.contestid = r1.contestid order r2.position desc) i pre-calculate top values , store them in temporary table before performing update: select

c++ cli - C++/Cli literal Array Initialization -

i'm trying create constant array in managed c++ , getting stuck. i've searched around haven't come across examples of how this. what i'd equivalent of: const unsigned char myconstarray = {1,2,3,4,5,6}; right i'm staring @ this: literal array<byte>^ myconstarray = gcnew array<byte> { 1,2,3,4,5,6}; which gather not right, since visual studio complains cannot use gcnew in constant expression. not sure go here, appreciated. cheers, david it not work literal because: a data member marked literal must initialized when declared , the value must constant integral, enum, or string type . conversion type of initialization expression type of static const data-member must not require user-defined conversion. literal (c++ component extensions) ...however quite strange literal an equivalent of static const using static const compiles without errors. creating read-only property way return array: ref class test1 { public:

c# - Adding condition to mapping for child collection in Entity Framework 6 similar to NHibernate's "where" -

in nhibernate, there where mapping allows specify condition on property mapping affects how pulled database. example, if wanted implement soft delete , exclude deleted items set, map so: fluentnhibernate // in class parentmap : classmap hasmany(x => x.children).where("isdeleted = 0"); hbm.xml <class name="parent" table="[parents]"> <bag cascade="all" lazy="true" name="children" where="isdeleted = 0"> <!-- rest of map here --> </bag> </class> is there similar in entity framework 6? the closest thing found library called entityframework.filters , allows add global filters properties, doesn't seem work when property collection. to give better example of why mapping necessary, let's have class has collection of objects have recursive child entity relationship (i.e., collection of objects of same type). follow basic structure: public class rep

NullPointer when dynamically creating TableLayout in Android -

i trying add table view in fragment getting nullpointer when try add row layout. tl.addview(tr_headings); looks causing crash. thanks looking @ this! public class historyfragment extends fragment { arraylist<workouts> workout_list; tablelayout tablelayout; public historyfragment() { // required empty public constructor } @override public view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate) { string name = "bench press"; string reps = "10"; string weight = "150"; string comment = "good weight. last rep tough"; simpledateformat df = new simpledateformat("yyyy/mm/dd hh:mm"); date d = new date(); string date = df.format(d); workout_list = new arraylist<workouts>(); for(int = 0; < 10; i++){ workouts workout = new workouts(name, reps, weight, comment, date); workout_list.add(workout); } view rootv

java - Username and Pass code using parallel arrays -

i trying create pass code , username login app designing. @ moment required have 4 users, , 4 separate pass codes relevant each user. code needs run in android emulator. would have simple array structure easy follow? as hristo said, should use hashmap map<string, string> mymap = new hashmap<string, string>(); mymap.put("dmcg", "somepassword"); ... string password = mymap.get("dmcg");

ruby - active model serializer with virtual attribute - Rails 4 -

i making api ror, , need create object virtual attributes , associated object. the problem serializer not kick in when return object virtual attribute. here returned object foo_controller { :id=>280, :virtual=>"y8st07ef7u" :user_id=>280 } :virtual virtual attribute , user_id id of associated table - user. my goal make this { :id=>280, :virtual=>"y8st07ef7u", :user=>{ :id=>280, :name=>'foo' } } foo_controller setting class api::v1::fooscontroller < applicationcontroller foos = foo.all foos.each |foo| foo.set_attribute('y8st07ef7u') end render json: foos.to_json(:methods => :virtual), status: 200 end foo_model setting class foo < activerecord::base belongs_to :user attr_accessor:virtual def set_attribute(path) self.virtual = path end end foo_serializer setting class fooserializer < act

is there any timeout value for socket.gethostbyname(hostname) in python? -

i'm translating hostname ipv4 address using gethostbyname() of socket in python. takes little time show ip address. wondering if there default timeout value each lookup. here's how i'm using socket in program- try: addr = socket.gethostbyname(hostname) except socket.gaierror: addr = "" print hostname+" : "+addr just need add question, there chance can miss ip address? had experience converting large sample of hostname ip address? here entire socket time out file. import socket try: _global_default_timeout = socket._global_default_timeout except attributeerror: _global_default_timeout = object() as can see, global_default_timeout = object() creating empty object. socket.setsocketimeout set default timeout new sockets, if you're not using sockets directly, setting can overwritten. for more, see this answer . edit: follow question, yes. made program involved host name ip address conversion, , did have is

java - Getting an id for existing dir on Drive -

i trying id existing dir on google drive. com.google.api.services.drive.model.about = drive.about().get().execute(); com.google.api.services.drive.drive.children.list list = drive.children().list(about.getrootfolderid()); iterator<entry<string, object>> itr = list.entryset().iterator(); entry<string, object> s; while (itr.hasnext()) { s = itr.next(); system.out.println(s.getkey() + "::" + s.getvalue()); } right code giving output - folderid::0apcebfk-cf2puk9pva which not correct id because have 2 dirs , 3 files in google drive. must missing something, right way id of existing dir. i have seen this question, , helpful if can equivalent java example. using same account's google drive owning app. create list of files , iterate. drive service = new drive.builder(httptransport, jsonfactory, credential1).build(); string query = "'" + about.getrootfolderid() +"' " + "in parents&q

ruby on rails - Adding a Computed Attribute to ActiveResource Resource -

what i'm trying add attribute activeresource resource computer based on other attributes created servers response. further complicating things attributes computation depends on part of has_many association has_many: items. what i'd happen when u = user.find(123) called items retrieved , attribute added user based on computation, example u.blue_item_count. the new attribute need appear when object serialized xml or json. instance u serialize {"id":1, "name":"bob", "blue_item_count":21 }. thanks just define method on user object uses items association. example: class user < activerecord::base has_many :items def blue_item_count items.each |item| ... end end end

C Passing a struct, that contains a struct array -

im trying array of structs contained inside struct eg (struct1.structarray[]) the code looks following: struct bullet{ int x; int y; int exist; int type; }; struct tank{ int x; int alive; int shotsfired; struct bullet shots[50]; }; im trying pass shots[] struct pointer following function. int get_alien_collision(struct bullet *bulletstruct) the line of code im using pass struct follows. a = get_alien_collision(&player.shots[i]) i unable access of data in shots[i] inside function (i confirmed attempting print value of "bulletstruct->x" screen first 20 , 0 when prints fine struct in main()) my full code (on pastebin) main.c , calculations.c incredibly messy , filled lots of bad practices, since first time coding in (what believe c) if want more explicit can use parens, or can make sure passing right thing defining intermediates like: struct bullet currentbullet=player.shots[i]; struct bullet *bp=&curre

angularjs - Test Angular controller calls service function exactly once using Jasmine -

i have following... app.controller('testctrl', function(testservice){ testservice.dosomething(); }); app.service('testservice', function(){ this.dosomething = function(){...}; }); i want use jasmine ensure dosomething called once , once. seem having trouble doing this. also, grabbing controller compiled element this... var element = angular.element('<my-test-directive />'); controller = view.controller('testctrl'); so appreciation if fits sort of formatting update i tried this... describe("testing", function () { var $rootscope, $scope, $compile, testservice, view, $controller; beforeeach(module("app")); function createcontroller() { return $controller('testctrl', { $scope: scope, testservice:testservice }); } function setupscope(_$controller_, _$compile_, _$rootscope_, _testservice_) { $compile = _$compile_; $rootscope = _$rootscop

python - Pickles: Why are they called that? -

i'm surprised such hard answer me find. it's such strange name. why pickles called pickles? http://en.wikipedia.org/wiki/pickle_(python) i understand "pickling" means respect vegetables , understand python concept analogous. but, why choose "pickle" instead of "serialization"? inside joke? there history it? from verb to pickle : vegetables, such cauliflowers, onions, etc, preserved in vinegar, brine, etc it python objects, preserved later use. name taken modula-3 concept , language inspired many python features. see module-3 pickle documentation . i suspect guido picked name because: it better first name thought of ( flatten , see this old usenet post announcing it ) funny names better drab ones, in tradition monty python background of language there nice alliteration going on there p's ( p ython p ickles) you put pickles (in jars) on shelve , module added library in same commit . if ever hold of guido&#

c - Compilers C99 GNU99 -

any appreciated. in advance i not able use functions in time.h inside kernel.cl file my main.cpp able use includes. my time.h is /usr/include , have tried using std=gnu99 , somehow still thinking using c99 my kernel.cl has #include "time.h" #define _posix_c_source >= 199309l**** ..... ..... struct timespec tp_start, tp_end; clock_gettime(clock_monotonic, &tp_start); and errors are g++ -c -o3 -fopenmp -i/usr/include main.cpp echo compiling main.cpp compiling main.cpp cl6x -mv6600 --abi=eabi -i/include -i/usr/share/ti/cgt-c6x/include -i/usr/share/ti/opencl -i/usr/include -c -o3 ccode.c echo compiling ccode.c compiling ccode.c clocl -i/usr/include -std=gnu99 kernel.cl ccode.obj kernel.cl:50:17: error: variable has incomplete type 'struct timespec' kernel.cl:50:8: note: forward declaration of 'struct timespec'

google calendar v3 api with OAuth 2.0 service account return empty result -

i got 0 results calendar eventsresource.listrequest serviceaccountcredential. , same code works usercredential. don't exception or error, events.items count 0 when try auth key.p12 file. i set api client access https://www.googleapis.com/auth/calendar on clientid of service account in domain admin security setting. any ideas? thanks --------------------------------here code: static usercredential getusercredential() { usercredential credential; using (var stream = new filestream(@"client_secrets.json", filemode.open, fileaccess.read)) { credential = googlewebauthorizationbroker.authorizeasync( googleclientsecrets.load(stream).secrets, new[] { calendarservice.scope.calendarreadonly }, "user", cancellationtoken.none, new filedatastore("carol test")).result; } return credential; } static serviceaccountcredential getserviceaccou

size - Best practice for sending large messages on ServiceBus -

we need send large messages on servicebus topics. current size around 10mb. our initial take save temporary file in blobstorage , send message reference blob. file compressed save upload time. works fine. today read article: http://geekswithblogs.net/asmith/archive/2012/04/10/149275.aspx suggestion there split message in smaller chunks , on receiving side aggregate them again. i can admit "cleaner approach", avoiding roundtrip blobstore. on other hand prefer keep things simple. splitting mechanism introduces increased complexity. mean there must have been reason why didn't include in servicebus beginning ... has tried splitting approach in real life situation? are there better patterns? i wrote blog article while ago, intention implement splitter , aggregator patterns using service bus. found question chance when searching better alternative. i agree simplest approach may use blob storage store message body, , send reference in message. scenario

Python - reading data from one file and selectively writing to a new file -

thanks in advance help. i'm new @ python, , trying convert file 1 format another. here code have: fs = open('sample_data.txt','r') fnew = open('sample_output.txt','w') fs f: while true: line = f.readline() if line , line[0]=='#': print(line) fnew.write(line + '\n') else: data=line.split() fnew.write(data[0]) if not line: break print('end of program') fs.close fnew.close the basic format of file contains commented headers @ top followed lines of data. the issue i'm having fnew.write(data[0]) line. following error: indexerror: list index out of range the line split breaks 8 columns of data, of want remove first two. so, ultimately, want rewrite entire file minus first 2 columns. there few more complicated reformatting need do, i'm hoping if can understand error in step, may figure out how rest. -------------- up

java - Read/Write to a .txt file from JAR -

currently i'm developing java application carry out survey. want read/write .txt file, creating .csv store inputted data. below code have used far write data - of course makes jar file not portable has absolute path. file file = new file("c:/files/javaapp/src/text.text/"); filewriter fw = null; bufferedwriter bw = null; try { fw = new filewriter(file, true); } catch (ioexception e) { system.out.println(e.getmessage()); } bw = new bufferedwriter(fw); try { bw.write("blah" + ","); } catch (ioexception e) { system.out.println(e.getmessage()); } try { bw.newline(); } catch (ioexception e) { system.out.println(e.getmessage()); } try { bw.close(); } catch (ioexception e) { system.out.println(e.getmessage()); } i have tried several methods such classname.class.getresource("text.text"); return reflection or nullpointer error. i know writing file within jar pose problems, meaning have point file outside read

android - NoSuchPropertyException in signed build -

i animating map marker via following code: final property<marker, latlng> property = property.of(marker.class, latlng.class, "position"); final objectanimator animator = objectanimator.ofobject(othermarker, property, typeevaluator, tolatlng); this works fine in debug build fails following stack trace in signed build: 0 android.util.nosuchpropertyexception: no accessor method or field found property name position 1 @ android.util.reflectiveproperty.<init>(reflectiveproperty.java:71) 2 @ android.util.property.of(property.java:55) 3 @ com.myapp.fragment.mapwrapperfragment.j(mapwrapperfragment.java:1090) 4 @ com.myapp.activitya.l(activitya.java:860) 5 @ com.myapp.fragment.fragmenta$22.onclick(fragmenta.java:377) 6 @ android.view.view.performclick(view.java:4438) 7 @ android.view.view$performclick.run(view.java:18422) 8 @ android.os.handler.handlecallback(handler.java:733) 9 @ android.os.handler.dispatchmessage(ha

c# - Entity Framework/LINQ - Returning data transfer objects from a large nested entity data set -

i using webapi , entity framework build rest api points large mssql database (~200 tables). database normalized, retrieving values useful consumer of api requires lot of drilling down tables. in order return useful data consumer, have taken approach of building models (or dtos) using factory pattern. however, noticed though data being returned in nice format, there performance issues due lazy loading being enabled. in short, querying data while returning data needed. so resorted turning off lazy loading , have attempted grab data explicitly using include methods: var accessions = db.accessionparties .include(ap => ap.accession.accessionparties.select(ap2 => ap2.party)) .include(ap => ap.accession.accessionparties.select(ap2 => ap2.accessionpartypurposes.select (app => app.partyaccessionpurposetype))) .include(ap => ap.accession.accessionanimals.select(x => x.animalinformationtype)) .include(ap => ap.accession.accessionanimals.select(x =&

regex - How to remove the first characters from strings? -

before : c3a848415acf99bd656edb67fe6f4473 md5 : d7sanne1949 8c20ef279947aa107e6e8043a3cb0975 md5 : b0angela 1edd31297ccb89b719e998e11b0f14d1 md5 : 6dviv13 ed3fcef597fd4f33cd2785f31a992bcf md5 : 9barmagh98 2d078a00ce2cf322948d87be7cbe7979 md5 : 13tmart123 after : d7sanne1949 b0angela 6dviv13 9barmagh98 13tmart123 how remove c3a848415acf99bd656edb67fe6f4473 md5 : , 8c20ef279947aa107e6e8043a3cb0975 md5 , etc ? java examples for: string s = "c3a848415acf99bd656edb67fe6f4473 md5 : d7sanne1949"; without regex : system.out.println(s.substring(39)); or (according kent's comment): system.out.println(s.split(" ")[3]); using regex : system.out.println(s.replaceall(".* md5 : ", "")); or system.out.println(s.replaceall("[0-9|a-f]+ md5 : ", "")); or system.out.println(s.replaceall("[0-9|a-f]{32} md5 : ", ""));

slowcheetah transformation on non-web/app.config file that do not reside in application root -

i have web application has config folder containing several custom config files. set of these custom files slowcheetah transformation. but, slowcheetah create config folder under bin folder , put transformed file there. original untransformed config file(s) sitting in config folder , gets deployed. does have 'workaround' can hook slowcheetah transformed config file gets deployed original folder. i don't want aftertargets=transformallfiles copy bin\config folder original config folder because not want overwrite "original" untransformed file everytime build.

xml - Which is the Real XMLSS? -

i'm working reading spreadsheet file exported web application we're developing. developer worked on export function informed me format xmlss. this abridged sample of our application exports: <?xml version="1.0"?> <ss:workbook xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet"> <ss:styles> <ss:style ss:id="1"> <ss:font ss:bold="1"/> </ss:style> </ss:styles> <ss:worksheet ss:name="sheet1"> <ss:table> <ss:row ss:styleid="1"> <ss:cell> <ss:data ss:type="string">challenge id</ss:data> </ss:cell> <ss:cell> <ss:data ss:type="string">challenge name</ss:data> </ss:cell> <ss:cell> <ss:data ss:type="string">challenge date/time (local)</ss:data> </ss:cell

asp.net mvc - Client-Side Validation with MVC -

i need create multi-step wizard using asp.net mvc. after thinking while, feel efficient solution put content wizard steps in single view, , step through them hiding , showing elements using jquery. but 1 area i'm not totally @ ease mvc validation. how validate each step way? seems won't know sure if data valid until final step completed , entire page posted server. any suggestions? you can validate individual controls using validator.element(element) - see documentation here . example of approach think taking in this answer

How to rename a file with string format in C#? -

this situation: created new file name using string format like: string newfilename = string.format("{0}/{1}/{2}/{3}.txt", fileinfo.year, fileinfo.month, fileinfo.day, fileinfo.time); and have another(old) file path: string path = @"c:\users\public\filename.txt" change or move old --> new. how that? possible change path of new? there can me. in advance string path = @"c:\users\public\filename.txt"; if (file.exists(path)) file.move(path, "destinationfilepath");

javascript - How to draw images on circles -

i've drawn 2 circles on canvas (one velocity , 1 controls) , i've been trying draw image on each of them, have no clue how this. i've uploaded images. know how? also, know why velocity x keys red circle aren't working? code: http://jsbin.com/vawitiziro/4/edit here updated jsbin: http://jsbin.com/tibuxezaca/5/edit 1) use context.clip drawing images in custom path: context.clip(); var w = imageobject.width || 0; var h = imageobject.height || 0; context.drawimage(imageobject, circle.x - (w / 2), circle.y - (h / 2)); 2) update x velocity in update function circle.x += circle.vx;

javascript - Footer Only sticks to bottom of SCREEN not content -

this question has answer here: footer @ bottom of page or content, whichever lower 3 answers i start saying, posting because response on website not @ regarding topic, solutions given i've tried , have not worked. (if have missed 1 apologize) link: nova.it.rit.edu/~whateverokay/index.php i have tried: making wrapper position relative , adding padding bottom not help. making footer position absolute, not help. goes bottom of screen not content. , therefore covers bunch of content. i have read these: matthewjamestaylor.com/blog/keeping-footers-at-the-bottom-of-the-page wordpress.org/support/topic/fixed-footer-covering-content webdeveloper.com/forum/showthread.php?202513-position-footer-at-bottom-regardless-of-content-height any question related on website. and few others cannot recall , yes sticky footer of sites linked (cssstickyfooter.com/) basi

php - how to aggregate data by age for rows spanning across different timeline -

i have huge table on 10,00,000 rows , growing. data looks this id topic_id publish_date hits ------------------------------------------------- 1 1 2014-01-01 20 2 1 2014-01-01 10 3 1 2014-01-03 10 4 2 2014-01-10 50 5 2 2014-01-15 100 ... ... i have table topics id, name, start_date, end_date. i need retrieve hit data table daywise hits each topic. enable me compare performance on each day eg: topic -> 1 2 day 1 x y 2 y 3 z b so on. i hope made proper explanation. what trying is: select report.topic_id, topic.start_date, sum(if( datediff(report.hits , en.start_date) = 0, hit,0)) d0 ,sum(if( datediff(report.hits , en.start_date) = 1, hit,0)) d1 ,sum(if( datediff(report.hits , en.start_date

iOS Xcode Custom Keyboard Extension advanceToNextInputMode() Not Working in UITabViewController -

Image
i using uitabcontrollerview via storyboard in custom keyboard app extension swift. there no exceptions when debug , unable switch next keyboard calling advancetonextinputmode(). here structure. i attempted adding advancetonextinputmode() call didappear function created uibutton. neither works. thank you i found in identity inspector of tabbaritem use switch keyboards had set uiviewcontroller. after switching uiinputviewcontroller worked fine.

html - Just started with Java, I think I need to include new classes. -

i added new classes end of xcode java project creator , firefox says doesn't support java won't load of options, may or may not correctly formatted. i'm sure should including new classes have suggestions. i've studied basics , websites i'm trying use learn java limited or technically down @ moment. i've tried convert html think online converters outdated. there anyway generate html java codes program render somewhat? // // hovercraft.java // hovercraft // // created getting nifty on 12/5/14. // copyright (c) 2014 __mycompanyname__. rights reserved. // // simple signed java applet // import java.awt.*; import java.applet.*; import javax.swing.*; public class hovercraft extends japplet { static final string message = "hello world!"; private font font = new font("serif", font.italic + font.bold, 36); public void init() { // set default , feel string laf = uimanager.getsystemlookandfeelclassname(); try {

r - Cannot get verbose=FALSE working for "joinCountryData2Map" -

i using 'r presentation' r studio create slide show project. using below code , whatever not able rid of output message code. not want progress message included in presentation slide. i have below portion of code in different chunk , did not me either. cleared cache , tried stuffs, not rid of progress message. any idea how rid of output message ? spdf <- joincountrydata2map(subset(world_all, year==year.list[i]),joincode = "iso3 ,namejoincolumn = "country_code" , mapresolution = "coarse",verbose=false) it generates below output message , not want show in presentation slide 154 codes data matched countries in map 0 codes data failed match country code in map 90 codes map weren't represented in data that did not work either. went source code of function , found "cat" command being used print messages. so, muted cat command output using below method , , worked !! capture.output( 'the whole functio

ruby on rails - Omniauth Callback -

im using devise rails 4 app. authenticate facebook, linkedin , email. i've started use figaro , change have made code swap password use email account out of production.rb application.yml file. now, when test linkedin registration link, error saying went wrong (after pressing "register linkedin"). same error when try authenticate other options. i have callback error in omniauth callback controller linkedin. line problem '@user.send_admin_email' below: def linkedin @user = user.find_for_linkedin_oauth(request.env["omniauth.auth"]) if @user.persisted? @user.send_admin_mail redirect_to root_path, :event => :authentication # sign_in_and_redirect @user, :event => :authentication #this throw if @user not activated # set_flash_message(:notice, :success, :kind => "linkedin") if is_navigational_format? else session["devise.linkedin_data"] = request.env["omn

java - Performance of nested loop vs hard coded matrix multiplication -

i reading book on 2d game programming , being walked through 3x3 matrix class linear transformations. author has written method multiplying 2 3x3 matrices follows. public matrix3x3f mul(matrix3x3f m1) { return new matrix3x3f(new float[][] { { this.m[0][0] * m1.m[0][0] // m[0,0] + this.m[0][1] * m1.m[1][0] + this.m[0][2] * m1.m[2][0], this.m[0][0] * m1.m[0][1] // m[0,1] + this.m[0][1] * m1.m[1][1] + this.m[0][2] * m1.m[2][1], this.m[0][0] * m1.m[0][2] // m[0,2] + this.m[0][1] * m1.m[1][2] + this.m[0][2] * m1.m[2][2], }, { this.m[1][0] * m1.m[0][0] // m[1,0] + this.m[1][1] * m1.m[1][0] + this.m[1][2] * m1.m[2][0], this.m[1][0] * m1.m[0][1] // m[1,1] + this.m[1][1] * m1.m[1][1] + this.m[1][2] * m1.m[2][1], this.m[1][0] * m1.m[0][2]

How to rerun only failed tests with FitNesse? -

i unable figure out how filter out tests based on run statuses in fitnesse. i'm commenting out passed tests manually next run can ignore them. how can rerun failed tests? there no feature in fitnesse this. want keep running passed tests ensure nothing has caused them break.

python - How to set array into float32 data type (need to be compatible with append)? -

i ran problem float 32 arrays. basically, have defined function , want produce series of results in array forms, called "apoints" in following code. found if use array([],numpy.float32), append commands, 'numpy.ndarray' object has no attribute 'append' . does know do? many thanks! ### here code, , apoints result in 64 bits, not 32. def f(n): s = np.float32(0) n in arange(1,n+1,1,dtype=np.float32): #for upward summation #print s s = np.float32(np.float32(s) + np.float32(np.float32(1.0)/(np.float32((np.float32(n)*np.float32(n)))))) return np.float32(np.float32(abs(np.float32((np.float32(s)-np.float32(r)))))/np.float32(r)) npoints = [] apoints = [] hpoints = [] npoints = arange(10,1000,20,dtype=np.float32) n in npoints: apoints.append(np.float32(f(n))) hpoints.append(np.float32(np.float32(1.0)/(np.float32(n)))) print apoints 'numpy.ndarray' object has no attribute 'append&

node.js - HTTP requests makes server hang -

i trying build rest api in expressjs, far i've had lot of trouble generating json responses. if send new record post requests 1 of endpoints, gets inserted database, server keeps hanging , doesnt respond. likewise, if make request 1 of resources, nothing happens, server hangs again. routes file: 'use strict' calendar = require './models/calendar' module.exports = (app, express) -> router = express.router() # log http requests console router.use (req, res, next) -> console.log req.method, req.url next() # calendar routes router.get '/calendars', (req, res) -> calendar.find (err, calendars) -> if err res.send(err) res.json(calendars) router.post '/calendars', (req, res) -> calendar = new calendar calendar.name = req.body.name calendar.save (err, calendar) -> if err next(err) res.json(200, calendar) # namespace api app.use('/api', router) ser