Posts

Showing posts from May, 2010

android - How to close the SlideMenu when onClick a button inside the 'menu' -

i'm quite newbie in android, manage create simple slidemenu referring https://www.youtube.com/watch?v=ot76zdiebe8 i've created few buttons in 'menu' used intent other pages. thing is, want when clicked onto button itself, menu automatically close , it'll show page intent to. there suggestions/codes can refer to? from docs: getslidingmenu().toggle();

ruby - How to display HTML in jQuery autocomplete results in Rails -

i populating set of results jquery ui autocomplete in rails: <%= text_field_tag('user', "", :placeholder => 'enter user...', class: "users", data: {autocomplete_source: user.order(:lastname, :firstname).map { |u| {:label => getlabel(u.firstname, u.lastname).html_safe, :id => u.id} }}) %> i trying display html in labels, instance bolding text, , display perhaps image in each row. def getlabel(firstname, lastname) "<b>" + firstname + " " + lastname + "</b>" end this renders plain text in results: <b>john smith</b> what best way labels rendered html? appreciated. edit: $('.users').autocomplete source: $('.users').data('autocomplete-source') select: (event, ui) -> $( ".users" ).val( ui.item.value ); $( "#user_id" ).val( ui.item.id ); $( "#select_user" ).sub

java - Is it possible to have a function call as the body of a thread? -

is possible have function executed in different thread calling function in body of thread have defined? thread background = new thread(new runnable() { public void run() { mcamera.addcallbackbuffer(data); } }); background.start(); can this? provided mcamera , data instance members, static members or final variables , non-null should work.

java - How to get a transparent Icon in GWT Maps -

looking way icon transparent can still see parts of map under when used marker. know function in either icon or marker can used accomplish this? or if it's css thing? use png/gif transparencies, trick, ensure container placing on has no background color. consider support images alpha transparency varies browser browser.

java - IllegalAnnotationExceptions There's no ObjectFactory with an @XmlElementDecl for the element -

i got following error while running project on command prompt java com.javavids.jaxb.sitemap.main.main i got following error exception in thread "main" com.sun.xml.internal.bind.v2.runtime.illegalannotationsexception: 1 counts of illegalannotationexceptions there's no objectfactory @xmlelementdecl element {unison}fromtime. problem related following location: @ protected java.util.list com.javavids.jaxb.sitemap.upm.test.dateorstartdateorenddate @ com.javavids.jaxb.sitemap.upm.test @ protected java.util.list com.javavids.jaxb.sitemap.upm.condition.content @ com.javavids.jaxb.sitemap.upm.condition @ protected com.javavids.jaxb.sitemap.upm.condition com.javavids.jaxb.sitemap.upm.rule.condition @ com.javavids.jaxb.sitemap.upm.rule @ protected java.util.list com.javavids.jaxb.sitemap.upm.policy.rule @ com.javavids.jaxb.sitemap.upm.policy @ protected java.

Ignore changes in specific files using git -

i novice in dealing git, have repository contains several files ending in .test want know how can check changes made repository (compared local repo) while disregarding changes made in these .test files. part of batch file. add .gitignore file root of project, , write inside: *.test if .gitignore file exists, append *.test in end. then add & commit .gitignore. further information: http://git-scm.com/book/en/git-basics-recording-changes-to-the-repository#ignoring-files

c# - Create a LinQ Expression with another Expression's Parameters -

vote question closed i have found similar question , useful answer using expressionvisitor class (link: how can convert lambda-expression between different (but compatible) models? ). thank all, i'm voting answer become closed duplicate, please consider voting too. code i'm developing repository code uses data transfer object, code below. public class usuariorepositorio : iusuariorepository { private readonly mongorepository<usuariodto> _repository; public usuariorepository(string connectionstring) { _repositorio = new mongorepository<usuariodto>(connectionstring, ""); } } public interface iusuariorepository { ienumerable<t> select(expression<func<usuario, bool>> predicate); } usuariodto data transfer object usuario class, both inheriting interface iusuario . the usuariorepository implements iusuariorepository interface, , has private member called _repository, belongs mon

c# - how redirect to a login page specified in a web.config file inside folder -

i use web.config file inside folder block users. want redirect page specified here: <?xml version="1.0"?> <configuration> <system.web> <authentication> <forms loginurl="~\paginas\login\loginvendedor2.aspx"/> </authentication> <authorization > <deny users="?"/> </authorization> </system.web> </configuration> but redirected page specified in web.config file in root of site web.config has feature called configuration inheritance. there excellent article here . you need edit web.config file in root directory , add attribute inheritinchildapplications="false" tags don't want web.config in sub-folder inherit. should work on forms tag. can't test right , may need block inheritance authenication tag instead.

webserver - Erlang/cowboy crash (socket reset) on ab testing -

