Posts

Showing posts from June, 2012

java - ERROR context.ContextLoader - Context initialization failed -

i upgrade project 1.3.7 2.2.1 in ggts.when run project got error following: | error 2013-07-26 13:28:09,778 [localhost-startstop-1] error context.contextloader - context initialization failed message: org.springframework.context.support.abstractrefreshableconfigapplicationcontext.getenvironment()lorg/springframework/core/env/configurableenvironment; line | method ->> 334 | innerrun in java.util.concurrent.futuretask$sync - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | 166 | run in java.util.concurrent.futuretask | 1110 | runworker in java.util.concurrent.threadpoolexecutor | 603 | run in java.util.concurrent.threadpoolexecutor$worker ^ 679 | run . . . in java.lang.thread | error 2013-07-26 13:28:09,819 [localhost-startstop-1] error context.grailscontextloader - error initializing application: org.springframework.context.support.abstractrefreshableconfigapplicationcontext.getenvironment()lorg/springframework/core/env/

python - Read from file: read two lines, skip two lines -

i want read 2 lines file, skip next 2 lines , read next 2 lines , on line 1 (read) line 2 (read) line 3 (skip) line 4 (skip) line 5 (read) line 6 (read) ... <eof> any ideas how this? thanks! my solution: j = 2 i, line in enumerate(f.readlines()): if in xrange(j - 2, j): print line elif == j: j += 4 you can advance iteration of file the itertools consume() recipe - fast (it uses itertools functions ensure iteration happens in low-level code, making process of consuming values fast, , avoids using memory storing consumed values): from itertools import islice import collections def consume(iterator, n): "advance iterator n-steps ahead. if n none, consume entirely." # use functions consume iterators @ c speed. if n none: # feed entire iterator zero-length deque collections.deque(iterator, maxlen=0) else: # advan

wsdl - How to create HTTP Adapter in IBM Worklight? -

i trying create adapter in worklight project. have wsdl in hand ,how add wsdl in project consume data. thanks in advance.... before posting read worklight documentation here , here , here if problems, post code! place technical questions. must read through ibm worklight information center .

C# Interop print and close Excel file -

have problem interop , editing existing excel file. excel app doesn't want close. if set code, when edit cells, comment, rest of code work need - excel open , after print dialog close. excel.application excelapp = null; excel.workbook excelworkbook = null; excel.worksheet excelworksheet = null; string workbookpath = ""; if (rbtype1.checked == true) { workbookpath = path.getfullpath("excel/mesto.xls"); } else if (rbtype2.checked == true) { workbookpath = path.getfullpath("excel/ulehly.xls"); } else if (rbtype3.checked == true) { workbookpath = path.getfullpath("excel/spolecenstvi.xls"); } else if (rbtype4.checked == true) { workbookpath = path.getfullpath("excel/vlastnici.xls"); } excelapp = new excel.application(); excelapp.visible = true; excelworkbook = excelapp.workbooks.open(workbookpath, 0, false, 5, "", "", true, excel.xlplatform.xlwindows, "\t", false, false, 0, true, 1, 0); excelworkshe

mongodb - When i run convertToCapped command in python using pymongo then it gives error that variable size is not defind -

