Posts

vb.net - How to communicate between 2 programs efficiently? -

what easy implement way communicate between 2 vb.net (3.5) form applications running on same machine? the current problem in each program user needs logged use. if user logged one, , clicks button launch another, should pass logged in not need log in again in second program. i looking solution can used other purposes well. note: not vb.net developer myself, member of team managing expressed difficulties task , trying research possible solution him. you can use socket pass information around. solution work 2 programs written in language.

split - C function for separate a string in array of chars -

i want create function split text using separator in c. 2 parameters text , separator passed function , function should return array of chars . for example if string hello word of c , separator white space . then function should return, 0. hello 1. word 2. of 3. c as array of chars. any suggestions? does strtok not suit needs ?

Python code for calculating number of an alphabet -

i need find number of alphabet in range of alphabets ie = 1, b=2 , c =3.... if returning value should 1 is there shorter method provided in python(inbuilt) find other declaring dictionary of 26 alphabets respected values. please if know of such function..... use ord() >>> c = 'f' >>> ord(c) - ord('a') + 1 6 if want 'f' , 'f' both return 6, use lower() >>> c = 'f' >>> ord(lower(c)) - ord('a') + 1 6 you might interested in chr() >>> c = 'f' >>> chr(ord(c) + 1) 'g'

.net - Entity Framework - Querying Inheritance -

Image
i tasked homework assignment make task tracker. wanted learn entity framework assignment, how use inheritance aspects. projects, tasks , sub-tasks have lot of similar properties, thought use inheritance, can't figure out how query particular projects. i drew diagram in visual studio: i created database model. how can employees projects? i've started this: modelcontainer m = new modelcontainer(); var employee = (from e in m.employees e.username == username select e).first<employee>(); but ((employee)employee).projects not available, ((employee)employee).items is. ((employee)employee).items.projects not available. how employee's projects? should add navigation property employees this? you'll have use queryable.oftype(tresult) extension method in order filter entities of type manager: using (var model = new modelcontainer()) { manager manager = (from m in model.employees.oftype<manager>() ...

java - Byte Array to Double Array -

i have array of bytes representing data .wav file. want convert array of doubles, can operations such fft on determine whether 1 file contained in other. right now, cast bytes doubles, gives me decent results, not precise like. know improper conversion, , feel causing me miss data, because of difference in bytes , doubles represent. how can convert byte array double array before doing fft correlation? if each byte represents signed 8-bit sample value, data has been lost when sample recorded, , there nothing improper or imprecise casting double (which can accurately represent values byte can) - there isn't else can do.

debian - Running linux serial script in background -

i'm running simple script connect serial port of electricity monitor , save output file: cu -s 57600 -l /dev/ttyusb0 >> /var/www/power.txt i'd ideally set off going in background , leave running, think might need daemon this? have experience using cu unattended? thanks, laurence i haven't used cu before, in general can make command run in background putting & after it. e.g cu -s 57600 -l /dev/ttyusb0 >> /var/www/power.txt &

logging - Ruby: Proxy pattern, reducing method calls -

how proxy ruby logger , keep performance? so, have requirement @ work, quite reasonable. when program sent signal hup log flushed , restarted. class localobject attr_accessor :logger def initialize context # 1 less method call! yea! performance++ @logger = context.logger end def @logger.info "hello world" end end the problem, if context.logger reset, @logger still points old one. so, thought proxy logger: class loggerproxy attr_accessor :logger def debug *args @logger.send :debug, args end def info *args @logger.send :info, args end end context.logger = loggerproxy.new context.logger.logger = logger.new 'my_file.log' signal.trap('hup') { context.logger.logger = logger.new 'my_file.log' } ... @logger = context.logger @logger.info "hello world" this works fine, except i've traded 1 method call 2 method calls (1 accessor; returns logger). still have call loggerproxy.:debug,...