trying out cowboy (erlang) http library, helloworld example: https://github.com/extend/cowboy/tree/master/examples/hello_world when using apache's "ab" testing tool in manner, "connection reset": d7 ~/cb/cowboy/examples/hello_world % !564 ab -n 30000 -c 5000 http://127.0.0.1:8080/ apachebench, version 2.3 <$revision: 655654 $> copyright 1996 adam twiss, zeus technology ltd, http://www.zeustech.net/ licensed apache software foundation, http://www.apache.org/ benchmarking 127.0.0.1 (be patient) completed 3000 requests completed 6000 requests completed 9000 requests completed 12000 requests completed 15000 requests completed 18000 requests completed 21000 requests completed 24000 requests completed 27000 requests apr_socket_recv: connection reset peer (104) testing smaller values -n 5000 -c 1000 works correctly. what may problem crashes or resets erl/cowboy process? have observed beam's memory usage under top , grows smth 120mb, nothing obsce

wordpress - Get customers name in Woocommerce -

i working woocommerce , make order confirmation email. it want mail say: "hi [customers name]" how woocommerce print customers name? thanks in advance! you need order object, depending on hook using should there. try this: add_action('woocommerce_order_status_completed','my_woo_email'); function my_woo_email($order_id){ $order = new wc_order( $order_id ); $to = $order->billing_email; $subject = 'this subject'; $message = 'hi '.$order->billing_first_name.' '.$order->billing_email;$order->billing_last_name.', order!'; woocommerce_mail( $to, $subject, $message, $headers = "content-type: text/htmlrn", $attachments = "" ) } this untested should started

ajax - javascript redirect & replace -

