Posts

Showing posts from March, 2011

c# - How to Display Contact List in Windows Phone 8? -

Image
i want create contact list similar picture below ,along indication of alphabet appears on scrolling contact list. please me how or reference link. you can thng : contacts contacts = new contacts(); contacts.searchcompleted += new eventhandler<contactssearcheventargs>(contacts_searchcompleted); contacts.searchasync(string.empty, filterkind.displayname,null); then can access properties of contacts want

c - MPLAB using external scientific library -

i using microcontroller microchip , using mplab ide tool. solve matrix problem called eigenvalues , eigenvectors of non symmetric 6x6 , 3x3 matrix. based on this wikipedia article have quite option choosing scientific libraries based on c code. mplab has it's own gcc compiler called xc32-gcc 32bit microcontrollers. choose gnu-gsl library, , did solve problem on ubuntu 14.04, need same on microcontroller. question how can compile , use library mplab. is there easy way or other peace of c code being able solve eigenvalues , eigenvectors? also xc32 compiler using c98 standard, complex numbers has manually calculated.

hadoop - What services can I turn off to trigger a second application attempt? -

hadoop yarn includes configuration modify how many times application can started: yarn.resourcemanager.am.max-attempts . i interested in hitting limit observe how system may fail, , want able without modifying code. mimic production scenarios, turn off other hadoop services cause second attempt of application. what services can turn off during application run trigger application attempt? for simplicity, close storage services(hosting source data or target data). example, hdfs service, hive service, etc.

jquery setting session in asp.net -

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

converted SVG is not displaying in android canvas -

i have eps image files. have converted .svg online converter nut converted svg not getting displayed on screen. (code works other original svg image). is there can not use converted svg images in android apps? here code: public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.main); view = new gestureimageview(this); svgimg=svgparser.getsvgfromresource(getresources(),r.raw.american); view.setimagedrawable(svgimg.createpicturedrawable()); view.setlayoutparams(params); view.setmaxscale(15f); viewgroup layout = (viewgroup) findviewbyid(r.id.layout); layout.addview(view); } i suggest not use svg android not support svg rasterization, may read more discussion here . but if got stick svg here useful solutions may you. scaling svgs in android is there lite svg viewer android svg image files android here beautiful tutorials display svg in android

Random text to fade -

