Posts

Showing posts from May, 2015

spring mvc - Server Sent Event to update collection in Emberjs application on Java EE/jetty -

the application has widget list of items keep changing based on events on server side. server has push these changes browser. the application uses emberjs javascript mvc framework , have managed implement basic update of collection following stock ticker example. ttp://www.xeqtit.com/blog/2012/04/creating-a-stock-ticker-table-using-ember-js. i trying replace following stub/mock calls actual rest calls server. setinterval(function() { quotes.quotescontroller.processchange({ "code": "aapl", "value": (119*math.random()).tofixed(2), "bid": (120*math.random()).tofixed(2), "offer": (118*math.random()).tofixed(2) }); }, 3*1000); replacing with, var source = new eventsource('data/quotes.json'); source.onmessage = function(event){ var data = event.data; quotes.quotescontroller....

c# - How to disable a cell of a GridView row? -

Image
i have gridview control first 2 columns have buttons. when row being created, want check if sixth column text "locked" or not. if yes button in first cell should not visible. the first 2 columns of gridview looks this: you need below hinde button control form cell... protected void gridview1_databound(object sender, gridviewroweventargs e) { if (e.row.rowtype == datacontrolrowtype.datarow) { if (e.row.cells[5].text=="locked") { (e.row.findcontrol("idofbutton1") button).visible=false; } } }

android - How to rotate pixels of bitmap -

i want rotate bitmap 90 degrees in android. , don't want new instance. there way resolve this? have idea: rotate pixels of bitmap. can't it. temp = bitmap.createbitmap(temp, 0, 0, w, h, matrix, false); this works: http://warting.github.com/androidbitmaprotate/ public class rotatebitmapactivity extends activity { imageview iv; private bitmap bitmap; @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.main); bitmap = bitmapfactory.decoderesource(getresources(), r.drawable.ic_launcher); iv = (imageview) findviewbyid(r.id.imageview01); findviewbyid(r.id.left).setonclicklistener(new onclicklistener() { @override public void onclick(view v) { rotate(-90f); } }); findviewbyid(r.id.right).setonclicklistener(new onclicklistener() { @override public vo...

ios5 - Copied blocks and CLANG leak warnings -

