Posts

Showing posts from August, 2012

c# smartphone-like scrolling windows forms panel movement -

i try explain it: i'm making touch app in windows forms. have panels buttons inside. move ( right or left ) panel when click in control inside panel , move mouse left or right. movement smartphone scrolling. i thought make drag&drop , when drag control inside panel, move panel right or left. don't know how make , don't want lose button's click because every button have own functionality. you have idea? thanks lot

javascript - How to reorder form fields using jquery -

i have php page form this: <form class="form3"> <label class="form3"><input type="checkbox"> item-1</label> <label class="form3"><input type="checkbox"> item-2</label> <label class="form3"><input type="checkbox"> item-3</label> <label class="form3"><input type="checkbox"> item-4</label> <label class="form3"><input type="checkbox"> item-5</label> </form> i have javascript variables set this: var checked = ["", "yes", "", "yes", ""]; now when page loaded, want check if the checked value "yes" want put input items first in teh list , remaining ones later, this: <form class="form3"> <label class="form3"><input type="checkbox" checked="checked"> item-2...

android - How to align header with its underlying data? -

i have implemented list view static header (the header not scrolling listview), using "linearlayout + listview" approach. in general, list view works table, header linearlayout , table body listview. can insert new column , corresponding data list view. reason implement way need let user share data throught context menu of listview. both header name , data has various length, how align header name underlying data? any thought appreciated. check link.. article in blog..hope can you.. http://cap-cay.blogspot.com/2011/09/android-programming-listview.html

JQuery offset() return negative value with CSS3 column? -

i newbie of jquery. want top offset of particular element. use following method: var top = $("img").offset().top; however, returns negative value. can't understand why return negative value? smallest value should zero, or wrong? p.s. use css3 column break in html file. thanks lot!!! edit: body of html file: <div id="chapter-0"> <div> <h1 xml:lang="en-us" id="toc-anchor">main title</h1> <h2 xml:lang="en-us" id="toc-anchor-1">subtitle 1</h2> <p xml:lang="zh-hk"> text</p> <p xml:lang="zh-hk"> text</p> <h2 xml:lang="en-us" id="toc-anchor-2">subtitle2</h2> <p xml:lang="zh-hk"> text</p> <p xml:lang="zh-hk"> text</p> <h2 xml:lang="en-us" id="toc-anchor-3">subtitle3<...

c++ - How to attach a signal to qPixmap? -

i'm creating application using c++ qt , want load multiple images. attach signal each image can enable or disable them afterwards. any help? edit 1: imagedlg = new qfiledialog(); imagelist = imagedlg->getopenfilenames(this, tr("open document"), qdir::currentpath(), tr("image files (*.png *.jpg);;all files (*.*)")); qstring imagename; int x = -50; int y = -50; int n = 1; double size = imagelist.size(); if(imagelist.isempty()) return; scene->clear(); setcursor(qt::waitcursor); foreach(imagename,imagelist) { double val = (n/size)*100; ui->progressbar->setvalue((int)val); image.load(imagename,"4",qt::autocolor); image = image.scaled(100,100,qt::keepaspectratio,qt::fasttransformation); imagenames.push_back(imagename.tostdstring()); // scene->setscenerect(x,y,100,100); item = scene->addpixmap(image); item->se...

c++ - Why does cin cause this program to hang? -

i have posted relevant code below. when compile program, runs , reaches point waits input. type in integer , press enter, code never continues. how go correcting this? int i; cout << "please input column sort by: "; cin >> i; well, first of all, posted above won't compile. try instead: #include <iostream> int main(int argc, char *argv[]) { int i; std::cout << "please input column sort by: "; std::cin >> i; std::cout << "you entered: " << << "\n"; return 0; } compile g++ -o3 thefile.cpp , assuming file called "thefile.cpp". if doesn't work there serious issue going on. if should able diagnose issue further.

filter a list of strings in C# -

i'm learning c# reading books , other online tutorials (homeandlearn.co.uk) i've managed fizzbuzz excercise struggling below excercise. much appreciated. please explain in detail can learn aswell. excercise filter list of strings should pass 6 letter strings composed of 2 concatenated smaller strings in list. for example, given list acks, top, cat, gr, by, bar,lap, st, ely, ades the list should return stacks, laptop, grades, barely because these concatenation of 2 other strings: st + acks = stacks lap + top = laptop gr + ades = grades bar + ely = barely there lot of ways this. here's 1 uses pairing: //grab possible pairings in 1 data structure list<keyvaluepair<string, string>> pairs = new list<keyvaluepair<string, string>>(); string[] list = { "acks", "top", "cat", "gr", "by", "bar", "lap", ...

java - Spring mvc checkboxes -

i've got list , works fine when using approach, problem list long. want put html after half or something. <form:checkboxes element="div" path="user.bags" items="${bags}" itemvalue="id" temlabel="name" /> first of all, there way manipulate list? or have loop through it? when loop through it seems doing this. i'm on right track here? <c:foreach items="${bags}" var="bag" varstatus="status"> <form:checkbox path="user.bags[${status.index}]" value="{bag.id}" name="?"/> </c:foreach> any answer good! i pass 2 lists specify html. checkboxes tag creates html ... see view rendered page.

