Posts

sorting - Drying up Models for Solr Sunspot searchable with Concerns -

i want dry models; sunspot allows one(1) "searchable" block in model. making 2 ignores second one. failed example below: digital.rb class digital < activerecord::base include baseconcerns belongs_to :digitable, polymorphic: true # ignores searchable string :url text :url string :remark text :remark end end base_concerns.rb module baseconcerns extend activesupport::concern included before_create{ self.id = uuidtools::uuid.timestamp_create().to_s.downcase if id.blank? } self.primary_key = 'id' # searchable text :id time :created_at time :updated_at end end end i want dry models using concern , want named columns searchable; while others can specify; how can this?

linux - static route w/ next hop to VPN gets "Network is unreachable' -

ubuntu 14.04, linux kernel 3.13.0-77-generic i have 3 servers a, b, , c. servers , b in same network (rackspace) , server c in network (aws). have vpn connection goes server b vpc server c located in. vpn connection works, can send traffic across server b server c , vice versa. have not been able figure out how route traffic server server c. believe solution add static route on server a, so: $> route add -net 10.0.0.0 netmask 255.252.0.0 gw xxx.xxx.xxx.xxx where xxx.xxx.xxx.xxx private ip address of server b. however, output of command siocaddrt: network unreachable i can ping , route traffic server b server a, assume unreachable network 1 across vpn tunnel. #/ect/sysctl.conf on server b ----------------------------- net.ipv4.ip_forward=1 net.ipv4.conf.all.accept_redirects = 0 net.ipv4.conf.all.send_redirects = 1 net.ipv4.conf.eth0.arp_notify = 1 vm.swappiness = 0 net.ipv4.tcp_rmem = 4096 87380 33554432 net.ipv4.tcp_wmem = 4096 65536 33554432 net.core.rmem_max = 335...

reactjs - Fetch not working on React Native Android debug -

i'm trying create simple reactnative app play around graphql , rn on android (i'm familiar getting work on iphone). but i'm running problem -- root component places get request api. although request works when spin xcode simulator, fails when run android version on phone. the android/ios versions identical. 2 index files both use react-native-router-flux , identical, , import shared components. here's simplified code of component: constructor(props) { super(props); this.state = { source: 'mygraphqlendpoint' } } componentdidmount() { if (this.props.drill) { return null; } this.serverrequest = fetch(this.state.source) .then((result) => result.json()) .then((json) => { this.setstate({ drill: json.data.drill }); }); } componentwillunmount() { this.serverrequest.abort(); } render() { const { drill } = this.state; if (!drill) { return null; } ...

python - Split RDD for K-fold validation: pyspark -

i have dataset , want apply naive bayes on that. validating using k-fold technique. data has 2 classes , ordered i.e. if data set has 100 rows, first 50 of 1 class , next 50 of second class. hence, first want shuffle data , randomly form k-folds. problem when trying randomsplit on rdd, creating rdds of different sizes. code , example of dataset follows: documentdf = sqlcontext.createdataframe([ (0,"this cat".lower().split(" "), ), (0,"this dog".lower().split(" "), ), (0,"this pig".lower().split(" "), ), (0,"this mouse".lower().split(" "), ), (0,"this donkey".lower().split(" "), ), (0,"this monkey".lower().split(" "), ), (0,"this horse".lower().split(" "), ), (0,"this goat".lower().split(" "), ), (0,"this tiger".lower().split(" "), ), (0,"this lion".lower...

windows 10 mobile - Is there any way to programmatically back out of an W10m app rather than exiting it? -

application.current.exit() exits app programmatically, need simulate same effect when press out of app, ie suspending it. possible? (yes know shouldn't mess around it's specific purpose) no, it's not possible exit app programmatically without terminating it.

Getting only the words starting with certain characters - autocomplete in jQuery -

i have following code perform auto-completion input. the problem i'm having function if type in "en" returns not words starting "en" (example: english, england, enterprise, etc) word contains string of characters "en" anywhere (example: central, century, calendar, etc) what change need make in code words start characters type in? thanks (function($){ $.fn.autocomplete = function(options){ var o = $.extend({}, $.fn.autocomplete.defaults, options); // public methods if (typeof options == 'string') { this.each(function(){ var = $(this); if (options == 'destroy') { $(window).off('resize.autocomplete', that.updatesc); that.off('blur.autocomplete focus.autocomplete keydown.autocomplete keyup.autocomplete'); if (that.data('autocomplete')) that.attr('autocomplete', that.data('autocomple...

c - How can hacker take advantage of array or pointers -

i graduate looking find work have question code security. in java there no out-of-bound arrays , there no pointers suggests java more secure c. in c these out-of-bounds arrays can cause stack corruption or buffer overflow , dangling pointers. in interview may asked "how can hacker take advantages of these?" how go answering this? examples welcome. well, talk heartbleed (there ton of documentation out there). basically, there api call made via network, code request communication keep-alive, like: you: send me "potato", 6 chars. response: potato however, there no check text requested, , length of text sent in aligned, this: you: send me "potato", 512 chars. response potato&&&&#8388325099#((#(#)%#(((#%)password:1234#(%()#%((#%#(#%)(#)(%)(##()jfjfeoijf#)j(jf)(#j)(#j#)(j#))j#.... where responding computer send potato, plus 506 bytes of stack around local variable, contain anything, including passwords, etc. that en...