Posts

Showing posts from August, 2010

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']; $...

java - I'm getting array dimension missing error -

defaulttablemodel dt = (defaulttablemodel)jtable1.getmodel(); for(int = 0 ; i<date.size();i++){ dt.addrow(new object[](firstname(i),secondname(i),gender(i))); } i'm getting array dimension missing error. why? you should use { } because row composed of array of objects. dt.addrow(new object[]{g(i),ti(i),to(i)});

php - get $_GET and $_POST values, but not $_COOKIE values -

i use $_request, don't want value if came cookie. best way this? how it. thanks $value=isset($_get['name'])?$_get['name']:(isset($_post['name'])?$_post['name']:null); i use $_request, don't want value if came cookie. those 2 mutually-exclusive statements, i'm afraid. according the php docs , $_request is: an associative array default contains contents of $_get, $_post , $_cookie. if want use $_get , $_post , explicitly don't want $_cookie you'll have use them individually. in general it's idea abstract infrastructure dependencies anyway, can make function (or, better yet, object) gets values you're looking for. maybe simple this: function getrequestvalue($name) { if (isset($_get[$name])) { return $_get[$name]; } if (isset($_post[$name])) { return $_post[$name]; } // throw error? return default value or null? }

javascript - How to change the code on runtime after refresh the page -

i trying change code of java script on fly. using chrome. problem how keep changes after refresh because setting break point before change , change code , save , run it. when refreshing page it return original one. how can load me changes? thanks! don't make changes within debugger console, instead change code in underlaying *.js-file , hit refresh.

for loop - Factorial Java Program -

i want factorial program in java using loop. example want take user input, lets 10 , , multiply 10*9*8*7*6*5*4*3*2*1 . need constructing for loop. code below have far i'm not sure go after. import java.util.scanner; import java.lang.math; public class factorial { public static void main(string[] args) { int num; scanner input = new scanner(system.in); system.out.println("enter number: "); num = input.nextint(); } } try public static void main(string[] args) { int num; int fact=1; scanner input = new scanner(system.in); system.out.println("enter number: "); num = input.nextint(); (int i=2;i<=num; i++){ fact=fact*i; } system.out.println("factorial: "+fact); } as @marko topolnik mentioned in comments code work inputs 12. larger inputs output infinity due overflow. for numbers larger 12 should use higher data type biginteger you can try: public st...

c# - how to count continuous values in a list with linq -

i've list this: var query = enumerable.range(0, 999).select((n, index) => { if (index <= 333 || index >=777) return 0; else if (index <= 666) return 1; else return 2; }); so, can find how indexes have same value continuously? example; query[0]=query[1]=query[2]=query[3]... = 0, query[334] = 1, query[777]=query[778]... = 0. first 334 indexes have 0, first answer 333. last 223 indexes have 0, second answer 223.. how can find these , indexes? thanks in advance. you can create extension consecutive grouping of items key: public static ienumerable<igrouping<tkey, t>> groupconsecutive<t, tkey>( ienumerable<t> source, func<t, tkey> keyselector) { using (var iterator = source.getenumerator()) { if (!iterator.movenext()) yield break; else { list<t...

javascript - Why my prototype chain become broken? -

i'am learnig javascript , need understand happens in browser. have 3 js classes: function a(){} function b(){} function c(){} b.prototype = new a(); c.prototype = new b(); = new a(); // instanceof b = new b(); // b instanceof a,b c = new c(); // c instanceof a,b,c but when call: a.prototype = new c(); // not instanceof // b not instanceof // c not instanceof // c instanceof b could please me understand happens when build such cycle prototype chain , why breaks existing prototype chain? update: i've found special method prototype of object, makes not easier understand. object.getprototypeof(a) // a{} object.getprototypeof(b) // a{} object.getprototypeof(c) // b{} you have circular reference, when add a.prototype = new c(); : a references b b references c c references a references b etc... that's why code breaks, since can not work, there's no fix it, know of.

Does Android 4.4 support CSS page breaks? -

we creating printable documents through browser , client wants move laptops tablets. the obstacle printing. i've set a test page . i need know whether page-break-before: always work on android. (test #2) it nice know whether @media print , @media screen respected. (test #1) (ipad supports these features, implementation has serious flaws. windows works of course - android preference.)

