Posts

Showing posts from August, 2010

apache spark - java.io.FileNotFoundException: localhost/broadcast_1 -

i trying run spark application using sparksql inside, whenever use left outer join giving me following error, select a.name,b.phone name left outer join phone b on (a.id=b.id) java.io.filenotfoundexception: localhost:57067/broadcast_1 @ sun.net.www.protocol.http.httpurlconnection.getinputstream(unknown source) @ org.apache.spark.broadcast.httpbroadcast$.read(httpbroadcast.scala:196) @ org.apache.spark.broadcast.httpbroadcast.readobject(httpbroadcast.scala:89) @ sun.reflect.nativemethodaccessorimpl.invoke0(native method) @ sun.reflect.nativemethodaccessorimpl.invoke(unknown source) @ sun.reflect.delegatingmethodaccessorimpl.invoke(unknown source) but there no problem me if use join instead of it. issue ? using spark version 1.0.0 generally file not found exception seen when there issue in finding file during file operation. , if sql statement culprit of exception should have got sqlexception, doing file operations before doing sql operation.

string - Read Line By Line Until Integer is Found C -

trying create program takes in text file , reads line line. finds 2 integers on each line , adds them together. outputs new line original string , total new text file. need adding 2 integers, getting them each line, , putting new line text file. input text file good morning hello 34 127 ann 20 45 10 11 fun program , find same 90 120 news paper said 56 11 how 20 5 line number 90 34 outputs first like: , continue on good morning hello 161 code: int processtextfile(char * inputfilename, char * outputfilename) { file *fp = fopen(inputfilename, "r");//open file to read char buff[1024]; char *p, *p1; int num; while (fgets(buff, 1024, fp)!=null) { printf("%s\n", buff); while(scanf(buff, "%*[^0-9]%d", &num)== 1) printf("%d\n", num); //fscanf(fp, "%s", buff); } return 0; } edit!!!!:: so i've been able accomplish this. how sort number produced? example: time money 5...

user interface - Using FLTK with Dev-C++ -

i have been working on several programming languages java , python , came c++. want build gui program , suggested use fltk, claimed lightweight , user-friendly. however, told install series of third-party tools, while still can't figure out how create simple gui application. i first told install enormous ide dev-c++ , download fltk source code (obtained here ). "tutorials" on internet suggested me install fltk package (obtained here ), while couldn't find tutorials or documentations how "import" library (i mean, specifying classpath , import classes in java). tried copy fltk source code dev-c++ folder dev-cpp\mingw64\x86_64-w64-mingw32\include , created fltk project , started compiling following code (auto-generated): /* ** copyright © yyyy name ** ** program free software; can redistribute and/or modify ** under terms of gnu general public license published ** free software foundation; either version 2 of license, or ** (at option) later version. *...

php - 'first monday previous month' strtotime confusion -

today 2015-05-14 why does date('y-m-d', strtotime('first monday previous month')) return string(10) "2015-04-18" i expected return 2015-04-06 - first monday of previous month. missing of in datetime string. try - date('y-m-d', strtotime('first monday of previous month')); docs

c# - Running a Specific Test from a Set of Data Driven Tests in Visual Studio -

does know if it's possible run specific test in visual studio set of data driven tests (i.e. using microsoft.visualstudio.testtools.unittesting library)? @ moment i'm having use conditional breakpoints , test debugging, i'm finding alittle bit of pain.

Using GOTO in ksh to return to already processed code -

i want flow of control go code has been processed . way code ... ... label code ... ... goto label basically want loop executed again after has been processed once.based on condition you don't have goto, need implement other flow controls. small example can start after comment main, start normal processing function normal , restart normal when some_condition equals 2. you can save following script file ( gupta.sh ), chmod ( chmod +x gupta.sh ) , call 10 times ( ./gupta.sh ) see different random executions , modify. #!/bin/ksh function get_random { (( between_0_3 = ${random} % 4 )) echo "random return= ${between_0_3}" return ${between_0_3} } function normal { echo "start normal execution" get_random # store return value in var some_condition=$? # ksh has switch case keyword case ${some_condition} in 0) echo "all went well" return 0 ...

when does the database is being destroy in django tests? -

i'm writing tests django app, , can't understand when database destroyed.. in django website says being destroy "he test databases destroyed when tests have been executed." i understand that, db destroyed when last test command in the last test*.py file executed. so wrote tests , have following: usermethodstests(testcase): def test_get_full_name(self): create db objects in model x stuff on them (not deleting) def test_get_username(self): * empty line create more db objects in model x but if write "print len(x.objects.all())" in * empty line, it output 0, if db deleted.. so don't understand if when db destroy/deleted can me?

C# WPF How to modify the ComboBox's selected item's color? -

i having trouble combobox's selected item color... default, when select item combobox, it's black. how change color of item white? cannot seem modify it. what's deal? in simplest case can write in xaml: <combobox itemssource="{binding dropdowmitems}" foreground="red"> <combobox.itemcontainerstyle> <style targettype="{x:type comboboxitem}"> <setter property="foreground" value="black"/> </style> </combobox.itemcontainerstyle> </combobox> in case of item template, need modify template.

c# - CMD result into a DropDownList -

i'm trying create installer restores database , want return results cmd command sqlcmd -l drop down select on button click event. is there possible way achieve without sending output of command file.txt , read each line afterwards? private void button1_click(object sender, eventargs e) { string command; command = "sqlcmd -l " ; try { system.diagnostics.processstartinfo procstartinfo = new system.diagnostics.processstartinfo("cmd", "/c " + command); procstartinfo.redirectstandardoutput = true; procstartinfo.useshellexecute = false; procstartinfo.createnowindow = false; system.diagnostics.process proc = new system.diagnostics.process(); proc.startinfo = procstartinfo; proc.start(); //get result , populate drop down } catch (exception objexception) { // log exception } } not sure if need, process class has standardoutput ...

javascript - .setCapture and .releaseCapture in Chrome -

i have html5 canvas based javascript component needs capture , release mouse events. in control user clicks area inside , drags affect change. on pc user able continue dragging outside of browser , canvas receive mouse event if button released outside of window. however, according reading setcapture , releasecapture aren't supported on chrome. is there workaround? an article written in 2009 details how can implement cross-browser dragging continue fire mousemove events if user's cursor leaves window. http://news.qooxdoo.org/mouse-capturing here's essential code article: function draggable(element) { var dragging = null; addlistener(element, "mousedown", function(e) { var e = window.event || e; dragging = { mousex: e.clientx, mousey: e.clienty, startx: parseint(element.style.left), starty: parseint(element.style.top) }; if (element.setcapture) element....

Why do the Android Keyboard pops up when adding a ListView -

i'm facing weird problem when adding listview layout. my layout contains 2 edittext , when start activity, keyboard doesn't pop automatically. when add listview anywhere in layout, keyboard pop when activity starts. i know there many ways hide keyboard one: getwindow().setsoftinputmode(windowmanager.layoutparams.soft_input_state_hidden) , may have seen other solutions problems here , here question not how prevent why happening ? i have created simple example demonstrate behavior <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@android:color/black" android:orientation="vertical" android:paddingbottom="@dimen/activity_vertical_margin" android:paddingleft="@dimen/activity_horizontal_margin" ...

java - Random order of a HashSet is always same until Server stopped -

hashset not maintain order of elements.i deployed app jboss server , observing order of hashset . it random. but had same random order until restarted application server . can explain situation underlying mechanisms? i digging issue related order of elements of hashset<object> . some of our servers had correct order maintaining (still it's random) , didn't. after have done restarts, figured out. the hashset not guarantee order of elements in it, not mean order randomly change. order of elements change when hashes need re-computed, , happens when capacity of underlying hash table needs change. the specifics of when capacity of hash changes may vary between different implementations, guaranteed if number of elements in hashset divided capacity of hashset exceeds loadfactor , hashset's capacity increase. whenever capacity increases, hash code of elements re-computed , order of elements may change.

Connect with SQL Server 2008 Express using Winforms (C#) -

i creating database coding in winforms (c#) , run script creating tables. in short create database using winforms (c#) in sql server express. but when run application error : cannot open database '' requested login. login failed. login failed user 'ketan\admin'. my connection string: server=.\sqlexpress;integrated security=true;database=mydatabasename;user id=myusername;password=mypassword; any appreciated. if have both integrated security=true; and user id=myusername;password=mypassword; in connection string, integrated security wins , specific user , password ignored , , connection attempted current windows credentials ( ketan\admin ) , doesn't seem work so change connection string to: server=.\sqlexpress;database=mydatabasename;user id=myusername;password=mypassword; now, specific user , password used connect sql server, , if correct, should able connect fine

javascript - How do i save uploaded images in folder as well as database using javacript/html.? -

i need save uploaded image files uploaded form local machine. well, want save image while clicking submit button "file saved successfully" message should saved in local database. using angular js.. code/idea can anything. javascript , html better this pls give me complete code achieve this..!! thanks in advance. saving database done server-sided. if use javascript on server instead of learning new language suggest learning node.js

c - Fibonacci Sequence Code -

the fibonacci numbers have range of interesting uses in mathematics , computer science. example, suppose single mould spores falls onto loaf of break while making breakfast 1 day. suppose 48 hours after spore created able clone itself, , create further fresh 1 every 24 hours thereafter. suppose 48 hours after created each new spore starts cloning fresh spore everyday. in general f(n) = f(n-1) + f(n-2). write program prints out number of spores present @ end of each day. stop when number of spores exceeds ten million. how many days take? int days, next, first=0, second=1; printf("enter day want know how many spores exists on\n"); scanf("%d", &days); while(next < 10000000) { if(days == 1) { next = 1; } else { next = first + second; first = second; second = next; } } printf("the day %d has %d spores\n", days, next); so far i've been able this. it's taking me no where. can else using...

sql - Conditional Self Joins -

suppose have data in table : trade id | source ----------------- x | lch x | commodore y | lch z | commodore i output : x | lch y | lch z | commodore meaning if there "lch" entry given trade id, take precedence. i have done in java or other programming language getting basic results after joining tables , filter using map etc. due performance reasons using query @ first place. could please have , let me know if there solution in sql. this task windowed aggregate function, no need join: select trade_id, source ( select trade_id, source, row_number() on (partition trade_id oder case when source = 'lch' 0 else 1 end) rn your_table ) dt rn = 1

In java I want to jump from a particular block of Statements to another block of statements. How can I achieve it? -

public class abc{ public static void main(){ try{ int =10; if(a=10){ throw new exception(); } l1:system.out.println(a); }catch(exception e){ continue l1; } } } actually trying when exception occurs wish continue next statement after well. there way can achieve java? you want put system.out.println(a); in catch block. putting in block mean executed when exception not occur. program goes catch block when exception occurs.

php - recursive function call in binary tree -

i have table ft_individual store information binary tree comprises of attributes id,user_name,active(to represent user active or not ),position(l left, r right),and father_id.... want number of child’s in left position of particular user number of child’s in left position of user. i made recursive function call not working. using php codeigniter frame work......help $l_count=$this->tree_model->childcount($user_i,'l'); $r_count=$this->tree_model->childcount($user_i,'r'); inside model. public function childcount($user_id='',$position='') { $this->db->select('id'); $this->db->from('ft_individual'); $this->db->where('father_id',$user_id); $this->db->where('position',$position); $this->db->where('active','yes'); $result=$this->db->get(); foreach ($result->re...

Using an iterator in python? -

i have learned iterators in python having hard time implementing them. i trying write class loop works: odds = oddnumbers(13) in odds: print(i) i want write iter() function , next() function this. so far have: class oddnumbers: def __init__(self, number): self.number = number def __iter__(self): return self def __next__(self): current = self.number if self.number%2 == 0: return current else: raise stopiteration but @ moment returning nothing. expect output be 1 3 5 7 9 11 13 help? you need variable track current number: def __init__(self, number): self.number = number self.current = 1 then need compare ending number, , maybe increment it: def __next__(self): if self.current > self.number: raise stopiteration current = self.current self.current += 2 return current

sql server - SSRS Expression Evaluation Issue Nested IIF/Switch -

long-time reader, first time poster. i've got tricky situation ssrs expression want with. i have, amongst others, 2 columns inside table named: forecastmovementcurrentperiod actualmovementcurrentperiod i have 5 criteria need applied in expression third column. they follows: if forecastmovementcurrentperiod = 0 , 'actualmovementcurrentperiod-forecastmovementcurrentperiod'>0, return "-100%" if forecastmovementcurrentperiod = 0 , 'actualmovementcurrentperiod-forecastmovementcurrentperiod'<0, return "+100%" if forecastmovementcurrentperiod <> 0 , if 'actualmovementcurrentperiod-forecastmovementcurrentperiod' not error, , abs((actualmovementcurrentperiod-forecastmovementcurrentperiod) / forecastmovementcurrentperiod) > 100%, return "large" if forecastmovementcurrentperiod <> 0 , if 'actualmovementcurrentperiod-forecastmovementcurrentperiod' not erro...

jquery - Why calling RSS feeds from ajax not working? -

i trying code this rss feed of football. but when calling it, giving error below xmlhttprequest cannot load http://ibnlive.in.com/ibnrss/rss/sports/football.xml . no 'access-control-allow-origin' header present on requested resource. origin ' http://localhost:8888 ' therefore not allowed access. what problem call?? my code call under $.ajax({ type: "get", url: "http://ibnlive.in.com/ibnrss/rss/sports/football.xml", datatype: "xml", success: xmlparser }); function xmlparser(xml){ console.log(xml); var xmlcode=''; $(xml).find('item').each(function(){ xmlcode+="<li>"+$(this).find('title').text()+"</li>"; }); $('.headline-ul').html(xmlcode); } is there else needed use field? please follow below links may in resolving issue displaying feed content using jquery returning xml ajax requestfor...

ios - FB.getLoginStatus returns status unknown -

i using cordova facebook plugin ios . fb.getloginstatus(function(response) { console.log(json.stringify(response)); }); fb.login( function(response) {}); i getting error {"status":"unknown","authresponse":null} as stated in facebook document, fb.getloginstatus return 3 possible responses: the user logged facebook , has authenticated application (connected) the user logged facebook has not authenticated application (not_authorized) the user not logged facebook @ time , don’t know if they’ve authenticated application or not (unknown). fb.getloginstatus(function(response) { if (response.status === 'connected') { // user logged in , has authenticated app // show open graph related features here. such frictionless sharing } else if (response.status === 'not_authorized') { // user logged in facebook, has not authenticated app ...

ios - How to track a user's action for posting on facebook (actually posted VS canceled)? -

to specific, i'm using unity3d (targetting ios 8) , plugin post on facebook. 2 plugins unfortunatelly behaved similarely; both failed @ doing expected, meanning problem doesn't come them (prime31 & u3dxt). answer i'm looking doesn't have specific setup. what want do, let user post message on facebook timeline, , reward him upon doing so. problem can't track whether post did complete or not, due follwing situations: if facebook app not installed on ios device, cancelling or failling on posting due whathever reason returns "false", while posting returns "true". if facebook app installed on ios device, cancelling or completing post, return "true". any idea why having fb app installed make things work differently? rewarding people posting supposed work fine? or trying not intended be? thanks only incentivize person log app, enter promotion on app’s page, or check-in @ place. don’t incentivize other actions. ...

unity3d - Unity Event.current is null reference, only s_Current available -

event e = event.current; this compiles. gives null reference execption on runtime. using debugger find event e = event.s_current; // ok event e = event.s_masterevent; // both these exist those objects exist , have want, doesnt compile. i using unity 5.0.1f1 personal. heeelp please! http://docs.unity3d.com/documentation/scriptreference/event.html event.current null outside of ongui(), what's causing exception. http://answers.unity3d.com/questions/661247/using-eventsnullreferenceexception.html

c# - The specified type member 'Title' is not supported in LINQ to Entities -

i got error when using title property in linq entity: the specified type member 'title' not supported in linq entities. initializers, entity members, , entity navigation properties supported. my query is: var db = faraworkspaceentity.getentity(); var query = item in db.projectmanagers item.projectid == projectid select new userlistitem { id = item.userid, title = item.user.title // here error }; return query.tolist(); public class user : identityuser<string, userlogin, userrole, userclaim> { [required] [display(name = "نام")] [stringlength(50)] public string firstname { get; set; } [required] [display(name = "نام خانوادگی")] [stringlength(50)] public string lastname { get; set; } public string title...

file - Read streamfile in java -

i working on comma separated value file.i want extract first position["0" place in array] value each raw , want math calculation on it. csv inputfile a,b,c,d 12,32,45,76 23,45,77,56 32,34,49,28 73,92,26,68 73,36,77,26 for getting first position give me error this exception in thread "main" java.lang.numberformatexception: input string: ""12" @ sun.misc.floatingdecimal.readjavaformatstring(floatingdecimal.java:1268) @ java.lang.double.parsedouble(double.java:548) @ rotation.pkg45.rotation45.main(rotation45.java:49)//code line no-49 it work fine second , third position fourth give same error first. package rotation.pkg45;import java.io.file; import java.io.filenotfoundexception; import java.util.scanner; import java.util.logging.level; import java.util.logging.logger; import java.io.filewriter; import java.io.*; import java.text.decimalformat; import java.util.arraylist; import java.util.collections; import java.util.list; import jav...

elasticsearch - Elastic search queries -

i have large database in elastic search. want data analysis. size of data want database 25,000. means there 25,000 results search query. want data csv file. firstly installed csv plugin server. when set size 25,000 doesn't display data. how can data set csv file? use logstash elasticsearch input , csv output ! following simple configuration can use export es data csv file: input { elasticsearch { host => "localhost" port => 9200 index => "your_index" query => '{ "query": { "match_all": { } } }' } } output { csv { path => "/path/to/you/csv/file.csv" fields => ["field1", "field2", "field3"] } } save configuration in logstash.conf file , run bin/logstash -f logstash.conf

angularjs - Using ng-repeat in directive causing form validation not working properly -

Image
in html, <form name="textform" novalidate> <cms-radio name="color" require="true" option="[{title:'red', value:'red'},{title:'orange', value:'orange'},{title:'green', value:'green'}]" ng-model="color"></cms-radio> </form> in js, angular.module('cmsradio',[]).directive('cmsradio', function(){ 'use strict'; return { restrict: 'e', scope: { name:'@', require:'=', option:"=", bindedmodel: "=ngmodel" }, replace:true, templateurl: 'radio.html' }; }); in radio.html <div class="form-group" ng-form="{{name}}" ng-class="{'has-error':{{name}}.$invalid && {{name}}.$dirty}" > <div class="radio" ng-repeat='item in op...

C# CR must be followed by LF -

i write simple http server myself, , use c# windows form retrieve content of http server. c# program said protocol violation, cr must followed lf. know issue can solved adding configuration files c# projects. want know reason. http server code in below. /* * handle connection each client * */ void *httpconnection_handler(void *socket_desc) { //get socket descriptor int sock = *(int*)socket_desc; int read_size; char *message = "http/1.1 200 ok\r\ncontent-type: text/xml; \r\ncharset=utf-8\r\n\r\n"; char *end = "\r\n"; char send_message[3000] = {0}; //send messages client char * buffer = 0; long length; file * f = fopen ("/mnt/internal_sd/device-desc.xml", "r"); if (f) { fseek (f, 0, seek_end); length = ftell (f); fseek (f, 0, seek_set); buffer = malloc (length); if (buffer) { fread (buffer, 1, length, f); } fclose (f); } strcat(...

java - Replace whitespace in JSON keys -

i thinking of best solution replace whitespaces in json keys underscore. { "format": "json", "testdata": { "key spaces in it": { "and again": { "child_key1": "financial", "child_key2": null }, ......... ..... i want above converted shown below: { "format": "json", "testdata": { "key_with_spaces_in_it": { "and_again": { "child_key1": "financial", "child_key2": null }, ......... ..... any suggestions ? does java library have predefined function ? replacing keys the following code uses google's json parser extract keys, reformat them, , create new json object: public static void main(string[] args) { string testjson = "{\"testkey\": \"test\", \"test spaces\": { \"chil...

java - How to load an image to an applet? -

i want load image applet keep getting nullpointerexception whenever run program. here code using load image. please help. img = getimage(getdocumentbase(), getparameter("questionmark2.jpg")); g.drawimage(img, 100, 100, this);

javascript - Populating the form with default values on click of radio buttons -

i have form 3 radio buttons , 3 text boxes , on click of radio button 1 input field shows , other 2 hides (using jquery). wish submit form filling 2 hidden fields default values , have tried assign values 2 hidden fields didn't worked , please me , here's have tried till know , unable assign values hidden text field . $(document).ready(function(){ $('input[type="radio"]').click(function(){ if($(this).attr("value")=="red"){ $(".box").hide(); $(".red").show(); } if($(this).attr("value")=="green"){ $(".box").hide(); $(".green").show(); } if($(this).attr("value")=="blue"){ $(".box").hide(); $(".blue").show(); } }); }); .box{ padding: 20px; display: none; margin-top: 20px; ...

mongodb - how can I find the average of the sums of a field? -

i have documents looks this { parentid: 2, childid: 4, data: 7 }, { parentid: 2, childid: 3, data: 5 }, { parentid: 2, childid: 3, data: 1 } i pull average of sum of data grouped childid parentid = specific id. for example data return given parent id (2) is ((5 + 1) + (7)) / 2 is there way nest $sum inside $avg or need return list of sums grouped childid , average them myself? first $sum data group childid find $avg of sums. db.collection.aggregate( [ { "$match": { "parentid": 2 }}, { "$group": { "_id": "$childid", "sumdata": { "$sum": "$data" }}}, { "$group": { "_id": "null", "avgdata": { "$avg": "$sumdata" }}}, ] ) { "avgdata" : 6.5 }

deployment - Ruby on Rails on few servers -

i have big application. 1 of part of highload processing user files. decide provide 1 dedicate server. there nginx distribution content , programs (non rails) processing files. i have 2 question: what better use on server? (rails or else, maybe sinatra) if i'll use rails how deploy? can't find instruction. if have 1 app , 2 servers how deploy , delegate task each other? ps need authorize user on both servers. in rails use devise. you can use rails this. if both servers act web client end user you'll need sort of load balancer in front of 2 servers. haproxy great job on this. as far getting 2 applications communicate each other, less trivial may think. should use locking mechanism on performing tasks. delayed_job default lock job in queue other works not try , work on same job. can use callbacks activejob notify user via web sockets whenever job completed. anything take time or calling external api should placed background processing queue you...

Google Drive PHP Client render PDF? -

i'm trying render pdf service account (the file shared service). $pdf = $drive->files->get($file_id); $pdf->downloadurl however, resource coming in 401 unauthorized. it's funny i'm authorized files , everything, downloading actual files unauthorized? i want render pdf inside page, possible? the downloadurl , webcontentlink not authorized, have send access_token request: $file->downloadurl . '&access_token=' . $access_token;

php - Secure Hidden form Data $_POST -

Image
i fiddling around in chrome , realized hidden form element can changed user in chrome inspector. as can see in picture above user can go in , edit form in chrome , submit form. i'm curious if there way around such more secure way of sending data files not want changed user. easy, don't put in form. can put it? store in session .

javascript - How do I split up index.js file in a node/mean/express application? -

i've got 1 incredibly long index.js route file node/mongo/express application. here structure. app.js /models schedule.js task.js etc... /routes index.js /public /javascript etc... i want this app.js /models schedule.js task.js etc... /routes index.js schedule.js tasks.js etc... /public /javascript etc... how can split index.js file? for example, have tried in app.js file var routes = require('./routes/index'); var tasks = require('./routes/tasks'); // later in file app.use('/', routes); app.use('/tasks', tasks); however, not finding task routes did before when had index.js. because took routes starting "/task" routes/index.js , placed them in routes/task.js, why express not recognizing routes in new file? any advice @ helpful, friend , new whole meanjs way of doing things, , cobbled have various tutorials. desperately need refactor, because routes/index.js g...

c# - How to run business logic on one computer of the local network and GUI on another? -

i have wpf application running on computer connected local network , there special device connected computer controlled application. there easy way migrate gui (wpf xaml) computer connected same network gui , bl stay coupled? i have been looking wcf there quite limitations make time consuming adapt wcf situation. wcf work if handle both properties (not supported @ all) , events in 1 servicecontract. no, there no simple way that. if gui , bl running on different machines, have implement special code perform network communications between apps (i.e. gui , bl 2 different apps), , if gui , bl tightly coupled, it's impossible , pointless (network-related code contain service contracts tremendous in size , remoting consume large amount of time, making ui interaction slow , painful) - should refactored. there is, however, workaround problem - can run app on machine both bl , gui, show gui on different machine: remotedesktop or remoteapp ( https://technet.microsoft.co...

java - Replacing hole punched/STUN UDP socket with TCP socket at runtime -

i have situation used stun establish udp [rtp] connection between 2 clients can stream media 1 packet loss. now, done streaming media , 1 client send other client large file. rather using udp [rtp] send large file, find more convenient, programmer, send file tcp because tcp takes care of re-sending lost packets on behalf. can tell client applications stop using udp connections (say "socket.close(); socket = null;") , open new tcp connections @ same port/address udp connections? work or three-way handshake blocked? there timing or security issue involved? in cases replacing hole punched udp tcp work , in cases not work? tcp , udp ports different. tcp socket @ port 1000, different communication endpoint udp socket @ port 1000. application span new thread, establish new tcp connection , transfer desired file. udp connection can continue exchange of rtp packets.

python - Sort ages into certain age groups using function? -

i need program read .txt file, example: mary 15 george 35 harry 18 suu 18 stacy 6 john 56 and after reading file, program sort ages age groups, are: [0-6], [7-15], [16-18], [19-30], [31-50], [51-) i know how make python read file. i'm not sure how sort people age groups shown above. could me or suggest something? not asking write me program. need starters. first create bunch of age groups groups = {(0,6):[],(7,15):[],(16,18):[],(19,30):[],(31,50):[],(51,5100):[]] then iterate on putting each person in group for person in people: (min_age,max_age),my_people in groups.iteritems(): if min_age <= person.age <= max_age: my_people.append(person)

c# convert a string hex to ascii ? string reading from a csv file -

i'm trying in c# , visual studio express convert long string of chars contains hex data names in ascii words example : file column read contain string 4e 4f 54 49 46 59 .................. (continue) that means in asci "notify" my program getting exception when method tohex try convert this. why appear exception? caused char of space between each 2 chars of hex ascii values? a first chance exception of type 'system.formatexception' occurred in mscorlib.dll first chance exception of type 'system.reflection.targetinvocationexception' occurred in mscorlib.dll first chance exception of type 'system.reflection.targetinvocationexception' occurred in mscorlib.dll using system; using system.collections.generic; using system.linq; using system.text; using system.threading.tasks; using system.windows; using system.windows.controls; using system.windows.data; using system.windows.documents; using system.windows.input; using...

9 slice scaling in Sprite Kit -

does sprite kit have equivalent 9 slice scaling sprites? i have tried googling, not finding anything, but... it's feature goes different names in different frameworks. missing it. spritekit supports 9-slices. https://developer.apple.com/library/ios/documentation/graphicsanimation/conceptual/spritekit_pg/sprites/sprites.html#//apple_ref/doc/uid/tp40013043-ch9-sw10 the document doesn't tell set size won't work without it, here is: skspritenode *button = [skspritenode spritenodewithimagenamed:@"stretchable_button.png"]; button.centerrect = cgrectmake(12.0/28.0, 12.0/28.0, 4.0/28.0, 4.0/28.0); button.size = cgsizemake(100.0, 50.0);

version control - Get revision number of a tagged file in WinCvs -

Image
this seems should simple, can't find solution appears work... i need cvs command given name of tag have applied file, give revision number. cvs tree structure: (filename) | +--> 1.1-----(branch) | | | 1.1.1.1---(tag1) | | | 1.1.1.2---(tag2) | | | 1.1.1.3---(tag3) | | | : 1.2 | | : for example: using cvs command, given tag name "tag2", how can cvs give me revision number "1.1.1.2"? the closest thing can find using log command -q flag, still gives me more information need. ex: cvs -q log -h filename passing tagname log command seems have no effect. cvs version information: my current solution use perl script parse output log command there has simpler way... passing tag name (with -r option) log command have effect, not particularly useful...

javascript - save handsontable to persistent state -

i have created table using handsontable: hot = new handsontable(container, { data: [], dataschema: {id: null}, startrows: 5, startcols: 1, colheaders: ["car"], columns: [ {data: 'id'} ], rowheaders: true, minsparerows: 1, persistentstate: true, onchange: function (change, source) { console.log(change); console.log(source); } }); they have pretty elaborate example on saving/loading to/from server using ajax. however, want use persistent state save load stuff. in particular want when cell's value in hot changed want save information in local storage, can retrieve later. closest got use change parameter in onchange , save manually localstorage. main question how can save cell's info once changed local storage? better persistentstorage. also, can save whole hot table local storage? more efficient update whole table ...

c# - Read Same Text File in Different Methods -

in btnnext_click method it's reading text file different text file, , not 1 opened. not go line line. need here code: public void scrubdata() { string filename1; string filepath1; // display openfile dialog box user openfiledialog openfiledialog1 = new openfiledialog(); openfiledialog1.filter = "txt files|*.txt"; openfiledialog1.title = "select txt file"; // show dialog. if user clicked ok in dialog if (openfiledialog1.showdialog() == system.windows.forms.dialogresult.ok) { try { string strfilename = openfiledialog1.filename; string strfilepath = system.io.path.getdirectoryname(strfilename); string filename = system.io.path.getfilenamewithoutextension(strfilename); string strfilenameandpathnew = strfilepath + openfiledialog1.initialdirectory + "\\" + filename + "_scrubbed.txt"; // if scrubbed...