Posts

Showing posts from April, 2011

wpf - Select the Text of the textbox for copy -

here steps should happen new uc loads , certficate generated exe the address of certficate shown in textbox (which described below) all these steps happen uc loads. i need copy button copy the path of textbox. i using below code uc loads copy button disable. why? <textbox grid.column="1" horizontalalignment="stretch" name="label1" verticalalignment="stretch" foreground="#fff20c0c" ismanipulationenabled="false" istabstop="false" isundoenabled="false" borderthickness="0" background="{staticresource {x:static systemcolors.controlbrushkey}}" textwrapping="wrap" isreadonly="true"> <button grid.row="2" height="auto" width="auto " command="copy" content="copy certificate address" horizontalalignment="left" verticalalignment="center" commandtarget="{binding eleme...

httpwebrequest - Using HttpRequestHeaders in WinRT & C# -

i'm using httpwebrequests contact api , need add header compiler tells me method not exists. yet, when check msdn, tells me method exists. setting useragent-property fails well. can me please? try{ httpwebrequest wr = (httpwebrequest)httpwebrequest.create(url); wr.method = "get"; wr.headers.add(system.net.httprequestheader.authorization, string.format("bearer {0}", _accesstoken)); wr.useragent = _appnameandcontact; var resp = (system.net.httpwebresponse) await wr.bettergetresponse(); if (resp.statuscode == system.net.httpstatuscode.ok) { using (var sw = new system.io.streamreader(resp.getresponsestream())) { var msg = sw.readtoend(); user usr = jsonconvert.deserializeobject<user>(msg); //var results = jsonhelper.deserialize<user>(msg); return usr; } } } you have use httprequestmessage this: using (v...

graphics - sprite animation -

i study "fundamentals of multimedia : ze-nian li , mark s drew" , didn't understand meaning of "sprite". can explain me meaning of "sprite"? , please explain me 1 algorithm it. tnx according wikipedia: in computer graphics, sprite two-dimensional image or animation integrated larger scene. however, i'm not sure if can indeed animation. far know term sprite single-frame still image . multiple sprites of figure can used make animation. for example, in side-scrolling 16-bit game (such old mario game), there's sprite mario standing still, 2 sprites running mario, etc. upon input of player corresponding sprites shown, animated or not. i think not best site ask such question, recommend graphicdesign.stackexchange.com

javascript - dijit.findWidgets return null array? -

