Posts

Showing posts from July, 2011

android - EditText getText() returns different value then what is displayed -

i have been developing android while , have never come across before im hoping 1 here can help. have multiple edittext's , autocompletextviews populate sharedprefs. problem views not displaying text should be. display old value there until leave activity , come back. strange part if call gettext function on edittext when has wrong value displayed gettext() returns correct value. can please explain why might be. public view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate){ view = inflater.inflate(r.layout.extra_info, container, false); myprefs = preferencemanager .getdefaultsharedpreferences(getactivity()); initprefs(); findtextviews(); findviews(); initdatasource(); runqueries(); getallfields(); return view; } private void findviews() { editpayid = (autocompletetextview)view.findviewbyid( r.id.editpayid )

objective c - NSLogging UILabel's text outputs null -

i have custom view controller called timerviewcontroller , subclasses of called firstviewcontroller , fourthviewcontroller . i declared instance of firstviewcontroller in firstviewcontroller 's . h named controller . in viewdidload method of fourthviewcontroller 's .m , have: controller = [self.storyboard instantiateviewcontrollerwithidentifier:@"maincontroller"]; in storyboard, i've declared view controller id maincontroller , declared custom class of fourthviewcontroller . then, in fourthviewcontroller 's .m have: controller.mainlab.text = [nsmutablestring stringwithformat:@"this string"]; nslog(@"%@", controller.mainlab.text); this, however, outputs (null) . why happen? mainlab must nil . outlet isn't connected xib. as aside, using stringwithformat: string isn't format wasteful.

python - Strip leading 'u' from JSON for PHP -

