Sunday, 15 May 2011

How to stop Devforce 7.2.3 deleting partial classes -



How to stop Devforce 7.2.3 deleting partial classes -

ever since upgraded devforce 7.2.3 , utilize entity framework 6.1 when ever create alter edmx , save of partial classes have in .model project deleted.

this happened lastly upgrade. can't find setting controls this. know how behavior can turned off?

devforce

Cassandra: Is this proper schema for the data model? -



Cassandra: Is this proper schema for the data model? -

in sensor-based application, 300k objects beingness monitored per hr on 30 metrics each having success , failure counters.

my schema:

create table measurements( objid int, hr timestamp, metric text, succ int, fail int, primary key (objid, hour, metric));

data retention period within 1 year, way table have 300k rows each having 24*360*30*2 columns(cells).

usual queries counter values aggregated on specified time interval (could days, weeks, months) , specified objects (ranging 1 hundreds).

time slicing ok column slicing, while retrieval of multiple objects bit pain, since rows keyed per object objid , lead multiget.

the general query can think of is:

select * measurements objid in (id1, id2, id3...idn) , hr >= <starttime> , hr < <endtime>;

of course of study aggregation have done manually in application.

q: optimal way construction info given query pattern?

worst case 'overall' result on period, means taking objects account. mean, perspective, total table scan. recommended practice perform such task w/o resorting mapreduce?

if know typically restricting subset of time , possible set of objects within each hr may sparse, might consider reversing index order, time first dimension. way, picking out columns restricted set of rows, still need multi-get, if querying objects common, number of rows may smaller.

if typically query/aggregate different granularities of time, store duplicate info @ higher granularities of time well, per day, week, month, etc. speed queries larger time scales. de-normalization friend in cassandra!

it's possible maintain around indices both orderings , take index based upon type of query performing.

cassandra schema

java - HTTP Status 500 - An exception occurred processing JSP page /FinancialAssessment.jsp at line 440 -



java - HTTP Status 500 - An exception occurred processing JSP page /FinancialAssessment.jsp at line 440 -

following exact error.

type exception report:

message exception occurred processing jsp page /financialassessment.jsp @ line 440

description:

the server encountered internal error prevented fulfilling request.

exception:

