Posts

Showing posts from August, 2012

django, css working but js not working -

here settings.py, static_url = '/static/' static_root = os.path.join(base_dir, 'static', 'static_root') staticfiles_dirs = ( os.path.join(base_dir, 'static', 'static_dirs'), ) media_root = os.path.join(base_dir, 'static', 'media') media_url = '/media/' and base.html <!doctype html> {% load staticfiles %} <script src="{{ static_url }}js/bootstrap.min.js" type="text/javascript"></script> <script type="text/javascript" src = "{% static 'js/docs.min.js' %}" ></script> please help!! you need jquery bootstrap, also: <script src="{{ static_url }}js/bootstrap.min.js" type="text/javascript"></script> should be <script src="{% static 'js/bootstrap.min.js' %}" type="text/javascript"></script> or <script src='/static/js/bootstrap.min.js&#

Libgdx: Gradle import eclipse only showing root folder instead of projects -

when try import libgdx project eclipse gradle import, instead of showing 5 (-core, -desktop, -android, -ios, -html) finds root folder in 5 in. i've not freshly created project, i've worked on long time , how use gradle. anyone have suggestions on might wrong? thanks viewed! it weird error. resolved after cut project out of workspace, repeated process (then worked). put workspace see if work , in fact did.

symfony - Pagination with OrderBy and Jointure -

Image
i've pagination problem annoying, here repository code: public function listesujetsadmin($forum, $user, $page){ $builder = $this->createquerybuilder('s'); $builder ->andwhere($builder->expr()->eq('s.forum', ':forum')) ->setparameter("forum", $forum->getid()) ->addselect('c') ->leftjoin('s.commentaires', 'c') ->orderby('c.datecreation', 'desc') ->addselect('l') ->leftjoin('s.lectures', 'l', expr\join::with, $builder->expr()->eq('l.user', ':user')) ->setparameter('user', $user->getid()) ->setfirstresult( sujet::max_par_page * ($page-1) ) ->setmaxresults( sujet::max_par_page ); return new paginator($builder); } if keep "->orderby('c.datecreation', 'desc'

Batch file: compare files? -

i have batch file checking files in map. my situation: i have example map on directory a. on directory b have map a. on directory b people working in files, there change files can delete or missing. want compare 2 maps missing files, maybe delete or missing. so comparing must this: directory map :compare-> directory b map a result must be: no changes or missing files! can me? thanks!! assuming have correctly shared remote directory on network, , have configured relevant netbios, tcp/ip settings, , on same subnet mask etc. should work: @echo off net use x: "\\computer-name\path-to-shared-subdirectory" del /q "missing.txt" 2>nul /f "tokens=*" %%i in ('dir /b /a:-d-h x:') ( if not exist "%userprofile%\directory-path\%%i" echo %%i )>>missing.txt pause i may have wrong way around, otherwise be: @echo off net use x: "\\computer-name\path-to-shared-subdirectory" del /q "missing.txt&

Trying to test with jasmine the constructor of a javascript library -