java - Strange behavior of String's matches() method -

i encountered interesting issue string's matches(regexp) method. asserttrue("33ccff".matches("[0-9a-za-z]{6}")); asserttrue("cc33ff".matches("[0-9a-za-z]{6}")); asserttrue("cc3355".matches("[0-9a-za-z]{6}")); asserttrue("cc9955".matches("[0-9a-za-z]{6}")); asserttrue("cc3366".matches("[0-9a-za-z]{6}")); asserttrue("cc3965".matches("[0-9a-za-z]{6}")); asserttrue("cc1961".matches("[0-9a-za-z]{6}")); asserttrue("cc9999".matches("[0-9a-za-z]{6}")); asserttrue("СС3966".matches("[0-9a-za-z]{6}")); // failing asserttrue("СС9965".matches("[0-9a-za-z]{6}")); // failing asserttrue("СС9966".matches("[0-9a-za-z]{6}")); // failing the last 3 assertion failing unexpectedly. couldn't find reasons why weird behavior happening. have same issue? have ideas? by way, in c...

encoding - How to encode a non-special character to HTML entity in Java -

the following code: org.apache.commons.lang.stringescapeutils.unescapehtml("&#72;&#101;&#108;&#108;&#111;&#32;&#87;&#111;&#114;&#108;&#100;"); gives: hello world but i'd know how decoded string "hello world". have tried escapehtml method, encodes special characters. but i'd know how decoded string "hello world". have tried escapehtml method, doesn't useful. not true "anything useful"; if test string contained html special characters <,>,&, function would've turned &lt; &gt; , &amp; (and change other upper iso8859-1 codes entities). if need encode unicode entity format, iterate through string codepoints: for (int = 0; < str.length(); i++) system.out.print("&#" + str.codepointat(i) + ";");

datepicker - Telerik Date Picker in IE <8 -

Image
i'm using date picker telerik mvc library. appears , works fine in firefox , ie8+ in standards mode. in ie6, ie7, , ie8 in quirks or ie7 standards modes input field displayed, not calendar icon. i think i've narrowed down problem rendering span contains icon. html span is: <span class="t-icon t-icon-calendar" title="open calendar">open calendar</span> and css applied span is: the problem seems span being rendered width , height of 0px, regardless of what's specified in css. why happening, , can fix it? i've tried setting font-size , line-height 12px , didn't help. answer update it turns out styling on span wasn't problem @ all. had styling on input element (float: left) caused span containing image end behind input. here link forum thread opened on same matter. believe questions answered.

java - Returning a toString from a StringBuffer -

