Posts

Showing posts from January, 2013

android - ActionBar: Swipe between tabs -

i make possible swipe between tabs in app. have found plenty tutorials this, can't work code, because use different code. myactivity.class: public class myactivity extends activity { @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.main); final actionbar actionbar = getactionbar(); actionbar.setnavigationmode(actionbar.navigation_mode_tabs); actionbar.tab taba = actionbar.newtab(); taba.seticon(r.drawable.icon_settings); actionbar.setdisplayshowhomeenabled(false); actionbar.setdisplayshowtitleenabled(false); taba.settext(""); taba.settablistener(new com.example.mainactivity.tablistener<tab1>(this, "tab1", tab1.class)); actionbar.addtab(taba); tab tabb = actionbar.newtab(); tabb.settext("tab2"); tabb.settablistener(new com.example....

ruby on rails - RSpec: should have_content can't find text -

i have following page <ul class="account_menu dropdown-menu"> <li class="divider"></li> <li class="current"><span>my account</span></li> <li class="account"><a href="#">account-1 (editor)</a></li> </ul> testing cucumber using step within(scope) page.should have_content(content) end test passes when content = 'account-1' , fails content = 'my account'. scope both cases 'account_menu' and should see "my account" within account menu expected find text "my account" in "my accountaccount-1 (editor)" (rspec::expectations::expectationnotmeterror) rails 3.2.17 rspec-rails 2.14.1 capybara 2.1.0 why can't find 'my account' text? thanks have_content ends concatenating content in unexpected ways. in case <li class="current"><span>my account...

javascript - Passing value instead of whole object with ng-options -

Image
i'm parsing .json file , showing available options in select: <div bo-switch-when="dropdown"> <fieldset> <select ng-options="options.text option in question.body.options" ng-model="question.answer" ></select> </fieldset> </div> it working, not want to. instead of getting whole object model, want have value of object. via chrome dev tools: this object (as in picture) in model. i want have text. but when change ng-options this: ng-options="options.text option.text in question.body.options" it isn't working @ all... this pretty common question among angular developers. you can use ng-repeat , so: <select ng-model="question.answer" > <option ng-repeat="option in question.body.options" value="{{option.text}}">{{option.text}}</option> </select>

java - Single Logout Profile Idp Logout Issue -

i using saml2.0 single logout profile. when sp initiated logout happens, logoutrequest sent request initiator sp ping (identity provider), ping sends sp logoutresponse . sp ends session after response, idp session not terminated. @ time user session idp terminated? before sp session or after session? right doing local logout, want global logout terminated sps session , idp session. in sp-initialized singlelogout idp sends logoutrespone original requester after has terminated sessions other session participants. once you've received logoutresponse , idp session supposed terminated. does logoutresponse receive contain success status code? binding using?

node.js - why npm checked for so many dependencies for single package -

i running npm install install 1 package called generator-angular npm install --global generator-angular you have no idea how many dependencies npm have checked, still rolling pick few npm http https://registry.npmjs.org/generator-angular npm http 304 https://registry.npmjs.org/generator-angular .... npm http 304 https://registry.npmjs.org/diff npm http 304 https://registry.npmjs.org/strip-ansi are these dependencies ? diff ansi ? or making mistakes ? yes, real dependencies. generator-angular particularly heavy module. one thing note many of them "peer dependencies". means installed next to, rather inside, generator-angular . allows them shared application other modules peer dependencies. in addition generator-angular , getting access generator-karma , grunt-cli , bower , , yo . if depending on of these already, make sure installing of modules in same place don't installed multiple times.

php - How do I pass isset value to multiple views with codeigniter -

