Posts

Showing posts from February, 2010

Joomla 3.1 getUserStateFromRequest, will it return an array? -

short , sweet - can getuserstatefromrequest return array? api documentation appears incomplete? many thanks! the joomla documentation if still quite limited looking @ source of japplication:: in joomla 2.5 public function getuserstatefromrequest($key, $request, $default = null, $type = 'none') { $cur_state = $this->getuserstate($key, $default); $new_state = jrequest::getvar($request, null, 'default', $type); // save new value if set in request. if ($new_state !== null) { $this->setuserstate($key, $new_state); } else { $new_state = $cur_state; } return $new_state; } the answer yes can if set jrequest::setvar('var1', array(1,2,3), 'default'); jfactory::getapplication->setuserstate('var1', array(123)); or pass request $_get['var1'] = array(1,2,3); $_post['var1'] = array(1,2,3);

Django jquery flot chart multiple series -

i use flot chart in django app. want draw every day chart has many data series (lines chart). each day, serial number change , don't know how handle flot. code more or less this: test.py data_day_1 = [[1,56],[2,65],[3,45]] data_day_2 = [[1,45],[2,23],[3,89]] return render_to_response('test.html', {'data_day_1': data_day_1, 'data_day_2': data_day_2, }, context_instance=requestcontext(request)) test.html <div class="portlet-body"> <div id="site_statistics" class="chart"></div> </div> <script type="text/javascript"> var data1 = []; {% x, y in data_day_1 %} data1.push([{{x}},{{y}}]) {% endfor %} var data2 = []; {% x, y in data_day_2 %} data2.push([{{x}},{{y}}]) {% endfor %} $(function () { var options = { lines: {show: true},

c# - RegEx.IsMatch() vs. String.ToUpper().Contains() performance -

since there no case insensitive string.contains() (yet case insensitive version of string.equals() exists baffles me, digress) in .net, performance differences between using regex.ismatch() vs. using string.toupper().contains() ? example: string teststring = "thisisastringwithinconsistentcapitalization"; bool containsstring = regex.ismatch(teststring, "string", regexoptions.ignorecase); bool containsstringregex = teststring.toupper().contains("string"); i've heard string.toupper() expensive call shy away using when want string.contains() comparisons, how regex.ismatch() compare in terms of performance? is there more efficient approach doing such comparisons? here's benchmark using system; using system.diagnostics; using system.text.regularexpressions; public class program { public static void main(string[] args) { stopwatch sw = new stopwatch(); string teststring = "thisisastringwithinco

Associativity of assignment operator in C -

this question has answer here: why these constructs (using ++) undefined behavior? 12 answers i have code: #include<stdio.h> main() { static int a[10]; int i=5; a[i]=i++;// **statement 1** printf("%d %d",a[6],a[5]); } i following output: 0 5 since assignment operator rtl, shouldn't i++; in statement 1 incremented , a[i] becomes a[6] before assignment? doesn't statement 1 evaluate a[6]=5; ? why a[5] becoming 5? this becuase = not sequence point c language. such, a[i] = i++ invokes undefined behaviour. this better explained here , , here (thanks daniel fischer)

mysql - optimize expensive php query/subquery -

i have table 3 columns: submission_id, column_id, data. each submission_id has 25 columns , data values. i have page displays submissions column_id = 16 , data = ('' or 0). this, use subquery distinct submission_id's need, , columns in main query. query is: select sid,cid,data webform_submitted_data sid in(select distinct sid webform_submitted_data cid=16 , data in (' ',0)) order sid asc the table getting large, , query takes 30-40 seconds when run php, (though 1.0e-6 seconds mysql) not php overhead, checked using mysqld-slow.log file, following: <-- # query_time: 32.975552 lock_time: 0.000138 rows_sent: 108 rows_examined: 177396 --> i tried running explain in php ![explain]:( http://i.imgur.com/692eyhf.png ) one more thing, page updates current submission , puts id value in column_id 16, takes off of page when reloads. reloads without update take less second, when need update 100 records, rebuilds cache every time. any thoughts appreciate

amazon web services - Subdomains for S3 Bucket Folders -

i want dynamically route subdomains s3 bucket folders. whats best way achieve this? example: i have bucket called 'example' has 2 folders, 1 called 'a' , 1 called 'b'. want dynamically route a.example.com folder 'a' , b.example.com folder 'b'...and on. hope makes sense thanks it make sense, can't it. can configure s3 , dns route 1 hostname 1 bucket, not part of bucket. if, instead of folders, willing use 2 different buckets, easy set redirection of 2 hostnames 2 different buckets.

colors - trigger.io tabbar tint inactive -

i have app uses tabbar don't see way change tint of inactive items. able darken inactive tabbar icons because tabbar light color, there way this? the tinting options tabbar based on functionality ios provides, limited. can set tint bar, both active , inactive tabs based on, , colour icons/text. the active tabbar item appears lighter inactive, effect want may need darken overall tint of tabbar.

SQL Server Query Plans, Elapsed Time is Lower, but Subtree Cost is Higher -

why elapsed execution time of first of 2 queries below lower , while estimated subtree cost higher ? estimated subtree cost guideline gauging query plan performance in conjunction other query performance indicators, response time, i'm surprised existance of inverse relationship between cost , time when comparing 2 similar queries side side. i've created example database illustrate problem , included resulting xml query plans both queries. realize existence of stateid foreign key in both county , town tables bad form, easiest way me illustrate phenomenon. i'm not asking "which more important, subtree cost or response time." want understand how inverse relationship can exist between query plan subtree cost , response time 2 similar queries, can make more informed decisions going forward. please note 2 queries below produce exact same result set. thanks! create table dbo.county (stateid int, countyid int) create table dbo.town (stateid int, countyid

grails - Converting Mutable to Immutable with Hibernate -

i'm using grails , have following domain class: class pack { string code date publisheddate //several other properties (including collections hasmany).... def ispublished() { return publisheddate != null } def publish() { publisheddate = new date() } def canedit() { return !ispublished() } } to sell pack first need publish , use publish method publicate pack. after published, pack cannot changed (i.e. after published, pack need immutable instance). my question is: how transform mutable object in immutable using groovy? or is there way retrieve immutable instance hibernate? another option use canedit() method combined hibernate events (beforeupdate , beforedelete). if canedit() == false can throw runtimeexception inside beforedelete or beforeupdate. solution? obs.: think freeze method in ruby need. ( http://rubylearning.com/satishtalim/mutable_and_immutable_objects.html ) you can use pack.read( id ) an

version control - Where does a Git branch start and what is its length? -

every , i'm asked, on commit branch on git starts or if commit has been created on specific branch. end point of branch pretty clear: that's branch label sits. - did start? trivial answer be: on commit created branch. information is, far know now, , that's why i'm asking question, lost after first commits. as long know commit branched off, can draw graph make clear: a - b - c - - - - j [master] \ d - e - f - g [branch-a] \ h - - [branch-b] i've created branch-b @ commit e that's "start". know that, because did it. can others recognize same way? draw same graph that: a - b - c - - - - j [master] \ \ f - g [branch-a] \ / d - e \ h - [branch-b] so, looking @ graph now, branch started @ e , 1 @ b ? commit d member of both branches or can decide whether belongs branch-a or branch-b? this sounds philosophical isn't.

Manually activate tabs jquery ui 1.10.3 -

i getting mad, searched through jquery ui doc , stackoverflow's questions (tons of questions) cannot figure out how manually activate tabs ( .tabs() ) in jquery 1.10+ . i founded , tried solution : $(mytabs).tabs("option", "active", index); but not seem work out. can me know how activate tab , e.g. when create new one? i can't figure out how jquery ui has no longer select event , know, accomplished goal. i'm creating new tabs function : var addtab = function() { var tabtemplate = "<li><a href='#tabs-1'>non titolato</a></li>"; var li = $.parsehtml(tabtemplate); $(li).addclass('ui-corner-all'); $(".ui-tabs-nav").append(li); $("#stepbuilder").tabs('refresh'); } i activate last 1 created. use following activate last tab. $("#stepbuilder").tabs({ active: -1 }); i've created an example on jsfiddle.net . the api doc

Django - Add a field to a form that not should be in a model -

i have form based on model, want add 1 more field. field should not on model (or can be, don't want have column , saved on database). this field passed view , define action view take (will used on if on view). you can add additional fields modelform: class fooform(modelform): extra_stuff = forms.charfield() class meta: model = foo fields = ['bar', 'biz']

python - How to use different test package on different platforms -

i come c++ background, python knowledge limited, need following situation: background: we have software sf , integrated large system s , system s uses python unittest2 testing framework (however tweaked). specifically, implements class a , inherits unittest2 , customized exception handling class b . test implemented based on a . system s available on linux only. however, software sf used standalone application, should use unittest2 when test on other platforms, in cases class a not available. question: how apply different test packages on different platforms? my possible solution: thinking of implementing wrapper class based on thread: create wrapper class call pre , post function around existing functions? . answer post put below: class wrapper(object): def __init__(self,wrapped_class): self.wrapped_class = wrapped_class() def __getattr__(self,attr): orig_attr = self.wrapped_class.__getattribute__(attr) if callable(orig_at

sql server 2008, need help to write conditional update statement -

i have simple update statment. update tbabc set salary = 1000, name = 'mike' id = 1 i need add condition when update salary, if salary = 0, change 1000, otherwise salary not change. i did research, , found similar question. using conditional update statement in sql update tbabc set salary = case when (salary = 0) 1000 else ??????? end, name = 'mike' id = 1 i got stuck on ???? part. sure put there make salary = salary. unless absolutely necessary, i'd prefer using clause rather complicated case function. simplifying, give: update tbabc set salary=1000, name='mike' -- using condition both field updates id=1 , salary=0; or preserving exact logic on transaction: update tbabc set salary=1000 -- id & if second condition met id=1 , salary=0; update tbabc set name='mike' -- id. id=1; i don't believe there's real-world case updating employee's name unconditionally, having condition on salary up

math - Strange subtraction in c# -

i doing c# program.. must simple mathematical operation. 72057594037927936.0 - 255.0 = ..... both numbers double... obtain 72057594037927680.0 instead of 72057594037927681.0 can explain me please how possible? thanx the exact result of subtraction, 72057594037927681 = 0xffffffffffff01 needs 56 bits of precision, double has 53, hence result rounded nearest representable number.

integration - Looking for Mail Client to integrate with java application -

i have written web application in java. part of application, need retrieve mails gmail, yahoo , hotmail. looking open source free mail clients having gpl license. came across many open source free mail clients sqmail, claws mail , thunderbird. not able figure our how should go integrating mail client application written in java. mail clients have code should copy in java file use client or how it? thank in advance. used javamail integrate gmail java application

c# - how to delete file in asp.net mvc using jquery -

my script $("#btndelete").click(function () { $.post(url, { filename: _filenameattachementphoto }, function (data) { $("#resumepart4").html(data); }); }); my controllers [httppost] public actionresult deleteconfirmed(string filename) { var path = path.combine(server.mappath("~/app_data/uploads"), filename); fileinfo file = new fileinfo(path); if (file.exists) { file.delete(); } return redirecttoaction("deleteconfirmed"); } i tried nothing happened. try this $.post('@url.action("deleteconfirmed", "controllername")', { filename: filename });

Setting Content for Bound Kendo UI MVC TabStrip using Razor -

having trouble setting tab content databound tabstrip. found example of how to using webforms syntax, can't convert razor: here webforms syntax from here : .bindto(model, (item, navigationdata) => { item.text = navigationdata.text; item.imageurl = navigationdata.imageurl; item.content = () => {%> random content want appear <% }; }) here how trying in razor: @(html.kendo().tabstrip() .name("orderdetailstabs") .bindto(model, (item, model) => { item.text = "part: " + model.wohdr.orderdetailid; // tab text item.content = () => { (@<text> test @(model.wohdr.id) </text>); }; which produces error: a local variable named 'item' cannot declared in scope because give different meaning 'item', used in 'parent or current' scope denote else

ipc - difference between MPI_Send() and MPI_Ssend()? -

i know mpi_send() blocking call ,which waits until safe modify application buffer reuse. making send call synchronous(there should handshake receiver) , need use mpi_ssend() . want know difference between two. suppose need send fix amount of bytes among processes , 1 supposed take longer time ? me code works mpi_send() call waiting indefinitely mpi_ssend(). possible reasons ? and important thing , pretty sure data being received @ receiving process when using mpi_send() ,so inference leads nothing in favor wait handshake when using mpi_ssend() . or can make conclusion : mpi_send() can send data self process can't using mpi_ssend() ? there small important difference between 2 (you can find in mpi standard document in section 3.4). regular mpi_send , implementation return application when buffer available reuse. could before receiving process has posted receive. instance, when small message has been copied internal buffer , application buffer no longer neede

c++ - Is there any static vector of types? -

is there static (compiler-time) vector of types? example, can type given constant integer index, following vector<int, float>::type<0> int vector<int, float>::type<1> float if want manipulate vector of types @ compile time, can use boost::mpl::vector boost.mpl library. beware, head might explode. using namespace boost::mpl; typedef at_c<vector<int, float>, 0>::type t1; // int typedef at_c<vector<int, float>, 1>::type t2; // float http://www.boost.org/doc/libs/1_54_0/libs/mpl/doc/refmanual/vector.html

How to track the device location (iOS and Android) device using Phonegap -

i know when user arrives or leaves location. trying using wireless network (check mobile devices), couldn't several reasons. 1) needed real time updates or every 1 - 5 min of information devices connected , devices have disconnected. 2) had high ping pc iphone on same network (still don't know why). now want using geolocation phonegap application (running in background) suspended on ios or running in background in android. any appreciated. the first thing creating phonegap app receives location updates while running in background entirely possible, not trivial. i've done myself , released apps on both android , ios platforms. if need accurate , regular position updates, i'd suggest using gps receiver on target devices. in phonegap, can setting "highaccuracy" flag when requesting position updates. watchposition() function deliver new position information , when device receives updates gps receiver, use this: navigator.geolocation.watchp

foxpro - Can't update a dbf from Java using dBase Driver -

hello have dbf file want update everytime try run update statement system says that index not found using microsoft dbase driver . this code: class.forname("sun.jdbc.odbc.jdbcodbcdriver"); string connstring="jdbc:odbc:driver={microsoft dbase driver (*.dbf)};defaultdir=path"; connection connection=drivermanager.getconnection(connstring); string sql; calendar cal = calendar.getinstance(); cal.gettime(); simpledateformat sdf = new simpledateformat("hh:mm:ss"); string _time =sdf.format(cal.gettime());//adding time of set product. sql="update [mesas] set per_mez="+args[2]+", hor_mez='"+_time+"', mes_mez='"+args[2]+"' cod_mez='m01'"; statement query = connection.createstatement(); query.execute(sql); try using executeupdate instead of execute . there strange problems execute while doing table update.

asp.net - Installing feature in Azure startup task for Windows Server 2012 -

i want install ip , domain restrictions feature in azure deployment, i'm using os version 3 (server 2012) has depreciated servermanagecmd, following code not work: startuptask.cmd @echo off @echo installing "ipv4 address , domain restrictions" feature %windir%\system32\servermanagercmd.exe -install web-ip-security @echo unlocking configuration "ipv4 address , domain restrictions" feature %windir%\system32\inetsrv\appcmd.exe unlock config -section:system.webserver/security/ipsecurity servicedefinition.csdef partial <startup> <task commandline="startup\startuptasks.cmd" executioncontext="elevated" tasktype="simple" /> </startup> i believe need use powershell commands i'm little out of depth here. can provide 2012 equivalent of code? for playing @ home, here's answer! @echo off @echo installing "ipv4 address , domain restrictions" feature powershell -executionpoli

sql server - Java.sql.sqlexception: The conversion of a char data type to a datetime data type resulted in an out-of-range datetime value -

when updating date field update not works netbeans , below exception raised java.sql.sqlexception: conversion of char data type datetime data type resulted in out-of-range datetime value however run same query query works fine in sql query analyzer (sql server 2000) i formatting date value updated follows in netbeans. jxdatepicker jdatepicker = (jxdatepicker) comp; date date = jdatepicker.getdate(); if (date != null) { try { string expectedpattern = "yyyy-mm-dd hh:mm:ss.sss"; string currentformat = "dd-mm-yyyy hh:mm:ss.sss"; simpledateformat dateformatreq = new simpledateformat(expectedpattern); simpledateformat dateformatcurr = new simpledateformat(currentformat); // convert date required format db //first prepare string in current format dd-mm-yyyy // convert date in current format dd-mm-yyyy // convert string

c++ - Efficient means of null terminating an unsigned char buffer in a string append function? -

i've been writing "byte buffer" utility module - set of functions personal use in low level development. unfortunately, bytebuffer_append(...) function doesn't work when null terminates character @ end, and/or adds room null termination character. 1 result, when attempted, when call printf() on buffer's data (a cast (char*) performed): i'll section of string, first null termination character within buffer found. so, i'm looking means incorporate kind of null terminating functionality within function, i'm kind of drawing blank in terms of way of going this, , use point in right direction. here's code, if helps: void bytebuffer_append( bytebuffer_t* destbuffer, uint8* source, uint32 sourcelength ) { if ( !destbuffer ) { puts( "[bytebuffer_append]: param 'destbuffer' received null, bailing out...\n" ); return; } if ( !source ) { puts( "[bytebuffer_append]: param 's

How can I rename a Ruby library module's namespace? -

i'd use ruby stripe library in rails app. uses module stripe namespace. i want use stripe namespace activerecord models, , rename library module stripeapi, e.g. stripeapi::charge refers stripe library, stripe::charge refers stripe -namespaced activerecord model (so e.g. stripe::charge.create(...) creates database record, rather making api calls). is there way this? (sure, rename namespace, or try use differently named models, find kinda ugly.) i recommend rename own namespace since have full control on code. otherwise become pain in ass if want update version of stripe gem or search bug relating namespace original stripe namespace. it's lot easier change own namespace instead of changing existing gem (eventually every version again).

ios - Resizable UITextView to fit its content -

i have done resizing uitextview fit content using following code snippet ( source ). uitextview* textview = [[uitextview alloc]initwithframe:cgrectmake(0.0f,0.0f,300.0f,10.0f)]; [self.view addsubview:textview]; textview.text = @"lorem ipsum dummy text of printing , typesetting industry. lorem ipsum has been industry's standard dummy text ever since 1500s"; cgrect frame = textview.frame; frame.size.height = textview.contentsize.height; textview.frame = frame; my problem don't want create uitextview programatically. when add interface builder , reference through @property , above code doesn't work. frame returns null . i've put code inside viewdidload assume happens because uitextview 's been initialized or added view controller yet(?) is there way accomplish without creating uitextview programatically? you don't this uitextview* textview = [[uitextview alloc] initwithframe:cgrectmake(0.0f,0.0f,300.0f,10.0f)]; [self.view addsu

android os deletes my files when battery drain? -

i have developed small application contains long running service listening incoming udp messages. i'm saving of data internal storage. usualy goes fine, , can data internal storage after reboot. yesterday application running , battery drained. i've noticed of data in internal storage gone. does android delete files when battery drained? no doesnt , unless "clear app data " settings .

php - Difficulty taking info from JSON page and putting into MySQL -

ok.. i'm trying info external json page local mysql database (via xampp). it's not working.. here code. json page { "id": 219, "first_name": "dimitar", "second_name": "berbatov", "season_history": [ ["2006/07", 2715, 12, 11, 0, 45, 0, 0, 0, 1, 0, 0, 26, 0, 91, 169], ["2007/08", 2989, 15, 11, 0, 56, 0, 0, 0, 3, 0, 0, 18, 0, 95, 177], ["2008/09", 2564, 9, 10, 0, 20, 0, 0, 0, 2, 0, 0, 14, 0, 95, 138], ["2009/10", 2094, 12, 6, 0, 13, 0, 0, 0, 1, 0, 0, 8, 0, 92, 130], ["2010/11", 2208, 21, 4, 8, 28, 0, 0, 0, 1, 0, 0, 26, 0, 92, 176], ["2011/12", 521, 7, 0, 2, 6, 0, 0, 0, 0, 0, 0, 5, 146, 89, 49] } mycode.php $con=mysqli_connect("server","username","password", "database") or die("nope."); //gets page player details $i = 219; //wi

svn - merging two subversion branches -

i found conflicting procedures: subversion merging svn checkout http://a.b.c/bldtest1 cd bldtest1 svn merge -r45:50 http://a.b.c/bldtest2 svn merge -r53:55 http://a.b.c/bldtest2 svn ci -m "revision 45:50 , 53:55 merged" merge between 2 branches in subversion $ svn merge -r 127:240 svn+ssh://svn.myproject.org/svn/trunk . which 1 of these right 1 ? opposite of each other. provided find set of revisions merged : svn log --verbose --stop-on-copy branch1 > log.txt so in order merge branch1 branch2, we: 1. svn co branch1 3. cd branch1 4. svn merge -r xx:yy branch2 or 1. svn co branch1 2. svn co branch2 3. cd branch2 4. svn merge -r xx:yy branch1 . these procedures are not conflicted : in first sample default target "." omitted in order merge branch1 branch2 you have to: read , understand svn book (link provided sameer) use correct way of merging svn co url/to/branch2 cd branch2 svn merge -r xx:yy url/to/branc

c# - Showdialog Make the Parent Form Flicker in MONO (2.10.9) -

i create winform application .net 2.0. , use mono (version 2.10.9 ) none-dotnet system. but in mono mode, when use " new form().showdialog() " or show message box " messagebox.show() ", main form flickers. i think when triggers showdialog method, main form runs " enable = false " through controls, costs time , flicker. is there have idea solve that? thanks. btw, checking code in mono branch: https://github.com/mono/mono/blob/master/mcs/class/managed.windows.forms/system.windows.forms/form.cs hope solve issue!!!!!

iphone - How can get value NULL in parse XML iOS -

i want value response server. used nsparsexml parse xml when element null, missed value , not add array. example: xml <file> <state>2</state> <memo/> </file> in xml, null . this code: - (void)parser:(nsxmlparser *)parser didstartelement:(nsstring *)elementname namespaceuri:(nsstring *)namespaceuri qualifiedname:(nsstring *)qualifiedname attributes:(nsdictionary *)attributedict { nslog(@"did start element"); if ( [elementname isequaltostring:@"filename"]) { xml_field = filename_cloud; nslog(@"found rootelement"); return; } else if ( [elementname isequaltostring:@"memo"]) { nslog(@"found rootelement"); xml_field = memo; return; } } - (void)parser:(nsxmlparser *)parser didendelement:(nsstring *)elementname namespaceuri:(nsstring *)namespaceuri qualifiedname:(nsstring *)qnam

css - Apply style to more than one element -

this easy one, can no find right way this. have following style definition: .main_section nav { color:#999; ... } so style applies a in nav in .main_section . want extend li elements affected. duplicate code, like: .main_section nav li { color:#999; ... } but feels wrong. want unify both style specs one. how can that? use comma (,) define same style on multiple elements .main_section nav a,.main_section nav li { color:#999; ... }

html - How to modify Powershell code so that hyperlinks are only created for the files but not the directories? -

i'm using code below generate index.htm page. code works great, thing don't want inside index.htm page have hyperlinks directories, useless. index.htm should contain hyperlinks .htm files inside c:\inetpub\wwwroot . suggestions on how achieve such result? $basedir = 'c:\inetpub\wwwroot' $exp = [regex]::escape($basedir) $server = 'http://172.16.x.x' get-childitem $basedir -force | select name, lastwritetime, @{n="url";e={$_.fullname -replace $exp, $server -replace '\\', '/'}} | convertto-html -fragment url, name, lastwritetime ` -precontent '<html><head><title>test</title></head><body>' ` -postcontent '</body></html>' | % { $_ -replace '<th>.*</th>','<th>files</th>' ` -replace '<td>(.*?)</td><td>(.*?)</td><td>(.*?)</td>', '<td&g

testing - How do programmers test their algorithm in TopCoder or other competitions? -

good programmers write programs of moderate higher difficulty in competitions of topcoder or acm icpc, have ensure correctness of algorithm before submission. although provided sample test cases ensure correct output, how guarantees program behave correctly? can write test cases of own won't possible in cases know correct answer through manual calculation. how it? update: seems, not quite possible analyze , guarantee outcome of algorithm given tight constraints of competitive environment. however, if there manual, more common traits adopted while solving such problems - should enough answer question. best practices.. in competitions, top programmers have enough experience read question, , think of test cases should catch of possibilities input. it catches of bugs - not 100% safe. however, in real life critical applications (critical systems on air planes or nuclear reactors example) there methods prove piece of code supposed do. this field of formal verificat

Tapestry: How to write HTML from java page -

i need write html .java page. here have tried this tml code fragment ${testfunction()} this java code fragment public string testfunction() { return "<input type='checkbox' name='leaf' id='leaf' value='leaf'/>" } the result want checkbox. string "input type='checkbox' name='leaf' id='leaf' value='leaf'". appreciated thanks. if want render string html need use markupwriter#writeraw() method: void beginrender(markupwriter writer) { writer.writeraw("<input type='checkbox' name='leaf' id='leaf' value='leaf'/>"); } or can use outputraw component: <t:outputraw value="testfunction()"/> or can use renderable write markup: @property(write = false) private final renderable checkbox = new renderable() { public void render(markupwriter writer) { writer.element("input", "type&qu

sorting - Yii CGridView - Sort by DESC first on column header click -

is possible change order of column-header click sort? i have "ranking" column, upon first click sort asc, , on 2nd click go desc sort - need reverse 1st click desc, , 2nd click asc. is possible? return new csqldataprovider($sql . $search, array( 'totalitemcount' => $itemcount, 'params' => $params, 'sort' => array( 'attributes' => array ( 'enabled', 'store_name', 'rating' => array ( 'desc' => 'rating * percent / 100 desc', 'asc' => 'rating * percent / 100 asc', ), ), 'defaultorder' => array( 'store_name'=>false ) ), 'pagination' => array('pagesize' => yii::app()->user->getstate(&

java - Read array of unknown objects in REST service -

how write rest service below data post request? templates can have data, array of data. { "name":"jose", "surname":"john", "templates":[ { "template1":"333", "any":"any" }, { "anything":"anything", "test":"tafsasdf" } ] } cxf knows how convert such string nested map<string, object> . need have jackson libraries in classpath , annotate server method @requestbody . something this: @requestbody public void somemethod(map<string, object> json objects) { // code here }

Webcam light still on ever after disconnecting the drivers vb.net 2008 -

i want capture image webcam , found excellent code that, problem after disconnecting webcam drivers webcam light still on. seems webcam still in use. how adjust it? sendmessage(hhwnd, wm_cap_driver_disconnect, deviceid, 0) destroywindow(hhwnd) webcam class public class form1 const wm_cap short = &h400s const wm_cap_driver_connect integer = wm_cap + 10 const wm_cap_driver_disconnect integer = wm_cap + 11 const wm_cap_edit_copy integer = wm_cap + 30 public const wm_cap_get_status integer = wm_cap + 54 public const wm_cap_dlg_videoformat integer = wm_cap + 41 const wm_cap_set_preview integer = wm_cap + 50 const wm_cap_set_previewrate integer = wm_cap + 52 const wm_cap_set_scale integer = wm_cap + 53 const ws_child integer = &h40000000 const ws_visible integer = &h10000000 const swp_nomove short = &h2s const swp_nosize short = 1 const swp_nozorder short = &h4s const hwnd_bottom short = 1

How to make a composite key without making it a primary key in SQL Server ? -

how make composite key without making primary key in sql server ? i have 2 int columns in table , want make them composite key, sadly don't want them set primary key (selecting both columns , select primary key in ssms). is possible ? what mean making them composite key ? do want make them unique (in combination)? just create unique constraint on them: alter table dbo.yourtable add constraint uc_yourtable_col1_col2 unique(col1, col2) or else want achieve making them composite key ?

idl programming language - IDL for loop overwrites data -

i have problem for-loops in idl. for sl=0,2 begin ; number of hours t=90,90 begin ; timesteps each hour rad_num = 0, 3 begin ; number of radars ibin = 0, 333 begin ; distance radar iray = 0, 359 begin ; angle if finite(input(ibin,iray,rad_num)) eq 1 begin bin = bin_index(ibin,iray,rad_num) ray = ray_index(ibin,iray,rad_num) ; necessary because of different grids array(sl,t,ray,bin)=array(sl,t,ray,bin)+ input(ibin,iray,rad_num) array_n(sl,t,ray,bin) = array_n(sl,t,ray,bin) + 1. endif endfor endfor endfor endfor endfor array = array / array_n when stopped program after first sl-loop-step, following: print, array[0,90,315,49] 44.0.673 but when don't stop program, this: print, array[0,90,315,49] -nan it seems, program overwrites data of previous loop-step. when make scatter-plot, have points of last loop-step only... do see mistake? lot! kiki you don't

html - What's the difference between CSS id selector and CSS class selector? -

this question has answer here: difference between div id , div class 13 answers id vs class in css. please explain in detail example 8 answers for example, can same results following 2 ways. <html> <head> <style type="text/css"> p#red{color:red} /* css id selector*/ p.green{color:green} /* css class selector*/ </style> </head> <body> <p id="red">red color</p> <p class="green">greencolor </p> </body> </html> they both can give me colored text. difference between them? answer. id's unique each element can have 1 id. each page can have 1 element id classes not unique can use same class on multiple elements. can use multiple classes on same element.

excel - Assign multiple variables (x, y, z) to a 2D array -

i have function signature function [a] = code(x,y,z); i have excel spreadsheet. 1024×1024 array have extracted 3d afm image, 1024 number of pixel , numbers in array height of surface. how assign x column, y rows , z numbers inside 2d array? from have understood, - z = xlsread(file); [x,y] = meshgrid(1:size(z,1),1:size(z,2)); out = code(x',y',z);

java - CRX remote access with full JCR 2.0 API support -

i need access crx content repository remotely. done via rmi. but there essential methods (like jcrutils.getweakreferences(node) instance) lead unsupportedrepositoryoperationexception . how can access repository ability use methods jcr 2.0 api? (rmi no must-have.)