on jstl page have following divs <div dojotype="dijit.layout.tabcontainer" style="width: 100%; height: 100%;" dolayout="false" id="dojotabbedpane" > <c:foreach items="${summariesmap}" var="summaryentry"> <div dojotype="dijit.layout.contentpane" title="${summaryentry.key}"> i try find divs under (including dojotabbedpane) in order recersively destroy contentpane under it. can use jquery.load() reload contents , use dojo.parser.parse(dijit.byid("dojotabbedpane")); to re-parse component make sure tabbedpane can rendered(otherwise doesn't , cause memory leak or error) here question is: (1) on right track re-parse dojo tabbedcontainer? (2) why each time findwidgets function return array size 0? thanks in advance. i'll answer 2 first: because dijit.findwidgets expects dom node, not widget. if need find widgets inside widget,...

math - Dominating Set Greedy Approximation Worst-Case Example -

Image
to find minimum dominating set of undirected graph g can use greedy algorithm this: start empty set d. until d dominating set, add vertex v maximum number of uncovered neighbours. the algorithm not find optimal solution, ln(delta)-approximation. (if delta maximum degree of vertex in g) now looking simple example greedy algorithm not find optimal solution. 1 found related instance of set cover problem. ( http://en.wikipedia.org/wiki/set_cover_problem#greedy_algorithm picture on right) translating 1 graph cause minimum of 14 vertices , lot of edges. does know small example? thanks in advance consider following graph: a greedy approach choose b d , g. meanwhile, e , f form dominating set.

java - Redis List, pop without removing -

i'm using redistemplate(from spring) in java app. need pop list of elements correspondenting values, without removing it. suggestions? you can peek @ item rather popping using range command. with spring, redistemplate instance, can listoperations instance using opsforlist() method, , then: listop.range(key, 0, 0) return first (left) item without popping it listop.range(key, -1, -1) return last (right) item without popping it see documentation at: http://static.springsource.org/spring-data/data-keyvalue/docs/1.0.x/api/org/springframework/data/keyvalue/redis/core/redistemplate.html http://static.springsource.org/spring-data/data-keyvalue/docs/1.0.x/api/org/springframework/data/keyvalue/redis/core/listoperations.html

c# - Fire events to client using WCF -

Image
i know there tutorials out there regarding wcf callbacks , events, i'm having trouble getting them work, or they're complex. i'm real beginner, love hear if knows of solid beginner tutorials aimed i'm trying figure out @ moment. please forgive me if use wrong terminology (and please correct me), said i'm beginner. the problem: it might more complicated is. i'm trying accomplish is: a host local memory (lets array of 5 integers) , running wcf service. listen queries client , fire update (events?) client when 1 of these integers changed (from external source, such user input via command prompt , set()). a client can make direct queries return 1 of these 5 integers or subscribe particular index of host array. what can do: i can set connection, service limited standalone functions. client can make "queries", limited remote function calling (such "add", parameters passed function , processing done internally). what i'm...

drop down menu - EntityManager results in nullPointerException. Using Seam and JBOSS -

i making web-based application using seam , jboss. trying make converter drop-down box, whenever use entitymanager within converter class nullpointerexception. have spent couple days trying figure , appreciated here of code. if anymore needed, let me know: converter class: package edu.uwrf.iss.flowershop.entity; import javax.faces.application.facesmessage; import javax.faces.component.uicomponent; import javax.faces.context.facescontext; import javax.faces.convert.converter; import javax.faces.convert.converterexception; import javax.persistence.entitymanager; import javax.persistence.query; import javax.servlet.servletcontext; import javax.swing.joptionpane; import org.jboss.seam.annotations.in; import org.jboss.seam.annotations.scope; public class empconverter implements converter { @in private entitymanager entitymanager; public object getasobject(facescontext arg0, uicomponent arg1, string arg2) { int num = integer.parseint(arg2); entitymanager.refresh(getcla...

php - In Symfony2 where do I put e.g. TCPDF? -

i'm on symfony 2.0 , understood third-party libraries go in /vendor. have 2 third party classes i'm using, 1 tcpdf , paypal class. neither have formal symfony2 bundles. so followed instructions here namespaces them , makes them usable inside /vendor: add third party libraries symfony 2 this works , can access them controllers. i'm rethinking if that's right thing. whenever do.. php bin/vendors install --reinstall ..those custom classes disappear because don't have git repo in 'deps'. has caused real problems e.g. when trying deploy on e.g. pagodabox. strong instinct code while 'third-party' belongs closer code of app. if that's true, should it: sit next controllers in src/mycompany/mybundle/controller/tcpdf.php be other custom-written services in src/mycompany/mybundle/dependencyinjection/tcpdf.php go in own directory under bundle: src/mycompany/mybundle/tcpdf/tcpdf.php if move these 2 classes /vendor 1 of above, access c...

.net - Dynamic Data Access Layer with EF4.3 -

i have been tasked designing data access layer connect tables interchangable schemas(used permissions , separation). database may different each call (because of business rules). plan on using entity framework 4.3(all existing apps use using entity framework) poco classes (to prevent multiple dev's accidently using model generator against that's customized) , dbcontext (so compact framework without code generating). plan on utilizing dbmodelbuilder , entityconnectionstringbuilder achieve these dynamic situations. done or have better solution? there extensions visual studio auto generate poco's using t4 templates. there t4 templates auto generating repositories , associated interfaces. these options have ability add options make easier working wcf. here visual studio extension link. http://visualstudiogallery.msdn.microsoft.com/ff781f46-d8c3-45e0-a545-40906921bb86 this extension automatically updates poco classes if .edmx resides in same namespace. options...

HTML : Why does a button element always appear slightly below the other elements? -

Image
i have noticed <button> element in html appears lower other elements shown in figure below. as can see, "go" button lower textarea element on same row is. code follows... <table width="100%"> <tr> <th rowspan="2" align="left"> <img width="120px" height="60px" src="test-image.jpg" /> </th> <th align="right"> user &nbsp;&nbsp; <a href="">my garage</a> &nbsp;|&nbsp; <a href="">account settings</a>&nbsp;|&nbsp; <a href="">sign out</a> &nbsp;|&nbsp; <br/> <textarea rows="1" id="search_text"></textarea><button>go!</button...

mysql - Access denied to ClearDB database using Python/Django on Heroku -

i'm trying build webapp on heroku using python/django, , followed tutorial set django project , push heroku. however, can never normal django "it worked!" screen. of course, because when check heroku ps , there never processes running. there no procfile according tutorial, shouldn't matter django app. when run heroku run python manage.py runserver , following error occurs: unhandled exception in thread started <bound method command.inner_run of <dja ngo.contrib.staticfiles.management.commands.runserver.command object @ 0x1ff819 0>> traceback (most recent call last): file "/app/.heroku/venv/lib/python2.7/site-packages/django/core/management/com mands/runserver.py", line 91, in inner_run self.validate(display_num_errors=true) file "/app/.heroku/venv/lib/python2.7/site-packages/django/core/management/bas e.py", line 266, in validate num_errors = get_validation_errors(s, app) file "/app/.heroku/venv/lib/python...

c++ - Matlab - Cumulative distribution function (CDF) -

i'm in middle of code translation matlab c++, , important reasons must obtain cumulative distribution function of 'normal' function (in matlab, 'norm') mean=0 , dispersion=1. the implementation in matlab this: map.c = cdf( 'norm', map.c, 0,1 ); which suppose equalization of histogram map.c. the problem comes @ moment of translating c++, due lack of decimals have. tried lot of typical cdf implementations: such c++ code found here, cumulative normal distribution function in c/c++ got important lack of decimals, tried boost implementation: #include "boost/math/distributions.hpp" boost::math::normal_distribution<> d(0,1); but still not same implementation matlab's (i guess seems more precise!) does know find original matlab source such process, or correct amount of decimals should consider? thanks in advance! the gaussian cdf interesting function. not know whether answer interest you, interest others question ...

button - Perform Click ImageView Android -

for ordinary button can this: mybutton.performclick(); and system understands, button clicked. now have imageview. what's alternative of function imageviews? thanks you can still assign onclicklistener image view, since listener assignment method view based method. once listener added imageview, may call onclick(imageview) method in listener when ever. besides that, imageview has access performclick method buttonview does. can use same code across views long have listener.

hyperlink - Double tapping links in webview -

i have problem people double clicking links in webview. scripts done few times if person taps link couple times. i tried disable webview , set unclickable in override of url loading doesn't seem work, every , still manages double tap. anyone have ideas how implement loading screen stop people tapping link 2 times? as far know, double click something, first click event trigger 2 times, make this: var isclicked = false; $("a").click(function(event) { event.preventdefault(); if (!isclicked){ isclicked = true; // } }); just set isclicked , update false when process ends.

Insert multiple line breaks into a JavaScript string (regex) (CodeMirror) -

i have few strings , insert line breaks them @ points. i figured out few of logistics whole can't seem crack problem, because have limited experience regex. basically have long string of xml tags on 1 line. want add line breaks @ points data more formatted , looking nice. using codemirror display data on webpage reason on line #1. so need go this: <sample><name></name><phonenumber><areacode></areacode><number></number></phonenumber></sample> to this: <sample> <name></name> <phonenumber> <areacode></areacode> <number></number> </phonenumber> </sample> codemirror take care of rest of formatting need insert line breaks in right spot using regex or loop of sort. tags or can change guessing regex has used. i have had success inserting line breaks \n , &#xd can't seem regex detect proper locations. any appreciated. thanks...

ios - How can use NSURLIsExcludedFromBackupKey with Adobe Air? -

apple has rejected our application because store files offline viewing  under localstorage (/documents) extract of message, received : data can recreated must persist proper functioning of app - or because customers expect available offline use - should marked "do not up" attribute. nsurl objects, add nsurlisexcludedfrombackupkey attribute prevent corresponding file being backed up. cfurlref objects, use corresponding kcfurlisexcludedfrombackupkey attribute. how can adobe air using flex sdk 4.6? thanks there native extension that: http://www.jampot.ie/ane/ane-ios-data-storage-set-donotbackup-attribute-for-ios5-native-extension/

Python Multithreading (not all threads progress) -

-- launch 10 threads -- threads share queue.queue(). -- each thread gets item queue -- each thread communicates first external webserver -- processes data coming ext. webserver -- communicates internal db -- gets next item queue -- repeats until queue finishes -- @ point threads joined , main thread exits -- in code, in main thread populate queue.queue() 500 items -- each thread gets first item in queue. i observe that: -- (that means when each thread processing first item) 10 threads starts , proceeds -- however, second item onwards, 2 10 threads progress. -- since there multiple network, i/o operations involved, assume threads should interleave , cpu time. could please explain behavior? pointers documentation or asked question on stack helpful. sysctl hw.ncpu (mac os) hw.ncpu: 2 regards,

css - Issue with positioning across browsers zoom - div and table(?) -

finally managed make little site acceptable in ff/ie/chrome -but when zoom in/out ff/chrome positions changes while in ie doesnt. my code: <div id="parent"> <b>favor emitir cheques, depostiso o tramsferencias <br /> nombre de "xxxxxxx xxxxxxxxxx, c.a." <br /> en xxxxxxxx xxxx, cta cte, no. xxxx-xxxx-xx-xxxxxxxxxx</b> <div id="child1"> base imponible bs. <table border="1" cellspacing="0"> <tr> <td>i.v.a. <input id="iva" type="text" name="iva" size="5" value="{{iva}}"/> % b.s.</td> </tr> </table> importe total bs. <table id="child1table"> ...text display... </table> </div> <div id="child2"> ... </div> on .css im using meyers reset , apart whats following: #parent { font-size:8...

python - Static files in a Bottle application cannot be found (404) -

i've reviewed questions here this, reviewed bottle tutorial, reviewed bottle google group discussions, , afaik, i'm doing right. somehow, though, can't css file load properly. i'm getting 404 on static file, http://localhost:8888/todo/static/style.css not found, which, according directory structure below, should not case. i'm using version 0.11 (unstable) of bottle; there i'm missing, or bug in bottle? my directory structure: todo/ todo.py static/ style.css my todo.py: import sqlite3 bottle import bottle, route, run, debug, template, request, validate, static_file, error, simpletemplate # needed when run bottle on mod_wsgi bottle import default_app app = bottle() default_app.push(app) apppath = '/applications/mamp/htdocs/todo/' @app.route('/todo') def todo_list(): conn = sqlite3.connect(apppath + 'todo.db') c = conn.cursor() c.execute("select id, task todo status '1';") re...

Life cycle of a backbone.js view, a few beginner questions -

can please explain, life cycle of view (controller), say, row in todo list app? app.rowview = backbone.view.extend({ events:{ "click #del" : "delrow" } }); most of tutorials, appview this: render: function() { this.collection.each(this.renderrow, this); return this; }, renderrow: function(row) { var rowview = new app.rowview({model:element}); this.$('#rows').append(rowview.render().el); } questions: does mean rowview used once , disposed in renderrow() ? or live on? if true, when kill view? adding listener model.destroy , invoke remove() @ view enough? if have row's markup rendered server, click #del events still captured , w/o rowview created? shouldn't 'click #del' better located in parent view, jquery can delegate , attach behavior there? does mean have 1 rowview per row? wouldn't mean _.template being compiled on every row? alternative?...

Should analytics be used for on-site statistics? -

i own video streaming website , have simple hit counter each video. want have more full-featured video statistics diplayed. initial thought log each hit in database on server, realised google analytics (ga) had data needed, plus loads of aggregation tools. here's pros , cons can think using ga api: pros easier lots of ways of viewing data cons less customisation (not of problem) delays in dipsplaying data on site (depending on frequency of api calls) the delays in getting data quite problem since want list "most viewed videos today" , possibly "most viewed videos in past hour". would best use ga or home-baked solution? analytics offers lot of customization can, taking case example, using javascript, track downloads custom events can associate id , numerical data. it seems appropriate. reference : https://developers.google.com/analytics/devguides/collection/gajs/eventtrackerguide implementing dedicated part of tools costly ,...

c++ - Type 'GLchar' could not be resolved -

i'm using eclipse, mingw, , have compiled freeglut , glew , copied libraries, dlls, , header files proper locations (mingw/include/gl, mingw/lib, windows/syswow64). have linked libraries (freeglut64, opengl32, glew32, glu32) in eclipse under mingw c++ linker. here code... --chargame.cpp-- #include <stdlib.h> #include <stdio.h> #include <string.h> #include <gl/glew.h> #include <gl/freeglut.h> #include "chargame.h" #define window_title "chargame" int currentwidth = 800, currentheight = 600, windowhandle = 0; unsigned framecount = 0; gluint vertexshaderid, fragmentshaderid, programid, vaoid, vboid, colorbufferid; int main(int argc, char* argv[]) { initialize(argc, argv); glutmainloop(); exit(exit_success); } const glchar* vertexshader = { "#version 400\n"\ "layout(location=0) in vec4 in_position;\n"\ "layout(location=1) in vec4 in_color;\n"\ ...

java - char array to int array -

i'm trying convert string array of integers perform math operations on them. i'm having trouble following bit of code: string raw = "1233983543587325318"; char[] list = new char[raw.length()]; list = raw.tochararray(); int[] num = new int[raw.length()]; (int = 0; < raw.length(); i++){ num[i] = (int[])list[i]; } system.out.println(num); this giving me "inconvertible types" error, required: int[] found: char have tried other ways character.getnumericvalue , assigning directly, without modification. in situations, outputs same garbage "[i@41ed8741", no matter method of conversion use or (!) value of string is. have unicode conversion? there number of issues solution. first loop condition i > raw.length() wrong - loops never executed - thecondition should i < raw.length() the second cast. you're attempting cast integer array. in fact since result char don't have cast int - conversion done automatically. conve...

Rails uploading multiple photos onto Amazon S3 -

i use paperclip gem attach photos onto models in project. however, have blog model use multiple photos per instance of blog. i'm looking solution can upload photos folder on amazon s3 , refer these photos later using html anchor tags. don't want attach photos model. any suggestions? i haven't done myself, solution here http://amazon.rubyforge.org/ believe paperclip uses behind hood.

MySQL Stored Procedure Conditional Statement -

can me on how have conditional statement on mysql stored procedure? i have sample query, if stored procedure parameter isfirsttask = true use left join else use inner join select * jobdetails jd inner join taskslogs tl on jd.jobid = tl.jobid; the question how change inner join left join without repeating whole query replace 1 word. assuming query bulk. possible? idea please. select * jobdetails jd left join taskslogs tl on jd.jobid=tl.jobid if(isfirsttask = true, true, tl.jobid not null);

sql - Trim spaces from values in MySQL table -

i want update values in table trimming leading , trailing spaces. have tried following queries neither worked. i know possible use trim select, how can use update? updates teams set name = trim(name) updates teams set name = trim(leading ' ' trailing ' ' name) you not have select . try - update teams set name = trim(name) 1 = 1;

javascript - How to display a input button and close the current window -

i have call service using ajax, if goes on ajax call enable or display input (maybe in div?) on page when clicked close current window. best way using javascript? here function of javascript class: myfunction.prototype.init = function(param1, param2) { this.myparams = new hash(); this.myparams.set("param1", param1); this.myparams.set("param2", param2); new ajax.request('myservice.asmx/myservicefunction', { method: 'post', onsuccess: //how can mentioned here?, onfailure: failurefunc, onexception: ajaxerror, parameters: this.myparams }); } any appreciated on onsuccess part have put this: onsuccess: function() { $('div_to_show').show(); } in html part have this: <div id="div_to_show"> <input type="button" name="close" id="close" value="close" onclick="javascript:window.close();" /> ...

Google Plus API getActivities JSON -

i think unofficial api google+ retrieve json without apikey doesn't work anymore :( used link retrieve posts : https://plus.google.com/_/stream/getactivities/?sp=[1,2,"profile_id",null,null,100,null,"social.google.com",[]] but 1 post works : https://plus.google.com/u/0/_/stream/getactivity/profile_id?updateid=post_id is there workaround ? ^^ thanks lot!

xamarin.android - Mono for android : using Facebook binding -

i'm trying use facebook sdk api binding (https://github.com/xamarin/monodroid-samples/tree/master/facebook) the bindings works if set package name in manifest com.facebook.android. if don't this, exception when launch login dialog (noclassdeffounderror: com.facebook.android.r$drawable). dialog tries load resource com.facebook.android package. is there way workaround this? application cannot use com.facebook.android package name, because must unique. i had same issue, resolved bit differently. after importing project, go project properties > android > , scroll down "library" package "com.facebook.android" should listed there, select , click on "apply" , "ok". build r.java facebook api, api generates dialog r.java required. if dont see package said above, project added external jar. list under "referenced libraries" in explorer. just import project , follow mentioned above.

javascript - Capture embedded variable from jQuery Ajax call -

i'm trying convert our current javascript framework jquery cause we'll need additional functionality of jquery further projects. there 1 particular function on place (and setup how setup......) i'd override jquery equivalent. here's original javascript function makes ajax call php page. function ajax(n,f,v){ var ajaxrequest; if(window.xmlhttprequest){// code ie7+, firefox, chrome, opera, safari ajaxrequest=new xmlhttprequest(); } else{// code ie6, ie5 ajaxrequest=new activexobject("microsoft.xmlhttp"); } ajaxrequest.onreadystatechange=function(){ if(ajaxrequest.readystate==4 && ajaxrequest.status==200){ //this result stored result = ajaxrequest.responsetext; //parsescript pulls out content , div , populates div retrieved content. parsed_result = parsescript(result); document.getelementbyid(parsed_result.div).innerhtml = parsed_result.sourc...

python - No content in django HttpResponseBadRequest -

i'm trying organize error messages returned django application, , having problems subclasses of httpresponsebadrequest objects having empty content: in views.py: class httpnocontentavailable(django.http.httpresponsebadrequest): content = "must add content before making request." def get_content(request, project_id): project = project.objects.get(pk=project_id) if not project.has_content(): return httpnocontentavailable() ... it works following: def get_content(request, project_id): project = project.objects.get(pk=project_id) if not project.has_content(): return httpnocontentavailable("must add content before making request.") ... in application, there many views need return same 400 response depending on whether or not there content, , i'd keep response content stored in 1 place. make matters more "interesting," unit tests running on development server pass -- http 400 responses correct co...

Syncing with SQLite database and Android Calendar -

i have rather complex question regarding syncing data between application's sqlite database, user's calendar s, , webserver. this behavior need: onresume() : any modified event s on calendar on account result in update in application's sqlite database. (only account 's user specifies, of course). what i'm doing write updating every entry in sqlite database each calendar event, whether it's been updated or not in onresume() . is, of course, not ideal. i'm able pull events application's sqlite database, , sync between database , webserver. main issue syncing between sqlite database , calendar . my research , i've read can write dirty flag on calendar if implement own syncadapter . require me implement contentprovider , avoid. questions are: is there reliable method seeing modified calendar events without implementing syncadapter? if not, garaunteed i'll able maintain own dirty flag application? know google uses dirty ...

HTML Layout Scrolling Divs -

this page referring to: http://searchleaf.com/v2/search_2.php i have floating div in middle of page 'content' div. inside of have 3 divs, 'contentboxes', side side, each taking 33% of space. when search first contentbox, returns results , second content box becomes visible. there, when click on word, third contentbox becomes visible more information. my problem when page shrunk, or there lot of information 1 word, second , third boxes bleed on main content box. have looked @ css's overflow property can't seem how it. should never bleed on main content box. what happens overflow set auto on main content box: scroll bar shows , scrolls entire content area. what want happen: scrollbar given each conentbox needed. here simple html layout example of problem, might easier: http://searchleaf.com/v2/layout.html when overflow property changed in .content auto. whole thing scrolls. how can scroll third box? thanks, bryce your problem might w...

primary key - Mysql Myisam re-using auto-incremented ids that are deleted -

i have table: test id int(10) auto-increment name char(36) now let whole table filled id 1000 => max unique id number. id 1 - 1000 = deleted previously. question 1; mysql re-use these deleted id's? question 2; if not, how go having auto-increment or whatever re-use unique identifier not exist in table? the reason asking, table consist of alot of entries, , alot of entries deleted time. happens when "run-out-of-id" when using auto-increment? thanks enlightment on :) -tom will mysql re-use these deleted id's? when mysqld starts, determines next value every auto_increment column finding maximum of incumbent records (and adding 1). therefore, if delete record highest value , restart server, deleted id indeed reused. otherwise, values reused if manually alter next auto_increment value (this not recommended not concurrency-safe): alter table foo auto_increment = 12345; if not, how go having auto-increment or whatever re-use u...

Jumping to a particular node in adobe Flex Tree -

i have flee tree inside canvas component , colapse tree , want click button brings me particlue node in tree. need expand tree can having issues setting focus particluar node in tree. tree binded xmlcollection. this code calling not work. pass id value , open tree , nothing gets selected var _ialbum_id:string = photoslist.selecteditem.album_id; (var i:int = 0; < treemyalbums.dataprovider.length; ++) { treemyalbums.expandchildrenof(treemyalbums.dataprovider[i], true) } var node:xml = xmlmyalbums.descendants("node").(@album_id == _ialbum_id)[0]; treemyalbums.selecteditem = node; you might want check if 'node' same object present in dataprovider of tree. if not pointing same object in memory, not work. can check debugger. if case, need find 'node' object in dataprovider doing checks on 1 or more unique properties , use other object set selecteditem property.

android - Use different typefaces for the same TextView with HTL formatting -

Image
i know how specify custom typeface textview. of now, application using 1 custom font, splitted in 2 ttf files. 1 regular characters , toher 1 bold characters. now, able use both inone textview html.fromhtml(). works system fonts, should able own typeface. currently, bold characters drawn regular font , fake bold text text paint quite ugly. any idea ? thanks if want use multiple custom fonts within single textview: use following code:(i'm using bangla , tamil font) textview txt = (textview) findviewbyid(r.id.custom_fonts); txt.settextsize(30); typeface font = typeface.createfromasset(getassets(), "akshar.ttf"); typeface font2 = typeface.createfromasset(getassets(), "bangla.ttf"); spannablestringbuilder ss = new spannablestringbuilder("আমারநல்வரவு"); ss.setspan (new customtypefacespan("", font2), 0, 4,spanned.span_exclusive_inclusive); ss.setspan (new customtypefacesp...

Why PlotLegend is an unknown option in Mathematica 6.0? -

i want have plotlegend in top-right corner of plot, option not work. how can add plotlegend plot ? should buy mathematica 8? u=sech[x]; w=cos[x]; v=sin[x]^2; plot[{u,w,v},{x,-5,5},plotstyle->{automatic,dashed,dotdashed}, plotlegend->{"sech[x]","cos[x]","sin[x]"}] plotlegend has (at least since 2.2) been loaded through add-on package. upgrade if want, loading legends using needs["plotlegends`"] should trick.

objective c - how can i change position of object correctly? -

i use function in loop calculate new position of object: ...some code.... (int = self.frame.origin.x; <= 710; ++i) { cgpoint newp = cgpointmake(i, 1); float posy = * pow((newp.x - w.x),2) - w.y; cgpoint result = cgpointmake(i, posy); [nsthread sleepfortimeinterval:1]; self.frame = cgrectmake(result.x, result.y, self.frame.size.width, self.frame.size.height); nslog(@"[%f, %f]", result.x, result.y); } , object still in place. console print: 2012-06-04 23:13:19.183 pert estimator[326:707] [304.000000, 169.499985] 2012-06-04 23:13:20.195 pert estimator[326:707] [305.000000, 165.172806] 2012-06-04 23:13:21.197 pert estimator[326:707] [306.000000, 160.856293] 2012-06-04 23:13:22.200 pert estimator[326:707] [307.000000, 156.550461] 2012-06-04 23:13:23.225 pert estimator[326:707] [308.000000, 152.255295] 2012-06-04 23:13:24.265 pert estimator[326:707] [309.000000, 147.970810] etc... what's wrong? wow, should using animation bl...

.htaccess - <http:// to http://www.> and <https:// to https://www.> -

there not say, because wanna try explain easy. is there way create .htaccess these things: example.com > http://www. example.com http:// example.com > http:// www. example.com https:// example.com > https:// www. example.com what mean like: if http, goes http + www if https goes https + www if nothing in front of domain, goes http + www i've tried make work code: rewritecond %{http_host} ^[^.]+\.[^.]+$ rewriterule ^(.*) http://www.%{http_host}/$1 [r=301] that code works, thing wrong it, when https:// example.com redirects http:// www. example.com if doesn't work, can write separate rule https , http: rewritecond %{https} !on rewritecond %{http_host} !^www\. [nc] rewriterule ^(.*)$ http://www.xplayrs.com/$1 [l] rewritecond %{https} on rewritecond %{http_host} !^www\. [nc] rewriterule ^(.*)$ https://www.xplayrs.com/$1 [l]

PHP/or mysql messing up my insert -

possible duplicate: charset issue mysql so have mysql string has of these characters in it: , ? “so” ‘so’ : ; ! @ # $ % ^ & * ( ) { } [ ] \ < > . / ` ~ ¨ ° ¯ ¡ ¢ £ § ¸ ´ when inserted database via php command mysql_query of characters show incorrectly. instance, “so” becomes â€Å“so†however, when print out query , run hand in phpmyadmin, works correctly. correct way insert these characters database don't mangled? use command before run insert query: mysql_query('set names utf8');

jquery - Using PhoneGap, can't load local .html file using Ajax on Android only -

i'm using phonegap (latest), jquery 1.7. i'm having troubles getting html loaded via ajax div. problem simple, have index.html file in www/ directory. , js file this: $.ajax({ type:"get", timeout:10000, datatype: "html", async: false, cache: false, url: "file:///android_asset/www/_liqui-cult.html", success: function(data) { $('#data_details .description').html(data); // never runs }, error: function(xhr,msg){ alert(xhr.status + ", " + msg); if(xhr.status == 0 || xhr.status == "0"){ alert(xhr.responsetext); // blank, if runs } } }); having spent day googling error, i've tried numerous things, ajax call never succeeds. i've tried changing url simply, _liqui-cult.html (without file:// -based url). i've tried /_liqui-cult.html . i started out trying jquery $.load , , wasn't working, switched more verbose $.ajax call. no matter do, either 404 status, or, if change ur...

jquery - Change background color of div when checkbox is clicked -

i have form several checkboxes, this: <div><input type='checkbox' name='groupid' value='1'>1</div> <div><input type='checkbox' name='groupid' value='2'>2</div> <div><input type='checkbox' name='groupid' value='3'>3</div> what i'm trying when checkbox checked, change background color of div, , when it's unchecked, remove background color. how can using jquery? thanks jquery: $("input[type='checkbox']").change(function(){ if($(this).is(":checked")){ $(this).parent().addclass("redbackground"); }else{ $(this).parent().removeclass("redbackground"); } }); css: .redbackground{ background-color: red; } i'd recommend using add/remove class, opposed changing css of parent div directly. demo: http://jsfiddle.net/ujcb7/

java - EJB 3.1 @LocalBean vs no annotation -

i understand difference between local view, remote view , no-interface view. don't understand difference between "no view" (no annotation) , no-interface view. , why should annotate interface @local ? if don't annotate interface in @ all, there difference? the rules (from memory): bean has @localbean annotation -> bean has no-interface view bean has @local annotation -> bean has local view bean has @remote annotation -> bean has remote view bean has no view annotations, directly implements interface has @local annotation -> bean has local view bean has no view annotations, directly implements interface has @remote annotation -> bean has remote view bean has no view annotations, directly implements interface has no view annotations -> bean has local view bean has no view annotations, , implements no interfaces -> bean has no-interface view so, using @localbean , using no annotation @ both ways of getting no-interface vi...

Activity annotation for Android -

there isn't monodroid [acitvity()] attribute/annotation android java sdk? while not strange thing in java (for example webservlet annotation) not possible have in android java sdk? in fact, tired of editing androidmanifest.xml! all of activities must, in fact, declared in manifest. haven't seen way around far. of course, imagine sort of tool did post processing on application (via eclipse or that) , generated manifest you. however, haven't seen such thing, , doubt such thing exists. instead, people typically declare them in manifest (it takes few seconds @ most), or create them in eclipse , let "dirty work."

java - Multiple Log4j.properties files in classpath -

how log4j manages multiple log4j.properties in classpath? log4j.properties file takes precedence? let me describe exact scenario. i have multiple maven modules developed different teams , each 1 of them has own log4j.properties file. of these log4j.properties file have rootlogger configured along consoleappender , fileappenders. now, when log4j loads log4j.properties file use configure rootlogger settings ? also, how log4j create logger hierarchy ? how log4j.properties file in other 3rd party jars affect logging process ? the first file in classpath loaded. if a.jar , b.jar both contain file, , a.jar comes before b.jar in classpath, a.jar's file loaded. that's how class loader works.

database - Element-wise quotient of two columns in SQL -

how can combine columns returned 2 select statements give element-wise quotient? query 1: select count(*) count table1 col2 = 1 , col3 > 5 group col4 order col4 query 2: select count(*) count table1 col2 = 1 group col4 order col4 so if return like: query 1 query 2 count count ----------------------- 1 5 2 4 i get: quotient ------- 0.2 0.5 with 4-column version of question, can assume quotient between groups same value in col4 . so, answer becomes: select col4, sum(case when col3 > 5 1 else 0 end) / count(*) quotient table1 col2 = 1 group col4; i've retained col4 in output because don't think ratios (quotients) useful without identify quotient associated values, though theoretically, answer doesn't want column in output.

java - Converting regex query to English keyword query -

i trying convert regex query keyword query, such keyword query gives me superset of regex query. example "host. " can convert "host " "host ((?10\.6\.2*)) chuckn*" can convert "host *", "10 6 ", "chuck " "host.* registered.+" can convert "host*", "registered*" "10\.64\.2*" can convert "10 64 *" for looking regex tree leaf elements can combined keyword query. trying access data structure inside pattern class in java used store regex. please let me know how done or if there other way. system.out.println( ( "host." + "\nhost ((?10\\.6\\.2*)) chuckn*" + "\nhost.* registered.+" + "\n10\\.64\\.2*" ) .replaceall("(.?\\*)", "*") .replaceall("\\.\\+", "*") .replaceall("\\\\.", " ") .replacea...

python - Django maximum recursion depth exceeded decimal -

i'm struggling try , figure out why post_save function returning: exception type: runtimeerror exception value: maximum recursion depth exceeded here code: #post save functions of order def orderps(sender, instance=false, **kwargs): if instance.reference none: instance.reference = str(friendly_id.encode(instance.id)) #now update amounts order items total = 0 tax = 0 #oi = orderitem.objects.filter(order=instance) #for in oi.all(): # total += i.total # tax += i.total_tax instance.total = total instance.tax = tax instance.save() #connect signal post_save.connect(orderps, sender=order) i've commented out order items code now. instance.total , instance.tax model decimal fields. it seems post_save function in endless loop, not sure why i've used same format of post_save functions. any ideas? you calling instance.save() in post save signal triggering recursively. all edited fields in...

Flash Media Server admin API connection reset -

i'm trying server stats off fms admin api this: http://example.com:1111/admin/getiostats?auser=xxx&apswd=yyy i have api commands enabled in users.xml config. when use bad user name or password, xml error response, expected. when use correct user name or password, "connection reset" error ("the connection server reset while page loading.") my security group on ec2 should correct, because url works fine on dev fms box in same security group. i looked @ apache logs , fms logs , don't see trace of admin requests, must looking in wrong place. so, 3 questions: what's serving admin api on :1111? apache? where admin api access , error logs? what's causing connection reset errors? for reference in case people run same problem: connection reset errors because need enable api access on http in 3 different places. if conf/fms.ini file default, sure include this: users.httpcommand_allow = true then in in conf/users....

c++ - How to convert endianness- as array of bits -

i'm looking convert value little-endian big-endian (and vice versa). have value expressed array of bits, rather single integer. how can implement endianness swap function? i'm not c++ person, i'm going generically. to convert big endian little endian reverse bytes. is, segment of 8 bits. so if have array of n bytes (pseudocoded here): bool bits[8*n]; you this: for(int = 0; < n/2; i++) { for(int j = 0; j < 8; j++) { bool tmp = bits[8*i+j]; bits[8*i+j] = bits[8*(n-i-1)+j]; bits[8*(n-i-1)+j] = tmp; } } in comments, mentioned "bits" pointers expressions evaluated correct bits later. changing order of pointers in fashion yield correct change of endian-ness when later bits.

opengl es - Translate ortographic to perspective -

i have 2 points describe line, problem know coordinates of 1 orthographic matrix (ie 150x250x0), , coordinates second perspective matrix (0.5x0.5x20.0f). translate orthographic coordinates perspective can draw line using glsl shader :). how accomplish task? you need move 1 of vertices other matrix space. example let's move 150x250x0 orthographic perspective space. need transform vertex inverted orthographic matrix. don't know math library use, maybe has function matrix inversion. otherwise use code link: http://www.gamedev.net/topic/180189-matrix-inverse/ . after step vertex in world space. ps: matrix inversion takes significant time calculations. if can track trasformations steps (translation, rotation , scale) easier way should invert these steps separately , compose matrix after that.

C# .net protocol buffers - protobuf-net support for serializing dictionary of object values? -

i'm new protocol buffers , using protobuf-net vs2010. i'm reading here dictionary in protocol buffers , doesn't seem protobuf can serialize dictionary object types values. here on site read this: notes on types supported: custom classes that: marked data-contract have parameterless constructor silverlight: public many common primitives etc single dimension arrays: t[] list / ilist dictionary / idictionary type implements ienumerable , has add(t) method code assumes types mutable around elected members. accordingly, custom structs not supported, since should immutable. which seems supported. i can compile list of objects so: message valuesobject { optional int32 someval = 1; repeated someclass listofsomeclasstypes = 2; } this works fine list<someclass> . why cannot serialize using protobuf-net dictionary<int, someclass> ? message serialize dictionary<int, someclass> ? a dictionary<int,someclass...

Apache POI Export Date Time data -

i'm tryng create xls file date values.i run apache quick-guide example when open xls file withoffice 2002(2003), values custom type (not date type)! http://poi.apache.org/hssf/quick-guide.html#createdatecellshow can create date cells? does body know how can export date value directly?

android - How to override the getItemId(int pos) method from CursorAdapter? -

i getting question due answer on here, didn't explain how asking how id of row in onitemclick(listview) when using custom adapter? the answer accepted in question need since making own custom adapter (cursoradapter), hence have same problem. problem have no idea how accomplish that. looking @ doc, , not sure how access _id column cursor. since doc doesn't have constant can info i'm stuck. figuring out appreciated. edit: not clear on question was, clarify, title, how can override getitemid() method in cursoradapter custom class created? assuming don't have cursor member of adapter: @override public long getitemid(int position) { cursor cursor = getcursor(); cursor.movetoposition(position); return cursor.getlong(mcursor.getcolumnindex("_id")); }

php - Iframes not loading in Firefox -

i have web page multiple iframes. these ifrmaes trying load web forms. problem is, these forms not loading in firefox working fine in ie8 , chrome. any idea abut problem ? following fragment of code. is, creating multiple iframes dynamically. foreach ($references $key => $reference) { <iframe scrolling='no' onload='javascript:resizeiframe(this);' id="refform_<?php echo $reference->getrecruitmentreferenceformdata()->getid(); ?>" style="display:block;margin-left:auto;margin-right:auto;" src="<?php echo url_for('recruitment/viewreferenceform') . '?id=' . $reference->getrecruitmentreferenceformdata()->getid(); ?>" id="rightmenu" name="rightmenu" height="1000px" frameborder="0"></iframe> <?php } function resizeiframe(obj) { var size = obj.contentwindow.document.body.offseth...

Programatically convert OneNote sections to XPS -

i need way programatically convert onenote sections files (.one) xps format. know how works excel , word, interop.onenote different. solution? thanks lot. you use publish function ( http://msdn.microsoft.com/en-us/library/gg649853.aspx ), e.g.: using microsoft.office.interop.onenote; ... application onapp = new application(); string sectionid = "your section id here..."; //could page or notebook id string path = "your filepath here..."; //e.g. c:\users\myusername\documents\hi.xps onapp.publish(sectionid, path, publishformat.pfxps);

web services - Is it necessary to define AnnotationMethodHandlerAdapter if i remove <mvc:annotation-driven>? -

as mentioned in http://static.springsource.org/spring/docs/3.0.x/spring-framework-reference/html/mvc.html spring 3 introduces mvc xml configuration namespace simplifies setup of spring mvc inside web application. instead of registering low-level beans such annotationmethodhandleradapter, can use namespace , higher-level constructs. preferred unless require finer-grained control of configuration @ bean level. i have used custom defaultannotationhandlermapping , need remove </mvc:annotation-driven> xml config avoid override of configuration </mvc:annotation-driven> . is necessary declare bean annotationmethodhandleradapter or set default ? please suggest.

android - Canvas doesn't draw bitmap when a ColorMatrixColorFilter is used -

i having difficulties using colormatrixcolorfilter modify color pixels in bitmap. if use bitmap local file system (a jpg), works. however, if use bitmap created buffer, nothing drawn on canvas. in particular, i'm using following code create colormatrix: float matrix[] = new float[] { 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0 }; rbswap = new colormatrix(matrix); paint = new paint(paint.filter_bitmap_flag); paint.setcolorfilter(new colormatrixcolorfilter(rbswap)); the above used create colormatrixcolorfilter used swap red , blue colors. if create bitmap using following code, works: bitmap = bitmapfactory.decoderesource(context.getresources(), r.drawable.picture); if create bitmap using following code, nothing ever drawn canvas: bitmap = bitmap.createbitmap((int) width, (int) height, bitmap.config.argb_8888); srcbuffer = bytebuffer.wrap(data); srcbuffer.rewind(); ...

c# - How to manage adding and removing specific items from collection with multiple threads? -

i have many threads can add items collection , remove specific items collection on condition. in first project, readers more writers. in second project, readers may more writers or equal or less. how should manage add/remove collection? what collection use? simple list blocking on add/remove? which blocking mechanism use( lock , readerwriterlockslim ,...)? you can use data structures namespace system.collections.concurrent . encapsulate 3 aspects mentioned , can used concurrent threads without explicit locking. see: system.collections.concurrent namespace @ msdn for example concurrentbag<t> has icollection interface , thread-safe implementation, optimized scenarios same thread both producing , consuming data stored in bag. if need quick object lookup might use concurrentdictionary<tkey, tvalue> .

sql server - Custom dynamic paging using stored procedure in asp.net -

create procedure [dbo].[sp_getpagewisedata] ( @tablename sysname, @ordercolumn nvarchar(100), @pageindex int = 1, @pagesize int = 10, @recordcount varchar(10) output ) begin set nocount on; declare @query varchar(2000), @minimumindex varchar(5), @maximumindex varchar(5) set @minimumindex=convert(varchar,(@pageindex - 1) * @pagesize + 1) set @maximumindex=convert(varchar,@pageindex * @pagesize) set @query='select row_number() over(order ' + @ordercolumn + ' asc)as rownumber,* #results ' + @tablename + '; select ' + @recordcount + '=count(*) #results; select * #results rownumber between ' + @minimumindex + ' , ' + @maximumindex + '; drop table #results' exec (@query) end here problem when procedure executed, output parameter @recordcount shows null value. why? please explain. thanks your query must this: set @query='select row_number() ove...

backbone.js - From Rails devise auth to backbone & api? -

i want rebuild app typical rails 3.2 mvc app api + frontend (backbone) only. have no experience in building apis in rails including authenticatin: what's best way authenticate devise using backbone? using auth_tokens? how should make api? printing out json or use gem grape? thanks in advance! i can explain way : first, install standard rails application devise. after that, create own session controller : class sessionscontroller < applicationcontroller def authenticate # method logs in , returns single_access_token token authentication. @user = user.find_for_authentication(:email => params[:user][:email]) if @user && @user.valid_password?(params[:user][:password]) render :json => {:user => {:email => @user.email, :id => @user.id, :firsname => @user.firstname, :lastname => @user.lastname, :team_id => @user.team_id, :singleaccesstoken => @user.generate_access_token}} else render :json => ...

Javascript Regex for colon? -

i'm wondering how can use javascript regex match word like: name: with variations of spaces ? i'm getting stuck. i.e. name<space>: fred name:<space>fred or name<space>:<space>fred note positioning of spaces after name, after colon etc ? i hoping /(name(\s*:\s*)?)\w/g work doesn't :( name starts capital letter. regex should match name starting capital n. if want entire regex case insensitive, add i flag @ end. if want name start lower or upper case n, use set the * means 0 or more. ? not needed anymore. something should work /name\s*:\s*\w*/g //matches "name" /[nn]ame\s*:\s*\w*/g //matches "name" or "name" /name\s*:\s*\w*/gi //the entire regex case insensitive