i had javascript code , wanted make reusable , testable i'm trying make library out of it. i've made in form of library i'm not able test constructor using jasmine. my library code looks way: window.menu = (function(){ function menu(){ this.additem('sample'); } menu.prototype.additem(string){ console.log(string); } var menu = function(){ return new menu(); } return menu; }()); now using jasmine, wan't write test testing not content of additem function, constructor, want know additem function called. there similar question here , reason not working me. if write test: describe("menu", function() { it("test constructor", function() { spyon(menu.prototype,'additem'); var newmenu = new menu(); } }); and get: referenceerror: can't find variable: menu in file:///home/whatever/library-test/spec/menuspec.js i don't know why happening, test code wrong or i've chosen bad app

How to synchronize a kernel workqueue thread? -

i'm pretty new linux device drivers , kernel. want synchronize workque thread (lets call a()) function (lets call b()). purpose here fail b when running. currently, have done follows. a(){ active = true; // variable shared b/w both , b ... ... ... active = false; } b(){ if(active){ return -ebusy } } is right way synchronize these 2 functions? there other strategy should follow? for linux-kernel it's bad code. try reading mutex , semaphore . http://www.linuxdevcenter.com/pub/a/linux/2007/05/24/semaphores-in-linux.html?page=5

angularjs - Creating environment independant code with Angular.js -

we using angular bower python api our stack. have multiple environments code runs in - dev, staging, prod, etc. of right now, have manually change connection strings front-end after push fresh code accommodate environment it's in - that's not right way things. elaborate, say, have following hosts front end: www.something.com , www.test-something.com , should connect apisomething.com , test-apisomething.com pull data, respectively. my objective able deploy code of environments without having change values. usually, i'd use environment variables on server side create links, since angular runs in browser, variables can't accessed. not sure how proceed. my research came tutorials using grunt here , here since aren't using grunt, that's not working out. my thought write python script manually generate "constants.js" in same directory app.js file resides (it have run once each environment) , include file git.ignore . script take parameter ,

angularjs - angular filter is date time format-er -

i have angular filter , show wrong time json '2015-04-09t16:30:00' problem show time 2015-04-09 12:30 pm off 4 hour of correct time how can show corect time ? app.filter('formatdateandtime', function () { return function (input){ if (moment.utc(input).local().format('mm/dd/yyyy hh:mm ') === 'invalid date') return ' '; else return moment.utc(input).local().format('mm/dd/yyyy hh:mm '); }; }); the moment.utc(x) call interprets input utc time , .local() outputs in local timezone, 4 hours off. oops, missed part of question getting same time. see ben whitney's answer (use moment(input) instead of moment.utc(input) )

MATLAB Weighted Multiple Regression -

i have set of data includes 821 observations, each 20 measurements. regress set data against set of single dependent variables using multiple linear regression in matlab. however, weight each observation differently in regression based on own calculations. example, give first observation weight of 1 , second observation weight of 1.6, ideally pull regression towards more heavily weighted second observation. is such computation possible in matlab? if so, function(s) best carry out type of computation? thanks help! with statistics toolbox, can use fitlm create linear regression model, applying weights option supply weights. nb in older versions of matlab, you'll need use linearmodel.fit rather fitlm , same thing.

web scraping - How to scrape user's facebook feed using Graph API? -

i'd scrape user's posts facebook. posts visible in browser, when i'm logged in , looking @ http://fb.com/username url. when i'm trying access same feed using graph api explorer ( https://graph.facebook.com/v2.3/username/feed ) i'm getting: "error": { "message": "(#803) cannot query users username (username)", "type": "oauthexception", "code": 803 } if try use id instead of username ( http://graph.facebook.com/v2.3/userid/feed ) i'm getting empty json in response: { "data": [ ] } so, there way user's feed using graph api? or have imitate web browser , parse html then? you not supposed grab feed of user, public or not. need authorize user user_posts access feed - , feed only. also, usernames not available in graph api anymore, need use app scoped id now. when authorize user. btw, scraping not allowed @ all: https://www.facebook.com/apps/site_scrap

Not able to execute javascript inside page that's loaded via jQuery's ajax -

summary... i have page loading other pages ajax , contain javascript. javascript makes use of document.ready doesn't work right when using code this... $.ajax({ type: 'get', url: 'layouts/' + layout + '.php', success: function(data){ $('.swap').fadeout('slow', function(){ // container $(this).delay(100).fadein().html(data); }); } }); it doesn't work right in sense javascript running fast. what's best way load pages make use of document.ready or code it? when use ajax load page, javascript in page typically not executed. can use jquerys load() method load page in , execute scripts. in template page, add <div> hold actual contents of page so: <div id="container"> <ul> <li></li> </ul> </div> in "control panel" page, have container <div> well:

c# - Inject a singleton with parameters -

using ninject, have interface want bind single instance of concrete implementation. example: public interface ifoo { //... } public class foo { //... } now normally, i'd bind like so: kernel.bind<ifoo>().to<foo>().insingletonscope(); but, need add parameters constructor foo . normally, again, wouldn't of problem (i think): kernel.bind<ifoo>() .to<foo>() .insingletonscope() .withconstructorargument("bar", mybar); now problem can't know value of mybar @ time set bindings. need defer until first time need ifoo (and note, in reality have several arguments pass). need singleton, lazy initialized on first use , gets arguments @ point. what's best way approach this? i'm assuming factory solution, don't quite see right way this. don't want create new foo every time. as in comment above. real problem may not have construction parameters when need foo. in pattern can bind interfaces please ,

hdfs - What is the difference between Block, chunk and file split in Hadoop? -

please clarify me 1)what difference between chunk,block , file split in hadoop?? 2)what internal process of $hadoop fs -put command ? block : hdfs talks in terms of blocks eg : if have file of 256 mb , have configured block size 128 mb 2 blocks gets created 256 mb. block size configurable across cluster , file basis also. split : has related map reduce , have option can change split size , means can modify split size greater block size or split size less block size . default if don't configuration split size approximately equal block size . in map reduce processing, number of mapper spawned equal number of splits : file if 10 splits there 10 mappers spawned. when put command being fired , goes namenode , namenode asks client (in case hadoop fs utility behaving client) , break file blocks , per block size , defined in hdfs-site.xml ,namenode ask client write different blocks different data nodes . actual data store on data nodes , meta data of data means file

sql - comparison of joins -

say have table sales called sales columns itemid, storeid, sale, , date i have table called storeregion has columns storeid , region. if want sales in region specific date range: select region, sum(sale) sales s inner join storeregion sr on s.storeid=sr.storeid date between 'whatever' , 'whatever' group region so result this: east|500 west|400 ok cool. now, have table called itemcategory columns itemid , category. want see sales of each category in each region. can this. select sr.region, ic.category, sum(sale) sales s inner join storeregion sr on s.storeid=sr.storeid inner join itemcategory ic on s.itemid=ic.itemid date between 'whatever' , 'whatever' group sr.region group ic.category so result this: east|toys|100 east|books|200 east|games|200 west|toys|300 west|games|100 now want find sales of 1 category in 1 region more 50% of total sales in same region. per example in first query result: west|400 and in secon

openlayers ol3 linestring getLength not returning expected value -

i using getlength retrieve linestring length. for same segment: 1- when using google map measure tool, 228m 2- when using ign geoportail measure tool, 228m 3- when use e.feature.getgeometry().getlength() 330m here flat coordinates: e.feature.getgeometry().getflatcoordinates() : [571382.4214041593, 5723486.068714521, 571593.8175605105, 5723741.65502785] in 4326: [5.132815622245775, 45.644023326845485, 5.134714626228319, 45.64562844964627] when check coordinates position on either ol3 or google map, same points. difference must come calcul... did miss , should not use getlength method? please give me direction if think not issue. geometry.getlength() returns length in map view projection, spherical mercator. spherical mercator distances stretched @ rate of 1/cos(latitude) ; in example: 228/330 ~ cos(45.64) . to real spherical distance: var geometry = feature.getgeometry(); alert (geometry.getlength()); // points of geometry (for simplicity assume 2 points) v

compiler construction - LLVM How to detect when a specific ASM instruction sequence is generated -

i compiling c program using llvm. want know if particular assembly sequence generated , if generated, source code line associated with. example , want log every time push %eax instruction generated. there way approach problem? in case others stumble upon similar problem. the place looked @ llvms backend code. in particular concerned x86 assembly generation. there 2 main areas modify , add tests. asmprinter class @ lib/codegen/asmprinter/asmprinter.cpp has different emit functions deal functions, basic blocks etc. go through them. these functions iterate through each machine instructions mi has functions getoperand() , getopcode() check specific instructions per requirement. each specific opcode , actual instructions specified in target specific files eg. lib/target/x86/x86geninstrinfo.inc the above functions in turn call target specific subclass functions. in case x86asmprinter , similar classes. to poke around add log statments such errs()<<

display the arraylist data on UI as soon as something is added using java -

what trying implementing news feeds kind of functionality.. have listener call function posted user , function give me post , store in arraylist.. now want display post on ui.. can't find perfect way this.. don't want call method or send request every 5 or 10 seconds ui contents in list.. want list updated new post, should displayed on ui.. please me on , let me know if there additional information required..

string - How to count words in a sentence of a text in multiple sentences in python -

i've searched around solution problem haven't found yet. have large text file divided sentences, separated "." need count how many words each sentence has , write file. i'm using separate file part of code , far have tekst = open('father_goriot.txt','r').read() tekst = tekst.split('.') with 'list' type variable each sentence in it's own index. know if write print len(tekst[0].split()) i number of words in first sentence. need kind of loop number of words in each sentence. after need data written file in form: 1. index number of sentence in text, 2. number of words in particular sentence, 3. number of words in same sentence in different text (which translation of first text using code in seperate file), 4. number of words both sentences have in common. ideas? after searching around while , simpler solution i've stumbled upon code gives me partial result of want. number of words in each sentenc

ruby on rails - Rescue nested method call -

Image
i read ruby doesn't have nested rescues. why won't work? begin dosomething rescue => e #this never executed, dosomething raises error directly end def dosomething somemodel.find(-1) #this raises exception instead of above end good day. must read ruby doc exceptions in short: exception - base class exceptions, therefore base code: begin # code rescue exception => e end you should specify exception handle if need proc - use class exception p.s. self education - http://rubylearning.com/satishtalim/ruby_exceptions.html

Get Laravel 5 controller name in view -

our old website css set body tag had id of controller name , class of action name, using zend framework 1. we're switching laravel 5. found way action name through route class, can't find method controller name. don't see in laravel docs this. ideas? this how action. inject route class, , call: $route->getactionname() . i'm looking similar controllers. i've checked entire route class , found nothing. if layout blade template, create view composer injects variables layout. in app/providers/appserviceprovider.php add this: public function boot() { app('view')->composer('layouts.master', function ($view) { $action = app('request')->route()->getaction(); $controller = class_basename($action['controller']); list($controller, $action) = explode('@', $controller); $view->with(compact('controller', 'action')); }); } you have 2 var

C# Compare Two Lists of Different Objects -

this question has answer here: how compare 2 lists of objects based on partial information of property? 3 answers i saw quickest way compare 2 list<> i'm having trouble adapting situation. issue lists of different types. my lists this: list<type1> firstlist; list<type2> secondlist; here have now: foreach (type1 item in firstlist) { if (!secondlist.any(x => x.id == item.id)) { // code executed on each item in firstlist not in secondlist } } foreach (type2 item in secondlist) { if (!firstlist.any(x => x.id == item.id)) { // code executed on each item in secondlist not in firstlist } } this works , all, o(n^2) . there way make more efficient? solution in questions linked above says use .except doesn't take lambda. edit: mentioned above, still being flagged duplicate. not have 2 lists o

twitter bootstrap 3 - Transparency bug IE11 -

ie 11.0.9600.17690 update kb3032359 on computers shows inappropriate transparent areas in response keyboard input in elements formatted bootstrap3 form-control class. this rendering bug triggered use of transparency box-shadow attribute used bootstrap place blue halo around focused control. can resolved adding following class override. .form-control:hover { -webkit-box-shadow: 0px 0px 5px 0px rgba(0,0,255,1); -moz-box-shadow: 0px 0px 5px 0px rgba(0,0,255,1); box-shadow: 0px 0px 4px 0px rgba(0,0,255,1); border-color: #888; } .form-control:focus { -webkit-box-shadow: 0px 0px 5px 0px rgba(0,0,255,1); -moz-box-shadow: 0px 0px 5px 0px rgba(0,0,255,1); box-shadow: 0px 0px 4px 0px rgba(0,0,255,1); border-color: dodgerblue; } the key difference bootstrap style alpha channel set 1 (no transparency). doesn't quite polished transparency, doesn't trigger bug.

c# - How to exclude the child object when saving a parent to EF? -

i have nullable foreign key parent child: public class company { public int? addressid {get;set;} public address address {get;set;} } public class address { public string streetaddress {get;set;} //not nullable in db } when try , save database ef tries save address object despite being null: var company = new company{addressid = null } //other stuff populated matters try { _context.entry(company).state = entitystate.added; _context.savechanges(); } catch (exception exception) { //throws validation error because streetaddress not nullable } i tried these { _context.entry(company).state = entitystate.detached; _context.company.add(company); } { _context.companies.add(company); } both of them still require street address populated. how can ignore nullable children when saving? i have hunch child foreign key non-nullable. try setting property virtual: public virtual address address { get; set; }

html - Why won't my 5 child divs go 100% across the parent div when they are set at 20%? -

i have parent div set 100% width , when set each of 5 children divs 20% each, theoretically each child div should contained inside parent div, rather breaking on second line. i have done before , has worked, isn't working now. it looks - <div class="parent"> <div class="child1"></div> <div class="child2"></div> <div class="child3"></div> <div class="child4"></div> <div class="child5"></div> </div> here link code - http://jsfiddle.net/dtk5zl1e/ i using bootstrap if makes difference. just add common class elements want float , add: <div class="container"> <h1 class="versions">choose versions report</h1> <div class="compare nav"> hello </div> <div class="first-draft n

user interface - Python | How would I put this into multiple threads and allow the GUI to update? -

i'm working on sub alert system gui, problem i'm having gui freezes because i'm running loop checks chat. how incorporate existing gui , chat code system gui won't freeze , textfield update console has. # import resources # import re import socket import importlib tkinter import * modules.irccommands import * recentsub= 'n/a' # close application # def close_window(): frmmain.destroy() # main application # def start(): # list info in shell # terminal.insert('1.0', 'subscriber alert ver. 1.5 | created & modified rubbixcube' + "\n") terminal.insert("end", 'important information:' + "\n") terminal.insert("end", 'host = ' + host + "\n") terminal.insert("end", 'port = ' + str(port) + "\n") c in chan: terminal.insert("end", 'chan = ' + c + "\n") terminal.insert("end", '\n' + "\n") te

SQL Server dense_rank() on nvarchar column -

from this question , possible use dense_rank on nvarchar column? here's sql fiddle created nvarchar column, see results yourself, , here's one column int of course possible. examples quite different. in first, values ordered as: 1 11 2 3 4 5 in second this: 1 2 3 4 5 11 hence, results different. numbers stored strings treated strings, not numbers. edit: there 2 ways "treat nvarchar()" number. first conversion, such as: dense_rank() on (order cast(number decimal)) grp (or whatever type want). the second work if values integers , not have leading zeros: dense_rank() on (order len(number), number) grp

android - Listview filling from database -

good evening , need filling list view mysql database, don't know how becaus i'm beginner in android wanna icon , 3 text views first title bold , second rib , last 1 in bottom , right of list view your question bit generic , not defined. that's why got down voted. i'd best bet start documentation. start reading listview , possibly adapter , try yourself. if still have problems, ask specific question don't understand or can't working. best specific answer can give need define custom adapter create item view want. want layout xml item view.

c - effective parallelisation of bilinear interpolation using OpenMP -

i want parallelise bilinear interpolation using openmp in such way there should least memory access of input array. in code below, each iteration of , j in output array, input data according longitude , latitude values read , processed. input[20][20] - input array contains data values eg{1,2,3,..,400} in 2d lon[100][100] - longitudinal positions of each interpolation point in output array in horizontal axis not equidistant. eg. {2.34,2.65,2.74... } lat[100][100] - latitudinal positions of each interpolation point in output array in vertical axis not equidistant.eg. {5.76,5.92,6.26... } output[100][100] - array containing interpolated values void interpolate(float (*lon)[100] ,float (*lat)[100] , float (*input)[20],float (*output)[100]) { int i,j,floori,floorj; float fractionj,fractioni; for(j = 0; j < 100; j++) { for(i = 0; < 100; i++) { floori = lon[i][j]; fractioni = lon[i][j] - floori; floorj = lat[i][j]; fractionj = l

c++ - How to support complex project configurations in Visual Studio? -

i'm working on project requires whole multi-dimensional matrix of configurations. theres (debug / release / optimised / final), (editor / non-editor), (win32 / win64 / ios / android), (usa / europe / asia) etc. different build targets (ie win32_europe_debug_editor.exe) , own set of libraries, includes, #defines , on. is there way add more dropdowns project configuration toolbar in visual studio? @ moment there's "platforms" , "configurations". i've got win32/win64/ios/android in platforms, there's still dozens of different configurations. "don't set project this" is, unfortunately, out of hands - way contracting company wants it, , we're bound that. i know made lot easier going through msbuild, i'm hoping find out if there's way while @ least partially staying within visual studio interface, that's rest of team used to. it's tricky enough setup is, , i'd minimise amount of cognitive load have take on!

performance - What are the effects of code bloat in C++? -

i can't find other explanation other "it's unnecessarily longer binaries". mean? how having more executable code under hood of program bad? ignoring readability benefits is. for example: template<int a, int b, int c> void dosomething(){ if( == 1 ){ ... } if( b == 1 ){ ... } if( c == 1 ){ ... } } in case there maximum of 3*3=9 possible combinations of way function can execute code, ignoring optimizations of course. so what's big deal? saves me lots of readability headaches , compacts how write.

python - send requests to twitter with `requests` : OpenSSL.SSL.SysCallError: (104, 'Connection reset by peer') -

i'm using python package requests send requests https://mobile.twitter.com/username/following . at first, encounter exception : requests.exceptions.sslerror: [errno 8] _ssl.c:504: eof occurred in violation of protocol. solve that, follow solution write ssladapter specify protocol_tlsv1. after that, encounter exception : requests.exceptions.sslerror: [errno bad handshake] (-1, 'unexpected eof’). and, found this, send request , receive data in same process. and then, use requests send requests https://api.twitter.com/1.1/friends/ids.json . second exception gone(still didn't understand why). encounter third exception : openssl.ssl.syscallerror: (104, 'connection reset peer'). found this in so. , add time.sleep(10) before send requests. third exception still happen. so second , third exception still happen. maybe response content big read? or it's problem of twitter server(some solutions said ). the code send requests https://mobile.twitter.com/us

c++ - Eclipse CDT could not find #include <__debug> -

everything fine last week when click build button c++ project , generate binary , can run program properly. today after updated "command line tools" in app store(btw laptop mac osx 10.10.2), when click build button, generate error message /library/developer/commandlinetools/usr/bin/../include/c++/v1/iterator:341:10: fatal error: '__debug' file not found "#include <__debug>" 1 error generated. and can no longer generate binaries , run program... i didn't change of settings in eclipse. so how can fix problem? ok fixed problem. whoever got problem today after updated cmdt 6.3 version. can download commandlinetoolsosx10.10forxcode6.2.dmg apples developer download page. work fine before.

c++ - How to hide C# warning using project(.csproj) file -

Image
one of c# project uses multiple c++ dlls. need hide warning same project. alink : warning al1073: referenced assembly 'mscorlib.dll' targets different processor i know it can use c# code this using project file. in case need use project file this. in c++ project file, can <link> <additionaloptions> /ignore:xxxx %(additionaloptions)</additionaloptions> </link> i'm no familiar c#. there anyway this? please see 2 posts below https://msdn.microsoft.com/en-us/library/jj715718.aspx https://msdn.microsoft.com/en-us/library/13b90fz7(v=vs.120).aspx right click project -> property -> build tab you can explicitly specify warning hide or lower warning level that.

jquery - How do get data of a row DataTables? -

i started datatable https://www.datatables.net/ . use lasted datatable.i can load data json string via ajax datatable.and want data when click in row .as see datatable debugger @ http://debug.datatables.net/idihol page test.aspx <table id="div_table" class="display cell-border compact" width="100%"> <thead> <tr> <td>no</td> <td>name</td> <td>des</td> <td>lid</td> <td>aid</td> <td>date</td> <td>by</td> </tr> </thead> </table> and script var table = $('#div_table').datatable({ "processing": false, "serverside": false, "ajax": {

java - How to refer a Spinner entry correctly? -

i've been making app android uses spinner list show name of few cities. need program change textview right below spinner display location of selected item in array. wrote following code same public class mainscreen extends activity { string[] cityarray = { "agra ", "ahmedabad", "alappuzha", "amritsar"}; spinner list = (spinner) findviewbyid(r.id.listview1); textview nam = (textview)findviewbyid(r.id.textview2); @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main_screen); arrayadapter adapter = new arrayadapter<string>(this, r.layout.activity_listview, cityarray); list.setadapter(adapter); list.setonitemselectedlistener(new onitemselectedlistener() { @override public void onitemselected(adapterview<?> parentview, view view,int position, long id) { nam.settext(list.getselecteditemposition());

hadoop - Which will give the best performance Hive or Pig or Python Mapreduce with text file and oracle table as source? -

i have below requirements , confused 1 choose high performance. not java developer. comfort hive, pig , python. i using hdp2.1 tez engine. data sources text files(80 gb) , oracle table(15gb). both structured data. heard hive suite structure data , python map reduce streaming concept have high performance hive & pig. please clarify. i using hive , reasons are: need join 2 sources based on 1 column. using orc format table store join results since data size huge text file name used generate 1 output column , has been performed virtual column concept input__file__name field. after join need arithmetic operations on each row , doing via python udf now complete execution time data copy hdfs final result taken 2.30 hrs 4 node cluster using hive , python udf. my questions are: 1) heard java mapreduce faster. true python map reduce streaming concept too? 2) can achieve above functions in python join, retrieval of text file name, compressed data flow orc since volum

How to extract data from Matlab .fig files in Python? -

if have x vs y data saved in matlab .fig file, there way extract data in python? i've tried using method shown in previous discussion , not work me. have tried open files using h5py , pytables, since .mat files hdf5 files now, results in error valid file signature can't found. currently i'm trying anaconda distribution of python 3.4. edit : managed figure out works, don't know why. has me worried might break in future , won't able debug it. if can explain why works, method in old discussion doesn't i'd appreciate it. from scipy.io import loadmat d = loadmat('linear.fig', squeeze_me=true, struct_as_record=false) x = d['hgs_070000'].children.children.properties.xdata y = d['hgs_070000'].children.children.properties.ydata the best way can think of using of matlab-python bridge (such pymatbridge ). you can call matlab code directly on python files , transform data 1 other. use matlab code load fig , extract data ,

java - Can not connect to server with RMI. Failed to retrieve RMIServer stub -

i have created project using spring3 , hibernate4. fails run.the code , root cause provided below. bean.xml (server-side) <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:context="http://www.springframework.org/schema/context" xmlns:tx="http://www.springframework.org/schema/tx" xsi:schemalocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd"> <context:component-scan base-package="com.music" /> <tx:annotation-driven /> <bean id="mbeanexporter" class="com.alcatel.axs.containe

yii before actions for specified action -

i know controller have method called:ccontroller:beforeaction() called before every action in current controller. how make work before "actions"? public function actions(){ return array( //trigger beforeaction action "uploader" 'uploader' => array( 'class' =>'', ), ); } nice question. think there isn't anyway disable running beforeaction on specific action. if have beforeaction inside controller, method run before any action. can instead: protected function beforeaction($action) { if($action->id != "uploader") { //do stuff here } return parent::beforeaction($action); }

objective c - IOS drawing text inside a subview -

Image
im trying draw text on subview, view appearing fine text not, im doing, view have black color, text have white color, text , rect value given in other method: nsstring* sumtext = [[nsstring alloc]initwithformat:@"%0.1f",sum]; cgrect textrect = cgrectmake(chartlocation.x+chartlength+10, chartlocation.y, 20, 20); [self drawtextrect:sumtext inrect:textrect]; -(void)drawtextrect:(nsstring *)sumtext inrect:(cgrect)textrect { uifont* font=[uifont fontwithname:@"arial" size:(20/2)]; uicolor* textcolor = [uicolor whitecolor]; nsmutableparagraphstyle *paragraphstyle = [[nsparagraphstyle defaultparagraphstyle]mutablecopy]; paragraphstyle.alignment = nstextalignmentcenter; nsdictionary* stringattr=@{nsfontattributename:font,nsforegroundcolorattributename:textcolor,nsparagraphstyleattributename:paragraphstyle}; uiview* textview =[[uiview alloc] initwithframe:textrect]; textview.bac

reactjs - Can I mount a React component automatically (like angularjs' direct)? -

update 3 i have been using angularjs several years, , want try reactjs. angularjs can define directive , put node inside html dom, this: <!doctype html> <html> <head> .... </head> <body> <!--helloworld directive--> <hello-world></hello-world> </body> </html> however, in react, knowledge, 1 needs call react.render( <helloworld />, targetelement); to mount component . there way in react mount component automatically? i have created codepen here show idea experiment. main piece of code below: function r() { var classname = 'hello'; if (window[classname]) { var elements = document.getelementsbytagname(classname); angular.foreach(elements, function (element) { react.render(react.createelement(window[classname]), element); }); } settimeout(r, 50); } every 50ms, check if class has been created. if render under element in real dom node <hello> </

python - I get IndexError while still in the range -

i trying read rows of csv file. file looks this col 1, col 2, col3 row11, row12, row13 row21, row22, row23 row31, row32, row33 ... i use following command read rows with open('~/data.csv') f: r = csv.dictreader(f) in range(5): print(list(r)[i]) the output prints first row, give out of index error right after. indexerror traceback (most recent call last) <ipython-input-15-efcc4f8c760d> in <module>() 2 r = csv.dictreader(f) 3 in range(5): ----> 4 print(list(r)[i]) indexerror: list index out of range i'm guessing i'm making silly mistake somewhere, can't spot it. ideas on doing wrong , how fix it? edit: output of print(list(r)) : [{'col 1': 'row11', ' col3': ' row13', ' col 2': ' row12'}, {'col 1': 'row21', ' col3': ' row23', ' col 2': ' row22'}, {'col 1':

maven - How to run my integration test after tomcat deployment in jenkins ? -

i need run project using tomcat (tomcat deploy) 2.after need run integration test using jenkins target : when run jenkins build , project should deploy tomcat server , run integration test in execute shell, enter commands need jenkins execute. rest setup & configuration. please read jenkins wiki building software project. give variables can use in shell script (such java_home).

c# - How i can add Couchbase Documents in a list? -

i'm experimenting couchbase + xamarin.forms trying simple search, showing results in listview i've stuck. :( know how add rows/documents of query in list? public list<visitor> searchrecord (string word) { var viewbyname = db.getview ("byname"); viewbyname.setmap((doc, emit) => { emit (new object[] {doc["first_name"], doc["last_name"]}, doc); }, "2"); var visitorquery = viewbyname.createquery(); visitorquery.startkey = new list<object> {word}; // visitorquery.endkey = new list<object> {word, new dictionary<string, object>()}; visitorquery.limit = 100; var visitors = visitorquery.run(); var visitorlist = new list<visitor> (); foreach (var visitor in visitors) { // visitorlist.add(visitor.document); <-- error. system.console.writeline(visitor.key); } return visitorlist; } i error messages: error cs1501: no overload method add' takes 2

Something wrong with XML Schema <xs:redefine> -

i want redefine complex types existing schema file. when i'm using altova xmlspy reported error. shows: redefining type definition 'address' must extension or restriction of itself. error location: xs:schema / xs:redefine / xs:complextype / xs:complexcontent / xs:extension / @base details src-redefine.5: redefining type definition 'address' must extension or restriction of itself. and source code has have <xs:extension> part in it. <xs:redefine schemalocation="reusable.xsd"> <xs:complextype name="address"> <xs:complexcontent> <xs:extension base="address"> <xs:sequence> <xs:element name="postcode"/> </xs:sequence> </xs:extension> </xs:complexcontent> </xs:complextype> </xs:redefine> i can't figure out what's wrong it. here's source code of schema files.

regex for parsing html page by libcurl in c -

this question has answer here: regex match open tags except xhtml self-contained tags 35 answers can give me regular expression in c parsing html page , extracting url links ? the commenters have pointed obligatory link parsing general html regular expressions. same page has (not linked) answer says well-known subset can parsed regular expressions. i'm that. if looking quick , dirty way list of hyperlinks in website, use \<a [^>]*<href *= *"([^"]+)" which should give link of <a href="..."> tags first grouped sub-expression each match. but: obviously, there no context, regex match links commented out or part of javascript string or part of javascript comment. regexes come in (too) many flavours. regex above works if \< means literal left angle bracket , < means boundary @ beginning of word. the r

Properties in Delphi 2006 and 7 -

tedit looks in dfm of delphi 2006 code. object myedit: tedit alignwithmargins = true left = 15 top = 25 width = 50 height = 20 margins.left = 20 margins.top = 30 margins.bottom = 16 align = alleft anchors = [akleft, aktop, akright, akbottom] explicitwidth = 100 explicitheight = 32 end but properties (like alignwithmargins , margins , align , explicitwidth , explicitheight ) not there in delphi 7. equivalent properties in delphi 7 , above versions? delphi 7 doesn't have properties, nor equivalent ones, because delphi 7 released before delphi 2006. delphi 7 released in 2002 delphi 8 - released in 2003 delphi 2005 - released in 2004 delphi 2006 - released in 2005 delphi programming language if want port code delphi 2006 delphi 7, have delete properties .dfm files.

java - Skip only hostname verification with Apache HttpClient -

i need skip hostname verification httpclient 4.2.1 without changing trustmanager. archived this: httpclient = new defaulthttpclient(a, b); sslsocketfactory socketfactory = (sslsocketfactory) httpclient.getconnectionmanager().getschemeregistry().get("https").getschemesocketfactory(); socketfactory.sethostnameverifier(sslsocketfactory.allow_all_hostname_verifier); ... sethostnameverifier method used deprecated. how can achieve same thing using not deprecated methods? as previous people have said should when have reason so. have closed testing environments , disable hostname verification when absolutely needed. place disabled in application running tests never in application deployed user facing servers. this can accomplished implementing own hostnameverifier. sslcontext sslcontext = sslcontext.getdefault(); hostnameverifier allowall = new hostnameverifier() { @override public boolean verify(string hostname, sslsession session) {

gwt - How can I make my uibinder accept html content not just widgets as content/children -

i have uibinder call use in uibinders. accepts widgets children not directly html. question how make uibinders accept html content g:html or g:htmlpanel not wigets? now: <my:a> <g:html><a href='#'>click me</a></g:html> </my:a> want: <my:a> <a href='#'>click me</a> </my:a> you need implement hashtml interface hassafehtml interface in widget.

cloud - Is it possible to have Docker On VM? -

Image
i thinking whether can have docker on top of guest os. layered blueprint thinking of i have containers run on top of docker , hence feel can address multi-os feature alongside docker please suggest if such implementation possible or not? that looks boot2docker implements already, with: host os windows or mac virtualbox tiny core host docker (meaning, no persistence except /var/lib/docker , noted in answer : use virtualbox extension pack mount guest host home directory) docker

Facing issues in upgrading rails version -

when run bundle install shows : fetching gem metadata https://rubygems.org/........ fetching additional metadata https://rubygems.org/.. resolving dependencies... have requested: rails = 4.2.1 bundle has rails locked @ 4.1.0. try running `bundle update rails` then run: bundle update rails gives: fetching gem metadata https://rubygems.org/........ fetching additional metadata https://rubygems.org/.. resolving dependencies... bundler not find compatible versions gem "railties": in gemfile: devise (>= 0) ruby depends on responders (>= 0) ruby depends on railties (< 4.2, >= 3.2) ruby rails (= 4.2.1) ruby depends on railties (4.2.1) please me out in solving this. in advance. it looks using older version of devise--you'll need update devise version work rails 4.2 ( bundle update devise ). once devise updated 3.4.x, can use railties v4.2.1.

jquery - Bootstrap colums not working properly -

i trying create bootstrap carousel single image sliding. example need. my problem is, want display thumbnail images in bootstrap columns. in case 6 columns. so tried - <div class="container"> <div class="col-sm-12"> <div class="carousel slide" id="mycarousel"> <div class="carousel-inner"> <div class="item active"> <div class="col-sm-2"> <a href="#"><img src="http://lorempixel.com/400/200/sports" class="img-responsive">1</a></div> </div> <div class="item"> <div class="col-sm-2"> <a href="#"><img src="http://lorempixel.com/400/200/" class="img-responsive">2</a></div> </di