this class: public string tostring(){ status = status1.getstat(); item = status1.getitem(); boolean checked; checked = false; stringbuffer sb1 = new stringbuffer(""); stringbuffer s1, s2, s3, z; s1 = new stringbuffer(item1[1]+"["+item2[1]+"] "); s2 = new stringbuffer(item1[2]+"["+item2[2]+"] "); s3 = new stringbuffer(item1[3]+"["+item2[3]+"] "); z = new stringbuffer(" player("+player+") - "+points+" points "); //sb1.append(item1[1]+"["+item2[1]+"] "+item1[2]+"["+item2[2]+"] "+ item1[3]+"["+item2[3]+"] "+ "player("+player+") - "+points+" points "); if (status == 1 && item.equals(item1[1])){ item1[1] = "*"; s1 = sb1.append(item1[1]+" "); //sb1.delete(1,4); }else if (status == 1 &...

Grabbing data from middleware form using jQuery in Django -

i have middleware this: class postmodelformmiddleware(object): def process_request(self, request): form = postmodelform() request.post_form = form this form has captcha field. want happen in template everytime person hits submit captch question refreshes javascript new one. how grab request.post_form , data in jquery? thank you! edit: more code. the html: <form id="add_post"> ... <input type="hidden" name="math_captcha_question" value="fbc9fcdffbf2b2723ab36e9f341372214daf1be936202d2035"> 6 - 5 = ... </form> i change value of "math_captch_question" displayed text. both of these displayed using template tag {{request.post_form.math_captcha_question}} the jquery: $("form#add_post").submit(function() { //validations , stuff var data = {category:category, body:body, nickname:nickname, math_captcha_question:math_captcha_question, math_captcha_field:...

java - page is not redirect -

org.apache.jasper.jasperexception: exception in jsp: /views/header.jsp:14 11: <a href="<%=request.getcontextpath()%>">home</a> | 12: <% string username=(string)session.getattribute("formdata"); 13: string admin="admin"; 14: if(username.equals(" ")){ 15: 16: string logout="http://localhost:8080/newsbank/logout.do"; 17: response.sendredirect(logout); stacktrace: org.apache.jasper.servlet.jspservletwrapper.handlejspexception(jspservletwrapper.java:451) org.apache.jasper.servlet.jspservletwrapper.service(jspservletwrapper.java:373) org.apache.jasper.servlet.jspservlet.servicejspfile(jspservlet.java:321) org.apache.jasper.servlet.jspservlet.service(jspservlet.java:257) javax.servlet.http.httpservlet.service(httpservlet.java:729) org.springframework.web.servlet.view.internalresourceview.rendermergedoutputmodel(internalr...

.net - HttpWebRequest - brackets not allowed in POST -

edit: using copied code project overly complicated... luckily weekend isn't far away. ** * ** original question * ** * ** * ** * ** * i'm wrapping external sms-gateway api internal use - external api requires message multiple recipients uses following syntax: http://(smsgateway)/?username=foo&pass=bar&from=myname&recipient[]=4512345678&recipient[]=4587654321&... that works fine requests rather post gateway avoid issues large url's generated. though http 1.1 not explicitly constrain clients sending requests long urls server. the issue here i'm not allowed use form parameter name containing brackets if use httpwebrequest in .net 4. following error: 'specified value has invalid http header characters' my question is: haven't been able find in http 1.1 specification regarding invalid characters in form parameter names why not allowed use form parameter name called 'recipients[]'? how sending post request? http...

.htaccess - Can deflate/gzip be with "deny from all"? -

i kind of confused .htaccess file. want gzip compression , deny in directory. question can "deny all" gzip compression or has problems? # compress text, html, javascript, css, xml: addoutputfilterbytype deflate text/plain addoutputfilterbytype deflate text/html addoutputfilterbytype deflate text/xml addoutputfilterbytype deflate text/css addoutputfilterbytype deflate application/xml addoutputfilterbytype deflate application/xhtml+xml addoutputfilterbytype deflate application/rss+xml addoutputfilterbytype deflate application/javascript addoutputfilterbytype deflate application/x-javascript # or, compress file types extension: <files *.html> setoutputfilter deflate </files> deny deny all means no 1 can access directory directly via url. content sent browser directory has come via server-side script placed elsewhere, means .htaccess bypassed entirely - compression won't take place. your server-side script therefore have perform compression on ...

ios - iPhone Interface Builder make a view a subView -

Image
i have uiview , uitableview in same nib file so: i have realised can't add toolbar or because has subview uiview first. @ current point in time merely separate uitableview. how turn subview of uiview? also, if can't that, how add new uitableview subview of uiview? have tried , ended following error: i don't quite know how add view outlet dragging view towards file's owner not allow me so. any appreciated, in advance. the easiest way make view subview doing in second screenshot. missing need create uitableviewcontroller , in interface builder set "file owner" class name of controller in identity inspector. can set view property uitableview. notice custom class of file's owner

php - How to access services inside non-controller function in Symfony 2 -

you may access (let's say) doctrine service inside controller, using: $d = $this->getdoctrine() now want controller call function (in class) , want class have access services. possible without passing services variable? you have inject dependent services class or method. if thinking global object might access everywhere it's not right way go (and can't access container way). you'd miss whole point of dependency injection. you can inject services class 2 ways: manually let dic it first solution requires pass dependency either way (constructor, setter, method). the later solution means define class service , let container construct , inject dependencies. can done if can delegate object creation dic. cannot done entities example. be careful injecting whole container. it's not best practice. you'd introduce dependency on whole container might have different services depending on configuration. dependencies wouldn't clear.

objective c - XCode warns for unreleased objects -

is there way make xcode warn unreleased objects? may useful classes lots of objects , forgot put [obj release]; in dealloc method. you can use analyze tool ("build , analyze" in xcode 3), static analysis , points out have unreleased objects. more detail here: build , analyze: running analyzer within xcode

php - Display a PNG favicon in CakePHP -

how show png favicon in cakephp? i'm using $this->html->meta('icon') looks .ico in root. how change looks .png ? $this->html->meta('icon', $this->html->url('/favicon.png'));

database - One To Many and Duplicate entry -

i use jpa->hibernate. playframework. want have relationship. category - 1:n -> tag every category can have many tags, tags not know it. so, this: @entity public class category ... { @onetomany public list<tag> tags = new linkedlist<tag>(); } i have test: @test public void playwithtags() { tag tag1 = new tag("tag1").save(); // managed playframework category cat1 = new category("cat1"); cat1.tags.add(tag1); cat1.save(); // check if tag1 , cat1 saved assertequals(1, tag.count()); assertequals(1, category.count()); category cat2 = new category("cat2"); cat2.tags.add(tag1); cat2.save(); } the result is: 16:18:01,555 error ~ duplicate entry '1' key 'tags_id' 16:18:01,555 error ~ not synchronize database state session org.hibernate.exception.constraintviolationexception: not execute jdbc batch update @ org.hibernate.exception.sqlstateconverter...

c# - Implement nhibernate. Class + abstract base class -

Image
i have following database setup: i need nhibernate file maps to: powerprognosisusagesubmission class powerprognosiswindsubmission class powerprognosissubmissionbase abstract base class although, getting nowhere. here attempt: i tried implementing powerprognosisusagesubmission <?xml version="1.0" encoding="utf-8"?> <hibernate-mapping namespace="dc.client.models.model" assembly="dc.client.models" xmlns="urn:nhibernate-mapping-2.2"> <class name="powerprognosisusagesubmission" table="powerprognosissubmissionbase" schema="`dbo`" mutable="true" lazy="false"> <id name="powerprognosissubmissionid" access="property" column="`powerprognosissubmissionbaseid`"> <generator class="native" /> </id> <property name="date" column="`date`" /> <property name...

bash - Setting awk to variable -

i have code looks this: awk -f'|' '{if($1 in a)print "duplicate found:" $2 " , "a[$1];else a[$1]=$2 }' dump.txt i need set $2 , a[$2] variable. how go doing this? i taking file contains: value "|" filename , want set filename , value 2 different variables. what mean set variables ? these environment variables. in awk, variables start dollar sign , numeric reserved awk. these field values each line. example: test.txt = line 1 line 2 line 3 the command awk '{print $4}' test.txt print out fourth field: $ awk '{print $4}' test.txt 1 2 3 $ awk '{print $3}' test.txt line line line as can see: don't have set . they're automatically set awk. if want set environment variables, can use -v parameter awk -v search="foo" '{ if (search = $1) { print "found string in record " nr }' in above, search awk variable set equal foo . since a...

Django -- messing with the test server -- 304 errors and such -

while working on webapp (which requires login entire site) noticed funny "glitch" (if can call that). viewing django site, logged site (on test server) in chrome. logged out of site , closed chrome entirely. i opened firefox , pasted in url django site, expecting taken login page. however, not asked log in, rather logged in. proceeded log out of site , close firefox. i re-opened chrome log in, find there no css styling. logged in , whole site had lost css styling , test server kept given 304 errors css , img files. i've figured out 304 error has time mis-matching (like django thinking logged out, in firefox logged in -- confused). i wondering if avoidable, or if "feature" of test server? kind of thing happen in production mode too? edit clarity of i'm asking: will loss of styling , images due 304 error experiencing django test server continue occur when launch webapp apache? thanks! you've got questions 3 things: why lo...

c++ - Windows security Center API -

i access windows security center check status of several security features. examples: firewall status whether windows date whether computer has virus protection how able this? 2003, xp, vista, 7 on vista+ can summary of status via wscgetsecurityproviderhealth .

javascript - Slide a div up to match its new contents with jQuery -

i have div contains questions questions 2: square root of 16? a. 7 b. 5 c. 4 d. 1 i need make when answer choice selected, slides , shows: question 2: correct! (or incorrect!) i have working using javascript here: function finalizeanswer(bttn,c,questionid) { if (c) { bttn.parentnode.style.backgroundcolor="lightgreen"; bttn.parentnode.innerhtml="<b>question "+(questionid+1)+":</b> correct!"; } else { bttn.parentnode.style.backgroundcolor="pink"; bttn.parentnode.innerhtml="<b>question "+(questionid+1)+":</b> wrong!"; } updatescore(); } the div resizes because contents different (no longer long question, short response). possible replace in here make slide instead of popping up? just reference function included: bttn -> button pressed. (a, b, c, or d) c -> if answer correct questionid -> used data...

Can I create a mobile 'view' that doesn't consist of Silverlight from my existing MVVM code? -

i'm in situation past year i've been developing heavily in silverlight using mvvm pattern. i've sold project manager numerous times on greatness of mvvm through separation of duties, , have had great successes i've re-written views in day, rather re-writing app in week. recently we've had directive 'go mobile' compatible many mobile browsers possible (eg. not silverlight). project manager under assumption, based on earlier work can write new 'view' mobile apps. question: is there way able apply existing mvvm code mobile front-end doesn't consist of silverlight? i don't think so. mvvm relies on constant interaction between view , viewmodel through notifications, commands, etc. since code in .net, there's no chance run on client side in web application. you use mvvm javascript framework knockoutjs in combination mvc framework (asp.net mvc 2 easiest transition). similar approach can think of, need migrate current app...

javascript - JSON Array rearrange/or filter by value of subvalue -

i'm bit stuck problem getting information out of json array. know how retrieve information , parse them. isn't issue. information facebook use jquery, did it's job fine fare. basically, need restructure json output of following link: https://graph.facebook.com/284521968232566/photos under tags, you'll see several items. need rearrange whole thing sorted tag. means: pauke { [name, source, link], [name, source, link] } trompete { [name, source, link], [name, source, link] } obviously, can see, top-level item has 1 item, there more pictures it'll grow. this might not right form of array, i'm open approaches. thank you ok, iterate on data , , on data[i].tags.data , building result array, somthing like: var json = {} ; // json data - needs pre-populated var result = [] ; // result array var tag ; // temporary variable each tag in turn. for(var i=0;i<json.data.length;i++) { if( typeof json.data[i].tags != 'undefined' ...

android - My Scrolling Bitmap Canvas is too slow to use -

i learning program android. i've made couple of basic games, learning i'd make car driving game. simplest way thought of doing keep car in middle of screen , scroll background give illusion of movement. as experiment figure out engine, created 2048x1200 bitmap load png. map. create new bitmap of 1024x600 cropped map display on screen. getwidth() & getheight() give these dimensions. take different crop each time based on movement show on screen. unfortunately find slow use. car have move @ snails pace if wanted smooth. 18fps. i using james daniello's simple game loop i read following stack overflow article says keep object creation out of main loop as possible, doing best can. how draw lots of bitmaps on screen in android game without slow performance also of use article romain guy on keeping bitmap same format screen stop having transformed displayed on screen, costly. bitmap quality, banding , dithering i'd figure out best can achieve canvas , bit...

c++ - Stack Memory vs Heap Memory -

possible duplicate: what , stack , heap i programming in c++ , wondering stack memory vs heap memory. know when call new, memory heap. if if create local variables, memory stack. after research on internet, common answer stack memory temporary , heap memory permanent. is stack , heap memory model concept of operating system or computer architecture? of might not follow stack , heap memory model or of them follow it? stack , heap memory abstraction on memory model of virtual memory ( might swap memory between disk , ram). both stack , heap memory physically might ram or disk? reason heap allocation seems slower stack counterpart? also, main program run in stack or heap? also, happen if process run out of stack memory or heap memory allocated? thanks stack memory range of memory accessible via stack register of cpu. stack used way implement "jump-subroutine"-"return" code pattern in assembly language, , means implement hardware-leve...

What's the way to run an Amazon Elastic Mapreduce job that depends on Numpy? -

the map portion of mapreduce job depends on numpy. so, means need have numpy installed part of bootstrap actions. what i'm thinking of doing building custom numpy package stored on s3 fetched , installed during boostrap actions. is there better way? numpy comes installed on amazon elastic mapreduce instances, if want use other modules, can zip them up, distribute them workers distributedcache (using "-cachefile"), , import them python's built-in "zipimport" module. see: http://www.cloudera.com/blog/2008/11/sending-files-to-remote-task-nodes-with-hadoop-mapreduce/

java - How to update a component in one window from another window in Netbeans Platform? -

i'm new netbeans platform. here i'm trying do, have 2 windows, 1 main window 'editor' , second 1 'explorer' window jtree component in it. every time add new item database, want add node jtree component in explorer window ! trying find way call updater method main window, far no luck ! both windows located in same module , same package ! there way can ? in netbeans platform applications use lookup api communicate between topcomponents/ modules. http://netbeans.dzone.com/news/top-10-netbeans-apis-part-2 http://netbeans.org/kb/trails/platform.html i recommend read netbeans platform book basics.

Is it right output of C programe -

possible duplicate: floating point comparison i have simple c code , output comes out unexpected me main() { float f1 = 1.0; double f2 = 1.0; if(f1==f2) printf("equal"); else printf("unequal"); } i expecting output "unequal" output equal .why so? since float , double have different precision ,output should unequal. precision matters when number can't represented exactly. since both floats , doubles (being ieee 754 single , double precision values) can represent 1.0 exactly, precision doesn't come it. 1.0 0 sign bit, exponent bits except highest set 1, , no mantissa bits set. in single precision, that's binary: 0-01111111-00000000000000000000000 and, double precision: 0-01111111111-0000000000000000000000000000000000000000000000000000 not numbers representable in ieee 754 - example, 1.1 mention in comment stored 1.100000023841858 in single precision. have @ this answer example o...

ios4 - IOS/OpenAl Sound Interference -

i'm new in objective - c... i found source code how use openal, copying , testing, sound played interference. can @ code , tell wrong ? alccontext *context = null; alcdevice *device = alcopendevice(null); if (device) { context = alccreatecontext(device, null); alcmakecontextcurrent(context); } nsstring *path = [[nsbundle mainbundle] pathforresource:@"sound" oftype:@"caf"]; audiofileid fileid = 0; nsurl *url = [nsurl fileurlwithpath:path]; osstatus result = audiofileopenurl((cfurlref)url, kaudiofilereadpermission, 0, &fileid); if (result != 0) nslog(@"faild load file @ path:%@",path); uint32 filesize = 0; uint32 propsize = sizeof(uint64); osstatus result1 = audiofilegetproperty(fileid, kaudiofilepropertyaudiodatabytecount, &propsize, &filesize); if (result1 != 0) nslog(@"cannot size of file!"); unsigned char *buffer = malloc(filesize); osstatus result2 = noerr; result2 = audiofilereadbytes(fileid, false...

php - PDO Microsoft Access -

i running linux bluehost , have pdo installed. wish access *.mdb info, cannot seem past connection string pdo in case. $dbh = new pdo("odbc:driver={microsoft access driver (*.mdb)};dbq=$mdb;uid=admin"); generates error: sqlstate[im002] sqldriverconnect: 0 [unixodbc][driver manager]data source name not found, , no default driver specified i know the path correct: /home1/[removed]/pss/pss.md does know of solution issue using pdo library? as requested, expanding on comment. mdb support on linux limited; although mdb tools (used pdo on linux) provide partial read-only support, general status seems far production ready, faq says 1.2 mdb tools do mdb tools open source suite of libraries , utilities read (and write) mdb database files. 1.6 there roadmap? roughly, plan moving forward looks this. add index scan capability libmdb , sql engine query plan generator. add support adding rows existing tables , mdb-import too...

objective c - Can't compile .deb packages; make package command returns error -

when try compile notification center widget ios 5 using cd <name> make package then following error: make package requires dpkg-deb. make: *** [package] error 1 but have installed dpkg-deb using sudo su <enter password> cd /bin curl http://debmaker-osx.googlecode.com/svn-history/r5/trunk/dpkg-deb > dpkg-deb and have navigated /bin directory , dpkg-deb file exists in folder. can make work? have followed tutorial on how install theos, dpkg-deb , how create weeappplugin, i'm stuck @ compiling bundle... http://weeplugins.com/blog/?p=1 update: seems cannot access /bin/dpkg-deb file if run command cd /bin/dpkg-deb i error don't have permission access file. possible maybe move file folder can access it? you can try "sudo make package". give superuser permissions.

android - Back and forward with loadDataWithBaseURL -

resultview.loaddatawithbaseurl( resulttextmaker.asset_url, searchresult == definition_not_found ? resulttextmaker.getnoresulthtml(definition.getword(), nodefinitionstr) : resulttextmaker.getresulthtml(), "text/html", "utf-8", null); hi, have code display result in webview. how implement , forward capability it? don't know pass the fifth parameter of loaddatawithbaseurl. search result html. the fifth parameter url want into. passing null defaults 'about:blank'

windows phone 7 - Control press "back button" and disable close the application using a dialog for confirm - wp7 -

i need show simple dialog question : 'do want exit application?' yes or no. dialog shown when user presses button of device. i know how can show dialog , don't know how disable action: close app. it's closed. if understand correctly, want display confirmation dialog when user clicks button on main page of app ask whether want exit. if user selects yes app exits, otherwise cancel navigation. this, in mainpage class constructor hook event handler mainpage() { backkeypress += onbackkeypressed; } void onbackkeypressed( object sender, canceleventargs e ) { var result = messagebox.show( "do want exit?", "attention!", messageboxbutton.okcancel ); if( result == messageboxresult.ok ) { // not cancel navigation return; } e.cancel = true; }

jms - how can the MessageListenerContainer listen the message asynchronously? -

is there long-lasting tcp connecton set up? tcp port open work? from spring docs a message listener container intermediary between mdp , messaging provider messagelistenercontainer glue code. real interesting stuff going on in jms provider. , yes, involves tcp connection or similar. the specifics implementation detail. consult jms vendor documentation , maybe they'll spell out.

xslt - Is it possible to build an XML document from a list of XPath values and the XML XSD? -

i have list of name/value pairs map xml document. idea this, assign each of names xpath this: account_number = 4294587576-32 = /my:myfields/my:customer/my:accountnumber customer_name = john smith = /my:myfields/my:customer/my:name customer_address = tampa, fl 33604 = /my:myfields/my:customer/my:address amount_due = 129.85 = /my:myfields/my:amountdue/my:amount days_past_due = 54 = /my:myfields/my:amountdue/my:dayspastdue now, shouldn't able take information along complete sample of xml document or xsd , build xml document looks this: <my:myfields> <my:customer> <my:name>john smith</my:name> <my:accountnumber>4294587576-32</my:accountnumber> <my:address>tampa, fl 33604</my:address> </my:customer> <my:amountdue> <my:dayspastdue>54</my:dayspastdue> <my:amount>129.85<...

Where can I find a good tutorial on how to make a multi-use database class using php and mysql? -

i've been trying hours make 1 class file handle database work (statements, security (sql injection prevent), etc) won't have keep writing statements update or insert every time need one. there tutorials online show how create multi-purpose database class prepared statements? he class tried construct brain killing me. :s <?php $d = new database(); // test class database { protected $db_connect; protected $statement; function database() { try { $this->db = new pdo("mysql:host=localhost;dbname=test", "root", "") or die("could not connect server."); } catch (pdoexception $e) { echo $e->getmessage(); } try { $this->preparedquery("insert feedback (name, feedback) values (?, ?)", array("this name", "this feedback w00t feedback")); } catch (invalidargumentexception $e) { e...

objective c - UIImageView setFrame -

hi came across piece of code , wondering setframe was. couldn't find in uiimageview docs. [largeimage setframe:cgrectmake(x_o, y_o, width, height)]; this code setting frame property using method syntax rather dotted notation. frame property of uiview objects (not uiimageview ), , rectangle defines view's location , size in terms of parent view's co-ordinate system. it defined as: @property(nonatomic) cgrect frame contrast frame bounds , rect in view's own co-ordinate system. frame derived bounds . view geometry, frames , bounds explained in detail here: view geometry , coordinate systems the class reference here: uiview class reference - frame property

How do you delete trailng white space in emacs? -

i have text file has fixed length lines, padded trailing spaces like: hello world ↩ other line ↩ x ↩ and want remove trailing spaces on each line looks like hello world↩ other line↩ x↩ is possible write emacs macro can solve this? edit: lines can have arbitrary number of spaces in before trailing spaces @ end, so hi world ↩ can valid line in file. emacs has built-in fixup-whitespace ( m-space ), shrinks more 1 space 1 space: hello world ↩ ^ cursor m-x fixup-whitespace hello world ↩ ^ cursor so, can define macro that: first calls fixup-whitespace then removes last whitespace another 1 m-x replace-regexp ret [ ]+' ret ' ret , solves problem using regular expressions.

How to stop changing the orientation when a progress bar is spinning in android -

i have registration screen user enters registration details , when user clicks on "register" button showing progress bar(progress bar begins spin) , takes user home screen.if user rotates phone when progress bar spinning, progress bar gets dismissed.i want orientation not change potrait landscape , vice versa,when progress bar visible(meaning spinning).how stop orientation change when progress bar spinning?any appreciated. this happening because when screen orientation rotates activity gets re-started. in case can add configchanges attribute in tag in androidmanifest file stop re-creation of activity. <activity android:name=".activity_name" android:configchanges="orientation|keyboardhidden"> by, orientation can change progress bar working , won't stop though orientation changes. update @override public void onconfigurationchanged(configuration newconfig) { super.onconfigurationchanged(newconfig); ...

css - How to push text to the left (out of the box) and make it hidden? -

see top of http://www.joopvos.nl/acmplus/ (column) ... @ right line of text cropped wanted ... , @ left want same ... can done css? html: <h1 id="site-name">acm<span>+</span> acm<span>+</span> acm<span>+</span> acm<span>+</span> acm<span>+</span></h1> css: h1#site-name { padding: 16px 0 20px 0; font-size: 4em; line-height: 100%; font-family: 'museosans500','lucida grande', 'sans serif'; color: #dcdcdc; font-weight: normal; float: left; display: inline; background-color: transparent; text-transform: uppercase; white-space: pre; /* on 1 line! */ overflow: hidden; width: 700px; } text-indent: -1000px; that'll pull off screen, left.

eclipse - Line number in android log util -

Image
is there way print file line number android log ? for getting line number ` public static int getlinenumber() { return thread.currentthread().getstacktrace()[2].getlinenumber(); } or thread.currentthread().getstacktrace()[2].getlinenumber() in log() ` try u....

javascript - ajax call to timed-out cas-protected server: ajax redirection problem -

our web server uses cas single sign on. cas server running jasig cas server on https://portal.ourdomain.com , web server running rails on http://service.ourdomain.com . the rails server has session timeout set low single sign-out backup measure , other reasons. occasionally, users redirected portal.ourdomain.com reauthentication. seamless since portal.ourdomain.com redirects them service.ourdomain.com updated ticket cookie unless cas session has expired. however, doesn't work ajax. web browsers not follow redirects xhr requests, if domain same. one obvious solution serve https://ourdomain.com , stop subdomain nonsense. extensive operation , require serving through https. another solution regularly ping server never times out. besides increased load on server, having pages never time out defeats purpose of having timeout in first place. which leads third, crappy solution: remove timeout. how overcome cross-domain issues ajax calls cas-protected resour...

android - what kind of layout is best to choose? -

[form drawn in gimp][1] result should this. layout best use? realize relative scary cumbersome code, , using table having problems height or width of elements. parent - linearlayout vertical child views - relative layout or linearlayout depending on complexity of each row. use relative layout more complex rows. i suggest create reusable elements can design layout ease. hth.

PHP Two functions with same name -

how include 2 functions same name in php file? i have 2 files: file1.php includes function getresidentcount() {} function getresidentdata() {} file2.php includes function getresidentcount() {} function getresidentdata() {} i need file3.php include of these functions since each 1 used calculate different resident counts , data. any idea how can include both of these files in 1 file. cannot change original files (they in production live app). thanks, claudia this evil. offer exercise. include('file1.php'); //include('file2.php'); $php=file_get_contents("file2.php"); $php=str_replace('getresidentcount', 'file2getresidentcount', $php); $php=str_replace('getresidentdata', 'file2getresidentdata', $php); eval($php); now can call duplicated function different name! do not this. it's idea :) an alternative use apd extension , lets rename functions. include first file...

android - How To Get Application Context After Force closed -

i integrated c2dm in application working fine. once c2dm notification came database operation need context create ormlitesqliteopenhelper object. ormlitesqliteopenhelper ldatabasehelper = openhelpermanager.gethelper(context.getapplicationcontext()); this fine in normal cases. suppose if force stop application manually settings- application->manageapplication. if c2dm message came after unable create ormlitesqliteopenhelper object. seems application context getting null. exception : java.lang.illegalstateexception: not find openhelperclass because none of generic parameters extends ormlitesqliteopenhelper: null how application context after force stopping application. i tried cases: context.getapplicationcontext() , context, this . please me . it might solve problem if explicitly tell ormlite name of databasehelper class. to this, open res/values/strings.xml, , add <string name="open_helper_classname">your.full.package.name.dat...

Java: Mapping XML to other XML (translation) -

to put simply, make java program takes 1 xml file (in format x) input, translate xml format y, maybe other stuff it, , output it. format x , y similar (both used in nlp tools, have same kind of tokens etc.) , have description schemas both of them. in case you're curious, i'd translate tcf format ; make bridge between 2 tools. i've never done before, how 1 go mapping 1 xml another? can recommend libraries or tools? (this has usable in eclipse though, , should free) so far found this program stylus studio , it's not free , though looks pretty cool, i'm not sure if it's output of use java program. if result of conversion xslt, can use in java? (how xslt work translating?) (so i'd maybe use gui map once, , keep using resulting xslt somehow in program) many shedding of light on matter! use xml transformations, implemented set of classes built jdk, see http://www.brics.dk/~amoeller/xml/transformation/index.html for tutorial.

objective c - Duplicate NSLog entries -

i don't know if it's possible me include code here that's relevant project large there typical reasons why nslog repeat warnings , calls @ occasions 1 call/error occuring? as example, have subclass of nsbox inits instance of class on awakefromnib : - (void) awakefromnib { burbcontrollerinstance = [[burbcontroller alloc] init]; if (burbcontrollerinstance) { nslog(@"init ok"); } } i nslog printing "init ok" twice. don't see why subclass 'awoken' twice anywhere in project. part of larger problem can't variables return nil class i'm creating instance of. i'm wondering if perhaps double values it. this post helpful, i. e. 1 comment: also important: awakefromnib can called multiple times on controller if use same controller several nibs – say, you’re using app delegate owner of both app’s box , preferences dialog. you’ll need guard test if use awakefromnib initializing n...

javascript - Change colour of text based on a value of another div element, Jquery, html and css? -

i want change color of text, based on value of div element. need run every second setinterval has go in there where something this: <div class="abcd">jkl</div> <div class="xyz">7</div> if("xyz" <10){ //change "abcd" "abcd2" changes color} i'm not @ jquery think thats tool needed job. setinterval(function() { var text = $(".xyz").text(); if (parsefloat(text) < 10) { $(".abcd").addclass("abcd2").removeclass("abcd"); } }, 1000); //run after every 1 second

WPF MVVM Combobox based on Entity Framework values does not raise property changed notification -

i have succesfully used mvvm principles in former projects, i'm stuck ... basic! using ef4.1 (code first approach) data storage access works fine. created following class: public class photo { [key] public int photoid { get; set; } public string year { get; set; } public byte[] thumbnail { get; set; } public datetime inserttime { get; set; } //insertion time public datetime updatetime { get; set; } //last modification time //navigational properties public virtual image image { get; set; } public virtual monument monument { get; set; }//a photo belongs specific monument public virtual mdpremisesspace mdpremisesspace { get; set; } //a photo shot @ specific premises space public virtual mdrestauration mdrestauration { get; set; }//a photo has restauration public virtual mdmaintenance mdmaintenance { get; set; }//a photo has maintenance public virtual mdt...

Qt animation problem - flickering geometry animation -

i have problem creating simple animation qt animation. have small image located @ bottom right corner of screen, trying create animation enlarge picture streching the top left corner of image , streching center of screen. managed that, but, it's notiable qanimation makes flicker (the right border of picture, , doesn't turns out good) did no animation, timer, , changing window geometry , had same problem, seems it's not refreshing fast enough, creating flickering in right border of picture. here 2 examples: 1 - using property animation (geometery) animation = new qpropertyanimation(this, "geometry"); animation->setduration(555); animation->seteasingcurve(qeasingcurve::linear); animation->setstartvalue(qrect(availablescreensize.width() -minwidth -window_padding,availablescreensize.height() - minheight -window_padding,minwidth,minheight)); animation->setendvalue(qrect(availablescreensize.width() - maxwidth -window_padding,available...

jquery - Is it allowed to have more than one document.ready in a page? -

possible duplicate: jquery - multiple $(document).ready … ? does matter if have more 1 document.ready in page? because have javascript files of them have phrase inside. cause problem? logical or syntax problem? nope, fine. one more great thing $(document).ready() didn't mention in previous post can use more once. in fact, if don't care @ keeping code small, litter javascript file them source .

php - Application whitelst -

i'm trying access photo albums of public group page. i'm using following code: // create application instance $facebook = new facebook(array( 'appid' => $appid, 'secret' => $appsecret )); $facebook->setaccesstoken($token); print_r( $facebook->api($id . '/albums') ); …which produces error: fatal error: uncaught oauthexception: (#3) app must on whitelist i've added ip server whitelist, hasn't solved anything. i'm confused why can access page's feed , other details not albums. am doing wrong here?