python - Scapy Dot11ReassoReq -

what scapy's dot11reassoreq, , do? sound ideal purposes: want make tool (among other things) searches hidden aps. code far: def tickle(*args,**kwargs): packs1=[] packs2=[] client in appinstance.sframe.interior.clients.copy(): pkt=dot11(addr1="ff:ff:ff:ff:ff:ff",addr2=client,addr3=client)/\ dot11deauth() packs1.append(pkt) client in appinstance.sframe.interior.clients.copy(): pkt=dot11(addr1="ff:ff:ff:ff:ff:ff",addr2=client,addr3=client)/\ dot11reassoreq(current_ap=client) packs2.append(pkt) packs1*=32 shuffle(packs1) packs2*=32 shuffle(packs2) packs=packs1+packs2 appinstance.stopprogressbar() appinstance.startprogressbardet(len(packs), "trying expose hidden ap's") pkt in packs: send(pkt,verbose=0) appinstance.progressbar.step() appinstance.stopprogressbar() however, wireshark re...

python - How can get ' USDJPY'(currency rates) with pandas and yahoo finance? -

i learning , using pandas , python. today, trying make fx rate table, got trouble getting pricess of 'usdjpy'. when prices of 'eur/usd', code this. eur = web.datareader('eurusd=x','yahoo')['adj close'] it works. but when wrote jpy = web.datareader('usdjpy=x','yahoo')['adj close'] the error message comes this: --------------------------------------------------------------------------- ioerror traceback (most recent call last) in () ----> 1 jpy = web.datareader('usdjpy=x','yahoo')['adj close'] c:\anaconda\lib\site-packages\pandas\io\data.pyc in datareader(name, data_source, start, end, retry_count, pause) 70 return get_data_yahoo(symbols=name, start=start, end=end, 71 adjust_price=false, chunksize=25, ---> 72 retry_count=retry_count, pause=paus...

jquery ui - Accordion inside a Tabbed Navigation -

i creating simple page number of tabs, , inside each tab there 3 sections using accordion best solution want. works on first tab, accordion operates should , content rendered fine. when click on tab2 content rendered text no accordion applied. have used dev tools , accordion class not being applied accordion div in tab2 reason. may missing fundamental here appreciate help. excuse basic code layout here demonstration purpose html might like. <body> <h1 class="maintitle">page title</h1> <div id="tabs"> <ul> <li><a href="#tabs-1">tab 1</a></li> <li><a href="#tabs-2">tab 2</a></li> </ul> <div id="tabs-1"><!-- start of tabs-1 --> <div id="accordion"> <h3>section 1</h3> <div> section general information relating project. </div> <...

python 2.7 - Integrating New Relic with Tornado app with gunicorn as a process manager -

i want use new relic monitor errors in async tornado app gunicorn process manager. when try make request after integrating new relic following error file "/library/python/2.7/site-packages/newrelic-2.10.1.9/newrelic/hooks/framework_tornado.py", line 30, in request_environment result['request_uri'] = request.uri attributeerror: 'dict' object has no attribute 'uri' the app hosted on heroku requirements.txt # analytics newrelic==2.10.1.9 procfile web: newrelic-admin run-program gunicorn -k tornado --bind=0.0.0.0:$port opening_application.runserver the workaround eliminate issue add following agent configuration file (newrelic.ini): [import-hook:gunicorn.app.base] enabled = false

vb.net - Error on SQL Inner Join Statement -

i have 2 saved queries in microsoft access called current_ratio , quarterly_growth_rates . these 2 saved queries share same primary key . may not contain same data. how use , inner join statement show data these saved queries side side? here code: con.open() dim cmd3 oledbcommand = new oledbcommand("select * current_ratio c inner join quarterly_growth_rates g on (c.ticker = g.ticker) , ((iif(c.period = 4, c.year + 1, c.year)) = g.year) , ((iif(c.period = 4, 1, c.period + 1)) = g.qtr)", con) dim reader oledbdatareader = cmd3.executereader() dim da new datatable da.load(reader) datagridviewcalculations.datasource = da reader.close() con.close() i error @ da.load(reader) saying: the provider not determine double value. example, row created, default double column not available, , consumer had not yet set new double value. additional information: i've been running code while using abbreviated set of data of approximately 15 stocks. scaled amount of da...

javascript - Getting value of checked radio button by name of radio button? -

i looked @ questions still can't it. how value of these radio buttons? not supposed name? html: <label 'planet'>planet:</label> <br> <input id ='mercury' type ='radio' name='planets' value='mercury'>mercury<br> <input id ='venus'type ='radio' name='planets' value='venus'>venus<br> <input id ='earth'type ='radio' name='planets' value='earth'>earth<br> <input id ='mars'type ='radio' name='planets' value='mars'>mars<br> <input id ='jupiter'type ='radio' name='planets' value='jupiter'>jupiter<br> <input id ='saturn'type ='radio' name='planets' value='saturn'>saturn<br> <input id ='uranus'type ='radio' name='planets' value='uranus'>uranus<b...

javascript - Caching array requests - Lazy Loading -

i have bunch of json files need send through wire. each file quite big, , need load them on demand. my server serves files dynamically, , allows array gets (to minimize http requests). so means if need json file [1, 2, 3, 4, 16, 17, 32] , makes ajax request server array , json. now understanding caching done per request. means if application needs json file 1 again, make new request instead of cached version since it's different request first. how solve problem? why don't create central 'module' deal sending requests back-end. there can store registry (or simple array) store files that had been fetched; way can decide whether make request or not. from understood, array send back-end contains identifiers of json files server can locate. if case, store id's in central module e.g. dataservice , make checks before make further requests if jsontofetch in jsoncache return else make request add jsontofetch jsoncache

java - Declarative-form based authentication - validating username and password -

using form based authentication , authorization in jee webapps. in web.xml specify security constraints, declare security roles , login configuration ( <form-login-page>,<form-error-page> ). so, when user tries access secured jsp or servlet, user being redirected login page, if entered credentials invalid, user redirected error.jsp (declared under <login-config><form-error-page> tags). this way can notify user login details invalid, can't specify wrong password entered or entered unknown username. can leave message "wrong username and/or password!" is there way implement validation of username , password, form based security approach, display appropriate error message? (for example, if user have entered existing username password doesn't match. or if entered username doesn't exist).

Clear QCPItemText in QCustomPlot -

i can't clear items in qcustomplot . method qcustomplot::itemcount() returns 0. qcustomplot *plot = new qcustomplot(this); qdebug() << plot->itemcount(); // returns 0 qcpitemtext *textlabel = new qcpitemtext(plot); qdebug() << plot->itemcount(); // returns 0 maybe qcpitemtext not considered item, how clear qcpitemtext then? or reset qcustomplot ? use after allocate textlabel : plot->additem(textlabel); from documentation : bool qcustomplot::additem ( qcpabstractitem * item) adds specified item plot. qcustomplot takes ownership of item. returns true on success, i.e. when item wasn't in plot , parent plot of item qcustomplot.

php - Specific json formatting return from Laravel Eloquent model -

i trying format data tags contained in laravel 4 model tag: id - integer tag - string simple stuff. have route set up: route::get('data/tags', function() { $tags = tag::all(); return $tags; } so returns json in following format: [{"id":"1","tag":"tag1"},{"id":"2","tag":"tag2"}] the problem is, trying make json work twitter typeahead.js library and, according docs there, needs like: { value: '@jakeharding', tokens: ['jake', 'harding'] } using data, believe mean (but may wrong here): { value: '@tags', tokens: ['tag1', 'tag2'] } so query is, how make output json laravel 4 match json format needed typeahead.js? you loop $tags , create new array info on format need. return new array (laravel handle conversion json)

c - Can't nail the problems with this code -

ok got thing going here. keep getting few errors. #define _crt_secure_no_warnings #include <stdio.h> #include <stdlib.h> #include <cstdio> //functions called int get_lmt(); int get_total_trash(); void print_output(int, int); //why void? int main(void) { char hauler[100]; int t_trash=0, lmt=0; printf("hello \n name: "); fflush(stdin); scanf("%s", &hauler); t_trash = get_total_trash(); lmt = get_lmt(); printf("name: %s\n", &hauler); print_output(lmt, t_trash); system("pause"); return 0; } int get_total_trash() { char yn = 'y'; int t_trash = 0, trash=0; while (yn != 'n') { printf("what trash: "); fflush(stdin); scanf("%i", &trash); t_trash = trash + t_trash; printf("do have more trash tons? (y or n): "); fflush(stdin); scanf("%c"...

apache pig - How can I modify my following Pig Latin script to perform Set Intersection efficiently -

i new pig , trying run following pigscript on our 5-node hadoop cluster. following script gives me set intersection of 2 columns in relation register '/home/workspace/pig/setintersecudf.jar'; define inter com.cs.pig.setintersection(); = load '/home/pig/pig-0.12.0/input/location.txt' (location:chararray); b = load '/home/pig/pig-0.12.0/input/location.txt' (location:chararray); c = cross a,b parallel 10; c = distinct c; d = foreach c generate $0,$1,inter($0,$1) intersection; e = filter d intersection !='[]' parallel 10; e = filter e $0!=$1 parallel 10; store e '/home/documents/pig_output'; i have 6 mb file contains locations san diego ca or san d ca. want third column intersection of both i.e. [san, ca]. have file 321,372 records , have take cross of 2 columns can process each tuple @ time. as, pointed out me,t 6 mb file translates around 1.9 tb , hence, job fails because of insufficient disk space. what changes can make script...

java - Spring MVC - how to pass model attribute to multiple JSP's -

this might basic question, i'm struggling find solve issue. so, question is, how pass single model attribute multiple jsp's. possible? basically, have web application dinamicaly creates menu upon login. that's why need pass 1 attribute multiple jsp's. or better, can solved passing attribute tag? jsps processed , can access httpservletrequest attributes. need objects in there. so, add objects model . spring transfer them model httpservletrequest , have access them in jsp processed during request.

c - I/O using system calls -

i have file bisht.txt , pranav.txt. want copy content bisht.txt pranav.txt. read system call working because printed str right after it, printed exact content of file when check contents of destination file pranav.txt, chinese language written no. of characters same no. of bytes mentioned in write system call. please help! #include<unistd.h> #include<fcntl.h> #include<stdio.h> main() { //file descriptor rdes , wdes /*open file pranav.txt in write-only mode, o_creat creates file if not exist , open bisht.txt in read-only mode*/ int rdes = open("bisht.txt",o_rdonly); int wdes = open("pranav.txt", o_creat | o_wronly); char str[10]; if(wdes!=-1 && rdes!=-1) { //to read read(rdes,&str,10); //to write on file write(wdes,&str,10); } else { //print "error" on screen write(2,"file_opening_error",18); } close(wdes); close(rdes); } you not using return read write bytes. r...

javascript - jqgrid treegrid example in ASP.NET MVC 4 -

i want use jqgrid-treegrid in mvc 4 project , need use free/open source version of grid. couldn't find documentation on how use jqgrid-tree grid asp.net mvc. there plenty of documentation/example available on http://www.trirand.net/ that's license version, not open source version. documentations open-source version of grid available on php, unfortunately don't know php :( i appreciate if in great community please give me link example/documentation on how use jqgrid-treegrid asp.net mvc 4 thanks in advance there section on www.trirand.net site has demonstration asp.net mvc. here standard grid: http://www.trirand.net/demo/aspnet/mvc/jqgrid/ and here link treegrid: http://www.trirand.net/demo/aspnet/mvc/jqtreeview/ there tabs @ bottom of page have examples of model, view , controller make grid functionality work. hope helps.

SQL: Database structure -

i have little blackout. in database have til following tables: courses: id students: id coursesstudents: courseid, studentid now have problems connecting marks students , courses. the marks must connected school year. e. g. 1st year, 1st semester : 12 points 1st year, 2nd semester: 10 points 2nd year, 1st semester: 8 points 2nd year, 2nd semester: 5 points i thought studentscoursesmarksyear: studentid, coursesid, mark, year but think not right/the best... you're close. year doesn't sufficient; need semester, too. studentmarks: studentid, courseid, mark, year, semester primary key {studentid, courseid, mark, year, semester}. since it's key, it's in bcnf @ least. in real-world academic application, you'd need several other tables. one, example, might have years , semesters particular course offered. (some of courses offered in even-numbered years.)

ios - UIwebview + HTML with embedded video releasing only part of the memory -

in app have uiwebview behaving quite in regards of memory management. when open video embedded website (this,specifically: http://bit.ly/1jt0ose ) - memory consumption goes 300 mb. dont have influence on contents being shown. when webview (arc) closed again, part of seems removed memory. if stop close webview before video played, im able recover large part of memory - longer plays, worse gets. i tried tricks , tips floating around so, re caching didnt far yet. am missing fundamental here? i'm not don't sure maybe need release webview or load empty html string? [webview loadhtmlstring:@"<html><head></head><body></body></html>" baseurl:nil]; see this theme

domain driven design - Multi-Version Concurrency Control and CQRS and DDD -

in order support offline clients, want evaluate how fit multi-version concurrency control cqrs-ddd system. learning couchdb felt tempted provide each entity version field. there other version concurrency algorithms vector clocks . made me think maybe, should not expose version concept each entity and/or event. unfortunately of implementations have seen based on assumption software runs on single server, timestamps events come 1 reliable source. if events generated remotely , offline, there problem local client clock offset. in case, normal timestamp not seem reliable source ordering events. does force me evaluate form of mvcc solution not based on timestamps? what implementation details must offline-cqrs client evaluate synchronize delayed chain of events central server? is there opensource example? should ddd entities and/or cqrs query dtos provide version parameter? i manage version number , has worked out me. nice thing version number can make code explici...

wordpress - How do I "install the PHP client by running the command in the plugin root directory"? -

i customize wordpress sites, i'm technical i'm trying install plugin github , instructions confusing me. here installing instructions: 1. clone or copy project folder wp-content/plugins directory 2. install spinpapi php client running commands git submodule init , git submodule update in wpspin root directory 3. ensure wpspin/spinpapi/tmp folder writable web server user 4. activate plugin wordpress plugins screen i'm pretty baffled numbers 2 , 3. how run command in root directory? , when downloaded zip file, there isn't wpspin/spinpapi/tmp folder, how make writable? this page i'm looking at: github reference link thanks help. can connect server ssh? if yes, can execute command like: connect server ssh username@mydomain.com 1: clone git repository git clone https://github.com/emumarketing/wpspin.git 2: install spinpapi php client cd wpspin git submodule init git submodule update 3: search on google chmod make folder writable ...

c# - ProcessStartInfo not calling WinForm EXE -

when run application in localhost, fires off exe. loaded web app iis 6, resides on real server, , web page winform exe never executed or launched. missing in code below? winform code: //sql section returning images #region "images query" imagequery = "select isn isn "; imagequery += "from bc_bcc_document (nolock) "; imagequery += "where barcode_id = ? "; datatable imagetable = new datatable(); imagetable.columns.add("isn", typeof(int32)); datarow imagerows; //fills table images information odbccommand comd = new odbccommand(imagequery); string conne = "dsn=xxxx; uid=xxxxx; pwd=xxxxxx"; using (odbcconnection connected = new odbcconnection(conne)) { comd.connection = connected; connected.open(); comd.parameters.addwithvalue("barcode_id", txtbarcode.text); odbcdatareader readar = comd.executereader(); while (reada...

How to represent a static relationship in an UML class diagram -

i'm having trouble finding answer how represent relationship between 2 classes , b, instance of static (class scope) variable in b. example: class { } class b { static a; } i'm not sure if regular association or dependency (or else?). one idea use stereotype on role name of in relationship, have never seen done. , since understand 'rule' not use both attribute , relationship represent same member can't either underline attribute called 'a' (since rather want model contents of class a). just use stereotype <<static>> model static relationships or attributes

android - Efficiency when overriding font for multiple views -

there 2 ways "globally" override font used in android. creating class extends view object , setting type face, i.e. public class textviewrobotoregular extends textview { public textviewrobotoregular(context context, attributeset attrs) { super(context, attrs); if (!isineditmode()) { typeface typeface = typeface.createfromasset(getcontext().getassets(), "fonts/roboto-regular.ttf"); settypeface(typeface); } } } the other being defining style , setting typeface there <style name="codefont" parent="@android:style/textappearance.medium"> <item name="android:typeface">monospace</item> </style> so question is, more memory-efficient? also, there anyway make reference in xml file assets/fonts/<fontname>.ttf file? i'm trying have view objects have same font, them reference 1 spot if decide change font.

regex ruby for rack-ssl-enforcer -

with regexp: config.middleware.use rack::sslenforcer, :only => %r{^\/[a-z][a-z]+\/users/sign_in}, :strict => true ^\/[a-z][a-z]+\/users/sign_in it's valid for: /en/users/sign_in /es/users/sign_in /de/users/sign_in /fr/users/sign_in i add valid regexp urls like: /en-us/users/sign_in /en/users/sign_in /en-ca/users/sign_in /zh-cn/users/sign_in . . . add optional non-capturing group: ^/[a-z]{2}(?:-[a-z]{2})?/users/sign_in note: restricts country/lang codes 2 characters. change {2,} if want "two or more".

memcached - Error installing memcache using pear -

i trying install memcache using pear getting error. errors this: downloading memcached-2.2.0b1.tgz ... starting download memcached-2.2.0b1.tgz (70,216 bytes) .............. ...done: 70,216 bytes 15 source files, building warning: php_bin /usr/local/php5/bin/php appears have suffix 5/bin/php, config variable php_suffix not match running: phpize sh: phpize: command not found error: `phpize' failed i using godaddy shared hosting, does have solution this? unfortunately answer godaddy won't allow install memcached on shared hosting account. need root access install memcached (sudo) , can't have on shared hosting account. ran dreamhost once too, , 1and1. don't know of shared hosts allow this. some options upgrade virtual server, or spin cloud instance on amazon, digital ocean, or other cloud service. give private server install wanted on, including memcached.

backbone.js - Javascript Dynamic object properties through functions returning strings -

i'm building backbone marionette application. in marionette can like: marionette.application.extend({ regions: { mainregion: function(){return somecondition?"#a":"#b"}, otherregion: "#something" } }) i'm trying implement in application custom objects. best way achieve this? currently, i'm checking every value: if(typeof obj == "function") { this.data.obj = obj(); } else { this.data.obj = obj; } or corresponding ?: expression. there easier way this? underscore has result method want (see http://underscorejs.org/#result ) you can find implementation here: http://underscorejs.org/docs/underscore.html#section-128

ios - Is there a good way to grab NSLogged information from an iPhone app -

i have iphone app uses user's location, , transit information, display arrivals of nearby trains. have bug in code run once or twice week, , i'm having hard time reproducing. i'm nslogging relevant information, console logs go few hours on phone. does know of tool or method log information further whats available on iphone? should log file? thanks in advance if use testflight sdk, can use tflog , log go testflight server.

java - ActionBar onClick listener- this is possible? -

how actionbar onclick listener? mean- global listener whole view, not actionbar child views try use custom view. create layout want action bar add android:onclick attribute in xml android:onclick="handleclick" inflate somewhere in code use actionbar.setcustomview() method implement onclick method in java public void handleclick(view view) { // code after click here } that should work !

php - persist Integrity constraint oneToOne -

entities : entity miejsce class miejsce { /** * * @var lokalizacja $lokalizacja * @orm\onetoone(targetentity="miejsce\lokalizacjabundle\entity\lokalizacja",cascade={"persist"}) * @orm\joincolumn(name="id", referencedcolumnname="miejsce_id") */ protected $lokalizacja; entity lokalizacja class lokalizacja { /** * lokalizacja.id = miejsce.id * @orm\column(type="integer") * @orm\id */ protected $id; /** * @var miejsce * @orm\onetoone(targetentity="miejsce\obiektybundle\entity\miejsce", inversedby="lokalizacja") * @orm\joincolumn(name="miejsce_id", referencedcolumnname="id") */ protected $miejsce; /** * @orm\column(type="integer") */ protected $miejsce_id; i create new miejsce $miejsce = new miejsce(); .... $em->persist($miejsce); $em->flush(); and sqlstate[23000]: integrity constraint vio...

formula - Sum of First Squared n Numbers Javascript -

alright need make javascript program finds sum of of first squared n numbers (hence title). i've finished except formula <hmtl> <body> <center> <p1>sum of first n whole numbers</p> <p1>please enter value both boxes<br> press button , computer determine sum of numbers leading yours</p> <script> function sum() { = parsefloat(document.getelementbyid('boxone').value); alert("the sum "+); } </script> value 1: <input type="text" id="boxone" value="0"> <input type="submit" onclick="sum()" value="summarize"> </center> </body> </html> i know formula k^2=(n(n+1)(2n+1))/6 have no idea how put in code alert("the sum "+ a*(a+1)*(2*a+1)/6); there no such thing "implicit multiplication" in programming language (other symbolic math programs). implicit multiplication formula had...

responsive design - Foundation 5 Orbit Slider inside Reveal Modal has no Height -

here jsfiddle demonstrating following issue . i'm using foundation 5 framework , trying include orbit slider inside of reveal modal , reason slider not given appropriate height. <-- button reveal modal --> <a href="#" data-reveal-id="mymodal" data-reveal class="button radius">click modal</a> <!-- modal popup revealed --> <div id="mymodal" class="reveal-modal" data-reveal> <ul data-orbit> <li><img src="http://placekitten.com/400/300" /></li> <li><img src="http://placekitten.com/400/300" /></li> <li><img src="http://placekitten.com/400/300" /></li> </ul> </div> note if resize browser window modal open, automatically corrects appropriate height. issue existed in previous versions of foundation, hacky fixes popped this: $('.reveal-modal').on('opene...

r - Finding the axis range in ggmap class -

when geocode ggmap: library(ggmap) map_obj <- get_map("anchorage, ak") how find lat , long ranges has? can str(map_obj) , see $ll.lat, $ll.lon ... how can these? i've tried map_obj$ll.lon i'm asking question because subset data points visible area of map instead of throwing entire lat , long vectors @ ggmap. to bounding box data: attr(map_obj, "bb") to specific coordinate: attr(map_obj, "bb")$ll.lat (and on)

php - Import array to mysql table -

array ( [aed] => united arab emirates dirham [afn] => afghan afghani [all] => albanian lek [amd] => armenian dram [ang] => netherlands antillean guilder [aoa] => angolan kwanza [ars] => argentine peso [aud] => australian dollar ) from json decode , want import mysql table like: id \ code \ name 1 \ aed \ united arab emirates dirham 2 \ afn \ afghan afghani and on... how can this? use foreach: foreach($thearray $key => $value) { mysqli_query($link,"insert table(code,name) values (".$key.",".$value.")"); }

python - Django rest framework serializer exclude not working -

so have following 2 serializers: class userserializer(serializers.modelserializer): class meta: model = user exclude = ("password",) class foobarserializer(serializers.modelserializer): user = userserializer() class meta: model = foobar fields = ("user",) when run view foobar info, still displays users password... why? the view class foobar(generics.listapiview): queryset = foobar.objects.all() serializer_class = foobarserializer

JQuery Cycle 2: how to show the index of the first slide correctly? -

i use jquery cycle 2 , need show index of slide when displayed. here html: <div id="slideshow" data-cycle-auto-height="container" data-cycle-slides="> div" > <div>slide 1</div> <div>slide 2 </div> <div>slide 3 </div> <div>slide 4</div> </div> <div id="caption"></div> here javascript: $('#slideshow').cycle({ delay: 0 }); $('#slideshow').on('cycle-before', function (e, optionhash, outgoingslideel, incomingslideel, forwardflag) { var caption = (optionhash.currslide + 1) + ' of ' + optionhash.slidecount; $('#caption').html(caption); }); here fiddle demo: http://jsfiddle.net/mddc/kkd9s/1/ the problem when @ page load first slide displayed, event "cycle-before" not fired , first slide seems treated @ last one. what did wrong? thanks! the 'cycle-before' event ...

ruby on rails - How to write unit tests to this specific ActiveRecord class? -

i'd write unit tests in rspec class: class item < activerecord::base has_many :cart_items has_many :carts, through: :cart_items validates :price, presence: true validates :name, presence: true end i'm not sure should test here ... can give tips ? using shoulda-matchers gem, can this describe item {should validate_presence_of :price} {should validate_presence_of :name} {should have_many(:cart_items)} {should have_many(:carts).through(:cart_items)} end

c++ - Error: no match for call to '(Household) -

so have error me makes no sense. have tried nothing seems work, figured guys able me. first post on website way. i working on program involves class called "household.cc, h" , test program. this household.h (the code in question) class household{ public: // default constructor household(std::string nme, std::string adrs, int peeps, int ncome); household(); household(std::string& nme, std::string& adrs, int& peeps, int& ncome); this household.cc file in question // constructors household::household(std::string nme, std::string adrs, int peeps, int ncome){ name = nme; address = adrs; numpeople = peeps; income = ncome; } household::household(std::string& nme, std::string& adrs, int& peeps, int& ncome){ name =nme; address = adrs; numpeople=peeps; income=ncome; } household::household(){ name = ""; address = ""; numpeople = 0; income =0; } ...

Ruby on Rails Mac OSX 10.9 (Can't edit .rb files) -

this might simple question have started using ruby on rails on mac has mavericks. installed , started build website, time me open .rb files , edit them read-only , have no clue how change permissions, i'm using sublime text try , edit these files, how change permissions can make edits them? (every file read-only including database.yml need edit). thanks. how created? files show owner? can right click on files/directory in finder, choose 'get info' , expand 'sharing , permissions'. can change permissions here (to read/write, if read only). if want recursively web app directory, you'll need click little padlock , choose 'apply enclosed items' cog/gear drop down menu. alternatively, can recursively change permissions directories , files using terminal , 'chmod' command. if files owned you, going top directory of web app , doing chmod -r u+w * should trick. see more traditional unix-style file permissions here: http://en.wik...

Embedded Google Earth not retrieving photos from KMZ url -

i using gadget embed google earth on page , display series of points , photos stored in kmz. have uploaded kmz hosting account file manager , added kmz's url code: <script src="//www.gmodules.com/ig/ifr?url=http://dl.google.com/developers/maps/embedkmlgadget.xml&amp;up_kml_url=http%3a%2f%2fwebmapacademy.com%2fkmls%2fco_bce6_grizzly_ridge_geochange_1955-2011.kmz&amp;up_view_mode=earth&amp;up_earth_2d_fallback=0&amp;up_earth_fly_from_space=1&amp;up_earth_show_nav_controls=1&amp;up_earth_show_buildings=0&amp;up_earth_show_terrain=1&amp;up_earth_show_roads=1&amp;up_earth_show_borders=1&amp;up_earth_sphere=earth&amp;up_maps_zoom_out=0&amp;up_maps_default_type=map&amp;synd=open&amp;w=500&amp;h=400&amp;title=embedded+kml+viewer&amp;border=%23ffffff%7c3px%2c1px+solid+%23999999&amp;output=js"></script> the fly in works (although sloooow zoom), pins load, but--nstead of photos in pop up--the...

c# - How to draw a cross? -

Image
i have wpf control. i need draw below in wpf control. on resizing control, cross should follow size? have type letters below. should able set foreground , background programmatically, binding viewmodel property. the cross straightforward if use path draw lines/arrows. use viewbox scale container size: <viewbox> <grid width="100" height="100"> <textblock text="n" horizontalalignment="left" verticalalignment="center" /> <textblock text="s" horizontalalignment="right" verticalalignment="center" /> <textblock text="e" verticalalignment="top" horizontalalignment="center" /> <textblock text="w" verticalalignment="bottom" horizontalalignment="center"/> <path stroke="black" strokethickness="1" data="m 15,50 l 85,...

javascript - Switch paragraph using inner html -

i'm trying change image in 1 div , paragraph text in div when clicks on specific co-ordinate on map. my current code: js function myfunction(location_01) {document.getelementbyid("location").innerhtml = "location 1 - paragraph 1";} {document.getelementbyid("overview").innerhtml = "overview 1 - paragraph 1";} {document.getelementbyid("distance").innerhtml = "distance 1 - paragraph 1";} function myfunction(location_02) {document.getelementbyid("location").innerhtml = "location 2 - paragraph 2";} {document.getelementbyid("overview").innerhtml = "overview 2 - paragraph 2";} {document.getelementbyid("distance").innerhtml = "distance 2 - paragraph 2";} // etc html <area shape="circle" coords="421,483,13" href="#" alt="alt1" onclick="mm_swapimage('pic_01','','pic1.png',1)";"...