Posts

Showing posts from July, 2011

android Facebook sdk login issue in 3.7 -

i developed app uses facebook login login. using default login button provided in facebook sdk 3.7 login functionality. issue is, devices unable login app. issue occurring on few devices, more 70% devices able login. the error is: session state:closed_login_failed, token:{accesstoken token:access_token_removed permissions:[]} seems hash generation issue. just use solution - packageinfo info = getpackagemanager().getpackageinfo("<your_package_name>", packagemanager.get_signatures); (signature signature : info.signatures) { messagedigest md = messagedigest.getinstance("sha"); md.update(signature.tobytearray()); log.d("keyhash:", base64.encodetostring(md.digest(), base64.default)); } this uses standard hash generation provided facebook. the same mentioned here . update: although problem related way generating hash , method have placed facebook login code, think there tutorials out there can

python - Value in MainWindow returned from childWindow -

how send value childwindow mainwindow once childwindow closed?. when "closebutton" in childwindow pressed, childwindow sends calculated value mainwindow. i did test this: def closeevent(self, evnt): value = 34 return value and didn't work, got this: typeerror: invalid result type childwindow.closeevent() here simple example how can that: import sys pyqt4 import qtgui class window(qtgui.qwidget): def __init__(self): qtgui.qwidget.__init__(self) self.button = qtgui.qpushbutton("make child") self.button.clicked.connect(self.openchildwindow) layout = qtgui.qvboxlayout(self) layout.addwidget(self.button) def openchildwindow(self): self.childwindow = childwindow(self) self.childwindow.setgeometry(650, 350, 200, 300) self.childwindow.show() def printresult(self, value): print value class childwindow(window): def __init__(self, parent

javascript - Detect internet disconnection via socket -

