Posts

Showing posts from August, 2012

html - Divider on Right of Title -

Image
i want put divider on right of section title of page this: i tryid code, here how is: here code: <h4 class="section-title">lastest blog</h4> .section-title { font-size:18px; background-image: url('images/divider-bar.png'); background-repeat: repeat-x; padding-bottom: 12px; color: #6c6c6c; } here fiddle: http://jsfiddle.net/chead/hryyg/ there go: http://jsfiddle.net/kqdcr/ just wrap text in span white background : .section-title span { background: white; padding-right: 3px; } of course not work if background of page not plain color.

c++ - Reference captured in static variable definition -

#include <iostream> void foo(int k) { static auto bar = [&]{ std::cout << k << std::endl; }; bar(); } int main () { foo(1); foo(2); foo(3); // output correct: 1, 2, 3 } check function foo , how static lambda capturing k reference. seems work, , same happening more complicated datatypes rather int . is expected? there guarantee address of k same every invocation of foo , or ub ? thanks in advance, , sorry if answered (i did try find similar question without success) it undefined behavior . per paragraph 5.2.2/4 of c++11 standard function call expressions , initialization of parameters: [...] the lifetime of parameter ends when function in defined returns . initialization , destruction of each parameter occurs within context of calling function. [...] therefore, lambda storing reference becomes dangling function call returns. in case, implementations free (and likely) create function parameters @ same ad

textbox - Control Textboxes (enable/disable) with radio buttons - jQuery -

i controlling textboxes, enable / disable, depending on selected radio button - jquery preferable. if radio button selected associated textboxes enabled - others disabled. same thing scenarios. 1 radio button pre selected. here markup: <div> <h1>control fields</h1> <div id="div1"> <div id="first"> <input type="radio" name="radio" id="radio3" checked="checked" />first</br> <input type="text" id="txt_one" /></br> <input type="text" id="txt_two" /></br> </div> <div id="second"> <input type="radio" name="radio" id="radio4" />second</br> <input type="text" id="three" /></br&g

How do I make jQuery Contains case insensitive, including jQuery 1.8+? -

i'm trying use "contains" case insensitively. tried using solution @ following stackoverflow question, didn't work: is there case insensitive jquery :contains selector? for convenience, solution copied here: jquery.extend( jquery.expr[':'], { contains : "jquery(a).text().touppercase().indexof(m[3].touppercase())>=0" }); here error: error: q not function source file: /js/jquery-1.4.js?ver=1.4 line: 81 here's i'm using it: $('input.preset').keyup(function() { $(this).next().find("li").removeclass("bold"); var thematch = $(this).val(); if (thematch.length > 1){ thematch = "li:contains('" + thematch + "')"; $(this).next().find(thematch).addclass("bold"); } }); my use of original case sensitive "contains" in same scenario works without errors. have ideas? i'd appreciate it. thi

Multiple chained deferred functions using q in AngularJS stop returning data -

i trying chain multiple deferred function calls such next call gets results of previous deferred.resolve. when chain more 2 of these calls, data stops being returned. here basic code inside angular controller: $scope.runasync = function() { var asyncfn1 = function(data){ var deferred = $q.defer(); $timeout(function(){ console.log("async fn1 " + data); $scope.outputlines.push("async fn1 " + data); deferred.resolve("async fn1 " + data); },1000); return deferred.promise; } var asyncfn2 = function(data){ var deferred = $q.defer(); $timeout(function(){ console.log("async fn2 " + data); $scope.outputlines.push("async fn2 " + data); deferred.resolve("async fn2 " + data); },1000); return deferred.promise;

installation of R package results in an error message -

i tried install r package crypticibd check got follwing error when tried use it > library("crypticibdcheck") load package : rjpsgcs load package : rjava error : .onload in loadnamespace() für 'rjava' error, details: command: fun(libname, pkgname) error: java_home cannot determined registry error: paket ‘rjava’ can't found > coudl point me direction? i installed rjava package , treid run package again : .onload in loadnamespace() error rjava command: fun(libname, pkgname) error: java_home cannot determined registry error: paket ‘rjava’ can't found >

multithreading - Reference counting of the object in multithreaded application c++ -

i trying implement reference count objects in multithreaded program, can delete object when none of threads wants use or 1 initiate object delete. for doing following thing. class refcount{ int ref_count; pubic: void incr_ref_count(){ ref_count ++; } int decr_ref_count(){ ref_count--; return ref_count; } } and using following code whenever copy obj in different threads. pthread_mutex_lock(&ref_count_lock); if(obj != null){ dup_obj = obj; obj.incr_ref_count(); } pthread_mutex_unlock(&ref_count_lock); and while removing reference pthread_mutex_lock(&ref_count_lock); if(dup_obj != null){ count = dup_obj.decr_ref_count(); if(count == 0) delete dup_obj } pthread_mutex_unlock(&ref_count_lock); i hoping work fine, problem think hav using mutexs(lock), need have mutex(lock) each object create seperately can make coping , increasing or decreasing of count can atomic. how implement this. p

php - Pass object as parameter in function not working -

this seems extremely easy life of me can't figure out why not working. trying pass object function error: catchable fatal error: argument 3 passed write_query() must instance of mysqli, null given, called in c:\xampp\htdocs\csp\login\login.php on line 28 , defined in c:\xampp\htdocs\csp\php_scripts\login_script.php on line 40 these functions definitions: function conn_database() { if (!empty($_post['userid']) && !empty($_post['password'])) { $conn = new mysqli('localhost', 'root', '', 'csp'); if (mysqli_connect_errno()) { echo 'connection database failed:'.mysqli_connect_error(); exit(); } return $conn; } } function write_query($userid, $password, mysqli $conn) { $query = 'select * authorized_users ' ."where userid= '$userid'"

uiview - ios - Position of subview is returning to default when update UILabel of main view -

i`ve created subview containing uipickerview slides on main view occupying half of screen. when user selects value in picker update uilabel located in main view (behind). , problem occurs, because since after set uilabel value, position of subview set initial size, changing position , confusing app. need set uilabel in main view without changing actual position of subview. have idea?

html - DIV background image being cut off when zoomed out in firefox -

i have div height/width of 15px. has background image height/width of 15px. problem background image being cut off few pixels on right , bottom when zoomed out levels in firefox. here's link , code below. try viewing in firefox. <div id="custom-checkbox"></div> #custom-checkbox { background: url('http://s16.postimg.org/5xacziapd/unchecked.png') no-repeat; width: 15px; height: 15px; } this best can display rest firefoxes pixel rounding. #custom-checkbox { background: url('http://s16.postimg.org/5xacziapd/unchecked.png') no-repeat; width: 15px !important; height: 15px !important; display:table; } hope helps it's best do.

Can I iterate over an array defined within a for-loop in Java? -

does java offer way following without resorting declaring array in separate variable? for (string s : {"hey", "there"}) { // ... } the best can come is: for (string s : new arraylist<string>() {{ add("hey"); add("there"); }}) { // ... } which isn't pretty. well, least can this: for (string s : new string[]{"hey", "there"}) { // ... } since array s "iterable" in java (although not implementing iterable ), iterate on array instead of arraylist , in-line initialized.

html - Css sibling (~) selector doesn't work with checked property -

why doesn't css below work me? can advise me please. #slide1:checked ~ #inner { margin-left: 0;} #slide2:checked ~ #inner { margin-left: -800px;} #slide3:checked ~ #inner { margin-left: -1600px;} the css below work. don't know go here. #slide1:checked ~ #broadcontrol label:nth-child(1), #slide2:checked ~ #broadcontrol label:nth-child(2), #slide3:checked ~ #broadcontrol label:nth-child(3){ background: #333; border-color: #333; !important; } html: <div id="broadcast"> <div id="overflow"> <div id="inner"> <article> <div class="info"></div> <div id="pic1"></div> <!--img src=""--> </article> <article> <div class="info"></div> <div id="pic2"></div> <

php - HTML Dom Parse 5000 + Items -

is there anyways run/write code below efficiently? when run (via chrome browser) tends time-out around 500th item , redirect me homepage. <?php include_once('config.php'); include_once('simple_html_dom.php'); for($i = 0; $i <= 5000; ++$i){ // retrieve dom given url $html = file_get_html($url); // loop checks through page contents , retrieves required foreach($html->find('div.product-details-contents') $content) { $detail['productid'] = $i; $detail['title'] = $content->find('span.title', 0)->plaintext; $detail['unit'] = $content->find('span.unit-size', 0)->plaintext; $sqlstring = implode("','", $detail); $sql = "insert `cdidlist` (`productid`, `title`, `unit`) values ('$sqlstring')"; if (!mysqli_query($connect, $sql)) { echo "error: " . mysqli_error(); } echo $id . " " . $detail['title'] . " item added sucsessfully! <

ios - UIScrollView programatically Scrolling -

i have uitextview inside uiscrollview needs automatically scroll once user starts editing it. because keyboard cover textview. here code - in viewdidload: feedbackformview = [[uiscrollview alloc] initwithframe:cgrectmake(0, segmentedcontrol.frame.origin.x + self.segmentedcontrol.frame.size.height, self.view.frame.size.width, self.view.frame.size.height)]; feedbackformview.backgroundcolor = [uicolor whitecolor]; feedbackformview.scrollenabled = yes; feedbackformview.delegate = self; feedbackformview.userinteractionenabled = yes; feedbackformview.showsverticalscrollindicator = yes; feedbackformview.contentsize = cgsizemake(320, 700); commentsview = [[uitextview alloc] initwithframe:cgrectmake(5, emailfield.frame.origin.y + 40, 250, 150)]; commentsview.delegate = self; commentsview.layer.borderwidth = 2.0f; commentsview.layer.cornerradius = 5; and here's delegate method implementation - -(void)textviewdidbeginediting:(uitextview *)textview{ cgpoint point = textview.

ios - Set Navigation Title Text -

i have uicollectionviewcontroller , trying set navigation title.. none of these works...it not show text! self.titlelabel = [[uilabel alloc] initwithframe:cgrectzero]; self.titlelabel.backgroundcolor = [uicolor clearcolor]; self.titlelabel.font = [uifont fontwithname:@"arialhebrew-bold" size:15]; self.titlelabel.shadowcolor = [uicolor colorwithwhite:0.0 alpha:0.5]; self.titlelabel.textalignment = nstextalignmentcenter; self.titlelabel.textcolor = [uicolor whitecolor]; self.titlelabel.text = [self.navigationitem title]; self.navigationitem.titleview = self.titlelabel; [self.titlelabel settext:@"title"]; self.navigationitem.title = @"the title"; make frame of new label bigger. height of nav bar fixed @ 44 pixels. for example: cgrectmake(100,0,120,44); the width , origins depend on else on navbar, , width of navbar.

PHP constant encapsed string php error -

this question has answer here: reference - error mean in php? 29 answers this error getting. "parse error: syntax error, unexpected t_constant_encapsed_string in on line 188" trying connect database , insert data table, can't figure out error. $tablename = "customer"; $nullstr = "null"; $sqlstring = "insert $tablename values ('".$nullstr."','".$fname."', '".$lname."','".$address."','".$state."','".$zip."', '".$phone"','".$email"')"; $result = $mysqli->query($sqlstring); you're missing string concatenation operator . in couple of places. replace $sqlstring = "insert $tablename values ('".$nullstr."','&qu

android - Why does my score counter always reset? -

i'm trying make game , can't seem score counter work. problem every time button clicked value of integer goes 0. public void button(view view){ integer counter = integer.valueof(0); counter = counter++; final textview score = (textview) findviewbyid(r.id.score); score.settext("score: " + counter); } i see why score goes 0 every time don't know how fix it. i'm new development sample code appreciated. thanks. because resetting it. integer counter = integer.valueof(0); // here counter = counter++; use global variable instead. public class myactivity extends activity{ int counter; protected void oncreate(bundle savedinstancestate){ super.oncreate(savedinstancestate); setcontentview(...); counter = 0; } public void button(view view){ counter = counter++; final textview score = (textview) findviewbyid(r.id.score); score.settext("score: " + counter); } }

Cannot figure out why I cannot deploy GWT application onto Apache Tomcat 7 -

first, tried follow tutorial deploy application. after fiddling , failures, thought should run gwt sample contacts project , see if work on tomcat rpc calls. again, no luck. did create sample application (when using eclipse wizard) compile, run once on development server, , see works. then take contents of war folder, zip it, rename sampleapp.war, deploy on apache, unzips. have folder called sampleapp. in .html, .css, web-inf. attempt localhost:8080/sampleapp/sampleapp.html doesnt work. type status report message /sampleapp/sampleapp.html description requested resource (/sampleapp/sampleapp.html) not available. i have no idea do. tried simple example possible , work cannot. help! updated: cannot deploy servlet sample gwt app apache tomcat 7 to deploy gwt app on tomcat have create war file using ant. follow link create war file , put war file in webapps folder of tomcat surely work. http://blog.elitecoderz.net/gwt-and-tomcat-create-war-using-ec

canvas - in android trying to create an image by taking the width and height of textview -

i have created layout , textview dynamically , set textview width value , hieght fill_parent. while doing tv = new textview(this); tv.setlayoutparams(new layoutparams(500, layoutparams.wrap_content)); tv.settext("hello world how whats whats hows life oh great"); tv.settextcolor(color.black); tv.setbackgroundcolor(color.transparent); tv.settextsize(24); ll.addview(tv); this.setcontentview(ll); its showing content nicely , wrapping correctly hello world how whats whats hows life oh great but when try extract textview width , height , try create image of same width , same height, generating smaller width image cutting correctly word y partially. bitmap = bitmap.createbitmap(tv.getwidth(),tv.getheight(),config.rgb_565); canvas=new canvas(bitmap); canvas.drawargb(255,0,255,0); paint.setstyle(style.fill); paint.setcolor(color.blue); paint.setantialias(true); paint.settypeface(typeface.serif); p

how to use different class function in java -

hi im new java unsure how use class function in java . teacher gave point2d class , wants use function in there. there function call distanceto // return euclidean distance between point , point public double distanceto(final point2d that) { final double dx = this.x - that.x; final double dy = this.y - that.y; return math.sqrt(dx*dx + dy*dy); } i not sure how suppose implement this. code public static int calc(int amount) { (int t = 0; t < amount; t++) { double current = 0; double x = stdrandom.random(); double y = stdrandom.random(); point2d p = new point2d(x, y); if ( current < distanceto(point2d p ) ) { } i tried use distanceto(p) , distanceto(poin2d) , nothing works. thanks in advance public static int calc(int amount) static , , distanceto not. for not being static , distanceto requires enclosing instance of object, say: new point2d().distanceto(...)

maps - Javascript code to download tiles from OpenStreetMap? -

i need download small region tiles openstreetmap. need in javascript. so, can download them when needed. have seen tile downloaders jtile downloader etc., standalone applications. how download them folder , can access them using map api leaflet, openlayers etc., kindly, suggest me solution do want run javascript in browser? not possible download files local filesystem using javascript (just google it). if can run code using environment nodejs, can download files quite easily: how download file node.js (without using third-party libraries)?

shell - Bash: Spliting string based on some delimiter and storing each in a variable -

113050050/cs101/mysql_java.pdf the above string, stored in variable 'line' line="113050050/cs101/mysql_java.pdf" now want split $line based on delimiter / , store each single part in variable var1=113050050 var2=cs101 var3=mysql_java.pdf $ ifs=/ read var1 var2 var3 <<< "$line" results $ echo $var1 113050050 $ echo $var2 cs101 $ echo $var3 mysql_java.pdf

mysql - select record which is not present in other table in codeigniter -

i have used following query select rows tables. table 1: id description status add_date topicid 1 xyz 0 22-3-13 5 2 pqr 0 21-3-13 5 3 abc 0 20-3-13 5 4 sdd 0 22-3-13 5 table2: id otherid 1 2 2 3 this query gives me record table1 want select record not in table2. table1 'id' not present in table2 'otherid'. in case want select record table1 id 1 , 4.because not present in table2 'otherid'. $topicid = 5; $q =$this->db->select(array( 't1.id id', 't1.description', 't1.topicid', 't1.add_date')) ->from('table1 t1') ->where('t1.topicid',$topicid) ->where('t1.status',0) ->order_by('t1.add_date desc)->get(); try query work $topicid = 5; $q =$this->db->sel

cordova - facebook comments are not shown its whole list in phone gap -

i'm trying put facebook comments phonegap app on ios using facebook cordova sdk. i've included facebook_js_sdk.js , cdv-plugin-fb-connect.js. also, added below code right after start of body tag. <div id="fb-root"></div> <script>(function(d, s, id) { var js, fjs = d.getelementsbytagname(s)[0]; if (d.getelementbyid(id)) return; js = d.createelement(s); js.id = id; js.src = "//connect.facebook.net/ko_kr/all.js#xfbml=1&appid=my_app_id"; fjs.parentnode.insertbefore(js, fjs); }(document, 'script', 'facebook-jssdk'));</script> and put below code displayed <div class="fb-comments" data-href="http://example.com" data-width="470" data-num-posts="10"></div> however, facebook comments plugin shows comment , half(it isn't loaded) when run app.

wix - Should ALLUSERS property be specified in the .wxs file which produce Windows merge modules (*.msm)? -

we developing windows installer installer (msi) using wix 3.5, , have used merge modules in our msi. in msi, have specified allusers property value=1. windows merge modules (*.msm) use property or should specify allusers property in .wxs file produces *.msm files? first, it's allusers property . spelling , capitalization critical. second, no, msi should set allusers=1 not msm. installer decision not merge module concern. if components in merge module require per-machine installation consider scheduling error custom action enforces this.

java - Fetch results from two queries in single list in DAO class -

i trying fetch 2 different select queries in dao class single list in java. public list<sbcdocumentdetailsvo> getsbcdetails() throws dataaccessexception, sqlexception{ list<sbcdocumentdetailsvo> sbcdoclist = new arraylist<sbcdocumentdetailsvo>(); mapsqlparametersource namedparameter = new mapsqlparametersource(); //using namedparameterjdbctemplate querying sbcdoclist = this.getnamedparameterjdbctemplate().query( sbcdetailsquery, namedparameter, new sbcdetailsmapper()); return sbcdoclist; } my select queries are select state, marketid, count(marketid) batchreport group state, marketid select sum(case marketid when 'in' 1 else 0 end) totalcountind ,sum(case marketid when 'gr' 1 else 0 end) totalcountgrp batchreport could 1 me 2 queries in single list. from point of view have 2 possibilities: collection merge the idea execute both queries , add both results single list: ... list result = new arraylist()

MySQL Replace is not working -

i try use mysql replace following table. create table price ( id bigint unsigned auto_increment, ski_chalet_id bigint unsigned not null, month date not null, d_1 double(18, 2), d_2 double(18, 2), d_3 double(18, 2), d_4 double(18, 2), d_5 double(18, 2), created_at datetime not null, updated_at datetime not null, unique index fk_ski_chalet_price_ski_chalet_idx (ski_chalet_id, month), index ski_chalet_id_idx (ski_chalet_id), primary key(id) ) default character set utf8 engine = innodb; i want add row if row not exist , update if row exist. used mysql replace that. replace `price` set `ski_chalet_id` = 43 , `month` = '2013-04-01' , `d_1` = 23 this query successful. add value 00 , 0000-00-00 or null. but insert query working. insert `price` (`ski_chalet_id`,`month`,`d_1`) values ('34', '2013-04-01', '46'); i cant find whats issue. please me. you have use "," instead on &q

.net - Deploying with TeamCity -

our team started solution consists of 4 projects - desktop app, 2 web app, win- , web-services. we decided use teamcity ci server , decided use building setup packages (nightly builds). google shows me lot of articles on how deploy web application, using .zip packages - no 1 upon how create msi or setup. also no clues on how same non-web project - desktop apps, web- , win -services. have used teamcity building , deploying non-web application? disclaimer: don't use teamcity build windows non-web application. java web or standalone applications , ios & android applications in teamcity, there "visual studio (sln) " build step type, try see if can utilize that. or investigate if can build msi , setup using msbuild , if turns out possible, can add msbuild type build step in teamcity creates msi or setup. or can imagine myself trying create cmd or powershell script build msi using wix toolset , , install wix on teamcity build agents. then in t

C# cannot take new memory -

working c# - c++ (manage) mix project , realize there memory leaks in our project, searched , found out, destructor of c++ part never called wrote piece of code free memories. can see program growing slower in memory (there more memory leaks), problem is, in c# part program start crash because of " out of memory exception ". in operation such as double []k = new double[65536]; memory usage of program seems 400-500mb crashed. os : win server 2003 memory : 4 gb os should let program grow 1200 mb after wrote free memory part start crash 400-500mb. called c++ func c# part free memories freememories() { if(!misalreadyfreedmemory) { misalreadyfreedmemory = true; _aligned_free(pointera); _aligned_free(pointerb); .... } } why cannot take new memory, program can not take released memory again? you should use idisposable pattern objects. basic idea this: public class myobject : idisposable { // unmanaged resource:

python surface plot from 3 1D arrays -

i have 3 1 dimensional arrays. each array consists of floating point numbers. first array represents x axis coordinates. second y, third z. if put corresponding points each array ordered triple have point in xyz space. these arrays read in file. in application z thickness. best way create surface plot in these circumstances. the easiest way start mayavi in interactive more in ipython importing mlab , use surf function: import mlab mlab.surf(x,y,z) hope helps.

ruby on rails - @ is not allowed as an instance variable name -

i working on project mongoid , rails. here code: class account include mongoid::document include mongoid::timestamps field :account_name, type: string has_many :groups end class group include mongoid::document field :group_name, type: string belongs_to :account has_and_belongs_to_many :groups end class groupscontroller < applicationcontroller before_filter :require_login, :find_company def new @group = @company.groups.new end def create @group = @company.groups.new params[:group] if @group.save redirect_to people_path else render :new end end private def find_company @company = current_account.groups.find(params[:company_id]) if params[:company_id] end end and error being returned is: @' not allowed instance variable name (nameerror) ./app/controllers/groups_controller.rb:5:in `new' i can't seem find googling around issue, appear issue lies has_and_belongs_to_many relationship, not

iphone - Init method with parameters not called -

i spent hours trying solve issue i'm trying initialize class parameter - (void)tableview:(uitableview *)tableview didselectrowatindexpath:(nsindexpath *)indexpath { //fetch value of selected row in nsstring uitableviewcell *cell = [tableview cellforrowatindexpath:indexpath]; // nsstring *tablerowvalue = cell.text; tablerowvalue = [[listofitems objectatindex:indexpath.row]objectforkey: @"clientid"]; //call next view contactslist *contactslist = [[contactslist alloc] initwithnibname:nsstringfromclass([contactslist class]) bundle:nil]; @try { [self presentmodalviewcontroller:contactslist animated:yes]; } @catch (nsexception *ex) { uialertview *alert = [[uialertview alloc] initwithtitle:@"error" message:[nsstring stringwithformat:@"%@",ex] delegate:self cancelbuttontitle:@"ok" otherbuttontitles: nil]; [alert show]; }

Python - Sorting a dictionary {String Key: List of Strings} by len(value)? -

suppose have following dictionary: {"a":["u","w"],"b":["t"],"c":["x","y","z"]} how can sort dictionary number of strings in list in of each value returns: [("c",["x","y","z"]), ("a",["u","w"]), ("b":["t"])] because value of "c" has 3 items in list, "a" has two, "b" has one. thinking along lines of: sorted(d.items(),key=operator.methodcaller(len(),tuple[1]),reverse=true) or sorted(d.items(),key=(string, stringlist):(len(stringlist),string),reverse=true) but both not seem work. still quite new sorting, help! >>> d = {"a":["u","w"],"b":["t"],"c":["x","y","z"]} >>> sorted(d.items(), key=lambda x: len(x[1]), reverse=true) [('c', ['x',

c# 4.0 - Video Conference in ASP.NET C# Website -

well, developing virtual classroom i.e. online classroom, website provides faculties , students interactive way of learning. done stuck video conferencing module. using asp.net c#. have searched lot this. information found is: 1) got know conferencexp module. developed microsoft , enables developers use build own video-audio conference. searched lot it, confused on how implement in website. suggestion steps on how use conferencexp in website. 2) though searched lot, yet if links left, asking again there better , easier way( easier , fast beacuse need implement website in 7 days) implement video-audio chat application in website using c#(or other technology working visual studio). 3) while searching found can use skype online classroom, suggestions related this? thanks in advance. you can use openmeetings regardless of technology. whole interface soap/rest based.

java - Spring MVC 3 User Defined Exception handling with User defined View -

how handle user defined exceptions (custom exception ex.: "businessexception") in spring mvc 3 custom message , view name ? for example : if throw own exception service layer should caught , should redirect specified view message, view name may same or different. and want display message using properties file searched in google, no luck. thanks. have @ simplemappingexceptionresolver <bean class="org.springframework.web.servlet.handler.simplemappingexceptionresolver"> <property name="exceptionmappings"> <props> <prop key="com.example.exception.businessexception"> yourview </prop> <prop key="java.lang.exception">error</prop> </props> </property> </bean>

c# - What is static indexer? -

this question has answer here: are static indexers not supported in c#? [duplicate] 3 answers static indexers? 4 answers an interviewer asked me question, puzzled term because understand "static" member , i'm familiar concept of "index" meant static indexer ? did searching of own unable find satisfactory definition. static indexer not possible in c# indexer semantics require 'this' keyword defines block of code indexer, , reference current instance of class. since static indexer have no such reference, stands reason can't define indexer static. that's personal interpretation, there may bigger picture that. however, if have special need, indexers convenience - can accomplish want old fashioned way through methods. the fact o

try to implode string using php and redis -

this php file:- <?php require "predis-0.8/autoload.php"; predis\autoloader::register(); try { $redis = new predis\client(); }catch (exception $e) { }; $redis->del("aaa"); for($i=1;$i<=10;$i++) { $randno=rand('1','5'); $ec = $redis->set("arr",$randno); $str = $redis->get("arr").","; echo ($str); } $comma = implode(",", $str); echo ($comma); ?> i using redis php. try implode strint. not work. return me error. warning: implode(): invalid arguments passed idea why fetch warning. in advance. you looking function explode not implode . implode takes array , concatenates elements given string in between. explode takes string , splits array @ places find given string removing string. $arr = array( 'foo', 'bar'); $imp = implode(',', $arr); # $imp == 'foo,bar' $exp =

java - How to read from org.jboss.netty.channel? -

i need read directly channel. i'm using netty. in channelhandler, have function: public void messagereceived(channelhandlercontext ctx, messageevent e) channelbuffer buf = (channelbuffer) e.getmessage(); channel ch = e.getchannel(); //i need read somthing ch, not buf } you can't read directly channel netty deliver data read channel automatically handler. if want read directly channel may use directly nio.

python - String concatenation performance -

right use list store altered string , return string .join() def applycoder(text, coder): l = [] in text: if in coder: l.append(coder[i]) else: l.append(i) return ''.join(l) # example output, shifts letters 3 in string # print applycoder("hello, world!", buildcoder(3)) # buildcoder(3) returns dictionary, e.g. {'a': 'd', ...} # >>> khoor, zruog! is there faster method change , return string? this should fast possible: ''.join([coder[i] if in coder else in text]) list comprehensions more optimized in python compared for loops bear great overhead. i've passed list comprehension opposed generator in ''.join because must know length of it's input in advance before joining. if give generator has make list anyway (which bit slower). actually can simplify further, which should faster ( this performs slower above method due method call ) ''.

string - Simple Android SharedPreferences Implementation: Method Failure - All Values Are Null -

i'm attempting null check several values in source code , appears returning null. should able use these value in new class due sharedpreferences implementation appears not working. (i appear overlooking simple.) startpoint class sharedpreferences implementation: sharedpreferences prefs=getpreferences(context.mode_private); sharedpreferences.editor editor=prefs.edit(); editor.putboolean("name",true); editor.putboolean("cap",true); editor.putboolean("code",true); editor.putboolean("time",true); editor.putboolean("ssid",true); editor.commit(); endpoint class sharedpreferences implementation: sharedpreferences prefs=getpreferences(context.mode_private); sharedpreferences.editor editor=prefs.edit(); if (new == null) { log.d(tag, "broken value! debug! debug!"); prefs.getboolean("new", true); prefs.getboolean("user", true); prefs.getboolean(&q

HTML5 Video dimensions in Safari IOS -

i'm building website client who's majority of content video. i'm using html5 video element display content have problems when comes safari on ios. safari on ios not download video metadata until user initiates download, width , height properties of video set default size of 300 x 150 px - leaving big area of black on either side of video stretching width of containing element. i'm trying make website responsive possible , default size not work me. there anyway combat safari on ios respects video size? i used following css worked me. tested on ipad mini ios 7.1 video { min-height: 100%; min-width: 100%; height: auto !important; width: auto !important; }

jquery - Get value from brackets from an onclick -

is possible lat , lon onclick function? <a href="javascript:void(0)" onclick="findlocation('6.443663,3.419248');return false;" id="lagos">lagos, nigeria</a> <a href="javascript:void(0)" onclick="findlocation('3.15021, 101.707703');return false;" id="kuala">kuala lupar, malaysia</a> <a href="javascript:void(0)" onclick="findlocation('24.9952447639, 55.0559356887');return false;" id="dubai">dubai, u.a.e.</a> i have numbers findlocation function array if possible each location. added note findlocation function plots locations on map , focuses in on location. need try lat , lon each onclick , somehow these plot points when page loads. function findlocation(address) { var address = document.forms[0].q.value = address; geocoder.geocode( { 'address': address}, function(results, status) { if (status == go

c# - Format string/number "NNNNN" -

i have write progression of number, having (each) 5 digit. code is: int count = 1; string labelcount = ""; foreach (var directory in folderlist) { if (count < 10) { labelcount = "0000" + count.tostring(); } else if (count < 100) { labelcount = "000" + count.tostring(); } else if (count < 1000) { labelcount = "00" + count.tostring(); } else if (count < 10000) { labelcount = "0" + count.tostring(); } count++; } but doesnt looks in opinion. there way format number (adding 0xn left) or that's way? just give format tostring method var str = count.tostring("00000");

java - Way to oblige AspectJ to throw a runtime error if it can't find/put to run the given aspect files? -

i trying run complex application complex classpaths , jvm options load-time aspects woven in. @ moment doesn't seem doing anything, can't know sure if in way related bug in code or in aspect not being loaded @ all. there special switch alert me if given aspect not being loaded (and possible, issue @ hand)? i've looked aj command line script , doesn't particularly useful :( update: forgot mention option want -showweaveinfo rather (or in addition to) -verbose . while latter shows if aspect has been registered @ all, former shows woven classes. in chapter 5 of the aspectj development environment guide find information about configuring load-time weaving aop.xml files including samples weaver options verbose , dump within , a short reference of weaver options . the former writes information processed ltw aspects on system.err , latter dumps classes in specified packages specific directory can inspect them , see if have been woven desired.

How to produce an csv output file from stored procedure in SQL Server -

is possible generate csv file stored procedure in sql server? created stored procedure , want stored result csv, know how achieve this? i think possible use bcp command. new command followed this link , worked me.

progress bar - C# progressbar drawstring on form load -

is there way write default text on progressbar in c# ? this isn't working in form_load, works fine on button click... using (graphics gr = progressbar1.creategraphics()) { stringformat sf = new stringformat(stringformatflags.nowrap); sf.alignment = stringalignment.center; gr.drawstring("hello world", new font("arial", 10.0f, fontstyle.regular), new solidbrush(color.black), progressbar1.clientrectangle, sf); } thanks in advance you can set 1 time timer event on 1 option. timer t = new timer(); form_load() { t.interval = 1000; t.start(); } static void t_elapsed(object sender, elapsedeventargs e) { //one time event t.stop(); using (graphics gr = progressbar1.creategraphics()) { stringformat sf = new stringformat(stringformatflags.nowrap); sf.alignment = stringalignment.center; gr.drawstring(&qu

Dust.js template with simple logic -

i have json data: { "title": "available cars", "names": [{ "name": "ford", "image": "./images/ford.png", "flags": "./images/us.png", "description": "make average cars", "detail": [{ "profile": "big company", "background": "bad" }] }, { "name": "bwm", "image": "./images/bmw.png", "flags": "./images/gm.png", "description": "make great cars", "detail": [{ "profile": "mediumgermancompany", "background": "good"

node.js - Using jade with wysiwyg markdown to allow users to edit content -

i believe don't re-invent wheel unless absolutely have to. don't want start coding away has been coded, or lot of people contributing already. i have emigrated planet node.js (sorry php/apache), , need put resources bring things speed other languages. i using node.js server listener, express.js middle-ware, , jade js template engine. i use tinymce features instead of code being usual ugly html markup , code markdown , allow jade majic. suppose more or less stackoverflow edit (which typing in) maybe little more advanced ui wise. so instance if click on button b should make selected text bold would, wysiwyg editors. references : http://nodejs.org/api/ http://expressjs.com/api.html https://github.com/visionmedia/jade#readme-contents http://www.tinymce.com/wiki.php you use of html generating wysiwyg editors, , on "save", allow html pass server convert jade syntax before storing it. you integrate package, example, express server: ht

symfony - Find out what Controller is triggering an event in symfony2 -

i need trigger event once in symfony2 project each web have created event dispatched whenever kernel.controller occurs, problem makes event run 6 or 7 times , want run once. any ideas or suggestions? if so,i wouldn't mind being able know controller triggered event can put code want put there!!

java - How do I get the buttons on my calculator to actually do equations? -

i wanted make small calculator project fun test out new gui knowledge java swing api. created gui, there's crucial part missing: math! question is, how add functionality each of these buttons? in simpler terms: how make buttons add text box(2+2) when user clicks buttons, , have system add numbers , display them user? here's code: package calculatorpack; import java.awt.borderlayout; import java.awt.color; import java.awt.gridbagconstraints; import java.awt.gridbaglayout; import java.awt.event.actionevent; import java.awt.event.actionlistener; import javax.swing.boxlayout; import javax.swing.jbutton; import javax.swing.jframe; import javax.swing.jlabel; import javax.swing.jpanel; import javax.swing.jtextarea; import javax.swing.uimanager; public class basiccalculatordesign { public static void main(string[] args) { try { uimanager.setlookandfeel(uimanager.getsystemlookandfeelclassname()); } catch (exception e) {

android - java.lang.RuntimeException: Cannot serialize: 0.0 -

i making soap request in asynctask getting strange error 04-18 13:51:25.070: e/androidruntime(23482): @ org.ksoap2.serialization.soapserializationenvelope.writeelement(soapserializationenvelope.java:658) 04-18 13:51:25.070: e/androidruntime(23482): @ com.mobilion.afad.registerdevice.getwebservice(registerdevice.java:49) 04-18 13:51:25.070: e/androidruntime(23482): @ com.mobilion.afad.registerdevice.access$0(registerdevice.java:44) 04-18 13:51:25.070: e/androidruntime(23482): @ com.mobilion.afad.registerdevice$requesttask.doinbackground(registerdevice.java:109) these methods private boolean getwebservice(string method, soapserializationenvelope soaprequest) { httptransportse httptransport = new httptransportse(soapaddress); try { httptransport.call(soapaction, soaprequest); //httptransport.call(namespace + method, soaprequest); return true; } catch (ioexception e) { e.printstacktrace(); return false;

c - Floating point emulation or Fixed Point for numbers in a given range -

i have co-processor not have floating point support. tried use 32 bit fix point, unable work on small numbers. numbers range 1 1e-18. 1 way use floating point emulation, slow. can make faster in case know numbers won't greater 1 , smaller 1e-18. or there way make fix point work on small numbers. it not possible 32-bit fixed-point encoding represent numbers 10 –18 1. obvious fact span 10 -18 ratio of 10 18 , non-zero encodings of 32-bit integer span ratio of less 2 32 , less 10 18 . therefore, no choice of scale fixed-point encoding provide desired span. so 32-bit fixed-point encoding not work, , must use other technique. in applications, may suitable use multiple fixed-point encodings. is, various input values encoded fixed-point encoding each scale suitable it, , intermediate values , outputs have customized scales. obviously, possible if suitable scales can determined @ design time. otherwise, should abandon 32-bit fixed-point encodings , consider alternatives.

Integer sent from javascript to php to mysql comes back different -

okay, im confused now. i have app in javascript sends array of info php script, in turn saves mysql database. the info contains unique number between 8 , 20 characters used mysql unique index , , has number incremented 1 assigned each unique number. when send 1066998880 works checking see if row exists, adding 1 score. but when send 100005075040249 saves mysql database 2147483647 , returns duplicate of 2147483647 . not sure im doing wrong. heres code: javascript $.ajax({ url: 'url', data: { unique_id: unique_id, first: first, last: last, email: email}, type: 'post', success: function(output) { 'functions'}; php $unique_id = $_post["unique_id"]; $first = $_post["first"]; $last = $_post["last"]; $email = $_post["email"]; $count = 1; // connect server , select database. $connection = mysql_connect("$host", "$username", "$password") or die(mysql_error());

java - Socket Programming Error while Posting XML to Server -

this question has answer here: official reasons “software caused connection abort: socket write error” 11 answers public static string posttoserver(string ip_port ,int nodexml) { logger.error("node xml "+node.writetostring(nodexml,true)); socket requestsocket = null; objectoutputstream out = null; objectinputstream in = null; string message = null; string ip_port_split[] = ip_port.split("@"); string ip_p = null; integer ip_ip = 0; if(ip_port_split.length != 0 && nodexml != 0) { ip_p=ip_port_split[0]; logger.error("ip_p "+ip_p); ip_ip=integer.parseint(ip_port_split[1]); logger.error("ip_ip "+ip_ip); try{ requestsocket = new socket(ip_p, ip_ip); out = new objectoutputstream(requestsocket.getoutputstream()); out.flush

javascript - CONVERT TIMES in HighChart -

Image
i using high charts compare waiting time discharge times each patient. for example: patient id expected time waiting time 2 2 hours 1 hour i have connection database these times: $query2 = "select patientid,forename, patient.illness, patient.priority, arrival_time, my_time() now, abs( timediff( my_time( ) , arrival_time ) ) waiting_time, time_to_sec( expected_time) expected_time , time_to_sec( discharge_time ) discharge_time, examined patient, priority_time patient.illness = priority_time.illness , patient.priority = priority_time.priority;"; $result2 = mysqli_query($conn, $query2) or die("invalid query: ".$query2); i want display patient id on x axis , waiting time on y axis. issues: converting time display in format: hours: minutes: seconds on y axis. here code: <html> <head> <script src="http://code.jquery.com/jquery-1.7.1.min.js"></script> <script src="js/high

c# - Error when trying to convert TextBox.Text value to Int32 -

in txtdefinavalor.text can enter values 1% 999%, made code if value higher 100%, change value of textbox 100%. it, removed % textbox , made if code using convert.int32 (had same error), tried int32.parse (had same error). error "input string not in incorrect format" on line: string valor = txtdefinavalor.text.replace("%", string.empty); i think textbox after replace % "" integer number , wasnt need convert, can't make string > value see full code: if (rbtpercentualmensal.checked || rbtpercentualmedioanual.checked) { string valor = txtdefinavalor.text.replace("%", string.empty); if (int32.parse(valor) > 100) { txtdefinavalor.text = "100%"; } } how solve it? try replaceing "." , "," (if users entered them), , trim! string valor = txtdefinavalor.text.replace("%", string.empty).replace(",", string.empty).replace(".", string.empty)