Posts

html - Use text-overflow: ellipsis on an anchor tag -

how can make <a> tag use text-overflow: ellipsis property? have long link names truncate. here attempt using usual text-overflow approach. http://jsfiddle.net/2wg8n/ you'll need change display: block; or else inline-block , specify width, e.g: a { width: 50px; display: block; white-space: nowrap; text-overflow: ellipsis; overflow: hidden; }

jquery - Setting Value or Text to an Unknown Element -

i'm trying set value of element, if value can't set (because it's not input element such input, select or textarea) must element can populated text() var someval = "my value"; //try , set value $("#some_el").val(someval); // if couldn't set $("#some_el").text(someval); something that. there method allow me in jquery? thanks you can chain methods, jquery checks internally, 1 of methods work: $("#some_el").val(someval).text(someval); http://jsfiddle.net/3btty/ another option checking whether selected dom element has specific property value or textcontent or not, allows use text or val method getter: var $elem = $('#some_el'), method = 'value' in $elem[0] ? 'val' : 'text'; var value = $elem[method](); note method works 1 selected element, more 1 selected element can use .each() method. http://jsfiddle.net/htuns/

requirejs - proper way of using require.js -

//some.html <script data-main="./scripts/main.js" src="./scripts/lib/require.js" ></script> <script src="./scripts/multiply.js"> //multiply.js define('main'.['jquery'], function($){ $(document).ready(, function(){ var sum = 1*1; $('#some').val(sum); }) } did use require.js correctly? adding each new external script(example multiply.js), declare new location in some.html, or defeat purpose of require.js? guideline great you not need add script tag each file load. job of requirejs. proper way: //some.html <script data-main="./scripts/main.js" src="./scripts/lib/require.js" ></script> // main js should load multiply you: define(['./multiply'], function(multiply){ } //multiply.js define(['jquery'], function($){ $(document).ready( function(){ var sum = 1*1; $('#some').val(sum); }) }

sorting - C# List<string> sort issue -

i have list looks like: list<string> newlist = new list<string>() { "10s", "xs", "80", "5s", "160", "40s", "80s", "std", "40", "xxs" }; and want sort { "40", "80", "160", "5s", "10s", "40s", "80s", "std", "xs", "xxs" }; how should it? hope can me on issue, lot! list<string> list = new list<string>() { "10s", "xs", "80", "5s", "160", "40s", "80s", "std", "40", "xxs" }; // filter out numbers: int temp; var newlist = (from item in list int.tryparse(item, out temp) select item).tolist(); // sort number , string: newlist = newlist.select(x => int.parse(x)).orderby(x => x).select(x => x.tostring()).tolist(); // sort rest string: var second...

c# - Check connection time out, preferable check using long elapsedTicks or DateTime elapsedTime? -

tcp server send data buffer , mainform receive data buffer , processing i have parameter check time on lastdatareceive (from tcp) on buffer. i have paramter check time on datareceivenow (from buffer) on mainform. now, want calculate elasped time, if lastdatareceive (from tcp) - datareceivenow (from buffer) > 60 seconds, prompt messagebox.show(" connection time out "); i have 2 method on doing it, don't know 1 gives best result or both same? 1st method: elasped time using datetime format , check condition of 1 second private void checkconnectiontimeout() { if (datetime.now.subtract(receiver.lastdatareceivedtime).totalseconds > 60) { messagebox.show("connection out"); } else { // ever } } 2nd method: elasped time calculating elapsedticks private void checkconnectiontimeout() { long datatimeout = (long)timespan.fromticks(receiver.lastdatatick - datareceiveticknow).totalseconds; datetime dt...

checkbox handling in yii framework -

i try make checkboxes in yii framework foreach , code write <?php foreach ($similaredu $value) { $checkboxname = $value['checkboxname']; $checkboxid = $value['checkboxid']; ?> <?php echo $form->labelex($model,$checkboxname); ?> <?php echo $form->checkbox($model,'check[]', array('value'=>$checkboxid)); ?> <?php echo $form->error($model,'check'); ?> <?php } ?> for particular case checked checkboxes , try value of them , getting : array ( [similarform] => array ( [check] => array ( [0] => 0 [1] => 20800 [2] => 0 [3] => 20801 [4] => 0 [5] => 20803 [6] => 0 [7] => 20804 [8] => 0 [9] =...

pthreads - Calling MPI functions from multiple threads -

i want implement following thing using mpi , pthreads facing error: each processor have 2 threads. each processor's 1 thread sending data other processors , other thread receiving data other processors. when implementing it, giving segmentation fault error messages "current bytes -40, total bytes 0, remote id 5". just testing purpose, when using 1 thread per processor , either sending or receiving data, errors not occur. i found info "in general, there may problems if multiple threads make mpi calls. program may fail or behave unexpectedly. if mpi calls must made within thread, should made 1 thread." in following link: https://computing.llnl.gov/tutorials/pthreads/ i want use 2 threads per processor 1 thread use mpi_send function send data , other thread receive mpi_recv function receive data without using locking mechanism. has idea how implement or how use multiple threads call mpi functions without using mutex or locking mechanism? here code: ...