Posts

Showing posts from February, 2013

php - To restrict menu tab using Yii -

i want restrict menu tab if aren't loggin , therefore redirect loggin web page. for example, if have in layout/main.php: <div id="mainmenu"> <?php $this->widget('zii.widgets.cmenu',array( 'items'=>array( array('label'=>'visit us', 'url'=>array('/visit/index')), array('label'=>'employee', 'url'=>array('/employee/index')), array('label'=>'login', 'url'=>array('/site/login'), 'visible'=>yii::app()->user->isguest), and want restrict menu tab employee , should write restriction? i read in post somethings this, don't know how use it: if(!isset($_session["user"])) { header("location: homepage.php"); } please, me? thank much it written in docs . define if menu element visible, use visible params, same login page, negatio...

R: regex from string to two dimensional data frame in one command? -

Image
i have string s containing such key-value pairs, , construct data frame, s="{'#jj': 121, '#nn': 938, '#dt': 184, '#vb': 338, '#rb': 52}" r1<-sapply(strsplit(s, "[^0-9_]+",as.numeric),as.numeric) r2<-sapply(strsplit(s, "[^a-z]+",as.numeric),as.character) d<-data.frame(id=r2,value=r1) what gives: r1 [,1] [1,] na [2,] 121 [3,] 938 [4,] 184 [5,] 338 [6,] 52 r2 [,1] [1,] "" [2,] "jj" [3,] "nn" [4,] "dt" [5,] "vb" [6,] "rb" d id value 1 na 2 jj 121 3 nn 938 4 dt 184 5 vb 338 6 rb 52 first i don't have na , "" after using regular expression . think should {2,} meaning match second occurence, can not in r. another think be: having data frame column below: m 1 {'#jj': 121, '#nn': 938, '#dt': 184, ...

android - How to get lat and longtitude values out from google places details result -