<script type = "text/javascript"> var r = window.location.href; if (r.match(/#|%23/)) { r = r.replace(/#|%23/gi, \"@num@\"); window.location.href = r; } </script> this script redirect page , replace # symbols @num@ in url (don't ask why)... i'm trying modify script doesn't replace "#" if @ end of url example: http://www.example.com/test.php?f=abc#def will become http://www.example.com/test.php?f=abc@num@def but link: http://www.example.com/test.php?f=abc#def# will become: http://www.example.com/test.php?f=abc@num@def# use positive lookahead guarantee there @ least 1 more character: /(#|%23)(?=.)/g

html - PHP Replace attribute single quotes with double quotes -

the geniuses @ hotmail decided mix single ' , double quotes " attributes in html emails lulz. unnecessarily over-complicates things i'm trying class , id body element in cases remove css selectors. doing basic string replacement not option here. i realized php's domdocument class automatically... libxml_use_internal_errors(true); //use prevent warning messages displaying because of bad html $html = new domdocument();//'1.0','utf-8' $html->xmlstandalone = false; $html->loadhtml($b); $b = $html->savexml();

python 3.x - datetime.today attributes error -

i'm trying use datetime.today code countdown seconds every time call attribute of time, interpreter denies attribute exists. example: x=datetime.today() x= x.hour print(x) will return: traceback (most recent call last): file "c:\users\manuel\downloads\graphics master v1.py", line 2, in <module> x=x.hour attributeerror: 'builtin_function_or_method' object has no attribute 'hour' in other programs have tested make sure correct attribute , syntax in master program keep getting error. datetime.today method not attribute. try datetime.today()

radio button - Ensure one of the RadioButton in a RadioGroup is selected in Android -

if have following radiogroup: <radiogroup android:id="@+id/rgtype" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="6" > <radiobutton android:id="@+id/rbbrides" android:layout_width="wrap_content" android:layout_height="wrap_content" android:checked="true" android:text="bridge" /> <radiobutton android:id="@+id/gbtunnel" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="tunnel" /> <radiobutton android:id="@+id/rbhighway" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="highway" /> </radiogroup> and want following check: if (rgty

php - Remove Database Duplicates with Similar Name -

i have table in database stores name of image files can retrieved on server. the table description follows: +------------+-----------------+------+-----+-------------------+-------+ | field | type | null | key | default | | +------------+-----------------+------+-----+-------------------+-------+ | id | varchar(50) | no | pri | null | | | userid | varchar(8) | no | | null | | | albumid | varchar(25) | no | | null | | | image_name | varchar(256) | no | | null | | | status | int(1) unsigned | no | | null | | | comments | varchar(4000) | yes | | null | | | mod_date | timestamp | no | | current_timestamp | | +------------+-----------------+------+-----+-------------------+-------+ i have separate php script scans image folders new files , adds them datab

mysql - Updating a double value, but not higher than x value? -

update base_resources set value = value + ? resource_id = ? , base_id = ? i have query. possible somehow add max value the value? i.e. new value of "value" cannot higher x, if is, set x. for example: if value entered (1500) , max value allowed (that conditional want add in query is) 1000, value 1000 instead. how can that? something this: update base_resources set value = least(value + ?, 1500) resource_id = ? , base_id = ?

html - How to define CSS font size within font tags? -

i have written html code using font tag. used size="2" , size="3" is possible define main css style in define sizes these fonts? <font size="2">hello 1</font> <font size="3">hello 2</font> thanks lot guys of course can. try adding css style included in page: font[size="2"] { font-size: 20px; } font[size="3"] { font-size: 30px; } naturally have choose size prefer. way, <font> tag obsolete, , should not use it. use <span> , assign class, instead. further reference: https://developer.mozilla.org/en-us/docs/web/html/element/font

regex - Php Preg Match, how can i do this -

<td class=bilgi_satir width="45%"><b>( place want fetch ) </b></td> ( other html tags ) <td class=bilgi_satir width="25%"><b>( place want fetch ) </b></td> ( other html tags ) <td class=bilgi_satir width="35%"><b>( place want fetch ) </b></td> ( other html tags ) how can fetch them array ? width variable changing ... try solve html problem regular expression, , have 2 problems. if want dirty regular expression, can done. shouldn't rely on it. simplest regex like: preg_match_all( "/<td class=bilgi_satir width=\"..%\"><b>(.*)<\/b>/i", $your_html_here, $m ); this returns want print_r( $m[1] ); (i added 1, 2, 3 tell 'em apart) array ( [0] => ( place want fetch 1 ) [1] => ( place want fetch 2 ) [2] => ( place want fetch 3 ) ) best way dom parsing. example: $doc = new domdocument

iphone - Applying a sort to NSArray of custom objects -

i have array of custom objects (really nsset stored in core data becomes nsarray allobjects) , each of these custom objects listitem . each listitem belongs list , has uniqueid. each listitem has different uniqueid uniqueid of list belongs + number. if id of list object @"foo", listitems each have property listitem1.id = @"foo0", listitem2.id = @"foo1", listitem3.id = "foo2" etc.. so, how can sort array of custom objects based on number appended uniqueid on each listitem? nsarray *sortedarray = [unsortedarray sortedarrayusingcomparator:^(listitem *obj1, listitem *obj2){ return [obj1.id compare:obj2.id]; }];

ios - Decrement GKScore value -

when try store score value less current value, doesn't stored. please? gkscore *scorereporter = [[gkscore alloc] initwithcategory:@"top_matcher"]; scorereporter.value = currentscore - 10; [scorereporter reportscorewithcompletionhandler:^(nserror *error) { nslog(@"error:%@ %lld %@", error, score, scorereporter); }]; you cannot decrement score (if leaderboard set highest first), once post it, there.

c# - Calculating heat map colours -

Image
i'm working on heat map made of html table. table contains n cells , has lowest value , highest value (highest higher lowest). each cell has cell value. these values ints. cells lowest value meant light blue, scaling across point cells highest value deep red. see gradient below ideal range: to calculate hex colour value of each individual cell, @ lowest , highest values table , cell's total value, passing them method returns rgb hex, ready used html's background-color style. here method far: public string converttotaltorgb(int low, int high, int cell) { int range = high - low; int main = 255 * cell/ range; string hexr = main.tostring("x2"); int flip = 255 * (1 - (cell/ range)); string hexb = flip.tostring("x2"); return hexr + "00" + hexb; } with lowest value of 0 , highest value of 235, method returns following table (cell values in cells). example case: if lowest 20, highest 400 , cell

html - navbar positioning bug in chrome -

Image
i having strange css positioning issue in chrome only. have menu <ul> navigation gets pushed down randomly. refreshing page fixes problem. strangely, if refresh page when being displayed correctly gets pushed down. this how supposed look, , half of time: and happens when gets pushed down reason. the site live, , can experience problem here . might take clicking around site <ul> drop. here html/php using: <div class="header"> <nav class="navbar"> <a href="<?php echo url("home") ?>" class="title"><?php echo strtoupper($site->title())?></a> <ul> <?php foreach($pages->visible() $p): ?> <li><a<?php echo ($p->isopen()) ? ' class="active"' : '' ?> href="<?php echo (strtolower(($p->title)) == "work") ? url("home") : $p->url(); ?>"><?php echo html($p->tit

html - Embedded if statement in a PHP generated table -

i have table built php. value in $row[6], $row[7], and/or $row[8] might "none" (not null). when happens, echo blank space. realize take if statement, can't figure out. appreciated! thanks. while($row = mysql_fetch_row($query)){ echo "<tr>"; echo "<td> {$row[1]} </td>"; echo "<td> {$row[2]} </td>"; echo "<td> {$row[3]} </td>"; echo "<td> {$row[4]} </td>"; echo "<td> {$row[5]} </td>"; echo "<td> {$row[6]} </td>"; echo "<td> <a href='{$row[7]}'>bluugnome</a> <a href='{$row[8]}'>canyoneeringusa</a> <a href='{$row[9]}'>climb ut</a> </td>"; read http://php.net/manual/de/control-structures.if.php if statement. can nest inside while block like while($row = mysql_fetch_row($query)){

playframework - Scala play http filters: how to find the request body -

i'm trying write filter similar simple 1 described in http://www.playframework.com/documentation/2.1.1/scalahttpfilters need access request body. documentation below states "when invoke next, iteratee. wrap in enumeratee transformations if wished." i'm trying figure out how wrap iteratee can request body string within filter can log well. i spent time on this. no means scala expert works pretty well! :) object accesslog extends essentialfilter { def apply(nextfilter: essentialaction) = new essentialaction { def apply(requestheader: requestheader) = { val starttime = system.currenttimemillis nextfilter(requestheader).map { result => val endtime = system.currenttimemillis val requesttime = endtime - starttime val bytestostring: enumeratee[ array[byte], string ] = enumeratee.map[array[byte]]{ bytes => new string(bytes) } val consume: iteratee[string,string] = iteratee.consume[string]()

C++ and Qt: Paint Program - Rendering Transparent Lines Without Alpha Joint Overlap -

Image
i have started create paint program interacts drawing tablets. depending on pressure of pen on tablet change alpha value of line being drawn. mechanism works. thin lines decent , looks real sketch. since drawing lines between 2 points (like in qt scribble tutorial) paint there alpha overlap between line joints , noticeable thick strokes. this effect line line conjuction: as can see, there ugly alpha blend between line segments. in order solve decided use qpainterpath render lines. 2 problems this: a long, continuous, thick path lags program. since path connected acts one, change alpha value affects the entire path(which don't want since want preserve blending effect). the following images use qpainterpath . the blend effect want keep. the following image shows 2nd problem changes alpha , thickness of entire path the red text should read: "if more pressure added without removing pen tablet surface line thickens" (and alpha becomes opaque) anoth

android - Theme.Sherlock.Light.DarkActionBar shows white actionbar -

i can't seem fix it. <application android:allowbackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/theme.sherlock.light.darkactionbar" > ... and have imported actionbarsherlock , implemented seemingly correct. theme.sherlock , theme.sherlock.light works perfectly. the problem actionbar.setbackgrounddrawable(null); which used in app remove blue divider. in design, removed whole background. now design works it's suppose to, i'm stuck sort of horizontal divider between actionbar , content.

c# - Is implicitly casting objects via function parameters expensive? -

is implicitly casting objects via function parameters expensive? for example class myclass : iclass and function takes iclass instead give myclass variable. myfunction(iclass myclass) {} myclass test = new myclass() myfunction(test); is performance hindering normal casting? edit: i edited case compile, sorry. how now?

image processing - ImageMagick convert from GRAY to TIFF using stdin -

i have file i'm saving in raw gray format, gets converted tiff. running command follows works: convert -size 1024x1024 -depth 16 -endian msb imgtemp.gray /tmp/bla.tiff but changing use stdin input doesn't: cat imgtemp.gray | convert -size 1024x1024 -depth 16 -endian msb -:gray /tmp/bla.tiff i following error: convert: no decode delegate image format gray' @ error/constitute.c/readimage/532. convert: missing image filename /tmp/bla.tiff' @ error/convert.c/convertimagecommand/3011. the question why? you have stdin , format flipped. " -:gray " should " gray:- " cat imagetemp.gray | convert -size 1024x1024 \ -depth 14 \ -endian msb gray:- /tmp/bla.tiff to answer why happening. can run previous command -verbose switch. cat imgtemp.gray | \ convert -verbose \ -size 1024x1024 \ -depth 16 \ -endian msb -:gray /tmp/bla.tiff this give use additional line of information explains imagemagick trying do

php - For loop to create extra columns -

this code displays basic tree structure bracket, trying complete following:- where shows: style="border-right:2px solid #000;" i trying use border every row, script not create rows in between teams/seeds define border, trying show border-right every row every team 1 team 2 etc , other rounds team 1 team 2 etc. php error reporting returning following line has undefined offset after } else { ? $line[$i] .= '<td align="center" style="border-right:2px solid #000;" colspan="2">vs</td>'; 3. $array = array('team 1', 'team 2', 'team 3', 'team 4', 'team 5', 'team 6', 'team 7', 'team 8'); $j = count($array); ($a=0; pow(2, $a) <= $j; $a++) //determine highest power of 2 go array count { $y[$a] = 1; $maxpower = $a; } ($i=1; $i < $j*2; $i++) { if($i % 2 != 0) //o

c# - column header text changes after change DataSource? -

when change datasource of datagridview datatable don't have rows, , after change datasource datatable contains rows, header text changes , properties width... try using bindingsource control between datagridview , datatable . bindingsource control has useful property called filter filter out unwanted rows without creating new datatable object or otherwise affecting structure of underlying datatable , datagridview's headers not affected. you can either manually through code or drop instance of bindingsource in designer. code this: bindingsource bs = new bindingsource(); bs.datasource = yourdatatable; yourgridview.datasource = bs; then can filter out results doing: bs.filter = "some_column = 'some_value'";

MySQL Foreign Constraint ON DELETE CASCADE -

i want know if implemented right or if other way around. so have 3 tables: tableparent , tablechild , anothertable tableparent has pk called id tablechild , anothertable has pk called id fk constraint tableparent.id , has on delete cascade i modeled thinking if delete row in tableparent , every row in tablechild , anothertable auto deleted. does works way? (using mysql, engine innodb) was going post in comment, comment button not showing up. check out quesion/answer. think has need , more on issue. mysql foreign key constraints, cascade delete i retype all, seems redundent.

r - My probability plot and log scales do not line up with my gridlines (using ggplot) -

Image
i'm trying create plot in x-axis has probability scale , y-axis log-10-scaled. i'll start data, can found text file here: http://m.uploadedit.com/b018/1374626091664.txt i want plot 2 data series based on factor "site", can see data. well, when go plot data, naturally use scale_x_continuous trans='probit' option generate probability plot scale. generated vector of breaks use probability axis, named ybreaks : ybreaks <- c(1,2,5,10,20,30,40,50,60,70,80,90,95,98,99,99.5,99.9)/100 ggplot(site1a, aes(x=prob, y=volume))+ geom_point(aes(colour=factor(site)))+ geom_line(aes(colour=factor(site)))+ scale_x_continuous(trans='probit', minor_breaks=ybreaks)+ scale_y_log10(labels = comma, breaks=c(.001,.01,.1,1,10,100))+ labs(x="exceedance probability", y="volume (cubic feet)")+ scale_colour_discrete(name="location", breaks=c("x1ain","x1aout"), labels=c("in","out"))+ th

java - Conflicting Jar Methods -

i have been trying make first gui music player in java. far have been able play mp3 javasound , mp3spi. now, want support .m4a songs , have researched best library jaad. downloaded it, added project , worked when tried play .m4a song. problem happens when try play .mp3 after adding jaad library. code playing songs is: file file = new file(pathtosong); audioinputstream audiostream= audiosystem.getaudioinputstream(file); // obtains audio input stream of song audioformat baseformat = audiostream.getformat(); //obtains audio format of song in audio input stream. decodedformat = new audioformat(audioformat.encoding.pcm_signed, //the type of encoding audio stream baseformat.getsamplerate(), //sample rate of audio stream 16, //number of bits in each sample of sound has format. baseformat.getchannels(), //number of audio channels in audio stream baseformat.getchannels() * 2, //number of bytes i

nlp - Standalone and open source library in java that allows document clustering similar to carrot2 -

i looking cluster short text documents, each few hundred character long. i have been using carrot2 workbench , capabilities api archaic , difficult understand / use. i looking replacement has similar capabilities (clustering algorithms) better api. i'm looking in java or python , has open source , free in beer so lingpipe ( http://alias-i.com/lingpipe/ ) not qualify. thanks. scikit-learn in python, supports wide range of machine learning algorithms (including clustering) , documented.

maven - Arquillian no HTTPContext found when launching in embedded Weld EE container -

i'm using maven , eclipse launch container tests. maven config setup using archetype: jboss-javaee6-webapp-ear-blank-archetype i can launch arquillian tests no problem in jboss as7. but when try launch using embedded weld ee container following exception: java.lang.illegalargumentexception: no org.jboss.arquillian.container.spi.client.protocol.metadata.httpcontext found in org.jboss.arquillian.container.spi.client.protocol.metadata.protocolmetadata. servlet protocol can not used what causing org.jboss.arquillian.container.spi.client.protocol.metadata.httpcontext found error , how can fix it? i setup 2 different profiles in pom, 1 jboss as7 (works) , 1 embedded weld ee (not working): <profile> <id>arq-weld-ee-embedded</id> <activation> <activebydefault>true</activebydefault> </activation> <dependencies> <dependency> <groupid>org.jboss.spec</g

php - Yii Bootster - TbTabs Change Tab Event -

how can control change of tab event when using tbtabs in yii bootter? here code (but didn't alert when have changed tab): $this->widget('bootstrap.widgets.tbtabs', array( 'type' => 'tabs', 'tabs' => array( array('label' => 'trainer modules', 'content' => 'content tab 1', array('label' => 'default modules', 'content' => 'content tab 2', ), 'events' => array( 'change' => "js:function(){alert('123');}" ) )); just future reference, 1 solution control tab clicks on tbtabs assign id each tab , handle event using clientscript, here how works: assign id each link this: $this->widget('bootstrap.widgets.tbtabs', array( 'type'=>'tabs', 'placement'=>'above', // 'above', 'r

mysql - Multiple keywords in SELECT LIKE -

i have search function on site uses get. have been trying code take words out of post , search in using sql. been able do: $id = $_get["search"]; $searchterms = explode(' ', $id); $searchtermbits = array(); foreach ($searchterms $term) { $term = trim($term); if (!empty($term)) { $searchtermbits[] = "name '%$term%'" } } $lol = mysql_query("select * database .implode(' , ', $searchtermbits).") i don't know i'm doing wrong. following error: have error in sql syntax; check manual corresponds mysql server version right syntax use near '(' , ', array).' @ line 1 $lol = mysql_query("select * database .implode(' , ', $searchtermbits).") should be $lol = mysql_query("select * database ". implode(' , ', $searchtermbits). "")

css - CSS3 ch unit inconsistent between IE9+ and other browsers -

ie9+ claims support ch css unit . definition, unit 'equal advance measure of "0" (zero, u+0030) glyph' of current font, or, in simpler words, the width of character box glyph “0” . interpretation seems right firefox 10+ , chrome 27+: <div style="width: 10ch;"></div> , <div>0000000000</div> have same width given have same font of same size. in ie9+ ch unit seems mean different. here fiddle demonstrating issue: http://jsfiddle.net/cnspg/6/ what logic of behavior of ie unit? or bug? possible make ie treat ch unit other browsers (probably ie-specific text rendering "magic")? according caniuse.com , ie interprets 1ch width of 0 glyph, without surrounding space. makes 1ch shorter in ie compared other browser.

rendering - Adjacent svg:polygon edges do not meet -

Image
i drawing bar chart using polygons next each other this: if closely, there white spaces between each polygon (zoomed): i trying prevent happening. found out svg shape-rendering attribute , set geometricprecision . solved problem gave me crisp edges: i not want either. tried other possible values shape-rendering none worked well. (i tried these on webkit.) looking solution. for interested, jsfiddle of chart here . really problem should rendering graph single polygon rather 1 polygon each bar, i'm assuming there reason doing way. one possible solution set stroke properties, outline of polygons drawn, causing them overlap. can set properties on group element apply them enclosed polygons. <g stroke-width="0.5" stroke="black" stroke-linejoin="round"> updated jsfiddle link note makes graph biggger should be, don't think that's significant problem. as reason why happening, because offsets of polygons aren&#

graphics - Adding space between cells in Matlab imagesc output -

Image
i creating 2d plot in matlab calling command: imagesc(vector1, vector2, mat_weights) . then, run colorbar command. i have smooth 2d plot, want add space between cells . here's how want look: how add such spacing between cells/boxes? you can add spaces between patches of color using function imagesc . here, scatter provides straightforward solution when used option 'filled' , marker 'square'. note need transform 2-d matrix vector, don't have scale data: scatter takes min , max values data , assign them min , max colors of colormap. the code % 2-d in 1-d: z = diag(1:10); %example of 2-d matrix plotted c = reshape(z,1,[]); %1-d transform vector color % input definition sz_matrix = 10; x = repmat( (1:sz_matrix), 1, sz_matrix); y = kron(1:sz_matrix,ones(1,sz_matrix)); s = 1000; % size of marker (handle spaces between patches) %c = (x.^2 + y.^2); % second color scheme %plot figure('color', 'w',

php - jquery validaton near the label itself -

js code: <script type="text/javascript"> function validate() { if($('#usr_name').val()==''){ alert('enter name!!!'); $('#usr_name').focus(); return false; } </script> html code: <div class="label_left"><label>name :</label></div> <div class="text_right"> <input type="text" name="usr_name" id="usr_name" value="" size="30" /><br /><br /> </div> am using format validation in jquery. showing alert message. require has place enter name beside label when not filled possible. if how this. me thanks. search jquery validation plugins, lot of them available in net ref: http://jqueryvalidation.org/documentation/ demo : http://jquery.bassistance.de/validate/demo/

asp.net - Telerik RadDatePicker not picking up dates post year 2030 -

i using raddatepicker control start , end date input controls on form. taking "01/01/1980" min date , "12/31/2049" max date. facing problem when enter date manually in date text box. scenario 1: enter date 123129. radpicker correctly picks 12/31/2029 , displays formatted date value. scenario 2: enter date 123130. client side validation warning. no matter day , month enter, freezes every time on year greater xx/xx/29 (2029). scenario 3: enter date 12312030 - complete year instead of last 2 digits. radpicker correctly picks 12/31/2030 , displays formatted date value. i tested 3 scenarios on asp.net calendar demo - datepicker - first well. i not sure why validation kicks in when max date set 12/31/2049. please assist me in resolving issue. thanks, vaibhav "the years starting 30 , greater parsed 19.. if u 30th(year) 1930, 123130 parsed 12/31/1930. invalid because default value of mindate i.e. 1/1/1980. in order solve set shortyearcentu

linux - Programming a kernel module, so that I can serve? -

i wish tell me advantage of creating module kernel because can not see difference normal executable. know depends on task @ hand give example? how building kernel modules depends on needs. for further instruction please read http://www.tldp.org/ldp/lkmpg/2.6/html/lkmpg.html after if have more detailed question regarding on how create kernel modules feel free come ;)

Get User details from Session in Spring Security -

i new spring mvc , spring security. have performed log-in , registration functionality using spring security , mvc. not able find way session management . i want access user details on pages (email, name,id,role etc). want save these session object can these on of page. i following way session in spring authentication auth = securitycontextholder.getcontext().getauthentication(); auth.getprincipal(); but object returned can username , password details. but need access more details of user. is there way saving session , on jsp page? or there ootb way in spring done? please me solution this. in advance. i want model class object returned securitycontextholder.getcontext().getauthentication().getdetails(); need configure. regards, pranav you need make model class implement userdetails interface class myusermodel implements userdetails { //all fields , setter/getters //all interface methods implementation } then in spring controller can this

ruby - Comparing values in two hashes -

i having trouble in comparing values in 2 hashes, getting error "can't convert string integer". first hash has values captured web page using method "capture_page_data(browser)" , second hash has data parsed report. code looks below: # open web application # navigate specific page , capture page data loan_data = hash.new loan_data = capture_page_data(browser) second hash has values captured report generated web application. code looks below: @report_data[page] = hash.new # have written logic parse data report hash variable now trying compare values in theses 2 hashes ensure data in report matching data in application using below code giving me error "can't convert string integer". loan_data.map{|ld| ld['maincontent_cphcontent_loanoverviewgeneralinfoctrl_lblrelname']} & @report_data.map{|rd| rd['relationship']} please me out in resolving issue. regards, veera. if inspect ld variable insid

javascript - How to send 'custom variables' parameters in Measurement Protocol(GA)? -

i'm develop on html5 project. project news reading html5 site. has offline reading feature, need integration google analzyer user access report. but found ga js sdk not support offline function. then try more information on ga site. found measurement protocol can this. it's said can send ga request through api. stop again on develop process, because need send custom variables js sdk: _gaq.push(['_setcustomvar', 1, 'user-online', 1, 1]); i've checked on ga site not informations "custom variables". i think this article should of there no more detail sample code explain parameters. universal analytics (ua) measurement protocol drives. they've changed quite few things. not sure accuracy of other elements of article, correct fact custom dimensions have replaced custom variables in ua https://www.optimizesmart.com/beginners-guide-to-universal-analytics-creating-custom-dimensions-metrics/ head here read custom dimensions

iphone - Tap Gesture on part of UILabel -

i add tap gestures part of uitextview following code: uitextposition *pos = textview.endofdocument;// textview ~ uitextview (int i=0;i<words*2-1;i++){// *2 since uitextgranularityword considers whitespace word uitextposition *pos2 = [textview.tokenizer positionfromposition:pos toboundary:uitextgranularityword indirection:uitextlayoutdirectionleft]; uitextrange *range = [textview textrangefromposition:pos toposition:pos2]; cgrect resultframe = [textview firstrectforrange:(uitextrange *)range ]; uiview* tapviewontext = [[uiview alloc] initwithframe:resultframe]; [tapviewontext addgesturerecognizer:[[uitapgesturerecognizer alloc] initwithtarget:self action:@selector(targetroutine)]]; tapviewontext.tag = 125; [textview addsubview:tapviewontext]; pos=pos2; } i wish imitate same behaviour in uilabel . issue is, uitextinputtokenizer (used tokenize individual words) declared in uitextinput.h , , uitextview & uitextfield conform uitextinput.h

sql server - How to design a database in the way that each class has one teacher and one TAs? -

i have 2 tables: user(loginid,password,email,usertype) -- primary key(loginid) class(coursecode, semester,year,classtime,proid) -- primary key(coursecode, semester,year) -- foreign key(proid) usertype can teacher, teaching assistant(ta) or student. dont know can add ta attribute 1 class has 1 ta , 1 teacher. thinking putting taid user table foreign key, be: class(coursecode, semester,year,classtime,proid,taid) but i'm not sure right or not. because when want teacher , ta's name teach specific course, not work. i've tried query below: select dbo.[user].name dbo.class inner join dbo.[user] on dbo.class.proid = dbo.[user].loginid , dbo.class.taid = dbo.[user].loginid crscode=@crscode , semester=@semester , year=@year question: have idea problem? in advance. edit: wrote: alter proc selectfacultynamebyid @crscode nvarchar(5), @semester nvarchar(20), @year int select u1.name teacher, u2.name assistant dbo.class c join [user] u1 on c.proid = u

spreadsheet - How to find a term in google docs -

Image
i have spreadsheet. generate formula, shown, search term in column d. =if(sum(isnumber(search("blue",d1:d))*1),"1","0") but error #value! . have idea, did wrong? your error might because trying sum strings. try: =arrayformula(sum(isnumber(search("blue",d1:d))*1))

java - Read data from table where primary key is composite using hibernate -

i have these pojo classes in project. public class merchantchainuser extends com.avanza.ni.common.dto.abstractdto implements java.io.serializable { private long chainid; private compositepk compositepk; public merchantchainuser() { } public void setchainid(long chainid) { this.chainid = chainid; } public long getchainid() { return chainid; } public void setcompositepk(compositepk compositepk) { this.compositepk = compositepk; } public compositepk getcompositepk() { return compositepk; } } , public class compositepk implements serializable { private long merchantid; private long userid; public void setmerchantid(long merchantid) { this.merchantid = merchantid; } public long getmerchantid() { return merchantid; } public void setuserid(long userid) { this.userid = userid; } public long getuserid() { return userid; } } hbm.xml file merchantuserchain is <hibernate-mapping> <class name="com.avanza.ni.portal.dto

uiimagepickercontroller - how to create a camera overlay view that recognized swipe gestures? -

i trying create camera overlay can recognize swipe gestures push other views. i wondering if can still use uiimagepicker or if have use avcapturesessionmanager. also prefer create overlay view in story board there way that? can select view inside storyboard controller camera overlay , present uiimagepicker on view did load? i've never used storyboard create camera overlay, have created xib works fine. can create overlay viewcontroller in normal (xib) way, complete gesture recognizers, can handle them directly in vc or use delegate (most vc presented camera). some code - -(void)setupcamera { self.picker = [[uiimagepickercontroller alloc] init]; _picker.sourcetype = uiimagepickercontrollersourcetypecamera; _picker.cameracapturemode = uiimagepickercontrollercameracapturemodephoto; self.overlay = [[overlayviewcontroller alloc] init]; _overlay.delegate = self; _picker.cameraoverlayview = _overlay.view; _picker.delegate = self; [s

java - Why does this method print 4? -

i wondering happens when try catch stackoverflowerror , came following method: class randomnumbergenerator { static int cnt = 0; public static void main(string[] args) { try { main(args); } catch (stackoverflowerror ignore) { system.out.println(cnt++); } } } now question: why method print '4'? i thought maybe because system.out.println() needs 3 segments on call stack, don't know number 3 comes from. when @ source code (and bytecode) of system.out.println() , lead far more method invocations 3 (so 3 segments on call stack not sufficient). if it's because of optimizations hotspot vm applies (method inlining), wonder if result different on vm. edit : as output seems highly jvm specific, result 4 using java(tm) se runtime environment (build 1.6.0_41-b02) java hotspot(tm) 64-bit server vm (build 20.14-b01, mixed mode) explanation why think question different understanding java stack : my

php - how to display particular array combination? -

i want display following array in output 246,357 donot process first subarray , remaining subarray combination should $array[1][0].$array[2][0].$array[3][0] ,similarly combination should $array[1][1].$array[2][1].$array[3][1] $array=[ [0,1], [2,3], [4,5], [6,7] ]; i have written follwing code not bypass first subarray output 0246,1357 .plz help. foreach($array $n) { $a.=$n[0]; $b.=$n[1]; } echo "$a".","."$b"; one way skip first element use flag variable $first : $first = true; foreach ($array $n) { if ($first) { $first = false; } else { $a .= $n[0]; $b .= $n[1]; } } another way remove first element array, skipped over: unset($array[0]); or check key within foreach loop: foreach ($array $k => $n) { if ($k > 0) { $a .= $n[0]; $b .= $n[1]; } } yet way use array_shift() , changes numeric keys in addition remov

When I initialize an array with an object in JavaScript, does the array contain a reference to the object or is it passed by value? -

i using javascript. have object. place object inside array initialize. work on array , value(s) inside it. i'm hoping know if, changing object in array, changing actual object itself? code below. function dostuff() { var node = getnode(); //getnode() returns node object var queue = [node]; //this line question while(queue.length > 0) { //add data queue[0]. add queue[0]'s children queue, remove queue[0] } return node; }; so, when while loop finishes, node pointing changed object, or hold copy of object before put queue? i appreciate help, many thanks! you check yourself: var obj = {a: 1, b: 1}; var arr = [obj]; arr[0].a = 0; alert(obj.a) // result: 0; http://jsfiddle.net/pnmxq/

loops - Javascript Control many types with "typeof" without "if" -

i wondering if there alternative classic. if (typeof firstpost === 'object' && typeof firstpost.active === 'boolean' && typeof firstpost.message === 'string' && typeof firstpost.maxheight) so avoid writing more code, maybe looping object. i use this: if user input var firstpost = { active : true, message : "hello", maxheight : 20 } then: var checks = { active : 'boolean', message : 'string', maxheight : 'number' } try { for(var key in checks) { if(typeof firstpost[key] != checks[key]) { throw new error(key + " not " + checks[key]); } } }catch(e) { alert(e.tostring()); } this not bytesless, it's more clean. (and checks if keys defined) edit: there no way more compact. can declare function in place , call it. function checkobject(obj,checks) { for(var key in checks) { if(typeo