Posts

Showing posts from May, 2012

javascript - Jquery .text().length counting element's code as well as characters? -

i want detect amount of characters in div , if there less five: var n = $("#mydiv").text().length; if (n < 5){ //do } but 'n' seems counting code used div self: <div id="mydiv"> </div> so if there no characters within div: n = 23 . does know way adjust count characters within div itself? trim text exclude leading , trailing spaces in text var n = $.trim($("#mydiv").text()).length; //use string.trim() if want support ie9+ demo: fiddle $.trim() string.trim()

javascript - How To Value Copy and Paste in another Textbox from Dropdown -

Image
hi guys can tell me how copy field value field when use check box in dropdown have click check box value copy in textbox. when have select checkbox value move in textbox auto. i using multiselect dropdwon list , need when select checkbox value option 1 or 2 value move in textbox automatic in below text box. <script language="javascript"> $(document).ready(function() { $("#dropdown").on('change',function(){ var dropdownval=this.value; $("#textbox").val(dropdownval); }); }); </script> </head> <body onload="prettyprint();"> <form> <p> <select multiple="multiple" name="dropdown" style="width:370px"> <option value="red">red</option> <option value="green">green</option> <option value="blue">blue</option> <option valu

C++ copy constructor, destructor error and more -

i new c++. have tried figure out how copy constructor works , destructor, cant work wright. i 2 errors: error: expected primary-expression before ';' token delete []; i have tried put different things after delete [] none of them worked, left blank @ moment. class dynamicline has no member named 'p2', what doing wrong? did decleare p2 in test program. this header file: template<class t> class dline { public: dline (t *v1, t *v2) : v1 {v1}, v2 {v2} {} t* v1; t* v2; // copy constructor dline(const dline &l) { v1 = l.v1; v2 = l.v2; } dline& operator= (const dline &l) { if (this == &l) { return *this; } v1 = l.v1; v2 = l.v2; return *this; } ~dline() { delete []; } }; i have vector class: using namespace std; vector2::vector2(float nx, float ny) : x {nx} , y {ny} { } float vector2::distancefrom(vector2 v) { return sqrt( (x - v.x)*(x - v.x) + (y - v.y)*(y - v.y) ); } os

java tells that can not find symbol -

i studying core java myself. wrote java program, , got 1 error: ...cannot find symbol "refc" but is declared object reference... can explain that? import java.io.*; class contactmain { int count = 0; int[] = new int[5]; contactmain() { system.out.println("a"); a[count] = count+1; count++; } } class contact { public static void main(string args[]) { int y = 0; int = 0; while (i<10) { contactmain refc = new contactmain();//create instance of class i++; } system.out.println(refc.a[i]); } } in last statement, got error {refc.a[i]} cannot find symbol. please, me. scope matters, you're declaring variable inside while(..){ } , trying access outside of loop, change code to: while(i<10) { contactmain refc=new contactmain(); i++; system.out.println(refc.a[i]); }

ruby on rails - Path helper inserts plus sign instead of space -

i want have link_to with <%= link_to "my link", search_path(par: "my link") %> but gets rendered <a href="/search?par=my+link">my link</a> instead of <a href="/search?par=my link">my link</a> is there way force behave properly, , not manually insert %20 instead of space? try this require 'cgi' cgi.unescape "/search?par=my+link" example: 1.9.3p448 :006 > cgi.unescape "/search?par=my+link" => "/search?par=my link" 1.9.3p448 :007 > cgi.unescape "/search?par=my%20link" => "/search?par=my link" hope helps!

html - Strange behavior of inline-block elements inside absolute positioned parent -

i have few <div> s having display:inline-block , inside absolute positioned parent <div> . html <div id='wrap'> <div id='container'> <div class='box'></div> <div class='box'></div> <div class='box'>&#64;</div> <div class='box'></div> </div> </div> css *{ margin:0; } html, body{ height:100%; } #wrap{ position:relative; background:lightgreen; height:100%; } #container{ position:absolute; bottom:0px; vertical-align:baseline; } .box{ display:inline-block; width:80px; height:120px; background:white; border:1px solid; } when add ascii character codes in of <div> s, strangely other <div> s move up. if remove ascii character <div> s align in same row. check jsfiddle i aware of other ways making layout, can make boxes absolute , force them positioned @ bottom of parent, i'm aware of css

Use of "("?) in Lua with string.find and the value that it returns -

a, i, c = string.find(s, '"("?)', + 1) what role of ? here? believe checking double quotes not understand use of "("?) . i read string.find returns starting , ending index of matched pattern. per above line of code, a , i , c , 3 values being returned. third value being returned here? ? matches optional character, i.e, 0 or 1 occurrence of character. pattern "("?) matches " , followed optional " , i.e, matches either " or "" . note match "? (zero or 1 " ) captured. as return value of string.find() , string.find() : if pattern has captures, in successful match captured values returned, after 2 indices. the capture third return value, when there successful match.

sql - Unable to copy cvs data to postgresql table -

i have tried reffering questions asked in so in sql have written : copy lcities e'c:\\users\\admin\\desktop\\sneh.csv' delimiter ';' csv error: invalid input syntax integer: "lawyer code, lawyer name, years of experience, location, average rating" context: copy lcities, line 1, column id: "lawyer code, lawyer name, years of experience, location, average rating" ********** error ********** error: invalid input syntax integer: "lawyer code, lawyer name, years of experience, location, average rating" sql state: 22p02 context: copy lcities, line 1, column id: "lawyer code, lawyer name, years of experience, location, average rating" ok error: relation "sneh" not exist tell postgresql table sneh not exist. you first create sneh name table inside postgresql , try again. clear when create table @ time take care datatype can use. because create error, reason behind conflict datatype csv data or p

prolog - How to create a list of fixed length and sums up to a certain number while choosing from its elements from other list -

assuming have list l=[1,2,3] want create list o length of o n , total sum of elements s has created using elements l if contain duplicates. examples n=5 , s=7 : o=[2,2,1,1,1] o=[2,1,2,1,1] o=[3,1,1,1,1] o=[1,3,1,1,1] here's variant similar @wouterbeek's solution doesn't use separate accumulator: summate_tokens(types, sum, n, [x|t]) :- n > 0, member(x, types), sum1 sum - x, % subtract running sum n1 n - 1, summate_tokens(types, sum1, n1, t). summate_tokens(_, 0, 0, []). it implicitly handles length of solution counter, n . work kind of numbers in types argument. with results: ?- summate_tokens([1,2,3], 7, 5, tokens). tokens = [1, 1, 1, 1, 3] ; tokens = [1, 1, 1, 2, 2] ; tokens = [1, 1, 1, 3, 1] ; tokens = [1, 1, 2, 1, 2] ; tokens = [1, 1, 2, 2, 1] ; tokens = [1, 1, 3, 1, 1] ; tokens = [1, 2, 1, 1, 2] ; tokens = [1, 2, 1, 2, 1] ; tokens = [1, 2, 2, 1, 1] ; tokens = [1, 3, 1, 1, 1] ; tokens = [2, 1, 1

sql - Update multiple rows in a column in MySQL -

i'm having table that: number 1 2 3 4 5 i want change value in row 1 1 8, used update tablea set number=8 number=1 the resulting table looks follows: number 8 2 3 4 5 so far tried query below update multiple rows, update tablea set number=8 number=1; update tablea set number=10 number=2; update tablea set number=11 number=4; and works fine possible reduce simpler? in query can this: update tablea set number = number + 7 number in (1,4); update tablea set number=10 number=2;

javascript - Slide (toggle) divs to one side -

i have created similar layout 1 trying achieve on webpage. please @ fiddle . slide(toggle) left <div class="slide"></div> clicking on <div class="clickme"></div> . have seen lot of similar question, far have not been succesful. edit. question misleading. looking jquery functions slideup(), slidedown(), slidetoggle() such content slide sideways e.g. slideleft() . far have found, nothing exists. update have come this . add .slide { } position: relative;

javascript - load json data into li with ng-repeat -

i can't load data list ng-repeat, here's app http://plnkr.co/edit/dd05tnnlg66h6nklbjhm?p=preview in line 12 of app.js wrote $scope.tabs = tabs; which tabs object in data.js one strange thing occur too, when console.log in maincontroller scope, tend execute twice. wonder you're using $scope.tabs.push add data tabs . can't because $scope.tabs object , not array. change data.js : var tabs = [ { 'tabid':1, 'tabname': 'main', 'tabfriends':[ {'name':'someone1'}, {'name':'someone1'}, ] }, { 'tabid':2, 'tabname': 'programming', 'tabfriends':[ {'name':'someone2'} ] } ]; it's array, can push now. , angularjs happy repeat on it. and tab object has tabname property, while on addtab function call name .

php - Get the rows and display them in echo mysqli prepared -

im trying rows database mysqli prepare statments , display them in echo <?php echo $username; ?> don't know how them , wasted 4 hours no success , greate php <?php include("secure/functions.php"); session_start(); $stmt = $mysqli->prepare("select * members username = ?"); $stmt->bind_param('s', $_session['username']); // bind "$username" parameter. $stmt->execute(); // execute prepared query. $stmt->store_result(); if($stmt->num_rows == 1) { $stmt->bind_result($id,$username); // variables result. $stmt->fetch(); } ?> you used $session_start(); should session_start(); no dollar sign.

jenkins plugins - SonarQube - no JaCoCo execution data has been dumped -

i'm running sonarqube in jenkins job (using post-build actions). i'm getting following problem jacoco - [info] [16:57:43.157] sensor jacocosensor... [info] [16:57:43.157] project coverage set 0% no jacoco execution data has been dumped: /var/lib/jenkins/.../target/jacoco.exec [info] [16:57:43.426] sensor jacocosensor done: 269 ms as result, i'm getting 0% code coverage project. couldn't find why jacoco.exec not being created. i don't have "jacoco" configured run maven (in pom.xml). know in past jacoco.exec created anyway (probably sonar itself). what doing wrong? need configure jacoco in pom.xml work? thanks. from web java ecosystem : it no longer possible let sonarqube drive execution of unit tests. have generate junit , code coverage (jacoco or cobertura or clover) reports prior sonarqube analysis , feed sonarqube reports. so need include jacoco in pom.xml: <plugin> <groupid>org.jacoco</groupi

rubygems - Compass unable to find files in project -

i editing wordpress template makes use of sass. when edit .scss file , save it, codekit throws out error. compass unable compile 1 or more files in project: error app.scss (line 9 of _settings.scss: file import not found or unreadable: foundation/functions. load paths: /library/webserver/documents/dev/ecpr_sgoc/scss /library/ruby/gems/2.0.0/gems/compass-0.12.2/frameworks/blueprint/stylesheets /library/ruby/gems/2.0.0/gems/compass-0.12.2/frameworks/compass/stylesheets /applications/codekit.app/contents/resources/engines/bourbon/bourbon/app/assets/stylesheets /applications/codekit.app/contents/resources/engines/neat /applications/codekit.app/contents/resources/engines/susy/sass compass::spriteimporter) identical app.css (this action triggered change _colors.scss) edit: upgraded codekit 2 , new output: compass failed run because mac has older version of sass and/or compass installed conflicts newer versions in codekit. must remove versions of sass below 3.3.r

actionscript 3 - How can I get SWF file ,which gets its xml file via a coldfusion .cfm file, downloaded and work offline? -

i trying download lesson player here(my.thinkwell.com/cf/external/?39b0f4357b39968d). have downloaded swf file( http://thinkwell.cachefly.net/player/twplayer.swf ). want make file work on browser offline. have downloaded [page][1] source , edited code in order swf file run, nothing works. i've discovered swf file communicates coldfusion file called config.cfm(thinkwell.cachefly.net/player/config.cfm) [xml file of lesson contains lesson presentation files. don't know how process going , if there other files included in process. want reach download files related whole process in order able run offline. in advance!

ios - AI for enemy in SpriteKit -

i have been making game in sprite kit time now. have added enemies , wondering how can control them around map using ai(just in other game). what want enemy wonder around tmx map, turning corner depending on random number. have tried have run many problems. know of articles me this? have done research. "pathfinding" , "a*" come up, know explanation or sample code on how it. appreciated. welcome so. let me start saying searching same thing. unfortunately pickings have been kinda weak, @ least found far. i did find couple of interesting reads: an article on ghosts behavior of pacman. simple effective. amit’s game programming information . more general discussion making games. gamasutra . excellent resources things game design. designing ai algorithms turn-based strategy games . gamasutra article extremely useful in explaining turn based ai in plain english. all these useful in own ways , make think. however, nothing have come across provides

r - How to perform sum of vector elements if it contains another vector? -

i have similar code in r gives warnings: > require(pracma) # integral > v1 <- c(1, 2, 3, 4, 5) #some vector of unknown length > v2 <- c(6, 7, 8, 9, 0) #another vector of same length v1 # here want sum v1 & v2 elements, sum contains x argument > f <- function(x) x^(-2i) sum(v1 / (1 - v2 * x)^2) > integral(f, 1e-12, 1) 49: in v2 * x : longer object length not multiple of shorter object length 50: in v1/(1 - v2 * x)^2 : longer object length not multiple of shorter object length i use r-studio debugging purpose, , see integral function pass vector f function. i understand v2 vector , x vector. i'm don't know how make work without warnings. have tried put vectorize(x) in sum function, warnings still here. how handle situation? there 2 problems here. first need vectorize function. second function returns complex value (although argument real). can integrate complex functions using myintegrate(...) function in elliptic packag

ruby on rails - implmenting custom authentication with devise, 'mapping' member -

i'm trying write custom (remote) authentication devise. api doc i've found this example , i'm proceding trials , errors. i'm particulary interested in understanding 'mapping.to.new' line do. it seems crucial since if returns nil, authentication process fail. but "mappings", defined? furthermore, call mapping.to.new has strange, seems object instantiation... isn't it? i've found different implementation, looks like: resource = mapping.to.where(["username = ?", auth_params[:username]]).first where seems mapping.to returns relation object, again, expected define mappings are? class remoteauthenticatable < authenticatable def authenticate! auth_params = authentication_hash auth_params[:password] = password resource = mapping.to.new return fail! unless resource if validate(resource){ resource.remote_authentication(auth_params) } success!(resource) end en

Easy way to fix global variables in PHP 5.4? -

Image
i have project lots global variables. examples used in functions function changepassform( $vars ) { global $tpl, $ibtns, $db; ... $db->query("...."); } i can pretty easy guess question is: "why not working"? answer php.net : anyway voted close question. @piotr please refine question or closed.

expression - python re.search error TypeError: expected string or buffer -

why re.search("\.docx", os.listdir(os.getcwd())) yield following error? typeerror: expected string or buffer because os.listdir returns list re.search wants string. the easiest way doing is: [f f in os.listdir(os.getcwd()) if f.endswith('.docx')] or even: import glob glob.glob('*.docx')

How to decleare and initialise a BigDecimal in C++ -

i trying call java method c++ code , using jni, able call java method during call want use bigdecimal inside c++ , can please me use bigdecimal( how declared , initialize) in c++ code. a bigdecimal java object native part. first need create it. therefore need class , method id. jclass cls = (*env)->findclass(env, "java/math/bigdecimal"); jmethodid = mid = (*env)->getmethodid(env, cls, "<init>", "(d)v"); this construtor of bigdecimal taking double. after can create 2 objects. jobject bd1 = (*env)->newobject(env,cls, mid, 1.222); jobject bd2 = (*env)->newobject(env,cls, mid, 0.0500); now have 2 bigdecimal , can add 1 other. first need add methodid again. jmethodid mid2 = (*env)->getmethodid(env, cls, "add", "(ljava/math/bigdecimal;)ljava/math/bigdecimal;"); then can call it. jobject sum = (*env)->callobjectmethod(env,bd1,mid2,bd2); now have sum of first 2 bigdecimal . print out u

html - remove pixels between DIVs without deleting whitespace -

.littlebox { margin:2px; padding:5px; width:100px; height:100px; border:1px solid #ccc; display:inline-block; } .divrow { width:100%; height:120px; } <div class="divrow"> <div class="littlebox">first</div> <div class="littlebox">second</div> <div class="littlebox">third</div> </div> <div class="divrow"> <div class="littlebox">first</div><div class="littlebox">second</div><div class="littlebox">third</div> </div> these 2 render differently, in first row there small space between each div, , in second there none. setting margin 0px still make space visible. http://jsfiddle.net/f3f3c/ i know float:left instead of display:inline-block solve problem, wonder if there way without using float. without altering html have 2 options: set parent's font-size 0 , reset font-siz

c# - update cell in datagrid wpf -

i have invoice program keeps track of items selected customer may want buy. every time "add item" button pushed, qty cell increments. problem im running in value getting upgraded in background, not being changed in cell itself. if click on cell however, value update. want update click "add item" button. can update cell information click button? code have works button push public partial class mainwindow : window } private void btnadditem_click(object sender, routedeventargs e) { adddatagridrow(invoiceitemid, cbxitems.selecteditem.tostring(), convert.todouble(txtprice.text)); } private void adddatagridrow(int id, string itemname, double itemprice) { //lstdataitem.add(new dataitem { sqty = count.tostring(), sname = itemname, sprice = itemprice, sremove = "delete item" }); // rows = new observablecollection<dataitem> { new dataitem () }; (int = 0; < rows.count; i++) { if (rows

ios - Fonts not fitting properly in UILabel - Ascender or Descender cropped -

Image
i've done extensive searching/reading/testing , cannot find solution problem. i've tried since ios 4.3 , it's still not resolved in ios7. the problem this: fonts @ large sizes can have ascenders or descenders cropped in uilabel. here's screenshot directly xcode 5.1 ui (no code @ all!) showing problem - font size 300 points: as can see, simple font helvetica neue (bold or not) has it's descender cropped. (you're seeing uiviewcontroller > uiview > uilabel) if try , change point size you'll see font scale down, , descender not cropped. here again @ 160 points: notice fonts not cropped , others - try noteworthy, or papyrus, or savoye let - of standard ios & fonts.... i'm talking height here - know can use adjustsfontsizetofitwidth=yes see entire length, , know can use sizetofit, neither guarantees no cropping of ascender/descender. notice calculating height using ascender/descender values not main issue font not centered vert

c# - sort nested Dictionary -

i sort dictionary value in nested dictionary. dictionary<int, dictionary<string, string>> data = new dictionary<int, dictionary<string, string>>(); dictionary<string, string> onerow = new dictionary<string,string>(); onerow.add("id", "1"); onerow.add("name", "john"); onerow.add("surname", "petrucci"); onerow.add("data", "2014-01-01"); onerow.add("active", "1"); this.data[1] = onerow; onerow = new dictionary<string, string>(); onerow.add("id", "2"); onerow.add("name", "joe"); onerow.add("surname", "satriani"); onerow.add("data", "2014-02-02"); onerow.add("active", "1"); this.data[2] = onerow; onerow = new dictionary<string, string>(); onerow.add("id", "3"); onerow.add("name", "steve"); onerow.ad

shell - read lines from a txt file in bash -

how read lines format inta intb intc intd charp "chara" optional? there possibility of comment marked # text i tried this file = 'test.txt' while ifs=' ' read -r numa numb numc numd charp #do done < file but don't know whether i'm on right path , charp sample: # comment 12345678 24 15 3 p 87654321 11 4 8 43218765 27 10 2 p you're on right track, there problems code: remove spaces around = in file = line - script break otherwise. your while statement missing do line (or ; do appended while line directly). instead of referring variable $file in done line, passing string literal file instead - use "$file" (the quotes there ensure works filenames have embedded spaces , other chars. interpreted shell). as ignoring optional character on end of line: adding variable, code ( charp ), sufficient - assigned remainder of line, , can ignore it. if put together, adding code ignoring comment lines,

c# - How to change the MenuItem Header according to the value selected in its submenu? -

<window x:class="menukinect.mainwindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" title="mainwindow" height="350" width="525"> <window.resources> <style targettype="{x:type menuitem}"> <setter property="foreground" value="white" /> <setter property="fontsize" value="12" /> <setter property="template"> <setter.value> <controltemplate targettype="{x:type menuitem}"> <border x:name="border" background="{templatebinding background}" borderbrush="{templatebinding borderbrush}" borderthickness="{templatebinding borderthickness}">

Error while implementing Fragments in Android -

i working on android app. want playstore ui, put horizontal drawer , made of activities fragments. when open activity, crashes, means "unfortunately app stopped". message in log: 04-06 17:24:07.616: e/androidruntime(1059): fatal exception: main 04-06 17:24:07.616: e/androidruntime(1059): java.lang.runtimeexception: unable start activity componentinfo{com.bingo.main/com.bingo.main.start}: java.lang.nullpointerexception 04-06 17:24:07.616: e/androidruntime(1059): @ android.app.activitythread.performlaunchactivity(activitythread.java:2180) 04-06 17:24:07.616: e/androidruntime(1059): @ android.app.activitythread.handlelaunchactivity(activitythread.java:2230) 04-06 17:24:07.616: e/androidruntime(1059): @ android.app.activitythread.access$600(activitythread.java:141) 04-06 17:24:07.616: e/androidruntime(1059): @ android.app.activitythread$h.handlemessage(activitythread.java:1234) 04-06 17:24:07.616: e/androidruntime(1059): @ android.os.handler.dispatchme

jquery - Multiple image animation in javascript -

i learning , tackling hardest piece of javascript have tried date. want create multiple animated sliding images, 1 sliding left right , straight after sliding right left. i have achieved 1 sliding image left right can not add image sliding right left. <canvas id="canvas" width="1600" height="300"></canvas> <script> window.requestanimframe = (function(){ return window.requestanimationframe || window.webkitrequestanimationframe || window.mozrequestanimationframe || window.orequestanimationframe || window.msrequestanimationframe || function( callback ){ window.settimeout(callback, 1000 / 60); }; })(); var canvas = document.getelementbyid("canvas"), cx = canvas.getcontext("2d"); function card(x,y){ this.x = x || -300; this.y = y || -300; this.width = 500; this.height = 0; this.img=new image(); this.init=function(){ // makes mycard available in img.onload function // otherwise "this&q

c# - Update Listview with view model with button click -

i want able update listview when user clicks on listview item (row) , clicks button. here code: xaml <window x:class="cs3000config2.dialogs.clone" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="clr-namespace:cs3000config2" title="clone scanner configuration" height="768" width="1024" fontsize="16" windowstyle="toolwindow" windowstartuplocation="centerscreen" resizemode="noresize" loaded="window_loaded"> <window.resources> <local:scannerviewmodel x:key="viewmodel" /> </window.resources> <window.background> <lineargradientbrush endpoint=".5,1" startpoint=".5,0"> <gradientstop color="#b8e1fc" offset="0" /> <gradientstop color="#a9d2f3" offset="0.

html - Is there any possibility to style an [input] tag? -

is there possibility style <input> tag? wrote: <li><form> <input class="search" name="s" type="search" placeholder="search..."> <input type="submit" value="> </form></li> and styling: form{ height: 40px; } .search{ border: none; background-color: #7e7376; } input[type=search]{ font-family: 'overpass'; font-weight: bold; color: #2c2729; margin-top: 4px; padding: 10px 15px; height: 12px; } it looks different on various browsers. tried apply reset css didn't help. building menu bar , search box needs part of it. on this? the appearance property looking for. the appearance property used display element using platform-native styling based on users' operating system's theme. input { -webkit-appearance: none; -moz-appearance: none; appearance: no

php - CakePHP: Advantages of adding CSS to CSS block instead of using inline output when using HtmlHelper? -

i started learn cakephp few days ago, following blog tutorial. in process of writing small project myself familiar framework. having studied documentation, noticed there 2 ways include css files. 1 way echo link tag(s) using htmlhelper: echo $this->html->css(array('style', 'forms', 'modal')); . type of linking referred 'inline style' according options array. the other method add tags (i believe default?) css block , print block inside <head> : echo $this->html->css(array('style', 'forms', 'modal'), array('inline' => false)); echo $this->fetch('css'); what advantages of using 1 way on other? consider following layout file: ... <head> ... <?= $this->html->css('main.css'); ?> <?= $this->fetch('css'); ?> ... </head> ... the simplest way by default rendered view contain: ... <head> ... <link rel="styles

objective c - UIScrollView and UITableView do not work -

i have uitableview uiscrollview , need table not have scroll, because of view going scrolling, using method -reset_sizes this, not work, scroll content_view frame of table not change, trying change height of table not work. somebody knows can problem? -(void) reset_sizes { [_scroll_view layoutifneeded]; _table_view.frame = cgrectmake(_table_view.frame.origin.x, _table_view.frame.origin.y, _table_view.frame.size.width, [list_elements_to_table count]*44); nsinteger height = _table_view.frame.size.height +_content_summary.frame.size.height+_content_apis.frame.size.height+_content_tag.frame.size.height; _content_view.frame = cgrectmake(_content_view.frame.origin.x, _content_view.frame.origin.y, _content_view.frame.size.width, _content_view.frame.origin.y+height); _scroll_view.contentsize = _content_view.bounds.size; } you can disable scrolling on uitableview _table_view.scrollenabled = no far why code not changing height of

java - Custom "hash table" implementation: Why is it so slow? (bytecode generation) -

today, answered ordinary question of java beginner. little bit later thought fun take question , implemented wants. i created simple code runtime class generation. of code taken template, possible change declare fields. generated code written as: public class container implements storage { private int foo; // user defined (runtime generated) private object boo; // user defined (runtime generated) public container() { super(); } } the generated class file loaded jvm using custom classloader. then implemented "static hashtable". programmer enters possible keys , generates class (where each key field). in moment have instance of class, may save or read generated fields using reflection. here whole code: import java.io.bytearrayoutputstream; import java.io.ioexception; import java.util.arraylist; import java.util.hashtable; import java.util.random; class classgenerator extends classloader { private arraylist<fieldinfo> field

c++ - overloaded new operator returning NULL memory for new object everytime -

i trying return null overloaded new operator function every time. here program class xxx{ int n; public: void* operator new(size_t){ cout<<"in operator new"<<endl; throw std::bad_alloc(); //return (void *)null; //line commented } }; int main(int argc,char *argv[]) { xxx *x1=new xxx; if(x1) cout<<sizeof(x1); else cout<<"unable allocate memory"<<endl; return 0; } here if use line return (void *)null; pointer x1 gets created not intended program. and if use line throw std::bad_alloc(); , program gets terminated/crashed instantly. now want know if there way if can bypass "new operator" not allocate memory object. this code works fine (tested msvc vs2010) , returns nullptr x allocation, requested in question: #include <iostream> using namespace std; class x { public:

java - how can I find default attributes for JTextPane document? -

i'm working jtextpane. jtextpane pane = new jtextpane(); string content = "i'm line of text displayed in jtextpane"; styleddocument doc = pane.getstyleddocument(); simpleattributeset aset = new simpleattributeset(); if add aset textpane's document this: doc.setparagraphattributes(0, content.length(), aset, false); nothing visible happens. no big surprise since haven't set custom attributes aset . however, if allow aset replace current paragraphattributes of doc this: doc.setparagraphattributes(0, content.length(), aset, true); a lot of things happen. how can information on default values of jtextpane document? particularly problems when i'm defining custom font aset , set replace current attributes, font displayed if bold. styleconstants.setbold(aset, false); doesn't help. i have looked @ source code see data structures holding information want. modification of code prints attributes each paragraph. int offset, length;

Git server's architecture -

Image
we want have git architecture this. possible? how can configure communication between git servers? there tool available can automate pushing 1 server? yes, setup makes sense. you automate push adding post-receive hook central repository. be aware both server repositories have bare in order reliably push them. alternatively pull second server if needs date working tree.

jquery - Side by Side two navbar bootstrap -

Image
how possible put 2 navbars side-by-side using twitter's bootstrap. i want sorting navbar on right side of filtering navbar. you need declare width , give them value of float: left demo http://jsfiddle.net/ky2pr/27/ .navbar { width: 200px; float: left; } fluid width mobile friendly demo http://jsfiddle.net/ky2pr/28/ .navbar { width: 50%; float: left; }

c - Program crashes when using scanf into third Array declared -

for reason, able use scanf char array, , first numeric one, however, program crashes when input data next array, in case, withdrawal[wt]. please take @ code. taking intro class c, not expert user. #include <stdio.h> int main(void) { /* declare variables */ float withdrawal[50] = {0}, deposit[50] = {0}; char name[50]; int number_of_deposits, number_of_withdrawals, x = 1, y = 1, d, wt; float balance; /* welcome message */ printf ("thank using matrix banking system. take red pill.\n\n"); /* prompt name */ printf ("please enter name: "); gets (name); printf ("\nhello %s.\n\n", name); /* prompt account balance, makes sure ammount 0 or more */ { printf ("now enter current balance in dollars , cents: $"); scanf ("%f", &balance); fflush(stdin); if ( balance < 0 ) printf ("error: beginning balance must @ least zero, pl