command is: db.command({'converttocapped': 'info', size:100000}) traceback (most recent call last): file "<pyshell#18>", line 1, in <module> db.command({'converttocapped': 'info', size:100000}) nameerror: name 'size' not defined from understand need run command pymongo: db.command( "converttocapped', 'info', size = 100000 ); as described on http://api.mongodb.org/python/current/api/pymongo/database.html#pymongo.database.database.command

webserver - Asp.net MutiView parameter passing issue -

i doing dotnetnuke module development. put asp.net mutiview control on view.ascx. there 3 views in mutiview. each view has custom module control wrapped place holder. on first module control in first view, select 1 row grid view, , active second view. on second view, receives value passed session object. however, problem cannot see value been assigned label want value assigned when second view has been activated @ first time. have redirect second view again clicking link button. is there able me it? appreciate kindness. on control one(selectjob): protected void gridviewjoblist_selectedindexchanged(object sender, eventargs e) { job newjob=new job(convert.toint32(gridviewjoblist.selectedvalue)); onselectedjob(newjob); } public event jobselectedeventhandler jobselected; protected virtual void onselectedjob(job j) { session["jobid"]=j.jobid; jobselected(this,j); } one v

php - YII: Radiobuttons On Action Should Update The Text Field -

i want create 2 buttons in _form.php . the 2 buttons '0'=>approve , '1'=>reject . now, have 2 text fields date , modified by . need update date current date , modify by login name when approve clicked , need update date null , modify by login name when reject clicked. how can this? no need create textfield modifiedby or date . check button pressed in controller. , whatever action want take. this: if(isset($_post['post']['approve'])===true){ $this->date = new cdbexpression('now()'); $model->save(); } if(isset($_post['post']['reject'])===true){ $this->date = ''; $model->save(); } adding rule in model, lets add name on insert or update . array('modifiedby','default','value'=>yii::app()->user->title,'setonempty'=>false,'on'=>'update'), array('modifiedby','default','value

how can i decode unicode string in python? -

wikipedia api encodes string unicode format "golden globe award best motion picture \u2013 drama" how can convert to "golden globe award best motion picture – drama" the wikipedia api returns json data, use json module decode: json.loads(inputstring) demo: >>> import json >>> print json.loads('"golden globe award best motion picture \u2013 drama"') golden globe award best motion picture – drama if instead have string starts u'' , have python unicode value , looking @ representation of string: >>> json.loads('"golden globe award best motion picture \u2013 drama"') u'golden globe award best motion picture \u2013 drama' just print value have python encode terminal codec , represent em-dash character in format terminal understand. you may want read python , unicode , encodings before continue, if not understand difference between unicode value , byte strin

python - Print values of array according to input -

i trying print values of list according user input, i.e. if user inputs 3, prints elements 1, 2 , 3. if user inputs 5, prints elements, 1,2,3,4 , 5. have written below code giving me error: var1 = [ '1', '2', '3', '4' , '5'] x = input('enter number of sites') print('the values are', var1[1:x] ) this error coming: slice indices must integers or none or have __index__ method any appreciated. in python3, input built-in function returns string, , since list indices can integers error message. to fix it, should convert result of input function integer, this: var1 = [ '1', '2', '3', '4' , '5'] x = int(input('enter number of sites')) print('the values are', var1[1:x]) you can format string nicely separated commas, instance: to_print = ', '.join(var[1: x])) print('the values are', to_print)

javascript - jQuery - Get value of inputs in array -

for each input field on page, has id ending in "_name" , "_value", i've placed in 2 arrays. , each of values of input (there equal number of inputs namearr , valarr) in name array place before input of namrarr heading, hide input. however, cannot seem access value of input once it's placed in array?? var name = $("[id$=_name]"); var namearr = $.makearray(name); var val = $("[id$=_value]"); var valarr = $.makearray(val); for(var = 0; < valarr.length; i++){ $(namearr[i]).before("<h3>"+namearr[i].val()+"</h3>"); $(namearr[i]).hide(); } you simplify it, jquery selector returning array: $("[id$=_name]").each(function (index, item) { $(this).before("<h3>" + $(this).val() + "</h3>"); $(this).hide(); });

c# - How to create html table from model class -

i new in mvc , learning mvc. not want use grid extension, rather want generate tabular ui html table. looking code , found hint. this code not full code. here got. <% if (model.count() > 0) { %> <table width="35%"> <thead><tr><th>species</th><th>length</th></tr></thead> <% foreach (var item in model) { %> <tr> <td><%= item.fishspecies%></td> <td align="center"><%=item.length%></td> </tr> <% } %> </table> <% } else { %> no fish collected. <%} %> the problem not being able visualize how model class should , how populated controller. viewbag not used in code, rather generating table directly model class. so can write small complete code me create html table , populate model directly without using viewbag? need code model, controller , view too. if want iterate th

Image in jsp through servlet -

i m not able display image on jsp page plzz dis jsp page d image inserted...` <h4>welcome<%=rst.getstring(1)%></h4> <table> <tr><td>designation:<%=rst.getstring(4)%></td><td></td></tr> <tr><td>date of birth:<%=rst.getstring(8)%>/<%=rst.getstring(7)%>/<%=rst.getstring(6)%></td></tr> <tr><td>qualification:<%=rst.getstring(9)%></td></tr> <tr><td>full address:<%=rst.getstring(10)%><%=rst.getstring(11)%></td></tr> <tr><td>contact no:<%=rst.getstring(12)%></td></tr <tr><td><img src="image1?imgid=<%=rst.getstring(14)%>" width="60" height="60"></img></td></tr> </table> and servlet try { string id1=request.getparameter("imgid"); blob i

javascript - Highcharts: Hide and show legend -

i'd able toggle visibility of legend of chart when user clicks button. i've tried hiding legend using undocumented destroy() method, when try re-render legend , it's items, items appear in top left of chart instead of within legend. items don't seem have of event handlers attached (clicking on item no longer toggles series). is there better way this? have support both svg , vml implementations, looking solution address both. jsfiddle example $('#updatelegend').on('click', function (e) { var enable = !chart.options.legend.enabled; chart.options.legend.enabled = enable; if (!enable) { chart.legend.destroy(); //"hide" legend } else { var allitems = chart.legend.allitems; //add legend items chart (var = 0; < allitems.length; i++) { var item = allitems[i]; item.legenditem.add(); item.legendline.add(); item.legendsymbol.add(); }

android - Google Play services out of date. Requires 3159100 but found 3158130 -

in sdk tools google play services has updated revision 9 (version 3159100) google api's (api 17) still revision 3 , therefore includes google play services version 3158130 how solve issue?? logcat message google play services out of date. requires 3159100 found 3158130 thanks in advance this issue google arises when update sdk 18 (jelly bean 4.3) (which has been resolved via update 21st october 2013 - see below) google : https://code.google.com/p/android/issues/detail?id=57880#makechanges it impacts google api emulators both 4.2.2 , 4.3 if running google play services. i'm not interested in workaround or "unofficial" solution. error caused google , i'm going wait them fix it. when do, i'll turn response proper "answer". this received 26th july 2013: comment #13 on issue 57880 sba...@google.com: google play services updated avd not http://code.google.com/p/android/issues/detail?id=57880 we're working on

glm for groups with unequal variance: is there an R equivalent of this Stata code? -

it well-known fact when fitting regression models groups, unequal variance between groups can cause trouble. there way in r account this? a solution stata suggested in presentation http://www.stata.com/meeting/fnasug08/gutierrez.pdf (slides 9-17). actual code, shown on slide 14, follows: # might specify . xtmixed . . . || id: boy agexboy girl agexgirl, nocons cov(un) # instead want . xtmixed . . . || id: boy agexboy, nocons cov(un) || id: girl agexgirl, nocons cov(un) is there similar solution in r?

single sign on - OPENAM - Domain not found at Login.jsp -

we implementing distauth , happen problems, when try access https://login.example.com/distauth , in top of page "please wait while redirecting..." , page goes blank, time after "domain invalid.jsp" apear... domaind invalid.jsp in same server of login.jsp, cant login page, try hard 4 days , nothing, please can help?: the logs: coresystem amjaxrpc:07/25/2013 10:05:48:417 brt: thread[webcontainer : 0,5,main] soap client: read exception java.io.ioexception: server returned http response code: 500 url: https://ssoweb.intranet.bb.com.br:443/sso/jaxrpc/smsobjectif @ sun.net.www.protocol.http.httpurlconnection.getinputstream(httpurlconnection.java:1448) @ com.ibm.net.ssl.www2.protocol.https.b.getinputstream(b.java:50) @ com.sun.identity.shared.jaxrpc.soapclient.call(soapclient.java:244) @ com.sun.identity.shared.jaxrpc.soapclient.send(soapclient.java:326) @ com.sun.identity.shared.jaxrpc.soapclient.send(soapclient.java:312)

html - Jquery mobile changing formatting, voiding float? -

i using jquery mobile application. using in 1 part of page, have discovered ruining formatting on listview. i have following basic format( fiddle @ bottom ) <ul> <li> <div id="number1"> <span></span> <div> <div id="number2"> <span><input type="checkbox" /><span> <span> something</span> <span> else</span> </div> </li> </ul> i creating listview. inner div id="number1" going main label list. in inner div id="number2" there checkbox , 2 small buttons inline. want take minimal space of way right. problem: formatting looks fine long not check "jquery mobile 1.3.0b1", using other parts of page. clicked though float:right on div w. id="number2" no longer having effect. http://jsfiddle.net/steverobertson/ncqf

google app engine - NDB query giving different results on local versus production environment -

i banging head wall on , hoping can tell me simple thing have overlooked in sleep deprived/noob state. very doing query , type of object returned different on local machine gets returned once deploy application. match = matchrealtimestatsmodel.querymatch(ancestor_key)[0] on local machine above produces matchrealtimestatsmodel object. can run following lines without problem: logging.info(match) # outputs matchrealtimestatsmodel object logging.info(match.match) # outputs dictionary json data when above 2 lines run on goggles machines following though: logging.info(match) # outputs dictionary json data logging.info(match.match) # attributeerror: 'dict' object has no attribute 'match' any suggestions might causing this? cleared data store , did think of clean gae environment. edit #1: adding matchrealtimestatsmodel code: class matchrealtimestatsmodel(ndb.model): match = ndb.jsonproperty() @classmethod def querymatch(cls, ancest

sql - Outer Reference error when grouping month and years -

getting following error: each group expression must contain @ least 1 column not outer reference i'd have listing of calculateddrugdistributionhistory grouped facilty, month, , year. want take inventory of facilities months have been imported our system. i have query: select f.name, month(cddh.dategiven) 'date_month', year(cddh.dategiven) 'date_year' calculateddrugdistributionhistory cddh inner join facilityindividuals fi on fi.facilityindividualid = cddh.facilityindividualid inner join facilities f on fi.facilityid = f.facilityid group f.name, 'date_month', 'date_year' order f.name, 'date_month', 'date_year' you can't use aliases in group clause. try way: select f.name, month(cddh.dategiven) date_month, year(cddh.dategiven) date_year calculateddrugdistributionhistory cddh inner join facilityindividuals fi on fi.facilityindividualid

java - Empty/Null values from post request are getting assigned to 0 -

<student> <id>1</id> <badge></badge> <name>matt</name> </student> this xml post when observe during post. public class student implements serializable{ long id; integer badge; string name; } my web service : @path("add") @post @consumes({mediatype.xml,mediatype.json}) @produces({mediatype.xml,mediatype.json}) public response add(student student) { } when debug on add method on service layer , variable badge gets assigned value "0", though not provided gui.database field badge integer(postgres). is related integer variable, assigns default value 0 if not present ? the type integer reference type. when create instance of class variable of reference type, it's default value null . behavior seeing not java's. jersey uses jaxb marshall , unmarshall entities. when sees have badge field has empty text element must make decision proper value set is. doesn't

ios - how to get coordinates of button with respect to superview? -

my view hierarchy uiviewcontroller.view a subview (on main view half size , in bottom) a button on subview i want co-ordinates of button respect main view the cgrect of button according superview. [self.view convertrect:button.frame fromview:button.superview];

stream - Gstreamer - appsrc push model -

i'm developing c application (under linux) receives raw h.264 stream , should visualize stream using gstreamer apis. newbie gstreamer maybe doing huge stupid mistakes or ignoring well-known stuff, sorry that. i got raw h264 video (i knew exact same format need) , developed application plays it. correctly works appsrc in pull mode (when need data called, new data file , perform push-buffer). now i'm trying exact same thing in push mode, because don't have video, stream. have method inside code called every time new data (in form of uint8_t buffer) arrives, , video source. i googled problem , had @ documentation , found no simple code snippets use case, if seems simple one. understood have init pipeline , appsrc , push-buffer when have new data. well, developed 2 methods: init_stream() pipeline/appsrc initialization , populate_app(void *inbuf, size_t len) send data when available. compiles , correctly runs, no video: struct _app { gstappsrc *appsrc;

HTML5/ Javascript not drawing tiles on the far right side of screen -

Image
i having issues drawing tiles @ far right of screen , cant figure out causing this. can see in image linked below floor tiles supposed going right edge of screen. here copy of code array drawing var maparray1 = new array(); // 05| 10| 15| 20| maparray1[0] = new array(00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00); maparray1[1] = new array(00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00); maparray1[2] = new array(00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00); maparray1[3] = new array(00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00); maparray1[4] = new array(00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 61, 00, 00, 00, 00, 33, 00, 00, 43);

html - The margin of a div respect its parent -

i confused margins. have logo inside div content. if give margin-top div logo margin appears between content , page. why? here example: http://jsfiddle.net/bckpb/ css: #content { position:relative; margin:0 auto; width:300px; height:250px; background-color:blue; } #logo { margin:20px auto; /* why 20px appear between page , content? */ width:120px; height:120px; background:yellow; } html: <div id="content"> <div id="logo"> </div> </div> it's because top-margin of block-level element , top-margin of first block-level child collapse (unless border, padding, line boxes or clearance separate them). 1 way prevent behaviour add overflow value other visible #content div. can change display value of #content inline-block. http://jsfiddle.net/bckpb/3/

iphone - How to Add/delete rows in grid view -

Image
i need add/delete rows gird show in below screenshot. intention add "name" , "mark" grid 1 one. default grid should show 3 items. once grid exceeds 3 rows should in scroll. used "scroll view" face below problems while implementing this. 1) how add items grid onnce enter "name" , "mark" , press "add" button? 2) how control grid height show "three" items default? 3) how make scroll after "three items" added grid. can 1 provide me code snippets or sample projects startup below screen-shot. https://github.com/slysid/ios hope looking for. not 100% done job. have used uitableview , subclass of uitableview cell make view scrollable. can find source code in above link. bharath

iis 6 - Cookie not getting removed for certain environments -

i have issue same code (web application) deployed 2 isolated environments behaving differently on "logout". the apparent key difference server1 not secured protocol, therefore http://myurl . server2 secured protocol , https://myurl . these servers both hosting web application in ii6 , i've combed through settings find difference nothing sticks out. web config doesn't have special declarations of sort. the "logout" mechanism simple setting expiration of relevant cookie day prior , redirecting home page. request.cookies["mycookie"].expires = datetime.now.adddays(-1d); response.cookies.add(request.cookies["mycookie"]); response.redirect("~/folder/homepage.aspx"); does have theories on why same code behave differently on 1 server vs other? i have tried of popular browsers ie8/9, chrome, firefox same results. examining cookie resource utility reveals server1(http) disposes of cookie correctly , server2(https) retains

sql - iif blank show zero -

i have visual studio report want state if calculation box blank due there being no figures available on particluar project show zero. my calculation :- =((sum(fields!totalcost.value, "accrued") + sum(fields!totalcost.value, "serv1")) / (sum(fields!quantity.value, "serv1") + sum(fields!quantity.value, "accrued")) ) and want try , include iif statement in show 0 if blank. any ideas on how best achieve aim? so far have got =iif((sum(fields!totalcost.value, "accrued") + sum(fields!totalcost.value, "serv1")) / (sum(fields!quantity.value, "serv1") + sum(fields!quantity.value, "accrued")) ) = "" ,false,0 ) getting little confused. most value not blank string nothing . try following construct: =iif(isnothing(((sum(fields!totalcost.value, "accrued") + sum(fields!totalcost.value, "serv1")) / (sum(fields!quantity.value, "serv1") + sum(fie

c# - How to calculate value percentage value between two points -

this dumb question but.. i have 3 values example lets call them minx, currentx , maxx. im looking way calculate percentage of maxx currentx represents. e.g if maxx 50 , minx 40 , currentx 45 want 50% pretty basic problem im having when 1 or more of variables negative number. any appreciated, let me know if didn't explain myself enough (currentx - minx) / (maxx - minx) will give percentage, if you're using negative numbers (as long maxx > currentx > minx ). make sure you're dealing doubles/floats, not ints. otherwise you'll need cast.

php - CakePHP: One to One relationship -

Image
i'm bit confused in how cakephp it's database relationship. for hasone relationship, according documentation : "user hasone profile" user hasone profile -> profiles.user_id array ( [user] => array ( [id] => 121 [name] => gwoo kungwoo [created] => 2007-05-01 10:31:01 ) [profile] => array ( [id] => 12 [user_id] => 121 [skill] => baking cakes [created] => 2007-05-01 10:31:01 ) ) but isn't 1 many relation? for example (i made these table illustrate confusion): in case there 2 profiles belonging same user. doesn't mean user hasmany profile? would make more sense if "user hasone profile" is so "user hasone profile" "profile hasmany user"? i'm not sure if i'm understanding correctly. in example @ documentation when said user has 1 profil

How to use two AngularJS services with same name from different modules? -

supposed have 2 modules angularjs, e.g. foo , bar , , both of them define service called baz . in application depend on them saying: var app = angular.module('app', [ 'foo', 'bar' ]); then can try use baz service in controller using app.controller('blacontroller', [ '$scope', 'baz', function($scope, baz) { // ... }]); how can define of 2 services i'd use? there such fully-qualified name? the service locator looks services name ( angularjs guide di ). "namespacing" services in angularjs : as of today angularjs doesn't handle namespace collisions services if you've got 2 different modules service named same way , include both modules in app, 1 service available. i guess can make qualified name "by hand": name service foo.baz , bar.baz instead of plain baz . it's kind of self-delusion. moreover, writing way doesn't make namespacing real, person reads code migh

Is there a C# equivalent to Java's Number class? -

i'm new c#, coming java, , i'd check whether object number (it can integer, double, float, etc). in java did saying if (toret instanceof number) . i'm hoping there's similar c# thing if (toret number) far haven't been able find number class this. there way this, or have manually check integer, double, etc? edit more info: want have byte array. however, when array stored in text file, parser i'm using can think it's integer array or double array. in java, had this: jsonarray dblist = (jsonarray)result_; byte[] reallytoret = new byte[dblist.size()]; object tocomp = dblist.get(0); if (tocomp instanceof number) (int i=0; < dblist.size(); ++i) { byte elem = ((number) dblist.get(i)).bytevalue(); reallytoret[i] = elem; } return reallytoret; } the important bit here if statement. objects in dblist parse integers, doubles, , bytes, care @ end byte value. well, yeah, it's extension method ors possibilitie

html - Unable to resolve constructor for: ' dojox.mobile.RoundRectCategory' -

Image
i use worklight 5.06 , dojo 1.8. after eclipse crash shows errors on browser's console: unable resolve constructor for: 'dojox.mobile.roundrectcategory' left list not found this.leftlist indefined as can see in screenshot: dojo.connect(window, "onload", function() { dojo.require("dijit.form.numberspinner"); }); function dojoinit() { require(["dojo", "dojo/request/script", "dojo/parser", "dojox/mobile", "dojox/mobile/compat", "dojox/mobile/devicetheme", "dojox/mobile/scrollableview", "dojox/mobile/screensizeaware", "dojox/mobile/fixedsplitter", "dojox/mobile/container", "dojox/mobile/edgetoedgelist", "dojox/mobile/roundrect", n ", " dojox / mobile / button ", " do

SQL Server CE Update table from another table -

having trouble trying adjust simple update 1 table another: update t2 set country_fk = t1.country_id dbo.countrycity t2 inner join dbo.country t1 on t2.country = t1.iso doing bit of research, sql server ce not from clause in join. i can't seem syntax right work on sql server ce. any suggestion more welcome. thanks!! yes, according sql ce reference , from clauses not supported in update . nor can update countrycity set country_fk = (select country_id country... because set accepts scalar , select returns selection. you have assign first or value from select country_id country c inner join countrycity cc on cc.country = c.iso need here specify 1 country instead of every country has matching iso to countrycity.country_fk country = same country specified above this has done in whatever script or application calling sql command, cannot done inside sql ce.

vb.net - How to Trigger Code with ComboBox Change Event -

i have created database containing historical stock prices. on form have 2 comboboxes, combobox_ticker , combobox_date . when these comboboxes filled want check database , see if respective data exists in database. if want change text of label called label_if_present "in database". my problem occurs change event. want of happen once change data in textboxes. have tried both .textchanged , .lostfocus events. '.textchanged' triggers code , throws , error in sql command statement. `.lostfocus' event doesn't trigger code @ all. here current code: public databasename string = "g:\programming\nordeen investing 3\ni3 database.mdb" public con new oledb.oledbconnection("provider=microsoft.jet.oledb.4.0;data source =" & databasename) public tblname string = "historical_stock_prices" private sub change_labels(byval sender object, byval e eventargs) handles combobox_ticker.textchanged, combobox_date.textchanged

c# - Error in downloading a file from folder,path is in database language used -

error message "requested url: /selva/ddl commands.doc" actually file path should url:/selva/docs/ddl commands.doc code have used : linkbutton lnkbtn = sender linkbutton; gridviewrow gvrow = lnkbtn.namingcontainer gridviewrow; string filepath = gvdetails.datakeys[gvrow.rowindex].value.tostring(); response.contenttype = "application/doc"; response.addheader("content-disposition", "attachment;filename=\"" + filepath + "\""); response.transmitfile(server.mappath("~/+ filepath + ")); response.end(); in aspx what may mistake can 1 me pls. in advance. try this response.clear(); response.appendheader("content-disposition", "attachment; filename=xxxxxx.doc"); response.contenttype = "application/msword"; response.writefile(server.mappath("/xxxxxxx.doc")); response.flush(); response.end(); referen

c# - Modify FileStream -

i'm working on class allow editing big text files (4gb+). may sound little stupid not understand how can modify text in stream. here code: public long replace(string text1, string text2) { long replacecount = 0; currentfilestream = file.open(currentfilename, filemode.open, fileaccess.readwrite, fileshare.none); using (bufferedstream bs = new bufferedstream(currentfilestream)) using (streamreader sr = new streamreader(bs)) { string line; while ((line = sr.readline()) != null) { if (line.contains(text1)) { line.replace(text1, text2); // here should save changed line replacecount++; } } } return replacecount; } you not replacing anywhere in code. should save text , write again file. like, public long replace(string text1, string text2) { long replacecount = 0; currentfilestream = file.open(currentfilename, filem

c++ - How to set up a std container with a RAII class? -

to realize raii idiom type socket , have created wrapper. wrapper calls connect in constructor , closesocket in destructor. std::map holds used sockets. unfortunatelly inserting new socket container calls destructor of temporary and, in fact, closes opened socket. there common way overcome this? here code: #include <iostream> #include <stdexcept> #include <map> #include <winsock2.h> struct socket { socket msock; socket() : msock(invalid_socket) {} socket(std::string ip, int port); ~socket(); }; socket::socket(std::string ip, int port) { msock = socket(af_inet, sock_stream, 0); if (msock == invalid_socket) throw std::runtime_error("socket()"); sockaddr_in addr = {0}; addr.sin_family = af_inet; addr.sin_port = htons(port); addr.sin_addr.s_addr = inet_addr(ip.c_str()); if (connect(msock, reinterpret_cast<sockaddr*>(&addr), sizeof(addr)) == socket_error) throw std::

Keep imported python module "fresh" -

ok, have following question: i have following: x.py: from y import afunc y.py: from z import adict now, x runs on run,sleep,repeat schedule. calls afunc on files. afunc uses values in adict , returns. adict in python module managed user in econ department. understand import called once , cached. if put import statement inside afunc it'll still imported once , cached (please correct me if i'm wrong). but want able pick changes adict on fly, in other words, i'd re-import z.adict every time x called y.afunc any advice appreciated! you can use reload can't use from z import adict you can : reload(z) #do z.adict here