currently i'm using node.js server has tcp socket connection(using socket.io ) using i'm showing real-time data via browser. consider scenario, have logged in application , real-time shown via web browser. of sudden network got disconnected. @ show message saying "expired" when client-side socket emits disconnect event. socket.on('disconnect', function () { console.log("disconnected server"); alert("disconnect"); }); now problem: above disconnect event emitted after 60 seconds; in-between when user tries update, not work , create bad impression us. how overcome situation , how emit disconnect event of sudden when network got disconnected? you have understand heartbeat interval , heartbeat timeout . earlier time when server emits heartbeat each 25 seconds (by default). , later timeout server keep specific client in memory. if client receives heartbeat within heartbeat timeout (60

PHP function preg_match is not functioning precisley -

i use preg_match_all() function count number of words. what have found out removes numbers content. why? here function: define("word_count_mask", "/\\p{l}[\\p{l}\\p{mn}\\p{pd}'\\x{2019}]*/u"); $matches; function str_word_count_utf8($str) { global $matches; return preg_match_all(word_count_mask, $str, $matches); } what think causing issue??

How to perform select->cut/copy->paste/move the selected area in android finger paint? -

am developing painting app. want select painted area , cut, move / paste same doing in app link1 , link2 . using finger paint app in api demo. don't know how this. know please me thank you.

swing - How to add text to JText area without deleting the previous text it has? java -

i have jtext area in program contain text, , want add more text it, when button pressed without deleting text has on it. example jtextarea text = new jtextarea("including; "); when button pressed, have add text without deleting 1 has already, so; text.settext("including button1"); and when button pressed should this text.settext("including; button1, button2"); what effective way of doing this? use append feature, this text.append("button1,"); place in button / s , write name of button

html - Accessing a file on my domain relative to port -

i running node server on port 3000. have css file stored on http://mydomain.com/style.css but since every page right http://mydomain.com:3000/randompage.html how can access style.css file? can http://mydomain.com:3000/styles.css page working on, doesn't exist. what best way deal situation? suppose applies files need access. i don't know simple solution using relative url or html magic in page. the usual solution install module in apache or function in node.js redirect requests other server html, seems coming single source. this document should started when using apache: using mod_rewrite proxying

spring - Get case insensitive request header value -

from httpservletrequest.getheader("name") how can value irrespective of case ...like specifying name or name etc. according javadoc, parameter considered case insensitive: http://docs.oracle.com/javaee/6/api/javax/servlet/http/httpservletrequest.html#getheader%28java.lang.string%29 so example should go, catching both "name" , "name".

authorization - XACML Policy with Multiple Resources with Multiple Rules and Multiple Actions -

in multiple decision profile scenario want create policy particular tenant , root resources customer. here scenario have tenant t1 , tenant t1 allowed access root resource customer. customer top level resource , contain sub child resources like: sub-resources: name, email . in scenario how can create policy can enforce multiple rules each sub resources like: rule-1: admin permit access resource- {name: create,read,update,delete}, {email: create,read,update,delete} rule-2: employee permit access resource- {name: read,update}, {email: read} please share policy structure , request format same. in request format want pass tenant id , root level resource customer . in scenario, want pass in field id interested in. the request be: "can alice view name field of customer record #123"? you express multiple decision request e.g.: "can alice view name, email, , job title fields of customer record #123"? either way policy field-centric. protect g

c# - Access collection through MVVM Command -

in viewmodel have base card class , deck class contain observable collection of cards. here how bound in xaml <gridview itemssource="{binding deckcollection}" isitemclickenabled="true" grid.row="0"> <gridview.itemtemplate> <datatemplate> <button command="{binding path=??}" commandparameter=?? <button.content> <grid> <image source="{binding imagepath}" stretch="none"/> </grid> </button.content> </button> </datatemplate> </gridview.itemtemplate> </gridview> here classes class deck { private observab

eclipse - Undefined attribute name (aria-hidden) -

i'm using eclipse kepler sr2 (4.3.2). jsp pages, jsp validator reports warning on bootstrap alert box following <div class="alert alert-danger alert-dismissable"> <button type="button" class="close" data-dismiss="alert" aria-hidden="true">x</button> error occurred </div> the closest similar question i've seen why eclipse creates warning on html script tag? i'm assuming latest version of eclipse has html5 support. is warning valid, or there way go away. upgraded eclipse luna , warning isn't shown anymore guess solution upgrade luna.

Having issues addressing inheritance in C# -

Image
i'm having trouble understanding how implement inheritance. my model purely demonstration's sake, here go: i have parent class bus . has 2 children dieselbus , electricbus . these abstract classes. i have further 2 classes coach , citybus . how set inherit either dieselbus or electricbus without having define separate coach , citybus classes coachdieselbus , coachelectricbus , citybusdieselbus , citybuselectricbus ? feasible/possible? i don't have examples short of skeletons far, looking advice on point. what looking this: as opposed this: thanks! edit (2013-07-03): first, code: bus.cs using system; using system.collections.generic; using system.linq; using system.text; namespace inheritancetest { abstract class bus { public bus () { } public abstract engine enginetype { get; set; } private int id; public int id { { return id;

In c++: what is the difference between initializing a variable in a function versus declaring it in the function header? -

is difference in can them? also, how can pass result of variable in function function? recently, had variable wasn't passing code in parent function other function. void add(int a, int b) vs void add(int a) int b; a+b; and passing result of variable parent function function: void add(int a, int b, double c) a+b=c; void divide(double c, int d, double e) c / d = e; there big difference between these 2 functions (i added absent details) void add(int a, int b) { int c = + b; } void add(int a) { int b = 10; int c = + b; } in first case can call function passing 2 arguments. example add( 2, 5 ); and inside function variable c have value depending of 2 arguments (if = 2, b = 5 c = 7). in second case can call function passing 1 argument add( 2 ); so if specify argument 2 c equal 12.you can not change value of b calling function because have no access it. take account code not compiled void add(int a, int b

asp.net mvc - Upload File in MVC and create a link to Download the the file -

i have created code upload file. not upload file in app_data/uploads folder have created. here code>> in view>> <form action="~/views/home/_saveupdate" method="post" enctype="multipart/form-data"> <label for="file1">filename:</label> <input type="file" name="files" id="file1" /> <label for="file2">filename:</label> <input type="file" name="files" id="file2" /> <input type="submit" /> </form> , handler>> [httppost] public actionresult index(ienumerable<httppostedfilebase> files) { foreach (var file in files) { if (file.contentlength > 0) { var filename = path.getfilename(file.filename); var path = path.combine(httpcontext.server.mappath("~/app_data/upl

Cross-mobile background service -

the goal record , analyze gps tracks: for ios , android devices gps required record/analyze in same time for other devices (tablet - desktop) enough analyze recorded tracks (in browser) it ok have platform-specific code, i'd share "analyze" part between ios, android , web and able run code while ios/android app backgrounded. i have "analyze" code written in javascript, started looking options in order: 1) do in web app ios safari stops running javascript when backgrounded. no luck. 2) use phonegap or alike javascript stops when backgrounded. proposed write service code native plugin. no luck. 3) use titanium spent 2 weeks find android service implementation in titanium incomplete. lacks startforeground(..), used ask android not kill service. tried implement native module this, reports while service running, javascript don't. 4) use marmalade mobile , compile c++ javascript web quick googling said c++ code can't

lucene - Kibana: Make phrase short yield no result -

the original log looks this: {"@message":"info 2014-03-03 23:59:30,022 [automatic.notify.service.17] ... if search 23:59:30,022 can find line, if search 23:59:30 , no result returned explanation this? because looking exact match, should try 23:59:30* if not care miliseconds.

Importing excel data to datagrid using interop C# -

i have started on importing excel data datagrid.i found code , tried in on system i'm net getting in datagrid.can please tell me i'm doing wrong here. if has working code can u please share me. here code using system; using system.collections.generic; using system.collections; using system.componentmodel; using system.data; using system.drawing; using system.linq; using system.text; using system.windows.forms; using microsoft.office.interop.excel; namespace windowsformsapplication1 { public partial class form1 : form { public form1() { initializecomponent(); } private void form1_load(object sender, eventargs e) { arraylist test = processworkbook("c:\\users\\s_kamalaksha_prabhu\\desktop\\book1.xlsx"); if (test != null) datagridview1.datasource = test; } public arraylist processworkbook(string filepath) { string file = fil

How to parse json using jackson android -

i making 1 webservice application in getting json response , parsing json , showing result in listview.right want parse jackson library.i tried far not getting anything. code: private static class holder { arraylist<upcomingpojo> holderlist; } objectmapper objmapper=new objectmapper(); holder holderpojo =objmapper.readvalue(jsonresponse,holder.class); upcomingpojo contact = holderpojo.holderlist.get(0); string name=contact.getname(); pojo: @jsonignoreproperties(ignoreunknown=true) public class upcomingpojo { string no,name,desc; public string getno() { return no; } public string getname() { return name; } } json: [ { "no":"12000", "name":"ram" }, { "no":"12532", "name":"ravi" } ] this code parsing json using jackson libr

c# - Does it make sense to encapsulate fields in a public class in a Web Service? -

if have public class in wsdl specification user have fill send server, make sense encapsulate fields or it's better make public too? it's never idea publicly expose class fields. encapsulate fields , expose them via public properties. might using public field now, may want add additional logic have more control on how field read or written in future, lot easier properties , doesn't require changes consumer code. you can use auto-implemented properties can defined cleanly in 1 line public field: public string field1 { get; set;}

Android ScrollView Overlaps - Weight? -

i have following layout, , reason scrollview overlaps on views. don't quite understand whole use of weight , layout_weight attribute in android. thinking has problem. <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/list" android:layout_width="match_parent" android:layout_height="match_parent" > <imageview android:id="@+id/topbar" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_alignparentright="true" android:layout_alignparenttop="true" android:adjustviewbounds="true" android:scaletype="fitxy" /> <imageview android:id="@+id/secondbar" android:adjustviewbounds="true" android:layout_width="match_parent" android:layout_height=&

ClassCastException: android.os.Handler$MessengerImpl cannot be cast to My -

i have declared handler in service : final messenger messenger = new messenger(new musicapicontrolhandler()); public class musicplayerbinder extends binder { public musicplayerservice getservice() { return musicplayerservice.this; } } @override public ibinder onbind(intent intent) { return messenger.getbinder(); } public class musicapicontrolhandler extends handler { @override public void handlemessage(message msg) { // } } in class implements serviceconnection , binds service , following: @override public void onserviceconnected(componentname componentname, ibinder ibinder) { handler = (musicplayerservice.musicapicontrolhandler) ibinder; } my problem is, classcastexception when try cast binder handler , should instance of because it´s set binder of messenger. where going wrong? i have not declared service process

How to remove ignored files from current commit using git commit --amend -

i made commit contains lot of .o files want ignore. created .gitignore file , made default global (i put home , did git config --global core.excludesfile ~/.gitignore ). now need amend commit these files no longer in before push. doing git commit -a --amend leave ignored files in commit. i need re-apply these new ignore rules on existing commit before push it how fix it? do a: $ git reset --soft head^ and see changes you've made commit staged. unstage unwanted files , commit wanted ones: $ git reset head *.o $ git commit -m "commit msg"

java - Selenium Webdriver for gwt multi upload component -

case 1: trying automate multiple file upload functionality. whatever xpath giving finding element properly, when executing program (using webdriverwait class) failing, giving following error exception in thread "main" org.openqa.selenium.timeoutexception: timed out after 5 seconds waiting visibility of element located by.classname: gwt-fileupload build info: version: '2.39.0', revision: 'ff23eac', time: '2013-12-16 16:12:12' case 2: trying automate upload files local server. whatever xpath giving finding element properly, when executing program (without using webdriverwait class) failing, giving following error: exception in thread "main" org.openqa.selenium.invalidselectorexception: given selector //input[@class='gwt-fileupload either invalid or not result in webelement. following error occurred: invalidselectorerror: unable locate element xpath expression //input[@class='gwt-fileupload code follows: webdriver drive

run from Shell R function with json string parameter -

i have function, works json string. when try in r: my_function('{"menu":{"id":"file","value":"file","popup":{"menuitem":[{"value":"new","onclick":"createnewdoc()"},{"value":"open","onclick":"opendoc()"},{"value":"close","onclick":"closedoc()"}]}}}') it works well. but when try in shell command: r -e "source('./my_function.r'); my_function('{"menu":{"id":"file","value":"file","popup":{"menuitem":[{"value":"new","onclick":"createnewdoc()"},{"value":"open","onclick":"opendoc()"},{"value":"close","onclick":"closedoc()"}]}}}')" it fails error: unexpected character

Integrating Facebook and Nextpeer in Android app -

i want integrate facebook , nextpeer in app. have facebook login button in activity , works fine. have nextpeer multiplayer activity works fine if i'm not logged in facebook when i'm logged in facebook , try start multiplayer game error: java.lang.classcastexception: com.facebook.accesstokensource cannot cast com.nextpeer.android.facebook.accesstokensource so it's seems nextpeer trying login facebook using class facebook sdk. can me that? please :) double check androidmanifest.xml file. have set right login activity? it should point “com.nextpeer.android.facebook.loginactivity”. <activity android:name="com.nextpeer.android.facebook.loginactivity" android:theme="@android:style/theme.translucent.notitlebar" android:label="@string/np__application_name" />

javascript - How to avoid $digest already in progress during testing -

i'm banging head around testing service uses google maps geoencoding service. thought going easy since it's straightforward code. seems it's not. here service: (function () { 'use strict'; var googlegeocodingservice = function ($q, googleapiloaderservice, $rootscope) { var geocoder, mapsreadypromise; mapsreadypromise = googleapiloaderservice.load('maps', '3', {other_params: 'sensor=false'}).then(function() { geocoder = new google.maps.geocoder(); }); var getlatlng = function (searchkeyword) { var deferred = $q.defer(); mapsreadypromise.then(function () { geocoder.geocode({'address': searchkeyword}, function (results, status) { $rootscope.$apply(function () { if (status === google.maps.geocoderstatus.ok) { deferred.resolve(results);

mysqli - openshift scaling up - "Unable to restore mysql-5.5 because it appears there is no snapshot for that type" -

i have openshift app mysql 5.5, php 5.4 , phpmyadmin 4.0 convert scalable. so according instructions shekhar gulati on - https://www.openshift.com/forums/openshift/recreate-an-existing-app-so-it-is-scaleable#comment-30153 took snapshot of old app. created new scalable app with $ rhc app create -s apiprod php-5.4 mysql-5.5 phpmyadmin-4 since old app had phpmyadmin - , cannot add phpmyadmin scalable app. created new app $ rhc app create -s apiprod php-5.4 mysql-5.5 untarred old snapshot, deleted phpmyadmin subdirectory old snapshot, tarred again, , tried restoring new scalable app - got following error - dev@ubuntusrv2:~$ rhc snapshot restore -a apiprod -f oldapp.tar.gz restoring snapshot oldapp.tar.gz... removing old git repo: ~/git/apiprod.git/ removing old data dir: ~/app-root/data/* restoring ~/git/apiprod.git , ~/app-root/data unable restore mysql-5.5 because appears there no snapshot type activation status: success result: success now, problem seems similar 1

jasperserver - JasperReportServer 5.5 sample tutorial -

Image
i'm trying start jasper report server connecting oracle db . i'm getting timezone mismatch exception while connection oracle db. know happening because local pc time , db server time difference. can me tutorial on jasper report server .can start server without connecting db or can me how configure h2 database.. please here guide can start with http://jasperserver.sourceforge.net/docs/3-5-0/jasperserver-user-guide.pdf in screenshot have depicted how change timezone , local before logging in jasperserver. hope helps.

Trying to get property of non-object. Objects in php work on localhost but not on Hostingsite -

i have uploaded ci project on hosting site now, whenever script accesses property of objects, no longer recognized objects, therefore property can't accessed , used. i've tried print_r($someobject) , works fine. shows me properties. when try print_r($someobject->property) no longer works. message is: trying property of non-object. i've tried treating array , doesn't work either. also, don't know if helps or not, indexes of arrays don't work either on uploaded version. example, on localhost returning result of query returned 1 value: q->result()[0] . doesn't work either, if take out index(key) , leave q->result() works. update: apparently objects have values retrieved database work fine objects on localhost when upload project on hosting site (the same php version) object wrapped in array on first position. else ever experienced this? or have idea of might going wrong? eg. on localhost: $object->property === on hosting site: $obje

sql - Validating date has expired with current system date -

i trying compare database stored date value current system date. date format (yyyy-mm-dd). , sql date written compare follows. select id table1 tabel1.date > current_date and want result if date has been expired or not. please find me correct sql. thanks in advance well, when tabel1.date > current_date date stored in database in future. try select id table1 tabel1.date < curdate();

eclipse - Project Deployment Error - GC Overhead Limit Exceede -

i using tomcat server , eclipse ide , using maven i getting " gc overhead limit exceeded " when doing project clean spring project. the reason why getting above error because "low memory allocation vm" the solution 1.goto bin folder of tomcat. 2.increase size of permgen in catalina.sh file eg: catalina_opts="$catalina_opts -xms1024m -xmx10246m -xx:newsize=256m -xx:maxnewsize=356m -xx:permsize=256m -xx:maxpermsize=356m" add above line in top of catalina.sh file , restart tomcat (even if doestn't work restart eclipse also). worked me

javascript - mockjax loader - stop from running for specific function -

i making use of jonathan sampson's answer jquery busy loader. works 100% , detects jquery posting or , shows loader. my problem times want user wait when fetch info database happy loader appear. what want however, functions loader not show when save info database. the fiddle can found here for example, below causes loader run. how can modify mockjax knows not run function only? $(document).on("click", function(){ $.get("/mockjax"); }); thanks always. short version (with code) click heading - animation click paragraph - no animation http://jsfiddle.net/hps2v/ $.ajax({ url: "/mockjax", type: "get", global: false //this key }); -- the longer version there great variable available in $.ajax() method let's stop ajax events firing (but not ajax itself). called global . docs global (default: true) type: boolean whether trigger global ajax event handlers request.

java - How to use my own sqlite database and search through it in android? -

i'm beginner in android development. i'm trying make app search name , show matching results (from database) in listview. since there's lot of data, thought best write database without using sqliteopenhandler. have .db file, need way able use in app assets folder , able search through it. i found links thought useful. http://www.reigndesign.com/blog/using-your-own-sqlite-database-in-android-applications/ this shows how use existing database. http://developer.android.com/training/search/search.html and google's information on storing , searching data. need know possible somehow combine these 2 methods achieve i'm looking for? you can use this extended sqliteopenhelper . helps copy db file assets folder in application.

java - How to use Spring authorization in client side in GWT -

i have been trying implement role base authorization in client side code limit views specific users. i'm trying use following code limit view @preauthorize("hasrole('role_user')") public void create(contact contact); i'm trying add following code authentication = securitycontextholder.getcontext().getauthentication(); userdetails currentuserdetails = (userdetails) a.getprincipal(); and added following in module.gwt.xml file <inherits name='org.springframework.security.core.authentication' /> <inherits name='org.springframework.security.core.context.securitycontextholder' /> <inherits name='org.springframework.security.core.userdetails.userdetails' /> but giving following error while compiling [error] unable find 'org/springframework/security/core/authentication.gwt.xml' on classpath; typo, or maybe forgot include classpath entry source? [java][error] line 22: unexpected exception

email - How to use an alias while sending mail on linux? -

i have shell script sends out mail @ end of processing status. using command - mail -s "mail_subject" "tom@my_domain.com" < "mail_text" this mail being sent email id user@<machine_name>.my_domain.local . is possible use alias while sending these mails ? something process.name@my_domain.com ? if yes how ? some versions of mail have options this, not universally portable. if needs simple, write own sendmail wrapper. cat - mail_text << ____here | sendmail -oi tom@example.com from: alias <process-noeeply@example.com> subject: mail_subject ____here the empty line after headers significant. sendmail fill in (what thinks are) sensible defaults headers don't specify. it doesn't have proper sendmail; mtas ship "sendmail" binary (more or less) supports traditional sendmail command-line api. if need mime or other bells , whistles, maybe @ mutt instead.

email - Issue with javax.mail.internet.AddressException:Domain contains illegal character in string -

i have been going through lot of questions regarding javax.mail.internet.addressexception , have noticed, email id format responsible exception thrown. have encountered problem , have not been able root of it. question is, exact reason exception thrown? also, thrown if mail address of form something.another@somename.com ? here log: methodname: exception while processing mail body javax.mail.internet.addressexception: domain contains illegal character in string ``'help@xyz.com''' it looks address contains quote characters. should not. where address coming from? coded java string constant in application? being read database? read user input field?

How to add facebook comments to my website page using facebook API? -

with new " comments edge " implementation, know if can let people add comments website page using own "add comment" form? according documentation can publish comment object_id (and object_id website url think). couldn't use comments plugin ( https://developers.facebook.com/docs/plugins/comments ), or need create custom means?

objective c - How to create own push service for iOS? -

in ios app, need fetch data server check whether new data available. can't use apn because there won't internet available, our app b2b app, use local server interact with. possible create push service in local server? if how setup push service in local server. local server can send push notifications app. you use new background fetch in ios 7 regularly fetch new data. apple doc (fetching small amounts of content regularly): https://developer.apple.com/library/ios/documentation/iphone/conceptual/iphoneosprogrammingguide/managingyourapplicationsflow/managingyourapplicationsflow.html#//apple_ref/doc/uid/tp40007072-ch4 tutorial: http://code.tutsplus.com/tutorials/ios-7-sdk-working-with-background-fetch--mobile-20520

wordpress - PHP if first div show class if else dont have class -

i have bootstrap carousel requires first slide have class of active work. jquery removes , adds class of active slide changes. i using wordpress populate carousel , using advanced custom fields plugin so. what im looking if first div add class of active. if not first div class not added. here php far: <div class="carousel-inner"> <?php while(has_sub_field('homepage_carousel')): ?> <div class="item active"> <img src="<?php the_sub_field('slide_image'); ?>" alt="..."> <a href="<?php the_sub_field('slide_link'); ?>">explore</a> </div> <?php endwhile; ?> </div> <div class="carousel-inner"> <?php $i = 0; ?> <?php while(has_sub_field('homepage_carousel')): ?

regex - Problems with repetition and grouping -

i'm trying use repetition trim down input sed pattern i'm getting unexpected results. the text parsing structured as: \s+\d+\s+\d+\s+\d+\s+\d+\[0-9a-za-z] ... i've tried using repetition reduce volume of input on 1 line , make command simpler read/debug: ^\s+((\d+\s+){4})([0-9a-za-z]).*$ when try use in sed substitution command, value of \2 equal last word \1. if change repetition 4 5 can alphanumeric pattern \2 appears in \1. need values in \1 else don't want muddle results or use work around removing last word form \1 output. does have idea why happening or doing wrong? (i know awk easiest way deal problem determined solve sed , improve understanding of regular expressions.) sed 's/\(\([[:blank:]]\{1,\}[0-9]\{1,\}\)\{4\}\)\([0-9a-za-z]\)/[\1](\2){\3}/' yourfile # \1 +---------------------------------------+ # \2 +------------------------------+ # \3 +-------------+ replac

java - Is RESTful webservices with Ajax ,Json,javascript and jquery alternative of JSP? -

i have perception there no or less need of jsp if use restful ajax call , json. we can update views using javascript or jquery. do need jsp in case? i using jsp session management only. do need jsp session management in case? you don't need jsps have httpsession, if manage rest services servlets or spring mvc. so, answer question, no. however, template framework jsp or freemarker still useful in case want use tags resolved on server.

php - Warning function mysql_query() and mysql_fetch_array() using TCPDF -

i'm trying print data mysql these error : warning: mysql_query() expects parameter 1 string, resource given in .. warning: mysql_fetch_array() expects parameter 1 resource, null given in .. tcpdf error: data has been output, can't send pdf file i have learn these following links still warning: warning: mysql_fetch_array() expects parameter 1 resource, boolean given in mysqli_fetch_array()/mysqli_fetch_assoc()/mysqli_fetch_row() expects parameter 1 resource or mysqli_result, boolean given this code: $con=mysql_connect('localhost','root','','bkd_rev'); $sql = 'select * tbl'; $result = mysql_query($con,$sql); if($result === false) { die(mysql_error()); } while($row = mysql_fetch_array($result)) { $id = $row['id']; $nam = $row['name']; $tbl .= '<tr>

apache pig - Passing parameter in sqoop -

below sqoop cmd in shell script, sqoop import --connect 'jdbc:sqlserver://190.148.155.91:1433;username=****;password=****;database=testdb' --query 'select dimfreqcellrelationid,ossc_rc, mecontext, enodebfunction,eutrancellfdd,eutranfreqrelation, eutrancellrelation dbo.dimcellrelation dimfreqcellrelationid > **$maxval** , $conditions' --split-by oss --target-dir /testval; before executing command, have assigned value $maxval , when execute sqoop cmd value should passed in place of $maxval. thats not happning. possible pass parameter through sqoop. can please let me know if have suggestion achieve logic? i believe problem seeing incorrect enclosing. using single quotes (') prohibit bash perform substitutions. need use double quotes (") if want use variables inside parameter. have careful not want substitute $conditions placeholder. try without sqoop: jarcec@odie ~ % echo '$maxval , $conditions' $maxval , $conditions jarcec@odie ~ %

android - using ShareActionProvider somewhere else, not it ActionBarSherlock -

Image
sorry noob question, i've used shareactionprovider actionbarsherlock. don't want use actionbarsherlock @ - want use side menu , have button sharing - can ? you can put in click listener or similar. intent sendintent = new intent(); sendintent.setaction(intent.action_send); sendintent.putextra(intent.extra_text, "this text send."); sendintent.settype("text/plain"); startactivity(sendintent); which should show dialog this:

c# - File contains corrupted data - Package Manager Console -

Image
i trying follow article . there step says need install xsockets.sample.webrtc via package manager console( pmc ), got stuck. have been getting error says file contains corrupted data , shown below - i went through post none of solutions worked me. not find solution problem. doing wrong? how make work? another question is, in article following, there picture shows - but got nothing localnuget in package source . got 2 options - check above image. why difference? there wrong visual studio installation? the problem nuget package manager console .if comes across problem, try , update nuget package manager version, worked in case. to update nuget package manager click on tools -> extensions , updates -> updates  -> visual studio gallery -> nuget package manager .

c# - accessor must be more restrictive than the property or indexer -

i have folowing class: using system; using system.collections.generic; using system.linq; using system.text; using system.data.odbc; namespace framework { public class oracleprovider { private odbcconnection db { get; private set; } private string dbusername = settings.default.username; private string dbpassword = settings.default.password; public oracleprovider() { connect(); } public void connect() { db = new odbcconnection("driver={microsoft odbc oracle};server=ctir; uid="+dbusername+";pwd="+dbpassword+";"); } } } now following error: error 11: accessibility modifier of 'framework.oracleprovider.db.set' accessor must more restrictive property or indexer 'framework.oracleprovider.db' i've been looking @ similar questions haven't found answer. can explain me why happening? want learn.

Why is return type needed on overloaded scala function? -

def tojson[t](obj: t) = { gson.tojson(obj) } def tojson[t](list: seq[t]) = { tojson(seqasjavalist(list)) } this doesn't compile. , that's documented feature ( see answer ): when method overloaded , 1 of methods calls another. calling method needs return type annotation. the question is: why? from above link + additional thought colleagues, here possible reasons: scala uses return type determine overloaded methods. case, , why neded? (java doesn't use return types, example) partial functions - if 1 of methods doesn't have arguments , other 1 does, tojson() may viewed partial function, it's not whether return type string or function i know it's best practice specify return type anyone, why above snippet not compiling, , if return type inference isn't enough, why there in first place? might not main reason, note reason explicit parameter given as: when method recursive. the problem is, depending on re

compact framework - wince get notification on resume of device c# -

i have mobile application on windows ce 6.0 device. device sent suspend hardwarebutton. want tasks, soon, device resumed. is possible check in .net cf-program, if device resumed? thanks! according this previous question, it's not possible without resorting p/invoke or 3rd-party library.

Converting data to Excel from Matlab -

in matlab 1 of variable produce sort of number follows: t = 1.0e-07 * columns 1 through 4 0.000002188044002 0.000011853757224 0.000043123777130 0.000134856642090 columns 5 through 8 0.000414700915105 0.001479279377534 0.003134050793671 0.008617995925603 columns 9 through 12 0.065830078792745 0.087987267599604 0.106338163623915 0.121617374878836 columns 13 through 16 0.134520178924611 0.145518794399287 0.155035638788571 0.163042823513867 columns 17 through 18 0.170181805020581 0.172442168463983 how can produce them in 1 column in order copy , paste excel? try format long g t' or else double click on t in workspace , you'll datagrid (the variable editor) can copy , paste out of

iphone - how to properly show / hide UIView on button click in iOS -

i have uiview , added in xib file. through connection inspector join properly. in viewdidload: method hiding , on button pressed showing it. here code far: .h file @property (nonatomic, retain) iboutlet uiview *subview; in viewdidload: method: _subview.hidden = yes; it hiding view properly, on button pressed not showing up. - (ibaction)customerinvoice:(id)sender { //self->_subview.hidden = no; _subview.hidden = no; } using both ways not showing up. please, me resolve it. sometime (or xcode) can make mistake during connecting iboutlets/ibaction if doesn't work can remove connection , again, should help. also apple recommendation use weak instead of strong/retain iboutlet property if haven't got reason should do: @property (nonatomic, weak) iboutlet uiview *subview;

javascript - Google Version 3 Maps Geocoder, Get Coordinates of marker layer when clicking or dragging marker -

i have made google version 3 geocoder , want able pick coordinates of marker when dragged or clicked. below code: <!doctype html> <html> <head> <meta name="viewport" content="initial-scale=1.0, user-scalable=no"/> <meta http-equiv="content-type" content="text/html; charset=utf-8"/> <title>google maps javascript api v3 example: geocoding simple</title> <link href="http://code.google.com/apis/maps/documentation/javascript/examples/default.css" rel="stylesheet" type="text/css" /> <script src="http://maps.google.com/maps/api/js?v=3.5&amp;sensor=false"></script> <script type="text/javascript"> var geocoder; var map; function initialize() { geocoder = new google.maps.geocoder(); var latlng = new google.maps.latlng(-34.397, 150.644); var myoptions = { zoom: 8, center: latlng, maptypeid: google.maps.maptypeid.roadmap } map =

ios - What is the reason for some people use GOTO statement in objetive C? -

i have not experience in objectivec (ios) development i've seen many codes curiosity , found people using goto statement ( jsonkit library , code games, etc), apple's source code known use ( you can see here ). as have learned in academic life, using goto bad development pratice , must avoid, why "commom" pratice in ios development, there special reason?? it programming style use break , continue , , return statements instead of goto statement whenever possible. however, because break statement exits 1 level of loop, might have use goto statement exit nested loop. *source - microsoft one more example blog

android - Is it possible to have RelativeLayouts in a RadioGroup -

i want row in layout radiobutton, edit text, textview surrounded radiogroup. radiogroup does't seem work way. i'm generating layout code not xml, show how like: <scrollview> <linearlayout> <radiogroup> <relativelayout> <radiobutton> <edittext> <textview> </relativelayout> <relativelayout> <radiobutton> <edittext> <textview> </relativelayout> </radiogroup> </linearlayout> </scrollview> i can select radiobuttons, group not working. wrong, or how solve problem? you can't have relativelayouts in radiogroup. view rendered expected, radio buttons won't function (they lose grouping). if need edittext inside each button, you'll have code radio button functionality yourself. however, if need different text styles inside radio bu

php - Data not pulled from mysql at particular zoom level laone -

between command not working correctly geo coordinates select * table_name loc_lng between $ln2 , $ln1 , loc_lat between $la2 , $la1 the code works fine when $ln2 smaller $ln1 , $la2 smaller $la1, dosent work when values $ln1 greater $ln2 , $la1 greater $la2. ln , la geo coordinates 1 bigger other. that's expected. need additional logic define minlatitude , maxlatitude , minlongitude , maxlongitude before pass values query. then query can be select * table_name loc_lng between $minlongitude , $maxlongitude , loc_lat between $minlatitude , $maxlatitude

How do I change the version of my SQL Server instance? -

i using sql server 2012 express.but when execute '@@version' query showing "microsoft sql server 2005 - 9.00.3042.00" , of queries 'fetch' not working anymore.how can change database engine sql server 2012? alter database database_name set compatibility_level = 110

java - what is the purpose of LockMode OPTIMISTIC? -

as per how optimistic locking in hibernate , need enable optimistic locking version element or version annotation in hibernate. clear till here. i not sure purpose of lock mode optimistic ? in kind of scenario, developer should use ? to understand why want optimistic locking, first need understand no locking , pessimistic locking mean. i'm no hibernate expert, i'll tell without focus on hibernate. when 2 process/users update same object 1 updates last win. need find way prevent this. 1 way pessimistic locking. here, put lock on object @ moment load database "select update". until transaction commited or rolled back, nobody else can "select update" object. problem is: when load entity via hibernate, specify if want load read-only purpose or if want modify object. so here comes optimistic locking. concept assumes optimistically go ok in cases. when 2 processes/users update same object, second 1 not win, exception on commit.

python - starbase gives 405 when trying to connect to hbase -

i'm trying read , write hbase through rest api, have running on machine @ port 8085 (can see @ xxxxx:8085/rest.jsp) i've made script test , gives me 405 (i think it's "method not allowed" i'm not sure): #!/usr/bin/env python starbase import connection socket import gethostname hostname = gethostname() print "hostname: %r" % hostname con = connection(host=hostname, port=8085) print con.tables() i think have problem prerequisites i'm not sure, perhaps more experience can help. are there nicer solutions connect hbase , python? thanks. starbase works stargate http://wiki.apache.org/hadoop/hbase/stargate . stargate runs on port 8000 default. if have stargate running, should able see list of tables accessing xxxxx:8000 (8085 in case). if don't see that, you're running old , deprecated version of rest api. you try apache thrift framework http://thrift.apache.org or happybase (which based on apache thrift fr

frontend - How I check that an api call to an appengine instance came from a Google Compute Engine instance? -

we using google compute engine instance generate convert datastore tables large downloadable csv files. want instance log errors app engine front end instance calling: /api/log but want sure call came google compute engine instance has authority write log. how can check api call came google compute engine instance? it depends on how secure want be. simplest solution include parameter in post request backend , front-end instances recognize - random sequence of characters trick. next level use secret key encrypt contents of request - there many implementations depending on language use. this approach more flexible too, if decide, example, move backend app engine compute engine.