how random text fade, text1 text2 ? my code follows: -(ibaction)generatenumbers; { int randomnumber = arc4random() % 1; switch (randomnumber) { case 0: label.text = @"text1"; break; case 1: label.text = @"text2"; break; default: break; } } -(ibaction)generatenumbers; { int randomnumber = arc4random() % 2; switch (randomnumber) { case 0: label.text = @"text1"; break; case 1: label.text = @"text2"; break; default: break; } } for fadein/out use methods - (void) settextwithfade { [label setalpha:1]; [uiview beginanimations:nil context:nil]; [uiview setanimationduration:1]; [uiview setanimationdelegate:self]; [uiview setanimationdidstopselector:@selector(fadedidstop)]; [lbl setalpha:0]; [uiview commitanimations]; } - (void)fadedidstop { label.text = @"new text"; [uiview begin

Event execute simultaneously or continuously in Javascript? -

i have action event click on button in javascript. if click button 2 times, function handler of action perform simultaneously or sequence? (the time between 2 click faster function handler execution time). your functions never run in parallel. when event occurs, user thread awoken execute registered handler , when function finishes may other function called. if don't use webworkers, never have 2 of functions running @ same time in page.

asp.net mvc 4 - MVC Partial views rendering cached version -

for whatever reason, whenever build project, changes i've made view not html not displayed. instead pulls info partial view (which in our application doesn't updated when make change in view). every time build project, application serves me partial view , have go each view made changes in , make sort of html change in order changes made prior build display. eventually, functionality change, right boss doesn't want mess yet. i've tried disabling cache in chrome's dom (f12) downloading extension force page not display chached versions of pages doesn't seem help. else can until partial views removed properly? update: i kinda goofed on title. whats happening generated files being served me localhost rather changes made view (html or otherwise), if made changes prior build. so in view i'd have this: <body> <div>hello world!</div <div><h2>sample text</h2></div> </body> <script> $(document).ready(

javascript - How to use $state.go on ng-submit -

i have search form on results page small search app built using angularjs , elasticsearch. started using ui-router ngroute , need figure out how use $state.go() on ng-submit button search form return results on results page. ui router config $stateprovider .state('search', { url: '/', views: { '': {templateurl: 'templates/search.html'},//parent view 'navbar@search': {templateurl: 'templates/navbar.html', controller: 'typeaheadctrl'}, 'searchdisplay@search': {templateurl: 'templates/results.html', controller: 'typeaheadctrl'}, 'pagination@search': {templateurl: 'templates/pagination.html', controller: 'typeaheadctrl'} } }) search form <form ng-submit="search()" class="navbar-form" id="global-search" role="search"> <div class="input-group"> <input type="text"

java 8 - using lambdas makes JSF to crash -

i have found unexpected behaviour need solve. if use lambdas in getter of managed-bean of current view, following error: javax.el.propertynotfoundexception: target unreachable, identifier 'logbookoperationsbean' resolved null viewid=/logbookoperations.xhtml .... phaseid=process_validations(3) caused by: javax.el.propertynotfoundexception - target unreachable, identifier 'logbookoperationsbean' resolved null @ org.apache.el.parser.astvalue.gettarget(astvalue.java:74) by using line: if (collectionutils.isnotempty(changes)) { changes.stream().foreach((element) -> system.out.println(element)); } when remove lambda , replace 'old' version: changes.stream().foreach(new consumer<treenode>() { @override public void accept(final treenode element) { system.out.println(element); } }); everything works fine. any ideas why? i using tomcat 8 , jre1.8.0_71

d3.js - How to do transition as expected with axis in D3 -

all: i pretty new d3 transition, wonder how can not apply length transition on axis tick lines when switch data? my code like: var data1 = [1,2,3,4] var data2 = [1,4,8,12] function draw(data){ var svg = d3.select(".chart svg"); if(svg.empty()){ svg = d3.select(".chart") .append("svg"); svg.append("g") .classed("yaxis", true) } svg.attr("width", 400) .attr("height", 300); var axisg = svg.select("g.yaxis") .attr("transform", function(){ return "translate(40, 20)"; }) var scale = d3.scale.linear(); scale.domain(d3.extent(data)).range([300-40, 0]); var axis = d3.svg.axis(); axis.scale(scale).orient("left")/*.ticks(5)*/; axisg.transition().duration(1500).ease("sin-in-out").call(axis) .selectall("line") .attr("x2", 300-40) .style("stroke", "black") .sty

Determining if string contains same word more than once using Python? -

i have strings owner names , need identify whether contain last name twice. for example, may have owner name reads " bennett mccarl & arnette bennett ". i return true if word found in string twice, , false if words in string unique. does know how can using python? def check(name): words = name.split() return (len(words) > len(set(words))) you can split name word list spaces, , transform list set. length become shorter after duplicated words has been eliminated.

jsf 2 - change selected item of selectonemenu primefaces by managedbean of javascript -

i want change selected value of selectonemenu either managed bean or javascript: <p:selectonemenu id="edit-article-famille" widgetvar="editfamille" required="true" requiredmessage="veuillez choisir une famille" value="#{articlesmb.selectedfamille}"> <f:selectitem itemlabel="selectionner famille" itemvalue=""/> <f:selectitems value="#{articlesmb.listfamilles}"/> </p:selectonemenu> how can it? in primefaces user guide, don't talk that. you can set value of p:selectonemenu widgetvar in javascript: editfamille.selectvalue(value); value value of selectitem . or in more recent versions of primefaces via pf('editfamille').selectvalue(value)

c# - Rounding a specific Hour in LINQ to Entities -

i wonder how following sql code can converted linq . declare @t table( hour datetime ) insert @t select '19000101 14:38:12' union select '19000101 09:21:55' select hour, case when datepart( minute, hour ) >= 30 left(convert(varchar, dateadd( hour, 1, hour ) , 108),2)+':00:00' else left(convert(varchar, hour , 108),2)+':00:00' end @t my current query is: list<registrovehiculo> listaregistrovehiculocompleta = (from r in db.registrovehiculo r.idpersona == opersona.id && r.tiporegistro == "s" && ( (ohoraextrageneral.fechadesde <= r.fecharegistro && r.fecharegistro <= ohoraextrageneral.fechahasta) || (ohoraextrageneral.fechadesde <= r.fechaentrada && r.fechaentrada <= ohoraextrageneral.fechahasta) ) orderby r.fecharegistro select r).tolist<registrovehiculo>(); how can make list rounded

sql - Retrieving values from 3 tables -

i have 3 tables: consumer has fields cons_id_no, key_id bm_bill has fields key_id, bill_id_no, amt_payable, bill_date (it contain of bill amounts , date of consumer) mreceipt has fields key_id, receipt_no, amt_paid, fine, pay_date (it contain of payment details of consumer) the consumer table has 1 many relationship bm_bill , mreceipt. want create ledger information of consumer based on cons_id_no. should contain cons_id_no, key_id, bill_id_no (latest), bill_date (latest), amt_payable (latest),receipt_no (latest), amt_paid (latest), fine (latest), pay_date (latest) , have created below query i have asked question here , found out 1 solution that, still not enough retrieving whole data tables of bills , payments. per tip got there, have reached solution, follows: first of created type: create or replace type key_id_row object ( key_id number(10) ); then created table type: create or replace type key_id_tab table of key_id_row; then created func

linux - Generate .NET documentation using Sandcastle HelpFileBuilder on ubuntu using xbuild -

i have travis ci workflow setup build sandcastle project. when running xbuild, error given below. can help? i using ubuntu 14.04.3 lts . $ xbuild sandcastlearm.shfbproj xbuild engine version 12.0 mono, version 4.0.5.0 copyright (c) 2005-2013 various mono authors build started 2/2/2016 10:41:37 pm. project "/home/travis/build/vivsriaus/armdoc/sdk/dotnet/src/resourcemanagement/resource/microsoft.azure.resourcemanager/bin/debug/dnxcore50/sandcastlearm.shfbproj" (default target(s)): target corebuildhelp: shfb: warning bht0001: unable executing project: unable obtain matching project global collection. specified project loaded command line property overrides ignored. shfb: error bht0002: unable build project '/home/travis/build/vivsriaus/armdoc/sdk/dotnet/src/resourcemanagement/resource/microsoft.azure.resourcemanager/bin/debug/dnxcore50/sandcastlearm.shfbproj': system.notimplementedexception: requested feature not implemented. @ microsoft.build.evaluation.projec

c# - Composition Root in MVVM DDD application -

so, answer should pretty simple: mark seemann wrote here : a composition root (preferably) unique location in application modules composed together. ( ... ) in wpf applications it's application.onstartup method i'm not sure onstartup method though. let's have application consisting of these projects dependencies: domain <- app services <- wpf client (viewmodels pcl <- executable wpf client views) mvvm pattern says business logic should proceeded in viewmodel. (edit: ahh, put in wrong words:/ meant is: when have business logic (in domain) in class game, , has method move returns true if move finished game - don't need game in view. need command - movecommand , game in viewmodel. , view should know command ) . view should know command, viewmodel has performed. basically, view should know viewmodel. knowledge domain useless in view. so question is: mvvm approach should take? i want keep best practices , create every object in composition root

c++ - Post constructor initialization -

i have set of objects derived common base, apiobject . need able register apiobjects in separate data structure, need have actual address of object being created, not base class (i'm using multiple inheritance). i can't put code register object in apiobject constructor, because not know address of derived object; nor can put in derived classes' constructors, because have no way of knowing whether constructing derived class (e.g. if class b inherited a , , both can constructed). so option see explicitly call registration function every time create object, in b* b = new b(...); registerobject(b); however, doesn't seem solution, have remember call function every time. i suppose should give more context explain why i'm doing this. objects created via overloaded new operator, , needs object know context created in (lua state). e.g. foo* object = new(l) foo(...); // foo derived apiobject, , want apiobject have reference l currently done in unelegant wa

javascript - Get the value that was just selected from a jQuery Chosen multiple select element -

i using jquery chosen convert select multiple select. when choose second item, gives me both selected items when $(this).val() . i want value item select @ moment. following code. $("#languageid").chosen().on("change",function() { alert($(this).val()); }); html: <select id="languageid" multiple > <option value="hindi">hindi</option> <option value="english">english</option> </select> according the documentation : chosen triggers standard dom event whenever selection made (it sends selected or deselected parameter tells option changed). therefore can access selected / deselected property on params object passed in change event callback. in other words, params.selected / params.deselected value of option element selected/deselected. example here $("#languageid").chosen().on("change", function(event, params) { var value = $(this).val()

angularjs - Changing default css in Angular Material for md-input -

Image
i have implemented form using angualr-material, can't find standard ways change default color coding in material. form <div class="col-xs-12 testformlabel"> <md-input-container class="testlabel"> <label>reason</label> <input name="reasonbox" id="reasonbox" ng-model="obj. reasonbox" ng-required="true"> </md-input-container> </div> css .md-input-has-value. testlabel > input { color:#008cba; } problem how can change auto focus label name , underline different color ( let dark blue green ) you can use selector change input: md-input-container:not(.md-input-invalid).md-input-focused .md-input { border-color: red } use change label: md-input-container:not(.md-input-invalid).md-input-focused label { color: red } include after include css angular ma

Javascript profiling mystery - closure variables -

i testing performance (with chrome timeline) on cases if variable defined inside closure. it's values not exposed user. as expected run_proto_fn run few times faster , minimal garbage collections, , low memory heap. but run_proto_obj happened make exact opposite, if costly having non-function values @ object prototype property properties. can share clarity here? some = function(){}; some.prototype.exe = function(v){ var x = { a:'lorem ipsum dolor sit amet, consectetur adipisicing elit. ea, quae repudiandae eveniet cumque consequatur vitae aut. nisi perspiciatis magnam explicabo optio reprehenderit dignissimos @ porro quam, neque dolorum, architecto odit?lorem ipsum dolor sit amet, consectetur adipisicing elit. ea, quae repudiandae eveniet cumque consequatur vitae aut. nisi perspiciatis magnam explicabo optio reprehenderit dignissimos @ porro quam, neque dolorum, architecto odit?lorem ipsum dolor sit amet, consectetur adipisicing elit. ea, quae repudianda

c++ - What does Copy constructor do for dynamic allocations -

this question has answer here: what rule of three? 8 answers i curious why copy constructor important dynamic allocation of own defined class. i implementing low-level c-string class dynamic allocations , here quick view of class class string { private: char * buf; bool inbounds( int ) { return >= 0 && < strlen(buf); } static int strlen(const char *src) { int count = 0; while (*(src+count)) ++count; return count; } static char *strcpy(char *dest, const char *src) { char *p = dest; while( (*p++ = *src++)); return dest; } static char* strdup(const char *src) { char * res = new_char_array(strlen(src)+1); strcpy(res,src); return res; } static char * new_char_array(int n_bytes) { return new char[n

c# - Prevent expiration of individual sessions based on custom conditions? -

a website working on data centric. reports take more hour complete. whenever user submits request report, new thread created generates report. user redirected page says report in progress, , please refresh download report. if user again refreshes page , report still in progress, same message shown; otherwise download link provided. all report/user relations saved in application variable. works fine, except when user inactive more 20 min (while report being processed), , user logged out; if user logs in again, report can still downloaded. i not want increase session expiration time, need stop expiration if user has going in background, report being processed. in session_end able retrieve the userid , match in application["work"] see user has pending work or not. however, clueless how can defer session end in above case? edit: every 1 has suggested workaround 'maintaining contact' 'using query string'. 'maintaining contact' looked prom

c# - How to group ListBox items by date -

Image
im trying simple task app. have tasks due date , want display this: i know how display data in listbox, dont know how group them duedate , display duedates headers (as in image below). this xml file tasks (tasks.xml): <?xml version="1.0" encoding="utf-8"?> <tasks> <task> <name>first task</name> <duedate>05/03/2013 00:00:00</duedate> <created>03/27/2013 01:24:08</created> </task> <task> <name>second task</name> <duedate>05/17/2013 00:00:00</duedate> <created>03/27/2013 01:24:19</created> </task> <task> <name>third task</name> <duedate>05/17/2013 00:00:00</duedate> <created>03/27/2013 01:24:38</created> </task> </tasks> and data model (mainviewmodel.cs): public class mainviewmodel : inotifypropertychanged { public observablecollection<task

oracle - Execute sql-statement once at date x -

i want have sql update-statement executed once @ date x. how can achieve on oracle 10g database? edit: aim fire update statement every day. why? have tiny mistake in application, can 'temporarily fixed' statement (since have db-access till real fix happen). jonny consider dbms_scheduler. meant running jobs periodically, can set pl/sql job script suspend or cancel job entry after run-once job ends successfully. http://docs.oracle.com/cd/b28359_01/server.111/b28310/scheduse.htm

html - Insert current date/time in HTTP POST -

i embedded developer , hosting form web page on embedded system. user fills out form sends message embedded system. can create whatever name , value fields want , sent embedded system. need stick in current date/time pc. i've read through can find, feel answers missing things web developer take granted. example, know js , how create one. don't know how create field date/time filled out automatically sent embedded side. there's button click send form defined as: <input id="btnsubmit" type="submit" class="sm" value="send configuration message"></div> the form defined as: <form method="post" action="/config/index.htm" onsubmit="btn=document.getelementbyid('btnsubmit'); btn.value='(please wait)'; btn.disabled = true;" style="width: 1000px"> so seems need else onsubmit append time, possibly in new name/value field. i've tried bunch of examp

Highcharts - Referance a separate data series in a series tooltip -

my desired functionality can seen @ link below. however, in case i'm using external csv file series' in it. when using external file, code doesn't have same functionality. (no tooltip appears on series 0 & 1) is there change can make code work external csv's? desired functionality: http://jsfiddle.net/uwbur/1/ tooltip:{ formatter:function(){ var key = this.key; if(this.series.index < 1){ return 'series 0 '+ this.y + '<br/>series 1 '+this.series.chart.series[1].data[key].y; } else{ return 'other series' + this.y; } } },

Error trying to install odoo error: command 'x86_64-linux-gnu-gcc' -

i have no idea i'm doing wrong when following instructions here: http://odoo-development.readthedocs.org/en/latest/install.html . can please me out? the command causes error is: $ sudo pip install -r requirements.txt here error: error: command 'x86_64-linux-gnu-gcc' failed exit status 1 can't roll pillow; not uninstalled cleaning up... command /usr/bin/python -c "import setuptools, tokenize; file ='/tmp/pip-build-rlhphv/pillow/setup.py';exec(compile(getattr(tokenize, 'open', open)( file ).read().replace('\r\n', '\n'), file , 'exec'))" install --record /tmp/pip-b4qpiv-record/install-record.txt --single-version-externally-managed --compile failed error code 1 in /tmp/pip-build-rlhphv/pillow storing debug log failure in /home/aaa/.pip/pip.log here commands i'm entering in order: -virtualbox:~$ sudo apt-get update -virtualbox:~$ sudo apt-get install git python-pip htop moreutils tree nginx gimp wmct

java - JFrame not drawing -

i'm making pong game jframe it's not drawing. package src; import java.awt.color; import java.awt.graphics; import javax.swing.*; public class pong_game extends jframe{ public void init() { settitle("pong"); setsize(500, 500); setresizable(false); setvisible(true); } public void paintcomponent(graphics g) { g.setcolor(color.black); g.fillrect(0, 0, 500, 500); } } my window blank, why? 1 thing might worth noting paintcomponent method seems lot of people spell differently or use differently think did wrong.

Php and MySql - copy data from one to another table -

i want know how if possible copy data 1 table column in same database? code below not working version of mysql should working. update `table1` set `table1.column1` = (select `table2.column2` table2 `table1.city` = 'table2.city') `listing` ='5' do have idea ? ! guys, thought solution possible php script , solution problem make short script gonna while loop :) thanks on joining discussions ! the solution in `` marks between them should column names, works nice, enjoy ! yes can insert ... select syntax like: insert database2.table1 (field1,field3,field9) select table2.field3,table2.field1,table2.field4 table2; check mysql

How to install the MongoDB driver for PHP 7 on Windows 7? -

Image
i can't seem find clear instructions on how php 7 running on machine windows 7 installed. tried couple of online tutorials, nothing seems have worked out me far. it's possible of may have had experience similar mine , absolutely wonderful if share experience me: specifically, did in order to issue resolved. here's did: i downloaded latest dll library php 7 (mongodb-1.1.2.tgz) here: pecl :: package :: mongodb :: 1.1.2 , placed file php_mongodb.dll archive ext directory keep php installation, added line extension=php_mongodb.dll php.ini file (after these steps, apache restarted, of course). section mongodb show result of running phpinfo() function: and i'm trying run simple script: <?php $connection = new mongoclient(); ?> and following error (i have broken lines little bit better readability): fatal error: uncaught error: class 'mongoclient' not found in c:\apache24\htdocs\test2.php:3 stack trace: #0 {main} thrown in c:\apache2

Use of data within a plist in Xcode for iOS -

hoping out there can me. i'm new ios app development , trying put careers day event @ local school. the background want able test students' ability accurately process , input data. to test this, want app deploy onto ipads them try during day. simple stuff (i think!) so far know how create app, put input boxes in , linked , have worked out how test input boxes correct against hard coded value in code this: self.dealid = self.dealidentry.text; nsstring *check1 = @"no"; nsstring *dealidstring = self.dealid; if ([dealidstring length] == 0) { check1 = @"no deal id entered"; } if([self.dealid isequal: @"12345678"]) { check1 = @"yes"; } self.dealidcheck.text = check1; what want though, have table of possible dealids, each 5-6 bits of associated data (customer, currency etc) , when student enters deal id , correct customer, currency etc app should check doing "lookup" of dealid

How can I save a jasper report to file? -

please point me in right direction. need program able have view report , save report button. on save report report should saved disk may use path retrieve saved report after program restarts. in research came jasperfillmanager.fillreporttofile methods , jrxmlwriter.writereport methods output file never created. i'm using irepot plugin netbeans. close deadline appreciated. you need have jasper reports server installed on pc / server , should have access repository through ireport. netbeans none of use in context. refer this stackoverflow question learning resources jasperreports. once done reading suggest follow these steps export , save pdf or excel output of report: save report in jasperserver repository. save data sources, input controls, etc. along report. (learn more links provided in post). run jasper report through web browser. log on to http://localhost:8080/jasperserver and put jasperadmin both username , password. locate report in repository

iphone - Assigning lat long to CLLocation giving error not accepting any format -

i giving lat long cllocation in way. cllocation *loc = [[cllocation alloc]init]; loc.coordinate.latitude = [slat floatvalue]; loc.coordinate.longitude = [slng floatvalue]; coming nsmutabledictionary *locat = [dictloc valueforkey:@"location"]; slat = [locat valueforkey:@"lat"]; slng = [locat valueforkey:@"lng"]; showing correct values in console, kills when allocated cllocation. please guide above. thanks. you can value in cllocationcoordinate2d object bellow... cllocationcoordinate2d location; location.latitude = [slat doublevalue]; location.longitude = [slng doublevalue]; or try retain string bellow.. slat = [locat valueforkey:@"lat"]; [slat retain]; slng = [locat valueforkey:@"lng"]; [slng retain]; and assign cllocation hope helpful you....

chronoforms - Trim a Text for a php -

i have code in chronoforms page title email each time fills form. however, i'm getting page title data. for example: "empodera tu ser con pnl - fundación empoder" i'd remove " - fundación empoder" but can't find answer <input type='hidden' name='page_url' id='page_url' value='<?php echo \juri::getinstance()->tostring(); ?>' /> <?php $jdoc = \jfactory::getdocument(); ?> <input type='hidden' name='page_title' id='page_title' value='<?php echo $jdoc->gettitle(); ?>' /> thanks in advance if can :d rodrigo check out str_replace() : $text = 'empodera tu ser con pnl - fundación empoder'; echo str_replace(' - fundación empoder', '', $text); // "empodera tu ser con pnl" this isn't elegant solution but, it'll work if part want remove constant. otherwise, you'll need creative , per

shell - Is there any way to execute .cmd file in Unix? -

how create .cmd file in .cmd file , pass variable in execute command. is there way execute .cmd file in unix ? kindly advice thanks, no, not really the .cmd files in windows interpreted windows cmd.exe program. if open 1 up, you'll find .cmd file contains text commands executed. in unix world equivalent command files shell scripts. these have .sh extension , interpreted bash program. read more shell scripts online well maybe... you can run cmd.exe program on linux, solaris mac , bsd using compatibility layer called wine however, because of differences between platforms, have revise scripts , manually check things paths , executable names still valid.

performance - Make my R code run faster (nested loops) -

imagine have 150 5 matrix. each element contains random integer 0 20. now think each column of matrix independent; need loop through possible combination of 5 columns, yields 150^5 = 75937500000 combinations. it critical run every single combination once. order ran combinations not matter. i tried doing using while loops. see code below. to run loop, based on calculation take me 54 hours on laptop. questions any way make code run faster on laptop? (bootstrapping?) if not, there web r servers can access run code @ significant faster rate? if not, make significant difference run in another/faster language? (python) while(counter1 <= 150) { while(counter2 <= 150) { while(counter3 <= 150) { while(counter4 <= 150) { while(counter5 <= 150) { #other operations take additional time# result<-c( giant_matrix[counter1,1], giant_matrix[counter2,2], giant_matrix[counter3,3], gian

python - Unable to plot dataframe using seaborn barplot -

Image
i have been able use pandas groupby create new dataframe i'm getting error when create barplot . groupby command: invyr = invoices.groupby(['finyear']).sum()[['amount']] which creates new dataframe looks correct me. new dataframe invyr running: sns.barplot(x='finyear', y='amount', data=invyr) i error: valueerror: not interperet input 'finyear' it appears issue related index, being finyear unfortunately have not been able solve issue when using reindex . import pandas pd import seaborn sns invoices = pd.dataframe({'finyear': [2015, 2015, 2014], 'amount': [10, 10, 15]}) invyr = invoices.groupby(['finyear']).sum()[['amount']] >>> invyr amount finyear 2014 15 2015 20 the reason getting error when created invyr grouping invoices , finyear column becomes index , no longer column. there few solutions: 1) 1 solution specify source data

How to get method information at Interceptor preHandle method in spring boot 1.3 -

@override public boolean prehandle(httpservletrequest request, httpservletresponse response, object handler) throws exception { if (this.logger.isdebugenabled()) { this.logger.debug(">>> handler: " + handler); } handlermethod handlermethod = (handlermethod) handler; login login = handlermethod.getmethod().getannotation(login.class); } i had above interceptor code in spring 3.x works. use code in controller having @crossorigin , @requestmapping method @ spring boot 1.3. below error occured. how method information @ interceptor prehandle method in spring boot 1.3? caused by: java.lang.classcastexception: org.springframework.web.servlet.handler.abstracthandlermapping$preflighthandler cannot cast org.springframework.web.method.handlermethod is added portion process request cors added after 4.2 spring again process "interceptor". can add code check whether "handler" of object type "handlermethod"

c - How to get char array size in this case? -

i'm doubt: how size of char array in case: #include<stdio.h> void f(char * x) { printf("size %d\n", sizeof(x)/sizeof(char)); } main() { char x[5] = {'a', 'e', 'i', 'o', 'u'}; f(&x[0]); } contrary expectations, i'm receiving 8 rather 5 or 6. wrong here? thanks! sizeof(x) in code return size of pointer char *x , not size of char array x pointing on and size of pointer in 64-bits system 8. , 32-bits system size of pointer 4

r - Plot ggpairs and legends (made separately) together -

Image
i'm making correlation plot using ggpairs , extracting legends ggplot. want plot them , wondering how that. source code have done far in making these plots given below: library(ggplot2) library(ggally) library(gridextra) library(tmle) data(fev) custom function 1 #custom smooth function ggpairs my_smooth <- function(data,mapping,...){ggplot(data=data,mapping=mapping)+geom_smooth(method = "lm",se=false,fullrange=true)+geom_point(...)+scale_shape_manual(values=c(0,1))} custom function 2 #custom density function ggpairs my_density <- function(data,mapping,...){ggplot(data=data,mapping=mapping)+geom_density(...,lwd=1)} ggpairs plot p<-ggpairs(fev,columns=1:3,mapping=aes(color=smoke,shape=sex,lty=sex),columnlabels=c("age","fev","height"),lower=list(continuous=wrap(my_smooth,alpha=0.75)),diag=list(continuous=wrap(my_density,alpha=0.5)),upper=list(continuous=wrap("cor",size=4)))+theme_bw() legend extraction #e

how to use jquery in dynamics crm 2011 online? -

did use jquery controlling form's attributes i'm interested in expanding textareas in forms of entities in micrsoft crm 2011 i found pretty nice solution using jquery solve problem i'm confused how use jquery methods in crm i understood have create web resources contain jquery libraries here example of setting jquery script file web resource. jquery web resource in crm 2011 be sure when adding script files form, reference jquery file listed before custom script file uses jquery methods. use javascript web resource in form

php - Why can't I get array key value after function? -

i'm calling wordpress function: get_user_meta($user->id, "user_address"); and returns array, don't want put variable echo out. but doesn't work: get_user_meta($user->id, "user_address")[0]; why? way 1 liner? as per function reference have pass third argument true return single value. get_user_meta($user->id, "user_address",true);

iphone - Is there any way in NSFileManager to get contents of a file only for some range of bytes -

i have files of size 6.7gb, , more (these video files). want chunks of file data send server, : contents = [filemanager contentsatpath:path]; if (mfileoffset<[contents length]) { nsrange range = nsmakerange(mfileoffset, (allowedsize>[contents length]?[contents length]:allowedsize); contents =[contents subdatawithrange:range]; however, produces memory issue: malloc: *** mmap(size=616927232) failed (error code=12) *** error: can't allocate region *** set breakpoint in malloc_error_break debug app(2700,0x4136000) malloc: *** mmap(size=616927232) failed (error code=12) *** error: can't allocate region is there way fseek in c++ read bytes of file come in specified range only? there method in nsfilehandle synchronously reads data specified number of bytes. -[nsfilehandle readdataoflength:] for seeking : – offsetinfile – seektoendoffile – seektofileoffset:

Need clarification with my for loop logic in Python -

the output should have been [2, 18, 6, 16, 10, 14] . my_list = [1, 9, 3, 8, 5, 7] number in my_list: number = 2 * number print my_list the problem prints same my_list values. logic number = 2 * number isn't executed? you not updating list, updating number variable: for number in my_list: number = 2 * number there may way this: using enumerate: my_list = [1, 9, 3, 8, 5, 7] index,number in enumerate(my_list): my_list[index] = 2 * number print my_list using list comprehension: my_list = [2*x x in my_list] using lambda , map: my_list = map(lambda x: 2*x, my_list)

Issue converting varchar to INT in sql server -

i have seen question on stackoverflow, seems there wide number of solutions tailored situation. seems have unique situation far can tell. running sql statement use ist_ca_2_batch_conversion go --t-sql script populate match type column declare @matchtype varchar(16), @pk varchar(500), @careturncode varchar(255), @caerrorcodes varchar(255) declare cursor1 cursor fast_forward select ["ref#"], ["return code"], ["error codes"] cacodes2matchtype open cursor1 fetch next cursor1 @pk,@careturncode,@caerrorcodes while @@fetch_status = 0 begin set @matchtype = dbo.getmatchtype(@careturncode,@caerrorcodes) update cacodes2matchtype set [match type] = @matchtype ["ref#"] = @pk fetch next cursor1 @pk,@careturncode,@caerrorcodes end close cursor1 deallocate cursor1 it fail @ set @matchtype = dbo.getmatchtype(@careturncode,@caerrorcodes) here beginning code getmatchtype function: -- batch submitted through debugger: sqlquery14.sql|6|0|

php - simplexml warnings and errors -

i having trouble php scripts parse xml files. these scripts have been running without error months, , crashing of sudden today. no changes made code or environment. relatively new php, appreciated. here's errors seeing: warning: simplexml_load_file() [function.simplexml-load-file]: c:/server/public_html/dev/temp.xml:1: parser error : opening , ending tag mismatch: hr line 1 , body in c:\server\public_html\dev\index.php on line 31 warning: simplexml_load_file() [function.simplexml-load-file]: led).</u></p><hr size="1" noshade="noshade"><h3>apache tomcat/6.0.32</h3></body> in c:\server\public_html\dev\index.php on line 31 warning: simplexml_load_file() [function.simplexml-load-file]: ^ in c:\server\public_html\dev\index.php on line 31 warning: simplexml_load_file() [function.simplexml-load-file]: c:/server/public_html/dev/temp.xml:1: parser error : opening , ending tag mismatch: hr line 1 , html in c:\server\public

javascript - Transferring values using js switch -

using jstorage.js, i've transferred values, referring english programs "starting", "primary", "uni" , on, 1 page in joomla site using script. works ok. each of values displayed in title on relevant second page. here js: jquery(document).ready(function(){ "use strict"; jquery("p.enrol_para").on("click", function(evnt){ var elementid = evnt.target.id; jquery.jstorage.set("program", elementid); }); jquery("div#register_title").prepend(document.createtextnode(jquery.jstorage.get("program")+" ")); }); and html fragment: <p class="enrol_para"><span class="enrol_text"><a href="/index.php/registration-starting" id="starting" class="enrol_btn">enrol/ลงทะเบียน</a></span></p> however, want "starting" show "starting english", "primary" show &quo

php - How to get all fields from two different tables by foreign key -

i have query part of function: function user_data($memberid){ //pass in memberid info user $data = array();//data returned $memberid =(int)$memberid;//creating int input $func_num_args = func_num_args(); //count number of arguments user data on init.php $func_get_args = func_get_args(); if ($func_num_args >1) { //if more 1, unset first element of array unset($func_get_args[0]); $fields = '`' . implode('`,`', $func_get_args) . '`'; //taking array , converting string $data = mysql_fetch_assoc(mysql_query("select $fields `member`,`oddjob` `memberid` = $memberid")); return $data; i call function (user_data) in users profile page shows info them. need able display data table called oddjob . the memberid primary key in member table. memberid foreign key in oddjob table. oddjobid primary key in oddjob table. i need edit query above pull fie

javascript - How to dynamically change the position of an absolute tooltip base on the target element -

i trying make tooltip shows table (in example below used large amount of text). i've wanted change position of tooltip when hover on target element @ corner of screen. here fiddle $("strong").on("mouseover", function(){ var $this = $(this), strongtext = $this.text(); $tooltipcontainer.show(); $tooltipcontainer.append('<span>'+ strongtext + '</span>'); }).on("mousemove", function(mousepos){... you can change mousemove code little update top position if overlap there below. check demo - fiddle on("mousemove", function(mousepos){ var overlap = mousepos.pagey + possrolly + $tooltipcontainer.height() - $(window).height() - $(window).scrolltop(); $tooltipcontainer.css({ left: mousepos.pagex, top: mousepos.pagey + possrolly - ( overlap > 0 && overlap ) }); })