Posts

Showing posts from February, 2010

spring - BeanCurrentlyInCreationException: Error creating bean with name 'scrService' -

i getting following error, spring ioc container definition. has spring quartz scheduler bean definition. this final root cause of error. caused by: org.springframework.beans.factory.beancurrentlyincreationexception: error creating bean name 'scrservice': org.springframework.beans.factory.factorybeannotinitializedexception: factorybean not initialized yet @ org.springframework.beans.factory.support.factorybeanregistrysupport.dogetobjectfromfactorybean(factorybeanregistrysupport.java:170) [spring-beans-3.2.13.release.jar:3.2.13.release] @ org.springframework.beans.factory.support.factorybeanregistrysupport.getobjectfromfactorybean(factorybeanregistrysupport.java:126) [spring-beans-3.2.13.release.jar:3.2.13.release] @ org.springframework.beans.factory.support.abstractbeanfactory.getobjectforbeaninstance(abstractbeanfactory.java:1467) [spring-beans-3.2.13.release.jar:3.2.13.release] @ org.springframework.beans.factory.support.abstractbeanfactory.dogetbean(ab

BigQuery command line tool - append to table using query -

is possible append results of running query table using bq command line tool? can't see flags available specify this, , when run it fails , states "table exists" bq query --allow_large_results --destination_table=project:dataset.table "select * [project:dataset.another_table]" bigquery error in query operation: error processing job '': exists: table project:dataset.table originally bigquery did not support standard sql idiom insert foo select a,b,c bar d>0; and had way --append_table but according @will's answer, works now. originally bq, there was bq query --append_table ... the bq query command $ bq query --help and output shows append_table option in top 25% of output. python script interacting bigquery. usage: bq.py [--global_flags] <command> [--command_flags] [args] query execute query. examples: bq query 'select count(*) publicdata:samples.shakespeare'

statistics - Increasing barplot values in R -

Image
i have managed "declare" empty barplot shown below using command: barplot(c(0, 0, 0, 0, 0), names.arg = c("a", "b", "c", "d", "e"), ylim = c(0,1000)) how can "add" values bars such can achieve this: you can this, though not ideal: dat <- rep(na,5) barplot(dat, names.arg = c("a", "b", "c", "d", "e"), ylim = c(0,1000)) barplot(replace(rep(na,5),1,100), ylim = c(0,1000), yaxt="n", add=true) # ^---- position of new bar # ^------value of new bar this won't work perfectly, if example want overwrite old bar lower value, close enough. generally you'd better off saving data , redrawing entire plot each time.

Regex for multiple conditions -

this question has answer here: learning regular expressions [closed] 1 answer i want regx following condition 1.combination of letters , digits should accept. 2.combination of letters , symbols should accept. 3.only letters should accept. 4.only digits should not accept. 5.only symbols should not accept. 6.combination of letters,digits,symbols should accept. i trying this: /^([a-za-z]+\s*)*[a-za-z]+$/ what wrong. check regex ^(?=.*[a-za-z])(.+) demo

ios - I am using Camera API and QRCode API in my Project, Can i implement multitasking(splitvIew) in my Project -

i using camera api , qrcode api in project, can implement multitasking(splitview, slideover) in project. think when use camera api, want use fullscreen. project have other functionalities. is possible use fullscreen when use camera api? if app camera-centric app or gaming related, apple suggest opt out above feature. apple documentation says consider opting out if app falls 1 of these narrow categories: camera-centric apps, using entire screen preview , capturing moment primary feature. full-device apps,such games use ipad sensors part of core gameplay otherwise, apple, , customers, expect adopt slide on , split view. to opt out of being eligible participate in slide on , split view, add uirequiresfullscreen key xcode project’s info.plist file , apply boolean value yes . let me know if need more clarification same.

html - How to generate auto redirect of php page that takes one input variable to same page php with another input variable? -

so have set of values let's 90, 100, 110, 120, 130, 140, 150 first time load php page, value 90 main input variable , page displays details 90. in 60 seconds page redirects same page input variable 100. continues on , when 150-related stuff displayed, goes 90-related stuff. how can achieved?? <?php mysql_connect("localhost", "root", "qwerty") or die(mysql_error()); mysql_select_db("ups_status") or die(mysql_error()); $data = $_post['input'] ;// <!--this input should change after every redirect--> $order = "select * ups_status1 (ipaddress '%".$data."%')"; $results = mysql_query($order) or die('invalid query: ' .mysql_error()); // <!--and echo results--> ?> <?php session_start(); if (!isset($_session['counter'])) { $_session['counter'] = array(90, 100, 110, 120, 130, 140, 150); } $i = isset($_session['i']) ? $_session['i

ios - Creating relationship in Core Data to perform deletion -

i new core data started learning new ideas in core data. i have core data database has 3 entity student , department , entity mapping student , department.let name studentdepartment student have student details primary key studentid department have department details primary key departmentid studentdepartment have studentid , departmentid foreign key. multiple student can enrolled in department , same student can enrolled multiple department. how create schema in core data. if deleting studentid in student table subsequent row should deleted in studentdepartment table. if deleting departmentid in department table subsequent rows should deleted in studentdepartment.how make relationship using core data. please provide me xcmodel. coredata isn't database, it's object store happens (sometimes) implemented on top of relational database. the practical result of don't need explicitly create separate table relationship mapping. instead create 2 enti

linux - Kprobe/Jprobe in the middle of a function -

i want intercept load_elf_binary function in fs/binfmt_elf.c file, read few custom section headers file passed via argument , set few registers(eax, ebx, ecx, edx) before returning function. now read jprobes way access arguments of target function problem once control returns jprobes function register , stack values restored per it's specifications, looking way around , inserting probe in middle of function (preferably towards end) idea. please correct me if wrong , this. so, let me see if understand you're doing properly. you've modified cpu (running in emulator?) instruction 0xf1 sort of cryptographic thing. want arrange load_elf_binary invoke instruction on return, registers set instruction magic. somehow custom sections involved. this going difficult in way state. there few major problems: i'm not sure threat model is, if magic cpu instruction decrypts mapped data directly you'll modify pages in linux page cache, , decrypted code or data

css - Heroku messing up styles -

i deployed ruby application heroku , noticed styles on herokuapp appeared not loading. pictures wouldn't show up, , looked terrible. how can fix this? rails asset pipeline the problem you're observing happens if rails asset pipeline not functioning properly: css references , photo urls returning 404 errors. way resolve precompile assets (css, js, image references) locally, prior pushing heroku. asset precompile to precompile assets on development platform production prior deploying heroku. include line in production.rb config.assets.compile = false run assets precompile on development platform $bundle exec rake assets:precompile ralis_env=production push heroku deploy notes watch messages logged during heroku slug generation. should display 'assets precompiled, not compiling before generating slug...' (that's not exact language, message tells heroku has detected assets precompiled.) use browser debug inspector probe , see

r - Can I manually create an RWeka decision (Recursive Partitioning) tree? -

i have constructed j48 decision tree using rweka. compare performance decision tree described existing (externally computed) decision tree. i'm new rweka , i'm having trouble manually creating rweka decision tree. ideally, show 2 side-by-side , plot them using rweka visualization (it informative , clean). right now, i'm going export rweka computed decision tree graphviz , manipulate structure want. want check before start , make sure cant specify rules want manually specify decision tree. i don't want compute decision tree (i've done that), want manually construct/specify decision tree (for uniform comparison in presentation). thank in advanced. the rweka package cannot . however, rweka uses partykit package displaying trees can want. @ vignette(“partykit“, package = “partykit“) how can construct recursive partynode object pre-specified partysplit s , turn them constparty . vignette has hands-on example this.

Confused about how C# struct work -

i have struct public struct card { picturebox picture; double value; } i want make array of that, , add/remove pictures , value go on. i'm not able card[] c = new card[13]; c[1].value = 4; how assign, read, , chance values of those? make value public . public double value; by default , class/struct level elements private , makes inaccessible. it recommended capitalize public elements, , use properties instead of fields, using following better: public double value { get; set; } you may want consider making struct class , not fit. (see when use struct? , of time working classes in c#) use dictionary of picture's , values: public dictionary<picture, double> cards;

c# - unable to de-serialize data -

i started created unity game visual studio project. created side project (winforms) testing don't know unit testing. there, of code works perfectly, serialization class works flawlessly when protobuf-net dll used 1 unity. now, when started work on unity, copied on of code , dlls protobuf-net , mysql.data. reason, cannot (basically)same code work. exception when de-serializing, this: invalid field in source data: 0 and this unexpected end-group in source data; means source data corrupt this stack trace last exception: protobuf.protoexception: unexpected end-group in source data; means source data corrupt @ protobuf.protoreader.readfieldheader () @ (wrapper dynamic-method) neohumansoftware.aon.userinformation.user.proto_2 (object,protobuf.protoreader) @ protobuf.serializers.compiledserializer.protobuf.serializers.iprotoserializer.read (object,protobuf.protoreader) @ protobuf.meta.runtimetypemodel.deserialize (int,object,protobuf.protoreader) @ p

replicaset - Mongodb replica set questions -

i have mongodb replica set configuration of 1 primary machine, 1 secondary machine , 1 arbiter machine. primary , secondary machines have 2 collections (each in own database) i need delete few gb 1 collection , leave other collection intact. brand new @ ideas/gotchas on this. thinking of following procedure: remove secondary replica set. in secondary, collection want delete, mongodump of data want keep. do mongo restore dump. re-add secondary replica set. think have set priorities primary not become secondary? the secondary sync/catch primary hope happens data deleted in secondary? primary removes itself? (which want) do need primary? rolling maintenance: to see how time of oplog have, bring down secondary , catchup : db.printreplicationinfo() when working primary, secondary , arbiter ... taking out secondary can have risk. primary won't have failover in case happens during maintenance period. primary-secondary-secondary safer. after shutdown secondar

varnish cache miss almost every request (wordpress + varnish + docker) -

i attempting setup wordpress site using varnish, apache2, mysql, , docker. appears working, varnish on port 80 , apache running on 8080 however, when looking @ request headers, see cache hit on second time request, afterwards see nothing cache misses no matter how many times try. my config file can found below. modified config found @ https://github.com/mattiasgeniar/varnish-4.0-configuration-templates/blob/master/default.vcl and complete overkill. see obvious mistakes, or possibly have simpler config file? in advance. vcl 4.0; # based on: https://github.com/mattiasgeniar/varnish-4.0-configuration-templates/blob/master/default.vcl import std; import directors; backend server1 { # define 1 backend .host = "web"; # ip or hostname of backend .port = "80"; # port apache or whatever listening .max_connections = 300; # that's .probe = { #.url = "/"; # short easy way (get /) # prefer head / .request =

javascript - Viewport sizing not working in ios -

i have header in website set 100vh , works great everywhere except ios . ios blows image large, , have scroll way down content. i've tried height:100% results in no height. any suggestions ? ivygarrenton.com browser support vw/vh/vmin/vmax ie 9+ partial support, firefox 31+ - supported chrome 31+ , safari 7+ - supported has repaint issue ios safari 7.1+ - partial support opera - 29+ to lookup in detail refer this link you can use jquery set height , width instead of one. css more faster jquery rendering ui.

ios - How to animate a UIProgressView on each cell in a UITableView at the same time? -

i have custom cell uitableview. custom cell has uiprogressview. set progress each cell's progressview animation @ same time cells. animation should start @ viewdidappear. you can use nstimer control animation , create global progressview control cells' progressview. so: uiprogressview *progressglobal; - (void)viewdidappear:(bool)animated { nstimer *timer = [nstimer timerwithtimeinterval:1 target:self selector:@selector(increaseprogress) userinfo:nil repeats:yes]; [timer fire]; } - (void)increaseprogress { [progressglobal setprogress:(progressglobal.progress + 5) animated:yes]; [[self tableview] reloaddata]; } -(uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath { uitableviewcell *vocell = [tableview dequeuereusablecellwithidentifier:table_view_cell_identifier forindexpath:indexpath]; uiprogressview *localprogress = (uiprogressview *)[vocell viewwithtag:25]; [localprogress setprogress:p

python - irc server response to JOIN comment -

i'm new writing irc sever. log joining channel in freenode connection . server response : /join #h :test!~test@151.232.114.48 join #h * :realname and test nickname. does know , 151.232.114.48 ? the left hand side of join doing joining, if nick of nick hostname.

c# - GUI designer claims undeclared variables -

Image
i decompiled executable lost source code sometime ago. code wasn't same i've written has variables guess added automatically compiler. far, ok. when opened gui designer error: i don't understand why erros since variables declared , code compile fine. can't use gui designer. how fix this? when use designer design user interface, corresponding code put in separate file warning should not manually edit file, otherwise designer stop working. the decompiler doesn't take account designer @ all, you'll end code compiles , functions should - designer wouldn't able read properly. perhaps easiest solution create , design new form, , copy in code decompiled files afterwards (unless else has great idea not know of, of course).

javascript - Regex: Match string with substrings with the same pattern -

i'm trying match string pattern, can have sub strings same pattern. here's example string: nicaragua [[note|note|congo member of iccrom 1999 , nicaragua 1971. both suspended iccrom general assembly in november 2013 having omitted pay contributions 6 consecutive calendar years (iccrom [[statutes|s|url|www.iccrom.org/about/statutes/]], article 9).]]. [[link|url|google.com]] might appear. and here's pattern: [[display_text|code|type|content]] so, want string within brackets, , more string match pattern within top level one. and want match this: [[note|s|note|congo member of iccrom 1999 , nicaragua 1971. both suspended iccrom general assembly in november 2013 having omitted pay contributions 6 consecutive calendar years (iccrom [[statutes|s|url|www.iccrom.org/about/statutes/]], article 9).]] 1.1 [[statutes|s|url|www.iccrom.org/about/statutes/]] [[link|s|url|google.com]] i using /(\[\[.*]])/ gets until last ]] . what want ab

Can Someone Help ME Convert Objective C to Swift -

i'm trying understand conversion , i'm not getting it. rvconfig *config = [rvconfig defaultconfig]; rover *rover = [rover setup:config]; [rover startmonitoring]; here have rvconfig.defaultconfig() rover.setup(config: rover(rover) rover.startmonitoring(rover) should this let config = rvconfig.defaultconfig() let rover = rover.setup(config) rover.startmonitoring()

How to compare two ipv6 addresses on a little endian machine in C -

i trying compare 2 ipv6 addresses want create code portable. know ipv6 addresses stored in network byte order (big endian) on big-endian cpu can use memcmp across 2 in6_addr structs. easiest way same thing on little-endian machine? [edit] when want compare 2 addresses want figure out whether address less, equal, or greater other. thought memcmp endian dependent in order scans across bits in memory. actually, think memcmp work. there's not popular machine 128-bit data type know of. suspect ipv6 address carried around arrays of bytes. given network byte order big-endian, memcmp see , compare high-order byte first, want to. you right have wondered if machine's endianness matters portability, in case, think doesn't. endianness matters when we're working 16- or 32-bit integers have been copied off network, , want work them integers. here, array of bytes, concern not exist. i don't -- understand sure i'm doing first -- but, try , see!

Get ALL sql queries executed in the last several hours in Oracle -

i need way collect queries executed in oracle db (oracle database 11g) in last several hours regardless of how fast queries (this used calculate sql coverage after running tests against application has several points queries executed). i cannot use tables v$sql since there's no guarantee query remain there long enough. seems use dba_hist_sqltext didn't find way filter out queries executed before current test run. so question is: table use absolutely queries executed in given period of time (up 2 hours) , db configuration should adjust reach goal? "i need query since need learn queries out of queries coded in application executed during test" the simplest way of capturing queries executed enable fine grained audit on database tables. use data dictionary generate policies on every application table. note when writing os file such number of policies generate high impact on database, , increase length of time takes run tests. therefore should us

sql - Rails ActiveRecord: Find from ActiveRecord result in O(1) time -

simple question here. have active record results this: @users = user.all later on, want data on user ispecific id. user.find('c5ab1bfc-90ac-4b59-b5d3-fd8940aab7b1') make query database. know user in list @users, there way find user @users id, without making db query, , without looping on @users object? yep can use #detect select first match in relation without firing off query: @user = @users.detect{ |u| u.id == 'c5ab1bfc-90ac-4b59-b5d3-fd8940aab7b1' } but if running simple #find query on user (user.find params[:id]), that's not going kill application, unless i'm terribly mistaken. updated: thanks d34n5 correcting me, #select iterate through entire collection whereas #detect (aliased #find) stop @ , return first occurrence.

call function after "loop" function for multiple elements is finished in jQuery -

i've searched site solution couldn't find extract purpose. i have 2 functions. first function fades in multiple elements in delay each other until every element faded in. want start second function after first done every element. i've tried .done() , .when() or .promise() figure out solution. (the fiddle below way simplified show problem. site i'm working on more complex, therefor need solution calling function after function , not settimeout() or else.) var v = $(".box"); var cur = 0; var first = function () { function fadeinnextli() { v.eq(cur++).fadein(200); if(cur != v.length) settimeout(fadeinnextli,100); } fadeinnextli(); return $.deferred().resolve(); }; var second = function () { alert('done'); }; first().done(second) https://jsfiddle.net/c633f5w8/3/ thank in advance. i didn't want rewrite have necessary stuff. illustrates use of fadein callback. https://jsfiddle.net/c633f5

excel - IF function with drop down menu; am I doing something wrong? -

Image
i got if function, has logical expression drop down menu. i'm total excel rookie , have learned how work drop down menus. doing out of ordinary here? formula: =if(g31="ascending";h31;if(g31="descending";h31+i31*5;if(g31="pyramid";h31;h31))) the given output: #naam? (probably #name? in english): the text saying ascending drop down menu 3 options: ascending, descending, pyramid , same. cell "ascending" h31, cell "70" g31 , cell "7,5" i31. =if(g31="ascending",h31,if(g31="descending",h31+i31*5,if(g31="pyramid",h31,h31))) **, not ;**

python - Pandas: Add multiple empty columns to DataFrame -

this may stupid question, how add multiple empty columns dataframe list? i can do: df["b"] = none df["c"] = none df["d"] = none but can't do: df[["b", "c", "d"]] = none keyerror: "['b' 'c' 'd'] not in index" i'd concat using dataframe ctor: in [23]: df = pd.dataframe(columns=['a']) df out[23]: empty dataframe columns: [a] index: [] in [24]: pd.concat([df,pd.dataframe(columns=list('bcd'))]) out[24]: empty dataframe columns: [a, b, c, d] index: [] so passing list containing original df, , new 1 columns wish add, return new df additional columns.

How to customize Xamarin.Forms app? -

how can customize appearence of xamarin.forms components? want each button have same image, instance. or systems share same login screen same background image. know can adding 1 specific screen each platform project. want able customize component itself. example: buttons have same background image no matter platform running. i've read these: http://developer.xamarin.com/guides/cross-platform/xamarin-forms/custom-renderer/ http://developer.xamarin.com/guides/cross-platform/xamarin-forms/working-with/styles/ http://code.tutsplus.com/tutorials/getting-started-with-xamarinforms-customizing-user-interface--cms-22144 the promising 1 seems last one. custom renderer way accomplish this? can't add image @ shared project , automagicaly works platforms? thanks. it's not absolutely clear, exactly want reach... try answer you. if use shared project (based on template " blank app (xamarin.forms shared )", can use same page / page-definition in all

python - Scrapy only outputting an open bracket -

i'm trying scrape title , url of khan academy pages under math/science/economics pages. however, outputting open bracket, , before happened scrape start url. from openbar_index.items import openbarindexitem scrapy.contrib.spiders import crawlspider, rule scrapy.contrib.linkextractors.sgml import sgmllinkextractor class openbarspider(crawlspider): """ scrapes website urls educational websites , commits urls/webpage names/text document """ name = 'openbar' allowed_domains = 'khanacademy.org' start_urls = [ "https://www.khanacademy.org" ] rules = [ rule(sgmllinkextractor(allow = ['/math/']), callback='parse_item', follow = true), rule(sgmllinkextractor(allow = ['/science/']), callback='parse_item', follow=true), rule(sgmllinkextractor(allow = ['/economics-finance-domain/']), callback='parse_item&

operating system - Trouble outputing file size to a label from a listbox in Python 3 -

i'm using os.path.getsize() output size of file label. file path stored in listbox. function works, outputs file size in bits, wrote following convert more appropriate units, , displaying in tb. it's executing of if statements, regardless if condition true. activefile = fileslist.get(active) filesize = os.path.getsize(activefile) filesizestr = str(filesize) + ' bits' if filesize > 8: filesize = filesize / 8 filesizestr = str(filesize) + ' bytes' if filesize < 1024: filesize = filesize / 1024 filesizestr = str(filesize) + ' kb' if filesize < 1024: filesize = filesize / 1024 filesizestr = str(filesize) + ' mb' if filesize < 1024: filesize = filesize / 1024 filesizestr = str (filesize) + ' gb' if filesize < 1024: filesize = filesize / 1024 filesizestr = str(filesize) + ' tb' there couple problems in code, you re-assign filesizestr . need concatenate new

sockets - Communicating between a PC and UR5 Universal Robotics Robot Arm using TCP/IP LabVIEW -

Image
i have ur5 universal robotics robot arm , pc connected via ethernet attempting have talk each other via labview (just send strings , forth). have managed read communication robot pc using tcp listen vi , tcp read function. however, unable write robot using tcp write, or initialize connection robot using tcp open connection. have tried tcp write after robot had established connection computer via tcp listen 0 bytes sent. how send strings robot pc using labview tcp/ip? if has experience using tcp/ip in labview appreciated. a couple of points: did provided desktop gui working? that's first step. the pic helpful, need know trying send (i.e. data). what trying send should command called "spec" here . furthermore, when manual doesn't give "example" programs user example one . so trying sending in example such "(0.1,0.4,0.4,0.01,3.14,0.01)” move robot somewhere or find other command know should work. i send , listen error robot (i

c# - Regex to remove HTML attributes and tags except allowed -

i need validate input text html tags specific rules. string result = string.empty; string acceptabletags = "h1|h2|h3|h4|h5|h6|br|img|video|cut|a"; string acceptableatributes = "alt|href|height|width|align|valign|src|class|id|name|title"; string stringpattern = @"</?(?(?=" + acceptabletags + @")notag|[a-za-z0-9]+)(?:\s[a-za-z0-9\-]+=?(?:(["",']?).*?\1?)?)*\s*/?>"; result = regex.replace(msg, stringpattern, ""); stringpattern = @"\s(?!(" + acceptableatributes + @"))\w+(\s*=\s*[""|']?[/.,#?\w\s:;-]+[""|']?)"; result = regex.replace(result, stringpattern, ""); return result; this working code. example, remove onload attribute here <img src="pic.jpg" onload=" alert(123)"> but not here <img src="pic.jpg"onload="alert(123)"> p.s. better

arrays - Check if number is in multiple strings and label -

here output working with: pool name: pool 2 pool id: 1 luns: 1015, 1080, 1034, 1016, 500, 1002, 1062, 1041, 1046, 1028, 1009, 1054, 513, 1058, 1070, 515, 1049, 1083, 1020, 1076, 19, 509, 1057, 1021, 525, 1019, 518, 1075, 29, 23, 1068, 37, 1064, 506, 1024, 1026, 1008, 1087, 1012, 1006, 1018, 502, 1004, 1074, 1030, 1032, 39, 1014, 1005, 1056, 1044, 2, 1033, 1001, 16, 1061, 1040, 1045, 1027, 26, 1023, 1053, 1037, 1079, 512, 520, 1069, 1039, 514, 1048, 1082, 523, 508, 524, 517, 522, 1066, 1089, 1067, 529, 528, 1063, 505, 1081, 527, 1007, 1086, 1051, 1011, 1035, 1017, 501, 1003, 1042, 1073, 1085, 1029, 1010, 24, 1013, 1055, 1043, 1059, 52, 1071, 516, 1050, 1084, 1000, 1077, 1060, 1072, 510, 1022, 1052, 526, 1036, 1078, 511, 35, 519, 1038, 521, 1047, 507, 6, 1065, 1025, 1088, 503, 53, 1031, 504 pool name: pool 1 pool id: 0 luns: 9, 3, 34, 10, 12, 8, 7, 0, 38, 27, 18, 4, 42, 21, 17, 28, 36, 22, 13, 5, 11, 25, 15, 32, 1 pool name: pool 4 pool id: 2 luns: (this 1 empty) what s

javascript - Polymer Routing with page.js do not add hashbang to URLs when links are opened in new tab -

i using polymer starter kit uses page.js routing. hashbang page option set true in routing.html // add #! before urls page({ hashbang: true }); when links such <a href="/products/productname"></a> clicked, #! added , resulting url looks this: http://localhost:3000/#!/products/productname when links opened in new browser tab, http://localhost:3000/products/productname . how can have #! added when links opened in new tab? you have write <a href="#!/products/productname" in every href

sql - Is querying directly against tables somehow okay now? -

in past, database administrator worth salt have told never query against table directly. in fact, have prevented putting tables in 1 schema & cutting-off direct access schema...thereby forcing query or crud views & procedures etc. , further, protecting data security-layers made sense security perspective. now enters entity framework... we use entity framework work. iqueryable king! dbo schema. and, people going directly tables left-and-right because repository patterns , online examples seem encourage practice. does entity framework under hood makes practice okay now? if so, do? why okay now? help me understand. does entity framework under hood makes practice okay now? ef doesn't change dynamic. convenience of data access , rapid development, not better way data. if so, do? it not. does, think, @ least avoid constructing select * type queries. why okay now? it remains matter of opinion , culture. in general "strict" d

C++: Quickest way to get integer within a range -

i need generate hash keys n=100 million keys. study appears murmur3 (murmurhash3_x86_32, see murmur3 hash ) fastest hashing function best latency , small enough collision rate. problem facing function returns key void * . more specifically, template is: void murmurhash3_x86_32 (const void *key, int len, uint32_t seed, void *out); as hash table size smaller largest hash can generate, need table range [0, n-1]. easiest solution seems to use % operator. known slow operator, wonder if there quicker way solve problem. one interesting suggestion found given is there alternative using % (modulus) in c/c++? on stackoverflow itself. suggests 'a power of two, following works (assuming twos complement representation)': return & (n-1); my issue on newer cpus, (or of times?), performance degrades @ around sizes 2^n, iirc, due multiway cache lines. (this link provides illustration regarding insertions big memory, part 3.5: google sparsehash! ). at moment, advantages o

Expose Windows PowerShell Commands as REST call -

i'm not familiar windows os have powershell commands want execute need expose them rest call. i'm not sure easiest secure method that. environment lamp multiple rest applications. not have special front end client uses these applications. i able use code in blog post verbatim expose powershell cmdlets directly via rest: exposing powershell json-emitting, rest-like web service this c# asp.net web app run in iis. it's interesting general purpose, think better method write own. using asp.net ideal because have access runspaces, natively executing powershell code (as opposed janky thing shell out powershell.exe or that). writing own let's decide how structure api way want. even when used above code, wrote own powershell module , exposed functions wrote myself purpose. you might have @ powershell pipeworks , looks promising i've not had chance play it.

Correct way to define array of enums in JSON schema -

i want describe json schema array, should consist of 0 or more predefined values. make simple, let's have these possible values: one , two , three . correct arrays (should pass validation): [] ["one", "one"] ["one", "three"] incorrect: ["four"] now, know "enum" property should used, can't find relevant information put it. option (under "items"): { "type": "array", "items": { "type": "string", "enum": ["one", "two", "three"] } } option b: { "type": "array", "items": { "type": "string" }, "enum": ["one", "two", "three"] } any thoughts? option correct , satisfy requirements. { "type": "array", "items": {

multithreading - how to avoid multiple threads doing a merge on a single database row -

we building trading system using (jms, weblogic , oracle backend) multiple trade events create journal entries merged single position row in database table. means multiple jms consumers creating multiple journal entries contending hold of single position row update it. not scalable design because no matter how many consumers have, blocked many times while waiting lock on single oracle row. (because have few distinct positions on of activity happening). as alternative, can keep inserting journal entries. every insert journal entry can further published event queue , consumer can call oracle view (which runs aggregate query) publish things downstream. this 2nd solution has other issues time take compute oracle view number of journal entries keep growing on time. is there other way can designed ?

eclipse - No source code is available for type <xyz>; did you forget to inherit a required module? -

i'm trying add dependency gwt project. problem getting following error: [info] --- gwt-maven-plugin:1.0-beta-2:codeserver (default-cli) @ mahlzeit-web --- [info] turning off precompile in incremental mode. [info] super dev mode starting [info] workdir: e:\java\mahlzeit-web\mahlzeit-web\target\gwt\codeserver [info] loading java files in com.mahlzeit.web.app. [info] tracing compile failure path type 'com.mahlzeit.web.googlecalendarpanel' [info] [error] errors in 'file:/e:/java/mahlzeit-web/mahlzeit-web/mahlzeit-web-client/src/main/java/com/mahlzeit/web/googlecalendarpanel.java' [info] [error] line 54: no source code available type com.bradrydzewski.gwt.calendar.client.calendar; did forget inherit required module? [info] [error] line 161: no source code available type com.bradrydzewski.gwt.calendar.client.event.deletehandler<t>; did forget inherit required module? [info] [error] line 162: no source code available t

java - User stay in app when user click in to site in webview -

i have webview in android app, when navigates around site, opens in new window, want stay inside webview.. there way easily? here code in activity: public class webview1 extends activity { webview web1; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_web_view); intent in=getintent(); string urll= in.getstringextra("url"); web1=(webview)findviewbyid(r.id.web); web1.loadurl(urll); } attach webviewclient webview , shouldoverrideurlloading() on webviewclient loads url webview , returns true. for example, activity implements approach: /*** copyright (c) 2008-2015 commonsware, llc licensed under apache license, version 2.0 (the "license"); may not use file except in compliance license. may obtain copy of license @ http://www.apache.org/licenses/license-2.0. unless required applicable law o

zk viewmodel or selectorcomposer -

im newbie in zk´s world, have doubt... read zk 8 documentation (almost all). @ office partners using viewmodel inside components using composer (selectorcomposer) bind elements this: <div apply="org.zkoss.bind.bindcomposer" viewmodel="@id('vm') @init('com.some.package.someviewmodel')"> <vbox> ... elements .... <div apply="com.some.package.somecomposer"> <hbox> <vbox> <checkbox ... more code... </checkbox> </vbox> </hbox> </div> </vbox> </div> i read if apply selectorcomposer lost coupling... reason of taking selectcomposer within viewmodel? or how works? thanks lot help. from point of view selectcomposer allow reuse java code in traditional way. example can defined abstractcontroller functionality reused in other controls of same type different functionality , extend abstractcontroller . in approach can control lifecycle of componente impleme

ios - Comparing equality of [UIColor colorWithPatternImage:] -

i want compare 2 uicolors generated using [uicolor colorwithpatternimage:] equality. can't seem figure out how this. [[uicolor colorwithpatternimage:[uiimage imagenamed:@"camo2"]] isequal: [uicolor colorwithpatternimage:[uiimage imagenamed:@"camo2"]]] always returns false, whether use == or isequal. know if it's possible compare colorwithpatternimages, or cgpatterns suppose? i've tried comparing cgcolorgetpattern(color.cgcolor) doesn't work either. edit: reason have function accepts uicolor , gives me nsstring displaying user. +(nsstring *)colornameforcolor:(uicolor *)color { if ([color isequal:[uicolor whitecolor]]) { return @"white"; } if ([color isequal:[uicolor colorwithpatternimage:[uiimage imagenamed:@"camo"]]]) { return @"camo"; } ... } is insane thing do? suppose make own object has color property , colorname property... using private apis this took r

join - Proper strategy for Redis caching relational data -

we have following use case example: we have users, stores, friends (relationships between users) , likes. store these tables in mysql , key-value stores in redis, in order read redis cache , not hit database. writes done both data stores. our app therefore fast, , scalable since hit database reads. using aws scalable redis. however, have problem when user logged in , have show list of stores, , of friends store. join, , redis not support joins directly. we'd know best way store , show data. ex: if should stored in redis table key value "store/user_who likes" , mantained every write, or maybe have hourly cron construct this. can read stored data or should construct join on demand? notice not facebook updates info in realtime, rather takes several minutes friend see of friends likes page have in common. in advance responses. depends how important you. why not store each person's friends set, , each store's likes set, , when need friends given store,

python - Sending a Class' attribute to an outside function in the function call -

i'm trying generalise function in script sending in class' attribute through function call outside function, since have call attribute self.attribute_name inside class , object_name.attribute.name outside it, either error no self.attribute_name exists outside code or no object_name.attribute.name exists inside. part of code concerned follows(this fragment of full code many parts omitted): class my_window: self.get_info_box = entry(root) self.entry_button = button(root, text="choose", command =lambda: self.retrieve_input(self.get_info_box, solitaire.cards)) def retrieve_input(self, box, entity): self.user_input = box.get() entity = input_check(box) def input_check(which_box): # function outside class my_window.which_box.delete(0, "end") # want if worked return 0 my_window = my_window() something in of head tells me might possible use lambda again accomplish i'm still not sure how use them , couldn&

oop - How to access other classes methods within a class (PHP) -

i'm building php oop mvc framework personal use. i'd know if there's way or correct implementation of following: being able call method "subclass" (not extended) "subclass". mean... have class creates new objects each subclass instead of using inheritance. let's call mainclass, , has 3 "subclasses" this class mainclass { public $db; public $forms; public $pagination; function __construct() { $this->db = new class_db(); $this->forms = new class_forms(); $this->utils = new class_utils(); } } and initialization is $mainclass = new mainclass(); i can example $mainclass->utils->show_text("hello world"); and works fine. what i'd is... within $mainclass->utils->test() (another test method), able access $mainclass->db without using global or $globals. is there alternative way of achieving this? able access $mainclass methods , submet