Posts

vba - Excel crashes when running a loop to disable controls -

public sub optionsdisable() dim mycontrols commandbarcontrols dim ctl commandbarcontrol dim iarray(21, 3181, 292, 3125, 855, 1576, 293, 541, 3183, 294, 542, 886, 887, 883, 884) long dim myelement variant each myelement in iarray set mycontrols = commandbars.findcontrols _ (type:=msocontrolbutton, id:=myelement) if not mycontrols nothing each ctl in mycontrols ctl.enabled = false next ctl end if next end sub okay everyone, when run subroutine, excel crashes. trying run through loop disable every control id in array. i'm thinking happening is entering infinite loop, set breakpoint on first line statement, , still crashes, before gets there. so, other guess it's problem array , or variant defining. anyone have idea? p.s. running code crash excel. try this: public sub optionsdisable() dim mycontrols commandbarcontrols dim ctl commandbarcontrol dim iarray va...

How to get the server name in a Java Web Application -

i have web application users deploy on own java web servers (e.g. tomcat). java side of web application needs report url of web application (e.g. http://aserver.com:8080/myapp or https://blah.blahsever/myapp ). since number of users use port-forwarding , other network techniques, web application reports wrong name. i have tried following techniques don't produce user requires. note (request httpservletrequest) request.getlocaladdr(); // returns: 127.0.0.1 request.getlocalname(); // returns: localhost request.getservername(); // returns: localhost request.getserverport(); // returns: 8080 request.getcontextpath(); // returns: /myapp request.getscheme(); // returns: http inetaddress.getlocalhost().gethostname(); // returns: serverxxx-xxx-xxx-xx.xxxx-xxxxxxx.net inetaddress.getlocalhost().gethostaddress(); // returns: xxx.xxx.xxx.xxx (ip address) inetaddress.getlocalhost().getcanonicalhostname(); // returns: serverxxx-xxx-xxx-xx.xxxx-xx...

Dynamic Buttons/Images with Django and Mongodb -

i have mqtt client logs messages mongodb. use django dynamically create webpage image or button on depending on last insert database. example there either 0 or 1 if latest insert 0 display green power button if 1 display red power button. on pressing of button performs command , inserts opposite value in database. possible , if how? to answer question, 1 of ways achieve want using css , jquery. use other libraries comfortable or vanilla html. use css change color of button depending on last insert's value. use jquery's on() function handle click event , trigger ajax request django backend invoke function want.

c - glibc error detected no idea what is wrong -

#include<stdio.h> #include<stdlib.h> #include<math.h> //#include<mathscall.h> #include<time.h> #include"plot.h" int main() { int no_packets = 10000; //float lamda = 0.1; double lamda = 0.1,*lamdas; int i,j,cumulative_x,count = 0; int trans_time = 1; double temp,*throughput; int iterations = 1/0.1; printf("iterations: %d\n",iterations); throughput = (float *)malloc(iterations*sizeof(float)); lamdas = (float *)malloc(iterations*sizeof(float)); int *pkt_collision; double *pkt_holder; int k=0; float p; for(p=0.1;p<1.1;p=p+0.1) { lamdas[k]=p; printf("lamdas: %f\n",lamdas[k]); k++; //printf("k: %d\n",k); } int l=0; while(lamda<1.1) { count = 0; temp = lamdas[l] * no_packets; int avg_packets = (int)temp; //printf("in here\n"); pkt_holder = ...

Script to copy database between servers -

the answer spike here needed. hurdle how have backup run on 1 server , restore run on through linked server in 1 script ? must script can turned stored procedure that's fed source , destination db names. does present problem source server sql server express 2012 whereas destination full version? it has script can run against db changing db name , logical names. it's process that's need run regularly , automatically against different db each time. also, why wouldn't better detach, copy mdf , ldf, re-attach? i'd suggest right clicking on database in management studio, clicking tasks generate scripts. you can script entire database (make sure in advanced options select script both schema , data) , restore on other database. you can backup 1 instance , onto bear in mind may have issues if you're moving between versions. transfering ldf/mdf files possible in opinion difficult , high risk.

c# - How do I figure out the names of OutputCache items? -

i have situation in across our app, there lot of content can put in outputcache , content can refreshed user @ point. need clear cache when user instigates refresh action. i assumed simple enough, httpresponse has method removefromoutputcache . method takes string name of item has been cached. not there easy way list of item names have been cached. as result have overriden outputcacheattribute following class: public class hierarchyoutputcache : outputcacheattribute { public static readonly concurrentbag<string> cachedpages = new concurrentbag<string>(); public hierarchyoutputcache(params string[] varyparameters) { location = outputcachelocation.server; duration = int.maxvalue; varybyparam = string.join(";", varyparameters); } public override void onactionexecuted(actionexecutedcontext filtercontext) { base.onactionexecuted(filtercontext); cachedpages.add(filtercontext.httpcontext.reques...

FPDF image size -

i'm using fpdf php add image pdf , want put automatically size of image find function function fctaffichimage($img_src, $w_max, $h_max) { if (file_exists($img_src)) { $img_size = getimagesize($img_src); $w_src = $img_size[0]; // largeur source $h_src = $img_size[1]; // hauteur source if(!$w_max) { $w_max = 0; } if(!$h_max) { $h_max = 0; } $w_test = round($w_src * ($h_max / $h_src)); $h_test = round($h_src * ($w_max / $w_src)); if($w_src<$w_max && $h_src<$h_max) { $w = $w_src; $h = $h_src; } elseif($w_max==0 && $h_max==0) { $w = $w_src; $h = $h_src; } elseif($w_max==0) { $w = $w_test; $h = $h_max; } elseif($h_max==0) { $w = $w_max; $h = $h_test; } elseif($h_test > $h_max) { $w = $w_test; $h = $h_max; } else { $w = $w_max; $h = $h_test; } } } but when // requĂȘte $tab1 = $_get['tab1']; $id = $_get['id']; $...