i have method takes block: - (void)methodwithblock:(blocktype)block the method starts out copying block , because asynchronous things before using it, , discarded otherwise. calls method within block, , releases it, within block. summarily: - (void)methodwithblock:(blocktype)block { block = [block copy]; [something asyncstuffwithfinishedblock:^{ // .. block(); [block release]; }]; } clang complains memory leaks "block". if remove copy , release statements block gone time it's called -- @ least earlier crashes indicates case. is wrong way things? if so, how should above -- i.e. block callback within block statement in method? can't store block instance variable, method called repeatedly different arguments while asynchronous part happening. first, -copy , -release should unnecessary. -asyncstuffwithfinishedblock: method must copy block that's passed it. when block copied , references other block object...

video - Issue while trying to handle Mediaplayer exceptions in my android application -

i wanted play different formats(like .3gp,.flv ) of videos in android application stored in sdcard. video files of types 1. mp4 , 2. flv, first playing fine, when trying play flv file application, giving error (1, -4 ). same flv file playing fine through native video application(directly gallery). unable handle exception. showing error message on screen. wanted handle exception. 1 please suggest way these problems. code : public class videoplayertest extends activity implements onerrorlistener { videoview view; mediaplayer mp; /** called when activity first created. */ @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.main); view = (videoview) findviewbyid(r.id.videoview); // view.setvideopath("/sdcard/emisodara.mp4"); try { mp = new mediaplayer(); mp....

Deploying PlayFramework Application to Google App Engine -

for new project planning use playframework , google app-engine. trying create sample application in playframework , tried deploy app-engine. it says application deployed successfully, when hit url of application it shows message "your application ready", not show home page of application. i using play framework 1.2 , gae-1.4 plugin. tried deploy application using plugin , using "appcfg". the application works fine in local development mode deploy app-engine, home page replaced "your application ready" message. can u guys tell me if doing wrong deployment of play-framework? tried searching if faced similar kind of issues in both google , not able find help. also, read post gae plugin not work play-framework 2.0( note : using play 1.2 in above example) . know how can deploy play2.0 application in appengine. thanks lot in advance!!! did add application name , version number in appengine-web.xml before deploy?

sql server 2008 - SQL Syntax for selecting the ID column and latest date from two tables -

i have system users can complete 2 types of tests. need list of distinct users sorted date of latest test completion. for purpose tables may set out as: test_users - test_user_id (int) test_1_results - test_1_result_id (int) - test_user_id (int) - date_of_completion (datetime) test_2_results - test_2_result_id (int) - test_user_id (int) - date_of_completion (datetime) i can happily list of different test_user_id 's using union follows: select test_user_id test_1_results union select test_user_id test_2_results and sort results 1 of these tables using order date_of_completion desc not know how union or if best way proceed. ultimately able wrap query within others like: select * test_users test_user_id in ( //the query asking ) some_criteria but far haven't had luck doing while using union , not sure doing wrong. the reason trying admin user needs able view list of has completed tests recent completions @ top. i familiar sql, have never h...

haskell - Understanding a monad instance -

i have haskell code portion: newtype state st = state (st -> (st, a)) instance monad (state state) return x = let f t = (t,x) in state f state f >>= g = state (\oldstate -> let {(newstate, val) = f oldstate; state f'= g val} in f' newstate) i'm new monad think got how return , bind works in general case. but in example above have lots of problems: in monad (state state) state monad's name? how related newtype state ... ? in return x = let f t = (t,x) in state f t comes from? so point you've heard of currying or partial application : if have f :: -> b -> c , x :: a , f x :: b -> c . i.e., if f two-argument function , x has type of f 's first argument, f x function takes second argument , "completes" application. well, in haskell same thing applies type constructors state . types , type constructors have kind , analogous how values have...

php - how to sort this multi-dimensional array -

i trying change output on shopping cart software. believe have found array coming , need sort it. sort() didn't work. used print_r see array, , more dimensions small brain can handle. how sort full currency name? array ( [0] => array ( [id] => usd [text] => dollar ) [1] => array ( [id] => eur [text] => euro ) [2] => array ( [id] => gbp [text] => united kingdom pound ) [3] => array ( [id] => cad [text] => canadian dollar ) [4] => array ( [id] => aud [text] => australian dollar ) [5] => array ( [id] => chf [text] => swiss franc ) [6] => array ( [id] => czk [text] => czech koruna ) [7] => array ( [id] => dkk [text] => danish krone ) [8] => array ( [id] => hkd [text] => hong kong dollar ) [9] => array ( [id] => huf [text] => hungarian forint ) [10] => array ( [id] => jpy [text] => japanese yen ) [11] => array ( [id] => nzd [text] => new zealand dollar ) [12] => array...

android - Live tv channel streaming api -

there lot of live tv apps available in android market.i want make such application. don't know api live tv streaming. youtube provides few number of channels live. there no malayalam , hindi channels. want these types of channels also. is there solution problem? please provide me help.i have searched lot didn't solution. i have doubt can implement server live channel broadcast , if how?

objective c - Draw new UIImage from old UIImage -

Image
i have uiimage bellow i want draw new image bove image video icon , video duration can 1 draw code above or refer blog thx.. in advance if have uiimageview *myimage, can this: uilabel *mylabel = [[uilabel alloc] initwithframe:cgrectmake(x,y,w,h)]; mylabel.text = yourstring; mylabel.backgroundcolor = [uicolor colorwithred:0 green:0 blue:0 alpha:0.2]; [myimage addsubview:mylabel]; [mylabel release]; hope understood question.

javascript - div onclick with Form and other elements -

i want fix problem have attaching onclick element div ( , it! ) please @ following code : <script> function gotoo(url,idd){ alert(idd); if (idd=="onlyme") window.location=url; } </script> <div id="onlyme" onclick="javascript:gotoo('http://www.google.com', this.id)" style="<-index:-150"> <form><input type="text" name="coap"></form> <h3>this element click should work!</h3> <div id="notme"> <h3>in point should not work!</h3> </div> </div> i want onlick triggered in div clicking. please check example live @ http://modacalcio.com/htmlproblemform.html the click triggered everywhere, expecially in form input. obiovusly wish use without deleting onclick in children nodes, have own onclick still need work also jquery have same problem help? $('#onlyme').on('click', function(evt) { if ($(e...

Dynamically add Views in "ViewContainer" in ASP.NET MVC -

i trying make following layout: http://i.imgur.com/js8ho.png (i cannot put image directly because of spam rules.) want use layout file loads headerview, sidebarcontainerview , contentcontainerview. controller needs add datagrid sidebarcontainerview. when click on row in dataview chartview has open inside contentcontainerview. problem adding dynamically view inside contentcontainerview. tried html.renderpartialview , sections don't result want. i'm in beginner stage of learning mvc 4.0 might easy question google doesn't seem know answer. thanks in advance <div id="contentcontainerview"> </div> in sidebarcontainerview: you should bind row click event function: function addchart(charttype) { $.getjson("/mycontroller/addchart", { charttype: charttype }, function (data) { $('#contentcontainerview').append(data); }); } data here partial chart view, appended contentcontainervie...

agile - Atlassian GreenHopper and Release Management -

Image
we playing around atlassian products , have prepared agile sprint using greenhopper, , little confused flow. here how doing current development @ office: 1. developers completes issues assigned them. mark them resolved. 2. once issues sprint complete have release ticket provides release details , assign inf team build , deploy in qa. if things approved in qa moved staging, produciton. 3. if issues found or of issues not resolved reject release , assign devs. , devs correct them , prepare release. does have suggestions on achieving similar jira+greenhopper or better ideas. thanks in advance. we pretty similar here, , works within jira / greenhopper: product owner creates epics / themes / user stories in jira/grasshopper backlog grooming occurs, story thrashed out bit, , story points entered user story sprint planning: stories selected upcoming sprint, , using greenhopper, create add stories sprint. see below sprint begins.. tasks created in jira ...

Parsing data from XML file with multiple of same name attributes in PHP -

i trying parse data xml below (i shortened data lot give example of data looks like). for each attribute, need store data in separate array. xml file <report> <title>resolution times (jun 07 00:21)</title> <sets> <set> <legend>solved in less 2 hours</legend> <values> <value data="8702" date="2012-05-24"/> <value data="8741" date="2012-05-25"/> <value data="8741" date="2012-05-26"/> <value data="8741" date="2012-05-27"/> </values> </set> <set> <legend>solved in less 24 hours</legend> <values> <value data="36990" date="2012-05-24"/> <value data="37094" date="2012-05...

html - CSS let text go over image -

Image
you know how tekst (paragraphs) wrap around floated image, so? [see img] i tekst go on image. in example img below. tried using z-index , display:inline neither worked. this not actual html, looks like; <img src="" alt="" style="float:right;" /> <p>lorem ipsum dolor sit amet, consectetur adipiscing elit. nulla sed eros tellus, sit amet ultrices quam. sed quis justo metus, quis gravida orci. vivamus porttitor fringilla massa @ luctus. quisque lacinia diam eget justo tempor vehicula. nulla fringilla libero sit amet tortor bibendum imperdiet. pellentesque in risus vel libero pellentesque hendrerit. suspendisse vehicula fermentum pretium. sed elementum eleifend dolor nec aliquam. nam ac viverra dolor. vivamus vitae ultricies velit.</p> try: <div style="position: relative;"> <img src="" alt="" style="position: absolute; top: 0px; right: 0px;" /> <p>lorem ips...

javascript - Auto Format Phone Number in Jquery -

i have 1 textbox phone number. phone number should xxx-xxx-xxx format. i got solution xxx-xxx-xxx format, don't know how modify code. $('#ssn').keyup(function() { var val = this.value.replace(/\d/g, ''); var newval = ''; while (val.length > 3) { newval += val.substr(0, 3) + '-'; val = val.substr(3); } newval += val; this.value = newval; }); http://jsfiddle.net/ssthil/ny2qt/ since you're using jquery can try jquery masked-input-plugin . there's jsfiddle here can see how works. the source code project on github can found here . the implementation more simple: html: <input id="ssn"/> javascript: $("#ssn").mask("999-999-999"); update : another 1 can found here .

android - To set the clickable list -

i have written code set list,now want clickable list how it.when clicking on perticular item should clickable.whan clicking on trxtview action should happen , when clicking on button action should happen. my code is public class downloadlist extends listactivity { private list<string> item = null; private list<string> path = null; private string root="/sdcard"; private textview mypath; listview lv1; public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.mydownload); mypath = (textview)findviewbyid(r.id.path); lv1=(listview)findviewbyid(r.id.list); getdir(root); } private void getdir(string dirpath) { mypath.settext("location: " + dirpath); item = new arraylist<string>()...

xml - How to calculate sum of nodes, with different number format in xsl? -

i have following xml structure: <example> <data> <numberger>3,40</numberger> </data> <data> <numberger>7,40</numberger> </data> <data> <numberger>17,40</numberger> </data> </example> i need sum of "numberger" nodes. formatting of number problem. because of use of "," function "sum" produces error. sum(//numberger) not work. can use xslt 2.0 functions. i think need write recursive template, takes computed value , list of nodes. something like: <xsl:template name="addgernumbers"> <xsl:param name="number"/> <xsl:param name="nodes"/> <xsl:choose> <xsl:when test="$nodes"> <xsl:variable name="recursive_result"> ... <xsl:call-template name="addgernumbers"> ...

Ruby: search for a partial match in an inverted index -

i need search partial match in inverted index, following code works exact matches not partial. reworked example @ http://rosettacode.org/wiki/inverted_index (which no longer works in ruby1.9.3) how efficient way please ? please no advise using lucene, sphinx etc unless know lightweight, simple , pure ruby solution, want myself. @data = {"contents"=>["1.txt", "2.txt"], "of"=>["1.txt", "2.txt"], "file"=>["1.txt", "2.txt"], "one"=>["1.txt"], "two"=>["2.txt"]} def search words result = [] words.each |word| result << @data[word] if @data[word] #should partial match end result end p search ['of'] #=> [["1.txt", "2.txt"]] p search ['one'] #=> [["1.txt"]] p search ['on'] #=> [] <<should become [["1.txt"]] define sear...

c# - Entity Framework 1:1 Relationship Identity Colums -

i cannot life of me 2 separate tables save relationship , 2 identity columns. keep getting errors dependent property in referentialconstraint mapped store-generated column. column: 'olsterminalid'. can't imagine setup abnormal. [datacontract] public class olsdata { private static readonly datetime theunixepoch = new datetime(1970, 1, 1, 0, 0, 0, 0, datetimekind.utc); [databasegenerated(databasegeneratedoption.identity)] public int olsdataid { get; set; } [datamember(name = "id")] public int id { get; set; } public datetime timestamp { get; set; } [datamember(name = "created")] [notmapped] public double created { { return (timestamp - theunixepoch).totalmilliseconds; } set { timestamp = theunixepoch.addmilliseconds(value); } } [inverseproperty("olsdata")] [datamember(name = "terminal")] public virtual olsterminal olsterminal { get; set; } } [datacon...

copying or renaming an android project in eclipse -

iv'e tried copy , paste project in same workspace. project gets copied doesn't run on device. if leave default name e.g "copy of myproject" works. if try rename using refractor option project shows error: "android requires compiler compliance level 5.0 or 6.0. found '1.7' instead. please use android tools > fix project properties.." when fix project suggested fails load device go project properties file , change project name , clean , build project.it should work then

Effect not working in ajax call -

i have code in ajax: $.ajax({ url : "<?php echo site_url('user/add'); ?>", type : 'post', data : form_data, success : function(msg) { $('#bid-form-part').html(msg).effect("pulsate", { times:3 }, 2000); } }); it shows html have send via ajax. thats fine, effect pulsate not working @ ;) any suggestion doing wrong? i want new content blink once or few times, code must wrong or something. thanks in advance. according jquery api, there isn't function called effect, try replacing few fade outs , fade ins see if work instead? e.g. $('#bid-form-part').html(msg).fadeout(200).fadein(200).fadeout(200).fadein(200).fadeout(200).fadein(200); its bit long winded, allows see if going work! i have used comment, apparently rep isn...

AESObfuscator for Android Licensing -

i'm using aesobfuscator in servermanagedpolicy android licensing. until now, i've created deviceid this: string deviceid = secure.getstring( getcontentresolver(), secure.android_id ); in examples on internet done this, stated isn't safe, no other way described. have read android_id can changed or can null, want have way unique id. licensing failed more once has bought app , i'm quite sure has this, otherwise can problem google, doubt. so how can this? create random hash , add deviceid (and of course store somewhere..?) what mean 'safe'? it's matter of obfuscating preferences make harder edit on rooted device. android_id can change if reset device (delete data), or if edits on rooted device. first case not problem, in second, won't able decrypt(de-obfuscate) stored preferences, treat error. if null, should think of sort of fallback value. the point here not have unique id, use device-specific data obfuscate preferences, cannot copy th...

android - Showing DialogFragment -

i have class activityexitdialogfragment extends android.support.v4.app.dialogfragment. there 2 methods in activityexitdialogfragment, oncreatedialog , newinstance new instance of activityexitdialogfragment. here are: public dialog oncreatedialog(bundle savedinstancestate) { string title = getarguments().getstring("title"); dialog mydialog = new alertdialog.builder(getactivity()) .seticon(r.drawable.ic_launcher) .settitle(title) .setnegativebutton("no", new dialoginterface.onclicklistener() { @override public void onclick(dialoginterface dialog, int which) { // dismiss dialog. dismiss(); } }) .setpositivebutton("yes", new dialoginterface.onclicklistener() { @override public void onclick(dialoginterface dialog, int which) { // close activity. getactivity().finish(); } }).create(); return mydialog; } static activityexitdialogfragment newinstance(string message) { activityexitdialogfragm...

android - ArrayAdapter throwing ArrayIndexOutOfBoundsException -

i getting arrayoutofbounds exception when using custom array adapter. i wondering if there coding errors have overlooked. here error log: 06-10 20:21:53.254: e/androidruntime(315): fatal exception: main 06-10 20:21:53.254: e/androidruntime(315): java.lang.runtimeexception: unable start activity componentinfo{alex.android.galaxy.tab.latest/alex.android.galaxy.tab.latest.basic_db_output}: java.lang.arrayindexoutofboundsexception 06-10 20:21:53.254: e/androidruntime(315): @ android.app.activitythread.performlaunchactivity(activitythread.java:2663) 06-10 20:21:53.254: e/androidruntime(315): @ android.app.activitythread.handlelaunchactivity(activitythread.java:2679) 06-10 20:21:53.254: e/androidruntime(315): @ android.app.activitythread.access$2300(activitythread.java:125) 06-10 20:21:53.254: e/androidruntime(315): @ android.app.activitythread$h.handlemessage(activitythread.java:2033) 06-10 20:21:53.254: e/androidruntime(315): @ android.os.handler.dispatchmessage(handler.java...

php - Hi. My Uploadify script don't see are $_SESSION -

function usersingin( ) { $login = common::getglobals('userlogin'); $pass = common::getglobals('userpassword'); $reg = false; $users = $this->db->get("select userid, userlogin, userpassword users"); foreach( $users $_users ) { if( $_users->userlogin == $login && $_users->userpassword == md5( $pass ) ) { //$sess->set('userhash', md5( $login.$pass.$salt ) ); session::set('uid', $_users->userid ); // set userid $reg = true; } } echo $reg ? "ok" : "error"; } ================================================= $(function() { $('#file_upload').uploadify( { 'filesizelimit' : '1000kb', 'queuesizelimit' : 1, 'filetypedesc' : ...

ruby on rails - Retrieve default belongs_to record from a built has_many association in a before_create hook? -

i have 2 models, user , stash . a user has many stashes, , default_stash. stash has 1 owner (user). before user created want build stash , assign stash self.default_stash. per instructions here rails - best-practice: how create dependent has_one relations created stash relation, cannot 'create' belongs_to relation @ same time. user.rb has_many :stashes, foreign_key: :owner_id belongs_to :default_stash, class_name: 'stash', foreign_key: :owner_id before_create :build_default_stash def build_default_stash self.default_stash = stashes.build true end stash.rb belongs_to :owner, class_name: 'user' at point stash can found in user.stashes user.default_stash remains nil, stashes.build not return id in before_create block. what need can achieved adding following user.rb after_create :force_assign_default_stash def force_assign_default_stash update_attribute(:default_stash, stashes.first) end but i'd prefer keep within before_creat...

javascript - Calling function from within Knockout Observable Array -

i have knockout observable array wish edit within javascript , html well. here code: var listmodel = function(formula) { var self = this; self.formula = ko.observablearray(formula); this.mergeequation = function(op) { if (op.type == "ins") { self.formula.splice(op.position, 0, op.value); } else if (op.type == "del") { self.formula.splice(op.position, 1); } else { console.info("no match: " + op.value + op.position); } }; }; my variable op json string. know how call mergeequation function using html data-bind, how do within same js file? current code goes this: ko.applybindings(new listmodel(formula)); //... //initializing of json object called op //... if (something) { mergeequation(op); } but doesn't work. missing out step here? i've read on functions , extenders both seems overkill i'm trying here. ps: here's sample of json structure i'm working with: {"type":...

ios - UINavigationController, how to hide tabbar in second level viewController then show tabbar in third level viewController -

here piece of code, in way, when push third level view controller, tabbar won't show. //at first level secondlevelviewcontroller *_2vc = [[secondlevelviewcontroller alloc]initwithnibname:@"secondlevelviewcontroller" bundle:nil]; _2vc.hidesbottombarwhenpushed = yes; [self.navigationcontroller pushviewcontroller:_2vc animated:yes]; //at second level thirdlevelviewcontroller *_3vc = [[thirdlevelviewcontroller alloc]initwithnibname:@"thirdlevelviewcontroller" bundle:nil]; _3vc.hidesbottombarwhenpushed = no; [self.navigationcontroller pushviewcontroller:_3vc animated:yes]; instead of setting values of hidesbottombarwhenpushed when initialise view controllers, should instead handle hiding mechanism in -(void)viewwillappear:(bool)animated in view controllers instead. an example of implementation be: in secondlevelviewcontroller.m -(void)viewwillappear:(bool)animated { [_bottombar sethidden:yes]; } in thirdlevelviewcontrolle...

javascript - Rotate objects around a point -

i'm working on 3d "cloud" consists of div elements. these div elements should rotate around point. works charme on x-axis can't working on y-axis too. i've put important things jsfiddle project: http://jsfiddle.net/lggdq/19/ if click , move mouse, items rotating. how can work on y-axis (the items moving not want them do)? items should rotate on x-axis. thanks in advance

statistics - How to read large files(with rownames) with scan in this situation in R? -

i have text file 1000 row * 40001 column table. the first column of file string , other columns float numbers, such this: a 2 3 4.54 .... 11.23 b 6 6 7 .... 23.45 i want read file matice read.table seems not efficient large files, think scan may right tool that? however, scan can accept numbers input default. if want non-number input, need change what parameter. there're 40000+ columns, can't assign type of input each input.. does know how use it? thanks! you use what argument , specify list of types (like colclasses ). lines <- "a 2 3 4.54 11.23 b 6 6 7 23.45" data <- (scan(textconnection(lines), what=c(list(null), rep(0,4)))) (data <- do.call(cbind, data)) # [,1] [,2] [,3] [,4] # [1,] 2 3 4.54 11.23 # [2,] 6 6 7.00 23.45

A step by step guide to easily send OpenCV C++ variables to Matlab -

i want able send opencv variables matlab in order plot graphs , calculate statistics in confortable way. i know have use matlab engine, there little on web how make accessible part of code, or functions convert cv::mat matlab arrays, or how deal column-major , row-major in specific case. i think step step procedure opencv-to-matlab interesting since opencv becoming popular , matlab helps lot debugging. step step sending data opencv matlab 1.- including , linking libraries the neccesary headers working matlab engine "engine.h" , "mex.h" . include path this: c:\program files (x86\matlab\r2010a\extern\include) in additional dependencies should add: libeng.lib , libmex.lib , libmx.lib . the easiest way set project using cmake, need write lines find_package( matlab required ) include_directories( ${matlab_include_dir}) cmake set paths , link needed libraries. using environment variables make project user-independent. tha...

java - External configuration of non controller or taglib classes -

i'm trying create external configuration non controller or taglib class because values need change without recompile. configurationholder , applicationholder deprecated options this? i've done 3 hours of googling , seems thing has come since classes have been deprecated using di. however, need configuration external of war file somehow don't know if me unless i'm missing something? thanks based on response got js3v recommend looking @ settings plugin . gives nice way enter these types of items , basic crud interface manage them. can have string, integer, date , bigdecimal types. can create names segment them (like admin.email.defaultgreeting , or banking.defaultinterestrate ) , access them in gsp's or controllers/services/domain classes this: //gsp <g:setting valuefor="admin.email.defaultgreeting" default="hello!" encodeas="html"/> //other import org.grails.plugins.settings.* setting.valuefor("admin.ema...

html - form not showing up correctly (weird spacing) in a table -

Image
i have form inside div inside td. if put div outside table, renders fine, when put inside table, spacing appears @ top , bottom. form correct size, wrapping div adcopyinlineeditcontainer randomly has more height if give height auto. <div class="inlineeditcustomholder blueborder" style="top: 0px; left: 102px;"><div class="adcopyinlineeditcontainer" style=""> <form method="post" class="adcopyinlineedit"> <input type="text" data-linetype="title" maxlength="25" data-maxlength="25" class="colorblue"> <div class="counter"> <span class="ad_title_counter">0</span>/25</div> <br> <input type="text" data-linetype="desc1" maxlength="35" data-maxlength="35" class="color...

Command line tool to apply suggestions provided by PHP Codesniffer -

i looking command line tool applies code formatting suggestions provided php codesniffer code base. there cool tools php codesniffer plugin eclipse in use case need batch process rather manual task. while there isn't directly fix issues reported php_codesniffer, there unrelated project tries fix issues rather report on them. in particular, tries make code conform new psr-1 , psr-2 standards, php_codesniffer adding support @ moment. it's not going fix everything, close going fixing issues: https://github.com/fabpot/php-cs-fixer however, recommend not running batch fixing tools on codebase. if want code conform coding standard, need learn , fix errors on time. there no reason fix in 1 hit, , doing automated tool is, in experience, best way break codebase.

c++ - Maybe bug in rapidxml - but I'm not sure how to fix -

i noticed rapidxml parses illegal <<element/> element named <element , instead of producing error. i think problem definition of lookup_node_name . comment is // node name (anything space \n \r \t / > ? \0) what understand w3.org specification name can have letters, numbers, , few other characters. i'm not sure correct fix. suggestions? from looking @ rapidxml code, lookup_node_name lookup table of valid name characters, , comment says, specific few prohibited. i'd try adding '< list of prohibited characters setting lookup entry ascii char 0x3c 0 1. ie, on line relating chars 0x30..0x3f, change this... // 0 1 2 3 4 5 6 7 8 9 b c d e f ... 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, // 3 to this: 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 0, // 3 that may work you, haven't tried it. see you've tried contact developer via sou...

fm application in eclipse for android -

i have got problem in line below. <uses-permission android:name="android.permission.modify_audio_settings"></uses-permission> the error says tag appears after tag. in tutorial,the above line mentioned after application tag , application correct. how solve error? here how manifest structure should look. if have <uses-permission> tag inside <application> tag, move out there. that said, should post more code and/or information ( but relevant parts! ) or neigh impossible find right solution without guessing.

performance - Calculation of system response time -

i've developed software , i'm going monitor performance of system, system working well, except in periods of working faces slowness. have prepared o log related system response , time response has been generated, log time below: process#1 step1: 300 millisecond step2: 700 milliseconds step 3: 10 millisecond process#2 step1: 10 millisecond step2: 50 milliseconds step 3: 4 milliseconds process#3 step1:2 millisecond step2: 40 milliseconds step 3: 80 milliseconds now want detect process has suspicious response time, rule in concepts of software engineering? mean have tried values greater average + 3* standard deviation, did not work, few data has been marked know data more 100 millisecond not normal rule purpose in software engineering, how detect bottle neck of system? there's no real rule of thumb finding bottlenecks. rule is, measure objectively parts of application slow, , have definitive answer. much engineering time was...

sql - How do I use an INSERT statement's OUTPUT clause to get the identity value? -

if have insert statement such as: insert mytable ( name, address, phoneno ) values ( 'yatrix', '1234 address stuff', '1112223333' ) how set @var int new row's identity value (called id ) using output clause? i've seen samples of putting inserted.name table variables, example, can't non-table variable. i've tried ouput inserted.id @var , set @var = inserted.id , neither have worked. thanks in advance. you can either have newly inserted id being output ssms console this: insert mytable(name, address, phoneno) output inserted.id values ('yatrix', '1234 address stuff', '1112223333') you can use e.g. c#, when need id calling app - execute sql query .executescalar() (instead of .executenonquery() ) read resulting id back. or if need capture newly inserted id inside t-sql (e.g. later further processing), need create table variable: declare @outputtbl table (id int) insert mytable(...

Why is my building in Java not drawing properly? -

i'm trying draw rectangle stylized edge on it, unfortunately edge covers left , top sides. public graphics2d draw(graphics2d b, long camerax, long cameray) { //let's drawing stuff, yay renderimage = new bufferedimage(width, height, bufferedimage.type_int_argb); graphics2d g = renderimage.creategraphics(); int[] xps= new int[pointsarray.length]; int[] yps= new int[pointsarray.length]; int i=0; (pair p:pointsarray){ xps[i]=p.pair[0]; yps[i]=p.pair[1]; i++; } g.setcolor(color); g.fillpolygon(xps, yps, xps.length); g.setcolor(color.darker()); g.drawpolygon(xps, yps, xps.length); b = super.draw(b, camerax, cameray); return b; } yes, it's polygon. have keep extendable. edit: pointsarray looks now. pointsarray = new pair[4]; pointsarray[0] = new pair(0,0); pointsarray[1] = new pair(0,height); pointsarray[2] = new pair(width,height); pointsarray[3] = new pair(width,0); ...

javascript - Google Map API V3 - Click on Marker show more info content as overlay (like in Google Maps) -

we use google map api v3 load google map in html container. have location search form. on submit, available locations , set markers in map. once markers loaded, on click on each marker need show title, address details , design have in google map. (in google maps - when clicking on red marker, can see more info overlay box additional details stars, directions, search nearby, save map, more..) do have built in api function load overlay box above. or don't have function load details have in google map currently. when searched in google , map docs, can see options show overlay window , write content inside box. didn't see options load content required. i have pasted code below reference. var map = null; gmap_ready = function (){ var mylatlng = new google.maps.latlng(43.834527,-103.564457); var myoptions = { zoom: 3, center: mylatlng, maptypeid: google.maps.maptypeid.roadmap } map = new google.maps.map(document.getelementb...

html - How to make complex form on table and avoid nesting <form> elements -

i'm going ask stupidest question you've ever heard (shame on me). want make write markup table should this: ============================================================ | layout | date edited | actions | active | default | ============================================================ | lauout1 | 04.05.2012 |[delete] | [ ] | o | ... fourth , fifth columns contain check box , radio button correspondingly , third got button. button submission should proceed 1 page on site , check box radio - other one. according question can't place 1 element inside one! mean 1 global around whole table , 1 around each delete button. think i'm going awful.. right solution? you still can use 1 form element whole table inside it, , put many submit buttons deletes want. name of each button sent script value on it. example: <form method="post"> <!-- table ... --> <!-- first item ... --> <input type="submit...

PHP Arrays - Separate Identical Values -

is there or standard way of doing this? take following example: $values = array( 'blue' , 'blue' , 'blue' , 'blue' , 'green' , 'red' , 'yellow' , 'yellow' , 'purple' , 'purple' , 'purple' ); i need separated no 2 identical values touching (unless there no possible solution -- in case either generating error, returning false or else acceptable). here's above array (done hand) how trying change it: $values = array( 'blue' , 'purple' , 'green' , 'purple' , 'blue' , 'red' , 'blue' , 'yellow' , 'blue' , 'yellow' , 'purple' ) the values won't in order in beginning -- simplicities sake. any ideas? code me started in right direction? this function should trick: function uniq_sort($arr){ if...

Minor glitch in running Struts2 helloWorld tutorials [TOMCAT] -

i'm trying run helloworld tutorials struts2 in eclipse indigo. when start tomcat server, following message in console window. highlighted bit 1 i'm not able understand. jun 13, 2012 1:12:28 pm org.apache.catalina.core.aprlifecyclelistener init **info: apr based apache tomcat native library allows optimal performance in production environments not found on java.library.path: c:\program files\java\jre7\bin;c:\windows\sun\java\bin;c:\windows\system32;c:\windows;c:\windows\system32;** **jun 13, 2012 1:12:28 pm org.apache.tomcat.util.digester.setpropertiesrule begin warning: [setpropertiesrule]{server/service/engine/host/context} setting property 'source' 'org.eclipse.jst.jee.server:strutsexample1' did not find matching property.** jun 13, 2012 1:12:28 pm org.apache.coyote.abstractprotocol init info: initializing protocolhandler ["http-bio-8080"] jun 13, 2012 1:12:28 pm org.apache.coyote.abstractprotocol init info: initializing protocolhandle...

android - Single Configuration Activity for multiple Homescreen Widgets -

i have 1 configuration activity different hoomescreen widgets android app. i widgetid in configuration activity this: widgetid = extras.getint( appwidgetmanager.extra_appwidget_id, appwidgetmanager.invalid_appwidget_id); but later in code want know widgetprovider class has called configuration activity. how can this? p.s. i've found answer: appwidgetmanager appwidgetmanager = appwidgetmanager.getinstance(context); appwidgetproviderinfo appwidgetmanager.getappwidgetinfo(widgetid);

cuda - thrust::sequence - how to increase the step after each N elements -

i using thrust::sequence(myvector.begin(), myvector.end(), 0, 1) and achieve ordered list like: 0, 1, 2, 3, 4 my question how can achieve such list below (the best way?) 0, 0, 0, 1, 1, 1, 2, 2 ,2, 3, 3, 3 i know how make functors, please not try answer functor. want learn if there optimized way in thrust, or missing simple way.. something this: thrust::device_vector<int> myvector(n); thrust::transform( thrust::make_counting_iterator(0), thrust::make_counting_iterator(n), thrust::make_constant_iterator(3), myvector.begin(), thrust::divides<int>() ); (disclaimer, written in browser, never compiled or tested, use @ own risk) should give sequence looking computing [0..n]//3 , outputting result on myvector . seeing having trouble compiling version, here complete example compiles , runs: #include <thrust/device_vector.h> #include <thrust/transform.h> #inc...

java - Images in Eclipse CustomizableIntroPart are not shown -

i'm creating customizableintropart eclipse application. define pages using xhtml works fine. handling images causing trouble. generate content using iintroxhtmlcontentprovider, when generate img-tag , set src attribute images not displayed. images might either in executing or in other plugins contributing xhtml page. element img = dom.createelement("img"); img.setattribute("src", getapplicationicon(element)); img.setattribute("class", "appicon"); div.appendchild(img); i couldn't find documentation on how specify source. tried things like plugin:my.plugin.id/icons/foo.png any appreciated. in end, it's web browser display xhtml content , has no notion of "contributed plugins" right? but using code process these contributions, , they're coming either plugin or other plugins? if that's case, i'd use org.osgi.framework.bundle.getentry(string) url image, , org.eclipse.core.runtime.filelocator....

android - How to send an ordered broadcast in a PendingIntent? -

i want send ordered broadcast in pendingintent. i've found pendingintent.getbroadcast(this, 0, intent, 0) , think can send regular broadcast. so, can do? i got http://justanapplication.wordpress.com/tag/pendingintent-getbroadcast : if onfinished argument not null ordered broadcast performed. so might want try calling pendingintent.send onfinished argument set. however, ran problem had send orderedbroadcast notification. got working creating broadcastreceiver forwards intent orderedbroadcast. don't know whether solution. so started out creating intent holds name of action forward extra: // name of action of our orderedbroadcast forwarder intent intent = new intent("com.youapp.forward_as_ordered_broadcast"); // name of action send orderedbroadcast intent.putextra(orderedbroadcastforwarder.action_name, "com.youapp.some_action"); intent.putextra("some_extra", "123"); // etc. in case passed pendingintent notificat...

multithreading - how much memory a thread takes in java -

how memory foot print normal thread takes in java. assuming there no object associated it. the amount of memory allocated thread stack specific jvm version + operating system. configured -xx:threadstacksize option (-xss on older versions.) anecdotally 512kb "normal", although 1024 on 64-bit linux platform it's commonly critical (one guy's opinion anyway)

jquery - How to set masonryhorizontal layout in Isotope -

i'm newbie when comes jquery, i'm editing scripts through modifications. used isotope experiment , here's result: http://rvflores.com/sm-scroll/ i need container appear in masonryhorizontal layout mode without me having click on button on top part change it. read documentation can't seem find how set it, copied script website. any , suggestions welcome, thank :) for missed actual answer in comments: the documentation masonryhorixontal missing layoutmode property. correct code be: $('#container').isotope({ layoutmode: 'masonryhorizontal', masonryhorizontal: { rowheight: 360 } }); this issue cause of this question .

c# - How to check if Azure Blob file Exists or Not -

i want check particular file exist in azure blob storage. possible check specifying it's file name? each time got file not found error. this extension method should you: public static class blobextensions { public static bool exists(this cloudblob blob) { try { blob.fetchattributes(); return true; } catch (storageclientexception e) { if (e.errorcode == storageerrorcode.resourcenotfound) { return false; } else { throw; } } } } usage: static void main(string[] args) { var blob = cloudstorageaccount.developmentstorageaccount .createcloudblobclient().getblobreference(args[0]); // or cloudstorageaccount.parse("<your connection string>") if (blob.exists()) { console.writeline("the blob exists!"); } else { c...

c# - MonoDroid JQueryUI or HTML -

i developing app using monodroid (c#) , wanted looking ui controls (ex: jquery). not sure if possible!! don't see samples , tried google it.. i found link: http://developers.de/blogs/damir_dobric/archive/2011/09/18/how-to-include-jquery-mobile-in-monodroid-project.aspx author said won't work in android. any suggestions? have got chance @ jquery mobile? http://jquerymobile.com/ that might tool looking for.

json - How to retrieve error message from xOptions in jquery-jsonp library -

i using 2.3.1.min version of jquery-jsonp library found here: https://github.com/jaubourg/jquery-jsonp , works expected, namely error function fires when error occurs. however, cannot seem display error encountered. checked docs on github project not find answer. is limitation? or not calling right object? my implementation.. the url parameter below set return 404 page on purpose. chrome dev tools shows 404 response, cannot seem capture result.. <script type="text/javascript"> $.jsonp({ url: 'http://apps.mydomain.com/service/nonexistant?&max=4&format=json', callbackparameter: "callback", error: function(xoptions, textstatus){ // lines returns "error" console.log(textstatus); // returns object (but expanding reveals no indication of error code / message) console.log(xoptions);...