i have isset() value calculate raw count , displays count in admin_messages.php page want pass same value view_home.php how can that? here view <li> <a href="#"> <i class="icon-home"></i> inbox <strong><?php if(isset($count)){echo $count;}?></strong> </a> </li> here controller function messages() { $data['records'] = $this->mod_contactus->get_records(); $data['count'] =$this->mod_contactus->message_count(); $this->load->view('admin/admin_messages',$data); } the controller friend here. try - uses magic method __construct() . edit suit needs. <?php class mycontroller extends ci_controller { private $message_count = 0; // code called here executed when class initialised, don't forget call parent::__construct(); execute codeigniter init code too. public function __construct() { paren...

php - Symfony - how to generate url with parameters in controller -

i want generate url ../profile/firstname.lastname but don't understand how can because want in php id user. this controller: $controllers ->match('profile/{firstname.lastname}/', array($this, 'profile')) ->assert('userid', '\d+') ->method('get|post') ->before(array($this, 'checklogin')) ->bind('home.profile'); you have build route this <route id="profile" path="/profile/{first_name}.{last_name}"> <default key="_controller">...</default> </route> and in controller create this $this->generateurl('profile', [ 'first_name' => 'skowron', 'last_name' => 'line' ]); but if have 2 profiles same data give bad results. can create slug or add id parameter route

ant - Custom build Android app from command line -

i'm trying make batch file commands, once runs, change strings in files, build project , generate apk signed. strings need change are: - package name (com.company.project) - images (like icons, splash screen, ...) - irrelevant string specific app. for last 2 things know how it, package name feel there wrong find , replace occurrences of string in root folder of app (including subdirectories). is there way or command ant has doing this? also ran issue while running command ant release . went root folder, ran command , gets errors. had go eclipse, clean project , let autobuild (with no generation of apk since when try run on device) @ point bin folder contains folders: classes, dexedlibs, res , manifest.xml file. then can go cl , run ant release . there way cl? clean , build can run ant release command after no issues? note: find , replace use .exe called fnr job edit: i'm using gradle , can build changing package name there still few things want in build.gra...

sql - Query causing values to not be included -

in following looking value in legacy database company has. select distinct dlr.circuit_design_id "cid", dlr.ecckt "circuit", ci.location_id_2 "site id", ci.exchange_carrier_circuit_id "id", ci.rate_code "rate", dlr.access_customer_name "customer site name", adr.house_nbr || ' ' || adr.street_nm || ' ' || adr.street_suf || ' ' || adr.city_name || ' ' || adr.state_code || ' ' || adr.zip_code "customer address" design_layout_report dlr, circuit ci, msag_addr_loc adr ci.circuit_design_id = dlr.circuit_design_id , ci.location_id_2 = adr.location_id , ci.circuit_design_id in ( select distinct circuit_design_id dlr_circuit_design_line location '% <some value other code>...

Using YouTube Player API in Chrome App? -

i'm trying use youtube player api inside chrome packaged app no luck, apparently can't load external content in way other using webview tag , can't change content security policy settings (unlike chrome extensions) - there way achieve that? i'm sure webview way this, , knowledge there isn't other way. if explain why in app webview isn't workable approach.

objective c - Odd issues with int and NSInteger -

have spent several hours on , sure i'm missing obvious. i'm new cocoa/objective c , rusty pointers / objects, , appreciate (kindly!) pointing out i'm going wrong. here code: .h file: @property (assign) nsinteger *freetrialcounter; .m file nsinteger = 2; self.freetrialcounter = &(a); nslog(@"free trial counter: %d", *self.freetrialcounter); int b = *self.freetrialcounter; nslog(@"b: %d", b); here output: free trial counter: 2 b: 1606411536 what missing here? why isn't "b" equal "2"? the root of problem int , nsinteger can different sizes. so, you're assigning pointer nsinteger property of type nsinteger* , okay (but unusual). however, you're dereferencing value int , happens not same size. however, think may confused how need declare property hold nsinteger . nsinteger simple integer type, not object, there's no need use pointer refer it. doubly true since seem declaring nsin...

c# - Response processing with ASP.NET functions -

i have function in c# code behind fires on button click. should change span "done", , if zipfile checkbox checked, fire off zip file user. process.text = "done"; if (zipfile.checked) { response.appendheader("content-disposition", "attachment; filename=" + foldername); response.contenttype = "application/zip"; using (zipfile zip = new zipfile()) { zip.adddirectory(server.mappath("pdfs")+"/"+foldername); zip.save(response.outputstream); } response.end(); } if checkbox unchecked, done displayed. if zipfile checkbox checked, send zip file, no longer change process.text = done. response seems overwriting asp.net function return. first time using response, doing wrong. in addition of setting text on server side, set on client side. try following snippet: <script> function btnprocessclicked() { $...

android - How to pause/resume a fragment -

background: wrote custom container capable of holding 3 fragments. depending on state of container 2 or 3 fragments visible. inform fragments visibility changed tried out 2 options: i called fragment.setuservisiblehint() method respective value. hosted fragments overrode method , react appropriately. worked out. i called fragmenttransaction.hide() , fragmenttransaction.show() methods hide , show fragments. hosted fragments overrode fragment.onhiddenchanged() , reacted needed. worked out well. my problem not satisfied either of these options. put invisible fragment standard paused state. advantage of option keep code clean , simple, don't need override special methods (like setuservisiblehint() or onhiddenchanged() ) , can handle inside onpause() , onresume() implemented. question: proper way put fragment paused state , resume state? update: tried out fragmenttransaction.detach() too. not option because destroys view, not allowed in case. sounds w...

java - Parse multi-section file with Spring Batch -

i'd use spring batch parse following multi-section file. the headers listed vertically the number of headers changes 1 file next there multiple, distinct "begin/end" tokens each section (meta, head, data, footer) requires different mappers/tokenizers any ideas? start-of-file programname=getdata dateformat=yyyymmdd start-of-fields id name end-of-fields timestarted=tue may 6 16:17:15 edt 2014 start-of-data 0|craig| 1|john| 2|tim| 3|| end-of-data datarecords=4 timefinished=tue may 6 16:49:38 edt 2014 end-of-file the way write custom itemreader<> parse every section , return custom bean: 1 bean header , 1 bean start-of-fields section preparation (store data step execution context). start-of-data / end-of-data section: data can parsed custom flatfileitemreader (custom because need stop on end-of-data , not on classic eof) using header bean gathered before row mapping. hope can start.

shell - How can I glob all nested files with subdirectory exceptions -

i attempting use shell globbing grab nested matchin folders, except ones in particular directory |__foo | |__foo.txt |__bar | |__bar.txt |__baz | |__baz.txt can glob return bar/bar.txt , baz/baz.txt the folders include vary, need explicitly exclude foo directory. possible? pseudo code something [**|!foo]/*.txt in bash, can use extended globbing for example $ find . ./bar ./bar/bar.txt ./biz ./biz/biz.txt ./foo ./foo/foo.txt # turn on extended globbing $ shopt -s extglob # match files not in foo $ ls !(foo)/* bar/bar.txt biz/biz.txt # match files in neither foo nor bar $ ls !(foo|bar)/* biz/biz.txt

spring mvc - Process Thymeleaf attributes multiple times -

i able store html thymeleaf attributes strings in database. able store html without thymeleaf attributes already: method in controller class // method string database first @modelattribute("somecode") public string populatesomecode() { return "this <h1>some code</h1>"; } index.html <!doctype html> <html xmlns:th="http://www.thymeleaf.org"> ... <body> <div th:utext="${somecode}">html go here</div> </body> </html> this produce desired result of displaying h1 saying "this code". i wondering if possible include thymeleaf attributes in string , have attributes processed. if changed string be: "this <h1 th:text=\"'another string'\">some code</h1>" i result h1 saying "this string", still "this code". there way this? have tried use thymeleaf __${expression}__ preprocessor feature? like thi...

sqlite - Android convert array of months -

i array of months since sqlite database, want see months in chart achartengine long name. how i? string sql = "select strftime('%m',"+table.date+") month"; cursor c = db.rawquery(sql, null); int count = c.getcount(); string[] months= new string[count]; for(int i=0; i<count; i++) { c.movetonext(); months[i] = c.getstring(0); } for(int i=0;i<months.length;i++){ multirenderer.addxtextlabel(i+1, months[i]); } timezone timezone = timezone.getdefault(); calendar calendar = new gregoriancalendar(timezone); for(int i=0;i<months.length;i++){ int monthnumber=integer.valueof(months[i])-1; calendar.set(2014, monthnumber, 1, 1, 1, 1); string monthname=calendar.getdisplayname(calendar.month, calendar.long, locale.getdefault()); multirenderer.addxtextlabel(i+1, monthname); }

qt - Custom deploy in QTCreator -

i working on qtcreator (3.0.x) targeting embedded linux device. fine except fact not able add custom file deploy step... in .pro file set: target.path = /home/root installs += target and able deploy executable remote device... now if add custom files deployment process? i'd tried add following lines .pro file: mypackage.files = /path/to/my/files/on/my/pc/* mypackage.path = /home/root installs += mypackage but doesn't work... how can that? i try use wildcard/glob in the following way : $$files(glob) — returns list of files match specified glob pattern mypackage.files = $$files(/path/to/my/files/on/my/pc/*) but in special case, easier specify directory since seem grabbing files anyhow, write personally: mypackage.files = /path/to/my/files/on/my/pc

vb.net - working with variables -

i new .net , wondering how add 2 registry search items own variable? e.g. using below code, software\test2 , software\test1 put own variable if found can use in section of code removal. the code using is: if microsoft.win32.registry.currentuser.opensubkey("software\test2") nothing label2.text = ""else listbox1.items.add("software\test2") if microsoft.win32.registry.currentuser.opensubkey("software\test1") nothing label2.text = "" else listbox1.items.add("software\test1") when call opensubkey , return registrykey object subkey opened. first thing assign result of function variable. can call getvalue on registrykey , assign result of function variable.

Use a decorator to turn a function into a generator in Python -

is there way decorator convert function below generator? @decorator_that_makes_func_into_generator def countdown(n): while n > 0: print n, n = n - 1 the function can modified if necessary. note function not have yield statement, otherwise generator. if can't change source of countdown , you'll have capture output: import sys io import stringio def decorator_that_makes_func_into_generator(func): def wrapper(*a, **ka): # temporarily redirect output stringio instance (intr) ts, intr = sys.stdout, stringio() sys.stdout = intr func(*a, **ka) # restore normal stdout backup (ts) sys.stdout = ts # output intr, split whitespace , use generator yield intr.getvalue().split() return wrapper @decorator_that_makes_func_into_generator def countdown(n): while n > 0: print(n) n = n - 1 print(countdown(5), list(countdown(5))) # <generator object wrapper...

android - Upload image to the wall with a link using Facebook SDK -

possible upload image user wall or page or group open external url when user click on it? found exmaple in facebook sdk tutorials doesn't take url private void postphoto() { bitmap image = bitmapfactory.decoderesource(this.getresources(), r.drawable.icon); if (canpresentsharedialogwithphotos) { facebookdialog sharedialog = createsharedialogbuilderforphoto(image).build(); uihelper.trackpendingdialogcall(sharedialog.present()); } else if (haspublishpermission()) { request request = request.newuploadphotorequest(session.getactivesession(), image, new request.callback() { @override public void oncompleted(response response) { showpublishresult(getstring(r.string.photo_post), response.getgraphobject(), response.geterror()); } }); request.executeasync(); } else { pendingaction = pendingaction.post_photo; } } is there suggestions thanks it's not ...

java - How to ignore xsi:nil attributes when parsing xml with XmlSlurper -

we're upgrading 3rd-party product consume xml content. new version generates xml xsi:nil="true" attributes, indicating null elements: <?xml version="1.0" encoding="utf-8"?> <data xmlns:xsi="http://www.w3.org/2001/xmlschema-instance"> <cusip xsi:nil="true"/> <ticker xsi:nil="true"/> <year>2014</year> </data> when parsing, use: def parsed = new xmlslurper().parsetext(xml) ... element.attributes().each{ k,v -> { } ..but attribute key xsi:nil="true" , comes as: "{http://www.w3.org/2001/xmlschema-instance}nil" ...and raising hell our downstream processing because it's not expecting attribute key enclosed in braces. does xmlslurper support way ignore xsi schema type attributes without having filter them out manually? to clear given xml... <?xml version="1.0" encoding="utf-8"?> <data xmlns:xsi="...

windows - Oracle Database Installation Error "ORA-12560: TNS:protocol adapter error" -

i'm working on mavericks machine running windows 8.1 vm, trying install oracle database 12c. installation runs fine until gets database configuration assistant portion, gives me error mentioned above, "ora-12560: tns:protocol adapter error". the database installer gives option skip step, i've tried doing so, , database installation continues , completes. after completed, database configuration assistant installed application. running application gives same error after setting of basic information (like database name, password, etc.). i'm more or less brand new oracle databases, , have no clue error might mean, or how fix it. have idea why error appearing? i'm eager provide more information if it's needed, , appreciate ideas or tips. thanks! it seems me oracle database not , running, common issue first time users, need setup database before else. try going control panel, administrative tools, services. restart both oraclexetnslistener ,...

syntax - How to assign a value to a double bracketed expression in Objective C -

specifically, how can rewrite following example of dot syntax equivalent bracket syntax: cell.textlabel.text = @"this cell"; i thought this: [[cell textlabel] text: @"this cell"]; a read-write property composed of 2 methods - getter , setter. the name of getter corresponds name of property. name of setter prefixed set ; first letter of property capitalized: [[cell textlabel] settext: @"this cell"];

ruby on rails - Sort by count of associated has_many model -

got following models class document has_many :document_tag_links has_many :document_tags, through: :document_tag_links class documenttag has_many :document_tag_links has_many :documents, through: :document_tag_links class documenttaglink belongs_to :document belongs_to :document_tag now, i'm trying sort documenttags how many documents associated with. i've tried following: scope :top10, -> { joins(:document_tag_links). select("documents.*, count(document_id) documents_count"). group("document_id"). order("documents_count desc") } but gives me following error: activerecord::statementinvalid: pg::undefinedtable: error: missing from-clause entry table "documents" line 1: select documents.*, count(document_id) as... ^ : select documents.*, count(document_id) documents_count "document_tags" inner join "document_tag_links" on "document_tag_links"....

javascript - When using the *sync functions in Node.js, what (if any) background operations continue to run -

when using node.js *sync functions (i understand shouldn't, , reasons why), (if any) background processes continue run? for example, if i'm using http.createserver, , 1 of requests call fs.writefilesync(), server continue serve new clients whilst write in progress (not accept connection, process entire request)? i.e. writefilesync() block entire process, or current call chain? basically effect of using *sync function block process long-running javascript does. running *sync, means when process waiting them complete sits , nothing. if use asynchronous counter part of functions, when process waiting them complete , handle other pending events such new http requests handled. if have http server running , call *sync function, when *sync function running new http requests in time queued handled after current javascript , *sync function has finished executing. here's quote node documentation : in busy processes, programmer encouraged use asynchronous vers...

jquery - How to center <ul> in a page? -

i have created ul element. these html , css navigation bar: html: <ul id="list-nav"> <li><a href="marsrutas.html">item1</a> </li> <li><a href="nuotraukos.html">item2</a> </li> <li><a href="apie zygi.html">item3</a> </li> <li><a href="apie mane.html">item4</a> </li> <li><a href="dviraciai.html">item5</a> </li> <li><a href="kontaktai.html">item6</a> css: ul#list-nav { margin:40px; padding:0; list-style:none; width:525px; } ul#list-nav li { display:inline text-align: center; } ul#list-nav li { text-decoration:none; padding:5px 0; width:65px; color:#eee; float:left; margin:5px; } ul#list-nav li { text-align:center; } ul#list-nav li a:hover { color:#000; border-width: 1px; border-style: ...

sql - Get row with the smallest time interval per value in a table -

here table: start time stop time extension ---------------------------------------------------------- 2014-03-03 10:00:00 2014-03-03 11:00:00 100 2014-03-03 10:00:00 2014-03-03 12:00:00 100 2014-03-05 10:00:00 2014-03-05 11:00:00 200 2014-03-03 10:00:00 2014-03-03 13:00:00 100 2014-03-05 10:00:00 2014-03-05 12:00:00 200 2014-03-05 10:00:00 2014-03-05 13:00:00 200 i want smallest time interval each extension: start time stop time extension ------------------------------------------------------------- 2014-03-03 10:00:00 2014-03-03 11:00:00 100 2014-03-05 10:00:00 2014-03-05 11:00:00 200 how can write sql? to row (including original columns) smallest time interval each extension (according updated question) postgres specific distinct on should convenient: select distinct on (extension) start_time, stop_time, extension ...

scala - Troubles launching Kestrel -

i try play kestrel 2.4.1 ( http://robey.github.io/kestrel/ ). unfortunately, not launch. following exception when run devel.sh script. iother scripts produce similar exception. starting kestrel in development mode... may 17, 2014 2:26:06 pm java.util.logging.logmanager$rootlogger log fatal: error in config file: %s java.lang.unsupportedoperationexception: position.line @ scala.tools.nsc.util.position$class.line(position.scala:173) @ scala.tools.nsc.util.noposition$.line(position.scala:196) @ com.twitter.util.eval$stringcompiler$$anon$1.display(eval.scala:444) @ scala.tools.nsc.reporters.abstractreporter.info0(abstractreporter.scala:45) any appreciated. using java 8. scala support java 8 experimental in 2.11.0, , github version has last version of scala being used 2.9.2 from: kestrel build file scalaversion := "2.9.2", from: scala 2.11.0 available! the scala 2.11.x series targets java 6, (evolving) experimental support java 8. in 2.11.0...

Basic file uploading via website form using POST Requests in Python -

i try upload file on random website using python , http requests. this, use handy library named requests . according the documentation , , answers on stackoverflow here , there , have add files parameter in application, after studying dom of web page. the method simple: look in source code url of form ("action" attribute); look in source code "name" attribute of uploading button ; look in source code "name" , "value" attributes of submit form button ; complete python code required parameters. sometimes works fine. indeed, managed upload file on site : http://pastebin.ca/upload.php after looking in source code, url of form upload.php , buttons names file , s , value upload , following code: url = "http://pastebin.ca/upload.php" myfile = open("text.txt","rb") r = requests.get(url,data={'s':'upload'},files={'file':myfile}) print r.text.find("the uploaded file has b...

optimization - Graph a series of planes as a solid object in Mathematica -

Image
i'm trying graph series of planes solid object in mathematica. first tried use rangeplot3d options fill options graph 3d volume, unable find working result. the graphic i'm trying create show deviation between z axis , radius origin of 3d cuboid. current equation i'm using this: plot3d[evaluate[{sqrt[(c[1])^2 + x^2 + y^2]} /. c[1] -> range[6378100, 6379120]], {x, -1000000, 1000000}, {y, -1000000, 1000000}, axeslabel -> automatic] (output more manageable range looks follows) where c 1 origional z-value @ each plane , result of equation z+(r-z) point on x,y plane. however method incredibly inefficient. because used model large objects original z-values of >6,000,000 , heights above 1000, mathematica unable graph thousands of planes , represent them in responsive method. additionally, because range of c 1 includes integer values, there discontinuity between these planes. is there way rewrite using different mathematica functionality generate 3dpl...

android - CursorAdapter in Listview -

Image
i'm using cursoradapter reading database in listview. have checkbox in each item of list when checkbox checked user favorite column in database change yes , item added favorite. everything ok , favorite column changed when scroll , down list checkbox going unchecked. , if restarting app checkbox have been checked what should problem: sorry bad english: cursoradapter class: public class myadapter extends cursoradapter { context b; layoutinflater inflater; @suppresswarnings("deprecation") public myadapter(context context, cursor c) { super(context, c); inflater = layoutinflater.from(context); b= (context) context; } @suppresswarnings("unused") @override public void bindview(view view, context context, final cursor cursor) { // todo auto-generated method stub textview tv1 = (textview)view.findviewbyid(r.id.txt_name); textview tv2 = (textview)view.findviewbyid(r.id.tx...

rspec - How would one test a custom Padrino FormBuilder? -

suppose have custom formbuilder in padrino, following: class customformbuilder < padrino::helpers::formbuilder::abstractformbuilder def foo(arg1, arg2, ...) # #template end end what's right way test this? it seems correct thing like: describe customformbuilder "renders right output" # ... result = customformbuilder.new(...).template.render expect(result).to include 'expected-content' end end it's not clear me how pull off: usually framework instantiates formbuilders, feels wrong i'm doing here. there better approach? i don't know how pass object formbuilder accept template. i don't know how result of rendering template. what's right way test this? i figured out after effort. idea make object represents template, pass formbuilder, make object model, , see if builder generates correct html. describe customformbuilder let(:template) class.new include padrino::helpers::outputh...

java - String is fixed to screen when using libgdx -

i've been having trouble libgdx , code , wanted know how can make text stop moving camera. wanted label corridnates of 2d array created when text moves camera. here's wrote: batch.begin(); for(int x = 0; x < world.getwidth(); x+=size){ for(int y = 0; y < world.getheight(); y +=size){ room r = (room)dcreator.getrooms(x/size,y/size); font.draw(batch, x+", "+y, r.getx(), r.gety()); } } batch.end(); any or questions appreciated! you need create new camera, won't move other. common have more cameras in game, 1 rendering game , second 1 gui. orthographiccamera gamecam = new orthographiccamera(); orthographiccamera guicam = new orthographiccamera(); guicam.settoortho(false, screen_width, screen_height); gamecam.settoortho(false, game_width, game_height); and in code: batch.setprojectionmatrix(gamecam.combined); batch.begin(); //render game stuff batch.end(); batch.setprojectionmatrix(...

dataframe - R how use a string variable to select a data frame column using $ notation -

this question has answer here: dynamically select data frame columns using $ , vector of column names 4 answers from reading i've been doing r, can select column in data frame either of these 2 methods: frame[,column] or frame$column. however, when have string variable, works in first. in other words, consider following: i have data frame, tmp, subset of larger data frame of question responses. v1 responder's id, q5.3 response, 1 or 0: v1 q5.3 2 r_bdykkzwcvbxdftt 1 3 r_41wnkuqcm8muw2x 0 4 r_2ogeykkgbh2e4rl 1 5 r_8d4jzmbfyo0m0ux 1 6 r_3kpgp2pxwronip7 1 str(tmp) 'data.frame': 5 obs. of 2 variables: $ v1 : factor w/ 364 levels "r_0039ornooowadqx",..: 256 116 70 201 95 $ q5.3: num 1 0 1 1 1 now, define variable x, holds string of name of 1 of columns. x<-"q5.3" tmp[,x] return...

validation - Java - validating a subject Code -

i have subject code e.g: abc123 string i need ensure of length 6, first 3 characters letters , last 3 numbers. i try , in if statement? can work length cannot figure out numeric , letter part of things. e.g: public void isvalidcode(string subjectcode2){ str = subjectcode2; if (str.length() == 6 && """"need test others here??""" ) { system.out.println("the code valid"); } else { system.out.println("the code not valid"); } you can use regular expressions, , matches() method of string class. if (str.matches("[a-za-z]{3}[0-9]{3}")) { // validation succeeded } else { // validation failed }

gwtp - How to program at client side to get Html Snapshot (or to capture all texts) of entire GWT page? -

to let understand want, please read this: suppose have gwt page ( mydomain.com#!article ). page contain many widgets , data downloaded db. db data & widgets mixed each other, example label can hold customer name (customer name came db). so, on page javascript, ie when view source can see javascript. however, if open gwt page in chrome & save " mygwtarticlepage.htm " local pc, reopen " mygwtarticlepage.htm ", can see text, widgets... in " mygwtarticlepage.htm " same ones in " mydomain.com#!article ". now, right-click & view-source of " mygwtarticlepage.htm ", see not javascript text, & db data & widget still in there. so, " mygwtarticlepage.htm " called html snapshot of " mydomain.com#!article ". are clear? now want program @ client side able capture texts of " mygwtarticlepage.htm ". so, myarticlepresenter.java (in client package) should work this: private asynccallba...

How to integrate PHP and R on Windows? -

having issues integrating php , r. working article: http://www.r-bloggers.com/integrating-php-and-r/ r installed , verified working our r script: rscript c:\inetpub\wwwroot\client\includes\decisiontreepredictor.r 20 10 o 1000 10000 5000 0.2 10.2 printing single value result of calculations: [1] "0" (the path rscript.exe set in windows environmental variables) i have php script in place using exec() tests commands such as: $result = exec('dir',$output,$returnvar); echo "<br>result ". print_r($result,true); echo "<br>output <pre>". print_r($output,true) , "</pre>"; echo "<br>return ". print_r($returnvar,true); returning: result 2 dir(s) 117,749,354,496 bytes free output array ( [0] => volume in drive c c_drive [1] => volume serial number 7eb2-a074 [2] => [3] => directory of c:\inetpub\wwwroot\client\temp [4] => [5] => 05/17/2014 ...

android - How to relocate to settings from app? -

i'm making application in eclipse wherein need activate gps. since can't activate gps through app, how can relocate user "settings>location access"? you can launch following intent after detect user has gps turned off: intent intent = new intent(settings.action_location_source_settings); startactivity(intent);

javascript - Context change events won't work Meteor -

so i've got structure <template name="example"> {{#each post}} <div class="hello"></div> {{/each}} </template> so trying check click events on hello div template.example.events = { 'click .hello' : function(event) { console.log("hey"); } } but not working. console not logging anything. does have change of context in html template? events function need pass event map to. right assigning event map , overriding actual events method. try this: template.example.events({ 'click .hello' : function(event) { console.log("hey"); } });

android - GLES2 glTexStorage doesn't work on Nexus 7 2013? -

how used gltexstorage #define gl_glext_prototypes #include <gl2ext.h> so gltexstorage2dext direct symbol. checked eglgetprocaddress() , same address. code snippet : glgentextures(1, &tex); glbindtexture(gl_texture_2d, tex); gltexparameteri(gl_texture_2d, gl_texture_min_filter, gl_nearest); gltexparameteri(gl_texture_2d, gl_texture_mag_filter, gl_nearest); gltexparameteri(gl_texture_2d, gl_texture_wrap_s, gl_repeat); gltexparameteri(gl_texture_2d, gl_texture_wrap_t, gl_repeat); then gives gl_invalid_operation on gltexsubimage2d : gltexstorage2dext(gl_texture_2d, 1, gl_rgba8_oes, w, h); gltexsubimage2d(gl_texture_2d, 0, 0, 0, w, h, gl_rgba, gl_unsigned_byte, data); but doesn't give error: glteximage2d(gl_texture_2d, 0, gl_rgba, w, h, 0, gl_rgba, gl_unsigned_byte, data); gltexsubimage2d(gl_texture_2d, 0, 0, 0, w, h, gl_rgba, gl_unsigned_byte, data); what's wrong use of gltexstorage2dext ? stop using extension. standard part of gl es 3 (w...

twitter bootstrap - Assigning Value but get null value in Jquery -

i assign value getting value variable string when print value null value variable. using "ids" variable assign value. here code ids = ""; if ($('input[name=msg_sel]:checked', '#' + tableid).length) { $.colorbox({ initialheight: '0', initialwidth: '0', href: "#confirm_dialog", inline: true, opacity: '0.3', oncomplete: function () { $('.confirm_yes').click(function (e) { e.preventdefault(); $('input[name=msg_sel]:checked', otable.fngetnodes()).closest('tr').fadeto(300, 0, function () { $(this).remove(); otable.fndeleterow(this); ids += $(this).attr("id").substring(3); //alert(ids); here works correct $('.select_msgs', '#' + tableid).attr('checked', false); ...

mongodb replication with admin authentication error -

i have 3 nodes of mongodb replication set 2 servers have data , third arbiter 54.83.20.44 : 27017 (primary) 54.197.243.55 : 40000 (secondary) 23.21.148.73 : 27017 (arbiter) all things have been configured automatic failover. but, ignored thing authentication. can connect replset using "robomongo" (desktop mongodb management tool) without username/password :( connected admin database of primary member , ran command: mongo use admin db.adduser("username", "password"); then, restarted mongod process --auth option this log after restart: [rsbackgroundsync] replset not trying sync 54.197.243.55:40000, vetoed 8 more seconds [rshealthpoll] not authenticate against 54.197.243.55:40000, { code: 18, ok: 0.0, errmsg: "auth fails" } [rshealthpoll] replset info 54.197.243.55:40000 thinks down what can ? adding username/password admin servers or primary server only? ...

android - Gettings user events? -

i'm trying user events (one's he's invited to) using fb android sdk have no clue how , i've found no instructions on website. here's code meanwhile - import android.content.intent; import android.os.bundle; import android.support.v4.app.fragment; import android.util.log; import android.view.layoutinflater; import android.view.view; import android.view.viewgroup; import com.facebook.request; import com.facebook.response; import com.facebook.session; import com.facebook.sessionstate; import com.facebook.uilifecyclehelper; import com.facebook.model.graphuser; import com.facebook.widget.loginbutton; public class socigofragmententrance extends fragment { private final static string tag = "fb_login"; private uilifecyclehelper uihelper; @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); getactivity().getactionbar().hide(); session.statuscallback callback = new session.statuscallback() { ...

passing variable to view, kohana 3.3 not working, Undefined variable: -

i have stupid question... why if pass e variable view browser return me undefined variable: ? clone first method (for ads, same procedure). ads work, , category not work, stupid, why? show little application my controller: <?php defined('syspath') or die('no direct script access.'); class controller_ads extends controller_template { public $template = 'template'; // function indes ads public function action_index() { $ads = orm::factory('ads')->find_all(); // load object inside ads table $view = new view('ads/index'); // load view/ads/index.php $view->set('ads', $ads); // set 'ads' object view $this->template->set('content', $view); } // view single ads public function action_single() { $id = $this->request->param('id'); $record = orm::factory('ads') ->where('id_ads...

recommendation engine - Wrong output in predict function from R package 'recommenderlab'? -

i need make recommender based on yelp database, i've filtered business reviews , user , created realratingmatrix user ratings respective businesses. though matrix gigantic i'm testing small matrix first ( mdat matrix). #learning matrix learningm <- as(mdat[1:8,],"realratingmatrix") # matrix predict user recommendations testm <- as(mdat[9:10,],"realratingmatrix") #using learning matrix create ubcf recommender rec <- recommender(learningm, method = "ubcf") #function should output 2 business recommendations users of testm pre <- predict(rec, testm, n=2) instead receive output this: > as(pre,"list") [[1]] character(0) [[2]] character(0) why getting output? predict function calculating wrong results providing erroneous output or business column name different text type can't output correctly? edit: mdat matrix requested, sorry not putting @ first place. > dput(mdat) structure(c(1, na, na, na, na, n...

java ee - What is PL/SQL Hibernate jar list? -

for personal projects, using hibernate in order connect java dynamic web application mysql database. here list of jars using: antlr-2.7.6rc1.jar asm-attrs.jar asm.jar cglib-2.1.3.jar commons-collections-2.1.1.jar commons-logging-1.0.4.jar dom4j-1.6.1.jar ehcache-1.1.jar hibernate3.jar jta.jar log4j-1.2.11.jar mysql-connector-java-3.0.17-ga-bin.jar at work, things different since using pl/sql instead of mysql. questions are: which jar should use replace mysql-connector-java-3.0.17-ga-bin.jar ? where can find find jar? should add/remove/replace jar list above? for information : i not using hibernate plugin in app. i using xml files instead of jpa annotations hibernate mapping. i hope clear, thanks in advance help, kind regards. indeed, you're right. downloaded ojdbc.jar (x java version) oracle website. thanks, omar.

android - Horizontal Page Indicator in a ViewPager -

Image
i have viewpager , want use "horizontal page indicator" (see pic below) make clear user can scroll horizontally. although see used in many apps can't find info on it. hoping simple enablex method in viewpager or adapter doesn't seem case. can tell me if there way enable on viewpager or implemented image on apps use it? also, name of type of page indicator? use android-viewpagerindicator library jake wharton https://github.com/jakewharton/android-viewpagerindicator

A numerical library which uses a paralleled algorithm to do one dimensional integration? -

is there numerical library can use paralleled algorithm 1 dimensional integration (global adaptive method)? infrastructure of code decides cannot multiple numerical integrations in parallel, have use paralleled algorithm speed up. thanks! nag c numerical library have parallel version of adaptive quadrature (link here ). trick request user following function void (*f)(const double x[], integer nx, double fv[], integer *iflag, nag_comm *comm) here function "f" evaluates integrand @ nx abscise points given vector x[] . parallelization comes along, because can use parallel_for (implemented in openmp example) evaluate f @ points concurrently. integrator single threaded. nag expensive library, if code integrator using, example, numerical recipes , not difficult modify serial implementations create parallel adaptive integrators using nag idea. i can't reproduce numerical recipes book show modifications necessary due license restriction. let's take...

Reading string by char till end of line C/C++ -

this question has answer here: c++ compile error: iso c++ forbids comparison between pointer , integer 5 answers how read string 1 char @ time, , stop when reach end of line? i'am using fgetc function read file , put chars array (latter change array malloc), can't figure out how stop when end of line reached tried (c variable char file): if(c=="\0") but gives error cant compare pointer integer file looks (the length of words unknown): one 2 3 so here comes questions: 1) can compare c \0 \0 2 symbols (\ , 0) or counted 1 (same question \n) 2) maybe should use \n ? 3) if suggestions above wrong suggest (note must read string 1 char @ time) (note pretty new c++(and programming self)) you want use single quotes: if(c=='\0') double quotes (") strings, sequences of characters. single quotes (') individual chara...

regex - TCL for DC: regexp matching of non-standard hierarchical names -

i'm trying write automation scripts synopsys design compiler, have troubles following case: i see there logic tie-off nets have following name: dc_shell> all_connected foo_top/foo/foo_pin {foo_top/*logic0*} in script want detect pins connected logic tie-offs: set connected_nets [find net [all_connected $pin]] foreach_in_collection net $connected_nets { if {[regexp {.*logic0.*} [get_object_name $net]] } { # skip pin because tied logic 0 continue } } this matching never succeeds. works other pins , nets, fails on tie-offs. i feeling has fact tie-off net specified * in name, i'm not sure how handle it. what can overcome , able detect these tie-off nets? thanks if try invocation regexp {.*logic0.*} {foo_top/*logic0*} 1, it's not matching fails. seem command get_object_name doesn't return expect to. as side note, regular expression {.*logic0.*} equivalent regular expression {logic0} purpose of determining ...

.net - How to reference a dynamically created OvalShape with a string variable in vb.net -

i have created 40 or ovalshapes ms power packs , when user clicks them send id separate function supposed change color of clicked oval. unfortunately controls method seems not work. controls.item(dummy).fillcolor = color.red gives me error saying "fillcolor not member of 'system.windows.forms.control'" dummy string containing name of control. i'm new vb.net i'm not sure if there's way reference things on form via string besides using controls . google hasn't helped on matter much, found way search through shapes using ctype on controls match oval type isn't helpful when want change 1 control... edit: looking able following: for = 1 40 ovalname = "oval" & if ovali = next i not sure how adding ovalshapes or type of container using. in order add them windows form control need use shapecontainer mentioned slaks. in example creating shapecontainer , adding form, using shapecontainers.shapes.add method add ...