Posts

Extract data between epoch times in a csv using shell script -

i'm trying work on following sample data: amanda,1.00,1418691511,non-technical,v1 charles,7.05,1417093994,technical,v1 christopher,7.00,1417102400,technical,v2 david,4.00,1417093447,non-technical,v1 john,4.75,1417059582,technical,v1 john,7.80,1417102602,technical,v2 joseph,7.80,1417093804,technical,v1 joseph,5.00,1423504662,technical,v2 michael,7.55,1417092924,technical,v1 richard,5.00,1417093649,non-technical,v1 robert,3.00,1417092640,non-technical,v1 thomas,6.75,1417102170,technical,v1 william,4.50,1417093255,non-technical,v1 rd,2.00,1426017161,technical,v8 rd,2.75,1426449217,technical,v9 here third column in csv epoch date format timestamp of individual records. i want extract data has time stamp between today , past 3 days only. following used achieve doesn't seem working me. awk -f , '{if ($3 >= system("date +%s --date="3 days ago"") && $3 <= system("date +%s")) { print }}' can me in understanding went wro...

Find csv data in column from list of data via linq -

my column in table stores csv list of items. in c# have list of items , want linq query on column returning rows have of items in list. table defined as name|tags with example data of joe | football,soccer,basketball mike | hockey,soccer steve | basketball,baseball so if c# list contains soccer , basketball joe , steve since both have 1 of in tags list. note, i'm using entity framework table. you have bring entity data memory: var result = players.tolist() .where(item => item.tags.split(',').any(x => x.contains("basketball") || x.contains("baseball")); should give 2 results. update: providing list of sports list<string> sports = new list<string> { "baseball", "basketball", "football" }; var result = players.tolist() .where(item => item.tags.split(',').any(sports.contains))...

asp.net mvc - Autofac (+MVC + EF + SignalR + Hangfire) lifetime scopes -

i have asp.net mvc project uses entity framwork, signalr , hangfire jobs. my main (root) container defined way: builder.registertype<dbcontext>().instanceperlifetimescope(); // ef db context builder.registertype<chatservice>().as<ichatservice>().singleinstance(); // classic "service", has dependency on dbcontext builder.registertype<chathub>().externallyowned(); // signalr hub builder.registertype<updatestatusesjob>().instanceperdependency(); // hangfire job builder.registertype<homecontroller>().instanceperrequest(); // asp.net mvc controller icontainer container = builder.build(); for mvc i'm using autofac.mvc5 nuget package. dependency resolver: dependencyresolver.setresolver(new autofacdependencyresolver(container)); for signalr i'm using autofac.signalr nuget package. dependency resolver: globalhost.dependencyresolver = new autofac.integration.signalr.autofacdependencyresolver(container); my signalr hub instan...

Python. Making a function that tests if a word is a palindrome recursively -

i'm trying make program tests if word palindrome using recursive function. pretty have working i'm having trouble getting move on next letter if first , last same. word = input("enterword") word = word.lower() def palindrom(word): if len(word) == 1 or len(word) == 0: return 0; if word[0] == word[-1]: print(word[0], word[-1]) palindrom(word); else: return 1; test = palindrom(word) if test == 0: print("yes") elif test == 1: print("no") so right tests if first , last letter same , if so, should run function again. need have check word[1] , word[-2] i'm having trouble. tried splitting word , popping letters kept looking @ list length of 1. if there way get length of whole split list, work well. you're missing return statement when call method recursively , correct slice: def palindrom(word): if len(word) == 1 or len(word) == 0: return 0 if word[0] == word[-...

mysql - SQL Query - ORDER BY -

rs.open "select [a$].security,[a$].name,sum([a$].[price]) [a$] inner join [b$] on [a$].security = [b$].id group [a$].security,[a$].description", cn, adopenkeyset, adlockreadonly the result query not align or match respective id in sheet b. example :- master worksheet aggregate records matching id of b , security of a. now, might have multiple instances of b's id having different price, reason why aggregate. question when paste record set data, see aggregated price value not pasted in front of id in b i.e want them ordered according id in b , order doesn't work, throwing error [b$].id not part of aggregate function. can hint on how can done ? try instead: rs.open "select [b$].id, [a$].name, sum([a$].[price]) [b$] left join [a$] on [b$].id = [a$].security group [b$].id, [a$].name", cn, adopenkeyset, adlockreadonly this should give total price each id in b , include ids b have no entries in a. every non-aggregated column in select clause has ...

javascript - How do I detect the "enter" key and "shift" key at the same time to insert a line break -

i'm trying create note system. whatever type form gets put div. when user hits enter , submit note. want make when hit shift + enter creates line break point they're typing (like skype). here's code: $('#inputpnote').keypress(function(event){ var keycode = (event.keycode ? event.keycode : event.which); if(keycode=='13' && event.shiftkey){ $("inputpnote").append("<br>"); } else if(keycode == '13'){ var $pnote = document.getelementbyid("inputpnote").value; if ($pnote.length > 0) { $("#pnotes-list").append("<div class='pnote-list'><li>" + $pnote + "</li></div>"); $('#inputpnote').val(''); } } }); #inputpnote form user enters note , #pnotes-list place notes being appended to. thank in advance! i think you'd have set 2 global varia...

concurrency - Ordering of senders in a Go channel -

consider ping pong example http://www.golang-book.com/10/index.htm#section2 . package main import ( "fmt" "time" ) func pinger(c chan string) { := 0; ; i++ { c <- "ping" } } func ponger(c chan string) { := 0; ; i++ { c <- "pong" } } func printer(c chan string) { { msg := <- c fmt.println(msg) time.sleep(time.second * 1) } } func main() { var c chan string = make(chan string) go pinger(c) go ponger(c) go printer(c) var input string fmt.scanln(&input) } the authors write: "the program take turns printing ping , pong." however, true, go must decide on order in senders can send channel? otherwise, there no guarantee ping sent before pong (i.e. can't 2 pings, or 2 pongs in row). how work? there no synchronization between ping , pong goroutines, therefore there no guarantee responses print in order...