i have returns result of place details code below: private placedetails getplacedetails(string url) throws exception{ string jsonresults =null; httphelper helper = new httphelper(); try { jsonresults = helper.getjsonstring(url); // create json object hierarchy results jsonobject jsonobj = new jsonobject(jsonresults.tostring()).getjsonobject("result"); placedetails = new placedetails(); placedetails.setname(jsonobj.getstring("name")); placedetails.setformatted_address(jsonobj.getstring("formatted_address")); placedetails.setinternational_phone_number(jsonobj.getstring("international_phone_number")); } catch (jsonexception e) { log.e("log_tag", "error processing json results " + e.getmessage().tostring(), e); } return placedetails; } now, problem dont know how la...

javascript - Implement routeboxer into code -

i'm new google map , js. learning trying create service car trip google map, google places, , rote boxer. now create need, working google map,places don't know how can implement routeboxer make search boxes. i try here: http://jsbin.com/inicah/23 map won't show. does tell me how can that? here code without routeboxer , works fine: http://jsbin.com/inicah/22 also try implement routeboxer @geozipcode example: http://www.geocodezip.com/v3_so_routeboxerplaces.html sorry english, bad, i'm learning hard

mysql - how to skip duplicate records when importing in phpmyadmin -

i have db on local machine , want import data db on hosting. both db's identical, same table names , column names , etc. when export table local db through phpmyadmin , import through phpmyadmin on hosting error pops telling me there duplicate entries primary key , stops whole operation. how can import data through phpmyadmin, skip duplicate entries, , display list of duplicates @ end of process? a solution can call values of primary key in db @ hosting , filter duplicates before import. wondering if there quick solution phpmyadmin? in phpmyadmin , in settings tab, can try checking following values: settings -> sql queries -> ignore multiple statement errors if using csv format: settings -> import -> csv -> not abort on insert error if using sql format: settings -> export -> sql -> use ignore inserts

Get links thru javascript? -

i have situation: $.getjson(url, args, function(data) { info(""); $("#results").empty(); if (! ('songs' in data.response)) { info("can't find anything"); } else { $("#all_results").show(); var tbody = $("#all_results_body"); tbody.empty(); $.each(data.response.songs, function(i, song) { var row = $("<tr>"); var artist = song.artist_name; //var artist = make_link(song.artist_name, //'http://static.echonest.com/echotron/?id=' + song.artist_id, 'other'); var tid = song.tracks[0].foreign_id.replace('-ww', ''); var tid = tid.replace('-us', ''); var title = make_link(song.title, ti...

php - Random mysql connection errors and other problems after server and wordpress migration -

i have migrated wordpress site new debian 7 x64 vps. after migration randomly receive "error establishing database connection". though have tried various methods fix problem still random errors. additionally way access db adminer wp plugin after login wordpress , via mysql command line. adminer not let me login if use php script out of wordpress. use mysql 5.5 nginx 1.4.1 , php5-fpm unix socket. strangely enough posts not shown after publish after migration. mysql logs empty. workaround found had manually restart mysql daemon after error in order temporarily fix until next random error. in mysql user passwords include symbols. somehow affecting behaviour of mysql server or database connection? should try repair database? suggestions?

asp.net membership - Sitecore Forced password change -

i need implement such feature . need work x days after last changed password, when login message says, password has expired, please enter new password , confirm new password do have ideas/suggestions how in proper way? you can add own processor first processor of loggingin pipeline process method: public void process(logginginargs args) { membershipuser user = membership.getuser(args.username); if (user != null) { datetime date = user.lastpasswordchangeddate; if ((datetime.now - date).totaldays > maxdayswithoutpasswordchange) { httpcontext.current.response.redirect("/passwordchangepage"); } } } this redirect users require password change /passwordchangepage url. on page create form old password , new password. on submitting form execute password change: membershipuser user = membership.getuser(username); user.changepassword(oldpassword, newpassword);

java - Null Pointer exception and intent error -

my app crash whenever click on button... button gets text edittext , , believe that why have null pointer exception . first question: how can check if edittext empty? tried .equals("") , .equals(null) , same matches, , .lenght == 0 second, when try call intent listactivity class handling error. (activity not found. no activity handle.) ill give onclicklistener on click listener button.setonclicklistener(new onclicklistener() { @override public void onclick(view arg0) { searchinenglish = rsearchenglish.ischecked(); searchindovahzul = rsearchdovahzul.ischecked(); searchbox = (edittext) findviewbyid(r.id.tvsearch); if (searchbox.gettext().tostring().equals("")){ if (searchinenglish) { int counter = 0; (int = 0; < englisharray.length; i++) { if (englisharray[i].contains(s...

c++ - Call destructor from empty define? -

suppose following header file: #ifndef test_header #define test_header class myfoo { public: myfoo(unsigned long *ulbaz): baz(ulbaz) { *baz++; } ~myfoo() { *baz--; } private: unsigned long *baz; }; #define define_a( ) myfoo bar( a); #define define_b( b ) #endif // test_header code-example: // code.cpp #include "test.h" unsigned long mylong = 0l; int main() { define_a( &mylong); define_b( &mylong); } as can see, define_b empty. don't understand: everytime define_b called, destructor myfoo , can see within callstack - how can be? far know empty define expands ; . edit: code works. i'm assuming running following main: int main (int argc, char const* argv[]) { unsigned long mylong = 0l; define_a( &mylong); define_b( &mylong); return 0; } the line define_b( b ) expands nothing, see destructor of class myfoo because when end of scope r...

jquery - DotNetNuke include javascript on every page -

i want create module includes javascript on every page on dotnetnuke site. can include js file in current page, clientresourcemanager.registerscript(this.page, "~/desktopmodules/authenticationservices/zapperscantologin/view.js", fileorder.js.jquery); but want install module on home page , include javascript on every page on dnn site. possible, how can it? i modification skin, here steps module. create module (i recommend starting templates http://christoctemplate.codeplex.com ) add js code add module homepage go module settings, choose display on pages

javascript - How to prevent Google Maps API v3 from caching tiles (to save storage space)? -

i have strange issue regarding caching of maps js api couldn't find solution. my situation follows: want display simple website including map based on maps api v3. website shall displayed on embedded device uses modified webkit engine. therefor displaying , using google maps works great. but here comes problem: our embedded device has few storage space (maybe few 100 kbs). maps api caches every map tile (which makes sense!!!), after user moving around map time, error cache full. is there possibility tell maps api not cache tiles, cache specific number of tiles, or remove cached tiles programatically ourselves? i couldn't find approach or solution regarding issue, great if has idea. thank in advance markus

c# - How to make XmlSerializer.Deserialize handle DefaultAttribute properly? -

there seems bug / inconsistency in microsoft xmlserializer: if have property marked system.componentmodel.defaultvalue attribute, not serialized. fair enough - seen expected behavior. the problem same attribute not respected when deserializing. code below illustrates issue. question how bypass this? have potentially hundreds of business classes default values used in ui tier (views), default value initialization in constructor not option. has generic. create new default attribute, seems duplicate work. see way override xmlserializer behavior or should use serializer job better? the example code: public class defaultvaluetestclass { [system.componentmodel.defaultvalue(10000)] public int foo { get; set; } } [testmethod] public void simpledefaultvaluetest() { // create object , set property value default var before = new defaultvaluetestclass(); before.foo = 10000; // serialize => xml var serializer = new system.xml.serialization.xmlserializer(...

java - Eclipse Kepler shows error marks on warnings -

Image
i've got problem eclipse kepler. in java project i've got warnings , shown error marks (red crosses) in project explorer. it looks picture http://i.stack.imgur.com/h8j7f.png so question is: possible switch yellow cross warnings , red cross errors? haven't found it, hope can me. edit: i've made test project, , here screenshot: thanks! it might me because set compiler mark errors used warning. can set in window->preference menu. open , go java->compiler->errorswarnings , check if want be. you can check compiler menu (java->compiler) if java compiler compliance level set want @chrylis suggested. otherwise might because program unable compile because of dependency problem might want check build path or jre in run configurations menu. right click on project -> run -> run configurations.

c++ - How to apply position transformation -

how apply drawing position in world via shaders? my vertex shader looks this: in vec2 position; uniform mat4x4 model; uniform mat4x4 view; uniform mat4x4 projection; void main() { gl_position = projection * view * model * vec4(position, 0.0, 1.0); } where position positions of vertexes of triangles. i'm binding matrices follows. view : glm::mat4x4 view = glm::lookat( glm::vec3(0.0f, 1.2f, 1.2f), // camera position glm::vec3(0.0f, 0.0f, 0.0f), // camera target glm::vec3(0.0f, 0.0f, 1.0f)); // camera axis glint view_uniform = glgetuniformlocation(shader, "view"); gluniformmatrix4fv(view_uniform, 1, gl_false, glm::value_ptr(view)); projection : glm::mat4x4 projection = glm::perspective(80.0f, 640.0f/480.0f, 0.1f, 100.0f); glint projection_uniform = glgetuniformlocation(shader, "projection"); gluniformmatrix4fv(projection_uniform, 1, gl_false, glm::value_ptr(projection)); ...

C++ alphabet equivalent digit code output program -

i have code embedded application. 1st trying make plain c++ may have concept clear . i have digit code assigned each english alphabet. want program outputs equivalent digit code sentence. loop should iterate number of times each digit of code sentence. bec need on/off pins me embedded application each digit. have add time difference between digits of same letter, between 2 letters, & between 2 sentences later. 1st wanted plain output each digit of resultant code. here code. have assigned alphabets string & code string array type. search equivalent digit code of character string array & save in string type. wanting assign each digit string int & loop it. having trouble in assigning string value int. have not experience of c++ programming. edit have trouble in converting string int @ 1st place, & overall logic solving problem seems fine. here code, how trying solve problem. #include <iostream> #include <string> using namespace st...

How to apply a CSS that is fetched from the application as a string in GWT? -

i have gwt application @ time gets string server represents css file content. possible apply 'css' string using gwt application? try this: element head = document.get().getelementsbytagname("head").getitem(0); styleelement style = document.get().createstyleelement(); style.settype("text/css"); style.setinnerhtml("your css goes here"); head.appendchild(style);

html - How to add content into a dynamically created div in JavaScript? -

i have code shows 'top of page' link when scroll down: window.addevent('load', function() { new jcaption('img.caption'); }); function fade_me(num){ var smoothtop=document.id('smoothtop'); if(smoothtop){smoothtop.fade(window.getscrolltop()<250?0:num);} } window.addevent('domready',function(){ var scroll=new fx.scroll(window,{ 'duration': 500, 'transition': fx.transitions.bounce.easeinout, 'wait': false }); var smoothtop=new element('div',{ 'id': 'smoothtop', 'class': 'smoothtop', 'style': 'position:fixed; display:block; visibility:visible; zoom:1; opacity:0; cursor:pointer; right:5px; bottom:5px;', 'title': '', 'html': '', 'events':{ mouseover: function(){fade_me(1);...

Nginx + Passenger -

hello have 1 question.. can succesfully install webserver multiple vhost rails applications want add passenger support existed nginx server (which configured via ispconfig).. problem if let passenger download , compile nginx passenger-install-nginx-module have configuration files in /opt/nginx ispconfig using /etc/nginx, passenger asking nginx have installed dont know type /etc/nginx configuration path. way im thinking let apt-get install nginx in case dont know how add passenger.. read nginx-full download few bytes linux , not work , debian wiki https://wiki.debian.org/nginx not contain passenger module anyway.. im using ubuntu, can ? :-) run 'nginx -v', tell configure arguments used compile distribution's nginx. pass same arguments passenger-install-nginx-module.

jquery - javascript (200-200)/100 = 9009 -

so working on formula javascript. , formula. data tank variables gathered inputfields. y = ((tank1 + tank2 + (tank 3 /25)) - (tank4 + tank4))/100; alert(y); so tank1 = 100 tank2 = 100 , tank3 = 0 tank4 = 100 , tank5 =100 according javascript answer 9009 while supposed 0 . for tank1 = 90 tank2 = 90 tank3 = 0 tank4 = 90 , tank5 = 90 answer = 818.6 i tried changing divisions multiplications /25 0.04 , /100 0.01 results same. tried renaming tanks in case referring wrong tanks. have tried alerting tanks , gave right inserted numbers back. running jquery. does know causing this? just use parseint(tankx) every tank variable , work expected. this because values come input fields strings not integers. reference: parseint

zend framework2 - ZF2 Setting up LDAP SSO -

i'm creating site works in network (with other sites) share same active directory authenticate users (sso). i've manage authenticate user... $auth = new \zend\authentication\authenticationservice(); $options = array( 'server' => array( 'host' => $host, 'basedn' => $dc ), ); $adapter = new \zend\authentication\adapter\ldap($options, $username, $password); $result = $auth->authenticate($adapter); ... dont how check if user auth'ed (from site in network) or need keep in session (or headers?) others sites knows user logged in. thanks! if there provision multiple-site sso created organization working with, require oauth, wraps directory service , handles sso in browser-friendly way. i've seen sso web apps done non-oauth ways too, has relied on sites sharing common root domain, , hence having shared cookie scope. bottom line: sso between domains not in-bui...

How to add an application page to a site in SharePoint? -

i experienced .net developer acting interim sharepoint developer, , new sharepoint. after determining need go application page instead of site page new project due it's complexity , need of custom code behind. before developing entire solution, wanted tie loose ends of understanding of application page deployments. need add page url on left side of site collection page (kind of happens when adding subsite site page.) have read modules, seems extremely hacky me. there must better way develkop custom page on top of sharepoint without page being accessible on entire site. edit application wanting develop on top of sharepoint exists purely data entry , reporting purposes. have considered using webpart? with visual webpart essencially usercontrol wrapped in webpart can add complexity want , have code behind hook events etc. the benefit of using webpart can drop on page, , use oob sharepoint access controls. you mention want develop data entry reporting app. can cre...

java - escaping HTML tags during finding the differences between two texts -

i use diff match patch find differences between 2 texts. function show deleted text red background , inserted text green background need. now use function find differences between 2 texts html tags. in case, function delivers strange result, example when bold text tag. can tested here . how escape html tags sothat function ignore them finding differences?

IIS6 ASP.NET - content-length header not set for EXE downloads -

when downloading file iis6-hosted asp.net mvc 3 application, content-length header not set .exe files. mime-types appear correctly set. ( .exe application/octet-stream ). static content compression disabled. as far can tell, problem specific .exe files. .zip works fine. suggestions? update here headers are being sent: accept-ranges:bytes cache-control:max-age=86400 compression-control:whitespace content-encoding:gzip content-location:http://...../somefile.exe content-type:application/octet-stream date:wed, 28 aug 2013 15:45:52 gmt etag:"5397aeeb6e4ace1:0" last-modified:mon, 06 may 2013 15:32:30 gmt transfer-encoding:chunked vary:accept-encoding turned out had isapi filter running stripping out headers, including one. disabling filter fixed problem.

vb.net - How to open a new form but closing the old one in VB -

i have welcome application loads up, need have form close , login form open when continue button hit. my code: me.close() dim login new form login.show() when click button closes welcome form , ends application. if can thanks! :) you can set properties of project select "when last form closes" in shutdown mode dropdown update:- "project" menu -> 'yourapp' properties... -> application tab find : "shutdown mode" change "when startup form closes" --> "when last form closes"

.net - Dealing with C# namespaces -

i working on project need ability download youtube videos. found project on github: https://github.com/flagbug/youtubeextractor my project has namespace. how import youtubeextractor project? need change namespace before (or after) importing it? or me, in case, advantages , disadvantages changing namespace vs. not changing it? using vs express 2012, if matters. my project has namespace. how import youtubeextractor project? you add reference external assembly (in particular case install nuget) , add using statement correct namespace ( youtubeextractor ) in classes defined. so follow steps described on home page: install-package youtubeextractor and then: using youtubeextractor; and finally: // our test youtube link string link = "insert youtube link"; /* * available video formats. * we'll work them in video , audio download examples. */ ienumerable<videoinfo> videoinfos = downloadurlresolver.getdownloadurls(link);

wpf controls - retrieve all datagrid rows in wpf -

i have datagrid follows; mainwindow.xaml: <datagrid name="csvdatagrid" itemssource="{binding}" autogeneratecolumns="false" margin="20,5,0,0" horizontalalignment="left" grid.columnspan="4" grid.row="3" grid.column="0" selectionchanged="csvdatagrid_selectionchanged" width="560"> <datagrid.columns> <datagridtextcolumn binding="{binding project}" header="project" width="50" /> <datagridtextcolumn binding="{binding description}" header="description" width="200"/> </datagrid.columns> </datagrid> mainwindow.xaml.cs private void submitbtn_click(object sender, routedeventargs e) { (int = 0; < csvdatagrid.items.count; i++) { datagridrow row = (datagridrow) csvdatagrid.itemcontainergenerator....

In groovy when comparing this and a reference passed in a method: same instance, different metaclass -

in groovy 1.8.6, trying this: class greeter { def sayhello() { this.metaclass.greeting = { system.out.println "hello!" } greeting() } } new greeter().sayhello() this didn't work: groovy.lang.missingpropertyexception: no such property: greeting class: groovy.lang.metaclassimpl after bit of trying, found passing reference self method did work. so, came this: class greeter { def sayhello(self) { assert == self // assert this.metaclass == self.metaclass self.metaclass.greeting = { system.out.println "hello!" } greeting() } } def greeter = new greeter() greeter.sayhello(greeter) the strangest thing assert == self passes, means same instance... right? default tostring seems confirm this. on other hand, assert this.metaclass == self.metaclass fails: assert this.metaclass == self.metaclass | | | | | | | org.codehaus.groovy.runtime.han...

android - packageManager.getInstalledPackages(0) doesn't return all apps -

i'm using packagemanager packagemanager = getpackagemanager(); list<packageinfo> mapps = packagemanager.getinstalledpackages(0); to retrieve list of installed apps. however, list doesn't contain installed apps, (like twitter, example) missing. to test this, i'm using int length = mapps.size(); for(int i=0; i<length; i++){ packageinfo info = mapps.get(i); log.i(tag, "package: " + info.packagename); } com.twitter.android , others aren't among logged strings, though installed on phone. p.s.: i've tried intent mainintent = new intent(intent.action_main, null); mainintent.addcategory(intent.category_launcher); list<resolveinfo> mapps = getpackagemanager().queryintentactivities(mainintent, 0); which shows twitter, doesn't (obviously) return processes can't launched via launcher, such "download manager" or "system ui". need method returns both system apps , third-party apps reliably. ...

php - Why MySQL is changing the column name with value? -

i have following piece of code written somewhere in php: $sql="update drivers ". "set location=$lo ". "where driverid=$id"; echo $sql; the outcome of echo is update drivers set location=loca driverid=3 however when run $result = mysqli_query($con2,$sql); echo $result; echo mysqli_error($con2); i unknown column 'loca' in 'field list' why getting 'loca' instead of location column name ? loca string , needs quoted. $sql="update drivers ". "set location='$lo' ". "where driverid=$id"; you should using pdo , prepared statements quoting you.

ios - ASIHTTPRequest and PHP Status Code always returns 200 or 500 -

my problem php responsestatuscodes not showing on ios. no matter status code return in sendresponse(), when reading responsestatuscode in ios, output 500. why , how can fix it? im assuming error php , has nothing asihttprequest. measure, i've included code used on ios side. let me know if other code need assist me. thanks in advance! here code use start connection server. asiformdatarequest *request = [asiformdatarequest requestwithurl:url]; request.shouldattemptpersistentconnection = no; [request setpostvalue:name forkey:@"name"]; [request setpostvalue:email forkey:@"email"]; [request setpostvalue:phash forkey:@"phash"]; [request setdelegate:self]; [request startasynchronous]; this code run when receiving request finished message. / - (void)requestfinished:(asihttprequest *)request { nslog(@"request finished"); int statuscode = [request responsestatuscode]; if (statuscode == 150) { nslog(@"user regist...

python - statsmodels examples seem not to work -

import statsmodels.formula.api sm import numpy np import pandas url = "http://vincentarelbundock.github.com/rdatasets/csv/histdata/guerry.csv" df = pandas.read_csv(url) df = df[['lottery', 'literacy', 'wealth', 'region']].dropna() print df.head() mod = sm.ols(formula='lottery ~ literacy + wealth + region', data=df) res = mod.fit() print res.summary() spits error after printing table. --------------------------------------------------------------------------- typeerror traceback (most recent call last) <ipython-input-4-f69caff21ed0> in <module>() 6 df = df[['lottery', 'literacy', 'wealth', 'region']].dropna() 7 print df.head() ----> 8 mod = sm.ols(formula='lottery ~ literacy + wealth + region', data=df) 9 res = mod.fit() 10 print res.summary() typeerror: from_formula() takes @ least 3 arguments (2 given) this not seem acceptable behavior. ...

c# - Workflow service - bookmarks not resuming -

i have simple workflow service created using wf 4.5, i'm running console app in vs.net 2012 (added service reference). in wf service, have single receiveactivity creates instance of service , after invokes nativeactivity uses filesystemwatcher/bookmarks monitor directory incoming files. 2 issues arise: the workflow goes idle , never gets resumed when file dropped folder. service goes idle/shown such in persistence store, never resumed. this whole separate issue, need accomplish institute warning/error timeouts if file isn't there within given timespan. seems creating pick activity 3 branches (two delays , actual file monitor activity) way go; sound right? i'm not sure how # 1 above working and/or there's better approach. thoughts/advice appreciated - in advance! you watching files, have resume bookmark when see file. not quite. if warning timer goes off, other 2 branches in pick canceled so, error timer never go off.

eloquent - How to check if a record is new in Laravel? -

i started using eloquent. when used php active record, there nice function checked if record loaded database or new instance. there similar in eloquent use? by new mean: $article = new article; whereas 1 database $article = article::find(1); all laravel models have ->exists property. more if model either loaded database, or has been saved database since being created exists property true; otherwise false. if wish know if model has been modified since being grabbed database, or not saved @ (aka if needs saving) can use ->isdirty() function. the laravel api useful place kind of information: http://laravel.com/api/4.2/illuminate/database/eloquent/model.html#method_isdirty , sheds far more light default documentation.

javascript - How do I get the domain originating the request in express.js? -

i'm using express.js , need know domain originating call. simple code app.get( '/verify_license_key.json', function( req, res ) { // how domain req or res object? mean need know if api called somesite.com or someothersite.com. tried doing console.dir of both req , res got no idea there, read documentation gave me no help. you have retrieve host header . var host = req.get('host'); it optional http 1.0, required 1.1. and, app can impose requirement of own. if supporting cross-origin requests , instead use origin header. var origin = req.get('origin'); note cross-origin requests require validation through " preflight " request : req.options('/route', function (req, res) { var origin = req.get('origin'); // ... }); if you're looking client's ip, can retrieve with: var userip = req.socket.remoteaddress; message.socket . socket.remoteaddress note that, if ...

android - wrap_content doesn't work on list view -

Image
when set property: android:layout_height of listview wrap_content wrap first item in listview: ... <listview android:id="@+id/points_add_list" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_below="@id/points_add_progress"/> <imageview android:id="@+id/points_add_progress2" android:layout_width="fill_parent" android:layout_height="2dp" android:layout_below="@id/points_add_list" android:layout_alignparentleft="true" android:layout_alignparentright="true" android:src="@android:color/darker_gray"/> </relativelayout> </scrollview> if use example 300dp instead of wrap_content, other items visible. my custom view layout xml list view adapter: <?xml version="1.0" encoding="utf-8"?> <linearlayout ...

c++ - how can i do delaunay triangulation of simple polygon and find it's neighbors for any triangles in cgal -

how can using cgal, delaunay triangulation of polygon (simple without hole , in cw order) , list of neighbors of triangles triangle generated delaunay triangulation? look @ example in user manual: http://doc.cgal.org/latest/triangulation_2/index.html#title29 you must distinguish between faces in , outside of polygon. when have face handle can 3 neighbor faces function neighbor(i) = 0, 1, , 2 see: http://doc.cgal.org/latest/tds_2/classtriangulationdsfacebase__2.html

c++ - Must shader uniforms be uploaded once for every VAO? -

must shader uniforms (like projection matrix not change often) uploaded once per vertex array object? or bound variables have nothing active vao, , shader connected vertex object when drawn? (e.g. shader stand own until vertex data sent via draw command, or somehow bound vao created?) uniforms have nothing vaos; they're different data. uniforms program object state. vaos entirely separate objects. as state, uniform data set program remain way until change it.

Makefile compiles all files, even though changes are done in a single c++ file -

i work on project involving large number of c++ files. asking question out of curiosity. usually after make done, particular c++ file under modification compiled alone subsequent make s. experience small modification in single c++ file results compilation of other c++ files , final executable. what reason makefile compile other non-modified c++ files? so here comes concept of timestamping in makefile . example make rule this output: dep1 rule-1 dep1: dep2 rule-2 when execute makefile make first checks timestamp of output file, (if output file doesn't exists default rule executed). output created @ 1200hrs , change file dep1 @ 1205hrs , execute make , make finds target output older depepndency dep1 execute rule-1. if suppose output created @ 1300hrs, dep1 @ 1230hrs, , update dep2 @ 1310hrs, , execute make . can see here since dep1 older dep2 rule-2 executed , dep1 's timestamp has been changed, output older dep1 rule-1 execu...

angularjs - How to count total number of watches on a page? -

is there way, in javascript, count number of angular watches on entire page? we use batarang , doesn't suit our needs. our application big , we're interested in using automated tests check if watch count goes much. it useful count watches on per-controller basis. edit : here attempt. counts watches in class ng-scope. (function () { var elts = document.getelementsbyclassname('ng-scope'); var watches = []; var visited_ids = {}; (var i=0; < elts.length; i++) { var scope = angular.element(elts[i]).scope(); if (scope.$id in visited_ids) continue; visited_ids[scope.$id] = true; watches.push.apply(watches, scope.$$watchers); } return watches.length; })(); (you may need change body html or wherever put ng-app ) (function () { var root = angular.element(document.getelementsbytagname('body')); var watchers = []; var f = function (element) { angular.foreach([...

c# - Cross-Thread Unauthorized AccessException MainViewModel->async LoadData() -

using windows phone 8 , c# , restsharp . getting information error raddiagnostics: [type]:[unauthorizedaccessexception] [exceptionmessage]:[invalid cross-thread access.] [stacktrace]:[ @ ms.internal.xcpimports.checkthread() @ system.windows.dependencyobject.setvalueinternal(dependencyproperty dp, object value, boolean allowreadonlyset) @ system.windows.dependencyobject.setvalue(dependencyproperty property, boolean b) @ microsoft.phone.shell.progressindicator.set_isindeterminate(boolean value) @ rwj.misc.globalloading.notifyvaluechanged() @ rwj.misc.globalloading.set_isloading(boolean value) @ rwj.viewmodels.mainviewmodel.executeasync[t](restrequest request, string host) @ rwj.viewmodels.mainviewmodel.<loaddata>d__a.movenext() --- end of stack trace previous location exception thrown --- @ system.runtime.compilerservices.asyncmethodbuildercore.<throwasync>b__0(object state)] sample code: public async void loaddata() { // authentica...

dns - Two external IPs one WebServer/Website -

i'm having following dilemma, have website on iis 2 internal ips, each 1 of ips nated different external ips (each ip different isp). configured roundrobin dns service (two hosts same name different ip). traffic balanced between 2 isps, , that's want. thing apparently configuration (dns roundrobin) meant when have cluster of server each server has own isp on own nic, traffic webserver client made on isp. right being told no matter our inbound traffic comes from, outbound traffic through our main wan, ok, because have tested when primary wan link down, website keeps working on secondary link. ok, question is, think there may problem configuration? dns rounrobin useful on configuration?. thanks lot feedback. normally when host web service responses bigger compared inbound traffic (normally receive http get/ , deliver whole content back) - make more sense balance outbound traffic on isps value out of additional bandwidth. does make sense - yes - can loose 1 is...

javascript - jQuery draggable creates duplicate sub items -

i'm using jquery ui draggable function. full code more complicated created simple test scenario troubleshoot bug here: fiddle there 2 sections "top" , "content". there yellow button in "top" section draggable. when drag yellow button @ top , drop gray "content" area, show in gray content: yellow box 1 item 1 item 2 item 3 add new item (button) when click on "add new item" button, "item 4" text added under item 3 text. when click on "add new item" button again, "item 5" text added under item 4 text , on... it work expected. however, problem arises when dragging of yellow button @ top , drop in gray area, have this: yellow box 1 item 1 item 2 item 3 item 4 item 5 add new item yellow box 2 item 1 item 2 item 3 add new item so when go , every time click on add new item button under yellow box 1, adds 2 new items every click instead of 1 (it add item 6 , item 7 under item 5) not wanted. ...

ios - Error When using Multiple Carousel -

i using multiple icarousels , want import pictures directory. have icarousel 1 on top , have icarousel 2 on bottom. have 6 folders in directory in ios device user has taken pictures. want assign icarousel 1 directory "apple" , icarousel 2 directory "green". the below code until now. of course, gets error saying "redefinition of..." since setting paths 2 imagearrays. how should make code simpler? furthermore, have warning saying 'nsmutablearray *_strong' 'nsarray *_strong' @ imagearray2 = directorycontent; line. want make working. - (void)viewdidload { [super viewdidload]; //configure carousel imagearray1 = (nsmutablearray *)[[nsfilemanagerdefaultmanager] directorycontentsatpath: fpath]; nsstring *location=@"apple"; nsstring *fpath = [documentsdirectory stringbyappendingpathcomponent:location]; nsarray *directorycontent = [[nsfilemanager defaultmanager] directorycontentsatpath: fpath]; ...

Is there a method in java that returns member variables of a class -

i have requirement check if member variables of class there in list or not. this, need variables of class dynamically (if possible list). there method in java? thanks, kd this concept of reflection . should able following (untested) code snippet: /** * @return {@code true} if of values of fields in {@code obj} * contained in set of {@code values}; {@code false} otherwise. */ public boolean containsallvalues(hashset<object> values, myclass obj) { field[] fields = myclass.class.getfields(); (field field : fields) { object fieldvalue = field.get(obj); if (values.contains(fieldvalue)) { return false; } } return true; }

oop - In C++ how to best decouple 2 classes that must maintain collections of references to each other -

i looking advice on elegant , secure way decouple 2 c++ classes maintain collections of pointers each other's types. i implemented using common base class polymorphism , told unsatisfactory solution. eager learn other ways can achieved. thanks in advance... i have added simplified version of class definitions below. aware salesteam class not decoupled salesperson here. // global vectors vector<customer *> v_customer; vector<salesperson *> v_salesperson; vector<salesteam *> v_salesteam; class person { // base class }; class customer: public person { private: const person *contact; // salesperson serves customer public: customer(const int abirthyear); virtual ~customer() {} }; class salesperson: public person { private: vector<person *> v_client; // these customers salesperson serves public: salesperson(); virtual ~salesperson(){}; }; class salesteam { private: vector<salesperson *> v...

Puzzled by failure of jQuery snippet for appending TDs to a TR -

the motivation behind question understand why jquery snippet below fails. note: force of dumb, blind trial-and-error, have found alternative code work (or seems to). therefore, purpose of question not (per se) "fix" problem shown below. rather, goal understand as can why fails. jquery(document).ready(function ($) { var tds = []; (var = 0; < 3; ++i) { var td = $('<td>'); tds.push(td); } var $tds = $(tds); var $row1 = $('#row1'); $tds.appendto($row1); }); basically, intent of snippet create 3 (jquery-wrapped) td elements, , append them pre-existing tr . (at end of post, copy full html+css+js code.) as stated before, goal understand why snippet fails. therefore, question addressed can see, without running code, snippet fail. of can so: reasoning? tells snippet can't work? here's full code: <!doctype html> <html> <head> <title>title...

Durandal ViewModels activate repeatedly after 2.0.0 upgrade -

Image
i upgrading durandal project 1.2.0 version 2.0.0. have followed steps in durandal documentation ( http://durandaljs.com/documentation/conversion-guide/ ) , app functions usual now. issue seeing activate callback keeps getting called on , on again. here 1 of viewmodels doing it: define(['services/datacontext', 'plugins/router', 'services/logger', 'services/model', 'services/images', 'services/pager'], function (datacontext, router, logger, model, images, pager) { var collaborators = ko.observablearray([]); var filterstring = ko.observable(); var pagehandler = new pager(); var activate = function (filter) { return q.all([datacontext.getall(model.entitynames.songwriter + 's', "", collaborators, { orderby: "firstname" })]) .then(dataretrieved) .then(activatepager); function dataretrieved() { ...

django - Tastypie patch override -

my model has counter field increases every time user hits link in front end. i'm using backbone send data so this.model.save({'increasecount': true}, {'patch': true}); since there no 'increasecount' field in database, i'd current value of 'counter' field , increase 1. am on right track? should use different approach? how go implementing writing custom obj_update (or other) method of resource? thanks!

c# - How to navigate with objects in windows phone 8? -

i need navigate 1 xaml page object not string .. present code : private void border_manipulationstarted(object sender, system.windows.input.manipulationstartedeventargs e) { string uri = "/phonepageone.xaml?text="; uri += txtbox.text; navigationservice.navigate(new uri(uri, urikind.relative)); } i dont want pass text in url, need pass object instead of below , , way ? person p = new person(); uri+=p in first page following: phoneapplicationservice.current.state["param"] = p; navigationservice.navigate(new uri("/phonepageone.xaml", urikind.relative)); and in second retrieve parameter: person p = phoneapplicationservice.current.state["param"] person; the phoneapplicationservice.state dictionary temporary storage location persists until app deactivated. other option declare static member in, example, app.xaml.cs , use save object 1 page , retrieve second one.

windows 8 - How to play overlapping audio in winrt? -

i'm porting app wp8 requires playback of various sounds can overlap. way i've found far use mediaelement, doesn't allow overlapping sounds. question - easiest , best audio engine use play overlapping audio? ideally need small example of how can this. i've looked wasapi ( http://code.msdn.microsoft.com/windowsapps/windows-audio-session-22dcab6b ), doesn't supports simple playback ? maybe can wrap mediafoundation , call winrt? ( mediaengine audio playback on winrt ) here code now, when play new sound cuts off playing 1 rather blending them. threadutility.runonuithread( async delegate() { // todo doesn't allow sounds overlap! uri uri = new uri(r.base_uri, r.raw.uri_prefix + resourceid); storagefile storagefile = await windows.storage.storagefile.getfilefromapplicationuriasync( uri); mediaelement element = new mediaelement(); var randomaccessstream = await storagefile.openread...

liferay - How to identify JSR version supported by a Portal? -

given particular portal , portlet running in it, how identify jsr version supports? more specifically, want know if liferay ce 6.0 supports jsr 168? , support jsf 286 provided after 6.1? i have portlets running on liferay ce 6.0 have below piece of information in portlet.xml . <portlet-app version="2.0".. does version 2.0 indicate adheres jsr 286 , whereas version 1.0 indicates adheres jsf 168? yes version 2.0 means adheres jsr 286. please check en.wikipedia.org/wiki/java_portlet_specification . liferay supports jsr 286 since version 5.