Posts

Showing posts from April, 2015

c - how to reuse the variable in linux kernel? -

extern unsigned long current_rx_time; export_symbol(current_rx_time); int netif_rx(struct sk_buff *skb) { current_rx_time = jiffies; } i modified kernel source code in dev.c shown above. later creating loadable kernel module in procfs , using currentrx_time send user space shown below : static int my_proc_show(struct seq_file *m, void *v) { //i printing value below seq_printf(m, "%lu\n", current_rx_time *1000/hz); return 0; } but getting error when compile module above current_rx_time undeclared. tell me how solve problem? first need declare variable , can export it. so declare in dev.c unsigned long current_rx_time; then export in dev.c export_symbol(current_rx_time); and in other loadable module want use (let's in temp2.c)... extern unsigned long current_rx_time; now make sure when going compile temp2.c @ time dev.c getting compile.

java - How to set delay time for the AsyncTask execution when it uses also another Thread? -

i set delay time in milliseconds class extends asynctask. class using java thread. there classes stream mjpeg on android few changes question: android ics , mjpeg using asynctask this class extends asynctask: public class getcameramjpeg extends asynctask<string, void, mjpeginputstream> { @override protected mjpeginputstream doinbackground(string... params) { try { url url = new url(params[0]); httpurlconnection connection = (httpurlconnection) url.openconnection(); connection.setrequestmethod("get"); if (username != null && password != null) { string authencoded = base64.encodetostring((username + ":" + password).getbytes(), base64.default); connection.setrequestproperty("authorization", "basic " + authencoded); } connection.connect(); return new mjpeginputstream(connection.getinputstream());

c# - Thread Synchronisation : Threads having their own copy of string type lock -

recently came across code following: void callthisindifferentthreads(return return) { var lock = "lock"; lock(lock) { //do here. } } my first reaction lock in code won't work because creating lock , using in same method. every thread calling method has it's own copy of lock there no synchronisation. but later realized should work because string goes string pool , there 1 instance of particular string. i'm not sure if i'm correct. locking on strings super bad . don't it. have no guarantee other clever soul not lock on strings, , because "super" global because of string interning, moment becomes accepted practice, wheels fall off. lock private object has 1 purpose... locking. strings don't fit description. locking string. safe/sane? is ok use string lock object?

mysql - Joining three tables in SQL, Inner join does not work properly -

we have 3 tables, document , department , contact . all tables linked 'id' column. want result follows firstname lastname address upload_date department_name the below query fetches first 4 columns select contact.firstname, contact.lastname,contact.address , document.upload_date contact join document on document.id= contact.id , contact.status = 1 , document.defaultdoc=1 so it's inner join. but fetch last column, department_name added similar join contact.deptid=department.id , query returns 0 results. wrong ? if add join department on contact.deptid=department.id it should work.

ssl - server giving msxml3.dll error '80072f7d' when trying to access secure url -

for years have used classic asp connect secure site of supplier using msxml3.dll - since morning, getting; msxml3.dll error '80072f7d' error occurred in secure channel support i have had around , can see not 1 have seen - cannot find solution. the partner site has updated ssl certificate. if try connect remote url server using ie or chrome, fails connect reporting nonvalid digital signature on site's certificate. however, if try connect local computer, works without problem , can see server identity has been correctly established. any appreciated. in microsoft windows server 2003, applications use cryptography api (capi) cannot validate x.509 certificate. problem occurs if certificate secured secure hash algorithm 2 (sha2) family of hashing algorithms. applications may not work expected if require sha2 family of hashing algorithms. http://support.microsoft.com/kb/938397 fixed problem me.

git - How to properly set permission for github webhook -

i have set github webhook server auto pull specified branch repo. make work made www-data owner of repo files on server (else won't able write files). but read it's bad let www-data owner of files. case? if yes how can setup properly? thanks helping!

timedelta - How can I accurately display numpy.timedelta64? -

as following code makes apparent, representation of numpy.datetime64 falls victim overflow before objects fail work. import numpy np import datetime def showmedifference( t1, t2 ): dt = t2-t1 dt64_ms = np.array( [ dt ], dtype = "timedelta64[ms]" )[0] dt64_us = np.array( [ dt ], dtype = "timedelta64[us]" )[0] dt64_ns = np.array( [ dt ], dtype = "timedelta64[ns]" )[0] assert( dt64_ms / dt64_ns == 1.0 ) assert( dt64_us / dt64_ms == 1.0 ) assert( dt64_ms / dt64_us == 1.0 ) print str( dt64_ms ) print str( dt64_us ) print str( dt64_ns ) t1 = datetime.datetime( 2014, 4, 1, 12, 0, 0 ) t2 = datetime.datetime( 2014, 4, 1, 12, 0, 1 ) showmedifference( t1, t2 ) t1 = datetime.datetime( 2014, 4, 1, 12, 0, 0 ) t2 = datetime.datetime( 2014, 4, 1, 12, 1, 0 ) showmedifference( t1, t2 ) t1 = datetime.datetime( 2014, 4, 1, 12, 0, 0 ) t2 = datetime.datetime( 2014, 4, 1, 13, 0, 0 ) showmedif

Execute remote exchange powershell command with C# -

i can execute powershell command on remote machine, , can execute powershell exchange snapin commands, can't figure out how both. issue resides in runspacefactory.createrunspace() method. a wsmanconnectioninfo object lets me target remote host so: wsmanconnectioninfo connectioninfo = new wsmanconnectioninfo( new uri(configurationmanager.appsettings["exchangeserveruri"]), "http://schemas.microsoft.com/powershell/microsoft.exchange", new pscredential(username, securestring)); and runspaceconfugation + pssnapininfo lets me target snapin so: runspaceconfiguration rsconfig = runspaceconfiguration.create(); pssnapinexception snapinexception = null; pssnapininfo info = rsconfig.addpssnapin("microsoft.exchange.management.powershell.admin", out snapinexception); but can feed 1 or other createrunspace(). runtime object returns has properties connectioninfo , runspaceconfiguration, they're both readonly. intentional design can't

sql - Pass stored procedure parameter values to nested stored procedure without knowing parameter names -

i trying create universal error trapping stored procedure called within stored procedures , need parameter names (i can system tables knowing stored procedure name) , values. the values need obtain , them dynamically (without having pass them stored procedure name). is there way pass unique id or other thing nested stored procedure can use parameter values main stored procedure in nested stored procedure? short example: have stored procedure: create procedure testparamaters @text1 varchar(500), @datetime1 datetime -- want able call sp this: exec dynamicerrortrackingsp (pass something, system variable/data/etc, can dynamically parameter values in nested sp) i have code similar , works fine (but have edited every sp correctly pass parameter values (i not want have edit every sp). exec dynamicerrortrackingsp @parmaternamevaluepairs = '@text1 = ' + @text1 + ', @datetime1 = ' + cast(@datetime1 varchar(500)) + '

jquery - Select List Manipulation -

this question similar @ least 1 other question, resolution didn't me. have code worked great in jquery 1.4, works no longer. have 2 buttons (used to) allow user navigate thru select list. here's working version: http://jsbin.com/weput/1/ <!doctype html> <html> <head> <meta charset="utf-8"> <title>js bin</title> </head> <body> <button onclick="setoption(-1)">&#8592;</button> <button onclick="setoption(1)">&#8594;</button> <select name="select1" id="select1"> <option value=""></option> <option value="one">one</option> <option value="two">two</option> <option value="three">three</option> </select> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script>

java - Array Index out of bounds think there is a specfic line -

exception in thread "main" java.lang.arrayindexoutofboundsexception: 100 @ ham.main(ham.java:34) line 34 on console says if (h[c] == 1) i wrote code generate hamming code..i getting javaindexoutbounds exception..i gave absurdly large array sizes counter tht..still not working! array outbounds thou there plenty of space array the line 27 might mistake...checking c import java.util.*; public class ham { public static void main(string ar[]) { scanner s = new scanner(system.in); system.out.println("input no. of bits"); int n = s.nextint(); int a[] = new int[100]; // user's input int h[] = new int[100]; // hamming code array system.out.println("i/p data"); int = 1, j = 1, pb = 1; (i = 1; < n + 1; i++) a[i] = s.nextint(); = 1; while (i < n + 1) { if (j == pb) // if index parity bit leave { j++; pb = pb * 2; } else { h[j] = a[i];

php - Table Monthly Rankings -

Image
do have suggestions/tips on how can achieve table layout in dompdf? retrieving of data database working fine problem how can achieve required table layout. here table output sample: here's have/tried far: <table class="ormexsum2" cellpadding="0" cellspacing="0" border="1" width="100%"> <thead> <tr><th colspan="14">monthly rankings</th></tr> <tr> <th width="10%">location</th> <th width="22.5%">negative snippet</th> <?php $year = (date('y')-1); $curyear = date('y'); $start = new datetime("dec 1, $year"); $end = new datetime("dec 31, $curyear"); $interval = dateinterval::createfromdatestring('fourth friday of next month'); $period = new dateperiod($start, $interval, $end, da

ruby - How to push seeds.rb to existing rails app (on Heroku)? -

i store app's data in seeds.rb locally. however, after pushing heroku, app works well, without data. not want re-input mass data again, have ways me? if push app heroku, can seed database following command. heroku run rake db:seed

Google Drive not persisting PUT changes -

to google: 1) have app uses google api javascript client. prior today, able save changes existing user file that's saved on drive. however, if send put request https://content.googleapis.com/upload/drive/v2/files updated file contents, still 200 response, new file contents not persisted. (fetching file again on page refresh shows old file state.) none of app's code has changed since last working on sunday. i feel related file revisions suspect behavior? , google drive api file update new possible bug . should bug report, unable find submit google drive sdk support page says come stackoverflow. update : there's thread on google+ site google drive developers regarding issue. 2) there webpage has information on when google makes api updates and/or changes break functionality? happened last week: google drive sdk giving access users files , affected app. stackoverflow best place learn these things?

sql server - Return value of SQLCMD RESTORE in cmd batch -

i building cmd script restore sql server database, , need know if restore worked correctly, in order perform other tasks. code: sqlcmd -s %database_server% -u user-p password-q "restore database %database% disk='i:\bakup.bak'" thanks backup command doesn't return error code. moreover, backup error can found in error log only, not in of system catalogs. there table msdb.dbo.backupset information on successful backups, though, , can used deduce whether backup errored or not. make note of current time prior taking backup, , after backup finishes use query retireve time of last successful backup: select max(backup_start_date) msdb.dbo.backupset database_name = 'database_name' if time returned less 1 recorded there errors.

ios7 - iOS: UICollectionView - Jerks while scrolling -

i have 3 item in single row. every item quite customized. on start load 6 item means 2 rows. when scroll , reaches end of send row load 3 row. between show jerk of mili seconds. is there way load minimum 5 rows. if user scroll 2nd row load 6th row , on... please help.. if trying load network resources in uitableviewcell , better asynchronize loading resources. if try load 6th row when scroll 2nd row. guess uitableviewcell visiblecells way load more cells' resources in advance .

ios - Problems setting position of CAShapelayer -

i have posted similar question before didn't feel got correct answer. want change position of cashapelayer position of touch located when touch moved. i'm using code can see down below. problem have animation work, not touch located. instead 20 pixels away. there way fix this? -(void)touchesbegan:(nsset *)touches withevent:(uievent *)event { nsset *alltouches = [event alltouches]; uitouch *touch = [alltouches objectatindex:0]; cgpoint currentpos = [mytouch locationinview: self]; layer = [self addcircleyellownwithradius:8 withduration:5 x:currentpos.x y:currentpos.y]; } -(void)touchesmoved:(nsset *)touches withevent:(uievent *)event { nsset *alltouches = [event alltouches]; uitouch *touch = [alltouches objectatindex:0]; cgpoint currentpos = [mytouch locationinview: self]; //set layer posotion touch position layer.position = cgpointmake(currentpos.x-8,currentpos.y-8); } -(cashapelayer *)addcircleyellownwithradius:(float)radius5 withduratio

scala - How do I verify mockito calls in asynchronous methods -

i'm writing highly asynchronous bit of code , i'm having problems testing using specs2 , mockito. problem matchers executed before asynchronous code executes. see specs2 has await , eventually helpers - promising i'm not sure how use them. below stripped down example illustrates problem sut package example.jt import scala.concurrent._ import executioncontext.implicits.global import scala.util.{try, success, failure} trait service { def foo def bar def baz } class anothertest(svc: service) { def method(fail: boolean) { svc.baz future { thread.sleep(3000) pvt(fail) oncomplete { case success(_) => svc.foo case failure(ex) => svc.bar } } } private def pvt(fail: boolean):future[unit] = { val p = promise[unit] future { thread.sleep(2000) if (fail) p failure (new runtimeexception("failure")) else p success () } return p.future } } specs2

c# - Are the AES legal key sizes really the limit? -

the aescryptoserviceprovider.legalkeysizes field shows allowed sizes in bits. however don't understand if true, how able utilise 2048 bit key length (256 bytes)? i suppose real question is, key produced size requested (larger max 32 byte), first 32 bytes (256 bits) taken in encryption/decryption process, rendering larger key size waste of space? i don't know if there way of telling what's exposed in api... any thoughts? maybe i'm looking @ in wrong way? aes can used 3 key sizes: 128, 192 , 256 bit keys. if able use larger keys 256 bit, library "lying you" i.e. bits of larger key discarded or compressed somehow. instance php mcrypt cuts size of key down largest possible size. larger key "seeds" rather common in world of cryptography. instance diffie-hellman - key agreement algorithm - generates secret larger key size required. question of extracting (concentrating) amount of entropy in key arises. if bits truncated entropy in

pdf - iTextSharp - when extracting a page it fails to carry over Adobe rectangle highlighting important info -

per following site... http://forums.asp.net/t/1630140.aspx?extracting+pdf+pages+using+itextsharp ...i use function extractpages produce new pdf based on range of page numbers. problem noticed pdf had rectangle on 2nd page not extracted along page. causes me fear perhaps adobe comments not being carried on pages extracted. is there way can adjust code take consideration bring on comments , objects rectangles new pdf when extractpages called? missing syntax or not available version 5.5.0 of itextsharp? your use of verb extract in context of extracting pages confusing. people think want extract text page. in reality, want import or copy pages. the example refer uses pdfwriter . that's wrong: should use pdfstamper (if 1 existing pdf involved) or pdfcopy (if multiple existing pdfs involved). see answer question how keep original rotate page in itextsharp (dll) find out why example on forums.asp.net really, bad example. the fact page has "a rectangle

html - Styling <button> with <i> icon and text in Chrome/Firefox -

Image
i have <button> tag have <i> element displaying icon before text. here's html <button> <i></i> login using facebook </button> the inside <i> displaying icon. other tag <a> , can use :before pseudo-class display icon, seems can not <button> tags. and here's css button { background: #4a6ea9; color: #fff; font-weight: bold; line-height: 24px; border: 1px solid #4a6ea9; vertical-align: top; } button { background: url('http://icons.iconarchive.com/icons/danleech/simple/24/facebook-icon.png'); display: inline-block; height: 24px; width: 24px; border-right: 1px dotted #fff; } here's fiddle http://jsfiddle.net/petrabarus/sdh3m the first initial display in chrome 28.0.1500.95 linux below looks little bit imbalance on top , bottom (i'm not designer nor front-end engineer can sense it's quite imbalance), can add padding padding: 4px 6px

c# - Could not load file or assembly 'System.Dynamic' or one of its dependencies -

i working on .net project 3.5 framework. getting error while run time. i think system.dynamic resides in system.core dll, cannot find system.dynamic under system.core? how can add in project? system.dynamics not available in .net 3.5 - dlr (= dynamic language runtime) introduced .net 4.0 , not availalbe backport afaik. the dlr , system.dynamics required use dynamic type. if want use that, need upgrade @ least .net 4.0.

ng pattern - $scope.var giving undefined in angularjs -

i using angularjs client side validation on textbox need input alphanumeric chars only. if textbox left empty or non-alphanumeric char entered, submitform sends 'false' js desired problem doesn't pass non-alphnumeric char (in scope). jsp file: <form name="addressform" method="post" ng-submit="submitform(addressform.$valid)" novalidate> .. <input ng-model="address" type="text" **ng-pattern**="/^[a-za-z0-9 ]*$/" required="true"/> js file: $scope.submitform= function(isvalid){ var inputaddr = $scope.address; alert(inputaddr); //coming undefined ... now when input alphanumeric character in input box 'address' in jsp gives me undefined on alerting in js (probably because of pattern filters char being non-alphanumeric). if remove ng-pattern, passes submitform passes 'true' if every input "as expected". reason want access $scope.address check ,

search - Find specific value in matrix algorithm -

i have matrix , want find algorithm can find values = 1 , give give me count of how many there are. my matrix , have size n x n: 44444444 4 4 1 4 4 4 444 4444 44 4 1 34 444 444 44 44 44444444 right don't know kind of algorithm have use. if parsing problem then, int count = 0; for(int i=0;i<n;i++) { for(int j=0;j<n;j++) { if(isdigit(matrix[i][j] && matrix[i][j]!='0') { int sum = 0; int tenpower = 1; for(;j<n && isdigit(matrix[i][j];j++) { sum = sum*tenpower+(matrix[i][j]-48); tenpower*=10; } if(sum == 1)count++; j--; } } } printf("%d\n",count);

php - Excel VBA: Dynamic Variable Name -

note: limited php <-> vba. please not suggest requires excel addon, or other language/method. i have function connect specified url, submits data, , retrieves other data. works great. i'm trying write can use generic function can use connect file need connect - each return different data (one user data, 1 complex calculations etc). when retrieves data php, there way dynamically set variables based on received - if not know has been received. i can make php return vba string in format, i'm using below example: string received in vba: myvalue1=dave&someothervalue=hockey&hockeydate=yesterday if parse in php, similar (not accurate, written example purposes); $mydata = "myvalue1=dave&someothervalue=hockey&hockeydate=yesterday" $myarr = explode("&",$mydata) foreach($myarr $key => $value){ ${$key} = $value; } echo $someothervalue; //would output screen 'hockey'; i similar in vba. string receiving php file

jquery - I am trying to make something like Facebook comment functionality. Read description what I am missing -

my comments posting through ajax fine when click on like, count not update. if refresh page once, , click on like, count updates through ajax. missing? why ajax call on clicking not occurring when post new comment. please help. here code. jquery : this part of code adds comment through ajax, submission via pressing enter $('textarea').keyup(function (event) { if (event.keycode == 13 && event.shiftkey) { var content = this.value; var caret = getcaret(this); this.value = content.substring(0,caret)+ "\n"+content.substring(caret,content.length); event.stoppropagation(); } else if(event.keycode == 13) { $.ajax({ type: "post", url: 'index2.php', data: $

angularjs - Testing immediately resolved $.defer() with Jasmine -

if testing code in angular uses $q , resolves such as; angular.module('myapp.mymodule', ['ng']) .service('someservice', function($q) { this.task = function() { var deferred = $q.defer(); deferred.resolve('some value'); return deferred.promise; }; }); that might used follows; function(someservice) { someservice.task().then(function() { console.log('resolved'); }); } you might find runs expected in application, fails under test; phantomjs 1.9.7 (mac os x) myapp.mymodule someservice someservice.task when invoked returned promise when invoked should call our handler failed expected spy ontaskcomplete have been called [ 'some value' ] never called. here example test above module; describe('myapp.mymodule', function() { describe('someservice', function() { beforeeach(function() { var suite = this; module('myapp.mymodule'); suite.injectservi

c++ - Warning message regarding stack size -

i use visual studio 2010 code analysis activated. in code there's line allocating memory in function: tchar somestring[40000]; the code analysis throws warning message: warning c6262: function uses '40000' bytes of stack: exceeds /analyze:stacksize'16384'. consider moving data heap i wonder if should take warning serious. have face real trouble if allocate memory on stack > 16384? or general warning message reminds me have take care stack size in general? far know default stack size 1mb (if use visual studio). admittedly, message can confusing since vs (project properties) report default 1m. however, if @ text of warning , you'll note limit 16k code analysis. follow steps @ bottom of link correct warning.

javascript - AngularJS : What is the best way to bind to a global event in a directive -

imagine situation in angularjs want create directive needs respond global event. in case, let's say, window resize event. what best approach this? way see it, have 2 options: 1. let every directive bind event , it's magic on current element 2. create global event listener dom selector each element on logic should applied. option 1 has advantage have access element on want operations. but...options 2 has advantage not have bind multiple times (for each directive) on same event can performance benefit. let's illustrate both options: option 1: angular.module('app').directive('mydirective', function(){ function dosomethingfancy(el){ // in here have our operations on element } return { link: function(scope, element){ // bind window resize event each directive instance. angular.element(window).on('resize', function(){ dosomethingfancy(element); });

python - Separate results by comma in django -

how separate results in django template? i have category model below class category(models.model): category_name = models.charfield(max_length=50) category_slug = models.slugfield(max_length=300) category_meta = models.textfield(max_length=300) category_description = models.textfield(max_length=300) listing = models.booleanfield(default=true) def __unicode__(self): return self.category_name this how print in template <h3 class="movie-items-listing">{% category in movie.movie_category.all |join:", " %}{{ category }}{% endfor %}</h3> and error templatesyntaxerror @ /movies/ 'for' statements should use format 'for x in y': category in movie.movie_category.all |join:", " now when wanna list these, show category 1 category 2 i tried use template filters separate these keep having errors. you using join template filter incorrectly. source try this {{ movie.movie_

javascript - how to get the input value in jquery -

i want value user inputs in text box , assign rounds, not work. line in user inputs value: number of rounds:&nbsp;<input type="text" id="numrounds" name="rounds" size="6"/> and in jquery have following line var rounds = $('#numrounds').val(); however, when run program not assigning numrounds value user inputs rounds. doing wrong? here full code: <!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <link href='http://fonts.googleapis.com/css?family=nixie+one' rel='stylesheet' type='text/css' /> <link rel="stylesheet" type="text/css" href="css/workitt.css" /> <script type="text/javascript" src="htt

Mouse over click response on image in wordpress -

i want know plugins used on chanege color of image or make image response on mouse over. i new in wordpress can give me list of best plugins. i editing theme: http://themeforest.net/item/overgrowth-retina-responsive-multipurpose-theme/full_screen_preview/4896083 please check theme, in homepage scrolldown page "blog" section come please put mouse on image image response. i looking this. i purchased theme , editing not able feature. and not know name says not able search on internet. so please tell me search in wordpress. how can achieved via code or via plugins? does overgrowth retina theme have plugins? any idea or suggestions highly welcome. this effect being achieved css3: 1] it's setting border-radius:100%; of image container change image square circle. 2] it's displaying 2 hidden elements on top of image blue semi-transparent overlay. these being set opacity:0; default state, , on :hover , being displayed using css transiti

Excel, Trying Index, Match, to lookup values with VBA -

i trying look-up values @ cell locations using vba, have searched google , on stackoverflow before asking because can't seem work. the following code trying use, note budgetcode references cell containing 1 of codes in first column , mo references cell contains number (1-12) or contains short code (ytd, 1qtr, 2qtr, 3qtr). example want pull cad-ns february (2), , should 5666.40. function ebudgetl(budgetcode string, mo string) ebudgetl = application.worksheetfunction.index(range("budget!g1:x5000"), _ application.worksheetfunction.match(budgetcode, range("budget!b1:b5000"), 0), _ application.worksheetfunction.match(mo, range("budget!g1:x1"), 0)) end function here part of data wish lookup: 1 2 3 4 cad-ns net sales 5264.0 5666.4 5614.9 5966.6 cosmat e material 6207.5 3660.0 3661.9 3560.9 cosdl e direct labor 610.4 105.3 167.

java - Null pointer exception while running Spring project -

i unable figure out reason nullpointer exception in spring project. sometime project works fine time throwing null pointer exception here full stacktrace. org.apache.jasper.jasperexception: javax.servlet.servletexception: java.lang.nullpointerexception org.apache.jasper.servlet.jspservletwrapper.handlejspexception(jspservletwrapper.java:585) org.apache.jasper.servlet.jspservletwrapper.service(jspservletwrapper.java:455) org.apache.jasper.servlet.jspservlet.servicejspfile(jspservlet.java:390) org.apache.jasper.servlet.jspservlet.service(jspservlet.java:334) javax.servlet.http.httpservlet.service(httpservlet.java:728) org.springframework.security.web.filterchainproxy$virtualfilterchain.dofilter(filterchainproxy.java:322) org.springframework.security.web.access.intercept.filtersecurityinterceptor.invoke(filtersecurityinterceptor.java:116) org.springframework.security.web.access.intercept.filtersecurityinterceptor.dofilter(filtersecurityinterceptor.java:83) org.springframework.securi

ruby on rails - Public activity select unique foreign keys by created time -

i'm looking query activity object in app. i'm using public_activity gem , have list of activities connected several models , list out recent unique activity. basically query recent activity particular tracking. let's i'm tracking button , it's id 29 . want query out recent (one) instance of tracking id=29 , other tracking ids. don't know querying rails well. right line have displays activity: @activities = publicactivity::activity.order("created_at desc").where(owner_id: current_user.id) let's have table of activities follows: id activity_id description created_on 1 3 yesterday 2 3 unlike 2 days ago 3 6 comment yesterday 4 7 review yesterday 5 7 review 2 days ago i want pull out recent entries of each activity id @activities variable following: id activity_id description created_on 1 3 yesterday 3 6 comment

python - Sum of a particular column in a csv file -

there csv file, a.csv , having content: place,hotel,food,fare norway,regal,nonveg,5000 poland,jenny,italiano,6000 norway,suzane,vegeterian,4000 norway,regal,nonveg,5000 i have parse csv , obtain output passing arguments in command prompt. example 1: mycode.py place desired output is: place,fare norway,14000 poland,6000 example 2: mycode.py place hotel desired output is: place,hotel,fare norway,regal,10000 poland,jenny,6000 norway,suzane,4000 so clear above example no matter pass argument gives sum of fare header common ones. below code , able pass arguments , output, stuck in sum of fare . can 1 me this. import sys import csv import collections d = collections.defaultdict(list) data = [] result = [] final = [] argvs = [] argv_len = len(sys.argv) index = 0 input = '' file = open('a.csv', 'rb') try: reader = csv.reader(file) row in reader: data.append(row) x in range(1, argv_len):

javascript - D3 visualization responsive to all screen sizes without scroll bar -

how can basic line graph fit on device screens without scroll bar appearing on screen? have included following 2 statements in code: .attr("viewbox", "0 0 width height") .attr("preserveaspectratio", "xminymin meet") this has resolved horizontal scroll bar appear on screen still getting vertical scroll bar on laptop screen although works fine on desktop screen. axis disappears on screen zoom in zoom out. here's jsfiddle. just change css bit: body { font: 12px arial; padding:0; margin:0; position:absolute; width:100%; height:100%; overflow:hidden } some of considered unnecessary. quickest , dirtiest add overflow:hidden

android - scrollView not working in GridView with in TableLayout with having scroolView -

i doing tablelayout scrollview . in code gridview in tablelayout not getting scrollview gridview . pls me. problem coming @ gridview . thank <scrollview xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="wrap_content" android:layout_height="wrap_content" android:scrollbars="horizontal" > <tablelayout android:id="@+id/tablelayout1" android:layout_width="532dp" android:layout_height="257dp" android:layout_gravity="right" android:paddingbottom="@dimen/activity_vertical_margin" android:paddingleft="@dimen/activity_horizontal_margin" android:paddingright="@dimen/activity_horizontal_margin" android:paddingtop="@dimen/activity_vertical_margin" android: