Posts

Showing posts from May, 2010

Camel SQL component - simple select query result -

i'm working apache camel , i've been facing problem sql component. perform insert query simple select query wouldn't return anything. datasource configured , have no errors. read result of select query list> have blank results. here's camel route: from("direct:start") .to("sql:select * infos id=1 ?datasourceref=mydatasource") .beanref("mbean","monitor") .to("log:result"); and here method i'm trying use process result: public object monitor(exchange exchange){ list<map<string,object>> l= (list<map<string,object>>) exchange.getout().getbody(); map<string,object> map = l.get(0); object str = map.get("msg"); exchange.getin().setbody(str); return str; } i'm stuck .. try this. worked me. public void process(exchange exchange) throws exception { list<hashmap> out = (arraylist<hashmap>) exchange.g

Python - make string equal length -

i have rna sequence of varying length. max length of sequence 22. sequences shorter. if sequence shorter add "0" end of line till length becomes 22. how in python? input aagauguggaaaaauuggaauc cagugguuuuaugguag cucuagaggguuucug uucauucggc and expected ouput should example in last line not contain 22 characters need make 22 adding 0 uucauucggc000000000000 but per commands getting out put aagauguggaaaaauu 00000 addtional characters used justification came down , not in same line use str.ljust method: >>> s = 'foobar' >>> s.ljust(22, '0') 'foobar0000000000000000'

sip - Does Asterisk 1.8.* support the key exchange RSA and DSS protocols? -

based on other topics know asterisk 1.8.* supports md5 protocol authentication i want know if astrisk 1.8.* support key exchange rsa , dss protocols sip clients/servers? if mean referring sip challenge/response authentication method rsa , dhs (i'm guessing meant diffie-hellman dhs rather dss) aren't applicable since what's required cryptographic hashing algorithm such md5 or sha2 rather asymmetric encryption algorithm (such rsa) or key exchange sequence (such dhs). note sip supports md5 looks there new rfc move sha2. if looking confidential sip transmissions sip have support way of tls. sip rfc mandate support of secure transmission channel uses sips prefix sip addresses instead of standard sip , indicates sip messages should sent on tls channel. not while sip rfc mandates support tls channel in practise it's not supported amongst public sip services. asterisk support sip tls.

regex - regular expression in c is not working properly -

i want match " 16kqgn579677 pt " this attempt: ^([a-z0-9]{2}+)([a-z]{4}+)([0-9]{1,6}+)([ ]{0,5}+)([a-z]{1,4}+).*" and code: int main(int argc, char *argv[]){ regex_t str; int reti; char msgbuf[100]; /* need match circuit(16kqgn579677 pt) */ reti=regcomp(&str,"^([a-z0-9]{2}+)([a-z]{4}+)([0-9]{1,6}+)([ ]{0,5}+)([a-z]{1,4}+).*", 0); if( reti ) { fprintf(stderr, "could not compile regex\n"); exit(1); } /* need match circuit(16kqgn579677 pt) */ reti = regexec(&str, "16kqgn579677 pt", 0, null, 0); if( !reti ){ puts("match"); } else if( reti == reg_nomatch ){ puts("no match"); } else { regerror(reti, &str, msgbuf, sizeof(msgbuf)); fprintf(stderr, "regex match failed: %s\n", msgbuf); exit(1); } regfree(&regex); retur

oracle11g - JDBC and Oracle 11g connection reset on ubuntu -

i having strange issue connection jdbc oracle 11g. started happening monday without settings changes either me or team aware of. reading in stackoverflow , oracle forums (see links @ bottom) i've learned there has been issue generation of random bytes on linux 64bit machines. led try several things, unfortunately didn't work. here summary of information i'm aware of. the weird thing is can connect on terminal using sqlplus, not using jdbc. thank ideas or help, amit my setup: os: ubuntu 12.04 java: both 7 , 6_45 (issue same) jdbc: downloaded oracle official site (see further description down) connection behind cisco vpn jdbc-manifests: odbc7.jar: manifest-version: 1.0 ant-version: apache ant 1.7.1 created-by: 20.12-b01 (sun microsystems inc.) implementation-vendor: oracle corporation implementation-title: jdbc implementation-version: 12.1.0.1.0 repository-id: javavm_12.1.0.1.0_linux.x64_130403 specification-vendor: sun microsystems inc. specification

javascript - Remembering data loaded via ajax 'load more' when using the back button -

just looking @ creating feature remember data has been loaded via ajax load more button when user leaves page , returns via button. the way thinking is: when user loads more data, parameter added url e.g ?more=1 when page loaded, checks more parameter , runs query depending on that my query returns 16 new results, 'value of more x 16' , use last parameter in limit claus. this shouldn't affect new data being loaded specifiy url in ajax. is correct way around this? or simpler way? craig when page loaded, checks more parameter , runs query depending on if runs query depending on parameter aren't caching results. if want remember data speed page loading should, after query, calculate html corresponding additional data , save in file. then, if same parameter present in url (and if files exist), can include preformatted data cache files.

stdmap - C++ std::map std::bitset segfault -

i have code: static void xmlcall hackhandler(void *data, const xml_char *name, const xml_char **attr) { setpointers* sets = static_cast<setpointers*>(data); if (strcmp(name, "instruction") == 0 || strcmp(name, "load") == 0 || strcmp(name, "modify") == 0||strcmp(name, "store") == 0) { long address(0); long page(0); int offset(0); long size(0); int i(0); (i = 0; attr[i]; += 2) { if (strcmp(attr[i], "address") == 0) { address = strtol(attr[i+1], null, 16); page = address >> 12; offset = address & 0xfff; continue; } if (strcmp(attr[i], "size") == 0) { size = strtol(attr[i + 1], null, 16); } } map<long, bitset<4096> >::iterator itlocal; itlocal = sets->lcount->find(page); if (itlocal == sets->lcount->end()) { sets->lcount->insert(pair<

Writing AVERAGEIF Statement in Excel over different columns with different criteria -

i'm new excel if statements , having trouble believe called nested if function. i've looked @ other if questions on here , couldn't figure out. i have 2 columns have numbers in , rest text.i need create if statement tell me average based on different combinations of text , numbers. have thousands of rows filter through , don't want them manually if function exists automate in excel. b=iphone c=5s d=verizon e=64 f=normal h=380 i have written if statement finds me average of prices on iphones =averageif(b1:h3792,"=iphone",h1:h3792) i make statement allows me enter more 1 criteria. mean more have "iphone" criteria, have "5s", "verizon", "64" , "normal". 1) ranges b1:h3792 , h1:h3792 should have same dimmention. change b1:h3792 b1:b3792 2) more criterias can use averageifs : =averageifs(h1:h3792,b1:b3792,"iphone",c1:c3792,"5s",d1:d3792,"verizon&qu

java - HttpResponse can return list in android through RESTFUL web service? -

i new android.i using restful web services.i have 1 field category in mysql database.now need value database , put autocompletetextview.but can values database.and know how set value autocompletetextview.but don't know how can list httpresponse. httpresponse can return list? you shouldn't returning httpresponse rest service. return javax.ws.rs.core.response instead. can insert data entity response this: // method annotation here public response somegetmethod() { // build listfromdatabase here return response.ok(listfromdatabase).build(); }

c# - Object gets stuck when trying to bounce off screen edges, am I doing this wrong? -

public class asteroidmovement : monobehaviour { public vector2 speed; public vector2 direction; private vector2 movement; private vector3 topscreenbound; private vector3 bottomscreenbound; // use initialization void start() { topscreenbound = camera.main.viewporttoworldpoint(new vector3(0f, 1f, 0f)); bottomscreenbound = camera.main.viewporttoworldpoint(new vector3(0f, 0f, 0f)); } // update called once per frame void update() { if (gameobject.transform.position.y >= topscreenbound.y) { direction.y *= -1; } if (gameobject.transform.position.y <= bottomscreenbound.y) { direction.y *= -1; } movement = new vector2(speed.x * direction.x, speed.y * direction.y); } void fixedupdate() { rigidbody2d.velocity = movement; } } i trying have asteroids in game bounce off edge of screen , have got working decently, after few bounces, asteroid/object gets "stuck" in wall , glitches out playing area. am going wrong?

c# - Class defined Datatable, how to leave row [0] unchanged? -

i add rows table configs this, form want datarow row2 = dataaccess.instance.configs.newrow(); row2["nome"] = "abrirficheiro"; row2["valor"] = convert.tostring(variables.abrirficheiro); dataaccess.instance.configs.rows.add(row2); but wanna keep row @ index 0 (the first one) untouched, idea how it's done? edit: i've been working around past hour, still unsucessful the table class code this public sealed class dataaccess { static readonly dataaccess instance = new dataaccess(); //**adicionar tabelas aqui public datatable configs { get; private set; } // explicit static constructor tell c# compiler // not mark type beforefieldinit static dataaccess() { } dataaccess() { this.configs = new datatable("configs"); tabelasset.tables.add("configs"); configs.columns.add("nome"); configs.colum

IOS layout issue -

if i'm right, in ios, don't have layout in android. i'm new ios. suppose have 2 label, 1 on top of other. possible make label goes down. went through widgets in ios. i've not seen linear layout i suggest first go through getting started guide ios. in case need set size of uilabel dynamically can using below code: cgsize maximumlabelsize = cgsizemake(296,9999); cgsize expectedlabelsize = [yourstring sizewithfont:yourlabel.font constrainedtosize:maximumlabelsize linebreakmode:yourlabel.linebreakmode]; //adjust label the new height. cgrect newframe = yourlabel.frame; newframe.size.height = expectedlabelsize.height; yourlabel.frame = newframe;

Display Excel Spreadsheet in WinForms, C# -

i have been struggling last few hours trying excel spreadsheet/workbook displayed on windows form using visual studio 2012, c#. can retrieve data workbook , display on form, need functionality of excel in application, including stuff filtering , conditional formatting , formulas , etc. i have read quite lot, , understand it, there no controls in visual studio embed these (office) files due licencing, makes sense. have found solution though, display file in webcontrol (i sure able work this), when try load excel file in web control, prompts user either open or save file, , when 'open file' chosen, file opened using microsoft excel. as understand it, happens because contenttype (mime type, excel contenttype ) of file needs set in browser (i need more research on not yet familiar concept, ). the resources using: logic save contents excel file: epplus i working following project, among others: winforms excel example the latter want achieve, keeps on asking save or

Pointer to Python classes and methods -

i have function pointer dictionary points different class methods. best method of doing it? class a(): command_map = { "call func1 of object1": ("1", func1) "call func1 of object2": ("2", func1) } def __init__(self, object1, object2): self.o1 = object1 self.o2 = object2 def call(self, cmd): t = self.command_map[cmd] target = t[0] func = t[1] if target == "1": resp = self.o1.func() elif target == "2": resp = self.o2.func() else: self._logger.warn("unknown target %r\n" % target) in case eclipse highlights func variable saying unused. how proceed? want call funca() of objecta or funcb() of objectb dependent on input values. is there way self.o1 put "command-map"? change command_map hold function names instead of actual 'pointers'. command_map = {

calabash-android giving "No keystores found." when run under Jenkins -

i have simple test android project can test fine using ".\gradlew calabashdebug" in dos shell logged in myself. however, when run project under jenkins on continuous integration server fails "no keystores found." error (see stack trace below). 07:54:04.462 [debug] [org.gradle.process.internal.defaultexechandle] changing state to: starting 07:54:04.464 [debug] [org.gradle.process.internal.defaultexechandle] waiting until process started: command 'cmd'. 07:54:04.507 [info] [org.gradle.process.internal.processparentinginitializer] attempt initialize behaving parent process finished. 07:54:04.513 [debug] [org.gradle.process.internal.defaultexechandle] changing state to: started 07:54:04.513 [debug] [org.gradle.process.internal.exechandlerunner] waiting until streams handled... 07:54:04.514 [info] [org.gradle.process.internal.defaultexechandle] started process 'command 'cmd'' 07:54:05.111 [quiet] [system.out] no test server found combinatio

Use specific TypeScript compiler version in Visual Studio -

i wonder if there's way set specific typescript compiler version project in visual studio. configure project use version 1.0, if new versions released. i know it not possible before , wonder if things changes after typescript matured 1.0 version. i noticed visual studio creates <typescripttoolsversion>0.9</typescripttoolsversion> property in project file, couldn't find documentation it. if try compile project <typescripttoolsversion>0.9</typescripttoolsversion> using typescript version 1.0 you'll following error: your project file uses different version of typescript compiler , tools installed on machine. no compiler found @ c:\program files (x86)\microsoft sdks\typescript\0.9\tsc.exe. may able fix problem changing element in project file. so it's preventing compiling newer version. not put compiler 0.9 compatibility mode. but if have typescript 0.9 installed, compile against version. yes, can force specific versi

Is there a reason to import the string module in Python? -

i beginner in programming , python first language. using python shell right now, don't understand why need import string module. i know importing string imports functions, when tried using functions string.split , string.join , work without import, assume means python builtins. is there works once import string module wouldn't work otherwise? generally don't need import string module class in builtins. however, there several constants in string module not built in, can usefull.

scheme - Building accumulator for lazy lists in Racket -

i defined simple lazy list of integers zero: (define integers-from (lambda (n) (cons n (lambda () (integers-from (+ 1 n)))))) (define lz (integers-from 0)) i coded accumaltor gets lazy list parameter (define lz-lst-accumulate (lambda (op initial lz) (if (null? lz) initial (cons (op (head lz) initial) (lambda () (lz-lst-accumulate op (op initial (head lz)) (tail lz))))))) does accumaltor answer format of lazy lists? here simple test of accumulator: (define acc (lz-lst-accumulate * 1 lz)) (take acc 4) => '(1 2 6 24) take helper function creates list first n elements of lazy list: (define head car) (define tail (lambda (lz-lst) ((cdr lz-lst)) )) (define take (lambda (lz-lst n) (if (= n 0) (list) (cons (car lz-lst) (take (tail lz-lst) (sub1 n)))) )) in lz-lst-accumulate calculate once (op (head lz) initial) , (op initial (head lz)) . inconsistent; both

python - Find number of zeros before non-zero in a numpy array -

i have numpy array a . return number of zeros before non-zero in a in efficient way in loop. if a = np.array([0,1,2]) np.nonzero(a)[0][0] returns 1. if a = np.array([0,0,0]) doesn't work (i answer 3 in case). , if big , first non-zero near beginning seems inefficient. here's iterative cython version, may best bet if serious bottleneck # saved file count_leading_zeros.pyx import numpy np cimport numpy np cimport cython dtype = np.int ctypedef np.int_t dtype_t @cython.boundscheck(false) def count_leading_zeros(np.ndarray[dtype_t, ndim=1] a): cdef int elements = a.size cdef int = 0 cdef int count = 0 while < elements: if a[i] == 0: count += 1 else: return count += 1 return count this similar @mtrw's answer indexing @ native speeds. cython bit sketchy there may further improvements made. a quick test of extremely favourable case ipython few different methods in [1]: import nump

css - Theron-Lite Theme - How to widen page width -

so i'm using wordpress develop website. theme using 'theron-lite'. have created child theme custom style.css the pages great, want them wider. don't need make entire length of screen; maybe 5%. i can't figure out how this. closest i've come modify page width adding code style.css: / page width / content .single_wrap{width:105%!important;} by changing {width:100%!important;} {width:105%!important;}, changes page desired width. however! it's not centered. change extends page on right-hand side instead of left , right equally. here's example: http://paradigmcurve.com/?page_id=65 is there way extend page on both sides, equally? or issue lie in margins? hopefully there savvy developers out there can me out. consideration! you have .center class width fixed of 1000px, how change width of ?

actionscript 3 - What is the fastest way to check if a user is connected to the internet in AS3? -

i need check if user connected internet. what's fastest way in flash as3? do http of reliable , fast website, google.com. see as3 http example.

Error Installing Entity Framework 6.0.1 From Nuget (This operation would create an incorrectly structured document.) -

in asp.net mvc 5 need use entity framework. have tried installing latest entity framework through nuget package, getting following error below. have pasted complete nuget stack error. have tried several things un-installing/installing ef, adding ef references manually,etc. none have worked far , have lost 2 days. i have tried links similar problem here in site , has not helped , hence starting new thread hoping me here! need here...i stuck. error stack: install-package entityframework installing 'entityframework 6.1.0'. downloading entityframework microsoft, license agreement available @ http://go.microsoft.com/fwlink/?linkid=320539. check package additional dependencies, may come own license agreement(s). use of package , dependencies constitutes acceptance of license agreements. if not accept license agreement(s), delete relevant components device. installed 'entityframework 6.1.0'. adding 'entityframework 6.1.0' epp. added 'entityframework 6.1.0&

php - Remove quotes from json_encoded ints prior to 5.3.3 -

when using json_encode, annoyingly automatically coverts int keys strings. example, if have array: $a = array(); $a[12] = 15; echo json_encode($a); {"12":15} //notice quotes around 12 after searching so, solution use json_encode($array,json_numeric_check) however, available in php > 5.3.3. production server i'm stuck using 5.3.2. surely there work around? so problem here mixing approach data structure , json_encode() trying make best guess how interpret array, since in json, there not such concept of non-zero based, numerically indexed array. if example, had zero-based numeric array continuous number sequence, json_encode() encode a numerically-indexed array of format: [value1, value2, ...] since don't have zero-based array, data structure being interpreted object structure , given string key (the available key type object in json) of format: {"key", value} so seems need make mind trying represent in array. need numeri

Listen for track ended event in Spotify iOS SDK -

i'm integrating spotify ios sdk app. how can listen track ending events on sptaudiostreamingcontroller or spttrackplayer ? i'm cool playing, pausing, authenticating, etc. need grab track-ended event. i can see spttrackplayerdelegate has methods, appropriately, trackplayer:didendplaybackoftrackatindex:ofprovider , but how can use these? there examples of usage? thanks time! these classes follow standard cocoa delegate pattern. first, set delegate on track player: self.trackplayer.delegate = self; then implement delegate method in whatever self is: -(void)trackplayer:(spttrackplayer *)player didendplaybackoftrackatindex:(nsinteger)index ofprovider:(id<spttrackprovider>)provider { // track playback ended. } your delegate method called track player when appropriate.

How to scroll without clicking window to focus in vim? -

Image
i have file navigate window (b) , edit window (a). want scan window-b scrolling, while i'm editing file in window-a . so set mouse=a , , have focus cursor in window-b . wish not focus it, how to? i don't believe there's way want. if had window-c, how know window scroll !? just use :h window-move-cursor :h scrolling window in focus, or if you're more comfortable mouse, use instead.

javascript - Find a TD closest to a Parent Div of a submit button -

i'm trying key attribute of <td> tag below html code. <td class="xedit editable editable-click editable-open" id="3" key="details" data-original-title="" title="">javascript library </td> <div class="popover fade top in editable-container editable-popup" style="top: 289px; left: 534px; display: block;"> <div class="arrow"></div> <div class="popover-content"> <div> <div class="editableform-loading" style="display: none;"></div> <form class="form-inline editableform" style=""> <div class="control-group form-group"> <div> <div class="editable-input" style="position: relative;"> <input type="text" class="form-control input-sm" style="padding-right: 24px;">

Execute PHP Script using HTML Form -

Image
hello dear why fail learning php, grateful if can me. :'( followed step step here : http://www.w3schools.com/php/php_mysql_insert.asp but when click button submit query nothing happen, show blank white screen , dont see new data on database? <html> <body> <form action="insert.php" method="post"> firstname: <input type="text" name="firstname"> lastname: <input type="text" name="lastname"> age: <input type="text" name="age"> <input type="submit"> </form> </body> </html> <?php $con=mysqli_connect("localhost","root","","garutexpress"); // check connection if (mysqli_connect_errno()) { echo "failed connect mysql: " . mysqli_connect_error(); } $sql="insert persons (firstname, lastname, age) values ('$_post[firstnam

morelinq - DistinctBy with two properties in VB.NET -

looking @ select distinct 2 properties in list possible use distinctby extensionmethod 2 properties. tried convert vb.net, i'm not getting expected results test class: public class test public property id integer public property name string public overrides function tostring() string return id & " - " & name end function end class test method: private sub runtest() dim testlist new list(of test) testlist.add(new test() {.id = 1, .name = "a"}) testlist.add(new test() {.id = 2, .name = "a"}) testlist.add(new test() {.id = 3, .name = "a"}) testlist.add(new test() {.id = 1, .name = "a"}) testlist.add(new test() {.id = 1, .name = "b"}) testlist.add(new test() {.id = 1, .name = "a"}) dim result ienumerable(of test) result = testlist.distinctby(function(element) element.id) '1 - '2 - '3 - result = testlist.d

css - Bootstrap - I am not able to split the container in to columns by calculating by 12 -

i have div, need make 2 colum in that, 1 should have divided 4 sub colums, , column should full width. i tried way, not result, me? bootstrap fiddle demo my html , css: <div class="row"> <div class="col-sm-6 col1"> <div class="col-sm-3">3 of 12 width</div> <div class="col-sm-2">2 of 12 width</div> <div class="col-sm-2">3 of 12 width</div> <div class="col-sm-5">4 of 12 width</div> </div> <div class="col-sm-6 col2"> <div class="col-sm-12">12 of 12 width</div> </div> </div> css: .row{ border:2px dotted gray; } .col1{ border:1px solid green; } .col2{ border:1px solid blue; } you should surround row container rows must placed within .container (fixed-width) or .container-fluid (full-width) proper alignment , padding.

php - See table (mysql) add changes to table -

can 1 please me how make changes after reading table? i have selected , got data want table. this: <?php $sql = "select * lesson modulid = '3' , correctedby = 'value' or correctedby null"; $result = mysql_query($sql, $con); echo "<hr>"; while ($nextrow= mysql_fetch_array($result)){ echo "studentid: " . $nextrow['studentid'] ; echo "<br>modulid: " . $nextrow['modulid']; echo "<br>besvarelse: " . $nextrow['answer']; echo "<hr>"; } ?> the problem have is: have colum in table named result, how want wright "replyanswer" same tabel got answer from. can sending reply answer form? understand trying explain?

r - How to check in every row in a column if it contains a substring -

let's have column 'name' in dataframe df : apple apple123 app aple and, want check if every row in name column contains word apple . way did use grepl , grepl('apple',df$name) , hoping return 'true','true','false','false','false' , however, returned 5 'false' instead. did wrong here, if not grep l, function should use? i running fine dat <- c('apple', 'apple123', 'app', 'be', 'aple') grepl('apple', dat) [1] true true false false false dat[grepl('apple', dat)] [1] "apple" "apple123" this same data.frame dat <- data.frame(v=c('apple', 'apple123', 'app', 'be', 'aple')) grepl('apple', dat$v) [1] true true false false false which same if do with(dat, grepl('apple', v))

c# - Use Save Dialog with folder structure I provide possible? -

i working of cloud saving services , allow user save new documents created service of choice online. want use regular save dialog provide folder structure gathered account determine path upload file. i've found examples of how customize save dialog still keeps core functionality of saving local computer, haven't found examples of how change that. are there examples out there on how or there better way doing still intuitive user? it possible if create shell namespace extension expose cloud service shell folders. microsoft not support writing 1 in c# because extension loaded process opens file dialog. an alternative way ask user save folder synced cloud storage via background service. can limit user can save files in file dialog .

Is it a good idea to add WebAPI into an existing ASP.NET MVC project? -

we have existing asp.net mvc 5 project. want use webapi too. is idea install webapi mvc project using nuget? or better create new project in same vs solution webapi? if latter, how routing done? i gather having mvc , webapi in same project can cause issues dependency injection. true? you can put in same project, install nuget package , add startup classes (you can see how in template). i can't speak dependency resolver issues though. however ask myself first why want mvc + web api, in many cases can use mvc job, , stay 1 framework. i'd consider web api if want use content negotiation, odata or if have lot of ready made web api code want port.

How to encode video 3840x2160 with 32x32 and 16x16 CU with depth 2 and 1 in HEVC Encoder HM 13 -

when try encode video encoder crashes after finishing first gop. this configuration i'm using: maxcuwidth : 16 # maximum coding unit width in pixel maxcuheight : 16 # maximum coding unit height in pixel maxpartitiondepth : 2 # maximum coding unit depth quadtreetulog2maxsize : 3 # log2 of maximum transform size # quadtree-based tu coding (2...5) = maxpartitiondepth + 2 - 1 quadtreetulog2minsize : 2 # log2 of minimum transform size # quadtree-based tu coding (2...5) quadtreetumaxdepthinter : 1 quadtreetumaxdepthintra : 1 #======== coding structure ============= intraperiod : 8 # period of i-frame ( -1 = first) decodingrefreshtype : 1 # random accesss 0:none, 1:cdr, 2:idr gopsize : 4

css - Splitting Multiple LESS arguments -

i have mixin: .gradient(@alpha, ...) { @r: extract(@arguments,1); @g: extract(@arguments,2); @b: extract(@arguments,3); background: -moz-linear-gradient(top, rgba(@r,@g, @b, .2) 0%, rgba(0,0,0,@alpha) 100%); background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(@r,@g, @b, .2)), color-stop(100%,rgba(0,0,0,@alpha))); background: -webkit-linear-gradient(top, rgba(@r,@g, @b, .2) 0%,rgba(0,0,0,@alpha) 100%); background: -o-linear-gradient(top, rgba(@r,@g, @b, .2) 0%,rgba(0,0,0,@alpha) 100%); background: -ms-linear-gradient(top, rgba(@r,@g, @b, .2) 0%,rgba(0,0,0,@alpha) 100%); background: linear-gradient(to bottom, rgba(@r,@g, @b, .2) 0%,rgba(0,0,0,@alpha) 100%); } setting color , alpha: @rgbcolor: 221,73,50; @gradientalpha: 0.3; using it: .wrapper .gradient { .gradient( @gradientalpha, @rgbcolor ); } returns: syntaxerror: error evaluating function `rgba`: color functions take numbers parameters seems work

vim: replace a string with the "/" character in it -

i've been using following replace characters: to find each occurrence of eth0 in current line only, , replace br0 ,enter (first press esc key , type): :s/eth0/br0/g to find , replace occurrences of eth1 br1 , enter: :%s/eth1/br1/g to find , replace occurrences of eth1 br1 , ask confirmation first, enter: :%s/eth1/br1/gc to find , replace occurrences of case insensitive eth1 br1 , enter: :%s/eth1/br1/gi however, how replace string 1 has / in it. example, want replace debug printf statements // . when type.. :%s/printf/ // /gc it gives me trailing characters error. if teach me how thankful. thank you! you can use different separator: :s+sprintf+ // +g

android - toast in Java, need to show the value of a textview -

i have resulttextview shows result of computation. pass value of resulttextview show in toast. i have code: toast.maketext(mycalcactivity.this,message, toast.length_long).show() ; but code showing value of firstnumbertxt type first number calculated instead. :( button plusbtn = (button) findviewbyid(r.id.plusbutton1); plusbtn.setonclicklistener(new view.onclicklistener() { public void onclick(view v) { edittext inputone = (edittext) findviewbyid(r.id.firstnumbertxt); string message = inputone.gettext().tostring(); edittext inputtwo = (edittext) findviewbyid(r.id.secondnumbertxt); string message2 = inputtwo.gettext().tostring(); int first = integer.parseint(message); int second = integer.parseint(message2); int sum = first + second; textview resulttxt = (textview) findviewbyid(r.id.resulttextview); resulttxt.settext("result " + sum); toast.maketext(mycalcactivity.this, mess

javascript - How can I change a table's column widths? -

i have large table need include in prototype. how change column widths? attempts using css have not worked. http://jsbin.com/lebokewi/1/edit?html,css,output css table, th, tr, td { border: 1px solid #000; } #colhdr th:nth-of-type(1) {width: 100px;} #colhdr th:nth-of-type(2) {width: 50px;} #colhdr th:nth-of-type(3) {width: 200px;} #colhdr th:nth-of-type(4) {width: 60px;} #colhdr th:nth-of-type(5) {width: 80px;} try using <col> width attribute: example <table> <col width="130"> <col width="80"> <tr> <th>month</th> <th>savings</th> </tr> <tr> <td>january</td> <td>$100</td> </tr> <tr> <td>february</td> <td>$80</td> </tr> </table> reference w3schools.com

angularjs - Radio Buttons ng-checked with ng-model -

in html page, have 2 sets of boolean based radio buttons: labeled: "yes" , "no" / values: true , false respectively. i'm populating full form postgresql database table allow authenticated user view form populated data , edit populated fields including radio buttons, save form save data db. of other text fields populate without issue; it's both collection of radio buttons having issue pre-checkmarking radio buttons. the below not pre-populate checked on front end (but adds correct attribute of checked in html source): <input id="billing-no" type="radio" name="billing" ng-model="person.billing" value="false" ng-checked="person.billing == 'false'" /> <input id="billing-yes" type="radio" name="billing" ng-model="person.billing" value="true" ng-checked="person.billing == 'true'" /> however, check

c++ - MATLAB Coder: sparse matrix -

matlab coder seems fancy , can speed matlab code converting code c/c++ or mex.. seems not support sparse matrix, or matlab function sparse essential code. have idea how overcome problem? many thanks! the eigen library can used handle matlab function sparse , in c language. as said "libill", generate mex code portions of matlab code doesn't use sparse speed portions up. and sparse part use above library.

use Qt with 2 versions of Visual Studio -

i want use qt visual studio 2010 , 2012 parallel. visual studio 2010, i've installed , it's running. how install visual studio 2012? in change environmental variables? windows 8.1 64bit you can install path, if need can compile there, not hard. in respective solution files change path of qt libraries accordingly. http://qt-project.org/doc/qt-5/windows-building.html

c# - Visual Studio 2010 and dotnet framework v2.0 unable to compile -

i using visual studio 2010 open dotnet framework 2.0 web application. conversion looks ok, target platform has been set v2.0 however, during rebuilding of solution complains references(dll) have added requires later version of dotnet framework. all dll build using dotnet framework 2.0 many years back, impossible require later version i clueless in resolving this. a) message when rebuild solution. type or namespace name xxx not exist in namespace xxx (are missing assembly or reference?) b) message when try re-add dll reference xxx.dll or 1 of dependencies, requires later version of .net framework 1 specified in project. you can change .net framework target clicking properties on project menu , selecting new target in .net framework dropdown box.

javascript - Unexpected Token Var -

i have error unexpected token var. searched no answer question. code there error: note: not full code , part error is. @ line 2. function firstpart() { var chin = document.getelementbyid('dialog'); var name = document.getelementbyid('textf').value; in javascript, syntax function is: function functionname() { //lines of code } the code have provided here missing the closing curly brace (}). add closing curly brace , see happens. as code itself, there nothing wrong it. it works correctly when closing curly brace added it. you can see here: http://jsfiddle.net/uaysk/1/ hope helps.

vhdl - How to code scoreboard for out-of-order transactions between golden C model and RTL? -

i've uvm test env both golden c++ model , rtl instantiated. in cases c++ model , rtl outputs go out of order c++ model not cycle accurate. in-order outputs, have infinite queues in scoreboard. whenever see output in rtl interface, try match head of c++ model-output queue. here assumption outputs c++ model come before rtl output there no notion of time c++ model. however things can go crazy , out of order in few scenarios (as example, arbiter). in case, standard way write scoreboard , checking codes in uvm? here solution assuming transactions can arrive in order, either device under test (dut) or behavioral c++ model. maintain 2 queues of observed transactions. expected -- hold transactions model actual -- hold transactions dut when scoreboard receives transaction dut or model, first check if exists in other queue. if so, found match. otherwise add appropriate queue. so have: on receipt of dut transaction check expected queue match if found, remove e

css - use tab-indent when tab button is pressed in textarea but it is going to next element in html -

<textarea></textarea> this code need output in whenever tab placed indent right.. pressing tab else please see following example: http://www.jqversion.com/#!/lidxmdg you can use jquery code accomplish that: $(document).delegate('textarea', 'keydown', function(e) { var keycode = e.keycode || e.which; if (keycode == 9) { e.preventdefault(); var start = $(this).get(0).selectionstart; var end = $(this).get(0).selectionend; // set textarea value to: text before caret + tab + text after caret $(this).val($(this).val().substring(0, start) + "\t" + $(this).val().substring(end)); // put caret @ right position again $(this).get(0).selectionstart = $(this).get(0).selectionend = start + 1; } });

ios - uiviewcontroller still retaining after remove from superview, is it retain cycle issue -

i have uiviewcontroller subclass abcviewcontroller.on button long press, open uipopover containing uiviewcontroller(addproduct) on abuton long press.the add product contains cancel button brings user abcviewcontrol.and in instruments allocation tool disappears.fine till point.some thing this.. -(void)openproductpopup:(int)productid action:(bool)action{ addproduct *addproduct = [[addproduct alloc] initwithnibname:@"addproductnew" bundle:[nsbundle mainbundle]]; [addproduct setproductid:productid]; [addproduct setisaddingproduct:action]; uinavigationcontroller *nav = [[uinavigationcontroller alloc] initwithrootviewcontroller:addproduct]; [addproduct setdelegate:self];***//weak in add product*** [addproduct setdatabasepath:databasepath]; [addproduct setbacktracker:nil]; [addproduct setarrcategories:self.arrcategoryforpopup]; uipopovercontroller *popover = [[uipopovercontroller alloc] initwithcontentviewcontroller:nav]; popover.delegate = se

javascript - Why the values of checked elements from select control are not coming in $_POST array after submission of form? -

this question has answer here: how multiple selected values of select box in php? 10 answers i've following html code: <form action="rebates.php" role="form" method="post"> <select id="example28" multiple="multiple" name="applicable_states"> <option value="" selected='selected'>select unit</option> <option value="1" >alabama</option> <option value="2" >alaska</option> <option value="3" >arizona</option> <option value="4" >arkansas</option> <option value="5" >california</option> </select> <button type="submit" class="btn btn-primary">preview</button> </form> the jquery code select co

php - laravel4-send more than one array from controller to view -

i have created small applications , creating edit form. have 2 tables 1 "cars" , other named "classes". table clrs has field named class has id of table classes. have join query gets data 2 tables , displays @ form. problem want create dropdown list @ field "class" gets classes table classes , displays dropdown, want set default value class id in table "cars". public function edit($id) { $values = db::table('cars') ->join('classes', 'cars.class', '=', 'classes.id') ->select('cars.*', 'classes.class') ->where ('cars.id','=',$id) ->get(); return view::make('pages.edit')->with('values', $values); } edit.blade.php <div class="form-group"> {{ form::label('class', 'class', array('class'=>'control