Posts

Showing posts from April, 2012

java - This application may be doing too much work in its main thread -

i using following piece of code add item mysql database.when button clicked,it should begin async task uploads data server.but when run error message "this application may doing work in main thread" logcat.how can fix code problem,thanks. public class newproductactivity extends activity { // progress dialog private progressdialog pdialog; jsonparser jsonparser = new jsonparser(); edittext inputname; edittext inputprice; edittext inputdesc; // url create new product private static string url_create_product = "http://localhost/android_connect/create_product.php"; // json node names private static final string tag_success = "success"; @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.add_product); // edit text inputname = (edittext) findviewbyid(r.id.inputname); inputprice = (edittext) findviewbyid(r.id.inputprice); inputdesc = (edittext) findviewbyid(r.i

java - TextArea without scrollbars (awt) -

i'm using java.awt.textfield , annoys me vertical scrollbar on right. wondered if can disable it? found constant "scrollbars_none", guess should possible. use following constructor textarea : public textarea(string text, int rows, int columns, int scrollbars) this way can use scrollbars_none constant in last value in constructor.

ORACLE vs SQL Server from text data type point of view -

these days facing problem related text datatype differences between oracle , sql server. more comparing concatenation of chars oracle varchar column sql server. here condition: rtrim(num1) || ' ' || rtrim(num2) <> d2.num and launched oracle. where num1 & num2 varchar2 data type oracle while num varchar in sql server. i want condition false but, unfortunately true. normally, both variables have same value = '7 a' not recognized being same. i trying manually hardcoded comparison, meaning '7 a' <> d2.num false, because oracle considers values same when comparing rtrim(num1) || ' ' || rtrim(num2) '7 a', oracle consider them different. does have idea why oracle consider rtrim(num1) || ' ' || rtrim(num2) <> '7 a' true?

css - QuickSand jQuery - want to modifications some options -

i'm using quicksand right now, cant things. want create small gallery 3 categories, example: all, bus, cars. if quicksand via default setting, it's problem, cos when click categorie else image hidden. want move focus image @ top of gallery, , else bottom ( not hiding ). i have sample right there: sample . want on site sort by: name, size. categories. trying that, no result :( maybe me. best cheers! i recommend using jquery isotope because sorting function seems little more advanced you're using. quicksand seems offer filtering pretty well, sorting function seems lacking bit. example getsortdata: { symbol: function ($elem) { return $elem.attr('data-symbol'); }, category: function ($elem) { return $elem.attr('data-category'); }, number: function ($elem) { return parseint($elem.find('.number').text(), 10); }, weight: function ($elem) {

php - MYSQL_FREE_RESULT How to properly use? -

i have large queries on pages(about 30 fields on row). heard mysql_free_result improve memory performance. wanna ask you, how can use mysql_free_result. i did on class: // buffered query private function query($querystr) { $this->querycount++; $starttime = microtime(); $this->queryres = mysql_query($querystr, $this->conn); $this->querytime = $this->querytime + (microtime() - $starttime); if ($this->queryres) { $this->query_log($querystr,$this->querytime); } else { $this->error("sql error: " . $querystr); } return $this->queryres; $this->free_result($this->queryres); } // free result public function free_result($result) { mysql_free_result($result); } is using true? if not true, how can use properly? mysql_free_result() needs called if concerned how memory bein

cordova - PhoneGap iOS oAuth redirect failing (NSURLErrorDomain error -999.) -

meteorjs: https://github.com/zeroasterisk/presenteract phonegap: https://github.com/zeroasterisk/presenteract-phonegap-ios i running meteorjs application inside phonegap 2.7 on ios. the meteorjs application loaded via external url, setup in config.xml <content src="http://presenteract.meteor.com" /> i have no problems oauth within browser the access config setup full wildcard <access origin="*" /> the application works well, identical browser version of it.... but when attempt oauth within phonegap, end following error: failed load webpage error: operation couldn’t completed. (nsurlerrordomain error -999.) (note: oauth attempts google, facebook, , twitter same. loads external site, login proceeds normal, , upon redirect application's main url) i have looked through other stackoverflow reports , done googeling... useful 1 found is: facebook dialog failed error: operation couldn’t completed. (nsurlerrordomain error -999.)

contravariance - Real World Use of the keyword In in .NET Framework -

i have accidentally come across keyword "in". read article on msdn - in (generic modifier) (c# reference) still don't quite understand why useful. can provide real world example show reason why keyword "in" useful? thanks.

Cleaning Maven m2e .cache directory -

my maven installation (windows 7 64-bit) has .cache directory 3.5gb! contains m2e directory. (i'm running eclipse 4.3m7 m2e.) surely things inside aren't needed @ present, , don't know stuff is! find no maven documentation of .cache directory online. so .m2/repository/.cache , .m2/repository/.cache/m2e directories? why have stuff years ago? how dispose of stuff that's not needed anymore? in contrast other answers, make sure keep .m2/*.xml (your settings) , .m2/repository (not strictly necessary keep, maven have download half internet again). now, .cache folder: if open eclipse, m2eclipse run job akin "downloading repository indexes". these indexes allow find artifact using m2e's "add dependency" wizard if know (part of) artifact id. needs put downloaded index files somewhere, , according http://dev.eclipse.org/mhonarc/lists/m2e-users/msg02486.html .cache folder go: also note m2e keeps @ least 3 copies of each repos

php - CodeIgniter: How to match current_url against views url (to construct a nav) -

in order apply active class current item in navigation menu. need check if link equal url i trying this: <ul class="nav"> <li class="<?php if(uri_string(current_url()) == base_url() || uri_string(current_url()) == '') echo 'active'; ?>"> <a href="<?php echo base_url() ?>">home</a> </li> <li class="<?php if(uri_string(current_url()) == base_url('news/create/')) echo 'active'; ?>"> <a href="<?php echo base_url('news/create/') ?>">+ new</a> </li> </ul> wich seems work fine home but in news/create won't ever equal.... it compares news/create ( uri_string(current_url() ) /news/create ( base_url('news/create') ) so.. what's the way go issue? as said, clean , simple solution: if($this->uri->uri_string() == 'news/create'){ ...

Java: detect language RTL in a Spring web application without using AWT component? -

i doing spring web application. i have access locale , need whether rtl (right-to-left). i found post: is there way detect rtl language in java? it appears can solve problem. however, solution there: componentorientation.getorientation(new locale(system.getproperty("user.language"))).islefttoright(); uses java awt's componenent (componentorientation). i wondering whether can rtl info locale without using awt components. thanks help! best. you check if locale's .getlanguage() 1 of right-to-left languages (hebrew, arabic, etc). how function implemented in awt. public static componentorientation getorientation(locale locale) { // more flexible implementation consult resourcebundle // find appropriate orientation. until pluggable locales // introduced however, flexiblity isn't needed. // choose efficiency instead. string lang = locale.getlanguage(); if( "iw".equals(lang) ||

html5 - Falling back on Android resource values for attribute defaults in a microformat -

i'm designing microformat consumed android client, extract elements containing menu commands , other metadata before pushing remaining content webview. i embed each menu command json object, like: <span class="menu-command">{"type": "share"}</span> the handler logic implemented natively client, , display properties (title, icon) pulled resource xml. now i'm considering switching more semantic html5 tags, possibly like: <menu> <menuitem label="share" data-type="share"> <!-- other actions --> </menu> with data-* attributes other fields required json spec (depending on type of action). we'd still use android app's resource file default values command's label , icon, i'm not sure of standards-friendly way so; label attribute required, , logic replace value isn't letter of standard, @ least. is there standards-compliant, or @ least conventional way client

archive created by PHP ZipArchive class opened with WinRar but not with WinZip -

i using ziparchive class zip files residing on server. able extract downloaded zip winrar not winzip. , if download created zip directly server via filezilla able extract winzip. please have @ following script using:- $zip = new ziparchive(); //create file , throw error if unsuccessful if ($zip->open($archive_file_name, ziparchive::create )!==true) { exit("cannot open <$archive_file_name>\n"); } //add each files of $file_name array archive foreach($file_names $files) { $zip->addfile($file_path.$files,$files); } $zip->close(); //get size of archive $zipped_size = filesize($archive_file_name); //set required headers header("content-description: file transfer"); //header("content-type: application/zip"); header("content-type: application/octet-stream"); header("cache-control: public", false); header("pragma: public&

variables - Displaying products on PDT.php page -

in sandbox mode products bought displayed no problem. when testing im sent pdt.php url ending item_name=54 example. when in live mode same pdt.php url ending item_name= without number , of course there problem. why? both sandbox button (buy now) , live button (add cart) have same id=54. before payment done overview of products in cart , here differs bit. in sandbox mode product listed objektsnummer:54 ss here: http://snag.gy/0smi6.jpg in live mode product listed artikelnummer54 ss here: http://snag.gy/zsih4.jpg so article number , object number in swedish. why this? live using other variable item_name? cannot find other id-holder item_name , not working on live side. any apprciated, stuk @ moment since "should" work. it issue language set on 1 of accounts, or language encoding have set. check these settings on both accounts , make sure same.

OpenCV Python: Convert RGB to YCrCb -

i can't seem convert rgb ycrcb in new opencv python api (cv2). when run code: img = cv2.imread('img1.jpg') imgycc = cv2.cvtcolor(img, cv2.color_rgb2ycrcb) , error: attributeerror: 'module' object has no attribute 'color_rgb2ycrcb' what doing wrong? the attribute name color_rgb2ycr_cb rgb ordering. bear in mind opencv natively uses bgr color ordering, not rgb, in case attribute color_bgr2ycr_cb . so, may want modify code: img = cv2.imread('img1.jpg') imgycc = cv2.cvtcolor(img, cv2.color_bgr2ycr_cb)

html - How do i toggle between classes of an element using javascript? -

this question has answer here: change element's class javascript 27 answers i trying make script sets class label of checkbox when click once , when click again reverts first class. this code have: <label for="img1"> <img class="img1" src="images/testimg.jpg" onclick="javascript:test()" id="t1" /> </label> <input type="checkbox" class="chk " id="img1" name="img1" value="1" /> i want test function assign class img2 when called , when call again assign class img1. javascript function toggleclass(element, origin, target) { var newclass = element.classname.split(" "); (var = 0, < newclass.length; i++) { if (origin.localecompare(newclass[i]) == 0) { newclass[i] = target;

asp.net - SQL Server Stored Procedure Creating Duplicates -

i running website using sql server 2008 , asp.net 4.0. trying trace issue down stored procedure creating duplicate entries same date. thought may couple post issue duplicates recording same date down milliseconds. 1 of duplicates @ :'2013-04-26 15:48:28.323' of data same except id. @check_date input stored procedure gives particular date looking @ (entries maid daily) @formheaderid grabbed earlier in stored procedure, getting header id detail table 1 many relationship header. the @getdate() entry found duplicate entries, there entries exact getdate() values different rows. this doesn't occur each entry either, randomly occurring in application. select @formheaderid=stage2_checklist_header_id stage2_checklist_header environmental_forms_id=@envformid , checklist_monthyear=@inspected_month order start_date desc if @formheaderid = 0 begin insert stage2_checklist_header( environmental_forms_id ,start_date ,checklist_month

Combining Spring Security Tags and Struts2 Tags -

i'm using spring security manage login , sessions on struts2 application. retrieve logged user in jsp page i'm using sec tag lib importing following jsp. <%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags"%> so print logged user use <sec:authentication property="principal.username" /> . i'm iterating through java.util.list received through action called, iterate through this: <s:iterator value="#request.mylist" var="useremail"> value: <s:property value="#useremail"/> </s:iterator> i'm looking way test list item check if same logged user, can't manage retrieve sec inside <s:if> tag. does know how combine both? , <s:if test="%{<sec:authentication property="principal.username" /> == #useremail}"> how using information session: <s:if test="#session.spring_security_context.authe

performance - Which is more efficient in Erlang: match on two different lines, or match in tuple? -

which of these 2 more efficient in erlang? this: valuea = myrecord#my_record.value_a, valueb = myrecord#my_record.value_b. or this: {valuea, valueb} = {myrecord#my_record.value_a, myrecord#my_record.value_b}. ? i ask because latter brings me need multiple lines fit in 80 character line length limit keep, , tend prefer avoid doing stuff this: {valuea, valueb} = { myrecord#my_record.value_a , myrecord#my_record.value_b }. they generate same code! if want less code try using: #my_record{value_a=valuea,value_b=valueb} = myrecord which generates same code. generally, if can, use pattern matching. never worse, better. in case minimum amount of work necessary. in general write code clearest , looks best , worry these types of optimisation when know there speed problem code.

optimization - How to optimize time-stepping algorithm in python? -

Image
i have piece of code increments time-step so-called lorenz95 model (invented ed lorenz in 1995). it's implemented 40-variable model, , displays chaotic behaviour. have coded time-stepping algorithm follows: class lorenz: '''lorenz-95 equation''' global f, dt, size f = 8 dt = 0.01 size = 40 def __init__(self): self.x = [random.random() in range(size)] def euler(self): '''euler time stepping''' newvals = [0]*size in range(size-1): newvals[i] = self.x[i] + dt * (self.x[i-1] * (self.x[i+1] - self.x[i-2]) - self.x[i] + f) newvals[size-1] = self.x[size-1] + dt * (self.x[size-2] * (self.x[0] - self.x[size-3]) - self.x[size-1] + f) self.x = newvals this function euler not slow, unfortunately, code needs make large number of calls it. there way code time-stepping make run faster? many thanks. there @ least 2 kinds of possible optim

android - How can I detect accessibility gestures from within a custom view? -

i need make custom view detect , react jellybean's accessibility gestures (eg: scroll page, swipe focus). example appreciated. can't seem find definitive in docs. i able intercept accessibilityevents writing custom accessibilitydelegate (call view.setaccessibilitydelegate()): http://developer.android.com/reference/android/view/view.accessibilitydelegate.html unfortunately have not been able find way intercept swipe focus event tabs between view elements. think may able writing accessibilityservice , having pass information app, seems accessibility services designed used multiple apps, , have manually enabled in accessibility options user, , order in receive events depends on order in enabled.

css - How do I make a div transparent on a white body background? -

the background-color of body #ffffff. , have div need colored needs transparent or see through. possible using css3 or have use images achieve this? body { background-color: #ffffff; } .box { background-color: #999999; background-image: linear-gradient(to top, #999999 0%, #444444 100%) !important; opacity: 0.7; } update: if go here: http://pinesframework.org/pnotify/#demos-simple , demo transparent success can see how pop-up looks see through on white background. need without using image using one. updated: per comment below, question appears duplicate of css - opaque text on low opacity div? . you need change opacity of background instead of element: .box { rgba(255,0,0,0.6); } or, since using gradient, use this: ultimate css gradient generator it allow semi-transparent backgrounds gradient.

eclipse - Could not find class 'android.webkit.WebResourceResponse' when running HelloCordova on Android 2.2 -

i tried follow tutorial: http://docs.phonegap.com/en/2.7.0/guide_getting-started_android_index.md.html#getting%20started%20with%20android and following error: 05-08 15:35:59.845: e/dalvikvm(307): not find class 'android.webkit.webresourceresponse', referenced method org.apache.cordova.cordovawebviewclient.getwhitelistresponse here guy explains error: https://issues.apache.org/jira/browse/cb-3041 this known issue. because android 2.3 not have android.webkit.webresourceresponse, code considered dead android 2.3's dalvik. means whitelisting doesn't work on android 4.x, per cb-2099. i'm going keep open, lower priority, since know causes , it's easy "first bug" if want fix this. he tells fix easy, not explain how fix -.- brilliant! obviously 1 fix not run android 2.2 emulator because works android 4.2. but how working in android 2.2? i want build application compatible api level 8 , up. this because android 2.2 not have updated

c - Preprocessor directives define and ifdef do not work as I imagined? -

i have 3 files: main.c #include <stdio.h> #include <stdlib.h> #include "test.h" #define debug int main() { testfunction(); return 0; } test.h #ifndef test_h #define test_h #include <stdio.h> #include <stdlib.h> void testfunction(); #endif // test_h_included test.c #include "test.h" void testfunction(){ #ifdef debug printf("i'm inside testfunction\n"); #endif } the question: why program not print stuff in #ifdef debug block? if write #define debug in test.h or test.c fine. what's problem #define debug in main.c? thanks. preprocessor directives define , ifdef not work imagined? no, not quite. seem believe preprocessor directives traverse file boundaries, don't. the scope of #define d preprocessor macro single file it's defined in, or other files if other files #include file containing macro definition. perhaps imagine run compiler (and preprocessor) on each fi

sql - Added new field to table and to stored procedure, now procedure returns no results -

i added deleted column table , wanted add additional clause i'm not getting results anymore (it returned results before added deleted column) select tblequipment.*, tblusers.* tblequipment inner join tblusers on tblequipment.userid = tblusers.id (upper(tblusers.dept) = 'aspire' or upper(tblusers.dept) = 'development') , (assettype = 'workstation' or assettype = 'laptop') , (tblequipment.deleted != 1) order username thanks help if deleted null every record, condition should be: and (tblequipment.deleted != 1 or tblequipment.deleted null)

ios - Custom UITableViewCell, GetCell throws UnknownNSKeyException -

i have created custom uitableviewcontroller , cell , source in project. controller , cell created iphone uiviewcontroller template got partial class paired xib file. have same setup working table , have followed same process (i think) create 1 why have no idea why i'm getting error. this getcell in tableviewsource class public override uitableviewcell getcell (uitableview tv, nsindexpath path) { mycell ocell; nsarray oviews; // ocell = tv.dequeuereusablecell ("mycell") mycell; // if (ocell == null) { oviews = nsbundle.mainbundle.loadnib ("mycell", tv, null); ocell = runtime.getnsobject (oviews.valueat (0)) mycell; } // ocell.updatewithdata (mydatacollection[path.row]); // return ocell; } i exception on line tries load nib: objective-c exception thrown. name: nsunknownkeyexception reason: [ setvalue:forunidentifiedkey:]: class not key value coding-compliant key lbl_address. i&

Django how the urls are resolved? -

im reviewing sample django code , trying understand how urls resolved? list.html categories {% c in active_categories %} <a href="{{c.get_absolute_url}}">{{c.name}}</a><br /> {% endfor %} urls.py from django.conf.urls import * urlpatterns = patterns('ecomstore.catalog.views', (r'^$','index',{'template_name':'catalog/index.html'},'catalog_home'), (r'^category/(?p<category_slug>[-\w]+)/$','show_category',{'template_name':'catalog/category.html'},'catalog_category'), (r'^product/(?p<product_slug>[-\w]+)/$','show_product',{'template_name':'catalog/product.html'},'catalog_product'), ) the above html list categories without problem , called when enter following in browser..[http:127.0.0.1:8000] when hover on - href="{{p.get_absolute_url}} - url resolve

php - mysql update table ajax by class -

i'm trying update rows quantity using ajax class not id have looked on google hours trying work out find didnt seem work my code far is include('config.php'); $id=$_get[id]; $sql2="select * `orders` `id` = '".$id."'"; $result2 = mysql_query($sql2); $row2 = mysql_fetch_array($result2); $order=$_get[order]; $qty=$_get[qty]; $sql="select * `stock` `part` = '".$part."'"; $result = mysql_query($sql); $row1 = mysql_fetch_array($result); $lineprice=$qty * $row2[price]; $sqlins1 = "update `orders` set qty='$qty', lineprice='$lineprice' id = '".$id."'"; if (!mysql_query($sqlins1,$con)) { die('error: ' . mysql_error()); } $sql="select * `orders` `invoice` = '".$order."' order id desc"; $result = mysql_query($sql); echo" <table id='poitable' width='100%' border='1'> <tr&g

c++ - Can raw pointers be used instead of iterators with STL algorithms for containers with linear storage? -

i have custom vector container internally stores item linear array. last night, trying implement custom iterators class able use them stl algorithms. have had success can see in here: live example custom iterators while doing so, discovered can merely pass raw pointers stl algorithm , seem work fine. here's example without iterators: #include <cstddef> #include <iostream> #include <iterator> #include <algorithm> template<typename t> class my_array{ t* data_; std::size_t size_; public: my_array() : data_(null), size_(0) {} my_array(std::size_t size) : data_(new t[size]), size_(size) {} my_array(const my_array<t>& other){ size_ = other.size_; data_ = new t[size_]; (std::size_t = 0; i<size_; i++) data_[i] = other.data_[i]; } my_array(const t* first, const t* last){ size_ = last - first; data_ = new t[size_]; (std::size

mysql - SQL- Selecting the most similar product -

alright, have relation stores 2 keys, product id , attribute id. want figure out product similar given product. (attributes numbers makes example more confusing have been changed letters simplify visual representation.) prod_att product | attributes 1 | 1 | b 1 | c 2 | 2 | b 2 | d 3 | 3 | e 4 | initially seems simple, select attributes product has , count number of attributes per product shared. result of compared number of attributes product has , can see how similar 2 products are. works products large number of attributes relative compared products, issues arise when products have few attributes. example product 3 have tie every other product (as common). select product, count(attributes) prod_att attributes in (select attributes prod_att product = 1) group product ; any suggestions on how fix or improvements current query? thanks! *edit: product 4 return co

Enthought Canopy installer does not create ~/Enthought directory in Linux -

i'm using opensuse 12.3 64bit. installed canopy when released, , since have uninstalled deleting both ~/enthgout , ~/canopy . now trying install canopy again, installer works without problem not generate ~/enthgout directory anymore. tried delete cache folders did not work. the installer not generate ~/enthought directory. created during first startup. more info here: http://docs.enthought.com/canopy/configure/faq.html#where-are-all-of-the-python-packages-in-my-user-python-environment

c - Equivalent of md5 hashing in linux commands -

i have following code in c u_char buf[64] = "hahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahaha"; //make md5 hash on buffer md5_init(&ctx); md5_update(&ctx, buf, sizeof(buf)); md5_final(buf, &ctx); md5_init , md5_update , md5_final openssl library. the above code make md5 hash on buffer buf . i want make same thing linux command using md5sum $echo -n "hahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahaha" | md5sum but did not same result what equivalent of md5 hashing in linux commands? actually, md5sum equivalent. echo prints out new-line character. try echo -n hahaha.... | md5sum .

Grab file from chrome webRequest onBeforeRequest -

i trying fetch files want uploaded via post. unfortunately requestbody formdata giving me huge headaches accessing file. filename string.... have file contents blob or data-url... //in form on page <input type="file" name="files[]" multiple> //extension's background.js chrome.webrequest.onbeforerequest.addlistener( function(details) { console.log(details); n = "files[]"; var file = details.requestbody.formdata[n][0]; console.log(file ); // babygnutux-big.jpg console.log(typeof file); // string }, {urls: ["*://example.de/*"]}, ["blocking", "requestbody"]);

java - variableReplace showing a error -

Image
i have went onto github repository docx4j files , downloaded variablereplace. when copied file netbeans, got error on line 86 (cannont find symbol). here code: /* * copyright 2007-2008, plutext pty ltd. * * file part of docx4j. docx4j licensed under apache license, version 2.0 (the "license"); may not use file except in compliance license. may obtain copy of license @ http://www.apache.org/licenses/license-2.0 unless required applicable law or agreed in writing, software distributed under license distributed on "as is" basis, without warranties or conditions of kind, either express or implied. see license specific language governing permissions , limitations under license. */ import java.util.hashmap; import org.docx4j.xmlutils; import org.docx4j.jaxb.context; import org.docx4j.openpackaging.io.savetozipfile; import org.docx4j.openpackaging.packages.wordprocessingmlpackage; import org.docx4j.o

xcode - Code signing error with sample app / new Provisioning Profile not in 'Code Signing' list -

there code signing error issues on forum couldnt find answer specific situation. have 2 issues really. first issue: i'm getting "a valid provisioning profile matching application's identifier 'com.yourcompany.thissampleapp' not found" error. error running on device (iphone 4s) have valid provisioning profile - com.mycompany.*. since didnt work, created provisioning profile bundle identifier com.mycompany.thissampleapp. same error. second issue: noticed thing, newly created provisional profile not show in 'code signing' section...so cant pick it. but...i can see both provisional profiles listed in organizer window. i downloaded apple's reachability sample apple. same error. any ideas anyone? thanks! ps: i'm running xcode 4.6 when happens me, (and happens lot), restart xcode, computer. if sure have correct provisioning profile, , correct certificates in keychain, , have correct bundle identifier. also, go target -> b

android - get string from Strings.xml by a variable -

i want string strings.xml. know how this. problem else: have string variable changes every time, , every time changes, want @ strings.xml , check if string variable exists in strings.xml, text. for example: string title="sample title" \\ changes string city= "sample city" string s = getresources().getstring(r.string.title); in third line: title string, , there isn't "title" named string in strings.xml how can this? please me as far can tell, use public int getidentifier (string name, string deftype, string defpackage) . use discouraged, though. to use (i haven't done had once read method) need to: int identifier = getresources().getidentifier ("title","string","your.package.name.here"); if (identifier!=0){ s=getresources().getstring(identifier); } else{ s="";//or null or whatever }

Not sure how to set up my dns and heroku apps to do what I want -

heroku offers , eu servers , want users connect server closer them, if connects eu, redirect them eu server , same us. my idea have them connect main domain name, example.com connect server, check users coming from, , redirect them want them be, , while looking @ same domain "example.com". heroku wont let me add same domain twice, , don't know should configure dns. domain provider has nameserver section , i'm not sure add there. want request , server load go onto heroku page, , not onto default dns server redirects or loads heroku page inside frame. they way seems correct, connect example.com, heroku page , redirect inside frame or eu page... not sure if best way, , mentioned, i'm not sure how setup namespace , stuff connect directly heroku server instead of default domain server. could explain me need achieve want? it not possible run multi-region application on heroku , i'd caution against trying work way around limitation. areas cause use

google app engine - Need a pure python library for reading a group3 TIFF (fax image) -

i trying decode group3 tiff. tiff data 1bit group3 compressed. it's generated fax machine aka ccit t.4 - http://www.fileformat.info/mirror/egff/ch09_05.htm i can not pre-convert image different format. have tried pil error group3 not supported. see there patch pil allows utalize libtiff not solution me need work on google's appengine allows pure python libraries or small whitelist of pre-approved c libraries. since pil not have patch applied default not available me in appengine. i used use google's images service read tiff of few weeks ago stopped working , instead corrupts image after reading it. this looks promising lacks group3 decoder support: http://www.lfd.uci.edu/~gohlke/code/tifffile.py.html i have tried pylibtiff, , though claims support pure python mode, can't seem run pure python module without using libtiff c libs. if has pure python implementation of decoder grateful! need convert tiff data png can work with, in fact conversion png i

java - How to skip replacing entity references in XML with XML Simple Framework -

i have xml document © entity represented string. <url imageartist="" imagesupplier="&copy;salzburg.info " urldescription="skip line: vatican museums walking tour including sistine chapel, raphael&apos;s rooms , st peter&apos;s" urllink="http://www.dynamic.viator.com/graphicslib/3731/sitours/skip-the-line-vatican-museums-walking-tour-including-sistine-chapel-in-rome-115004.jpg" urltype="image"/> the persister throws exception when comes across "copy" reference , tries deference it: javax.xml.stream.xmlstreamexception: parseerror @ [row,col]:[1,42] message: entity "copy" referenced, not declared. @ com.sun.org.apache.xerces.internal.impl.xmlstreamreaderimpl.next(xmlstreamreaderimpl.java:598) @ com.sun.xml.internal.stream.xmleventreaderimpl.nextevent(xmleventreaderimpl.java:83) @ org.simpleframework.xml.stream.streamreader.read(streamreader.java:110) @ org.simpleframework.xm

Spring MVC 3 + Tiles 3 -

i'm hoping can point me in right direction here. keep getting 404 returned request spring controller. controller returns view name "showcardoverview". request makes controller without problem. cannot figure out why tiles cannot resolve view name tile definition. below config files: tile defs <tiles-definitions> <definition name="base" template="/jsp/layouts/flagship.jsp"> <put-attribute name="head" value="/jsp/assets/head.jsp" /> <put-attribute name="left" value="/jsp/assets/left.jsp" /> <put-attribute name="right" value="/jsp/assets/right.jsp" /> <put-attribute name="body" /> </definition> <definition name="showcardoverview" extends="base"> <put-attribute name="body" value="/jsp/showcard-overview.jsp" /> </definition> <

java - File Transport Protocol for Maven -

i use scp://server/path style urls in distributionmanagement config, taking long deploy small artifacts. i have made test using file://server/path style urls, works when run maven same machine repository is. is possible use file://server/path style urls deploy remote machine? the deploy mechanism of maven based on wagon provider. file provider states in documentation working local file system. guess need test others ( wagon provider ). maybe can try ftp if faster. hope helps little bit.

excel - Error Help: Adding to ranges using Application.Union -

i attempting loop through large list rows searching specific column values based on values in tab. had working 1 value add second criteria receiving errors on "set tworange = application.union(tworange, cell.entirerow)". have entered code below. is aware of why might receiving these errors? edit: error "run-time error '5': invalid procedure call or argument sub calculate() '----data pull----' dim cell range dim onerange range dim tworange range dim threerange range dim fourrange range dim fiverange range dim sixrange range dim sevenrange range dim eightrange range dim ninerange range dim tenrange range dim mycount long dim existcount long existcount = 0 mycount = 1 each cell in worksheets("data").range("c2:c99999") if cell.value = worksheets("calculation").range("b8").value existcount = existcount + 1 if mycount = 1 set onerange = cell.offset(0, -1) s

php - How to manipulate URL inside ajax call? -

i trying trigger ajax call on change of dropdown menu(at client_script.php). ajax call send values server_script.php , change div section of client_script.php. problem server script kept in local directory such blocks/latestgrades/server_script.php. when ajax call done url becomes address of server_script.php prepended http://localhost/umoodle which quite ok, because server_script/php file location such. when hover around other pages, onchange triggeres ajax call tries find server_script.php on location prepended http://localhost/umoodle/<something_i_dont_want_here>/ how alter url cut place dont want , ajax call that? make sure ajax url absolute url (beginning forward slash) formed root instead of relative current page. example: (url: '/umoodle')

text to speech - How to add a sound to Android pico TTS engine? -

i'm using pico default android tts engine ipa caracters doing this string text3 = "<speak xml:lang=\"fr-fr\"> <phoneme alphabet=\"ipa\" ph=\"+"+words+"\"/>.</speak>"; mytts.speak(text3, texttospeech.queue_add, null); it's working, letters doesn't "ã" or "ɑ" etc. so question is, how can add theses letters/sounds, tts engine ? hey can use addearcon() add sounds testtospeech link . medthod used add earcons.it link text speecific sound file. can find example on this. mtts = new texttospeech(this, new oninitlistener() { @override public void oninit(int status) { mtts.addearcon("[tock]", "com.ideal.itemid", r.raw.tock_snd); showrecordingview(); } }); there explanation on addearcon in book professional android sensor programming greg milette, adam stroud @ page no 366 , 367. you can find

Creating a Form Using HTML & PHP -

i trying create form on website ( http://youngliferaffle.com/ ) using html, php, , bootstrap twitter. i've been looking through several tutorials on how create think i'm having trouble locations -- in relocating user if make error or after submit answers. i'm new php. appreciate help! thank you! main issues: "too many redirects webpage"/possibly due cookies not receiving email submissions user not being redirected correct page after submission or due bad submission here part of html form: <form method="post" action="contact-form-submission.php"> <fieldset> <label><strong>sign-up</strong></label> <input type="text" class="name" name="cname" id="name" placeholder="full name"></input> <input type="text" class="phone" name="phone" id="phone" placeholder="phone number"&

ios - How Global HTTP Proxy works internally? -

i understand question little bit outside of scope. i wonder, how global http proxy differentiate between http , non http traffic? does check whether connection made port 80? does level of traffic inspection? does filter calls go through specific api's (like nsurlrequest)? i want make sure application writing work correctly it. i talked apple tech support , gave me info proxy applied automatically to: nsurlconnection , based on (as example uiwebview) cfhttpstream supports proxy, it's not automatically applied it. so, proxy settings read through api's defined in cfproxysupport.h anything below cfhttpstream doe not have support proxies (ase example cfsocketstream, bsd sockets , on).

hyperlink - External link in WinJS, iframe or not, doesnt matter -

i work on windows 8 app, , page use link hystory running , forward through app, have 3 or 4 links external websites(eg: facebook or site). tried run them in iframe, or make them open in default browser simple links. both method resulted in error in base.js says can't handle error (!?) searched lot before asking here. watched msdn sample works fine, if copy need in app results in same error. i use page dont have forward history, works, need on front page. ideeas? thank much. le: this items.js code: ( items.html page ) (function () { "use strict"; var appviewstate = windows.ui.viewmanagement.applicationviewstate; var ui = winjs.ui; ui.pages.define("/pages/items/items.html", { // function called whenever user navigates page. // populates page elements app's data. ready: function (element, options) { var listview = element.queryselector(".itemslist").wincontrol; listview.itemd