i have following i'm trying parse in php it's json leading 'u' (probably python indicators, i'm not sure) what's quickest way turn these valid json? or valid json php should able parse? {u'_id': u'fruit', u'etags': [{u'score': 3.612, u'tag': u'apple'}, {u'score': 1.443, u'tag': u'banana'}, {u'score': -0.833, u'tag': u'cherry'}, {u'score': -2.048, u'tag': u'orange'}]} edit: "syntax error, malformed json" in php off, may not 'u' edit: not great answer, getting trick done me: $json = str_replace("u'", "'", $json); $json = str_replace("'", '"', $json); you're doing wrong here. assuming have in python data = {u'_id': u'fruit',

dos - Creating text editor like EDIT on Command Prompt using FreePascal -

i want create texteditor dos program. want create using freepascal compiler. know logical programming create it? make sure fpc installed , set (including path), download main sources if needed. (depends on platform) run "make" in packages/fv/examples/ (in sources) compiles testapp.pas testapp.exe run testapp.exe , select file->new, in editor. study testapp source , remove parts program don't like. reference book turbo pascal "turbo vision" library (which similar fpc provided fv library demo uses) great asset this.

iphone - Unable to change font size on UILabel in iOS -

i have started learning ios programming. working on demo application in using font " ge flow regular "(ge_flow_regular.otf) & " ge flow bold " arabic language. have followed required steps add custom fonts in ios app. want increase or decrease size of texts on uilabel in ios unable specified font. can perform font size increase or decrease other fonts in ios. don't understand why unable change font size " ge flow regular " font? please me solve problem. have tried using [uifont fontwithname:size:] ?

javascript - jQuery value not getting assigned from ipinfo when expected -

i'm using: //function obtain current location, used display relevant contact information $.get("http://ipinfo.io", function(response){ $("#address").html(response.region);//http://jsfiddle.net/zk5fn/2/ $("input[id=address]").val(response.region); }, "jsonp"); to current location contact page. aim can use if address== display various contact numbers etc. this function updates value of hidden field. i've checked debugger , it's working fine. i'd value can play it's blank or empty. i have $(document).ready(function(){ var testloc = $('#address').val(); if(testloc == ""){ alert("noes!!!"); } }); which i've placed in same script block within head see if results different, again, it's blank , returns noes alert. i though waiting document load i'd values assigned/set. can suggest solu

json - Get Sharepoint 2013 List Items data from certain fields with javascript and REST -

i'm trying list item data columns(fields) list. from understand need internalname of fields want pull list data from. edited include $expand both field , item information in 1 rest response: edited include loop i'm using create options. i'm storing data in value, separating ?'s , splitting data html table when selected. function execcrossdomainrequest() { var executor; executor = new sp.requestexecutor(appweburl); executor.executeasync( { url: appweburl + "/_api/sp.appcontextsite(@target)/web/lists/getbytitle('weights%20and%20thickness')" + "?$select=fields,items&$expand=fields,items&@target='" + hostweburl + "'", method: "get", headers: { "accept": "application/json; odata=verbose" }, success: ondatareturned, error: onerror }

xamarin.ios - Integrating third party controller with MVVMCross on MonoTouch -

i want use third party view controller inherits uiviewcontroller ( https://bitbucket.org/thedillonb/monotouch.slideoutnavigation/src/f4e51488598b/monotouch.slideoutnavigation?at=master ), how integrate mvvmcross? i take source , change inherit mvxviewcontroller, guessing run other libraries. do need implement interfaces mvxviewcontroller does? imvxtouchview? imvxeventsourceviewcontroller? for particular case, don't want data-binding can use custom presenter - e.g. see @blounty's answer, or see project demo - https://github.com/fcaico/mvxslidingpanels.touch if ever need convert third party viewcontroller base classes support data-binding, easiest way guessed: inherit them provide eventsource -viewcontroller inherit eventsource -viewcontroller add mvx bindingcontext this technique how mvvmcross extends each of uiviewcontroller , uitableviewcontroller , uitabbarcontroller , etc in order provide data-binding. for example, see: extending uiviewcont

html - Having Bootstrap to show the whole page instead of zooming it on a mobile device? -

i'm using bootstrap website , notice when view layout on mobile device, mobile's web browser automatically zooms in particular top left corner portion of webpage. want browser show whole webpage @ start instead of zooming top left corner. showing whole webpage (albeit may little small in size) default behaviour when don't use bootstrap. is possible bootstrap show whole webpage instead of zooming in page when first entering on mobile device? this has viewport being set. assuming webpage standard size, can use: <meta name="viewport" content="width=1024"> make sure place in head of page - or replace 1 there.

regex - Gradle/Java replace text -

is possible use regex convert urls in css files in way demonstrated below? don't want hardcode font names. from: url('../fonts/glyphiconshalflings-regular.eot?#iefix') format('embedded-opentype') to: url("#{resource['css:../fonts/glyphiconshalflings-regular.eot']}?#iefix") format('embedded-opentype') and have: task fixcssresources << { filetree cssfiles = filetree("src/main/webapp") { include "**/*.css" } cssfiles.each { file cssfile -> string content = cssfile.gettext("utf-8") // here? cssfile.write(content, "utf-8") } } assuming want format url(something) , should want: string regex = "url\\('([^']*?\\.(eot|ttf|fnt))(.*?)'\\)"; // font file formats^ content = content.replaceall(regex, "url(\"#{resource['css:$1']}$3\")"); edit : forgot es

Determining when functions allocate memory in C++ -

so 1 major problem have determining whether given function in c/c++ memory allocation or not. work external libraries, of have functions return pointers new objects. there basic design paradigm or convention let me know ahead of time if allocates memory? it seem function returns pointer new object must allocating memory, not seem case. example, fopen not edit: clear, don't have access source code can't check if uses new or malloc, ect. read documentation of libraries use. should tell if things should freed.

Obtain date without timestamp in DB2 -

please pardon ignorance if have missed documentation/solution same. searched web , not find answer. i have simple question. in db2 table,i have column of type date , data of format 04/25/2013 12:00:00am . when query db2 database, want obtain date , not timestamp i.e obtain "04/25/2013" , not "04/25/2013 12:00:00am". tried date(column name) , gave complete value including time stamp. this looks timestamp , not date column. if indeed timestamp column try this: select varchar_format(current timestamp, 'mm/dd/yyyy') sysibm.sysdummy1 ; just replace current timestamp in above example column , sysibm.sysdummy1 table. the thing varchar_format lets format timestamp. change 'mm/dd/yyyy' part 'yyyy.mm.dd' format '2017.08.18'.

Query (Inbox and Outbox, etc) for Private Messaging System - PHP and MySQL -

i'm writing private messaging system website. user can communicate 1 of more other users (including himself / herself). have 3 tables - users - conversation_list - conversation_messages for database shown below. the users table holds users the conversation_messages table holds messages written, each message has conversation_id the conversation_list holds list of participants in each conversation each conversation of course, identified unique conversation_id now, wish query following tables: - getinboxmessages <-- difficult new messages directed user. replies message should grouped conversation , latest reply previewed - getoutboxmessages messages sent user. replies messages should grouped conversation , latest reply previewed - getconversation each message replies - isunreadmessage check if message has been read or not - getnumberofunreadmessages number of unread messages what have done far shown below. getoutbo

PostgreSQL: Find shared beginning of string with SQL -

how can determine shared beginning of 2 or more strings using sql? for example, have 3 uris: 'http://www.example.com/service/1' 'http://www.example.com/service/2' 'http://www.example.com/service/3' how can determine share 'http:://www.example.com/service/' using sql? create aggregate function create or replace function string_common_start (s text, t text) returns text $$ declare sa char(1)[] = string_to_array(s, null); ta char(1)[] = string_to_array(t, null); output_s text = ''; begin if s = t or t = '' or s = '' return t; end if; in 1 .. least(length(s), length(t)) loop if sa[i] = ta[i] output_s = output_s || sa[i]; else exit; end if; end loop; return output_s; end; $$ language plpgsql strict; create aggregate string_common_start (text) ( sfunc = string_common_start, stype = text ); it not aggregate nul

c# - Detect another application's window is scrolling -

from wpf, is possible detect application's scrollbar (e.g. notepad) being scrolled? i have looked , seems maybe need register global hook in native dll receive messages. messages interested wm_vscroll (see wm_vscroll message . at rate, looking simplest implementation. suggestions welcome.

javascript - Multiple tours with intro.js -

we'd have 1 general multi-page tour , page specific tours available web app. multipage 1 functioning, , page specific 1 triggers, calls both tour data objects. there way have multiple tours on same page? function inittours(){ // start intro tour document.getelementbyid('startintro').onclick = function() { introjs().setoption('donelabel', 'next page').start('.intro-farm').oncomplete(function() { window.location.href = 'nav_season.php?multipage=true'; }); }; var tourstep = $('.content .intro-farm').attr('data-step'); var nextlink = $('#nexttourlink').attr('href'); if (regexp('multipage', 'gi').test(window.location.search)) { introjs().setoption('donelabel', 'next page').gotostep(tourstep).start('.intro-farm').oncomplete(function() { window.location.href = nextlink+'?multipage=true'; }); } //page specific if ($('.page-tou

jar - I can't figure out how to call Java oscar3 class method stringToString from the command line -

i'm trying call java class method command line life of me can't figure out syntax. method stringtostring found in class http://apidoc.ch.cam.ac.uk/oscar3/apidocs/uk/ac/cam/ch/wwmm/oscar3/oscar3.html what have tried: java -xmx512m -classpath .:oscar3-a5:lib/oscar3-a5.jar uk.ac.cam.ch.wwmm.oscar3.oscar3 stringtostring "test" java -xmx512m -classpath .:oscar3-a5:lib/oscar3-a5.jar uk.ac.cam.ch.wwmm.oscar3 oscar3(stringtostring "test) java -classpath .:oscar3-a5.jar:lib/uk.ac.cam.ch.wwmm.oscar3.oscar3 stringtostring "test" it complains this: exception in thread "main" java.lang.noclassdeffounderror: uk/ac/cam/ch/wwmm/oscar3/oscar3 caused by: java.lang.classnotfoundexception: uk.ac.cam.ch.wwmm.oscar3.oscar3 @ java.net.urlclassloader$1.run(urlclassloader.java:202) @ java.security.accesscontroller.doprivileged(native method) @ java.net.urlclassloader.findclass(urlclassloader.java:190) @ java.lang.classloader.loadclass(classloader.java:30

android - Uninstall DevicePolicyManager app -

my app uses devicepolicymanager. if users want uninstall app have following steps: settings -> location , security-> device administrator deselect app , thay can uninstall it i think not solution play store app. can these steps users in code can uninstall app launcher? yes can. this: devicepolicymanager dpm; componentname admin; try { dpm = (devicepolicymanager) getsystemservice(context.device_policy_service); admin = new componentname(youractivity.class, adminreceiveractivity.class); if(dpm.isadminactive(admin)) { dpm.removeactiveadmin(admin); } } catch(exception e) { e.printstacktrace(); } { intent intent = new intent(intent.action_delete); intent.setdata(uri.parse("package:" + this.getpackagename())); startactivity(intent) }

sql server - Row-wise shifting pivoted data -

i need following data id 1 2 3 4 5 --- ------------ ------------ ------------ ------------ ----------- 1 null null null null level 1 2 null null null level 1 level 2 3 null null level 1 level 2 level 3 4 null level 1 level 2 level 3 level 4 5 level 1 level 2 level 3 level 4 level 5 to transformed as: id level1 level2 level3 level4 level5 --- ------------ ------------ ------------ ------------ ------------ 1 level 1 null null null null 2 level 1 level 2 null null null 3 level 1 level 2 level 3 null null 4 level 1 level 2 level 3 level 4 null 5 level 1 level 2 level 3 level 4 level 5 i.e. in every row data of columns 1,2,3,4,5 shifted left num

jsf - remove row from datatable -

i don't know how remove row datatable. this facelet: <p:commandbutton id="confirm" value="valider" update=":messages" oncomplete="dialogdelete.hide()" actionlistener="#{agentbean.btndelete}" styleclass="ui-confirmdialog-yes" icon="icon-ok"/> session bean: public void delete (agentministere agentministere) { agentministerefacade.remove(agentministere); } managed bean: public string btndelete (){ manager.delete(agentministere); return "agentlist"; }

php - Efficient way to query database from an array -

i have array containing 400 10-20 character, single string number items. want query database array in efficient way (on server load , load time) possible. here have takes 4-6 seconds load page. foreach(unserialize(mysqli_fetch_array(mysqli_query($database, "select `array` `users` `id` ='00000001'"))[0]) $value) { $friend_id = mysqli_fetch_array(mysqli_query($database, "select `id` `users` `id` ='".$value."'"))[0]; if(!empty($friend_id)){ echo mysqli_fetch_array(mysqli_query($database, "select 'username' `users` `id` ='".$value."'"))[0] . "<br />"; } } look out joins in sql, e.g. @ page .

c - Why am I getting this error during run-time? -

i wrote program while watching tutorial compare difference between 'call-by-value' , 'call-by-reference' in c. getting error: run command: line 1: 1508 segmentation fault: 11 ./"$2" "${@:3}" help? main() { int a,b; scanf("%d %d", &a, &b); printf("before call %d %d", a,b); exch_1(a,b); printf("after first call %d %d", a,b); exch_2(a,b); printf("after second call %d %d \n", a,b); } exch_1(i,j) int i, j; { int temp; temp = i; = j; j = temp; } exch_2(i,j) int *i, *j; { int temp; temp = *i; *i = *j; *j = temp; } as exch_2 expects addresses parameters, have call exch_2(&a,&b); . you passing values, , these taken addresses. if e. g. a has value of 5 , computer try use value @ address 5 on computer - not accessible program.

javascript - How can I read & write data to a new tab in Firefox? -

in past used work: // writing var newtab = window.open(); newtab.document.write("<html><head><title>i'm tab</title></head>"); newtab.document.write("<body id='hello'>with text on it</body>"); newtab.document.write("</html>"); newtab.document.close(); // reading wrote newtab.document.getelementbyid('hello').addeventlistener("click", custom_search_function(), false); however when try execute code, firefox mentions security error: error: securityerror: operation insecure. i searched forum alternative , works: var textonpage = "<html><head><title>i'm tab</title></head><body>"; var newtab = window.open("data:text/html;charset=utf-8," + encodeuricomponent(textonpage)); newtab.document.close(); but can't access page via getelementbyid newtab.document.getelementbyid('hello').addeventlistener("

asp.net mvc 4 - MVC Form View vs Table -

i looking migrate couple of applications 1 classic asp app uses vbscript , rds datafactory , foxpro desktop app mvc. there example somewhere shows using jquery show form view startup opposed table/grid view search. both applications show entire row using entire screen add update delete find next prev etc navigation @ bottom of screen opposed grid , edit. thanks yes lot, http://jquery.bassistance.de/validate/demo/ if can take jqueryui or kendoui or knockoutjs

sorting - Sequence divs using javascript onclick -

is there way click on div , save click sequence value in db. say have ten items in 10 small small divs , want them sorted in sequence click on them. clicking on first 1 sorted first , next , next. want able javascript. have seen happening in desktop application form fields sequenced tab order click on fields. i can give conceptual format, because full-fledged deal quite long, , because you've posted no code . ensure each div has unique id, , has @ least 1 common css class e.g. sortable - critical, allow query dom elements further sorting. and, regarding ideas id of divs, have seen variations of identifier post id database; you have listening function run when window loaded, listens when div has class sortable clicked. override default action, , use class in tandem div id keep record of elements clicked , sort them accordingly whatever criteria deem fit (id, date, content). however, have manipulate dom modified represent new ordering. can done in 2 further way

ruby on rails - Spree - Generator command -

i new spree , rails , have been following developer guide ( http://guides.spreecommerce.com/developer/extensions_tutorial.html ) on spree commerce build new extension, no success. when following in spree extension director, rails g migration add_sale_price_to_spree_variants sale_price:decimal i c:/railsinstaller/ruby1.9.3/lib/ruby/gems/1.9.1/gems/acts_as_list-0.2.0/lib/acts _as_list.rb:18:in `insert': uninitialized constant activerecord::base (nameerror ) c:/railsinstaller/ruby1.9.3/lib/ruby/gems/1.9.1/gems/acts_as_list-0 .2.0/lib/acts_as_list.rb:24:in `<top (required)>' c:/railsinstaller/ruby1.9.3/lib/ruby/site_ruby/1.9.1/rubygems/core_ ext/kernel_require.rb:64:in `require' c:/railsinstaller/ruby1.9.3/lib/ruby/site_ruby/1.9.1/rubygems/core_ ext/kernel_require.rb:64:in `require' c:/railsinstaller/ruby1.9.3/lib/ruby/gems/1.9.1/gems/spree_core-2.0 .4/lib/spree/core.rb:3:in `<top (required)>' c:/railsi

angularjs - Angular to use Rails templates + Routing -

rails provide strong template engine out of box , it. wondering if there way use it? maybe angular templates can wrapped inside rails lives in our views directory. can call metatemplates. so instead of angular templates living in asset directory feel not way? also need make use of rails routes inside angular @ point. example signout functionality. afaik, let ruby serve angular templates. angular requesting resource server via url, , expects html fragment. if angular requesting rails, use rails functionality serve html fragment (ie template). write angular templates rails partial using erb or haml, rails serve html requester. as side note, gets complicated separate concerns doing approach. keep clear in mind rails needs application server, , rails needs application service. application server needs serve angular application (i.e. js , html managed angular on client side). application service needs serve json consumed angular.

Updating android app on play store -

i developed android app. earlier didn't have database. have added database , uploaded .apk on play store of updated version. in further updates, updating database. so, want ask have upload whole .apk did before or there other way update? also, if upload .apk whole database in it, when update app play store, database gets updated or whole app? ofcourse change app version before uploading on play store. want know if in update database changes, whole app downloaded in update or database part? well have upload whole app , should consider changing version of app androidmanifest.xml

winapi - Control start up manager -

i know there anyway identify app executed manually or in window start up..i explain why need application made start application creates system tray icon.whenever user launch app creates system tray , shows dialog box..but in start should not show dialog box. add parameter when run startup, /startup , check @ runtime.

android - Add dashed-line border for PdfPcell in PdfPtable using itext? -

how add dashed-line border pdfpcell in pdfptable using itext in android? set border of cell no_border , define pdfpcellevent instead. draw border in event, using line dash pattern. for cell events, see http://itextpdf.com/themes/keyword.php?id=201 for dashed lines , drawing rectangles, see pathconstructionandpainting , graphicsstateoperators .

jquery - Show a Modal Window on Form Submit and Submit form While Modal "Accept" Button is clicked? -

i have form validations in place, when submit form have shown bootstrap modal window, know modal window has 2 buttons accept , cancel, on click of accept button want form submit , on cancel close modal. var errormessages = []; $("#f").submit(function(event){ $("input,select,textarea").not("[type=submit]").each(function (i, el) { errormessages = errormessages.concat( $(this).triggerhandler("validation.validation") ); }); if(errormessages.length==0){ $('#mymodal').modal("show"); $("#agreesubmit").on('click',function(){ $("#mymodal").modal("hide"); return true; }); } event.preventdefault(); }); now stuck @ click of #agreesubmit button when click it, want form submit , not sure here. does help? need "flag" agreement made, , submit form. i've shown d

if statement - Integer comparison in Bash using if-else -

i have variable called choice . now, try use if compare entered value: read $choice if [ "$choice" == 2 ];then #do elif [ "$choice" == 1 ];then #do else else echo "invalid choice!!" fi the output goes directly invalid choice if enter either 1 or 2. tried put quotes around 1 , 2 inside if statement. still didn't work. using -eq gives me error "unary operator expected".what doing wrong here? your read line incorrect. change to: read choice i.e. use name of variable want set, not value. -eq correct test compare integers. see man test descriptions (or man bash ). an alternative using arithmetic evaluation instead (but still need correct read statement): read choice if (( $choice == 2 )) ; echo 2 elif (( $choice == 1 )) ; echo 1 else echo "invalid choice!!" fi

c# - How to delete AppData\Local\Geckofx\ when closing my browser? -

i'm working on gecko based web browser , i'd delete appdata\local\geckofx\ on exit. i'm using code: protected override void onformclosing(formclosingeventargs e) { try { var dir = new directoryinfo(@"c:\users\admin\appdata\local\geckofx\"); dir.attributes = dir.attributes & ~fileattributes.readonly; dir.delete(true); } catch { } } of course delete if user has name "admin". there way make work usernames? plus i've noticed won't delete in folder, there way force delete or isn't recommended? to delete files , folders in folder ; use code : foreach (fileinfo file in thedirectory.getfiles()) { file.delete(); } foreach (directoryinfo dir in thedirectory.getdirectories()) { dir.delete(true); } on stackoverflow thread found code delete read-only files : private static void deletefilesysteminfo(filesysteminfo fsi) { fsi.attribut

css - Anchor styling having issues, don't know why -

i have styling done follows /*------------this css internal css in html page-------------*/ <style> .rating_star { background-image: url('<?php echo base_url();?>assets/front_assets/images/star_hv.gif'); } .rating_star hover { background-image: url('<?php echo base_url();?>assets/front_assets/images/star.gif'); } </style> and here html part: <a href="javascript:void(0);" onclick=" var i='<?php echo base_url();?>assets/front_assets/images/loading.gif'; var load = document.createelement('img'); load.setattribute('src', i); $('#rate').html(load); $.post('<?php echo base_url();?>rating/rate' {'star':1,'item_slug':$('#item_slug').val()}, function(data){$('#rate').html(data););" class="rating_star">&nbsp; </a> the problem

html - How does grooveshark.com detect mobile users? -

when visit http://grooveshark.com/ smartphone, you're redirected http://html5.grooveshark.com/ . wondering if knows how this. can tell? requests sent browser website contain user agent string in header. see http://www.useragentstring.com/ this gets compared maintained list of known mobile devices.

java - Android dialog box and Async Tasks -

i trying make progress dialog pop while things loading. have figured out how make dialog boxes appear , disappear , can change whats in them have multiple async tasks , want dialog appear when first async task starts , disappear when last async tasks finishes. is there way dialogs know when async tasks complete given activity? having problems on how approach issue. help! here exact sample code used acheive same functionality. public class loginactivity extends activity { public static string tag = "login_activity: "; private edittext usernameedittext; private edittext passwordedittext; private progressdialog progress_dialog; private int taskcount = 0; private void updatetaskcount(int value) { taskcount += value; if(progress_dialog != null && taskcount == 0) { progress_dialog.dismiss(); } } @override protected void oncreate(bundle savedinstancestate) {

Print HTML & CSS via PHP -

i have user registration , login form has various error/success messages. trying put error box html code around each error message having bit of difficulty. the html error box is: <div class="alert alert-info alert-login"> *error message here* <div> my php looks this: $msg = 'login failed'; i have tried following: $msg = '<div class=\"alert alert-info alert-login\">login failed<br></div>'; however did not work, able shed light why , how able fix this? message showing div styling not. cheers! since you're using single quotes encapsulate string, don't need escape double ones, use: $msg = '<div class="alert alert-info alert-login">login failed<br></div>'; more strings , single quotes: http://www.php.net/manual/en/language.types.string.php#language.types.string.syntax.single

eclipse - Android application crash when run after installation -

i developing native android application, using third party api well. problem is, when connect mobile (s3) machine , run application directly on mobile works fine. when copied apk android mobile, installed app , run. on 1 of api call crashes saying "unfortunately appname stopped working". i not find way around find out issue , thing cause of application crash. anyone please suggest how find out problem or can possible cuse. developing in eclipse. why don't set 5 minute quick bugsense library , free account , check exception get? http://www.bugsense.com/

Can be used push models in asp.net using c# -

i have show notification or alert on asp.net page based on database server data insertion, want know if possible task push models? you can use signalr send notifications web server clients: http://signalr.net/ . to send notifications sql server web server, can use sqldependency , sqlcachedependency classes. from guidelines, http://msdn.microsoft.com/en-us/library/9dz445ks(v=vs.110).aspx , sqldependency.start(myconnectionstring); using (sqlconnection connection = new sqlconnection(myconnectionstring)) { using (sqlcommand command = new sqlcommand("select ... mytable", connection)) { sqlcachedependency dependency = new sqlcachedependency(command); // refresh cache after number of minutes // listed below if change not occur. // value stored in configuration file. int numberofminutes = 3; datetime expires = datetime.now.addminutes(numberofminutes); response.cache.setexpires(expires); res

ios - Group animation on multiple objects -

i'm trying animate many bubbles coming out of machine. i'm using basic animation scale bubbles small bubble large 1 , keyframe animation send bubble in curve across screen. these combined group animation. i have read through can try work, have following 2 problems. i can't scale animation work keyframe animation when try animate each bubble. the animation happens them @ same time. i'd see them animated 1 after other, animate together. here animation code have. -(void)emitbubbles:(uibutton*)bubblename :(cgrect)rectpassed { bubblename.hidden = no; // set position , size of each bubble @ head of bubble machine , size (0,0) cgpoint point = (rectpassed.origin); cgrect buttonframe; buttonframe = bubblename.bounds; buttonframe.size = cgsizemake(0, 0); bubblename.bounds = buttonframe; cgrect oldbuttonbounds = bubblename.bounds; cgrect newbuttonbounds = oldbuttonbounds; newbuttonbounds.size = rectpassed.size; cgfloat animationduration = 0.8f; // set scaling cab

java - How to handle arbitrary user supplied types in my library? -

i'm writing library able handle hexagon grids. the user has access hexagongridbuilder object can set width, height , lot of other parameters grid , build() method returns hexagongrid object. hexagongrid has various methods hexagon (for example grid coordinate, or pixel coordinate). my problem want allow user put arbitrary satellite data in each hexagon object on hexagongrid . best practice so? i can provide generic methods allow user pass satellite data hexagon : private object satellitedata; public <t> void setsatellitedata(t satellitedata) { this.satellitedata = satellitedata; } @suppresswarnings("unchecked") public <t> t getsatellitedata() { return (t) satellitedata; } this flawed since involves casting objects without being sure type is. i can modify hexagongridbuilder user can pass class object satellite data can validate whether supplied right type or not: public <t> void setsatellitedata(t satellitedata) {

ZURB Foundation: CDN foundation.min.js with fallback to local -

i want load cdn version of foundation.min.js local fallback. question is: how can detect if foundation.js loaded? i saw done done jquery, modernizr, bootstrap ... can't find code foundation. should except part " window.foundation ": <!-- jsdelivr cdn --> <script src="//cdn.jsdelivr.net/foundation/4.3.1/js/foundation.min.js"></script> <!-- fallback local --> <script>window.foundation || document.write('<script src="/js/vendor/foundation.min.js"><\/script>')</script> ok, turned out original code correct. foundation actual javascript object , had typo somewhere else. so, sum ... can load foundation.min.js cdn local fallback this: <!-- jsdelivr cdn --> <script src="//cdn.jsdelivr.net/foundation/4.3.1/js/foundation.min.js"></script> <!-- fallback local --> <script>window.foundation || document.write('<script src="/js/vendor/foundati

what is the best way to check in C# .NET if a directory has access to list files or a unauthorized access exception would rise -

how check in best way in .net 2.0 c# if have access specified directory listing top directory files e.g. system directory or system volume information folder etc. code looks this, think not best way check since produces exception each time handled check function , returning based on result. i use function doesn't throw error check if in specified directory access list files or maybe code can improved or optimized. might have check through thousand directories if exists access or not. raising thousand exceptions might cause problem, don't know. //here code using system.io; private void button1_click(object sender, eventargs e) { messagebox.show(directorycanlistfiles("c:\\windows\\prefetch").tostring()); } public static bool directorycanlistfiles(string directorypath) { try { directory.getfiles(directorypath, "*", searchoption.topdirectoryonly); } catch { return false; } return true; } the best way check per

How can I know if a table is already arranged in ascending order in MySQL? -

example, have table , want know if pre-arranged alphabetically descending or ascending, there built-in function can this? letters | numbers | a | 1 | b | 2 | letters | numbers | b | 2 | | 1 | thanks. data in table not arranged in order . you have explicitly specify order when selecting data. if not specify order when selecting data returned order neither predictable nor reliable.

css3 - Native-like momentum-scrolling on BODY in iOS webapp -

according article http://johanbrook.com/browsers/native-momentum-scrolling-ios-5/ 1 should able enable native-like momentum-scrolling this: body{ -webkit-overflow-scrolling: touch; } however, doesn't change in webapp. scrolls same or without property. expected have longer momentum native apps do. i tested on scrollable div, works - don't want add unnecessary markup this. any tips? further info ok, "kind-of" works this: html, body { height:100%; overflow: scroll; -webkit-overflow-scrolling: touch; position:relative; } however, position:fixed inside body-tag moves while scrolling , re-attaches it's correct position when scrolling stops. there can fix this? anyone having input on this? fiddle: http://jsfiddle.net/nmxeg/1/ use div set height, , perform scroll touchscroll on div. header , footer can remain fixed divs @ same level in dom. <div id="fixedheader"></div>

put the find command in a batch file -

the following command works fine in cmd window. lists directories contains word "note" not "notes". dir c:\myfiles\mydirectories /s /b /ad |find "note" | find "notes" /v when put command in batch file, cmd complains invalid switch -v . dir c:\myfiles\mydirectories /s /b /ad ^|find "note" ^|find "notes" /v what did wrong? thanks. this on windows 7. are you: 1) escaping pipes when put in batch file command ? if yes, don't escape pipes. dir c:\myfiles\mydirectories /s /b /ad |find "note" |find "notes" /v 2) having search invokes within sub-shell ? if yes, retain escape characters on pipes. mean like: for /f "delims=" %%a in ('dir c:\myfiles\mydirectories /s /b /ad ^|find "note" ^|find "notes" /v') echo 3) having command saved in batch file invoked in sub-shell ? if yes, discard escape characters. mean: for /f "delims=" %%a i

python - Subprocess.check_output doesn't work -

when use check_output within subprocess module have output error python shell: attributeerror: 'module' object has no attribute 'check_output' the code: target = raw_input("ip: ") port = subprocess.check_output(["python", "portscanner.py", target ]) i use python 2.7. solution! check_output() method defined in python2.7 onwards, said "martijn pieters" check in subprocess.py line no: 515 def check_output(*popenargs, **kwargs): you may either using old python version or might have messed python interpreter. try using dir(module[.class]) to find available methods or classes in module , proceed.

How to print a drive document with Google scripts -

an example of print 10 copies of pdf lives in google drive using script. learned today site's gadgets , may how implement script , yesterday enabled cloud printing our printers. i found similar question posted 2012: google app script print button apparently when question asked gas , cloud printing didn't work? or wasn't supported or wasn't available... i'm not sure. is possible? i apologize since new me , don't know google lingo enough yet. thank you! andy i don't think can want directly in google app script might useful: https://developers.google.com/cloud-print/docs/gadget

ember.js - Accessing Ember object instances in debugger -

Image
in debugger it's easy enough @ class definitions of objects i've created typing in app.classname.prototype . ok not hugely interesting still when you're first feeling around in "ember dark". instances though? that's want access to. if app has moved activitiesbydateroute , instantiated activitiesbydatecontroller there must instance of activitiesbydatecontroller container stored in? thought maybe ember debugger (aka, ember-extension) might me figure out. think should i'm not getting it. following indicate me? it appears instance name ember461 how manipulate in debugger? i've tried app.ember461 ... no go. i've tried app.activitiesbydatecontroller.ember461 ... no go. anyway, gist of question. please help, i'm couple objects short of instance. here of easiest way manipulate ember model. just output 1 of model's properties onto page {{ somevalue }} bind value input box {{ input value=somevalue }} log value o

ClojureScript and size for Mobile app -

i have generall concern. wrote simple viewpager in html/css/javascript allows me swipe between "pages" using viewpager in android and/or iphone. required javascript less 1kb. when converted clojurescript, resulting code optimizations , lack of pretty printing, ended @ around 62kb. what i'm concerned with, clojurescript big , more regular javascript, full fledged mobile application, slow. can put mind @ ease? have experience this? there's quite bit of clojure's data structures , core library functions have compiled js, of 60kb. wouldn't worry javascript size since in mobile apps other assets (i.e., images) dominate size. speed, usual rules apply: careful dom manipulations , layout/repaint. for it's worth, the weathertron ios application written clojurescript + angular.js , performs fine.

javascript - Chrome Extensions: How does A Browser Action popup communicate with the active tab? -

i want script running on browser action popup information current active tab when invoked. it's not clear me how communicate between two. need content script running on active tab , chrome.tabs.sendmessage() requesting info it? permissions should ask for? yes, communication between content-script , other scripts (background, browseraction, pageaction) goes via messages. so, on each side have kind of code: chrome.runtime.onconnect.addlistener(function(port) { port.onmessage.addlistener(function(request) { // process request // reply port.postmessage(data) if needed }; };

php - Order by custom field (numeric) in WP_Query -

i using following query posts post_type 'portfolio'. $args = array( 'posts_per_page' => -1, 'offset'=> 0, 'post_type' => 'portfolio' ); $all_posts = new wp_query($args); where $args is: $args = array( 'posts_per_page' => -1, 'offset'=> 0, 'post_type' => 'portfolio', 'orderby' => 'up_count', //up_count numeric field posts table 'order' => desc ); this should sort results up_count. that's not case. codex wp_query doesn't state sorting custom field (or may missing something?). this query when debugging wp_query request. select ap_posts.* ap_posts 1=1 , ap_posts.post_type = 'portfolio' , (ap_posts.post_status = 'publish' or ap_posts.post_status = 'private') order ap_posts.post_date desc

ruby - How to get the number of unread tweets of a user using twitter gem in rails app -

im using twitter gem retrieve tweets. how unread tweets since last logged in ? def twitter @twitter = twitter.user_timeline('pallavi_shastry', :count => 10) end twitter api doesn't have such option user_timeline . but, since have store last login time anyway, can store last tweet id read , tweets ids higher that. def twitter(username, last_tweet_id = nil) # display latest 10 tweets if # have never read user's timeline before opts = last_tweet_id ? { :since_id => last_tweet_id } : { :count => 10 } twitter.user_timeline(username, opts) end then can use method way: # tweets newer 365677293978398720 @twitter = twitter('pallavi_shastry', 365677293978398720) # 10 latest tweets @twitter = twitter('pallavi_shastry')

css - How to position a block of text on the same line -

Image
a following html markup creates qa section in site. want way - sentence in q section should positioned on same line "q" symbol; sentences in section should moved right , each sentence should start new line. this: desired result http://i44.tinypic.com/i22d5j.png but looks way: actual result http://i43.tinypic.com/2afkdpj.png <html> <head> <style type="text/css"> .qa b { font-size: 50px; } .qa .answer_box { margin-left: 90px; display: inline; } .qa p { font-size: 25px; } </style> </head> <div class="qa"> <div class="question"> <b>q</b> <p> believe in seo? </p> </div> <div class="answer"> <b>a</b> &l

python - Django Form Wizard with Conditional Questions -

in django application, have form wizard few form classes. have ability have conditional questions. meaning if user selects yes question, question within form become required , javascript make question visible. found example of how online, doesn't work. suggestions on how can create functionality? class questionform(forms.form): cool_list = ( ('cool','cool'), ('really cool','really cool'), ) yes, no = 'yes','no' yes_no = ( (yes,'yes'), (no,'no'), ) are_you_cool = forms.choicefield(choices=yes_no,label='are cool?') how_cool = forms.multiplechoicefield(required=false,widget=checkboxselectmultiple, choices=cool_list,label='how cool you?') def __init__(self, data=none, *args, **kwargs): super(questionform, self).__init__(data, *args, **kwargs) if data , data.get('are_you_cool', none) == self.yes: self.fields['how_cool'].required = true

iframe - How do I navigate through a playlist using the Youtube Javascript API? -

once i've created playlist using loadplaylist method array of video urls, want able navigate through playlist. the function described in documention playvideoat(int) seems able this, after calling single time, lose reference entire playlist. meaning call playvideoat(2) , navigate third video in playlist i've created, cannot use function again, , unable navigate further through list. are there workarounds or suggested fixes use? here's issue filed problem -- seem introduced bug. https://code.google.com/p/gdata-issues/issues/detail?id=5018&q=playvideoat&colspec=api%20id%20type%20status%20priority%20stars%20summary if you're in need of temporary workaround, in lieu of videoplayat() call 'cueplaylist() again (or loadplaylist() have autoplay) , pass index, this: player.cueplaylist({'listtype':'playlist','list':'[playlist id]','index':[video index number]}); you can test in fiddle: http://jsfi

Uploading photo to server using java apache -

i have problem using apache in java upload photo server using post method . question : how can upload photo server via form ? <form method="post" action="http://www.blahblah.com/profile/profile/uploadpic/username/" enctype="multipart/form-data"> <input type="file" name="photo" id="photo" value="" /> <input type="hidden" name="secfrdcodedvar" id="secfrdcodedvar" value="8f0f54c112765db73c3d3b11f5fb23007b86a619" /> <input type="submit" name="btnsubmit" id="btnsubmit" value="?????" class="btn" /> <input type="hidden" name="frm-id" value="137616551552069e8b0b459" id="frm-id" /> </form>

node.js - JavaScript documentation rules? Need a way to specify the expected structure of an input object -

i find myself using lot of functions similar following in nodejs: socket.on('view:create', function (data) { //data = { structure of data object here } .... }) i adding comment remember data object. is there way specify structure of object receiving input, when inside function write data.key recognises key valid? i use commenting style advised google closure . it similar style of different languages, helps autocompletion in modern ides, , jsdoc generating documentation easy

d - transform each element of tuple; get that tuple -

i have tuple in d. want apply element-wise operation on tuple, , transformed tuple passing function accepts variadic template arguments. execution path of transform defined @ compile time, actual value not. the purpose of similar template mechanism used in c++'s bind construct, determining use placeholders/passed arguments , use stored arguments @ compile time. how accomplish this? this first time in d i've ever missed feature in c++11's template system: pack/unpack operator - please make me not feel bad :-( edit: ended using mixin s, because apparently generic programming solution want can solved using them. may answer them if no 1 comes more elegant taking d's ridiculously powerful jackhammer-of-a-generic-programming-tool it. the element of tuple can template alias parameter can be. however, run-time expressions cannot alias parameters - evaluated @ compile time. thus, not possible transform tuple using transformation runs @ compile-time (barring

html - Extra space is created when a button is placed directly below a text area -

Image
when placing button directly below text area, space created in both chrome , firefox (i haven't tested other browsers). here's fiddle replicates issue. here's code: html <div> <textarea></textarea> <button></button> </div> css div { width: 100px; height: 125px; } textarea { width: 100px; height: 100px; padding: 0; margin: 0; border: none; outline: none; background: red; resize: none; } button { width: 100px; height: 25px; border: none; background: blue; margin: 0; padding; } change display property on textarea block , should line without gap in-between. in general when have html elements not lining-up properly, play display property it's culprit. demo: http://jsfiddle.net/8kzpf/

css - 2 Columns and 2 playlists issue -

having frustrating issue here, i'm using 2 columns , audio playlist plugin. long story short, need audio players appear side-by-side in columns. cannot figure out :/ here url: http://www.airmanstudios.com/tests/ if have manually re-build columns, best approach? tried using different column css/scripts no avail. #stacks_in_139_page8 .jwresp_col{ width:100% !important; } #stacks_in_142_page8{ width:50%; float:left; } seemed job me. that's messy markup though , slimmed down if wanted modify html. put above in css though.

c - Main is usually a function? -

i question because doing basic program, , have warning when compilate it, says "warning: 'main' function"" , make error of syntaxis in same line. program palindrome, in spanish "capicua". help. program in c. int t=10; int cargarvector(char vec[t]); int escapicua(char vec[t]) int main() { //here error!! char vec[t]; cargarvector(vec); escapicua(vec); return 0; } int cargarvector(int vec[t]) { int i=0; printf("ingrese letra"); aux=getche(); while(aux!='.'&&i<t) { while(aux<'a'||aux>'z') { printf("error, ingrese letra del abcdario") aux=getche(); } vec[i]=aux; i++; printf("ingrese letra"); aux=getche(); } r=i; return 0; } int escapicua(char vec[t]) { int i,c; for(i=0;i<(t/2),i++) { if(vec[i]!=vec[(t-1)]

c# - How to fix parsing int from string? -

i trying percent @ end of string (i.e. "50013 / 247050 [20%]" want 20 @ end.) reason keeps returning -1. problem code? public int percent(string s) { string outp = "-1"; if(s != null) outp = s; try { outp = s.substring(s.indexof("["), s.indexof("%")); } catch (argumentoutofrangeexception e) { } int outt = int.parse(outp); return outt; } the second parameter isn't index count . should this: // because, don't want [, you'll add 1 index, int index1 = s.indexof("[") + 1; int index2 = s.indexof("%"); string outp = s.substring(index1, index2 - index1);

xpath - trying to get all p tag text between two h2 tags -

<h2><span>title1</span></h2> <p>text want</p> <p>text want</p> <p>text want</p> <p>text want</p> <h2>second title want stop collecting p tags after</h2> i can p tags identifying text within h2, preceeding-sibling::p grabs p tags end of dom. have tried use "and" selector declare start , end returns null. must missing here i've been stuck on quite while. cannot predict how many p tags need index number on p element not going me in case. here xpath used of following p tags after h2. problem grabs p tags end of dom. //span[contains(text(), "title1")]/ancestor::h2/following-sibling::p so want p tags between 2 specific h2 tags. xpath query sounds. //p[ preceding-sibling::h2[span='title1'] , following-sibling::h2[.='second title want stop collecting p tags after'] ] the query simplified selecting p first preceding h2 element starti