org.apache.jasper.jasperexception: exception occurred processing jsp page /financialassessment.jsp @ line 440 437: 438: 439: 440: if(std.prev_treatment_start_date.equals("null")) 441: { 442: system.out.println("out krishna------------"); 443:

stacktrace:

org.apache.jasper.servlet.jspservletwrapper.handlejspexception(jspservletwrapper.java:568) org.apache.jasper.servlet.jspservletwrapper.service(jspservletwrapper.java:470) org.apache.jasper.servlet.jspservlet.servicejspfile(jspservlet.java:390) org.apache.jasper.servlet.jspservlet.service(jspservlet.java:334) javax.servlet.http.httpservlet.service(httpservlet.java:728)

root cause:

java.lang.nullpointerexception org.apache.jsp.financialassessment_jsp._jspservice(financialassessment_jsp.java:542) org.apache.jasper.runtime.httpjspbase.service(httpjspbase.java:70) javax.servlet.http.httpservlet.service(httpservlet.java:728) org.apache.jasper.servlet.jspservletwrapper.service(jspservletwrapper.java:432) org.apache.jasper.servlet.jspservlet.servicejspfile(jspservlet.java:390) org.apache.jasper.servlet.jspservlet.service(jspservlet.java:334) javax.servlet.http.httpservlet.service(httpservlet.java:728)

if error line 1 on if statement prabably, seek this:

if( std == null || std.prev_treatment_start_date == null ) { .....

this because in java have test each object avoid nullpointerexception means object null , cannot have methods or attributes.

java jsp servlets

html - How to detect browser type in HTML5 or Javascript for playing mp3 instead of webm in Safari/IE browsers? -



html - How to detect browser type in HTML5 or Javascript for playing mp3 instead of webm in Safari/IE browsers? -

i have created survey in qualtrics wherein play webm audios. in safari webm doesn't play , ie user needs install this google plugin. wondering if there code in preferably html(5) or javascript can observe type of browser , if it's safari or ie play mp3 version of audio(which have on server well). please allow me know if there improve solutions tackling problem of playing sound in various browsers.

the sec auditory story titled, &ldquo;the precious possession.&rdquo; press &ldquo;play story&rdquo; button begin listening story; after have finished listening story, reply set of questions story. <div> <audio controls="" id="audio3" style="display:none"><source src="http://langcomplab.net/most_precious_possession_master.webm" style="width:50%" type="audio/webm" />your browser doesn&#39;t back upwards sound format.</audio> </div> <p>&nbsp;</p> <div><button name="play" onclick="disabled=true" style="height:25px; width:200px" type="button">play story</button></div>

here's javascript in qualtrics means cannot alter much.

qualtrics.surveyengine.addonload(function() { /*place javascript below line*/ var aud = document.getelementbyid('audio3'); this.questionclick = function(event,element){ if((element.type == "button") && (element.name == "play")) { aud.play(); } } });

if provide both mp3 , webm sources , set type attribute properly, browser can select 1 supports. add together mp3 one. set mp3 1 first since old safari browsers utilize first 1 (and supported mp3), otherwise browsers select first 1 can back upwards based on type.

<audio controls="" id="audio3" style="display:none"> <source src="http://langcomplab.net/most_precious_possession_master.mp3" style="width:50%" type="audio/mp3" /> <source src="http://langcomplab.net/most_precious_possession_master.webm" style="width:50%" type="audio/webm" /> browser doesn&#39;t back upwards sound format. </audio>

see additional info on mdn applies both sound , video.

https://developer.mozilla.org/en-us/docs/web/guide/html/using_html5_audio_and_video

javascript html html5 audio safari

css - Is there a way to position page content UNDERNEATH or ON TOP OF a scrollbar? -



css - Is there a way to position page content UNDERNEATH or ON TOP OF a scrollbar? -

i'm trying emulate ctrl+f functionality chrome highlights matches on page in scrollbar, fields in form. using page offsets , percentages, have blocks of color correspond relative locations of fields on page.

in prototype, blocks of color sit down left of scrollbar. ideally, they'd sit down underneath scrollbar, , scrollbar's track transparent looks they're part of scrollbar track.

can default scrollbar set allow overflow content show underneath (or allow page content go on it)? know accomplished if rolled own scroll, i'd utilize default ones provided browser if @ possible.

it's clearest if @ prototype.

css:

::-webkit-scrollbar { width: 14px; height: 18px; background-color:transparent; } ::-webkit-scrollbar-track, ::-webkit-scrollbar-track-piece { background:none; } ::-webkit-scrollbar-thumb { height: 6px; border: 4px solid rgba(0, 0, 0, 0); background-clip: padding-box; -webkit-border-radius: 7px; background-color: #333 } ::-webkit-scrollbar-button { width: 0; height: 0; display: none; } ::-webkit-scrollbar-corner { background-color: transparent; }

i thought of rendering matches on trackbar browsers today before. thought simple using linear-gradient background ::-webkit-scrollbar-track. did not seek implementing this. right after reading question, i've tried , looks it's not such easy.

you can utilize linear-gradient background ok, if seek rendering more 1 match (a line), can't rendered (especially when window's size changed) , line not rendered smoothly. such seems ok:

//render 2 lines, 1 @ 50px , other @ 100px background: linear-gradient(transparent 50px, reddish 50px, reddish 51px, transparent 51px, transparent 100px, reddish 100px, reddish 101px, transparent 101px);

but it's not stable, said when seek resizing window, @ size, line won't rendered (at to the lowest degree tried on opera). when window's height large, line becomes blurred (not sharp) , thicker. don't understand this, because color stops set fixedly (by px, not %). issue worse when number of lines larger. have linear-gradient many corresponding color stops. seems neat way solve problem. because of undesired issue, can't utilize approach.

the new approach: tried using multi-backgrounds feature instead. each background renders 1 line, background-size same background 2px height , background-position should different. here equivalent code (to above clean code) using approach:

background: linear-gradient(red, red), linear-gradient(red, red); background-repeat: no-repeat; background-size: 100% 2px; background-position: 0 50px, 0 100px;

the new approach of course of study requires browser has back upwards multi-backgrounds features (looks ie8- not back upwards cool feature).

so that's need solve problem. need find how apply style using script. can't select pseudo-element (or that) via script. can utilize window.getcomputedstyle() method read-only style of pseudo-element. have way modify css directly. that's using pure js help of document.stylesheets , cssrules. allow insert/remove/modify rule.

that looks great. there still issue. when changing style using method, style not applied right (at to the lowest degree happens ::-webkit-scrollbar-track, may not happen other elements). when move mouse on scrollbar, new style applied. i've found simple way invalidate scrollbar setting overflow of document.documentelement (the html) hidden , set auto. works well.

here code:

var requiredtb = $(".required input"); var invalids = requiredtb; var offsets = []; //init offsets highlight on trackbar later requiredtb.each(function() { offsets.push(($(this).offset().top)/document.body.scrollheight * 100); }); //find rule styling -webkit-scrollbar-track //we added in css stylesheet, done 1 time var sheets = document.stylesheets; var trackrule; for(var = 0; < sheets.length; i++){ var rules = sheets[i].cssrules || sheets[i].rules; for(var j = 0; j < rules.length; j++){ var rule = rules[j]; if(rule.selectortext == "::-webkit-scrollbar-track:vertical"){ trackrule = rule; break; } } } //define invalidate() method, need utilize method //to refresh scrollbars, otherwise newly applied style not affected window.invalidate = function(){ $(document.documentelement).css('overflow','hidden'); settimeout(function(e){ $(document.documentelement).css('overflow','auto'); },1); }; //this main function set style scrollbar track. function settrackhighlights(positions, color){ positions.sort();//ensure input array should ascendingly sorted. trackrule.style.csstext = ""; var gradient = "background: ", backpos = "background-position: "; var winheight = $(window).height(); $.each(positions, function(i,pos){ gradient += "linear-gradient(" + color + ", " + color + "),"; backpos += "0 " + pos + "%," }); gradient = gradient.substr(0,gradient.length-1) + ";"; backpos = backpos.substr(0,backpos.length -1) + ";"; trackrule.style.csstext += gradient + backpos + "background-repeat:no-repeat; background-size:100% 2px"; invalidate(); } //initially set highlights on trackbar settrackhighlights(offsets,'red'); //handle oninput event update highlights accordingly requiredtb.on('input', function(e){ var required = $(this).closest('.required'); var refreshhighlights = false; if(this.value && !required.is('.ok')) { required.addclass('ok'); refreshhighlights = true; invalids = invalids.not(this); } if(!this.value && required.is('.ok')) { required.removeclass('ok'); refreshhighlights = true; invalids = invalids.add(this); } if(refreshhighlights){ offsets.splice(0); invalids.each(function() { offsets.push(($(this).offset().top)/document.body.scrollheight * 100); }); settrackhighlights(offsets,'red'); } });

you have add together empty ::-webkit-scrollbar-track:vertical rule (we need deal vertical scrollbar) in css code, should appended @ lastly override similar rule before. can in fact utilize insertrule() method (of cssrulelist can accessed via cssrules property) add together new rule instead of looping through stylesheets, , through cssrules (of each sheet) find empty rule ::-webkit-scrollbar-track:vertical.

the code posted here can improved, such can add together method settrackhighlights allow add together more lines (instead of rendering lines each time need add/remove 1 line)...

note using term line, mean rendering representation of match on trackbar.

demo

css scroll scrollbar scrollbars

ios - Images in Images.xcassets Not Showing up When Archiving App? -



ios - Images in Images.xcassets Not Showing up When Archiving App? -

i using xcode 5.1.1 , images.xcassets store important amount of app's images (i realize doing this, building , running app takes longer). anywho, works expected. when hook device , run it, images show fine.

the problem is, when archive project send beta testers, upon installing through means, app not show of images stored in images.xcassets, other images stored appear (the icons stored in images.xcassets appear though).

what wrong here?

i have found workaround works me. faced same issue , found out problem deployment target version. when changing deployment target ios 6.0 ios 8.0, many images part of image catalogue(image.xcasset) not seen when creating archive , sharing testers. worked fine when running development build on same iphone. on changing deployment target ios 8.0 ios 6.0 , creating archive 1 time again images seen. workaround alter deployment target 6.0. not sure if there ios bug though.

ios objective-c xcode archive xcasset

xml - How a value bind to another binded Node to get the TEXT which inside that Node -



xml - How a value bind to another binded Node to get the TEXT which inside that Node -

1i have xml , xslt files, want xslt auto value node in same xml file .

xslt line 68 know should not set way, no thought how pass value in key('description2-by-id', thanks

xml data

<data> <countrylist> <countryname code="aa" name="antarctica" ist="true"/> <countryname code="ab" name="abkhazia" ist="false"/> </countrylist> <description1list> <description1name description1id="1" recordtype="person">p1</description1name> <description1name description1id="2" recordtype="person">p2</description1name> <description1name description1id="1" recordtype="entity">e1</description1name> </description1list> <description2list> <description2name description2id="1" description1id="2">p21</description2name> <description2name description2id="2" description1id="2">p22</description2name> <description2name description2id="3" description1id="3">e11</description2name> </description2list> <description3list> <description3name description3id="1" description2id="1">p211</description3name> <description3name description3id="2" description2id="3">e111</description3name> </description3list> <referenceslist> <referencename code="9811" name="national list" description2id="1"/> </referenceslist> <records> <person id="752" date="15-oct-2013"> <country countrytype="bb"> <countryvalue>aa</countryvalue> </country> <descriptions> <description description1="1" description2="2" description3="1"/> <description description1="2"/> </descriptions> <references> <reference>9811</reference> </references> </person> <entity id="758" date="15-oct-2013"> <country countrytype="bc"> <countryvalue>ab</countryvalue> </country> <descriptions> <description description1="1" description2="3" description3="2"/> <description description1="3"/> </descriptions> </entity> </records> </data>

xslt

<?xml version="1.0" encoding="utf-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/xsl/transform"> <xsl:key name="country-by-code" match="countryname" use="@code"/> <xsl:key name="description1" match="description1name" use="concat(@description1id, '|', @recordtype)"/> <xsl:key name="description2-by-id" match="description2name" use="@description2id"/> <xsl:key name="description3-by-id" match="description3name" use="@description3id"/> <xsl:key name="reference-by-code" match="referencename" use="@code"/> <xsl:template match="/"> <html> <body> <table border="1"> <tr> <th>id</th> <th>date</th> <th>country</th> <th>description1</th> <th>description2</th> <th>description3</th> <th>reference</th> <th>referencename</th> <th>referencedescription2code</th> <th>referencedescription2</th> </tr> <xsl:apply-templates select="data/records/*"/> </table> </body> </html> </xsl:template> <xsl:template match="person | entity"> <xsl:variable name="varrrecord" select="."/> <xsl:for-each select="$varrrecord/country"> <xsl:variable name="varcountry" select="self::country"/> <xsl:for-each select="$varrrecord/descriptions/description | $varrrecord[not(descriptions/description)]"> <xsl:variable name="vardescription" select="self::description"/> <xsl:for-each select="$varrrecord/references/reference | $varrrecord[not(references/reference)]"> <xsl:variable name="varreference" select="self::reference"/> <tr> <td> <xsl:value-of select="$varrrecord/@id"/> </td> <td> <xsl:value-of select="$varrrecord/@date"/> </td> <td> [<xsl:value-of select="$varcountry/@countrytype"/>] <xsl:value-of select="key('country-by-code', $varcountry/countryvalue)/@name"/> [<xsl:value-of select="key('country-by-code', $varcountry/countryvalue)/@ist"/>] </td> <td> <xsl:value-of select="key('description1', concat($vardescription/@description1, '|', name($varrrecord)))"/> </td> <td> <xsl:value-of select="key('description2-by-id', $vardescription/@description2)"/> </td> <td> <xsl:value-of select="key('description3-by-id', $vardescription/@description3)"/> </td> <td> <xsl:value-of select="$varreference"/> </td> <td> <xsl:value-of select="key('reference-by-code', $varreference)/@name"/> </td> <td> <xsl:value-of select="key('reference-by-code', $varreference)/@description2id"/> </td> <td> <xsl:value-of select="key('description2-by-id', <xsl:value-of select="key('reference-by-code', $varreference)/@description2id"/>)"/> </td> </tr> </xsl:for-each> </xsl:for-each> </xsl:for-each> </xsl:template> </xsl:stylesheet>

actual outcome is

|id |date |country |description1 |description2 |description3 |reference |referencename |referencedescription2code |referencedescription2| |752 |15-oct-2013 |[bb] antarctica [true] |p1 |p22 |p211 |9811 |national list |1 | | |752 |15-oct-2013 |[bb] antarctica [true] |p2 | | |9811 |national list |1 | | |758 |15-oct-2013 |[bc] abkhazia [false] |e1 |e11 |e111 | | | | | |758 |15-oct-2013 |[bc] abkhazia [false] | | | | | | | |

what expected outcome is

|id |date |country |description1 |description2 |description3 |reference |referencename |referencedescription2code |referencedescription2| |752 |15-oct-2013 |[bb] antarctica [true] |p1 |p22 |p211 |9811 |national list |1 |p21 | |752 |15-oct-2013 |[bb] antarctica [true] |p2 | | |9811 |national list |1 |p21 | |758 |15-oct-2013 |[bc] abkhazia [false] |e1 |e11 |e111 | | | | | |758 |15-oct-2013 |[bc] abkhazia [false] | | | | | | | |

again?

i afraid illustration not clear plenty (too many similar values) , there no explanation of logic(!), no more guess:

<td> <xsl:value-of select="key('description2-by-id', key('reference-by-code', $varreference)/@description2id)"/> </td>

what (1) @description2id value matching referencename, , (2) utilize description2name value via 'description2-by-id' key.

xml xslt

javascript - Filtering content of one controller with model in another (AngularJS) -



javascript - Filtering content of one controller with model in another (AngularJS) -

i have similar this:

<div ng-controller="controllera"> <input type="text" id="search_form" value="search" ng-model="searchmodel" /> </div> <div ng-controller="controllerb"> <ul> <li ng-repeat="item in items | filter:searchmodel">{{item}}</li> </ul> </div>

but when search in input bar, not impact list. how can create model 1 controller impact content of another?

thanks.

edit

controllera , controllerb exclusively isolated of each other , maintain way. if need share model other controller, how utilize $rootscope that?

you can utilize service share info between controllers. utilize factory feature angular has define service.

here illustration found here , easy google search.

<!doctype html> <html ng-app="project"> <head> <title>angular: service example</title> <script src="http://code.angularjs.org/angular-1.0.1.js"></script> <script> var projectmodule = angular.module('project',[]); projectmodule.factory('theservice', function() { homecoming { thing : { x : 100 } }; }); function firstctrl($scope, theservice) { $scope.thing = theservice.thing; $scope.name = "first controller"; } function secondctrl($scope, theservice) { $scope.something = theservice.thing; $scope.name = "second controller!"; } </script> </head> <body> <div ng-controller="firstctrl"> <h2>{{name}}</h2> <input ng-model="thing.x"/> </div> <div ng-controller="secondctrl"> <h2>{{name}}</h2> <input ng-model="something.x"/> </div> </body> </html>

javascript angularjs angularjs-model

php - Hook to overlap two image in product loop page and single page in woocommerce -



php - Hook to overlap two image in product loop page and single page in woocommerce -

i working t-shirt designing plugin , going merge woocommerce plugin. in have overlap 2 image bellow.

white t-shirt ( set admin same product). t-shirt logo (uploaded designer product image when uploading product front end end , details goes woocommerce product section ).

the t-shirt logo on top of white t-shirt.

is there hook overlap 2 image in product single page , product loop page in woocommerce.

there no specific hooks same.

store 2 images : 1 product image, other in post_meta product.

you can on lap 2 images on here : can utilize css overlap 2 images 1 did here : http://codepen.io/anon/pen/ijmtn

for changing image in product loop, need remove default woocommerce hook product thumbnail.

remove_action( 'woocommerce_before_shop_loop_item_title', 'woocommerce_template_loop_product_thumbnail', 10 );

and add together custom hook output required markup.

add_action( 'woocommerce_before_shop_loop_item_title', 'your_function', 10 ); function your_function(){ //your code }

for changing image single product page, there template in woocommerce single-product/product-image.php. need override template out required markup

php wordpress woocommerce

python - IOError: [Errno 2] No such file or directory: 'CHTR_trades.csv' -



python - IOError: [Errno 2] No such file or directory: 'CHTR_trades.csv' -

i appreciate help simple code:

import csv open('chtr_trades.csv','rb') csvfile: chtrreader = csv.reader(csvfile, delimiter = ' ', quotechar = '|') row in chtrreader: print ', '.join(row)

i receiving error:

traceback (most recent phone call last): file "/home/peter/pycharmprojects/practice/reader.py", line 4, in <module> open('chtr_trades.csv','rb') csvfile: ioerror: [errno 2] no such file or directory: 'chtr_trades.cs

i checked location of file terminal , in right folder:

peter@peter-hp-g60-notebook-pc:~/pycharmprojects/practice$ ls chtr_quotes.csv chtr_stdev.csv graph.py plot.py practice.py chtr_quotes.short.csv chtr_trades.csv matplotlibrc practice1.py reader.

any help appreciated.

the error telling python not have plenty info find file. can prepare problem supplying total path1:

with open(os.path.expanduser('~/pycharmprojects/practice/chtr_trades.csv'),'rb') csvfile:

or, utilize os.chdir , alter python's current working directory:

from os import chdir os.chdir(os.path.expanduser("~/pycharmprojects/practice/")) open('chtr_trades.csv','rb') csvfile: ...

either way, need give python more info file is.

1in both of code examples above, os.path.expanduser used expand ~ in filepath home directory.

python ubuntu

Get following command line arguments (elements in an array) in C# -



Get following command line arguments (elements in an array) in C# -

how arguments after first 3 string[] in c#?

e.g. [1, 2, 3, 4, 5] want [4, 5]

making sure have using system.linq, can utilize this:

stringarray.skip(3);

this returns ienumerable, can traverse. if need array, can just:

stringarray.skip(3).toarray();

c#

android - setOnCompletionListener (MediaPlayer.OnCompletionListener) in the type MediaPlayer is not applicable for the arguments -



android - setOnCompletionListener (MediaPlayer.OnCompletionListener) in the type MediaPlayer is not applicable for the arguments -

i wanted observe whether sound has finished playing, if not disable 1 button, below code tried

mp.setoncompletionlistener(new oncompletionlistener() { public void oncompletion(mediaplayer mp) { //code disable button here } });

if add together this, below errors

1)description resource path location type oncompletionlistener cannot resolved type lazyadapter.java /chattingdoc/src/com/chattingdoc line 278 java problem 2)description resource path location type method setoncompletionlistener(mediaplayer.oncompletionlistener) in type mediaplayer not applicable arguments (new oncompletionlistener(){}) lazyadapter.java /chattingdoc/src/com/chattingdoc line 278 java problem

public class customvideoview extends videoview { public static int _overridewidth = 250; public static int _overrideheight = 250; public customvideoview(context context) { super(context); } public customvideoview(context context, attributeset set) { super(context, set); } public void resizevideo(int width, int height) { _overrideheight = height; _overridewidth = width; // not sure whether useful or not safe getholder().setfixedsize(width, height); //getholder().setsizefromlayout(); requestlayout(); invalidate(); // important, onmeasure triggered } @override protected void onmeasure(int widthmeasurespec, int heightmeasurespec) { setmeasureddimension(_overridewidth, _overrideheight); } } //xml file <com.destress.customvideoview android:id="@+id/videoview1" android:layout_width="250dp" android:layout_height="250dp" android:layout_centervertical="true" android:layout_centerhorizontal="true" android:gravity="center" /> // utilize code customvideoview video; video = (customvideoview) findviewbyid(r.id.videoview1); video.setoncompletionlistener(new oncompletionlistener() { @override public void oncompletion(mediaplayer mp) { //your code } }

android android-layout media-player

Windows Phone 8.1 Bugsense integration -



Windows Phone 8.1 Bugsense integration -

i wanted integrate bugsense windows phone 8.1 app using info stackoverflow post:

bugsensehandler.instance.initandstartsession(new exceptionmanager(current), "app-key");

the other step in 2 step process of integration bugsense application got me confused. in windows phone 8 documentation/example on bugsense website 1 should remove the

unhandledexception += application_unhandledexception;

line app page code. in 8.1 template line not nowadays default. basicly, added suggested line of code app constructor apikey got. used article additional info on matter: using bugsense windows phone

is there else needs done before can see info on crashes on bugsense website? tried out app on emulator after deploying (i don't mean step step debugging) , on friend's phone well. neither of these yielded info after crashing application.

does have relevant info on how run bugsense on wp 8.1? thanks!

windows-phone-8.1 bugsense

Bash : preserve string with spaces input on command line? -



Bash : preserve string with spaces input on command line? -

i'd allow string captured spaces, that:

echo -n "enter description: " read input echo $input

would produce:

> come in description: wonderful description! > wonderful description!

possible?

the main thing worry when refer variable without enclosing in double-quotes, shell word splitting (splits multiple words wherever there's space or other whitespace character), wildcard expansion. solution: utilize double-quotes whenever refer variable (e.g. echo "$input").

second, read trim leading , trailing whitespace (i.e. spaces @ origin and/or end of input). if care this, utilize ifs= read (this wipes out definition of whitespace, nil gets trimmed). might want utilize read's -r ("raw") option, doesn't seek interpret backslash @ end of line continuation character.

finally, i'd recommend using read's -p alternative supply prompt (instead of echo -n).

with of these changes, here's script looks like:

ifs= read -r -p "enter description: " input echo "$input"

string bash input

jquery - Backbone Marionette Region + Layout + View hierarchy and responsiveness -



jquery - Backbone Marionette Region + Layout + View hierarchy and responsiveness -

i writing first marionette app , utilize marionette ui structure.

my understanding that, speaking,

a region 1:1 existing, single dom node (like div or span) , may contain views, including special ones provided marionette a layout view container of regions , specifies template regions arranged; view may rendered region

so think means must follow sort of hierarchy:

- root (region) [could more one] -- layout --- inner part a1 --- inner part a2 -- layout b --- inner part b1 --- inner part b2 -- view c --- maybe subviews?

if assumptions wrong, please correct.

in case, application has navigation , content area in ui. now, when script loaded, may loading page has div#region-navigation in place customize appearance, or may loading page without node in place. if navigation node in place, don't need render it, need able maintain reference , things ("log in" => "log out" instance). on other hand, if not in place, need render , maintain it.

my question is: "marionette" way handle this? have thought of 1 way, avoid going downwards unnecessarily painful paths.

my solution create absolute rootregion single selector (default body) not exist @ time of creation.

i have 2 applayouts: injectedapplayout, layout has content region, , managedapplayout, layout replaces contents of body.

then based on script tag data- params and/or on page (using jquery) can take layout use.

in either case, have headerregion , contentregion. in case of injectedapplayout headerregion lives outside while managedapplayout contains both. then, perchance need create separate externalheaderregion , internalheaderregion or utilize conditional because need handle things differently depending on whether beingness managed me or not.

this seems sub-optimal haven't found illustration of how people manage this.

finally, in case of injectedapplayout, afraid div containing contentlayout may little if screen width big because not command it. styles, using bootstrap , media queries, utilize max-width values determine styles set. question is: @media (max-width: xxxpx) queries still apply containing div in case of injected app layout?

i've used next structure

-marionette application (root - have regions hash of existing node elements) -- layoutview (breaks application part in sub regions if needed) ---collectionview || compositeview (render collections) ----itemview || ---layoutview (create more sub-regions) ---- (other sub views) || ---itemview (render model)

+router , controllers application statuses maintain

lets separate responses between stuff

application - starts first. in charge of keeping constants , global params, start , stop sub modules load default routers , controllers + provide request/response channel.

1) can receive params on start

var options = { something: "some value", another: "#some-selector" }; myapp.start(options);

2) have regions has work existing nodes (navs, content, footer, sidebars , on)

myapp.addregions({ someregion: "#some-div", anotherregion: "#another-div" });

so can provide params js render right views + can hook-up application node elements

router , controller

helps render right view according application status. in charge of keeping application view right according url , provide navigation can utilize links + navigate manually navigate method

var myrouter = new marionette.approuter({ controller: mycontroller, approutes: { "foo": "dofoo", "bar/:id": "dobar" } });

layoutview in charge of rendering , closing subviews. separate parent node in child

backbone.marionette.layoutview.extend({ template: "#layout-view-template", regions: { menu: "#menu", content: "#content" } });

using construction can pass application params allow application know if user loged in or not. according can add together regions addregions , render layouts (like 'usernav' or 'guestnav') . layout render kid views userlinks, useravatar , on. user click links router , controller handle , tell application render in region.

jquery css backbone.js marionette

c# - ConfigurationErrorsException occured -



c# - ConfigurationErrorsException occured -

i want create custom configuration c# application. app.config likes:

<?xml version="1.0" encoding="utf-8" ?> <configuration> <configsections> <section name="location" type ="folderconfigsection.locationconfig, folderconfigsection"/> </configsections> <location> <folders> <add folder ="c:\test1"/> <add folder ="c:\test2" /> <add folder ="c:\test3" /> </folders> </location> <startup> <supportedruntime version="v4.0" sku=".netframework,version=v4.5" /> </startup> </configuration>

so created 2 classes.

namespace folderconfigsection { public class locationconfig : configurationsection { [configurationproperty("folders")] public string folder { { homecoming base["folder"] string; } set { base["folder"] = value; } } } }

and

namespace folderconfigsection { public class foldercollection : configurationelementcollection { protected override configurationelement createnewelement() { homecoming new folderelement(); } protected override object getelementkey(configurationelement element) { homecoming ((folderelement)element).environment; } } public class folderelement : configurationelement { [configurationproperty("folder", isrequired = true)] public string environment { { homecoming (string)this["folder"]; } set { this["folder"] = value; } } } }

but got exception in program.cs

public class programme { public static void main(string[] args) { locationconfig _locationconfig = (locationconfig)configurationmanager.getsection("location"); string firstfolder = _locationconfig.folder; } }

the exception the section name 'location' reserved <location> sections. want list folders.

anything wrong?

i'm restating @tim has answered in comments.

do not utilize location section name. reserved <location> element configuration. utilize other name, such locationconfig. change type of folder property in locationconfig class string foldercollection. clarity, should alter property name folder plural form folders. to list folders in locationconfig, need iterate folders collection property. might want implement indexer on foldercollection class, indexed access folders property, .

putting in code:

app.config <?xml version="1.0" encoding="utf-8" ?> <configuration> <configsections> <section name="locationconfig" type ="folderconfigsection.locationconfig, folderconfigsection"/> </configsections> <locationconfig> <folders> <add folder ="c:\test1"/> <add folder ="c:\test2" /> <add folder ="c:\test3" /> </folders> </locationconfig> <startup> <supportedruntime version="v4.0" sku=".netframework,version=v4.5" /> </startup> </configuration> locationconfig namespace folderconfigsection { using system.configuration; public class locationconfig : configurationsection { // alter property type foldercollection, , // alter property name `folders` clarity [configurationproperty("folders")] public foldercollection folders { { homecoming base["folders"] foldercollection; } // setter property isn't needed here // set { base["folders"] = value; } } } public class foldercollection : configurationelementcollection { protected override configurationelement createnewelement() { homecoming new folderelement(); } protected override object getelementkey(configurationelement element) { homecoming ((folderelement)element).environment; } // indexer public folderelement this[int index] { { homecoming baseget(index) folderelement; } } } public class folderelement : configurationelement { [configurationproperty("folder", isrequired = true)] public string environment { { homecoming (string)this["folder"]; } set { this["folder"] = value; } } } } program.cs public class programme { static void main(string[] args) { var locationconfig = (locationconfig)configurationmanager.getsection("locationconfig"); foreach (folderelement folder in locationconfig.folders) { // list folders console.writeline(folder.environment); } // first folder using indexer property console.writeline(locationconfig.folders[0].environment); } }

c# .net

angularjs - Connection state with doowb/angular-pusher -



angularjs - Connection state with doowb/angular-pusher -

i trying build angular project pusher using angular-pusher wrapper. it's working need observe when user loses net briefly can retrieve missed changes info server.

it looks way handle reload info on pusher.connection.state('connected'...) not seem work angular-pusher - receiving "pusher.connection" undefined.

here code:

angular.module('respondersapp', ['doowb.angular-pusher']). config(['pusherserviceprovider', function(pusherserviceprovider) { pusherserviceprovider .settoken('foooooooo') .setoptions({}); } ]); var respondercontroller = function($scope, $http, pusher) { $scope.responders = []; pusher.subscribe('responders', 'status', function (item) { // item updated. find in our list , update it. var found = false; (var = 0; < $scope.responders.length; i++) { if ($scope.responders[i].id === item.id) { found = true; $scope.responders[i] = item; break; } } if (!found) { $scope.responders.push(item); } }); pusher.subscribe('responders', 'unavail', function(item) { $scope.responders.splice($scope.responders.indexof(item), 1); }); var retrieveresponders = function () { // list of responders api located @ '/api/responders' console.log('getting responders'); $http.get('/app/dashboard/avail-responders') .success(function (responders) { $scope.responders = responders; }); }; $scope.updateitem = function (item) { console.log('updating item'); $http.post('/api/responders', item); }; // load responders retrieveresponders(); };

under setup how go monitoring connection state? i'm trying replicate firebase "catch up" functionality spotty connections, firebase not working overall me, confusing trying manage multiple info sets (not looking replace back-end @ all).

thanks!

it looks pusher dependency exposes subscribe , unsubscribe. see: https://github.com/doowb/angular-pusher/blob/gh-pages/angular-pusher.js#l86

however, if access pusherservice access pusher instance (the 1 provided pusher js library) using pusherservice.then. see: https://github.com/doowb/angular-pusher/blob/gh-pages/angular-pusher.js#l91

i'm not sure why pusherservice provides level of abstraction , why doesn't homecoming pusher instance. it's can add together of angular specific functionality ($rootscope.$broadcast , $rootscope.$digest).

maybe can set pusherservice dependency , access pusher instance using following?

pusherservice.then(function (pusher) { var state = pusher.connection.state; });

angularjs pusher

javascript - how to print textbox value in php -



javascript - how to print textbox value in php -

in code,when text entered textbox , click on add attribute button, entered value displayed on page 2 times, 1 in first row of table , 1 in first row of sec table. question is, when entered text textbox in second row of sec table, should display entered text.but can't display. not working.

<script> var = 0; document.getelementbyid('add-val').innerhtml=''; function insrow() { i++; var x=document.getelementbyid('mytable').insertrow(-1) var a=x.insertcell(-1) var txt=document.getelementbyid('add-val').value; a.innerhtml=txt; // <tr> of table var row = document.getelementbyid("myrow"); var newrow=document.getelementbyid("myrow1"); var x = row.insertcell(-1); var y = newrow.insertcell(-1); x.innerhtml=txt; //+ '<br>' + y.innerhtml='<input type="text" name="nm" />'; } document.getelementbyid('add-val').innerhtml=''; </script>

& html code.

<form method="post" name="form"> <input type="text" name="attr" id="add-val"> <input type="button" onclick="insrow()" value="add attribute"> <table width="27" height="17" id="mytable"> </table> <table cellpadding="13px"> <tr id="myrow"> </tr> <tr id="myrow1"> </tr> </table> <input type="submit" value="add option" onclick="insrow()"/> <?php if(isset($_post['submit'])) { $val= $_post['add']; echo $val; } ?> </form>

it should be

y.innerhtml='<input type="text" name="nm[]" />';

the []'s after nm

name="nm[]"

serve store new generated fields array, can accessed $_post

which access so....

$val = $_post['nm']; foreach($val $v){ echo $v; // display user entered } // var_dump($val) show users seperate input each field

javascript php html

jQuery - slideDown slideUp - fadeIn fadeOut - ScrollTo -



jQuery - slideDown slideUp - fadeIn fadeOut - ScrollTo -

i want seek , accomplish effect.

so have website 100% height. in footer have 2 buttons, contact , info. when click 1 of buttons page should scroll downwards first fade in corresponding content. when other button clicked want fade content out fade new content in, without scroll.

then want have close button in content fades in, 1 time clicked fade out content scroll up.

i hope makes sense.

here illustration of mean http://www.10yearsintype.com/#!stories click on 1 of designers or bring together our mailing list.

this pathetic effort http://jsfiddle.net/ricoshift/lumr7/

function toggleslider() { if (jquery("#panelthatslides").is(":visible")) { jquery('html, body').animate({ scrolltop: 300 }, 600), jquery("#contentthatfades").animate( { opacity: "0" }, 600, function(){ jquery("#panelthatslides").slideup(); } ); } else { jquery('html, body').animate({ scrolltop: 300 }, 600), jquery("#panelthatslides").slidedown(600, function(){ jquery("#contentthatfades").animate( { opacity: "1" }, 600 ); }); }

}

i'd love help nail this.

jquery

asp.net mvc 3 - How to Implement Solrnet in Mvc 3 Project with facet and weightage -



asp.net mvc 3 - How to Implement Solrnet in Mvc 3 Project with facet and weightage -

i got many examples not single illustration run properly. in problem wants implement solrnet in mvc3 , wants searching facets , weightage. used illustration gives error [https://github.com/mausch/solrnet/tree/ee56b02c913a9b52459cefe1cc1623cc254d5f3b] please give me illustration working properly.. thanks!

asp.net-mvc-3 solrnet facet

arraylist - Combinations of array elements -



arraylist - Combinations of array elements -

may similar question asked in past, not able find solution problem. have 2d array of integers {{1,2,3},{7,5},{4,9}}, want possible combinations array elements.

output should - {{1,7,4},{1,7,9},{1,5,4},{1,5,9},{2,7,4},{2,5,9},{3,7,4},{3,5,9}}

can help me in ?

in groovy (which assume want):

[[1,2,3],[7,5],[4,9]].combinations()

arrays arraylist groovy

SQL select from table with alias (Oracle9i) -



SQL select from table with alias (Oracle9i) -

according oracle documentation statement select should possible alias table names aliases without or keyword as. however, aliasing tables keyword as leads error:

ora-00933: sql command not ended

for example, next statement fails above error:

select count(*) my_table a;

once keyword as removed executes expected.

could please comment on this. there way create application of as table aliasing work?

p.s. i'm using code generation utility translate java code sql statements @ runtime. utility enforces utilize of aliases as.

oracle not take table aliases , see no way create work.

can't in java? column aliases optional in oracle, " " in generated string , remove them (thus removing column aliases table aliases). option?

sql oracle9i

android - ScheduledExecutorService run only once inside Service -



android - ScheduledExecutorService run only once inside Service -

i running scheduledexecutorservice within of service takes image in background. scheduledexecutorservice running 1 time means taking 1 image after interval passed in function. showing no errors @ all. next code of service

package com.anawaz.spy; import java.io.file; import java.io.filenotfoundexception; import java.io.fileoutputstream; import java.io.ioexception; import java.util.concurrent.executors; import java.util.concurrent.scheduledexecutorservice; import java.util.concurrent.scheduledfuture; import java.util.concurrent.timeunit; import android.app.service; import android.content.intent; import android.hardware.camera; import android.hardware.camera.picturecallback; import android.hardware.camera.shuttercallback; import android.os.ibinder; import android.util.log; public class camservice extends service { private static final string tag = "tag"; private final scheduledexecutorservice scheduler = executors.newscheduledthreadpool(1); photographic camera camera; scheduledfuture beeperhandle; /* service life cycle overrides */ @override public void oncreate() { super.oncreate(); photographic camera = camera.open(); seek { camera.setpreviewdisplay(null); } grab (ioexception e) { e.printstacktrace(); } //takepicsperiodically(mainactivity.getspint(mainactivity.sp_period)); takepicsperiodically(5); } @override public void ondestroy() { stoppics(); super.ondestroy(); } @override public ibinder onbind(intent intent) { // todo auto-generated method stub homecoming null; } // @override // public ibinder onbind(intent arg0) { // homecoming myremoteservicestub; // } // /* ----------------------------------- */ // // private imyremoteservice.stub myremoteservicestub = new // imyremoteservice.stub() { // // /* basic service methods */ // public boolean iscollecting() { // homecoming (beeperhandle != null); // } // /* ------------------------- */ // }; public void takepicsperiodically(long period) { final runnable beeper = new runnable() { public void run() { log.d("tag", "new image taken"); camera.takepicture(shuttercallback, rawcallback, jpegcallback); } }; camera.startpreview(); beeperhandle = scheduler.scheduleatfixedrate(beeper, period, period,timeunit.seconds); } public void stoppics() { beeperhandle.cancel(true); beeperhandle = null; camera.stoppreview(); camera.release(); photographic camera = null; } /* photographic camera phone call backs */ shuttercallback shuttercallback = new shuttercallback() { public void onshutter() { log.d(tag, "onshutter'd"); } }; /** handles info raw image */ picturecallback rawcallback = new picturecallback() { public void onpicturetaken(byte[] data, photographic camera camera) { log.d(tag, "onpicturetaken - raw"); } }; /** handles info j peg image */ picturecallback jpegcallback = new picturecallback() { public void onpicturetaken(byte[] data, photographic camera camera) { fileoutputstream outstream = null; seek { // write local sand box file scheme // outstream = // camerademo.this.openfileoutput(string.format("%d.jpg", // system.currenttimemillis()), 0); // or write s d card file mfolder; mfolder = new file("/sdcard/spy/"); if (!mfolder.exists()) { mfolder.mkdir(); } outstream = new fileoutputstream(string.format( "/sdcard/spy/image_%d.jpg", system.currenttimemillis())); outstream.write(data); outstream.close(); log.d(tag, "onpicturetaken - wrote bytes: " + data.length); } grab (filenotfoundexception e) { e.printstacktrace(); } grab (ioexception e) { e.printstacktrace(); } { } log.d(tag, "onpicturetaken - jpeg"); } }; }

no logcat because not getting error. service running after taking picture. doing wrong?

after reading post http://code.nomad-labs.com/2011/12/09/mother-fk-the-scheduledexecutorservice/ tried try catch block. , found camera.takepicture(shuttercallback, rawcallback, jpegcallback); throwing exception. because of error not starting preview after taking first picture. refer answer. http://stackoverflow.com/a/21728454/1770916

following updated working code of service.

package com.anawaz.spy; import java.io.file; import java.io.filenotfoundexception; import java.io.fileoutputstream; import java.io.ioexception; import java.util.concurrent.executors; import java.util.concurrent.scheduledexecutorservice; import java.util.concurrent.scheduledfuture; import java.util.concurrent.timeunit; import android.app.service; import android.content.intent; import android.hardware.camera; import android.hardware.camera.picturecallback; import android.hardware.camera.shuttercallback; import android.os.ibinder; import android.util.log; public class camservice extends service { private static final string tag = "tag"; private final scheduledexecutorservice scheduler = executors.newscheduledthreadpool(1); photographic camera camera; scheduledfuture beeperhandle; /* service life cycle overrides */ @override public void oncreate() { super.oncreate(); photographic camera = camera.open(); seek { camera.setpreviewdisplay(null); } grab (ioexception e) { e.printstacktrace(); } file mfolder = new file("/sdcard/spy/"); if (!mfolder.exists()) { mfolder.mkdir(); } takepicsperiodically(mainactivity.getspint(mainactivity.sp_period)); //takepicsperiodically(5); } @override public void ondestroy() { stoppics(); super.ondestroy(); } @override public ibinder onbind(intent intent) { // todo auto-generated method stub homecoming null; } public void takepicsperiodically(long period) { camera.startpreview(); beeperhandle = scheduler.scheduleatfixedrate(beeper,period, period,timeunit.seconds); } final runnable beeper = new runnable() { public void run() { log.d("tag", "new image taken"); seek { camera.startpreview(); camera.takepicture(shuttercallback, rawcallback, jpegcallback); }catch (exception e) { log.e("tag","error in executing: no longer run!: "+e.getmessage()); e.printstacktrace(); } } }; public void stoppics() { beeperhandle.cancel(true); beeperhandle = null; camera.stoppreview(); camera.release(); photographic camera = null; } /* photographic camera phone call backs */ final shuttercallback shuttercallback = new shuttercallback() { public void onshutter() { log.d(tag, "onshutter'd"); } }; /** handles info raw image */ final picturecallback rawcallback = new picturecallback() { public void onpicturetaken(byte[] data, photographic camera camera) { log.d(tag, "onpicturetaken - raw"); } }; /** handles info j peg image */ final picturecallback jpegcallback = new picturecallback() { public void onpicturetaken(byte[] data, photographic camera camera) { fileoutputstream outstream = null; seek { // write local sand box file scheme // outstream = // camerademo.this.openfileoutput(string.format("%d.jpg", // system.currenttimemillis()), 0); // or write s d card outstream = new fileoutputstream(string.format( "/sdcard/spy/image_%d.jpg", system.currenttimemillis())); outstream.write(data); outstream.close(); log.d(tag, "onpicturetaken - wrote bytes: " + data.length); } grab (filenotfoundexception e) { e.printstacktrace(); } grab (ioexception e) { e.printstacktrace(); } { } log.d(tag, "onpicturetaken - jpeg"); } }; }

android android-service scheduledexecutorservice

java - How to save fragments state once they have created in activity? Android -



java - How to save fragments state once they have created in activity? Android -

i have fragmentactivity 4 fragments. can swipe them finger/on button click. 3 of them using asynctask (parsing html code jsoup , adding imageview , textview fragments).

when fast swipe 1 fragment error. need save fragments state 1 time have created, not refreshing time.

public class fragment_knse_d extends fragment implements onclicklistener { public progressbar mprogress; context cont; private imageview iv; private bitmap bitmap; linearlayout layout; int screenwidth, screenheight; string url="http://www.url.com/"; public view v; @override public view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate) { // todo auto-generated method stub\ display display = getactivity().getwindowmanager().getdefaultdisplay(); screenheight = display.getheight(); screenwidth = display.getwidth(); v = inflater.inflate(r.layout.kontakt_knse, container, false); iv = (imageview) v.findviewbyid(r.id.imageview1); layout = (linearlayout) v.findviewbyid(r.id.layout); mprogress = (progressbar) v.findviewbyid(r.id.progressbar1); homecoming v; } @override public void onclick(view v) { } private class title extends asynctask<void, void, void> { string nazwa1,nazwa2,nazwa3,nazwa4,test1; int rozmiar; bitmap bitmap1,bitmap2,bitmap3,bitmap4; private context mcontext; private view rootview; public title(context context, view rootview){ this.mcontext=context; this.rootview=rootview; } @override protected void onpreexecute() { // todo auto-generated method stub mprogress.setvisibility(view.visible); super.onpreexecute(); } @override protected void doinbackground(void... params) { seek { // connect web site document document = jsoup.connect(url).get(); string temp = document.html().replace("<br />", "$$$"); //$$$ instead <br> document = jsoup.parse(temp); //--------------------------------------------------- elements test = document.select("div[class=entry themeform]"); element p = test.select("p").first(); test1 = p.text().replace("$$$", "\n").tostring(); //rozmiar = img1.size(); } grab (ioexception e) { e.printstacktrace(); } homecoming null; } @override protected void onpostexecute(void result) { // set title textview mprogress.setvisibility(view.invisible); //1 textview text1 = new textview(((knseactivity)getactivity())); layout.addview(text1); text1.settext(test1); text1.settextsize(20); text1.setgravity(17); } } @override public void onactivitycreated(bundle savedinstancestate) { // todo auto-generated method stub super.onactivitycreated(savedinstancestate); connectivitymanager conmgr = (connectivitymanager) ((knseactivity)getactivity()).getsystemservice(context.connectivity_service); if (conmgr.getactivenetworkinfo() != null) { cont=getactivity(); new title(cont, v).execute(); } else { textview warningtext = new textview(((knseactivity)getactivity())); layout.addview(warningtext); warningtext.settext("brak łączności! informację nie można pobrać."); warningtext.settextsize(20); warningtext.setgravity(17); } } }

it 1 of fragment. utilize pager swipe fragments, here adapter:

class myknseadapter extends fragmentstatepageradapter{ public myknseadapter(fragmentmanager fm) { super(fm); // todo auto-generated constructor stub } @override public fragment getitem(int i) { fragment fragment = null; if(i==0) { fragment = new fragment_knse_a(); } if(i==1) { fragment = new fragment_knse_b(); } if(i==2) { fragment = new fragment_knse_c(); } if(i==3) { fragment = new fragment_knse_d(); } homecoming fragment; } @override public int getcount() { // todo auto-generated method stub homecoming 4; } @override public charsequence getpagetitle(int position) { // todo auto-generated method stub if(position==0) { homecoming "knse"; } if(position==1) { homecoming "kierownictwo"; } if(position==2) { homecoming "członkowie"; } if(position==3) { homecoming "kontakt"; } homecoming null; } }

i think problem every time app creating new fragment, example:

if(i==0) { fragment = new fragment_knse_a(); }

am right? can do, save fragment state?

here error log:

06-22 21:35:21.154: e/androidruntime(27479): fatal exception: main 06-22 21:35:21.154: e/androidruntime(27479): process: com.example.uwbnewapptest, pid: 27479 06-22 21:35:21.154: e/androidruntime(27479): java.lang.nullpointerexception 06-22 21:35:21.154: e/androidruntime(27479): @ android.view.viewconfiguration.get(viewconfiguration.java:325) 06-22 21:35:21.154: e/androidruntime(27479): @ android.view.view.<init>(view.java:3448) 06-22 21:35:21.154: e/androidruntime(27479): @ android.view.view.<init>(view.java:3505) 06-22 21:35:21.154: e/androidruntime(27479): @ android.widget.textview.<init>(textview.java:623) 06-22 21:35:21.154: e/androidruntime(27479): @ android.widget.textview.<init>(textview.java:618) 06-22 21:35:21.154: e/androidruntime(27479): @ android.widget.textview.<init>(textview.java:614) 06-22 21:35:21.154: e/androidruntime(27479): @ com.uwbapp.fragment_knse_c$title.onpostexecute(fragment_knse_c.java:123) 06-22 21:35:21.154: e/androidruntime(27479): @ com.uwbapp.fragment_knse_c$title.onpostexecute(fragment_knse_c.java:1) 06-22 21:35:21.154: e/androidruntime(27479): @ android.os.asynctask.finish(asynctask.java:632) 06-22 21:35:21.154: e/androidruntime(27479): @ android.os.asynctask.access$600(asynctask.java:177) 06-22 21:35:21.154: e/androidruntime(27479): @ android.os.asynctask$internalhandler.handlemessage(asynctask.java:645) 06-22 21:35:21.154: e/androidruntime(27479): @ android.os.handler.dispatchmessage(handler.java:102) 06-22 21:35:21.154: e/androidruntime(27479): @ android.os.looper.loop(looper.java:136) 06-22 21:35:21.154: e/androidruntime(27479): @ android.app.activitythread.main(activitythread.java:5017) 06-22 21:35:21.154: e/androidruntime(27479): @ java.lang.reflect.method.invokenative(native method) 06-22 21:35:21.154: e/androidruntime(27479): @ java.lang.reflect.method.invoke(method.java:515) 06-22 21:35:21.154: e/androidruntime(27479): @ com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:779) 06-22 21:35:21.154: e/androidruntime(27479): @ com.android.internal.os.zygoteinit.main(zygoteinit.java:595) 06-22 21:35:21.154: e/androidruntime(27479): @ dalvik.system.nativestart.main(native method)

java android android-layout android-fragments android-asynctask

r - How to plot values in a matrix -



r - How to plot values in a matrix -

suppose have matrix this:

trainingsize trainingtime accuracy [1,] 1179 0.923 0.262 [2,] 2356 0.953 0.563 [3,] 3536 0.971 0.869 [4,] 4712 0.979 1.212 [5,] 5889 0.983 1.542

how can plot trainingsize vs accuracy , trainingtime vs accuracy in 2 dimensional space?

qplot(lcmatrix[,1], lcmatrix[,3]) qplot(lcmatrix[,2], lcmatrix[,3])

these 2 commands plot separately. how plot them together?

does work?

qplot(lcmatrix[,1], lcmatrix[,3]) + qplot(lcmatrix[,2], lcmatrix[,3])

converting comment ..

here's way plot trainingsize vs accuracy , trainingtime vs accuracy in 1 plot:

require(ggplot2) require(reshape2) ggplot(melt(as.data.frame(m), id="accuracy"), aes(x = accuracy, y = value, color = variable)) + geom_point()

so convert matrix data.frame , melt resulting data.frame id = "accuracy" afterwards can plotted in 1 plot.

r plot ggplot2

c++ - why primary expression don't include template_id -



c++ - why primary expression don't include template_id -

i have such code, compile "g++ -wall -g -std=c++11 test.cpp ",which doesn't compile because error: expected primary-expression before ‘)’ token

#include <functional> #include <vector> #include <algorithm> int main() { std::vector<int> vec; for(int i=0;i<10;++i) { vec.push_back(i); } std::sort(vec.begin(),vec.end(),std::less<int>); //should std::less<int>() }

but standard says:

primary-expression: literal ( look ) id-expression lambda-expression id-expression: unqualified-id qualified-id unqualified-id: identifier operator-function-id conversion-function-id literal-operator-id ~ class-name ~ decltype-specifier template-id template-id simple-template-id simple-template-id template-name <template-argument-list>

so seems std::less template-id, it's primary-expression.

being grammatically right doesn't create programme semantically correct. grammar production primary-expression -> template-id there allow utilize of specialization of function template expression, e.g, valid:

template <typename t> bool less(const t& a, const t& b) { homecoming < b; } int main() { std::vector<int> vec; std::sort(vec.begin(), vec.end(), less<int>); }

a template-id refers class template, however, not usable expression.

c++ bnf

python - Tkinter error with importing -



python - Tkinter error with importing -

i'm trying create simple gui programme in python when seek run error:

this have in code.

from tkinter import * test = tk() test.title("reverse") test.geometry("300 x 200") test.mainloop() 'import site' failed; utilize -v traceback traceback (most recent phone call last): file "c:/users/brenda/pycharmprojects/reverse string/reverse string.py", line 1, in <module> tkinter import * file "c:\python27\lib\lib-tk\tkinter.py", line 38, in <module> import fixtk file "c:\python27\lib\lib-tk\fixtk.py", line 1, in <module> import sys, os file "c:\python27\lib\os.py", line 398, in <module> import userdict file "c:\python27\lib\userdict.py", line 84, in <module> _abcoll.mutablemapping.register(iterableuserdict) file "c:\python27\lib\abc.py", line 109, in register if issubclass(subclass, cls): file "c:\python27\lib\abc.py", line 184, in __subclasscheck__ cls._abc_negative_cache.add(subclass) file "c:\python27\lib\_weakrefset.py", line 86, in add together self.data.add(ref(item, self._remove)) typeerror: cannot create weak reference 'classobj' object

test.geometry("300 x 200") should be: test.geometry("300x200")

also, create sure right in how installed tkinter. on linux machine, use:

sudo apt-get install python-tk

you can seek looking @ next similar question: making python script executable causes 'import site' failed; utilize -v traceback (mac osx)

python user-interface tkinter

for loop - please explain shellsort code in C -



for loop - please explain shellsort code in C -

this code written in ansi c ritchie..... have used comment in code doubt. have learnt shell sort youtube , have understood how works code confusing specially these loop....why have used gap= n/2....what gap? , these loop doing here.....plz :(

void shellsort(int v[], int n) { int gap, i, j, temp; for(gap= n/2; gap >0; gap /=2) // gap /=2 for(i=gap; i<n; i++) for(j= i-gap; j>= 0 && v[j]>v[j+gap]; j -=gap){ temp= v[j]; v[j]=v[j+gap]; v[j+gap]=temp; } }

what edition of book reading from? think there number of programming errors in illustration code way untill 3rd edition.

gap refers int declared above loop. gap, i, j & temp integers. means hold integer numeric value (e.g, 1,2, 12, 586 etc).

a /= b partition assignment literal meaning = / b.

you might wondering v & n are?

int v[] refers int array, value used within [ ] index of array, e.g v[0], v[1], v[2], v[n]...

since v & n declared parameters of shellsort function, means when phone call function, need passed int array value, int value. without these values function cannot operate properly

if have c book, need know c in book :)

c for-loop shellsort

hibernate - Can I insert a JPA entity directly using QueryDSL? -



hibernate - Can I insert a JPA entity directly using QueryDSL? -

is there way in querydsl insert jpa entity without using jpa provider directly?

my utilize case issue following. using hibernate bring together table mapping between 2 entities.

ex:

public class contract implements serializable { @id @generatedvalue(strategy = generationtype.auto) @column(name = "id") private long id; @version @column(name = "version") private integer version; private string number; private string volume; @manytomany @jointable(joincolumns = @joincolumn(name = "contract_id", referencedcolumnname = "id"), inversejoincolumns = @joincolumn(name = "attachment_id", referencedcolumnname = "id")) private list<attachment> attachments; }

my problem if seek add together attachments in 2 separate threads simultaneously, optimistic lock exceptions (as expected). instead, seek add together attachment straight via sql insert command.

is there anyway of inserting attachment entity via querydsl object? couldn't find reference documentation covers utilize case. update query, requires setting individual fields.

pseudo code:

jpaquery.insert(qattachment.attachment).into(qcontract.attachment).where(qcontract.contract.id.eq(<contractid>));

is feasible?

that's not covered querydsl , insert clauses not covered jpa api, need insertion via jpa entitymanager api.

hibernate jpa querydsl

html - Difference between width:auto and width:100% - what is it 100% of? (CSS) -



html - Difference between width:auto and width:100% - what is it 100% of? (CSS) -

why setting element position:fixed alter width? know html elements default span entire width of browser window, when set position on header fixed, <div> shrinks 0 width. why this?

trying width:auto not prepare it, <div> still has 0 width!

this illustration taken code academy "build resume" project @ end of web fundamentals course.

i have html file so:

<!doctype html> <html> <head> <link type="text/css" rel="stylesheet" href="stylesheet.css"/> <title></title> </head> <body> <div id="header"></div> <div class="left"></div> <div class="right"></div> <div id="footer"></div> </body> </html>

and css file so:

div { border: 5px solid red; border-radius: 5px; } #header{ height:30px; background-color:orange; z-index:1; } #footer{ height:30px; background-color:teal; clear:both; } .left{ height:300px; width:200px; float:left; } .right{ height:300px; width:200px; float:right; }

update: noticed setting width:100% maintain width way across browser window. going on here? i've read why fixed positioning alter width of element? not sure how applies here.

edit: thought move comments , seek answering here, give more direction on i'm confused: "yes, seems "whereas position , dimensions of element position:absolute relative containing block, position , dimensions of element position:fixed relative initial containing block" key part. see position:fixed set dimensions of relative viewport, isn't viewport whole browser window? why size collapse zero? , beyond that, why width:auto not prepare width:100% create span whole horizontal length again?"

width:auto different width:100%. width:auto expand width of element horizontal space within containing block. since space on within of containing block doesn't count borders/padding/margins.

width:100% width:auto and adds width of borders/padding/margins of containing element. difference between width auto , width 100 percent provides visual demonstration.

so, when set width:auto on position:fixed element, , position:fixed shrink-wrapped element's width of content (which nothing), width automatically adjusted of containing element, in case _____ (what? , why did have width of zero?).

when set width:100% includes padding/margins/border of _____ (what? , why did expand cover whole page horizontally?).

the reason because both fixed , absolute positioning take element out of flow of document. residual effect of that, unless explicitly told otherwise, element grow/shrink according size of content rather size of parent.

as you've discovered, simple prepare give width of 100 percent:

.fixed-element{ position:fixed; width:100% }

to address issue of quote on fixed positioning:

whereas position , dimensions of element position:absolute relative containing block, position , dimensions of element position:fixed relative initial containing block. viewport: browser window or paper’s page box.

i find quite poorly worded. it's not meant dimensions grow size of viewport. instead it's trying distinguish specific differences between absolute , fixed positioning. more thoroughly put: dimensions/size of fixed element relative initial element. whereas dimensions/size of absolute element relative containing element. doesn't explicitly mean actually take 100% of viewport default...

html css

c# - Draw marks on a DataGridView vertical Scrollbar -



c# - Draw marks on a DataGridView vertical Scrollbar -

i working on project cells in datagridview highlighted. , wondering if can create marks on scrollbar indicate highlights are. ideas may helpful.

the yes, no , maybe

the yes: according this possible. however, links answer; not sure lead..

the no: according cody gray's first-class analysis in reply this post painting on scrollbar not possible.

but maybe workaround solve problem..?

here idea:

you add together lean panel either overlays scrollbar or attaches left. should lean , go on height of scrolbar; gets redrawn usual paint events.

you maintain list of rows, marks should shown. list re-created or maintained upon:

adding & removing rows changing target row possibly when sorting or filtering

here little code, quick proof of concept. more robust solution guess create decorator class datagridview register.

now, when move lift towards marks find target rows. lot of room improvement, start imo..

you have alter isrowmarked() function needs. have chosen test first cell's backcolor..

you can utilize different colors different marks; maybe copying them marked row/cell.

public form1() { initializecomponent(); datagridview1.controls.add(indicatorpanel); indicatorpanel.width = 6; indicatorpanel.height = datagridview1.clientsize.height - 39; indicatorpanel.top = 20; indicatorpanel.left = datagridview1.clientsize.width - 21; indicatorpanel.paint += indicatorpanel_paint; datagridview1.paint += datagridview1_paint; } panel indicatorpanel = new panel(); list<datagridviewrow> tgtrows = new list<datagridviewrow>(); void datagridview1_paint(object sender, painteventargs e) { indicatorpanel.invalidate(); } void indicatorpanel_paint(object sender, painteventargs e) { // check if there hscrollbar int hs = ((datagridview1.scrollbars & scrollbars.vertical) != scrollbars.none ? 20 : 0); e.graphics.fillrectangle(brushes.silver, indicatorpanel.clientrectangle); foreach (datagridviewrow trow in tgtrows) { int h = (int)(1f * (indicatorpanel.height - 20 + hs) * trow.index / datagridview1.rows.count); e.graphics.fillrectangle(brushes.red, 0, h-3, 6, 4); } } bool isrowmarked(datagridviewrow row) { homecoming row.cells[0].style.backcolor == color.red; // <<-- change! } // phone call in: datagridview1_rowsremoved, datagridview1_rowsadded // whenever set or alter markings , after sorting or filtering void findmarkers() { tgtrows.clear(); foreach (datagridviewrow row in datagridview1.rows) if (isrowmarked(row) ) tgtrows.add(row); indicatorpanel.invalidate(); }

note have removed first reply original requirements talk of 'marks' not 'a few marks'. sec version seems lot nicer me, now.

c# .net winforms datagridview scrollbar

visual studio 2013 - Extensibility Project Type does not exist with VS2013 -



visual studio 2013 - Extensibility Project Type does not exist with VS2013 -

in visual studio 2013, extensibility project template not found under "visual c#" , "other project types". please guide me enable project type visual studio?

you need install visual studio 2013 sdk. additional project templates appear in visual c# - extensibility , other project types - extensibility.

visual-studio-2013 vs-extensibility project-template

html - How can I position my content in a grid-like fashion -



html - How can I position my content in a grid-like fashion -

i have bunch of controls web app this

-------------------------------------------------------------------------- banana: | number of slices: [dropdown] | piece thickness: [dropdown] -------------------------------------------------------------------------- cucumber: | number of slices: [dropdown] | piece thickness: [dropdown] --------------------------------------------------------------------------

i place these in grid-like layout , have feeling tables not way (even if perfect situation). i'm having hard time figuring how align columns match in position , length (those pipes (|) not visible, if them aligned (and of course of study in "cells" of different lengths)).

what have here tabular input. each row of table ingredient, , each column indeed column (first label column, column slices, thickness). absolutely should utilize <table> this.

however, i'd suggest little alter in layout:

ingredient | slices | thickness ------------------------------------ banana | [dropdown] | [dropdown] ------------------------------------ cucumber | [dropdown] | [dropdown]

just makes more table-like way ;)

html css grid-layout

batch file - DIR recursion doesn't recognize folders beginning with a number -



batch file - DIR recursion doesn't recognize folders beginning with a number -

i want replace 1 image in sub-directories, recursive function of dir (/s) doesn't recognize folders origin number. example, replace file in directory "example/image.txt" not "1234 folder/image.txt"

@echo off dir /s /b image.jpg >> filelisting.txt echo image replaced in next folders: >> imagelocations.txt /f %%a in (filelisting.txt) ( echo %%a >> imagelocations.txt xcopy /f /q "%cd%\image.jpg" "%%a" ) del filelisting.txt

for /f command, default, seek tokenize input lines using spaces , tabs delimiters between tokens. if files/folders have spaces in names, part before space retrieved. avoid it, disable line splitting setting delimiters empty list

for /f "delims=" %%a in (filelisting.txt) ( ....

batch-file cmd

batch file - Execute a set of commands through java -



batch file - Execute a set of commands through java -

this question has reply here:

how run batch file java application? 8 answers

i have set of commands executing through java. stored them in .bat file , executing through java. when run bat file through command prompt executes when execute through java, 1-2 commands execute , programme exits. please suggest me solution this.

please suggest me jar file if other command referenced

code:

public static string cmdexec(string cmd) throws ioexception { process p = runtime.getruntime().exec(cmd); }

the basic form executing should be;

public static string cmdexec(string cmd) throws ioexception { process p = runtime.getruntime().exec(cmd); p-waitfor(); }

there several circumstances may impact execution of command if 1 not wait completion.

only if parent process (i.e. java program) continues, no other exec might interfere exec started, no resource required exec affected, omit waitfor more efficiency (by parallel execution).

java batch-file cmd threadpool

sql - Join language specific names in one row -



sql - Join language specific names in one row -

given next tables:

materials

+-----------------+-----------------+ |material |name | +-----------------------------------+ |00000001 |material number 1| |00000002 |material number 2| +-----------------+-----------------+

material names

+---------+---------+-------------+ |material |language |name | +---------------------------------+ |00000001 |de |mat. nummer 1| |00000001 |fr |matérial 1 | |00000002 |sp |mat. 1 | +---------+---------+-------------+

how can create sql statement (mssql 2005 flavor) homecoming info follows:

+---------+---------------+---------------+----------+----------+ |material |name_en |name_de |name_fr |name_sp | +---------------------------------------------------------------+ |00000001 |material number|1 mat. nummer 1|matérial 1|null | |00000002 |material number|2 null |null |mat. 1 | +---------+---------------+---------------+----------+----------+

i tried several approaches using case when, is not null, , like. resulted in single rows 1 column filled, if there more names available material.

what can accomplish this?

you can join , conditional aggregation:

select m.materialid, m.name name_en, max(case when nm.language = 'de' nm.name end) name_de, max(case when nm.language = 'fr' nm.name end) name_fr, max(case when nm.language = 'sp' nm.name end) name_sp materials m bring together materialnames nm on m.materialid = nm.materialid grouping m.materialid, m.name;

sql sql-server tsql sql-server-2005

python - Psycopg2 installation for OS X and Django -



python - Psycopg2 installation for OS X and Django -

i utilize postgresql database django. first installed driver psycopg2 pip , virtualenv:

$ path=$path:/library/postgresql/9.3/bin/ $ pip install psycopg2 [...] installed psycopg2 cleaning up... $

i have done next configuration in django:

databases = { 'default': { 'engine': 'django.db.backends.postgresql_psycopg2', 'name': 'my_db', 'user': 'django', 'password': 'xx', 'host': 'localhost', 'port': '5432', } }

but when seek create schema syncdb have next error:

$ python manage.py syncdb raise improperlyconfigured("error loading psycopg2 module: %s" % e) django.core.exceptions.improperlyconfigured: error loading psycopg2 module: dlopen([...]/code/env/dev/lib/python2.7/site-packages/psycopg2/_psycopg.so, 2): library not loaded: libssl.1.0.0.dylib referenced from: [...]code/env/dev/lib/python2.7/site-packages/psycopg2/_psycopg.so reason: image not found

do know why libssl not loaded , how can prepare issue?

thank you

python django postgresql

c++ - Unresolved externals on linking yaml-cpp against my project -



c++ - Unresolved externals on linking yaml-cpp against my project -

when seek link project against yaml-cpp library, unresolved externals

error 1680 error lnk2019: unresolved external symbol "class yaml::node __cdecl yaml::loadfile(class std::basic_string,class std::allocator > const &)" (?loadfile@yaml@@ya?avnode@1@abv?$basic_string@du?$char_traits@d@std@@v?$allocator@d@2@@std@@@z)

i built lib using cmake , building project 'all build'

the code simple:

#include <yaml-cpp/yaml.h> int main(int argc, char **argv) { yaml::loadfile("config.yaml"); homecoming 0; }

c++ linker yaml yaml-cpp

php - Google maps in toggle -



php - Google maps in toggle -

i have problems lay out of goole maps. using simple toggle open map, see part of map.

then utilize acf (advanced custom field) wordpress show map. have seen toggle in conflict google api.

this stamp of result:

http://lab-360.it/img/maps.jpg

here code:

/*toggle*/ $(document).ready(function () { $('.acf-map').hide(); $('a.togglelink-map').on('click', function (e) { e.preventdefault(); var elem = $(this).next('.acf-map') $('.acf-map').not(elem).hide('fast'); elem.toggle('fast'); }); }); /*acf render map*/ (function ($) { /* * render_map * * function render google map onto selected jquery element * * @type function * @date 8/11/2013 * @since 4.3.0 * * @param $el (jquery element) * @return n/a */ var map; function render_map($el) { // var var $markers = $el.find('.marker'); // vars var args = { zoom: 16, center: new google.maps.latlng(0, 0), maptypeid: google.maps.maptypeid.roadmap }; // create map map = new google.maps.map($el[0], args); // add together markers reference map.markers = []; // add together markers $markers.each(function () { add_marker($(this), map); }); // center map center_map(map); } /* * add_marker * * function add together marker selected google map * * @type function * @date 8/11/2013 * @since 4.3.0 * * @param $marker (jquery element) * @param map (google map object) * @return n/a */ function add_marker($marker, map) { // var var latlng = new google.maps.latlng($marker.attr('data-lat'), $marker.attr('data-lng')); // create marker var marker = new google.maps.marker({ position: latlng, map: map }); // add together array map.markers.push(marker); // if marker contains html, add together infowindow if ($marker.html()) { // create info window var infowindow = new google.maps.infowindow({ content: $marker.html() }); // show info window when marker clicked google.maps.event.addlistener(marker, 'click', function () { infowindow.open(map, marker); }); } } /* * center_map * * function center map, showing markers attached map * * @type function * @date 8/11/2013 * @since 4.3.0 * * @param map (google map object) * @return n/a */ function center_map(map) { // vars var bounds = new google.maps.latlngbounds(); // loop through markers , create bounds $.each(map.markers, function (i, marker) { var latlng = new google.maps.latlng(marker.position.lat(), marker.position.lng()); bounds.extend(latlng); }); // 1 marker? if (map.markers.length == 1) { // set center of map map.setcenter(bounds.getcenter()); map.setzoom(16); } else { // fit bounds map.fitbounds(bounds); } $(document).on('click', '.map', function () { google.maps.event.trigger(map, 'resize'); map.setcenter(bounds.getcenter()); map.setzoom(16); }); } /* * document ready * * function render each map when document ready (page has loaded) * * @type function * @date 8/11/2013 * @since 5.0.0 * * @param n/a * @return n/a */ $(document).ready(function () { $('.acf-map').each(function () { render_map($(this)); }); }); })(jquery);

this code in content.php

<?php $location = get_field('luogo'); if($location['address']) { ?> <a href="#" class="togglelink-map">accedi</a> <div class="acf-map"> <div class="marker" data-lat="<?php echo $location['lat']; ?>" data-lng="<?php echo $location['lng']; ?>" itemprop="map"></div> </div> <?php } ?>

the basic issue map-div(s) don't have size when create map.

the easiest approach trigger resize-event of window when toggle map(take @ lastly line):

$(document).ready(function () { $('.acf-map').hide(); $('a.togglelink-map').on('click', function (e) { e.preventdefault(); var elem = $(this).next('.acf-map') $('.acf-map').not(elem).hide('fast'); elem.toggle('fast',function(){google.maps.event.trigger(window,'resize')}); }); });

the problem: map not centered @ desired position, , there no handle maps-instance apply centering.

another approach:

trigger custom event map-div:

$(document).ready(function () { $('.acf-map').hide(); $('a.togglelink-map').on('click', function (e) { e.preventdefault(); var elem = $(this).next('.acf-map') $('.acf-map').not(elem).hide('fast'); elem.toggle('fast',function(){google.maps.event.trigger(this,'toggle');}); }); });

in render_map define handler custom event:

map = (function (o, a) { var m = new google.maps.map(o, a); google.maps.event.addlistener(o, 'toggle', function () { var c = m.getcenter(); google.maps.event.trigger(m, 'resize'); if(!m.get('centered')){ m.setcenter(c); m.set('centered',1); } }); homecoming m; })($el[0], args);

demo: http://jsfiddle.net/doktormolle/3rquk/

php jquery wordpress google-maps

asp.net mvc - Error to deploy MVC 4 to Azure -



asp.net mvc - Error to deploy MVC 4 to Azure -

i trying deploy mvc 4 app azure receiving error

error 1 web deployment task failed. ('microsoft.web.deployment.deploymentbaseoptions' not contain definition 'useragent)

will appreciate help prepare it.

thanks

asp.net-mvc deployment web-deployment

php - Auto post on facebook page as page admin with sdk4 (graph api) -



php - Auto post on facebook page as page admin with sdk4 (graph api) -

i seek post facebook page via website page admin. can personnal business relationship .

this code :

private $fb_api; private $fb_secret; private $fb_redirect = 'index.php/admin/ajout_actualite'; private $fb_helper; private $fb_scopes = array(/*'publish_actions', 'email', */'create_event', 'manage_pages', 'publish_stream'); private $fb_session; $data = $this->config->item('facebook')['key']; $this->fb_redirect = base_url($this->fb_redirect); $this->fb_api = $this->config->item('facebook')['key']; $this->fb_secret = $this->config->item('facebook')['secret']; facebooksession::setdefaultapplication($this->config->item('facebook')['key'], $this->config->item('facebook')['secret']); $this->fb_helper = new facebookredirectloginhelper($this->fb_redirect); if ( $this->session->userdata('access_token') ) { $this->fb_session = new facebooksession( $this->session->userdata('access_token') ); // validate access_token create sure it's still valid seek { if ( ! $this->fb_session->validate() ) { $this->fb_session = false; } } grab ( exception $e ) { // grab exceptions $this->fb_session = false; } }

and how post on page :

$loginurl = $this->fb_helper->getloginurl($this->fb_scopes); if($this->input->get('code') != null) { $s = file_get_contents("https://graph.facebook.com/oauth/access_token?client_id=".$this->fb_api."&redirect_uri=".urlencode($this->fb_redirect)."&client_secret=".$this->fb_secret."&code=".$this->input->get('code')); $s = parse_str($s, $out);//var_dump($s); $this->session->set_userdata(array("access_token" => $out['access_token'])); }else if($this->session->userdata('access_token') == null) { redirect($loginurl); } if($this->fb_session != null){ $response = (new facebookrequest( $this->fb_session, 'post', '/xxxxxxxx/feed', array( 'name' => 'this drop da bit', 'caption' => "i love baby", 'link' => 'http://lesjoiesducode.fr/', 'message' => 'unicorn 1 - 0 facebook' )

))->execute()->getgraphobject()->asarray(); }

i hope can help me :), i've read 4-5 topics there in bulk on previous sdk :/

thanks in advance help.

you using user access token phone call /{page-id}/feed that's why post published on behalf of user.

to post on behalf of page itself, have utilize page access token. page access token, add together permission manage_pages first login scope create call-

/{page-id}?fields=access_token

this give page access token. utilize token /{page-id}/feed phone call pass additional parameter access_token other parameters.

php facebook facebook-graph-api facebook-php-sdk