Posts

Showing posts from February, 2011

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...

node.js - Invalidate JWT Token in NodeJS -

i followed tutorial using jwt token. token expiry set 5 minutes, if wanted invalidate token after 1 minute of use? want able make api call /api/logout , should delete token. i'm using express , node. it seems gather option have token db stores token. when want expire token, expire/remove token db. i've seen people casually "remove" token physical hard space, cannot figure out token physically stored me remove it. the general benefit of jwt token authentication tokens can contain session information keep in session store. saves considerable resources, in request-to-response times, because not have session data on each , every request - client gives that. however, comes @ cost of not being able revoke jwt token @ time of choosing, because lost track of state . the obvious solution of keeping list of invalidated tokens somewhere in database kind of removes above-described benefit because again have consult database on every request. a better op...

c# - NHibernate - Check if entitiy is out of date/sync -

i using (fluent) nhibernate in project. let's have transient entity, a, being stored. @ point, part of data store related entity updated. is there way know entity out of date/sync can go ahead , refresh ? usually version column used determine that, , number, each persist updates number, or datetime last persisted time stored. when entity updated version column updated, assume entity a, class { int id { get; set; } int version { get; set; } string name { get; set; } } class amap : classmap<a> { public amap() { id (x => x.id).generatedby.native(); version (x => x.version); map(x => x.name); } } when entity updated generated sql like, update set.... id = ? , version = ? so, if updated other transaction fail update , throw exception. on exception should able reload , retry. make sure use new session when retry.

sml - What does function return when "function times zero" in functional programming? -

i stuck sml assignment. trying create compound function (fun compound n f). it's supposed apply function f on n times example, compound 3 f equal f(f(f(x))). got work except case n zero. asked professor won't tell me direct answer. tried give me hint "what's function times zero?" still can't figure out either. can stackoverflow figure out? thanks. my code: fun compound n f = if n < 2 if n = 0 fn x => f x else fn x => f x else fn x => f(compound (n-1) f(x)); example: val fnc = fn x => x + 1; (* example function used *) compound 5 fnc(10); (* return 15 correct*) compound 0 fnc(10); (* returns 11, should 10 *) answer: fun compound n f = if n < 2 if n = 0 fn x => x else fn x => f x else fn x => f(compound (n-1) f(x)); i won't give final answer because don't upset teachers ;) however, i'll try derivation believe you'll find easy complete. let's start simple c...

wordpress - ZipArchive gives blank screen PHP -

i enabled php_zip.dll in php.ini , shows in phpinfo, ziparchive enabled. next, here code using: $zipname='exports.zip'; $zip=new ziparchive; $zip->open($zipname, ziparchive::create); when code reaches point, screen goes blank. there no errors in error log. html supposed show, not. other unessential php commented out. using php 5.2.4 on wordpress 3.9.2 site. i found solution finding in search engines. instead of using php's ziparchive, used command line winzip. looked this: $cmd='"c:\winzip-directory\winzip32.exe" -a "c:/zip-directory/exports.zip" "c:/zip-directory"'; exec($cmd); i still don't know caused problem php's ziparchive, though.

ios - Adding multiple objects to NSMutableArray -

i have following iteration: historialservicios = [[nsmutabledictionary alloc]init]; // parse , loop through json (dictionary in messagearray) { //datos de nivel objects nsstring * code = [dictionary objectforkey:@"code"]; nsstring * date = [dictionary objectforkey:@"date"]; //datos de nivel client nsdictionary *level2dict = [dictionary objectforkey:@"client"]; id someobject = [level2dict objectforkey:@"email"]; nslog(@"nombre===%@",someobject); nsstring * email = someobject; nslog(@"email=%@",email); nslog(@"code=%@",code); nslog(@"date=%@",date); //insertamos objetos en diccionario historialservicios } the iteration looping inside root node of json tree , inside child node "client". what need create nsmutablearray of dictionaries. each dictionary has include retrieved objects each iteration, in case keys code, data , email. code , data...

javascript - How to change current URL and open new tab on click using jQuery -

i need replace every link on page has current url like: ("body a").on("click", function() { window.open("new_page.html?test=1&test=2", "_newtab"); window.location.replace('replace_current_page.html?test=1&test=2'); }); i'm not sure window.open right function. maybe replacing href better idea? if has every link, need go same page? i'm not sure need well. /* allows open link in new window */ $(function() { $('a').each(function() { $(this).attr('target', '_blank'); /* uncomment if need change href here $(this).attr('href', "mylink.htm"); */ }); });

