Posts

Showing posts from January, 2013

javascript - Jquery .get not retrieving file -

i have code supposed read html file, split array , display parts of array, when going though alert, found $.get not getting file <html> <head> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"> </script> </head> <body> <button onclick="myfunction()">update</button> <div id="div1"></div> <script> function myfunction() { var info = ""; $.get("../read_test/text.html", function(data) { somefunction(data); }); alert(info); var array = info.split("§n"); var people = array[1].split(","); (var = 0; < people.length; i++) { document.getelementbyid("div1").innerhtml = people[i] + "<br>"; } } function somefunction(data) { ...

java - how to call click() function for a textbox in gwt -

this question has answer here: firing click event code in gwt 8 answers when click button, want give click textbox beside it. however, giving focus textbox wont work. need click it, user can manually how do programmatically? button.addclickhandler(new clickhandler() { public void onclick(clickevent event) { //click texbox } }); you can call native event on element: nativeevent event = document.get().createclickevent(); domevent.firenativeevent(event, mytextbox);

java - How to differenciate instanciated variables from others? -

this question has answer here: what nullpointerexception, , how fix it? 12 answers here code: piece grille[][] = new piece[9][9]; grille[0][0] = new piece(1,joueur1,0); grille[8][0] = new piece(1,joueur2,0); grille[0][8] = new piece(1,joueur2,0); grille[8][8] = new piece(1,joueur1,0); grille[0][1] = new piece(3,joueur2,1); grille[1][0] = new piece(3,joueur2,1); grille[1][1] = new piece(3,joueur2,1); grille[7][0] = new piece(3,joueur1,2); grille[7][1] = new piece(3,joueur1,2); grille[8][1] = new piece(3,joueur1,2); grille[7][7] = new piece(3,joueur2,3); grille[7][8] = new piece(3,joueur2,3); grille[8][7] = new piece(3,joueur2,3); grille[0][7] = new piece(3,joueur1,4); grille[1][7] = new piece(3,joueur1,4); grille[1][8] = new piece(3...

bash - Loop only iterates once with `ssh` in the body -

this question has answer here: ssh breaks out of while-loop in bash [duplicate] 3 answers i see questions same as... while loop iterates once when call ssh in body of loop. while read -r line; ssh somehost "command $line" done < argument_list.txt ssh reads standard input, first call ssh consumes rest of argument_list.txt before next call read . fix, either redirect ssh 's standard input /dev/null using either ssh somehost "command $line" < /dev/stdin or ssh -n somehost "command $line" in event ssh does need read standard input, don't want reading more data argument_list.txt . in case, need use different file descriptor while loop. while read -r line <&3; ssh somehost "command $line" done 3< argument_list.txt bash , other shells allow read take -u option spec...

c# - Avoiding duplicate methods for Task and Task<T> -

i have logic task , task<t> . there way avoid duplicating code ? my current code following: public async task<socialnetworkuserinfo> getme() { return await wrapexception(() => new socialnetworkuserinfo()); } public async task authenticateasync() { await wrapexception(() => _facebook.authenticate()); } public async task<t> wrapexception<t>(func<task<t>> task) { try { return await task(); } catch (facebooknointernetexception ex) { throw new noresponseexception(ex.message, ex, true); } catch (facebookexception ex) { throw new socialnetworkexception("social network call failed", ex); } } public async task wrapexception(func<task> task) { try { await task(); } catch (facebooknointernetexception ex) { throw new noresponseexception(ex.message, ex, true); } catch (facebookexception ex) { throw new soci...

powershell - Remote Registry List of PCs -

i trying remote registry values oeminformation key list of computers, cant seem work. error: exception calling "openremotebasekey" "2" argument(s): "the network path not found" what missing? $strmachinename = import-csv c:\temp\pcs.txt foreach ($line in $strmachinename) { try { $reg = [microsoft.win32.registrykey]::openremotebasekey('localmachine', $computer) $regkey=$reg.opensubkey('software\microsoft\windows\currentversion\oeminformation') 'model:{0} manufactured by:"{1}"' -f $regkey.getvalue('model'),$regkey.getvalue('manufacturer') } catch{ write-host "$_" -fore red } } $results|export-csv c:\temp\pcs-results.csv -notype the $computer -variable referring in following line, doesn't exist. [microsoft.win32.registrykey]::openremotebasekey('localmachine', $computer) does content of txt-file have header? ex: computer machin...

Matlab 2D-Array indexing and replacing -

given array array_in of size m*n , r of size s*2. each row in array r corresponds starting , ending values of first column of array_in , corresponding column elements in array_in i.e array_in(:,2:end) should not changed , remaining elements replaced nan. first column of output array_out same array_in. number of rows of array r changes. in following example number of rows assumed 2. array_in = [0 0.1;1 0.8;2 0.5;3 0.2;4 0.3;5 0.6;6 0.8;7 1;8 1.2;9 1;10 0.1]; r = [2 3;6 9]; r 1st row: should considered 2:3 = [2 3]; r 2nd row: 6:9 = [6 7 8 9]; rows i.e [2 3 6 7 8 9] should retained , , expected output is: array_out = [0 nan;1 nan;2 0.5;3 0.2;4 nan;5 nan;6 0.8;7 1;8 1.2;9 1;10 nan]; how can done? ind = ~any( bsxfun(@ge, array_in(:,1).', r(:,1)) & ... bsxfun(@le, array_in(:,1).', r(:,2)) ); array_out = array_in; array_out(ind,2:end) = nan;

gmaps4rails v2 - customize sidebar -

i use gmaps4rails display markers on map , have sidebar witch allow me select marker , open on map. the sidebar wirks customize it. right know do: <script type="text/javascript"> $(document).ready(function(){ var raw_markers = <%=raw @hash.to_json %>; function createsidebarli(json){ return ("<li>" + json.titre + ' ' + json.address + "</li>"); }; function bindlitomarker($li, marker){ $li.on('click', function(){ handler.getmap().setzoom(14); marker.setmap(handler.getmap()); //because clusterer removes map property marker marker.panto(); google.maps.event.trigger(marker.getserviceobject(), 'click'); }); }; function createsidebar(json_array){ _.each(json_array, function(json){ var $li = $( createsidebarli(json) ); $li.appendto('#markers_list'); bindlitomarker($li, json.marker); });...

php - How configure cakephp 2.4.x website in cpanel -

i have uploaded cakephp files cpanel account. after run website. shows error telling pdo mysql connect error. checked database.php file, correct data given. again run again showing same error. core/cake/model/datasource/dbosource.php line 262 → mysql->connect() core/cake/model/connectionmanager.php line 107 → dbosource->__construct(array) core/cake/model/model.php line 3454 → connectionmanager::getdatasource(string) core/cake/model/model.php line 1124 → model->setdatasource(string) core/cake/model/model.php line 3476 → model->setsource(string) core/cake/model/model.php line 2880 → model->getdatasource() core/cake/model/model.php line 2852 → model->_readdatasource(string, array) app/controller/appcontroller.php line 55 → model->find(string, array) [internal function] → appcontroller->beforerender(cakeevent) core/cake/event/cakeeventmanager.php line 248 → call_user_func(array, cakeevent) core/cake/controller/controller.php line 925 → cakeeventmanager->dis...

javascript - Accessing Facebook Graph API from unknown domains -

i'm working on app lets users place widgets on websites visitors can optin email addresses (kinda similar leadpages). now i'd implement facebook optins i'm having difficulties figuring out elegant solution allow access fb app unknown domains, users can authorize app , can use graph api names , email addresses. what kind of approach suggest? currently, i'm handling opening new popup domain's url redirects users fb login page app , handle else in popup looks awful because whole facebook.com seen, not login part in js sdk. thanks!

c# - How to query with a join with linq to sql -

i'm trying query gifts given term categories table. entity framework created bridge table connect "gift" "giftcategroies". query have yielded no results. from dbcontext: public dbset<gift> gifts { get; set; } public dbset<giftcategory> categories { get; set; } the 2 entities created: public class gift { public int id { get; set; } public string name { get; set; } public icollection<giftcategory> categories { get; set; } public int rating { get; set; } } public class giftcategory { public int id { get; set; } public string name { get; set; } public string description { get; set; } public icollection<gift> gifts { get; set; } } here query try , fetch gifts given giftcategory term. no results returned. i'm not sure if need join type of query. var model = gifts in db.gifts join giftcategory in db.categories on gifts.id equals giftcategory.id giftcategory.name.contains(searchter...

javascript - File uploader using jquery ajax -

i want upload file using jquery, getting exception saying undefined not function @ $('#myfile').ajaxform({ html <html> <head> <meta charset="iso-8859-1"> <title>insert title here</title> <script src="jquery-1.11.1.min.js"></script> <script src="x.js"></script> </head> <body> <form enctype="multipart/form-data" action="/fileuploadui5/upload" method="post" id="myfile"> <input type=file name=upfile><br> <input type="submit" name="upload" value="upload" id="ubutton" /> </form> </body> </html> x.js $(document).ready(function() { $(function() { $('#myfile').ajaxform({ beforesend : function() { }, uploadprogress : function(event, position, total, percentcomplete) { ...

Let Excel prefetch the whole ragged hierarchy from SSAS -

Image
i have following ragged hierarchy: you can see there plus sign in front of "rent" however. clicking on it, hierarchy cannot expanded: the hierarchy saved follows in relational database: i using hidememberif onlychildwithparentname in ssas dimension settings. how can make excel show expand sign, if possible? have looked @ query beeing send sql server profiler , can see excel retrieves on level @ time. want force retrieve whole hierarchy or @ least second level user not have non-working expand signs. i know not appear parent child hierarchies, have several constraints not allow me use them. if understanding correctly, need set mdx compatibility in visual studio(vs) , sql server management studio(ssms) , can placeholder value when browse cube. if have misunderstand, please provide more informations. ragged hierarchies hand-in-hand hidememberif , mdx compatibility . mdx compatibility 1 of special-purpose parameters connection string properties...

c# - getting data from upload-template in jquery file upload plugin -

i tried use asp.net mvc 3 example of jquery file upload plugin. i've changed upload-template shows input filed , checkbox every file (user can set data each chosen file). , when user decides upload file need not data provided plugin (file name, file url, file size) data input , checkbox. don't know how values when user uploads many files, because if give id these fields there same id each input , each checkbox, it's not gonna work. if give same class these fields can elements class , iterate through these fields don't know iteration refers file. i've put hidden inputs in form send when file uploaded have no idea how data each input in upload-template send via form. there code used display each file added queue not uploaded yet. <!-- template display files available upload --> <script id="template-upload" type="text/x-tmpl"> {% (var i=0, file; file=o.files[i]; i++) { %} {% var nodename = file.name.substring(0, file.name.le...

extjs - Ext JS: MultiSelect ComboBox beforedeselect behavior -

i have combobox has multiselect true. combobox has initial value set, selected when open combobox. problem becomes when want use combobox.setvalue... using function apparently fires off beforedeselect event, not select event. , odd thing is, beforedeselect fired values i'm setting in setvalue . please see this example . to reproduce issue, can following: click "set combobox value" button click drop down you should see 4 alerts: maryland, pennsylvania, maryland, pennsylvania or click drop down you should see 2 alerts: colorado, colorado click "set combobox value" button you should see 1 alert: colorado click "set combobox value" button again you should see 2 alerts: maryland, pennsylvania maybe i'm misunderstanding event, why behavior? why using setvalue deselect states (that i'm setting) combobox, still have them selected when open combobox? , why first test case show 4 alerts? update looking @ syncselection co...

html - PHP not able to access POST values -

i have html login form processed , displayed user php if not logged in. form set post /user.php in turn accesses authentication class, , either creates session , returns true or false , not log user in. my problem whatever try, html form not post values php processing part. this current source code: log in form: <div class="panel-body"> <!-- begin ifloginerror --> <div class="alert alert-danger"> <p>either username or password incorrect. please try again. <a href="" class="alert-link">forgotten password?</a></p> </div> <!-- end ifloginerror --> <form class="form-horizontal" method="post" action="{root}/user.php"> <div class="form-group"> ...

java - Log4j2 not logging to console -

i cannot log4j 2 log console. nothing showing when running gradle. log4j2.xml in projects root directory: <?xml version="1.0" encoding="utf-8"?> <configuration status="all"> <appenders> <console name="console" target="system_out"> <patternlayout pattern="%d{hh:mm:ss.sss} [%t] %-5level %logger{36} - %msg%n"/> </console> </appenders> <loggers> <root level="all"> <appenderref ref="console"/> </root> </loggers> </configuration> usage in classes: public class abchandler { private final logger logger = logmanager.getlogger(); public abc(string serialportname) { logger.info("opening serial port {}", serialportname); } } loading file , configurations on machine works. this class used: import org.apache.logging....

regex - Removing lines from a text file using python and regular expressions -

i have text files, , want remove lines begin asterisk (“*”). made-up example: words *remove me words words *remove me my current code fails. follows below: import re program = open(program_path, "r") program_contents = program.readlines() program.close() new_contents = [] pattern = r"[^*.]" line in program_contents: match = re.findall(pattern, line, re.dotall) if match.group(0): new_contents.append(re.sub(pattern, "", line, re.dotall)) else: new_contents.append(line) print new_contents this produces ['', '', '', '', '', '', ' ', '', ' ', '', '*', ''], no goo. i’m python novice, i’m eager learn. , i’ll bundle function (right i’m trying figure out in ipython notebook). thanks help! your regular expression seems incorrect: [^*.] means match character isn't ^ , * or . . when inside bracket expressi...

android - Most efficient way of creating XML array of ImageView -

i'm new android programming , wondering best way create array of imageviews instead of making imageview1, imageview2, imageview3 etc. hope way guys suggest allows opportunity of putting them in layout. this sample code assumes have images : image1.jpg , image2.jpg , image3.jpg in project drawables folder. format of images can different create array of images private int[] images = {r.drawable.image1, r.drawable.image2, r.drawable.image3, r.drawable.image4}; set baseadapter class imagesadapter extends baseadapter { int[] images; public productlist(int[] images) { this.images = images; } @override public int getcount() { return images.length(); } @override public object getitem(int position) { return images[position]; } @override public long getitemid(int position) { return 0; } @override public view getview(int position, view convertview, viewgroup parent) { if (convertview == null) { conv...

graph - dynamically updating SimpleHistogramDataSet on certain event -

i need example programs on simplehistogramdataset dynamically update graph when new responses server arrive...i new jfreechart actually...kindly send me links that can me building dynamic simplehistogramdataset on occurance of events(e.g. new responses arrive server)... have compare response times of 2 different server strategies ...ie..strategy1 send me 10,000 responses , create dynamic simplehistogramdataset strategy2 send me 10,000 responses , create simplehistogramdataset,,,but want draw 2 strategies output on same graph compare them....i dummy in jfreechart guide pe through proper links plz..

azure - Creating Job from REST API returns a request property name error -

i have asset , mediaprocessor ready. trying encode asset. when send request specified in tutorial ( http://msdn.microsoft.com/en-us/library/jj129574.aspx ): { "name":"curltestjob", "inputmediaassets":[ { "__metadata":{ "uri":"https://wamsbluclus001rest-hs.cloudapp.net/api/assets('nb%3acid%3auuid%3a429967f5-4709-4377-bab2-4680ae2a0dd87')" } } ], "tasks":[ { "configuration":"h.264 hd 720p vbr", "mediaprocessorid":"nb%3ampid%3auuid%3a2e7aa8f3-4961-4e0c-b4db-0e0439e524f5", "taskbody":"<?xml version=\"1.0\" encoding=\"utf-8\"?><taskbody><inputasset>jobinputasset(0)</inputasset><outputasset>joboutputasset(0)</outputasset></taskbody>" } ] } i following response { "odata.error": { ...

javascript - JQuery an item.ID in the View -

continuing after previous question had answered: on click - make @html.displayfor editable text field i trying movie item's id in jquery, need in "var" form. i can .name via text box entry, cannot seem work code grab id. appreciated! view snippet @html.hiddenfor(modelitem => item.id) // <-- above bit <span class="item-display"> <span style="font-size: 17px;">@html.displayfor(modelitem => item.name)</span> </span> <span class="item-field"> @html.editorfor(modelitem => item.name) </span> here jquery lets me item-field's value .on("focusout", "span.item-field", function (event) { console.log("this log"); var $field = $(event.currenttarget), $display = $field.prev("span.item-display"); $display.html($field.find(":input:first").val()); $display.show(); $field.hide(); ...

php - Logging file changes in CentOS -

i running centos development server. how go setting logs following: (apache server) (files located in www/html default dir) what time files altered what altered in files (they .php files) what ip did changes originate from? thanks in advance!

ios - display a NSString in cell.accessoryView instead of a UIImageView? -

how can assign string accessory view of cell instead of uiimageview ? thanks! a string not view. perhaps want display uilabel ? the accessoryview property uiview , can assign uiview subclass it. cell.accessoryview = mylabel work fine.

r - Build summary table from matrix -

i have matrix mdat <- matrix(c(0,1,1,1,0,0,1,1,0,1,1,1,1,0,1,1,1,1,0,1), nrow = 4, ncol = 5, byrow = true) [,1] [,2] [,3] [,4] [,5] [1,] 0 1 1 1 0 [2,] 0 1 1 0 1 [3,] 1 1 1 0 1 [4,] 1 1 1 0 1 and i'm trying build t: t1 t2 t3 row1 1 2 4 row2 2 2 3 row3 2 5 5 row4 3 1 3 row5 3 5 5 row6 4 1 3 row7 4 5 5 where each row in mdat: t1 shows mdat row number t2 shows mdat column there's first 1 t3 shows mdat column there's last consecutive 1. therefore row1 in t [1 2 4] because row 1 in mdat first 1 in column 2 , last consecutive 1 in column 4. row2 in t [2 2 3] because row 2 in mdat first 1 in column 2 , last consecutive 1 in column 3. this try: for (i in 1:4){ (j in 1:5) { if (mdat[i,j]==1) {t[i,1]<-i;t[i,2]<-j; cont<-0; while (mdat[i,j+cont]==1){ cont<-cont+1; t[i,3]<-cont} } } } here's strategy using apply/rle richard su...

delete subarrays from multiple array by equal values of key PHP -

i faced problem , hope can help i have array (but hundreds of subarrays): array ( [0] => array ( [id] => 211 [name] => name [description] => desc [link] => http://link/211 [previewurl] => https://link/id885364?mt=8 [payout] => 0.30 [image] => http://link/ios.png [categories] => array ( [0] => ios [1] => games ) ) [1] => array ( [id] => 2 [name] => name [description] => desc [link] => http://link/211 [previewurl] => https://link/id885364?mt=8 [payout] => 2 [image] => http://link/ios.png [categories] => array ( [0] => ios [1] => games ) ) ...

magicsuggest - Magic Suggest - Pre-select multiple items from MVC Model -

i'm looking way populate magic suggest control multiple values. using asp.net mvc , set these values based on properties in model. part 1: magic suggest support multiple values? related question on sof addresses adding single value not multiple. possible? part 2 : ideally, i'd bind control mvc model somehow. if not possible, i'd @ least set pre-selected values dynamically. have access model via razor syntax. similar how magic suggest allows set data perhaps. $(function () { $('#magicsuggest').magicsuggest({ data: '/controller/getvaluesjson?mealid=@model.id', valuefield: 'id', displayfield: 'name', /* property below allows pre-selection */ /* how can use razor , set mvc model?* / value: */ code here */ }); }); edit: part 2: attempting set value property variable seems fail. i've tried variations of strings, quotes etc. no ava...

java - How to check if an adapter filter doesn't correspond to any entries in a listview -

does "getfilter().filter();" on simple adapter have way check if listview has particular entry ? i have code: string tempstring = searchfield.gettext().tostring(); if (tempstring != "") { mainactivityfragment.adapter.getfilter().filter(tempstring); mainactivityfragment.actionbar.setsubtitle("search results"); } else { toast.maketext(getactivity().getbasecontext(), "the search field can't empty !", toast.length_short).show(); } i'd know if "filter(tempstring);" true (it exists in particular listview). if not maybe prompt user message. there similar question here may or may not duplicate i'll link here: android - listview filter count . you can count results after applying filter. unless question knowing before hand; if that's case please edit question specify , can try different solution.

content management system - loading a template in php -

i'm building small cms in php have problem front end. have folder name template inside folder got different themes -admin -template ---theme1 ---theme2 ---theme3 -index.php when load index.php can load theme, in browser url localhost/cms/template/theme1/page.php but have localhost/cms/page.php instead. will please tell me when i'm doing wrong! thanks. i'm little confused...you front end issue, point url issue. my guess this: need identify different themes using separate stylesheets in css . having different pages called page.php looks differently requires more work , complicates issue. css designed customize of different pages and/or templates. why not create 3 different stylesheets , create simple form allows administrator choose stylesheet use (by radio button , or else). you can determine stylesheet "in use" in number of ways - either on end or front end. given cms, you'll want administrators choose stylesheet , allow selectio...

java - Path2D.intersect() Similar to Area.intersect() -

Image
i have played around area.intersect() , wondering if there way create method 1 using path2d because noticed performance jump when using path2d shape. in other words take portion of large path2d , create smaller path2d portion. map drawing in-game view note: using below hashmap render tiled shapes viewing area according each "object" in case different image types : ocean, grass, obsidian, rock, sand, & dirt... linkedhashmap<point, linkedhashmap<object, path2d.double>> edit : each image type has entire map area of own 10000px 100000px tiles intersect 100px 100px shoved linked hash map point given type path2d.double , rendered onto screen points in current viewing area. it's not clear sdk you're working offers area.intersect(). depanding on intend intersect path with, however, may complex problem - notice path2d intersected polygon may turn several paths! however, there known algorithm intersecting path polygon, such cyrus-beck ...

ruby on rails - Passing a list of same parameters with a different value -

so creating client methods create path hit external service. also, using addressable gem. here example: def get_member(ord_id, member_id) path = '/organizations/{ord_id}/people/{member_id}' hash = get(path, member_id: member_id, org_id: ord_id) { member.custom_deserialize_method(hash) } end this works if path simple above. now want write method different path bulk this: organizations/ab9176be/members/bulk?memberid=8e936891&memberid=b71c4f1e (this not web url. service end point) the above method can have multiple memberid params. know addressable has expand method , ruby has to_param method. but not not know if in situation. appreciate here. route globbing i'm sure if help, considering you've had no responses, felt i'd best posting i learnt route globbing few weeks back. bascially allows define routes this: get 'books/*section/:title', to: 'books#show' would match books/some/section/last-words-a-m...

java - Spring MVC on Tomcat PermGen Space increase constantly -

Image
i have web app built on top of springmvc 3.2 , running on tomcat. use visualvm monitor permgen space , found increase constantly: i take 3 heap dump , run "classloader loaded classes histo" analysis , found these results: the 9:44pm dump: loader:org.springframework.instrument.classloading.tomcat.tomcatinstrumentableclassloader#1, count:3285 the 9:55pm dump: loader:org.springframework.instrument.classloading.tomcat.tomcatinstrumentableclassloader#1, count:3286 the 7:40am dump: loader:org.springframework.instrument.classloading.tomcat.tomcatinstrumentableclassloader#1, count:3855 my app quite during period. looks number of classes been loaded increasing constantly. want understand classes newly loaded across these heap dump. running "classloader loaded classes" doesn't give me information buried these kind of information: anyone has experience on analysing kind of issue? update jvm info jvm: java hotspot(tm) 64-bit server vm (20.45-b01, m...

jquery - My css dropdown menu shows in the wrong place on internet explorer and firefox -

everything works great on chrome , safari when tried check using ie , ff submenu menu shows in left side of main navigation. website cedumilam.php.cs.dixie.edu. css code: #nav { margin: auto; z-index: 10; display: inline; text-transform: uppercase; text-align: center; } #nav ul { width:570; margin:0px auto 2px auto; text-align:center;} #nav ul li{display: inline; position:relative; z-index:99; } #nav li:hover { position: relative } #nav li:hover > { color: #845343; text-decoration:underline; } #nav li.sub:hover > { border-radius: 10px 10px 0 0; -moz-border-radius: 10px 10px 0 0; -webkit-border-radius: 10px 10px 0 0; } #nav li { color: black; font-weight: bold; text-decoration: none; padding: 15px; display: inline; } #nav li ul { background: #fff; margin-top: 5px; display: none; } #nav li:hover ul { display:block; position:absolute; } #nav li ul { background: white; padding: 2px; } #n...

php - Laravel Eloquent - belongs to many through -

i have sites, pages, elements , element_creators tables, : sites id ... pages id site_id ... elements id page_id ... element_creators id element_id ... i'm able retrieve element creators linked page $this->belongstomany('elementcreator', 'elements', 'page_id', 'element_creator_id'); is there simple way retrieve element creators specific site (through pages) ? thank ! you may try this: $site = site::with('pages.elementcreators')->find(1); // 1 id example then may access elementcreators using this: $elementcreators = $site->pages->fetch('elementcreators');

eclipse - Property detection android -

in ios textview has property detection detects whether string valid phone number, or email link .. this property exists in android? thanks in xml can set android:inputtype of textview instance email can use <edittext android:id="@+id/edittext1" android:layout_width="match_parent" android:layout_height="0dp" android:layout_weight="1" android:ems="10" android:inputtype="textemailaddress" /> and phone number can use. <edittext android:id="@+id/edittext1" android:layout_width="match_parent" android:layout_height="0dp" android:layout_weight="1" android:ems="10" android:inputtype="phone" />

c++ - Use the private variable of the superclass with friend -

i have class private variable a. class b subclass of a. in class b_test, wrtite "b b; b.a;", put friend class c in both class , class b still no works. any idea? thank you. (sorry make mistake in code when post question. solved now). rod_algonquin right. thank you.) private members not inherited . if want access member in inherited class, need use protected modifier.

ruby - How to find screen coordinates of a smaller image within a screenshot -

Image
how coordinates of image exists within screenshot? i have screen shot looks this. (partial) and find out coordinates of progress indicator and play button my script written in ruby , running osx 10.7 is there exists can this? if brute force search needed whats best language in? if know target size use brute force attack ... this pretty basic shape/pattern so if size known quite easy , not slow ... 1. find possible locations create control points check possible location of button they should describe image discard invalid loactions something this: red dots control points the less tne number of points faster be but less precise ... now go through entire screen , compute maxdiff = max(|scrpnt(i)-ctrlpnt(i)|) avgdiff = sum(|scrpnt(i)-ctrlpnt(i)|) / n n - number of control points (in picture n = 11) i = 0,1,2...n-1 if both maxdiff , avgdiff < treshold possible location on button 2. test possible location now check points of ...

elisp - Emacs -- how to consolidate :lighter(s) for minor modes -

is possible consolidate :lighters on mode-line when combination of active minor modes exists? if so, how please? example: minor mode number 1 has :lighter of " -" minor mode number 2 has :lighter of " +" if both minor modes active in buffer, consolidate lighters: " ±" you can dynamically alter lighter value minor mode modifying minor-mode-alist : (setcar (cdr (assq 'mode minor-mode-alist)) value) when either of modes activated or deactivated, check status of other, , set lighter text accordingly. when both active can make 1 empty string, , other 'combined' lighter. or, better, take advantage of fact mode-line construct valid, , make automatic. using delight.el wrapper above, , assuming both modes defined mylibrary.el might say: (delight '((mode+ (mode- " ±" " +") "mylibrary") (mode- (mode+ "" " -") "mylibrary"))) that's not perfe...

apache - Redirect link to new link with anchor tag -

i have url: www.example.com/test/here. i want re-direct to: www.example.com/test2/home#here. i have tried: rewriterule /apply$ www.example.com/test2/home#here [r, ne] but getting server error. sorry not htaccess files. you getting server error because of this: [r, ne] you can't have spaces in rewrite flags, confuses mod_rewrite , makes think it's parameter, making think you've not closed flags ] . besides that, you're regex pattern: /apply$ will never match /test/here . perhaps, should try ^test/here$ instead.

c# - Migrating From NHibernate to Entity Framework 6 -

does know if there way nhibernate's referencesany in entityframework? background i've been tasked updating application uses nhibernate (specifically version 2.1.2.4000). company prefer go entity framework going forward. ideally not have change database schema (deal dba's), i'm having issues figuring out how map entity uses referencesany similar in entity framework. my nhibernate mapping reference: //this in spectator mapping class, isn't related @ // player, judge, or viewer mapping.referencesany(p => p.owner) .entitytypecolumn("owner") .entityidentifiercolumn("owner_id") .addmetavalue<player>("player") .addmetavalue<judge>("judge") .addmetavalue<viewer>("viewer") .identitytype<int>(); player , judge , , viewer descend same base abstract class person stored in database separate tables (with there not being table person ). i haven't been able figure out...

javascript - Scope variable not printing AngularJS -

i starting build first single page application in angularjs , stuck on simple problem. want able set scope variables 'title' , 'subtitle' change page header each time user clicks 'link'. on main index page, html should displaying looks this: <div id="header"> <h1>{{title}}</h1> <h3>{{subtitle}}</h3> </div> in app.js file doing of routing, have multiple controllers applied depending on url. each of controllers looks this: app.controller('displayctrl', function($scope, $http) { $scope.title = "machine profiles"; $scope.subtitle = "add, remove, , view data machines"; console.log($scope.title); }); as can see outputting console variable set, , displaying correct thing. problem h1 , h3 tags not displaying scope variable! title , subtitle in header blank, though scope variable being set , logged. not getting errors in console on page load or when click links. ...

javascript - How can I use Greasemonkey to reorganize a <ul> list? -

i tried adapt someone's script stack overflow post, did wrong. i've got no experience javascript or jquery, so... please help? the target-page html looks this: <div class="container7"> <div class="userdata"> <h4></h4> <ul id="userinfo" class="set textsize"> <li class="name"></li> <li class="joindate"></li> <li class="title"></li> <li class="custom"></li> <li class="description"></li> </ul> </div> </div> i want modify this: <div class="container7"> <div class="userdata"> <h4></h4> <ul id="userinfo" class="set textsize"> <li class="joindate"></li> ...

web services - How do I control the timeout for a webservice call in WinDev? -

we have integrated several different 3rd party web services have seen long waits , timeouts these services. there way set amount of time wait? as noted httptimeout works network connections. in experience works soaprunxml(). http://doc.windev.com/en-us/?3043008 httptimeout http://doc.windev.com/en-us/?3069014 soaprunxml in httptimeout reference soaprun in soap run there no reference httptimeout. shows documentation far complete.

sql - MySQL: Modifying a query based on EXPLAIN plan -

i have long running query i'd speed up. result of query new table. the tables myisam , running on large ec2 instance (m2.4xlarge, 64gb ram). system usage looks this: pid user pr ni virt res shr s %cpu %mem time+ command 17438 mysql 20 0 32.7g 7.1g 7420 s 2 10.6 1:35.82 mysqld relevant portion of cnf: key_buffer = 32768m max_allowed_packet = 96m thread_stack = 192k thread_cache_size = 8 sort_buffer_size = 2m read_buffer_size = 2m read_rnd_buffer_size = 8m table_cache = 512 thread_concurrency = 8 bulk_insert_buffer_size = 2048m max_write_lock_count = 1 # ~1/4 of memory of machine max_heap_table_size = 16384m tmp_table_size = 16384m # ~1/4 of memory myisam_sort_buffer_size = 17179869184 when run simple query, takes longer think should , memory , cpu usage on machine low. the query explain p...

jquery - How to Learn JavaScript Correctly Quiz Issue -

i'm working through how learn javascript correctly . halfway through has create quiz application. i'm able display first question, clicking next button changes second question. problem when click button third time, screen clears , third question never appears. i'm sure i'm missing easy. idea i'm going wrong? app.js: var allquestions = [ {question: "who prime minister of united kingdom?", choices: ["david cameron", "gordon brown", "winston churchill", "tony blair"], correctanswer:0}, {question: "who president of united states?", choices: ["george bush", "barack obama", "hilary clinton"], correctanswer:1}, {question: "what best state?", choices: ["iowa", "wisconsin", "colorado", "north carolina"], correctanswer:1} ]; var score = 0; var = 0; $(document).ready(function() { ...

.net 4.0 - Json.net: Preventing OutOfMemoryErrors when handling large objects -

my question same this one , unfortunately answer doesn't work me. i'm trying handle edge cases, 1 of case receive unusually large (e.g., 150 million character) json string server. i'm using memory optimization technique described in json.net docs , still outofmemoryerror in deserialization step. what correct way handle large json objects json.net? i'd settle setting max length flag, i'm not sure how that. here's code: dim serverresponsestream stream = 'gzipwrapperstream response server using sr streamreader = new streamreader(serverresponsestream), _ reader jsonreader = new jsontextreader(sr) dim serializer jsonserializer = new jsonserializer() 'out of memory exception here in deserialize dim response = serializer.deserialize(reader) end using edit: per this answer , have tried: dim = new jarray() using sr streamreader = new streamreader(serverresponsestream), _ reader j...