httprequest - Node.js` "http.get" doesn't return full response body to a browser but just a piece of <head> tag. How to get full response? -

i experience strange behavior node.js http.get . make request url ajax , want result browser. piece of <head> tag content , nothing more, no <body> content. if send result system console ( console.log(chunk) ) result want - full page. here steps: // simple jquery ajax $.ajax({ type: "get", url: "/myapppath", // send app's url data: {foo: "bar"}, success: onload, // callback, see bellow error: onerror, datatype: "text" }); // callback function want insert result <div id="baz"> function onload(resp) { document.getelementbyid("baz").innnerhtml = resp; } // in /myapppath http.get("http://stackoverflow.com/", function(result) { result.setencoding('utf8'); result.on("data", function(chunk) { console.log(chunk); // returns whole page system console res.end(chunk); // returns piece of <head> tag browser. }); }); s

Wordpress Site Will Not Index In Google -

so, i've been banging head against wall on while. i have wp site here: http://www.barre101.com . , robots.txt located here: http://www.barre101.com/robots.txt for crazy reasons, google not indexing of pages in search results. in webmaster tools, there have been no crawl errors, , says 19 pages crawled yesterday. i have fetched site in webmaster tools, , googlebot fetches correct information on page. has experienced before? any/all appreciated! thanks! i looked @ source of pages , believe headers not setted correctly in process of indexing site. <meta name="description" content="full functionable, premium wordpress theme solution website."> <meta name="keywords" content=", proffesional wordpress theme, flexible wordpress theme, wordpress in 1 theme, premium wordpress theme " /> consider adding relevant keywords , relevant description. adding sitemapindex.xml lot also note headers contains these:

Remove the checked list item from the listview dynamically using jquery? -

i'm dynamcially creating listview storing data. when clicked on button listview appended checkbox's. when i'm selecting individual checkbox of items in listview particular list item has deleted listview. when i'm trying delete particular item not deleting. $('#add #input[name="check"]:checkbox').change(function () { var chklength = $('input[name="check"]:checkbox').length; var chkdlength = $('input[name="check"]:checkbox:checked').length; if (chklength == chkdlength) { $('#select').attr('checked', true); //$('#empty').on('click', function() { $('#add input[name="check"]:checkbox:checked').on('click', function () { $('#empty').on('click', function () { localstorage.removeitem($(this).attr('url')); $("#favoriteslist").listview('refresh'

Mysql - search for blogs by tags -

i'm using following query search blogs contain words in titles. each word recorded unique in table tags , referenced actual blog in table tags_titles. t.label actual tag words stored. for reason query not produce ay results, unless input number in case produces blogs without filtering. how can work? select tt.blog_id, b.title, count(*) total_matches tags_titles tt inner join tags t on tt.tag_id = t.tag_id left join blogs b on tt.blog_id=b.blog_id t.label in ('boats','planes') group tt.blog_id order total_matches desc i think want right join rather left join , fix other details in query: select b.blog_id, b.title, count(t.label) total_matches tags_titles tt inner join tags t on tt.tag_id = t.tag_id right join blogs b on tt.blog_id=b.blog_id , t.label in ('boat','plane') group b.blog_id order total_matches desc; you asking @ blog level. however, join instead keeping tags, rather blogs. once switch

python - storing template replacement values in a separate file -

using string.template want store values substitute template in separate files can loop through. looping easy part. want run result = s.safe_substitute(title=titlevar, content=contentvar) on template. i’m little stumped in format store these values in text file , how read file python. what looking call serialization . in case, want serialize dict, such as values = dict(title='titlevar', content='contentvar') there may ways serialize, using xml, pickle, yaml, json formats example. here how json: import string import json values = dict(title='titlevar', content='contentvar') open('/tmp/values', 'w') f: json.dump(values, f) open('/tmp/values', 'r') f: newvals = json.load(f) s = string.template('''\ $title $content''') result = s.safe_substitute(newvals) print(result)

c# - Access form control from other form -

this question has answer here: access class form 3 answers i got following method in mdiparent1 public void disablebutton() { toolstripbutton1.enabled = false; } in loginform okbutton click mdiparent1 f1 = new mdiparent1(); f1.disablebutton(); this.close(); the loginform modal of mdiparent1. problem disablebutton() don't works in loginform you're creating new instance of mdiparent1 , not using actual instance opened loginform . pass parent loginform constructor. private mdiparent1 _parentform = null; public loginform(mdiparent1 parentform) { _parentform = parentform; } //then in whichever event you're using _parentform.disablebutton(); this.close(); when want show loginform form, pass in mdiparent1 form. //assuming in mdiparent1.cs (otherwise pass form instance variable) using(loginform lf = new loginform(this)) { l

php - how to delete a file on the server and add a new file based on clients choice -

i have figured out how upload file server if file not exist. if file exist client able overwrite/delete existing file , upload new file. yes, both files must have same name. so attempting when file existed use switch statement calls function either delete existing file , upload new file or force php code die therefore canceling upload if (isset($_get['run'])) $linkchoice=$_get['run']; else $linkchoice=''; switch($linkchoice){ case 'one' : upload_file(); break; case 'two' : kill(); break; then link execute function <a class=button href='?run=one'>replace existing file</a><br/> <a class=button href='?run=two'>cancel upload</a> here how tried put together. <?php error_reporting(e_all); ini_set('display_errors',1); $allowedexts = array("xml"); $temp = explode("."