date - Java - Better way then using Ifs and repeating functions - DateRelated -

i created function check date string month contains can use multiple date formats. i'm using lot of ifs , repeating .contains function. there better way of doing this? also related dates in format weekday(string), month(string) day(int- xx), year(int - xxxx). e.g. sunday, june 27, 1965. i've had no luck far built in functions. public static int checkmonth(string s){ string month = s.tolowercase(); if(month.contains("january")){return 1;} else if(month.contains("febuary")){return 2;} else if(month.contains("march")){return 3;} else if(month.contains("april")){return 4;} else if(month.contains("may")){return 5;} else if(month.contains("june")){return 6;} else if(month.contains("july")){return 7;} else if(month.contains("august")){return 8;} else if(month.contains("september")){return 9;} else if(month.contains("october")){re...

java - Spring Boot in standalone Tomcat ignores exceptions set in DeferredResults -

i'm running spring boot 1.2.1 application in standalone tomcat. i have 2 controller mappings, both simplicity throw exception. first 1 request , returns string view name: @requestmapping(value = { "/index" }, method = requestmethod.get) public string init() throws myrequestprocessingexception { if (true) { throw new myrequestprocessingexception( "something went wrong processing request"); } return "init"; } this exception definition: @responsestatus(value=httpstatus.internal_server_error) public class myrequestprocessingexception extends exception { public myrequestprocessingexception(string message) { super(message); } } in embedded tomcat in standalone tomcat, trying access /index results in 500 json error data being returned client. my controller has method accepts post , returns deferredresult: @requestmapping(value = "html/start", method = requestmethod.post, consumes = a...

Devexpress XtraTreeList parent node -

i have 1 treelist has 1 parent node , number of childs. when loading if click on parent(root) node not selected , eventhandler node not called. if select 1 of childs , select parent node call eventhandler selecting node. appreciate on fixing that. i have solved problemy seting treelist.focusednode null (or nothing in vb.net) in form constructor , adding handler focusednodechanged event (it cannot assigned in designer code!). regards, maciej nowicki

node.js - Heroku deployment failed, seems like bcrypt issue -

i try deploy school project heroku, when type git push heroku master, following error" remote: gyp err! build error remote: gyp err! stack error: `make` failed exit code: 2 remote: gyp err! stack @ childprocess.onexit (/tmp/build_434f42dd0dc575279023b0d76c2ad5e9/.heroku/node/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:267:23) remote: gyp err! stack @ childprocess.emit (events.js:110:17) remote: gyp err! stack @ process.childprocess._handle.onexit (child_process.js:1067:12) remote: gyp err! system linux 3.13.0-40-generic remote: gyp err! command "node" "/tmp/build_434f42dd0dc575279023b0d76c2ad5e9/.heroku/node/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild" remote: gyp err! cwd /tmp/build_434f42dd0dc575279023b0d76c2ad5e9/node_modules/bcrypt remote: gyp err! node -v v0.12.0 remote: gyp err! node-gyp -v v1.0.2 remote: gyp err!...

python - Reading in TSV with unescaped character in Pandas -

i have tsv file each line word token , pos tag, separated tabs. the det boy noun said verb " punct hi intj mum noun " punct this used basis pos-tagger later on. problem whenever pandas encounters quotes, returns this: word tag 0 det 1 boy noun 2 said verb 3 \tpunct\r\nhi\tintj\r\nmum\tnoun\r\n punct i have tried explicitly define quotes escape character, didn't work. other thing can think of escape them in tsv files directly, since have many of them, , have been generated me external source, tedious , time consuming. has encountered before , have solution? you can tell pandas ignore quoting when reading file, in case pandas uses same configuration options builtin csv module, have pass quote_none constant csv module: import csv import pandas pandas.read_table(fn, quoting=csv.qu...

geotagging - SEO for same site in multi locations -

i have portfolio website want market in both australia , in uk. have purchased domains want make sure google not penalize me having duplicate content can please advise me best practice/s make sure both sites optimise seo in these regions thanks in advance all of concerns well-answered @ heart of google itself. take @ this link (go bottom of page): websites provide content different regions , in different languages create content same or similar available on different urls. not problem long content different users in different countries.

javascript - Ruby On Rails Ajax Submit submitting twice -

so decided make blog in ror , got comments submit , not when went "update" submit method allow page not refreshed when comment posted (ajax) whenever go post comment on pages reason loops send comment submit , 2 comments same message appearing @ same time. <h2>comments</h2> <div id="comments"> <%= render :partial => @post.comments %> </div> <%= form_for [@post, comment.new], :remote => true |f| %> <p> <%= f.label :body, "new comment" %><br/> <%= f.text_area :body %> </p> <p><%= f.submit "add comment", disable_with: "adding comment..." %></p> <% end %> that show point, can see tried see if disabling button disable_with has not. and below comment_controller class commentscontroller < applicationcontroller def create @post = post.find(params[:post_id]) @comment = @post.comments.create!(comme...

ios - bar button in Xcode always goes to bottom Xcode 6.3 beta -

Image
when drag bar button item onto view controller not stay @ top of view automatically go bottom under table view. know wrong? you can fix moving bar button item under navigation item, inside document outline windows. before after that should fix issue. verified issue in xcode 6.3.2

.htaccess redirects - I am completely lost -

i trying create redirects using htaccess quite bit overwhelmed all. here goes. the new domain hosted on hosting account there no site built. want use domain "easier" branding. here trying achieve. i want people go newdomain.com redirected external site: blog.olddomain.com/podcast/ i want create redirects upcoming new posts. example, want send people newdomain.com/1 , have them redirected blog.olddomain.com/episode1. newdomain.com/2 redirect blog.olddomain.com/episode2, etc. i hope can me this! thanks! ok nevermind, found solution. created redirect 301 /index.html http://olddomain . com/podcast/ and add new lines create new pages ;)

Python subprocess doesn't run until calling process finished -

edit 1 - added more code i'm not sure proc.communicate needed, 1 of suggestions found other stackoverflow code.(sorry tired last night , didn't think before asking question.) i should add not experienced coder (mechanical engineer) can tell code in gui have button call subprocess the subprocess (screenshot-cmd.exe) creates png of cropped screen shot won't produce file until there error or if button click event over. this makes me think subprocess not run until event finished i want call process several times after single button press , move files produces after each 1 produced if use proc.wait(), process hangs indefinitely. how stop this? # function take single image called 'filename' , place in directory 'dir' def takeimage(dir,filename): # calculate view capture whole display window in. clientrect = win32gui.getclientrect(win32gui.getforegroundwindow()) windowrect = win32gui.getwindowrect(win32gui.getforegroundwindow()) ...

xml - XSLT help! Convert any structure into Name Value pair -

convert following xml name value pair..any structure <root> <abc> <element_1>"<value-of select='a'>"</element_1> <element_2>"<value-of select='b'>"</element_2> </abc> <xyz> <element_3>"<value-of select='c'>"</element_3> </xyz> <element_4>"<value-of select='d'>"</element_4> </root> try (borrowed quite bit post: how output current element path in xslt? ): <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/xsl/transform"> <xsl:output method="xml" indent="yes"/> <xsl:template match="text()"/> <xsl:template match="/"> <root> <xsl:apply-templates></xsl:apply-templates> </root> </xsl:templ...

objective c - Archived App not working. Run from XCODE successful -

i have made app swift working when run xcode. however, when try archive , run .app, not start. how can check why app crashing/not starting? can reasons? this console output if enter packe , start folder contents/macos mislavs-mbp:~ proslav$ /users/proslav/desktop/trackingcore.app/contents/macos /trackingcore ; exit; dyld: library not loaded: @rpath/sqlite.framework/versions/a/sqlite referenced from: /users/proslav/desktop/trackingcore.app/contents/macos /trackingcore reason: image not found trace/bpt trap: 5 logout running terminal gives following output lsopenurlswithrole() failed error -10810 file /users/proslav /desktop/trackingcore.app. i have added framework https://github.com/stephencelis/sqlite.swift access sqlite database. library not loaded although exists in .app i found answer. in copy files linking resources instead of frameworks. seemed no problem run archving.

Create hierarchy structure in Android -

i have been tasked create/generate hierarchy structure data sqlite in android. newbie in android. appreciated. for example, hierarchy based on roles. top level highest privilege, e.g. admin. http://www.android-advice.com/wp-content/uploads/2012/02/org-chart2.dia_.png just extend view class, override ondraw method , use canvas primitives draw structure.

java - Big O Complexity for nested loop -

for (i = 0; < 2*n; += 2) { (j=n; j > i; j--) //some code yields o(1) } i thought above yield n*log(n) i've seen source n^2 complexity big oh. please explain me , how approach problems in future. since big o upper bound, n * n <= n^2, resulting in o(n*2). answer right

javascript - lodash _.sortedIndex returns last index element -

i'm using lodash _.sortedindex determine position element should go. if array being checked small enough works perfectly. array can grow quite large , after has increased size _.sortedindex returns last element of array instead of actual position var checkobject = {name: john, lastname: doe} var arrayofobjects = [1...25]; //the objects similar layout checkobject var position = _.sortedindex(arrayofobjects, checkobject, 'name') this works fine, , position returned appropriate spot. however in instance below: var checkobject = {name: john, lastname: doe} var arrayofobjects = [1...75]; //the objects similar layout checkobject var position = _.sortedindex(arrayofobjects, checkobject, 'name') it seems either return correct position or return 76 is there way ensure returned position correct? this call called function inside angular using following: $scope.$evalasync( function (data) { somefunctiontocheckindex(data) } );

How do I grab all the links within an element in HTML using python? -

Image
first, please check image below can better explain question: i trying take user input select 1 of links below "course search term".... (ie. winter 2015). the html opened shows part of code webpage. grab href links in element , consists of 5 term links want. following instructions website (www.gregreda.com/2013/03/03/web-scraping-101-with-python/), doesn't explain part. here code have been trying. from bs4 import beautifulsoup urllib2 import urlopen base_url = "http://classes.uoregon.edu/" def get_category_links(section_url): html = urlopen(section_url).read() soup = beautifulsoup(html, "lxml") pldefault = soup.find("td", "pldefault") ul_links = pldefault.find("ul") category_links = [base_url + ul.a["href"] in ul_links.findall("ul")] return category_links any appreciated! thanks. or if see website, classes.uoregon.edu/ i keep simple , locate links contai...

python - How to concatenate nested lists together into a new nested list using a loop? -

i can't seem figure out how this... have example of want outcome be, can't figure out how loop. celts = [["bass", 1,2,3], ["bradley", 7,8,9]] celts2 = [["bass", 4,5,6], ["bradley", 1,2,3]] celts3 = [["bass", 8, 5, 2], ["bradely", 7,4,1]] new = celts[0] + celts2[0] + celts3[0], celts[1] + celts2[1] + celts3[1], print new result is: (['bass', 1, 2, 3, 'bass', 4, 5, 6, 'bass', 8, 5, 2], ['bradley', 7, 8, 9, 'bradley', 1, 2, 3, 'bradely', 7, 4, 1]) using list comprehension (which is type of loop): celts = [["bass", 1,2,3], ["bradley", 7,8,9]] celts2 = [["bass", 4,5,6], ["bradley", 1,2,3]] celts3 = [["bass", 8, 5, 2], ["bradely", 7,4,1]] new = [celts[i] + celts2[i] + celts3[i] in range(len(celts))] >>> print new [['ba...

ios - Swift - Issue with variable scope with parse.com -

i'm struggling problem since 2 days swift calling parse.com class. i have variable declared @ root of uiviewcontroller class var myvariable: string? i created function call database , return value func retrievedata() { // create query var querytest:pfquery = pfquery(classname: "myclassename") // clause querytest.wherekey("columnname", equalto: "sometext") querytest.getfirstobjectinbackgroundwithblock { (myparseobject:pfobject!, errreur: nserror!) -> void in self.myvariable = myparseobject["nameofcolumnofcontainerthevaluetobereturned"] as? string println("valeurtest dans la bd = \(self.myvariable)") } } so far println inside function returns value! great the problem starts when call function inside viewdidload. want change value of myvariable calling retrievedata() function. however, variable value not change! override func viewdidload() { super.viewdi...

asp.net mvc - What happened on location url when click @Html.ActionLink more than twice? -

according to: route different view(use @html.actionlink , ng-view in view) in asp.net mvc angularjs, ng-view work 1 time, location url strange <ul> <li>@html.actionlink("home", "index", "home")</li> <li>@html.actionlink("device management", "index", "devicemanagement")</li> </ul> if click device management first time, location is:(with ngroute "/device" success!) http://localhost:13060/devicemanagement#/device if click again device management, location is:(with ngroute "/device" can't work!) http://localhost:13060/devicemanagement# why "/device" disappear when click @html.actionlink above twice? what happened @html.actionlink did? in case, should route angular route in client side.action link should modified: <a href="/#/home">home</a> <a href="/#/devicemanagement">device management...

json - jquery form callback receiving null -

i have jquery form: var uploadformoptions = { target: '#ur', beforesubmit: uploadvalidate, // pre-submit callback success: uploadresponse, // post-submit callback datatype: 'json', error: function (xhr, ajaxoptions, thrownerror) { alert(xhr.status); alert(thrownerror); }, resetform: true // reset form after successful submit }; $('#upload').ajaxform(uploadformoptions); the response function declared: function uploadresponse(responsetext, statustext, xhr, $form) { and ends responsetext === null. error function not called. the script being called php , returns value. i'm @ loss. can help? thanks. the output in script is if ( is_numeric( $uid["uid"] ) ) $bool = setcookie("gp_uid", $uid["uid"], time()+3600*24*365*10 /*expire: 10 years*/, '/'/*cookie-path*/); print json_enco...

jquery - Resetting the .style of an element / reverting to 'initial' without .style overriding -

i have div ( .projecttitle ) inside of div ( .projectcontainer ). when screen greater 1000px wide, .projecttitle initialized opacity:0; . when screen less 1000px wide, initialized opacity:1; . see: @media (min-width: 1000px) { .projecttitle { opacity:0; } } @media (max-width: 1000px) { .projecttitle { opacity:1; } } now, if .projectcontainer hovered on while screen wider 1000px, opacity of .projecttitle should animate 1, , 0 when unhovered. however, nothing should happen if hovered on when screen less 1000px; should alway remain @ 1 in case. i have variable ( windowstate ) changes depending on width of screen: less 1000px, windowstate = 3 greater 1000px, windowstate = 2 i have jquery event looks handle hovering, it's job properly: $(".projectcontainerr").hover( function(){ if (windowstate != 3){ $('.projecttitle', this).animate({ opacity:1},100); } }, funct...

c++ - class myString new programmer -

class mystring { public: mystring(const char x[]) : capacity(1024) { (int = 0; < capacity; ++i) { if (x[i] == '\0') break; s[i] = x[i]; length++; } } mystring() : capacity(1024), s('\0'), length(0) {} //etc... private: const int capacity; char s[1024]; int length; }; i'm getting error: in file included main.cpp:19:0: mystring.h: in constructor ‘mystring::mystring()’: mystring.h:21:44: error: incompatible types in assignment of ‘char’ ‘char [1024]’ : capacity(1024), s('\0'), length(0) i don't under stand what's going on. i'm bit new constructors. in advance! change s('\0') s("\0") when use single quotes, it's single character. must use double quotes test string.

asp.net mvc - Remote validation not working for MVC -

i have made remote validation in project, avoid duplicate entries in db. model class this public class supplier { public int supplierid { get; set; } public string suppliername { get; set; } [required, displayname("supplier code")] [remote("vicodeexists", "supplier", "vi code exists.", additionalfields = "supplierid")] public string suppliercode { get; set; } } and inside suppliercontroller have function this public jsonresult vicodeexists(string suppliercode, int supplierid = 0) { var user = _db.suppliers.where(x => x.suppliercode == suppliercode.trim() && x.supplierid != supplierid); return !user.any() ? json(true, jsonrequestbehavior.allowget) : json(string.format("{0} exists.", suppliercode), jsonrequestbehavior.allowget); } in create view @html.textboxfor(model => model.suppliercode) @html.validationmessag...

VIM: Determine if function called from visual-block mode -

from within function, how can determined if function called visual-block mode. involves calling function both from: normal-mode mapping command-line mode for precise function, luckily behaves identically under either normal/command mode or visual-mode single line selected. more 1 line - a:firstline/lastline - function not called normal mode. the problem need know if in visual-block mode, single line or not. i've tried following no avail: function! t() range echo [a:firstline, a:lastline] echo [getpos("'<")[1:2], getpos("'>")[1:2]] echo visualmode() echo mode() endfun vnoremap tt :call t()<cr> nnoremap tt :call t()<cr> output visual-line mode (notice crazy max-int output): [3, 4] [[3, 1], [4, 2147483647]] v n i require answers of variety either "can't done" or "step-by-step". no vague do-this do-that finish this... i'm tired of jumping through obscure vim goldberg-esque ...

python - Convert Bitstring (String of 1 and 0s) to numpy array -

i have pandas dataframe containing 1 columns contains string of bits eg. '100100101' . want convert string numpy array. how can that? edit: using features = df.bit.apply(lambda x: np.array(list(map(int,list(x))))) #... model.fit(features, lables) leads error on model.fit : valueerror: setting array element sequence. the solution works case came due marked answer: for bitstring in input_table['bitstring'].values: bits = np.array(map(int, list(bitstring))) featurelist.append(bits) features = np.array(featurelist) #.... model.fit(features, lables) for string s = "100100101" , can convert numpy array @ least 2 different ways. the first using numpy's fromstring method. bit awkward, because have specify datatype , subtract out "base" value of elements. import numpy np s = "100100101" = np.fromstring(s,'u1') - ord('0') print # [1 0 0 1 0 0 1 0 1] where 'u1' datatype , ord...

java ee - Need hellp on Loading Oracle forms from j2ee application -

we have 2 different applications oracle forms , java web application running on 2 different servers jboss , weblogic respectively. currently, users logging separately , working in 2 different windows. requirement provide hyperlink/button in each application switch between them. for example, if user logged java web application credentials, in succeeding page should hyperlink/button part of page , clicking user should authenticated oracle forms , load oracle forms page in same window. i never worked on such requirement , please me - whether feasible or not?

jquery - Cross Origin Domain Blocking in ajax Image Search API (Google) -

i new ajax. tried using ajax method google image search (deprecated api). reasons client preferring deprecated api custom search. when make request says cross-origin request blocked: same origin policy disallows reading remote resource @ https://ajax.googleapis.com/ajax/services/search/images?v=1.0&rsz=8&start=0&imgsz=xlarge,large&q=apple. can fixed moving resource same domain or enabling cors. but when call via browser url responds perfect response. my ajax request $.ajax({ type : "get", url : "https://ajax.googleapis.com/ajax/services/search/images?v=1.0&rsz=8&start=0&imgsz=xlarge,large&q=apple", beforesend : function(xhr) { xhr.setrequestheader('referer', 'http://www.mydomainexample.com'); }, success : function(result) { console.log(result) }, error : function(error) { console.log(error) } }) pardo...

Connecting two different database in Tableau -

Image
i want connect 2 database , establish relationship between them in tableau. 1 sql sever , microsoft excel sheet. how that? i have goggled lot not suitable answer. you speaking data blending - and connecting cross database data cross database querying flagship upgrade tableau 10.0 however , you cannot use cross-database joins these below connection types: tableau server firebird google analytics microsoft analysis services microsoft powerpivot odata oracle essbase salesforce sap bw splunk teradata olap connector

javascript - Push array into array with keys -

i working arrays , pushing items array. below have loop, inside casperjs invoked , links scrapped , placed in array. page links placed in array named page_links , video links in array video_links . trying merge both arrays 1 array. how can push items in array keys? var page_links = []; var video_links = []; (var = 0; < categoryurls.length; i++) { // start loop casper.thenopen(categoryurls[i], function() { tryandscroll(this); casper.then(function() { this.getelementsinfo('.title').foreach(function(element) { // skip elements don't have href attribute... if (!element.attributes.href) { return; } page_links.push( element.attributes.href ); casper.thenopen(element.attributes.href, function() { this.click('.responsivewrapper'); }).then(function(){ casper.each(this.getelementsinfo('.badge-youtube-player'), funct...

ruby - How to resolve LoadError: cannot load such file -- ffi_c -

i know how resolve next error seen when executed require command on console after installed ruby 2.2.1 windows installer , ruby gem 2.4.6 . loaderror: cannot load such file -- ffi_c c:/ruby22-x64/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_req uire.rb:54:in `require' is dll? if read requirement documentation ffi , can see: you need sane building environment in order compile extension. @ minimum, need: a c compiler (e.g. xcode on osx, gcc on else) libffi development library - commonly in libffi-dev or libffi-devel this means gem not pre-compiled, , has compile code when installs. in turn means if running on pc need install ruby development kit windows, aka ' devkit ', can downloads page on rubyinstaller site download , install devkit first, open new command line window followed by: gem install ffi refer details: https://stackoverflow.com/a/7988119/3035830

android - How to prevent removing META-INF/* files from .apk? -

i'm having jars in android libs folder have meta-inf files ( meta-inf/cxf/bus-extensions.txt more detailed) take part in extensions loading. while building android builder removes such files needed , can't loaded later in runtime. how can prevent removing of meta-inf/* files? i'd prefer avoid unpack each jar, copy files manually each time , write special code load them. ps. @ moment i'm building in intellij idea , not using maven or gradle. i had workaround - bundle resources jars meta/*, put them assets , override resources loading assets

php - GCM Downstream Android Notification -

i have created android app registration id gcm , receive downstream notification. registration part working here. (regid sent me opening email , i'm hard cording in 3rd party server.) thing when send message server app never receives it. following code.. notificationmainactivity - (registers app in gcm successfully) public class notificationmainactivity extends activity { public static final string extra_message = "message"; public static final string property_reg_id = "registration_id"; private static final string property_app_version = "appversion"; private final static int play_services_resolution_request = 9000; string sender_id = "1030512389658"; static final string tag = "kanrich gcm notification"; public textview mdisplay; googlecloudmessaging gcm; atomicinteger msgid = new atomicinteger(); sharedpreferences prefs; context context; string regid; ...

css - Converting my jQuery animations to CSS3 transitions — "proper" methods / handling variables? -

i'm on first big website project (although still personal, in sense portfolio website, , not client). i'm of way done, , have learnt lot of course of doing it. the majority of animations , other things changing , moving around on site done using jquery animations. however, has come attention today using css3 transitions better, more efficient, , nicer way things! as such i'm in process of changing bunch of jquery animations on css3 transitions, , it's gone smooth. have few question proper methods, however. example 1 for example, best way handle transition needs occur when variables in js set? there way pass these variables css, or use jq tell "when true, add these transition properties css", in order trigger animation? eg: an element must change it's height. height change different depending on screen width - handled media queries. but, height should change if xyz = true , other wise, should stay same. how can css know whether or not xyz t...

Custom item value resets after binding the ComboBox in C# -

i have raddropdownlist (telerik component combobox) , in application bind database table items into. public static void bindcombobox(raddropdownlist cb, string displaymember, string valuesmember, string sql) { connect = new sqlceconnection(connectionstring); sqlcedataadapter da = new sqlcedataadapter(sql, connect); system.data.dataset ds = new system.data.dataset(); da.fill(ds); da.dispose(); cb.datasource = ds.tables[0]; ds.dispose(); cb.displaymember = displaymember; cb.valuemember = valuesmember; cb.selectedvalue = null; } after binding items in combobox, add item it: radlistdataitem item = new radlistdataitem {text = "all", value = 0}; cmb.items.add(item); cmb.selecteditem = item; but when select new item in combobox , check selected value, it's empty (not null). what happens value set item befor...

Primefaces p:ajax listener conditional update -

jsf page: <p:commandbutton> <p:ajax process="@this" update="name desc msg" listener="#{bean.deletelistener}"/> </p:commandbutton> bean: public void deletelistener() { if (data.size() == 0) { // updates "msg" setmsg("there no data delete"); return; } setmsg("data deleted."); // , updates bean values "name" , "desc" also. ... } is possible conditionally update ajax call based on ajax listener logic. update client ids "name desc msg" conditionally shown in listener code below (note sample scenario in larger application). application uses primefaces 5. thanks. sure, use primefaces requestcontext in listener requestcontext context = requestcontext.getcurrentinstance(); //update panel context.update("form:panel"); see also: - http://www.primefaces.org/showcase/ui/misc/requestcontext.xhtml

java - How to access public variables declared in an Activity class from another class in android -

i have public variables define in activity class: public class rentlistingfeed extends actionbaractivity { private parsequeryadapter<parseobject> mainadapter; private customadapter rexovoadapter; private listview listview; public string typequery; public string bedquery; public string toiletquery; public string condquery; public string availquery; public string intentionquery; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_rent_listing_feed); typequery=getintent().getstringextra("type"); bedquery=getintent().getstringextra("beds"); toiletquery=getintent().getstringextra("toilets"); condquery=getintent().getstringextra("condition"); availquery=getintent().getstringextra("availability"); intentionquery=getintent().getstringextra(...