Posts

Showing posts from January, 2013

php - Get Directory contents but dont show directory -

i have linux hosting , want files specified url because these files registered users. when accessing directory url files showing up. example: www.site.com/files (this should redirect home page) example: www.site.com/files/filename.zip ( should able download file) i tried .htaccess modrewite files directory not showing file. any idea, how resolve problem. a lame workaround, nevertheless; include empty index file in directory. also add line in .htaccess or httpd.conf file: indexignore *

"this.point.config" is not working anymore in highcharts tooltip -

i have same problem posted in post : highcharts pass multiple values tooltip i want pass data tooltip this.point.config[2] not working. found this example. it's not working there too formatter: function() { return 'param1: '+this.point.config[2] + 'param2: '+this.point.config[3]; can please me if want pass in values tool tip, data series needs list of objects rather list of values: data: [ { x: 7, y: 10, config1: 'test', // our custom data config2: 'test2' // our custom data }, { x:10, y:20, config1: 'test3', // our custom data config2: 'test4' // our custom data } ] so in highcharts formatter function can reference custom parameters eg. config1 , config2 (you can use whatever name want really) : tooltip: { formatter: function() { return 'param1: '+this.point.config1 + '<b

Java AWT/Swing : paintComponent issue with custom JPanel(s) -

ok, basically, have far: a main class creates custom jframe (applicationwindow). an applicationwindow class extends jframe , acts window. a mapdisplaypanel class extends jpanel , meant (using gridlayout) display 8x8 grid of: a mapblock class extends jpanel. mapblocks contained in class contain game data, gamedata.java it seems work, except 1 mapblock painted screen. code: main.java public class main { public static void main(string[] args) { final applicationwindow window = new applicationwindow(); window.setvisible(true); } } applicationwindow.java public class applicationwindow extends jframe { public applicationwindow() { settitle("heroes!"); setlocationrelativeto(null); setsize(800,600); // setlayout(new borderlayout()); jpanel map = new mapdisplaypanel(); add(map);//, borderlayout.center); } } mapdisplaypanel.java public class mapdisplaypanel extends jpanel{ gamedata game = null; public mapdisplaypanel() {

objective c - Decrypt with java and AES file encrypted in Obj-C -

i have file encrypted obj-c code: nsmutabledata *filedata = [nsmutabledata new]; // file data. [[self encrypt::filedata withkey:@"some_key"]] - (nsmutabledata*) encrypt:(nsmutabledata*)data withkey: (nsstring *) key { // 'key' should 32 bytes aes256, null-padded otherwise char keybuffer[kcckeysizeaes128+1]; // room terminator (unused) bzero( keybuffer, sizeof(keybuffer) ); // fill zeroes (for padding) [key getcstring: keybuffer maxlength: sizeof(keybuffer) encoding: nsutf8stringencoding]; // encrypts in-place, since mutable data object size_t numbytesencrypted = 0; size_t returnlength = ([data length] + kcckeysizeaes256) & ~(kcckeysizeaes256 - 1); char* returnbuffer = malloc(returnlength * sizeof(uint8_t) ); cccryptorstatus result = cccrypt(kccencrypt, kccalgorithmaes128 , kccoptionpkcs7padding | kccoptionecbmode, keybuffer, kcckeysizeaes128, nil, [dat

How to globally PREVENT json rendering in rails? -

i have rails application in of actions respond json. is there "switch" can turn off prevent controllers responding json despite respond_to method call, or still have disable manually in every action (which seems odd). i have proposal, though bit hacky i'm afraid :) class < applicationcontroller before_filter :disable_json def disable_json if request.format =~ /json/ //do like, redirect_to or reply message end end the before_filter fired before specific controller's method. the json header "application/json" for request , can read more here: http://guides.rubyonrails.org/action_controller_overview.html#the-request-object

Java method doesn't change parameter objects -

this question has answer here: is java “pass-by-reference” or “pass-by-value”? 71 answers i have function this: public static int partition(list list, listelement eleml, listelement elemr){ listelement elemx; ... elemr = elemx.next; return x; } and @ end of funktion elemr changed, after calling function main method parameter elemr has still same value before function call. what's problem? how can change listelement , "save" change after function called without changing return type listelement (i need integer return value too)? java functions parameters called reference name, meaning when place object function argument, jvm copies reference's value new variable, , passes function argument. if change contents of object, original object change, if change actual value of reference, these changes destroyed when function e

regex - Removing many types of chars from a Python string -

i have string x , wish remove semicolons, periods, commas, colons, etc, in 1 go. there way doesn't require big chain of .replace(somechar,"") calls? you can use translate method first argument of none : string2 = string1.translate(none, ";.,:") alternatively, can use filter function : string2 = filter(lambda x: x not in ";,.:", string1) note both of these options work non-unicode strings , in python 2.

Javascript/Jquery not working in Internet Explorer 6-8 -

jquery/javascript not working @ my website ie 6-8 browsers. can have ie7 compatibility in ie9 click f12 , choose browser mode ie7. example jquery: hover on category images. click like/dislike. the contact form sending. use jquery 1.9 version, jquery 2.0 not support ie < 9 jquery 2.0 & above version leaves behind older internet explorer 6, 7, , 8 browsers. in return smaller, faster, , can used in javascript environments code needed old-ie compatibility causes problems of own. don’t worry, jquery team still supports 1.x branch run on ie 6/7/8. can (and should) continue use jquery 1.9 (and upcoming 1.10) on web sites need accommodate older browsers. reference: http://blog.jquery.com/2013/04/18/jquery-2-0-released/

r - Error: ggplot2 doesn't know how to deal with data of class SpatialPointsDataFrame -

i trying follow tutorial found on http://www.r-bloggers.com/mapping-the-worlds-biggest-airlines/ . able plot following tutorial, convert robinson projection. have noticed there might error ne_10m_populated_places.shp after doing readogr command. please me figure out must spatial shapes? library(ggplot2) library(maps) library(rgeos) library(maptools) gpclibpermit() library(rgdal) worldmapin<- readshapepoly("ne_10m_admin_0_countries.shp") worldmap_ogr <- readogr(".", "ne_10m_admin_0_countries") worldrobinson <- sptransform(worldmap_ogr, crs("+proj=robin +lon_0=0 +x_0=0 +y_0=0 +ellps=wgs84 +datum=wgs84 +units=m +no_defs")) urbanareasin<- readshapepoly("ne_10m_urban_areas.shp") urbanareas_ogr <- readogr(".", "ne_10m_urban_areas") urbanareasrobinson <- sptransform(urbanareas_ogr, crs("+proj=robin +lon_0=0 +x_0=0 +y_0=0 +ellps=wgs84 +datum=wgs84 +units=m +no_defs")) simp<- gsimplify(u

Update XML stored in a XML column in SQL Server -

Image
i have sample table in sql server 2012. running queries against .modify() xquery method executing not updating. here table for trying update settings 'newtest' this execute nothing updating! help! since there xml namespace ( xmlns:dev="http://www.w3.org/2001/xmlschema" ) in xml document, must inlcude in update statement! try this: ;with xmlnamespaces(default 'http://www.w3.org/2001/xmlschema') update xmltable set xmldocument.modify('replace value of (/doc/@settings)[1] "newtest"') xmlid = 1

java - Android - Change text of button in a selected row -

i've tried nothing have worked. have listview this: [ checkbox ] | [textview] | [button] what i'm trying change text of [button] in row witch [ checkbox ] checked. here problematic block of code: public view getview(int position, view convertview, viewgroup parent){ final viewholder vh; final view conv; if(convertview == null){ layoutinflater vi=(layoutinflater)pcontext.getsystemservice(context.layout_inflater_service); convertview=vi.inflate(r.layout.rest_dishes_item, null); conv=convertview; final button b[]; b=new button[itens.size()]; vh=new viewholder(); vh.txt=(textview)convertview.findviewbyid(r.id.dish_name); vh.checkbox=(checkbox) convertview.findviewbyid(r.id.dish_item); vh.qnt=(button) convertview.findviewbyid(r.id.qnt); vh.quantidade=new quantidade[itens.size()]; for(int i=0;i<itens.size();i++){

c++ cli - How to display global variable on messagebox? -

this written code, void horizontal_calculate() { string ^aa = filenames[0]; std::string file1(marshal_as<std::string>(aa)); string ^bb = filenames[1]; std::string file2(marshal_as<std::string>(bb)); double result3=horizontal_read(file1); double result4=horizontal_read(file2); double result=result3/result4; result1=result; system::diagnostics::debug::writeline("{0}",result); } private: system::void button4_click(system::object^ sender, system::eventargs^ e) { (int = 0; < filenames->length; i++) system::diagnostics::debug::writeline(filenames[i]); semicircle(); horizontal_calculate(); oblique(); messagebox::show("time ratio = "result1"","screening result",messageboxbuttons::ok, messageboxicon::information); } i have declared double=result1 global variable. it comes out error "error

php - why this is not the array I need? -

i have array $num_arr ,so want new array it's sum smaller 10,so write code this, $num_arr=array(1,3,6,5,4,2,7,9,5,3,6,2,4,7); $sum=0; for($i=0;$i<=count($num_arr);$i++){ $sum+=$num_arr[$i]; $k++; if($sum>=10){ $need_arr[]=array_slice($num_arr,0,$k); array_splice($num_arr,0, $k); $k=0; $sum=0; } } the result $need_arr not right,that why , how can right array this: array(array(1,3,6),array(5,4),array(2,7),array(9),...) ? implemented "oneliner" fun: $num_arr=array(1,3,6,5,4,2,7,9,5,3,6,2,4,7); $result = array_reduce($num_arr, function($result, $curr) { if (!count($result)) { $result[] = array(); } $last =& $result[count($result) - 1]; if (array_sum($last) + $curr > 10) { $result[] = array($curr); } else { $last[] = $curr; } return $result; }, array()); var_dump($result); online demo: http://ideone.com/afvmkp

css - How to add image between blog posts -

i'm trying figure out how add image between blog posts (i.e., graphic basic divider line, not border) on website: www.sacspartans.org i know how create , div, add image, etc. don't know file make modification to. know? i'm using toolbox, bare bones starter theme. any appreciated. edit: opened index file... i'm not sure add div. add div right above <?php endwhile; ?>

activemq - how can the broker get the message from jdbc persistent storage? -

Image
i want ask feasibility actimvemq's configuration. have guarantee 4 contidions. 1) each producer, consumer , broker in 1 server loaded on same 1 jvm. 2) each producer in 1 server have deliver messages consumer of same server. 3) if 1 of servers killed , remained messages in server, want other server's broker messages of killed node , execute instead of killed node. message in jdbc database store. could recommmand alternative way or elborate explanation implementation? i'm new activemq , it's urgent. me. in advance.. http://img41.imageshack.us/img41/9104/croppercapture52.jpg the dilemma want have active-active setup (cluster assume) want fail on inside cluster. you can't active nodes picking failed brokers db , continue there. can create additional setup of brokers on each machine, acting slaves first ones. look @ docs http://activemq.apache.org/masterslave.html then each machine has fail on machine. way no message stranded (assuming

kendo ui - Why is the KendoUI DataSource change event not raised after data a dataitem is modified? -

i have put jsfiddle demonstrates change event not being fired when data item modified. go fiddle , see grid , links under grid. click on each 1 of links in order, , see modify operation happen, change event not raised. can see modification did happen, when click on refresh grid link. add/remove operations refreshing grid not needed, , change event raised. how can change event raised when dataitem modified? regards, scott http://jsfiddle.net/codeowl/gfpdc/108/ for reason stackoverflow saying that: " links jsfiddle.net must accompanied code " markup: <div id="kendogrid"></div> <p>&nbsp;</p> <ul> <li><a id="lnkwireupdatasource" class="link">wire datasource</a><br /></li> <li><a id="lnkaddrecord" class="link">add record</a></li> <li><a id="lnkmodifyrecord" class="link">modify re

php - Laravel eloquent table structure -

i quite new laravel , eloquent world , i'm loving far, having trouble understating how structure tables , models in order me able crud data eloquents relationships. far have structured tables this: users -----------------has_one------->onsite_teachers onsite_teachers -------has_many------>train_lines train_lines -----------has_many------>train_stations train_lines -----------belongs_to---->text_train_lines train_stations --------belongs_to---->text_train_stations my question how best construct models me able crud using relationships. because have tried following no success: $user = user::find(1); $user->onsite_teacher->train_lines()->save($data); $user->onsite_teacher->train_lines->train_stations()->save($data); it looks query wrong try this: $user = user::find(1); $user->onsite_teacher()->first() ->train_lines()->save($data);

bookmarks - Make the display url of a web site different than the actual url for bookmarking purposes -

is possible display different url actual url bookmarking purposes? here's why, web site a.com live , being use administrative purposes have not been added new site. when user visits a.com, redirected a_new.com. a_new.com temporary , become a.com need users able to bookmark a.com though @ a_new.com. makes sense? cool, thanks, w no and thing (though won't you) for example if user visits www.goodsite.com and goodsite site vulnerable script injection. evil hacker changes bookmarking property of goodsite.com evilsite.com next user bookmarks site in surprise. the best thing think when new domain comes set redirect on pages of temporary domain

validation - how to validate checkbox number in Yii -

my page has many checkbox, varies 5 100, need verify checked number. minimal number 2, max 8. went through yii documents, , not found such validation method. how can achieve in elegant way? in addition, want save checkbox value in session while user manipulating , how achieve this? by using range validation can achieve functionality. rule come bellow. modify according program public function rules() { return array( array('your_attribute', 'required'), array('your_attribute', 'in','range'=>range(2,8),'message'=>'range should in 400 690'), ); } i got syntax here http://www.yiiframework.com/forum/index.php/topic/25286-yii-numbers-range-validator/

oop - PHP: get_called_class() vs get_class($this) -

in php difference between get_called_class() , get_class($this) when used inside instance? example: class { function dump() { echo get_called_class(); echo get_class($this); } } class b extends {} $a = new a(); $b = new b(); $a->dump(); // output 'aa' $b->dump(); // output 'bb' is there difference in case? when should using 1 or other get_called_class() or get_class($this) ? in case there's no difference, because $this points correct instance class name resolved using get_class() . the function get_called_class() intended static methods. when static methods overridden, function return class name provides context current method that's being called.

iphone - how to change the arrow direction of UIMenuController just before shown in an UIWebView -

Image
i trying change arrow direction when appears not block top bar set application. here code used change direction: uimenucontroller *menucontroller = [uimenucontroller sharedmenucontroller]; [menucontroller setarrowdirection:uimenucontrollerarrowup]; and here result, say, pretty stressful: it appears same issue on iphone well. can this? thanks after days of researching, find way change arrow direction of menu controller in webview. first, please in view controller's viewdidload method. [[nsnotificationcenter defaultcenter] addobserver:self selector:@selector(menucontrollerwillshow:) name:uimenucontrollerwillshowmenunotification object:nil]; [[nsnotificationcenter defaultcenter] addobserver:self selector:@selector(menucontrollerwillhide:) name:uimenucontrollerwillhidemenunotification object:nil]; then, add these 2 functions, arrow direction pointing up, in case menubar appear below text. (same way, can change uimenucontrollerarrowup; other direction if want

iphone - iOS push Notification SSL Revoked -

i have implemented push notification , uploaded build appstore. notifications coming fine on development, not coming production, found there issue in .pem file have generated production. unfortunately lost private key production ssl certificate, therefore can't generate same .pem file same certificate without private key. must have revoke old certificate new one. my question that. have upload new build on appstore after revoking certificate? created new certificate seems notifications not coming on production still. should have upload build?? yes, have create new provisioning profile new certificate , need submit build again new provisioning profile.

c# - How to combine this String with LINQ -

i have linq query. has combine matching string " " single string value. tried below code model. showing: linq entities not recognize method 'system.string aggregate[string](system.linq.iqueryable 1[system.string], system.linq.expressions.expression 1[system.func`3[system.string,system.string,system.string]])' method, , method cannot translated store expression. please suggest me how can write query combine set of strings single string. code btags = db.bibcontents.where(x => x.bibid == q.bibid && x.tagno == "245") .select(x => x.normvalue) .aggregate((s, x) => s + " " + x).firstordefault() thanks why not use string.join like: string str = string.join(" ", db.bibcontents .where(x => x.bibid == q.bibid && x.tagno == "245") .select(x => x.normvalue));

c# - Style "filter operators" ComboBox of Telerik RadDataFilter -

so have raddatafilter <telerik:raddatafilter x:name="raddatafilter" /> problem: want hide filter operators combobox. (the 1 has "contains", "is equal to" ... etc. etc. etc.) searching telerik's website , forum led me believe way override whole controltemplate . the solution came style base on trigger: <style targettype="telerik:radcombobox"> <style.triggers> <trigger property="x:name" value="part_simplefilteroperatorcombobox"> <setter property="visibility" value="collapsed" /> </trigger> </style.triggers> </style> you can name , set style raddatafilter so: <telerik:raddatafilter x:name="raddatafilter"> <telerik:raddatafilter.resources> <style targettype="telerik:radcombobox" basedon="{staticresource hiddenoperatorstyle}" /> <

HTML setting image for background -

hello i'm beginner in html , wanna ask if can set imege 1 http://www.hdwallpapers.in/walls/water_drops_on_glass-wide.jpg html background. please help! add entry stylesheet, or insert in section of html: <style> body { background-image:url('http://www.hdwallpapers.in/walls/water_drops_on_glass-wide.jpg'); } </style>

web services - Convert android AsyncTask call to a separate class and call from all activities -

i new android development. have asynctask function in application. calling http request activities. in each activity using following class connect server, in activities called twice !!. basically web developer , in such cases use single class can accessed entire application(web) , use common function same activity. difference input , out put changed. my doubt in case can use ( convert) such function or class ? assume create android class ( can accessed activities ) just make json string need specific server ( process in server ) just pass created json created class , made http connect ) process returned data server pass corresponding activity so can use same function activities , can avoid duplicate query can convert code such manner ? my code public class mainactivity extends activity { @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setrequestedorientation (activityinfo.screen_orie

javascript - how to keep the y-axis labels in between the lines in HighChart plug in -

Image
i using this plugin create chart . i have : and want: how can this? references?? and here code chart $(function () { $('#container').highcharts({ chart: { type: 'column', margin: [ 100] }, title: { text: 'world\'s largest cities per 2008' }, xaxis: { categories: personnamelist, labels: { rotation: -45, align: 'right', style: { fontsize: '13px', fontfamily: 'verdana, sans-serif' } } }, yaxis: { min: 0, title: { text: 'population (millions)' } }, legend: { enabled: false }, tooltip: { formatter: function() { return '<b>'+ this.x +'</b>

hadoop - Will mapreduce use node where most of the gzip'd file is? -

i'm having hdfs cluster big gzip 'd files. i made sure blocks of gzip 'd files on same datanode, writing them hdfs data node. for in {1..10}; scp file$i.gz datanode1: ssh datanode$i hadoop fs -put file$i.gz /data/ done now want run mapreduce task on files. i expect jobtracker put job processing file1 on datanode1 , blocks are. indeed, if datanode dies lose locality, work until dies? if doesn't work that, can write fileinputformat that? gzip isn't splittable compression format (well if stack gzip files end end), firstly make sure block size of gzip files same / bigger actual file sizes. as gzip file isn't splittable, if have 1g gzip file 256m block size, there chance not of blocks file reside on same datanode (even if upload 1 of datanodes, there no guarantee on time failures , sure, blocks not moved around other nodes). in case job tracker never report local map task if of blocks non-resident on node task running. as task a

django - Phone_info matching query does not exist -

views.py def add_phone(request): user=request.user try: phone = phone_info.objects.get(user=user.id) except phone_info.doesnotexist: phone = none phoneform = phoneform({'user':request.user}) phone = phone_info.objects.get(user=request.user) phoneform = phoneform(instance=phone) if request.method=='post': phoneform = phoneform(request.post,instance=phone) if phoneform.is_valid(): phone=phoneform.save(commit=false) phone.save() return redirect('/member/contact-list/') return render_to_response('incident/add_phone.html', { 'about_menu': true, 'phoneform' :phoneform }, context_instance=requestcontext(request)) models.py is class phone_info(models.model): user = models.foreignkey(user, null=true) name1 = models.charfield('name', max_length=100, null=true, blank=true) number1 = models.charfield(&

dependencies - Dependency Error while installing LibreOffice on RHEL -

i'm quite new red hat sorry possibly dump question. i want install libreoffice. therefore downloaded tar.gz libreoffice.org. after extracting files run root: yum install *.rpm . results in following output: [root@oc0715621235 rpms]# yum install *.rpm loaded plugins: downloadonly-background, fastestmirror, refresh-packagekit, security, versionlock loading mirror speeds cached hostfile setting install process examining libobasis4.0-base-4.0.2.2-2.x86_64.rpm: libobasis4.0-base-4.0.2.2-2.x86_64 marking libobasis4.0-base-4.0.2.2-2.x86_64.rpm installed examining libobasis4.0-calc-4.0.2.2-2.x86_64.rpm: libobasis4.0-calc-4.0.2.2-2.x86_64 marking libobasis4.0-calc-4.0.2.2-2.x86_64.rpm installed examining libobasis4.0-core01-4.0.2.2-2.x86_64.rpm: libobasis4.0-core01-4.0.2.2-2.x86_64 marking libobasis4.0-core01-4.0.2.2-2.x86_64.rpm installed examining libobasis4.0-core02-4.0.2.2-2.x86_64.rpm: libobasis4.0-core02-4.0.2.2-2.x86_64 marking libobasis4.0-core02-4.0.2.2-2.x86_64.rpm install

jsf 2 - Passing parameter in EL action doesn't work with RequestScoped bean -

edit: using jsf scopes , jsf managedbean instead of cdi doesn't work cdi beans regardless of requestscoped, conversationscoped or sessionscoped. i'm trying pass parameter function on bean this: <h:commandbutton action="#{bean.update(wp.nr)}" value="update" /> however update function called if make bean viewscoped, not when requestscoped. using viewscoped doesn't seem work know whether use of @ least viewscoped requirement passing parameters in el calls in action or requestscoped should work , there else going on. this on glassfish 3.1.2.2 the bean looks this import javax.faces.bean.managedbean; import javax.faces.bean.requestscoped; @managedbean(name="bean") @requestscoped public class filiaalbean implements serializable { private static final logger log = logger.getlogger(filiaalbean.class.getname()); @inject testejb testejb; // removed data member , getter , setters public string update(int wpnr

oracle jdbc driver not working as i wanted -

i'm bit confused oracle jdbc. i use ojdbc16 by following step : 1) adding ojdbc.jar build path -> work in local ( connexion, request etc..) 2) trying test webapp jetty sealing violation: package oracle.jdbc sealed dont see drivers can load appart ojdbc.jar :/ maybe come copy/paste nexus ? remove dependencies "ojdbc" pom.xml. 3) trying test webapp jetty. it's working (huh) if eclipse:eclipse (update of classpath) not working anymore. 4) when run junit test, fail because oracle driver seems unfindable. i'm confused, how can step 3 work. , how can step 4 doesn't work step 3 work ? , how can fix probleme ojdbc ? thanks, summary: if find class @ compile time not @ runtime, might help: try copying ojdbcxx.jar file use java folder structure... details: i've been wrestling 2 days - , reading lots of stackoverflow answers, many helped understanding of related things :-). came across solution worked me. i using: windows 7

android - slide down view weight -

i have linear layout has 4 childs different weights. when user click button @ first child , want add new child parent linear layout different weight ( 0dp height ) . when adding new child childs height changing.how add new view without change height percantage ? ------ view 1 (25%) ------ ------ view 2 (25%) ------ ------ view 3 (25%) ------ ------ view 4 (25%) ------ after adding new layout programmatically ------ view 1 (25%) ------ ------ view 2 (25%) ------ ------ view 3 (25%) ------ ------ view 4 (25%) ------ ------ view 5 (25%) ------ total layout 125% , scrollable. thanks when use weights, sizes of views determined dynamically ensure views fit within size of parent - proportions determined weights. from described, linearlayout not sound correct solution problem. listview may better approach, automatically provide scrolling func

sql - postgresql WITH statement add empty records to report -

i'm writing request postgresql database (9.2) describe structure of schema tables. make result of request more readable, want add epmty record after rows, corresponded exact table. i think easiest way reach that, using statement. experience problems here. current result rowset part: "table_name" "column_name" "format_type" "description" "is_pk" "is_nullable" "foreign_table" "foreign_column" "active_keys" "table" "" "login activation keys" "" "" "" "" "" "key" "character varying(900)" "activation key" "pk" "" "" "" "" "loginid" "bigint" "activated login "" "y" "" "" "addresses" "table" "" &qu

uPNP - handling changes to local IP address -

i boot laptop w/o lan connection , link-local address 169.254.1.1 my local upnp clients/servers start discovering 1 , communicating. now connect lan , dhcp assigns me proper routable ip address 10.0.0.4. i upnp clients , servers start interacting others on lan. do clients , servers need written detect situation , restart upnp sessions or there better way? example, there upnp s/w libary supports ip address changes internally? thanks, r ohnet detect changes in ip address , update devices, including switching them between network interfaces. c++ library bindings c#, java , c clients. liberally licensed , has ports available desktop , mobile platforms. disclaimer: i'm not entirely unbiased here - maintain project.

numpy - Python save txt file in a different folder -

the following script running , saving txt output in desktop running script desktop. however, want save txt files documents in new folder named ascii. how can give command doing that. 8phases.txt has following lines- -1 1 -1 -1 1 1 1 1 1 1 -1 1 -1 -1 -1 1 1 -1 1 -1 -1 -1 -1 1 the script- import numpy np import matplotlib.pyplot plt d=12 n=np.arange(1,4) x = np.linspace(-d/2,d/2, 3000) = np.array([125,300,75]) phase = np.genfromtxt('8phases.txt') i_phase = i*phase count,i in enumerate(i_phase): f = sum(m*np.cos(2*np.pi*l*x/d) m,l in zip(i,n)) s = np.column_stack([x,f]) np.savetxt((str(count)+'.txt'),s) any please- you should provide full path in argument of savetxt method, example: np.savetxt(r"c:\ascii\%s.txt" % count,s)

google maps - JQuery - refresh a marker position (to get movement) -

i have gps based system sends mysql database coordinates. using code: (function() { window.onload = function() { // creating new map var map = new google.maps.map(document.getelementbyid("map"), { center: new google.maps.latlng(41.65, -0.88), zoom: 1, maptypeid: google.maps.maptypeid.roadmap }); function createpoints(json){ var infowindow = new google.maps.infowindow(); // looping through json data (var = 0, length = json.locations.length; < length; i++) { var data = json.locations[i], latlng = new google.maps.latlng(data.lat, data.long); var iconbase = 'https://maps.google.com/mapfiles/kml/shapes/'; var marker = new google.maps.marker({ position: latlng, map: map, title: data.nome, icon: iconbase + 'schools_maps.png' });

JavaScript array iteration - MDN example -

i reading re-introduction javascript on mdn website , came across example in array section: for (var = 0, item; item = a[i++];){ // item } where "a[]" array being looped over. i confused value "item" have in first iteration. i=0 , item @ first undefined, when assigned value of a[i++] wouldn't iteration start i=1, mean iteration start second element in a[] array -> a[1], skipping on first element a[0] entirely? i++ post increment operator, means increments i 1 evaluates old (non-incremented) value. > = 0 0 > i++ 0 > 1

jquery - Populating javascript array with async geocode function -

so, i'm parsing information , querying geocode multiple addresses. i'm not entirely sure what's best way of doing it. here's i'm trying do. for($j = 0; $j < $rawarray.length; $j++){ $basestr = $addresnum != 'empty' ? $rawarray[$j][$addresnum] + ' ': ''; $basestr += $addresstr != 'empty' ? $rawarray[$j][$addresstr] + ' ': ''; $basestr += $addresdiv != 'empty' ? ', ' + $rawarray[$j][$addresdiv] : ''; $basestr = ($basestr.tolowercase().indexof("qc") >= 0 || $basestr.tolowercase().match(/qu[e-é]bec/) ? $basestr : $basestr + ", qc"); console.log("looking for: " + $basestr.match(/\w\d\w([ ])*\d\w\d/i)[0]); $basestr = $basestr.match(/\w\d\w([ ])*\d\w\d/i)[0]; $geocoder.geocode({ address: $basestr }, function(locresult, status) { $arraycoords[$j] = new array(); if (status == google.maps.geocoderstatus

.net - Deploying a Console Application by only copying the Bin Directory -

i wanting have deployment process console applications, similar web deployments. looking way copy contents of "release" directory network share directory via vs deployment process. i know, seems strange, however, these applications used batch internal jobs. however, have go thru development process, dev, uat, production. since our process copy/paste , not install, limited process. problem copy/pasting uat environment getting uat server settings instead of production. i'm trying make efficient possible without having our deployment team thinking. so main question: process deploy console application visual studio results are, essentially, copy/pasting release directory target directory on remote server? i think asking mix of things: how transform configuration files target specific environment how automatically copy binaries , transformed configuration files the vs publish button both. for #1 need define compile configuration each target environme

android - Add CustomViews to a LayoutView dynamically -

i have layoutview in scrollview named mylayout , want add view composed layoutview textview , editext inside scrollview according value, example method addmycustomviewtomylayout(int x){ .... } that adds desired number of elements mylayout in scrollview, the customviews added scrollview should linked activity , set value from-to app. is possible? how do? there's nothing special scrollviews. can think of them boundless view. while normal layouts linearlayout bound area, scrollview allow child whatever height wants (or width in case of horizontalscrollview). scrollviews contain 1 child. child size bound width of scrollview, not bound height. thus, child measure based on idea has enough vertical space show everything. in case, create or inflate mylayout want. add scrollview. if want add other views it, add mylayout layout view. let scrollview thing.

Ideal C# IEnumerable generic number sequence with start and interval -

i looking for, not find, idiomatic example generic class implementing ienumerable, this: constructor takes start , interval , , getenumerator returns ienumerator , starts starts , goes on forever returning items interval. in other words, like: public class sequence<t> : ienumerable<t> t :... { public t start { get; private set; } public t interval { get; private set; } sequence(t start, t interval) { ... } ienumerator<t> getenumerator() { for(t n = start ; ; n += interval) // not compile yield return n; } ... else? } there lots of related questions, , small snippets, bits&pieces, have not been able find single nice example of complete class, @ least similar enough. how implement this, if there existing class this, it'd know, not answer question. so, actual question(s): recent c# version has introduced new features useful this, , ideal example code it? also if there common pi

data visualization - How to combine different barplot in R? -

Image
i new r user. i have difficult time figuring out how combine different barplot 1 graph. for example, suppose, top 5 of professions in china, are, government employees, ceos, doctors, athletes, artists, incomes (in dollars) respectively, 20,000,17,000,15,000,14,000,and 13,000, while top 5 of professions in us, are, doctors, athletes, artists, lawyers, teachers incomes (in dollars) respectively, 40,000,35,000,30,000,25,000 , 20,000. i want show differences in 1 graph. how supposed that? beware have different names. the answer question straight forward. new r user, recommend make liberal use of 'ggplot2' package. many r users, 1 package enough. to "combined" barchart described in original post, answer put of data 1 dataset , add grouping variables, so: step 1 : make dataset. data <- read.table(text=" country,profession,income china,government employee,20000 china,ceo,17000 china,doctor,15000 china,athlete,14000 china,artist,13000 us

sql - Calculate variance of frequencies when dataset does not contain entries of frequency zero -

i have dataset has 3 fields: id, feature , frequency. want find out, group of given id's, feature has largest spread of frequencies. result want if split group of id's 2 sub-groups, using median value of frequency feature, have 2 groups different each other , yet of equal size. my first thought calculate variance of frequencies each feature , use feature variance highest. given database table looks this: id | feature | frequency ---+---------+------------- 0 | 0 | 1 0 | 1 | 1 0 | 2 | 0 1 | 0 | 2 1 | 1 | 2 1 | 2 | 0 2 | 0 | 3 2 | 1 | 3 2 | 2 | 8 3 | 0 | 4 3 | 1 | 8 3 | 2 | 10 4 | 0 | 5 4 | 1 | 10 4 | 2 | 12 feature 0 has frequencies of 1, 2, 3, 4, 5 feature 1 has frequencies of 1, 2, 3, 9, 10 feature 2 has frequencies of 0, 0, 4, 10, 12 we can see feature 2 has biggest spread , splitting on 4 make nice point split 2 groups (0, 0 , 4 1 group , 10 , 12 other g