Posts

Showing posts from May, 2011

javascript - Unset object property -

i have provider: advicelist.provider('$advicelist',function(){ this.$get = function ($rootscope,$document,$compile,$http,$purr){ function advicelist(){ $http.post('../sys/core/fetchtreatments.php').success(function(data,status){ this.treatments = data; console.log(this.treatments); // correct object }); this.advicecategories = [ // available in controller ]; } return{ advicelist: function(){ return new advicelist(); } } } }); further, have controller: advicelist.controller('advicelistctrl',function($scope,$advicelist){ var adv = $advicelist.advicelist(); $scope.treatments = adv.treatments; // undefined }); why it, controller's $scope.treatments stays undefined, this.treatments inside provider however, filled correctly? also, advicecategories available in contr...

java - How to create request scoped web service port? -

i have spring mvc based web application calls web service. web service requires http based authentication every call.i hold web service proxy configuration in applicationcontext.xml: <beans... <bean id="paymentwebservice" class="org.springframework.remoting.jaxws.jaxwsportproxyfactorybean"> <property name="customproperties"> <ref local="jaxwscustomproperties"/> </property> <property name="serviceinterface" value="com.azercell.paymentgateway.client.paymentgatewaywebservice"/> <property name="wsdldocumenturl" value="#{config.wsdldocumenturl}"/> <property name="namespaceuri" value="http://webservice.paymentgateway.azercell.com/"/> <property name="servicename" value="paymentgatewaywebserviceimplservice"/> <property name="portname" value="paym...

php - Get X first/last WORDS from string -

ok, need... example input : $str = "well, guess know # : & ball"; example output : firstwords($str,5) should return array("well","i","guess","i","know") lastwords($str,5) should return array("is","it","is","a","ball") i've tried custom regexes , str_word_count , still feel if i'm missing something. any ideas? all need $str = "well, guess know # : & ball"; $words = str_word_count($str, 1); $firstwords = array_slice($words, 0,5); $lastwords = array_slice($words, -5,5); print_r($firstwords); print_r($lastwords); output array ( [0] => [1] => [2] => guess [3] => [4] => know ) array ( [0] => [1] => [2] => [3] => [4] => ball )

c# - How does the following LINQ statement work? -

how following linq statement work? here code: var list = new list<int>{1,2,4,5,6}; var = list.where(m => m%2 == 0); list.add(8); foreach (var in even) { console.writeline(i); } output: 2, 4, 6, 8 why not 2, 4, 6 ? the output 2,4,6,8 because of deferred execution . the query executed when query variable iterated over, not when query variable created. called deferred execution. -- suprotim agarwal, "deferred vs immediate query execution in linq" there execution called immediate query execution , useful caching query results. suprotim agarwal again: to force immediate execution of query not produce singleton value, can call tolist(), todictionary(), toarray(), count(), average() or max() method on query or query variable. these called conversion operators allow make copy/snapshot of result , access many times want, without need re-execute query. if want output 2,4,6 , use .tolist() : var list = new list<int...

c# - MVC, I get it, but separating out the model for repository functions and maybe even business logic... Best practice? -

Image
c# asp .net mvc 4.0 i understand mvc pattern, when comes down model: public class user { int id { get; set } int name { get; set; } } i see benefit dividing business logic repository ( data fetchers ). like: public class userrepository { ienumerablelist<user> getallusers() { ienumerablelist<product> users = //linq or entity; return ienumerablelist<product> users; } int getscorebyuserid( id ) { int score = //linq or entity; return score; } } would business logic go user class like: public class user { public int id { get; set } public int name { get; set; } public bool hasdiscount( int id ) { if( getscorebyuserid( id ) > 5 ) return true; return false; } } does have decent example. it's not easy 1 2 3 find such explicit example me. does above code seem okay? should repository extend user or should separate class.....

forms - Better dropdown with bootstrap -

Image
i try use dropdowns of bootstrap, it's work problem esthetic. : http://twitter.github.io/bootstrap/javascript.html#dropdowns i have code : <div class="dropdown"> <a class="dropdown-toggle" data-toggle="dropdown" href="#">colléctivités <b class="caret"></b></a> <ul class="dropdown-menu" role="menu" aria-labelledby="dlabel"> <?php foreach ($collectivite $key => $value) { echo '<form method="post" action="wbx.php"><li><button type="submit" class="btn" style="margin:0px;" name="cookie" value='.$value.'>'.$value.'</button> </li></form>'; } ?> </ul> </div> without php : <div class="dropdown"> <a class="dropdown-toggle" data-toggle...

php - Multipart response in Laravel 4 -

does laravel 4 support multipart response? need output , process, parse kind of data. json combined base64 image blobs. just image there route handling request "something.com/api/v1/get-all" action in controller should respond multipart. whats best practice in laravel framework? content-type: multipart/form-data; boundary=.............................103832778631715 --.............................103832778631715 content-disposition: form-data; name="__json_data__"; content-type: application/json; { "item": { "uuid": "12345-523462362-252636", "title": "title" } } .............................103832778631715 content-disposition: form-data; name="imagefile"; filename="someimage.jpg" content-type: application/octet-stream [[[base64 encoded contents of file]]] .............................103832778631715-- you want mulipart form, don't you? echo form::o...

linux - How to have bash shell not execute rest of semicolon list of commands? -

suppose following in bash @ command prompt: cmd1;cmd2;cmd3 if cmd1 fails how bash not cmd2 . cmd1 && cmd2 && cmd3 explanation execute cmd1 . if fails, cmd2 , cmd3 not executed. why? because false logically anded else equal false , if cmd1 returns false there no need evaluate cmd2 , cmd3 . , reasoning, if cmd1 succeeds , cmd2 fails, don't execute cmd3 . note just make things little more confusing, posix systems (like linux , other unix variants) return 0 success , non-zero failure . so, when failure above false = non-zero = failure true = zero = success why? because numerical value of return code used indicate different failure codes. for example, $ ls /root ls: cannot open directory /root: permission denied $ echo $? 2 $ asdf asdf: command not found... $ echo $? 127 $ ls / bin boot data dev etc home lib ... $ echo $? 0 ls returns "1" minor problems , "2" more serious problems. bash...

.net - Using values from 2 list boxes in c# to populate a SQL table -

i have 2 list boxes, listbox1 (customer id) , list box 2 customer emails, need link items add email sql table based on id matching. so line 1 in list 1 linked line 1 in listbox 2 , , on , i'm not sure how write code this, thought might need sort of array i'm new coding i'm not sure. any fantastic cheers you can use selected index of list box matching id's in first list box id's of second list box, that may in format below listbox1.selectedindex matching listbox2.selectedindex now can opt code store in database.

akka - Is there a standard way to do `actorFor orElse actorOf`? -

i actorref may have been created. there standard way call context.actorfor and, if didn't return live actorref , call context.actorof ? vice versa fine (ie call context.actorof and, if actor exists, call context.actorfor ). first off: get-or-create can work if there 1 entity (otherwise never sure how created when find it). means parent of actor-to-be place put code. within actor quite straight-forward: val child = context.child(name) match { case none => context.actorof(props(...), name) case some(c) => c } please refrain using actorfor , deprecated in akka 2.2 good reason . in case context.child() want more efficiently.

java - ValueAxis can't change Locale -

i've problem jfreechart locale. created barchart3d need change locale of rangeaxis. when retrive plot receive valueaxis , can't change locale inside it. how can change locale inside it? is possible change locale of jfreechart? you need bit more specific trying achieve. in general, jfreechart use default locale settings provided java runtime.

c# - How to Get the Integer Value of the Month? -

i'm working mvc3.i'm using dropdownlist select month using following code, <select id="mth" class="dropdown"> <option>jan</option> <option>feb</option> <option>mar</option> <option>apr</option> <option>may</option> <option>jun</option> <option>jul</option> <option>aug</option> <option>sep</option> <option>oct</option> <option>nov</option> <option>dec</option> </select> i want pass integer value of corresponding month controller.for example if choose 'jan' value '1' should passed controller.how can that? you can add value attribute options <select id="mth" class="dropdown"> <option value="1">jan</option> <option value="12">dec</option> </select...

c# - Does a variable of an interface type act as value type if the underlying implementation is a struct? -

i looking @ this question, , aside rather odd way enumerate something, op having trouble because enumerator struct. understand returning or passing struct around uses copy because value type: public mystruct getthingbutactuallyjustcopyofit() { return this.mystructfield; } or public void pretendtodosomething(mystruct thingy) { thingy.desc = "this doesn't work expected"; } so question if mystruct implements imyinterface (such ienumerable), these types of methods work expected? public struct mystruct : imyinterface { ... } //will caller able modify property of returned imyinterface? public imyinterface actuallystruct() { return (imyinterface)this.mystruct; } //will interface pass in value changed? public void setinterfaceprop(imyinterface thingy) { thingy.desc = "the implementing type struct"; } yes, code work, needs explanation, because there whole world of code not work, , you're trip unless know this. before forg...

c# - Posting json to mvc 4 WebApi controller action. Why doesn't it deserialize my array? -

the following has been driving me bit crazy. have found couple of similar problems did not offer solution. trying post json object containing few data items. 1 of them list of object itself. here is: { "claimtype":"trade", "claimedproductid":"4", "claiminguserid":"2", "message":"test", "tradeoffers":[ { "offeredproductid":"7", "offeredquantity":"5" }, { "offeredproductid":"12", "offeredquantity":"2" } ] } this json validates. my controller looks this: public class productcontroller : apicontroller { [httppost] public void claim(claimviewmodel claimviewmodel) { //do amazing stuff data viewmodel. //sorry guys. stuff tooo cool posted here see //not ;-) } } the claimviewmodel posting looks this: public class claimviewmodel { publi...

matlab - Combining solve and dsolve to solve equation systems with differential and algebraic equations -

i trying solve equation systems, contain algebraic differential equations. symbolically need combine dsolve , solve (do i?). consider following example: have 3 base equations a == b + c; % algebraic equation diff(b,1) == 1/c1*y(t); % differential equation 1 diff(c,1) == 1/c2*y(t); % differential equation 2 solving both differential equations, eliminating int(y,0..t) , solving c=f(c1,c2,a) yields c1*b == c2*c or c1*(a-c) == c2*c c = c1/(c1+c2) * how can convince matlab give me result? here tried: syms b c y c1 c2; eq1 = == b + c; % algebraic equation deq1 = 'db == 1/c1*y(t)'; % differential equation 1 deq2 = 'dc == 1/c2*y(t)'; % differential equation 2 [sol_deq1, sol_deq2]=dsolve(deq1,deq2,'b(0)==0','c(0)==0'); % works, no inclusion of algebraic equation %[sol_deq1, sol_deq2]=dsolve(deq1,deq2,eq1,'c'); % not work %solve(eq1,deq1,deq2,'c') % not work %solve(eq1,sol_deq_c1,sol_deq_c2,'c') % not work no combinati...

excel - Run-time error '9' when copying worksheet to another workbook -

i've been trying write macro copy "sheet1" 1 workbook another, keep getting run-time error '9': subscript out of range. sub copysheettootherwbk() dim copyfrombook workbook dim copytowbk workbook dim shtocopy worksheet set copyfrombook = workbooks("allbugs.xlsx") set shtocopy = copyfrombook.worksheets("sheet1") set copytowbk = workbooks("yourfriendlyneighborhoodtemplateworksheet.xlsx") shtocopy.copy after:=copytowbk.sheets(copytowbk.sheets.count) end sub the highlighted line "set copyfrombook = workbooks("allbugs.xlsx")". not sure i'm doing wrong here. relatively new vba. appreciated. the workbooks collection refers open workbooks. if workbook isn't open need first. set copyfrombook = workbooks.open("c:\some location\allbugs.xlsx")

symfony - Loading fonts in symfony2 -

don't know how load ttf font types on css files twig in symfony2 app. suggestions? ttf inside folder in resources. thanks load font in twig? want have custom fonts in css file defines styling of twig. @font-face { font-family: giveitsomename; src: url(locationtoyourfont.ttf); // can add stuff font-style, or font-weight... } and later in css file, use there font named giveitsomename in classes wish, this .someclass { font-family: giveitsomename; }

asp.net mvc - MVC Html.ActionLink removes empty querystring parameter from URL -

i'm using html.actionlink(string linktext, string actionname, object routevalues) overload send params action method.. sometimes need pass empty parameter value like: ?item1=&item2=value i'm specifying param in anonymous type create , pass routevalues , both null , string.empty result in url omits empty item1 param. new { item1 = null, item2 = "value" } new { item1 = string.empty, item2 = "value" } new { item1 = "", item2 = "value" } // result in: ?item2=value i can create url manually want use helper method. suggestions? create emptyparameter class follows: public class emptyparameter { public override string tostring() { return string.empty; } } then: @html.actionlink("action", "controller", new { item1 = new emptyparameter(), item2 = "value" });

Android studio offline installation -

my windows xp development environment has no internet access. need install android studio without internet connection. (formerly used 1-2 months intellij idea 12 android development) the steps made: i downloaded studio 0.2.x installation files developer site ( http://developer.android.com/sdk/installing/studio.html ). i downloaded jdk , installed. i installed android sdk package installer, downloaded api files , installed files using package installer. ( http://siddharthbarman.com/apd/ ) i tried create new project. "gradle" error. seems gradle bundled inside studio because of error exists, downloaded gradle-1.6.zip website. ( http://www.gradle.org/downloads ) added gradle\bin path environment variable. then still new errors maven missing. seems need download maven don't know version. can write step step how many more programs / libraries should download hello world android studio , android emulator ? note: download files machine has internet conn...

tsql - SQL Selecting Maximum Based on Minor-Major scheme -

i trying create query select distinct line, select using revision minor / major scheme. below example table: serial number | revmajor | revminor ----------------------------------- aq155 | 1 | 1 aq155 | 1 | 2 aq155 | 1 | 1 aq155 | 1 | 7 aq155 | 2 | 1 <--------- jr2709 | 1 | 7 jr2709 | 2 | 2 <--------- how can write query in t-sql 2008 select 2 highlighted lines, "newest revision"? in advance! you could select * ( select *, row_number() on (partition [serial number] order revmajor desc, revminor desc) versionrank table ) t versionrank = 1

android - getting "androidApplicationContext must be not null!" crashes from crash reporting service -

after supporing linkedin social network, app i'm working on has caused many crashes thing written there "androidapplicationcontext must not null!" . i've searched internet , , found next links clues: http://pastebin.com/qev9d8xh http://logs.nslu2-linux.org/livelogs/android-dev/android-dev.20120829.txt it says : aug 28 17:15:23 <s3nsat10n> has run across stacktrace this? http://pastebin.com/qev9d8xh aug 28 17:15:33 <s3nsat10n> has null app context inside apache httpclient aug 28 17:15:38 <hodapp> wongk: yeah, i'm confused why it's doing this... aug 28 17:15:47 <s3nsat10n> highly modified httpclient seem, judging naf.gba package stuff aug 28 17:15:51 <s3nsat10n> seems happening on samsung galaxy s devices, don't know if that's case. aug 28 17:16:48 <wongk> s3nsat10n: never see aug 28 17:16:50 <wongk> seen aug 28 17:17:17 <s3nsat10n> yeah :/ aug 28 17:17:22 <s3nsat10n> neither has of i...

java - Regarding ConcurrentHashMap, what does the following mean? -

directly concurrenthashmap javadocs : the allowed concurrency among update operations guided optional concurrencylevel constructor argument (default 16), used hint internal sizing. table internally partitioned try permit indicated number of concurrent updates without contention. because placement in hash tables random, actual concurrency vary. i not point when say: "which used hint internal sizing". should not sizing determing capacity , not concurrencylevel? the table internally partitioned - means divide table concurrencylevel divisions in hopes can many concurrent updates without collisions. there no guarantee hashed data fall nicely in partitions.

java - How to get user details from Websphere UserRegistry -

how fetch user's other details ad after logging application using ldap registry configured in websphere server. have java ee application, using single sign on. want other details email, office location of user configured in active directory. how that? // retrieves default initialcontext server. javax.naming.initialcontext ctx = new javax.naming.initialcontext(); // retrieves local userregistry object. com.ibm.websphere.security.userregistry reg = (com.ibm.websphere.security.userregistry) ctx .lookup("userregistry"); from registry, there chance it? in websphere application server can access user registry information -and modify it- thorugh virtual member manager componente api. there's plenty of documentation , samples on ibm infocenter . there, code snippet properties of entity user: dataobject root = sdohelper.createrootdataobject(); dataobject entity = sdohelper.createentitydataobject(root, null,...

c++ - QPainter::begin: Widget painting can only begin as a result of a paintEvent -

the code works following warning message while press mouse while executing: ?? qpainter::begin: widget painting can begin result of paintevent qpainter::setpen: painter not active qpainter::drawrects: painter not active added modification further down #include <qtextedit> class qtexteditenter : public qtextedit { q_object public: qtexteditenter(qwidget *_parent); protected: virtual void paintevent(qpaintevent *_event); void mousepressevent(qmouseevent *evt); int m_color; void mousedoubleclickevent(qmouseevent *e); signals: void signalpressenter(); }; #include "qtexteditenter.h" #include <qpainter.h> #include <qmouseevent> qtexteditenter::qtexteditenter(qwidget *_parent) : qtextedit(_parent) { this->setframestyle(qframe::sunken); m_color = 0; setattribute(qt::wa_paintoutsidepaintevent, true); } void qtexteditenter::paintevent(qpaintevent *_event) { qpainter pnt( viewport() ); pnt.set...

java - Delete a node in Binary Search Tree -

i have test code bst. bst created, node deletion not working properly. suggest if below delete code correct or modification in delete method helpful. public class binarysearchtree { public binarysearchtree() { super(); } private class binarysearchtreenode{ private int data; private binarysearchtreenode left; private binarysearchtreenode right; public binarysearchtreenode(){ } public binarysearchtreenode(int data){ this.data = data; } public void setdata(int data) { this.data = data; } public int getdata() { return data; } public void setleft(binarysearchtree.binarysearchtreenode left) { this.left = left; } public binarysearchtree.binarysearchtreenode getleft() { return left; } public void setright(binarysearchtree.binarysearchtreenode right) { this.right = right; } public binarysearchtree.binarysearchtreenode getright() { return right; } } ...

ASP.NET Razor Dropdown Selection -

i have list of string , have selected item among strings. controller: viewbag.groupname = new selectlist(names, names.find(s=>s==place.groupname)); view: @html.dropdownlistfor(model => model.groupname, (ienumerable<selectlistitem>)viewbag.groupname) but selection on view first item in list not expected. problem. you need make sure first parameter pass html.dropdownlistfor set value of selectlistitem should selected. if value of doesn't match values in dropdownlist, won't set item selected. in case, need make sure model.groupname set value of selectlistitem should selected. example: .cs: class myviewmodel { public string selectedvalue = "3"; public list<selectlistitem> listitems = new list<selectlistitem> { new selectlistitem { text = "list item 1", value = "1"}, new selectlistitem { text = "list item 2", value = "2"}, n...

java - Oracle MERGE and prepared statement -

i have backup utility, workig on restore section. table: create table "sbooks"."dev_corpus" ( "corpusid" number(9,0) not null enable, "corpus_name" varchar2(768 byte) not null enable, "corpuslastsync" date, primary key ("corpusid") in restore class primary key in table, if exists update row, if not insert row. problem need pass parameters class (they not exist in table), how can this? suggestion? using preparedstatment or what? , how? please give examples or links sources. more info: using oracle sql developer , java netbeans. edit: trying in command window: merge dev_corpus using (select corpusid, corpus_name, corpusdesc, corpusimageids, rocf1, rocf2, rocf3, rocc1, rocc2, rocc3, corpusactive, corpusrunfrequency, corpuslastrun, corpuslastsync, rocsettingid, corpusaffinity, corpusterms, corpusdomain dual corpusid = 1000156 , corpus_name = 'sahar' , corpusdesc = ...

ruby - A rails app which gets users location using HTML5 geolocation and saves to data base -

seems pretty simple i'm struggling. here's have far in view. display location coords test working. want persist on database, hence ajax call. doing right way or there easier or better way? <p id="demo">click button coordinates:</p> <button onclick="getlocation()">try it</button> <script> var x=document.getelementbyid("demo"); var lat; var long; function getlocation() { if (navigator.geolocation) { navigator.geolocation.getcurrentposition(showposition); } else{x.innerhtml="geolocation not supported browser.";} } function showposition(position) { lat = position.coords.latitude; long = position.coords.longitude; x.innerhtml="latitude: " + lat + "<br>longitude: " + long; $.ajax({ type: 'post', url: 'http://localhost:3000...

Change DIV class with PHP -

i’m trying style div’s css. want change div tag class inside mysql loop using php. <?php $result = $mysqli->query("select * posts order id desc limit 0, 20"); while($row = mysqli_fetch_array($result)) { ?> <div class=” box id1”><?php echo $row[‘post’];?></div> <?php } ?> so want change class box id1 in order box id1 box id1 box id2 box id2 box id2 box id2 box id1 box id1 box id2 box id2 box id2 box id2 on. (2 div tags class box id1 4 box id2 looping) i tried using rand(1, 2); making numbers comes randomly not order want. appreciated. in advance. <?php $result = $mysqli->query("select * posts order id desc limit 0, 20"); $i=1; $class_str = ""; while($row = mysqli_fetch_array($result)) { switch($i%6){//deciding 6 place //first 2 id1 case 1: case 2: $class_str="id1"; break; //four other id2 case 3: case 4: ...

PHP Multidimensional Arrays , display data in a tabular form -

when echo array , result : $items = array( [147] => array([itemname] => array([0]=>white snack [1]=>dark cookie) [itemcode] => array([0]=>it-ws [1]=>it-dc ) ) [256] => array([itemname] => array([0]=>soft sandwiches [1]=>hard drinks) [itemcode] => array([0]=>it-ss [1]=>it-hd ) )) now need display following result in tabular form , indexes 147 , 256 , pass them separate foreach loop correct index value. -----------147--------------- name ----------------------------------- code white snack --------------------------- ws dark cookie --------------------------- dc -----------256--------------- name ----------------------------------- code soft sandwiches ---------------------- ss hard drinks ---------------------------- hd am not able achieve this. please help. $itemindexes = array(147,256); foreach($itemindexes $...

v8 - how to add path with module to python? -

i try build v8 javascript engine. when try invoke command python build/git_v8 , error: file build/gyp_v8, line 48 in < module > import gyp importerror: no module named gyp how can tell python search gyp module , correct path module in folder gyp? my version of python 2.6.2.2, recommended in build instructions. obviously, module gyp.py not in search path of modules (sys.path). sys.path array variable in sys module contains known paths of modules. can add directory containing module gyp.py manually either of these methods: set via pythonpath environment variable (see http://docs.python.org/3/using/cmdline.html?highlight=path#envvar-pythonpath ) add path manually within python script prior importing gyp. example, if directory containing module /home/you/gyp: import os, sys sys.path.append('/home/you/gyp') import gyp #--------- that's ------------ you can check if path exists using debug lines import sys print(sys.path) # version python...

Android failed to use HTTP method POST -

so, have code in activity (layout supporting user interface button triggers method onsaveregistrationclick ): public void onsaveregistrationclick (view view){ postdata(); } public void postdata(){ httpclient httpclient = new defaulthttpclient(); httppost httppost = new httppost("http://www.mywebsite.com"); try { httpclient.execute(httppost); } catch (exception e){ toast.maketext(this, "not working" , toast.length_short).show(); } } on website, have index.php on call saves 1 row in database helps me determine if android connected site. however, i'm getting exceptions on line httpclient.execute(httppost); . mistaking? p.s. - have permission added in androidmanifest.xml (i added extra, i.e.: <uses-permission android:name="android.permission.internet"/> <uses-permission android:name="android.permission.write_external_storage"></uses-permission> <uses-permission an...

c99 - bizarre C statement -

this question has answer here: what purpose of static keyword in array parameter of function “char s[static 10]”? 1 answer void test(int x[static 10]); int main() { int a[]={1,2,3,4,5,6,7,8,9,10,11}; test(a); return 0; } void test(int x[static 10]) { printf("%d",x[9]); } i looking bizarre c statements. found one, not understand use of static 10 in statement. same int x[10] ? another thing, can use volatile also, in place of static e.g int x[volatile 10] knows use of kinda declaration? ps: compiled using gcc 4.6.3, it's hint compiler telling x pointer parameter points first element of array of @ least 10 elements. for example: test(null); // undefined behavior

AngularJS : Toggle to modify attribute in directive -

in project working on, applying ui-sort via angular on to-do list , trying toggle work when user editing tasks. current method of testing toggle employing use of button toggle sorting on , off. my strategy this: employ angular directive generate initial template sorting on. add button which, when clicked, modifies scope variable in controller ($scope.sortingenabled) toggle between true , false. inside directive, have watch set on 'sortingenabled' in link function add/remove sorting attribute . here in todo.html before tried employing directive: sortableoptions function written re-order todos on internal records. <ul class="unstyled" ng-model="todos" ui-sortable="sortableoptions"> <!-- list items here via ng-repeat --> </ul> the following code in todo.html after directive: <sortable></sortable> and current draft directive inside todo-directives.js: app.directive('sortable', function() { ...

orm - How would I map this existing DB in Grails? -

we have existing oracle database , map in grails 2.2.3 can use gorm. have authorization table has primary keys in several entities such fund, organization, account, etc. here table looks like: table: phone_auth id not null number auth_code varchar2 fund varchar2 organization varchar2 account varchar2 the fund, organization, , account columns primary keys map records in other tables (the fund table, account table, etc.) how map in grails? need use static embedded = ['fund', 'organization', 'account'] ? or use mappedby in way? thank you! so this class phoneauth { string authcode fund fund organization organization account account static mapping = { table 'phone_auth' version false fund column: 'fund' organization column: 'organization' account column: 'account'...

gruntjs - Grunt Image Paths in CoffeeScript (eco) Templates -

i've ran slight issue referring images in production environment. image files generated using imagemin , end /images/.. files – which totally fine, don't know how refer them in coffeescript. in eco templates i'm using backbonejs with. everything works fine in css – compass seems taking care of putting in right urls. there's no helper can use (or don't know how) refer image url. so simple: <img src="images/draggable.png" /> works in development, not in production. any appreciated. i'm using grunt/yeoman. here's gruntfile.js: 'use strict'; if (process.env.node_env != 'production') { var livereload_port = 35729; var lrsnippet = require('connect-livereload')({port: livereload_port}); var mountfolder = function (connect, dir) { return connect.static(require('path').resolve(dir)); }; } // # globbing // performance reasons we're matching 1 level down: // 'test/spec/{,*/}*.js...

android - how to find range of Normalized Device Co-ordinates? -

i new opengl programming. know ndc ranges [-1, 1] on both axis 0,0 in center. trying increase range , doing via gltranslatef(0,0,-11.0f) gives me more room. but dont know new ndc range after gl call. can body please explain ? you need first try understand life of vertex in opengl pipeline (an example here ). otherwise find hard understand doing. can frustrating @ begining. the simple answer question ndc coordinates always in range of [-1, 1]. cannot change , shouldn't need change that. what do want change though, modelview , perspective matrices objects have more space in screen. example gltranslatef(0,0,-11.0f) command, moves object down on negative z axis (where "camera" looks @ default i.e. away eye). since object farther away seems smaller, have more screen space. another set of tutorials have personaly found helpful opengl es ground up (they iphone principles same)

asp classic - Server.CreateObject("Wscript.Shell") issue - Object Server required error??? ASP/VBscript error -

i'll try keep basic. i'm trying run shell on server side (not client). i've broken down code it's pretty basic. right if run on client side using createobject("wscript.shell") 'document.write' user in browser. <script type="text/vbscript" > set shell = createobject("wscript.shell") set whoami = shell.exec("whoami") set whoamioutput = whoami.stdout strwhoamioutput = whoamioutput.readall document.write strwhoamioutput </script> now if change code run on server side: <script type="text/vbscript" > set shell = server.createobject("wscript.shell") set whoami = shell.exec("whoami") set whoamioutput = whoami.stdout strwhoamioutput = whoamioutput.readall document.write strwhoamioutput </script> i error in browser telling me 'object required: server' @ line 11. line 11 'server.createobject' line. missing here? thanks from 'docu...

pip - Failed to install PyZMQ 13.1 for PyPy 2.0.2 on Ubuntu 12.04.2 LTS -

i use pip install root. works cpython because doesn't use cffi backend. pypy following error: importerror: pyzmq cffi backend couldn't find zeromq: [errno 2] no such file or directory: '/********/site-packages/zmq/cffi_core/__pycache__/_cffi__g5368a726x67d4e236.c' the '/ * * /site-packages/zmq/cffi_core/ directory exists , contains following .py files(and correponding .pyc): -rw-r--r-- 1 root 7.8k jul 16 17:29 _cffi.py -rw-r--r-- 1 root 406 jul 16 17:29 constants.py -rw-r--r-- 1 root 2.2k jul 16 17:29 context.py -rw-r--r-- 1 root 915 jul 16 17:29 devices.py -rw-r--r-- 1 root 551 jul 16 17:29 error.py -rw-r--r-- 1 root 1000 jul 16 17:29 __init__.py -rw-r--r-- 1 root 1.7k jul 16 17:29 message.py -rw-r--r-- 1 root 2.1k jul 16 17:29 _poll.py -rw-r--r-- 1 root 6.8k jul 16 17:29 socket.py -rw-r--r-- 1 root 1.1k jul 16 17:29 stopwatch.py but, there no __pycache__ directory. by poking around cffi python files (in particular verifier.py) found can't f...

dataframe - R Subset data frame and perform function based on columns -

sample data. i'm not sure how use code block system on yet. df <- data.frame(c(1,1,1,2,2,2,3,3,3),c(1990,1991,1992,1990,1991,1992,1990,1991,1992),c(1,2,3,3,2,1,2,1,3)) colnames(df) <- c("id", "year", "value") that generates simple matrix. id year value 1 1990 1 1 1991 2 1 1992 3 2 1990 3 2 1991 2 2 1992 1 3 1990 2 3 1991 1 3 1992 3 i sorting through r subsetting questions, , couldn't figure out second step in ddply function {plyr} applied it. logic: id subgroups, find highest value (which 3) @ earliest time point. i'm confused syntax use here. searching so, think ddply best choice, can't figure out how. ideally, output should vector of unique ids (as 1 selected, entire row taken it. isn't working in r me, best "logic" come with. ddply( (ddply(df,id)), year, which.min(value) ) e.g. id year value 1 1992 3 2 1990 3 3 1992 3 if 3 not...