Posts

Showing posts from January, 2010

.htaccess - add www to htaccess for contextdependant urls -

i know his rewriteengine on rewritecond %{http_host} ^yourdomain\.net$ rewriterule (.*) http://www.yourdomain.net/$1 [r=301,l] however, not know beforehand domainname (it can 1 of 30). possible make yourdomain.com variable matches 30 possible domains? you don't need match 30 domains: rewriteengine on rewritecond %{http_host} !^www\. [nc] rewriterule (.*) http://www.%{http_host}/$1 [r=301,l]

Analytics for Google Calendar? -

i need find out how many people use public google calendar , unable find way of integrating analytics. possible? if have website there way this, takes little coding. go calendar settings , find "embed calendar", embed in website copy/pasting embed code. install google analytics on website , track views page calendar. this may not work, depending on how share public calendar...

java - Which class is equivalent to the Javascript's object window.document in GWT? -

i building extention first gets window associated httprequest explained here . there div element in document has src external website. cancel request , associated window. want fill window's doc string "hello world". using following in javascript (jsni) works (ie, replaces string data external source be): window.document.write("hello world"); but need in java rather through jsni. i tried using class document pass object making call jsni as: @[package].[class]::populatebox(lcom/google/gwt/dom/client/document)(window.document); the method defined as: public static void populatebox(document doc){ doc.getbody().setinnerhtml("hello world); } this code rather replacing text @ div request loaded replaces top level body of html document. what problem here? document wrong class use here? there no problem code: window.document donates th document . doc.getbody() complete body of document. doc.getbody().setinnerhtml("...

forms - List element content by class with jquery -

i have several forms created dynamically using php. list fields mandatory above each form. t should this: <div class="mandatory_list">mandatory fields: first name, email</div> <form> <label>first name*</label><input type="text" /> <label>last name</label><input type="text" /> <label>email*</label><input type="text" /> <label>comments</label><input type="text" /> </form> if simplify things can give mandatory labels seperate class. came far: <script> var mandatory= ( $("label:contains('*')").text() ); $('#mandatory_list').html("mandatory fields: " + mandatory); </script> this gives me following output: "mandatory fields: first name *email *". mean had replace asterisks comma's. there's better way go this. i think easier class on mandatory fields, p...

Facebook API sometimes doesn't load -

i'm having problem when using $facebook->api('/me','get'); when loading page first time, nothing happen. have reload page again make script work. not sure problem is. require_once('src/facebook.php'); $app_id = "app_id"; $app_secret = "app_secret"; // init facebook api. $facebook = new facebook(array( 'appid' => $app_id, 'secret' => $app_secret, 'cookie' => true, )); //facebook authentication part $user_id = $facebook->getuser(); $loginurl = $facebook->getloginurl( array( 'scope' => 'publish_stream, user_likes' ) ); if (!$user_id) { echo "<script type='text/javascript'>top.location.href = '$loginurl';</script>"; exit; } $user_profile = $facebook->api('/me','get'); $user_gender = $user_profile['gender']; if($user_gender == 'male...

asp.net - How to detect similarities using .Net or SQL Server -

i'm using asp.net 4 , sql server 2008 r2. i know if exist class or tool in database or in .net framework calculating data similarities between 2 string values. what need value in percent indicating similarities between 2 strings, can execute logic based on percentage (like refusing user's input if data similar present in system). any ideas? thanks ps please comment if need more information or question not appropriate. there fuzzy comparison in sql it's not great. instead, use levenstein algorithm has implementation in both sql , c#. http://en.wikipedia.org/wiki/levenshtein_distance or similar approach, wiki page has lot of information.

ruby - Liquid Exception in atom.xml -

i using octopress write blog. did not support tex, sought guidance online. in end, failed use tex&markdown. to make problem worse, following problem occurs: lo@lo:~/blog/octopress$ rake generate ## generating site jekyll unchanged sass/screen.scss unchanged sass/syntax/syntax.scss unchanged sass/bootstrap/responsive.scss unchanged sass/bootstrap/bootstrap.scss configuration /home/lo/blog/octopress/_config.yml building site: source -> public liquid exception: variable '{{' not terminated regexp: /\}\}/ in atom.xml liquid exception: variable '{{' not terminated regexp: /\}\}/ in atom.xml liquid exception: variable '{{' not terminated regexp: /\}\}/ in atom.xml generated site: source -> public lo@lo:~/blog/octopress$` now have no idea how fix it. i tried diff files in /octopress , /octopress.bk . in end, find had used wrong grammars in *.markdown. i wrote \{\{\{ \}\}\} , lead problem. solved it. seems atom.xml file cha...

html - Android - Read news from website -

i'm making android application, need read latest news page (and tab says "nyheder": http://www.stormthebuildingfest.com/ , afterwards, of course, print them out on screen. i've seen different places maybe jsoup problem - jsoup cookbook doesn't seem me. is possible fetch news page? how? or if jsoup - refer me part of cookbook fits problem? http://jsoup.org/cookbook/ thanks in advance. basically, need this: //this line whole page document doc = jsoup.connect("http://www.url.com/section.script").get(); //this other line make sure specific info you're looking elements elems = doc.select("some element"); //or if wanna print out, can system.out.println(doc); //you can print text (without tags, or charset issues) system.out.println(doc.text()) //the .text(); method works variable elements //well. if got info, , want text, that's //the best way go in addition, i'd study jsoup selector api.

string - How can I split very long case patterns across multiple lines? -

how split long valuex string in following bash code? case "$1" in value1|value2|value3|...........more values..................| valuen) some_processing "$@" ;; ... esac i'm looking splitting separate lines. m.b. like: val+=value1 val+=value2 .... thanks in advance from man page: a case command first expands word, , tries match against each pattern in turn, using same matching rules path‐name expansion[.] in other words, it's glob pattern, not regular expression. such, can use ifs between pattern tokens. example: case "$1" in value1 | \ value2 ) : ;; esac note must escape line continuation backslash, unlike usual case pipe symbol continue line automatically. other that, can break line same way @ prompt.

ruby - Sequel: How to use group and count -

simply put, how can query using sequel ? select a.id, count(t.id) albums right join tracks t on t.album_id = a.id group a.id db[:albums___a]. right_join(:tracks___t, :album_id=>:id). select_group(:a__id). select_more{count(:t__id)}

linux - Remove a file from usr/include? -

i trying run program command line in ubuntu , have directory in usr/include/ directory need remove run. how can command line? rm -r /usr/include/... just use that. if need that, there wrong program. if package installed directory, use: sudo apt-get purge package-name all in all, directories directly under /usr under charge of package manager, , if want things without that, use /usr/local dir. changing other programs resources bad idea. also, don't run don't have sudo . end badly. , program require removal of dir in /usr/include ?

mysql with inner query -

i have table stores answer survey , im trying query mysql tell me if survey answered answer field = 16 or 20 i have following mysql statement select distinct(submissionid) submissionid answer exists ( select * answer submissionid = submissionid , (answer = '16' or answer = '20') ) edit here sorry dont think said question right here table structure: create table if not exists `answer` ( `aid` int(11) not null auto_increment, `sid` int(11) not null, `qtid` int(11) not null, `answer` text not null, `userip` text not null, `submissionid` int(11) not null, primary key (`aid`) ) engine=myisam default charset=latin1 auto_increment=422 ; aid unique id every answer given sid survey id (cause may have more 1 survey) qtid questionsid value answer answer user gave qtid of survey userip self explainable submissionid id gave each submission so know in table there 5 unique submissionid's there 1 submssionid answer field...

oracle - Unable to get out of ORA-00907 error -

i getting missing right paranthesis error. if remove comments around iterator.next() statement, working fine. unable figure out whats wrong. there no "(" in data pass. string oracle_sum_query = "select item_number, sum(system_quantity) items " + "where sndate = ? , item_id in" + " (select item_id ap.system_items org_id = 4 " + " , segment1 in "; ...... while (iterator.hasnext()) { //iterator.next(); string oraclequery = string.format(oracle_sum_query + "(%s)) group item_number", iterator.next()); preparedstat = connection.preparestatement(oraclequery); preparedstat.setdate(1, getsndate()); the error seems indicate sql statement building in oraclequery has incorrect number of parenthesis. helpful print sql statement out before passing preparestatement call make debugging easier. my guess string returned iterator.next() not expect.

php - Strange prepared statements error -

here how statement looks like. $stmt = $this->db->prepare(" select q.id questions q left outer join ( select max(chk_date) questions_last_chk_date last_check_date user_id = ? , chk_token=?) lcd on q.add_dt > lcd.questions_last_chk_date q.author_id<>? ") or die($this->db->error); $stmt->bind_param("isi", $_session["userid"], "q", $_session["userid"]) or die($stmt->error); i got 2 questions 1) getting error message fatal error : cannot pass parameter 3 reference why error occurs? btw, know last_check_date table empty think it's not related problem. 2) on windows, getting error message table last_check_date doesn't exist, ...

How to use OpenNTF's "Workflow for XPages"? -

any tips on getting started using "workflow xpages" on opentntf? documentation pretty high-level, , sample app. page 24 1 info using simple workflow engine. i'm digging employeereview.nsf example database, use pointers? one of developers evaluated workflow stuff on last couple of days. unfortunately, cannot share documentation came out result of efforts. way analyse parts of sample application. find simple workflow control und workflow action controls in sample application , take @ source code. see simple workflow control deals persons , roles. roles in context of workflow not acl roles. roles ere defined in configuration ( [manager] ) need have kind of configuration in application contains person name role person has in workflow. if person manager example, have describe, other persons he/she managing. then, in workflow steps describe, in wf state specific person involved, next step , if mail send around. once ayou have done bit of analysis, able create o...

ruby on rails - NoMethodError undefined method `save' for nil:NilClass -

what need fix this? new ruby on rails. error when rspec ran 1) remember token should have nonblank remember token failure/error: before { @user.save } nomethoderror: undefined method `save' nil:nilclass # ./spec/models/user_spec.rb:125:in `block (2 levels) in <top (required)>' user_spec.rb require 'spec_helper' describe user before @user = user.new(name: "example user", email: "user@example.com", password: "foobar", password_confirmation: "foobar") end . . . { should respond_to(:remember_token) } . . . describe "with password that's short" before { @user.password = @user.password_confirmation = "a" * 5 } { should be_invalid } end describe "return value of authenticate method" before { @user.save } let(:found_user) { user.find_by_email(@user.email) } describe "with valid password" { should == found_user.authenticate(@user.password...

insert special characters in URL hash using JavaScript -

i want add hash url. example http://somesite.com/somesubdomain#p1=1&p2=2&p3=3 when try this, is: http://somesite.com/somesubdomain#p1=1%23p2=2%23p3=3 so, in short, how add special characters in url hash. edit: i using yui browser history manager. var hash = "p1=1&p2=2&p3=3" yahoo.util.history.navigate("state",hash); the way you're supposed in yui appears like: yahoo.util.history.navigate('p1','1'); yahoo.util.history.navigate('p2','2'); yahoo.util.history.navigate('p3','3'); if want browser url string http://somesite.com/somesubdomain#p1=1&p2=2&p3=3 the calendar example in docs demonstrates this.

haskell - Functional alternative to caching known "answers" -

i think best way form question example...so, actual reason decided ask because of because of problem 55 on project euler . in problem, asks find number of lychrel numbers below 10,000. in imperative language, list of numbers leading final palindrome, , push numbers list outside of function. check each incoming number see if part of list, , if so, stop test , conclude number not lychrel number. same thing non-lychrel numbers , preceding numbers. i've done before , has worked out nicely. however, seems big hassle implement in haskell without adding bunch of arguments functions hold predecessors, , absolute parent function hold of numbers need store. i'm wondering if there kind of tool i'm missing here, or if there standards way this? i've read haskell kind of "naturally caches" (for example, if wanted define odd numbers odds = filter odd [1..] , refer whenever wanted to, seems complicated when need dynamically add elements list. any suggestions on how ...

javascript - Prevent XSS flaws -

possible duplicate: sanitize/rewrite html on client side i working on html5 , jquery website parse data json files. i have doubt on how prevent prevent xss flaws project , should optimize html5 , javascript don´t have issue xss. xss flaw occurs on sites dynamically generate pages. web sites static pages not vulnerable xss. xss flaws of 3 types. persistent - user input consists of malicious software code gets stored in web application, , gets rendered thereafter in every request read along piece of data. non-persistent - user input consists of malicious code returned in server's response request, doesn't stored in web app specific request. dom-based - not involve web server, local web browser. think looking for. check out this link explanation on xss. avoid xss must perform input validations.

java - How can I find verify the encryption strength of my JDK security Providers? -

i have little program prints out of supported providers in jdk installation wondering if knows how can change program print out "strength" of each of providers? import java.security.provider; import java.security.security; public class securitylistings { public static void main(string[] args) { (provider provider : security.getproviders()) { system.out.println("provider: " + provider.getname()); (provider.service service : provider.getservices()) { system.out.println(" algorithm: " + service.getalgorithm()); } } } } cipher.getmaxallowedkeylength() pass in transformation , return highest allowed key. here easy check public bool isunlimitedkeystrength() { return cipher.getmaxallowedkeylength("aes") == integer.max_value; }

objective c - What is the purpose of the delegate method 'canMoveRowAtIndexPath'? -

i'm working on ui component right now, , behaves uitableview, i'm heavily modeling delegate , data source protocols after of uitableview. however, noticed 1 method don't quite understand- 'canmoverowatindexpath'. this allows delegate specify whether wants given cell 'movable'. however, wouldn't dropping movable cell higher index immovable cell (i.e. 'above' in table) cause indirectly move anyway? (since every cell below moved 1 pushed down 1 row). so basically, question point of method? can provide example use-case it? because i'm debating whether should bother including in component or not. if anything, think perhaps more useful delegate method such 'canmoverowinsection', allow specify whether rows in given section can moved. allow disable reordering of particular section, , moving other rows outside of section not affect ordering of rows inside it. i know apple engineers provided method reason, can't see reason might...

html - Shadowbox YouTube video not appearing on iphone devices -

http://www.execairshare.com/about-us/testimonials has had problems loading youtube video in shadowbox , being unable view on iphone? on other mobile devices works fine on iphone shows blank black box. assuming flash thing? <a href="http://www.youtube.com/v/mf5mpd1ligm" rel="shadowbox:width=680;height=480"> <img src="//i4.ytimg.com/vi/mf5mpd1ligm/default.jpg" alt="thumbnail"> </a> your linking flash version of youtube video. since iphone has no flash doesn't work. you'll need link html5 version of video. try adding '?html5=1' <a href="http://www.youtube.com/v/mf5mpd1ligm?html5=1" rel="shadowbox:width=680;height=480"> <img src="//i4.ytimg.com/vi/mf5mpd1ligm/default.jpg" alt="thumbnail"> </a>

asp.net - Methods for asp:FileUpload object? -

. . i'm trying set <asp:fileupload> object fire on client side after click "browse" , select file. (specifically, want return name of file selected.) however, i'm having hard time trying find correct method. none of server-side methods want (and i'd prefer fire on client-side, anyway), , none of various combinations of client-side methods (onclick, onchange, etc.) seem work. ideas, anyone? thanks! edit: think may have answered own question. ended abandoning asp.net <asp:fileupload> tool, , used lower-tech <input type="file"> instead. methods seem work fine that. edit #2: nothing doing. works fine on client side, have problem of trying save file on server side. guess it's square 1. edit #3: think final answer. changed <asp:fileupload id="fileuploader"> , added fileuploader.attributes.add page_load. sees , fires no problem. of course, i'm getting "object expected" error (beca...

php - Ajax pagination in joomla -

i looking implement ajax based pagination system in joomla. ever tried before? , pointers or suggestions? with joomla cannot navigate away url means of 'get'. prohibits pagination classes working use url modification work(via get). alternatives either post or ajax pagination, , ajax seems easier accomplish , have nicer looking result. any tutorials ive tried havent worked out well. don't know if matters, i'm using mysqli. addfullajax plugin, suggested in previous answer, tries make site "fullajax'd" default. can simple overwrite. here couple simple steps configuration of plugin enable ajax (correctly ahah ;) ) pagination : set "enable positions update" "using fullajax_tmpl" (also not forget install template) in "content css id" need set content id placed content in "advanced options" in "parameters fullajax" field need delete all, , put there next code: function wrappager(){ $$(...

python - MySQLdb execute -

i have searched high , low on site , many others , have found similar questions, none of answers have worked me (usually accounting tuple). i'm writing python script parse html pages , populate database. have working except populating part... here code segment deals mysql database (note: using mysqldb module in python) conn = mysqldb.connect(user="root", passwd="xxxxx",db="nutrients") cur = conn.cursor() test = "canned corn" cur.execute("insert food (name) values (%s)", (test,)) conn.commit() i first testing parsed string wasn't working. gives me 2 errors: traceback (most recent call last): file "c:\python32\lib\site-packages\mysqldb\cursors.py", line 171, in execute r = self._query(query) file "c:\python32\lib\site-packages\mysqldb\cursors.py", line 330, in _query rowcount = self._do_query(q) file "c:\python32\lib\site-packages\mysqldb\cursors.py", line 294, in _do_query ...

php - How to install the wkhtmltopdf shell utility? -

i have dedicated whm / cpanel server root access. i trying install shell utility (wkhtmltopdf) /usr/local/bin/ can call within php using exec. i've got handle on php stuff. new server / sys admin related things. i have checked out instructions on http://code.google.com/p/wkhtmltopdf/ - these assume higher level of knowledge have. i wondering if can explain, complete newbie, how go installing wkhtmltopdf. thanks (in advance) help. depends bit on server , system. have root/sudo access? ubuntu? sudo apt-get install wkhtmltopdf installed me nicely , can symbolic links point executable, depends on environment. kind of broad question, i'll edit answer if want more info it's hard write such generic answer work in case :) perhaps check out how install wkhtmltopdf on linux based (shared hosting) web server

C++ Array vs Vector performance test explanation -

in order quantify difference in performance of c-like array , vectors in c++, wrote little program. https://github.com/rajatkhanduja/benchmarks/blob/master/c%2b%2b/vectorvsarray.cpp to compare them on common grounds, decided test both random , sequential access. added iterators, compare them (but not question focusses on). the results, 64-bit linux machine 7.7 gb ram on array/vector size of 1 million follows:- time taken write array. : 12.0378 ms time taken read array sequentially. : 2.48413 ms time taken read array randomly. : 37.3931 ms time taken write dynamic array. : 11.7458 ms time taken read dynamic array sequentially. : 2.85107 ms time taken read dynamic array randomly. : 36.0579 ms time taken write vector using indices. : 11.3909 ms time taken read vector using indices, sequentially. : 4.09106 ms time taken read vector using indices, randomly. : 39 ms time taken write vector using iterators. : 24.9949 ms time taken read vector using iterators. : 18.8049 ms...

PCRE Regex Syntax -

i guess more or less two-part question, here's basics first: writing php use preg_match_all in variable strings book-ended {}. iterates through each string returned, replaces strings found data mysql query. the first question this: sites out there learn ins , outs of pcre expressions? i've done lot of searching on google, best 1 i've been able find far http://www.regular-expressions.info/ . in opinion, information there not well-organized , since i'd rather not hung having ask whenever need write complex regex, please point me @ couple sites (or couple books!) me not have bother folks in future. the second question this: have regex "/{.*(_){1}(.*(_){1}[a-z]{1}|.*)}/" and need catch instances such {first_name}, {last_name}, {email} , etc. have 3 problems regex. the first sees " {first_name} {last_name} " 1 string, when should see two. i've been able solve checking existence of space, exploding on space. messy, works. the second pro...

ios - Does RubyMotion support integration of objective-c code? -

there ton of libraries/pieces of code have been built in objective-c can rubymotion use these bits without rewriting them in ruby? there couple ways this. 1 vendoring 3rd party code vendor directory , using app.vendor_project method in rakefile . see using 3rd party libraries example. another option using cocoapods . motion-cocoapods ruby gem, can add of libraries here using this: app.pods dependency 'jsonkit' end

java - Checking the key in a Map -

can suggest me why if condition not working in below code record has key siteid. while (!pdsxoutrecords.isempty()) { pdsxrecord record = pdsxoutrecords.remove(0); // below if condition not working if(record.getattrs().containskey("siteid")) { system.out.println("testing"); } } and pdsxrecord class this public class pdsxrecord { private string m_key; private map<pdsxattrkey, pdsxattrvalue> m_mapattrs; } // constructor public pdsxrecord(string key, map<pdsxattrkey, pdsxattrvalue> mapattrs) { m_key = key; m_mapattrs = mapattrs; } public string getkey() { return m_key; } public map<pdsxattrkey, pdsxattrvalue> getattrs() { return m_mapattrs; } below thing gets printed using record.getattrs() {gem.2036=null, gem.2037=null, gem.2038=com.ebay.pdsx.common.pdsxattrvalue@6b306b30, gem.2039=null, gem.10230=null, gem.10117=null, gem.10119=null, gem.10240=null, uid=com.e...

Android Layout Can't get EditText to line up in LinearLayout -

i created layout dialog box. want same width zip code edittext , email edittext edit boxes , want them align left. so should like: email: _ __ _ ___ zipcode: _ __ _ ___ correction: above not showing correctly on stackoverflow. lines above should , left justified. have same display problem on forum. put spaces after email: still not align. instead getting email wider zip code. changed both edittext same input type no luck. if textview has same text align if both zip code:. if pad email text edit spaces layout manager seems know , expand email edittext larger zip code. frustrating! <?xml version="1.0" encoding="utf-8"?> <textview android:id="@+id/messagemsg" android:layout_width="fill_parent" android:layout_height="wrap_content" android:textsize="@dimen/text_21px" android:textcolor="@color/white" android:text="lorum ipsum afasdf lajsdfasldfjald:"...

How to escape wildcard expansion in a variable in bash? -

how escape wildcard expansion in variable name? cp="lib/*" command="java $variables -cp $cp someclass" echo $command echoing command causes wildcard expansion. echo "$command" using quotes prevents glob being expanded. by way, see "i'm trying put command in variable, complex cases fail!"

php - Edit Database After Successful paypal payment -

i've been @ bit now, , have tried using google extensively. i have application set up: hwid system available paid subscribers. i want buyers able click on 'buy button', , once pay automatically adds information database app uses. way there no waiting after payments. i know possible, because i've seen done before - can't seem find how works? i prefer done in php well. basically need use paypal api's - pdt (payment data transfer) ipn (instant payment notification) paypal code samples you specified don't want waiting update records after payments. depending on plans should aware of dangers of assuming payment has been processed (before has). there number of ways either trick system thinking have paid using paypal (when payment failed or trying commit fraud). so if updated records based on return value after paying paypal lead open problems. wouldn't operations specified unless know payment has gone through ok, , how do that?...

git - How to safely change github account name? -

i change github account name, found option in github account settings. however, concerned consequences , know best strategy of name change, considering have projects of own tied account. so far, came plan: change account name in github settings for each project's local folder in '.git / config' file update remote "origin" url new one will work? should there further steps on computer holds project sources? effect of name change on cloned or forked projects on github? thank you! 1.) have change projects remote addresses. can see them via: git remote -v after remove old remote addres: git remote rm git@github.com:old_account/foo.git finally add new remote address: git remote add origin git@github.com:new_account/foo.git 2.) cloned repos break . there no url-redirect or similar. can change local cloned repos, others have point new repo addres(like in step 1) note: github forked repos works without problem.

jquery mobile anchor links in a page -

i link different parts of html page using anchor tags , ids in jquery mobile framework. doesn't seem working in usual html tags. here's code tried. tips appreciated! <div data-role="page"> ... <p> text continues..... <id="1"> more text continues..... <id="2"> more text continues..... <id="3"> more text continues..... <id="4"> more text continues..... </p> ... <a href="#1" data-ajax="false">find #1</a> <a href="#2" data-ajax="false">find #2</a> <a href="#3" data-ajax="false">find #3</a> <a href="#4" data-ajax="false">find #4</a> </div> <id> isn't valid html tag. you should using <a name="one"> anchor, , <a href="#one"> link.

$.AJAX JQUERY/PHP login script with strange will of it's own -

hello fellow programmers! i have annoying problem login script i've built. it's script sends username variable , password variable html form $.ajax (jquery) call check.php file. variables sent keyup function in js. trick there no submit button , user logs in automatically when variables match db. check.php oop multiple methods , when vars match db, php sends json_encode js. want keep script , settings file seperated. when put database settings in check.php file, script works. if try load them externally include @ top, script doesn't work. js: $("#wachtwoord, #gebruikersnaam").keyup(function(){ passnum = $("#wachtwoord").val(); usernum = $("#gebruikersnaam").val(); if(passnum.length > 2 && usernum.length > 2) { $.ajax({ type: "post", url: "classes/check.php", datatype: 'json', data: "gebruikersnaam="+usernum+"...

c# - Hit-testing on entire area of custom FrameworkElement that contains transparent elements -

i've got custom control inherits frameworkelement . contains visual contains transparent areas. i'm trying make entire control area respond hit tests, @ moment, when click on part of control displays transparent area of visual , click passes through underlying layer. is there way of making entire control hit-testable without using hack? i'd stay away techniques painting background of visual white, or adding border around custom control has same event handler set. thanks in advance! simply use transparent brush , respond hit testing. for example, if have null background brush, hit testing pass right through. if use brushes.transparent background or fill area, work hit testing.

Do SVG Fonts work in IE8? -

how svg font work in ie 8? here have single glyph defined , displays in browsers i've tried except ie8 ( link source ): <html> <head> </head> <body> <svg xmlns="http://www.w3.org/2000/svg" xlink="http://www.w3.org/1999/xlink" id="layer_1" enable-background="new 0 0 542 324" space="preserve" viewbox="0 0 542 324" version="1.1" y="0px" x="0px"> <defs> <font id="plainblacknormal" horiz-adv-x="199"> <glyph unicode="!" horiz-adv-x="253" d="m232 798q0 -24 -8 -62t-18 -78t-19.5 -74t-12.5 -50l-5 -25q-3 -11 -5.5 -25t-4 -33t-1.5 -47q0 -33 5 -56l7 -36q2 -13 -0.5 -19t-16.5 -6q-11 0 -23.5 22.5t-24 56t-20 74t-11.5 76.5l20 170q-1 17 -5 37t-11 35t-17.5 21.5t-24.5 -4.5h-16q0 3 -2.5 5t-2.5 5 q0 5 26.5 21t62.5 42q1 0 14 10l28 23q15 13 30 23.5t21 10.5q12 0 23.5 -29t11.5 -88zm238...

iphone - programmatically create new table with ios-core data -

can core data allow me create new table programmatically? or if need need use sqlite directly. thanks from coredata perspective, don't create new tables because database tables 1 possible type of persistence store associated core data model. you can, however, create new core data entities programatically using nsentitydescription class. in nsentitydescription class documentation find this: entity descriptions editable until used object graph manager. allows create or modify them dynamically. however, once description used (when managed object model belongs associated persistent store coordinator), must not (indeed cannot) changed. enforced @ runtime: attempt mutate model or of sub-objects after model associated persistent store coordinator causes exception thrown. if need modify model in use, create copy, modify copy, , discard objects old model. i've never tried modify 1 @ runtime, i'm not sure how works when have existing sqlite persistence store, i...

python - How to match a emoticon in sentence with regular expressions -

i'm using python process weibo (a twitter-like service in china) sentences. there emoticons in sentences, corresponding unicode \ue317 etc. process sentence, need encode sentence gbk, see below: string1_gbk = string1.decode('utf-8').encode('gb2312') there unicodeencodeerror:'gbk' codec can't encode character u'\ue317' i tried \\ue[0-9a-za-z]{3} , did not work. how match these emoticons in sentences? try string1_gbk = string1.decode('utf-8').encode('gb2312', 'replace') should output ? instead of emoticons. python docs - python wiki

tsql - What does [,...n] mean in T-SQL BNF? -

if @ page http://msdn.microsoft.com/en-us/library/ms189499 [,...n] mean? have suspicions it's microsoft's alternative using sequence { } symbols. that nice big link right above syntax block on msdn pages lays out "conventions." [,...n] , has say: indicates preceding item can repeated n number of times. occurrences separated commas.

design - How should you split pages into JSF components? -

i working on jsf web app project external web developers providing (static) html, css & javascript. best way split pages jsf components manage changes design in future. is bad practice leave html pages intact, , add jsf components required dynamic content? (this managing versions) or should entire site split atomic jsf components , follow standard jsf guidelines? what issues think encounter doing this? ideally, external developers able jsf too, , create reusable composite components. but if providing static html & css, must manually convert code reusable components. so, whenever need change layout related, update components , client code up-to-date. also, you'll find ways of reducing code duplication common in stylized html/css. you could, yes, start adding jsf components required, feasible if had 1 page, or if every page did needed different markup , styles. , wouldn't version control, because end having update every 1 of pages whenever need cha...

iphone - Unable to set member variable -

very strange issue. i have following code: nsdictionary* notificationuserinfo = [pnotification userinfo]; nsmanagedobject* newshoppingfilter = [notificationuserinfo valueforkey:@"shoppinglistfilter"]; self.shoppinglistfilter = newshoppingfilter; nslog(@"%@ tapped", [newshoppingfilter valueforkey:@"name"]); for reason self.shoppinglistfilter = newshoppingfilter not setting variable. i assume issue not initializing self.shoppinglistfilter variable in way cannot figure out. nslog shows right output, newshoppingfilter not null self.shoppinglistfilter is. any appreciated. i bet newshoppingfilter nil. likely, there no key "shoppinglistfilter" in notification user info dictionary. set breakpoint @ line assigns value self.shoppinglistfilter , check value of newshoppingfilter. display entire contents of notificationuserinfo. post code creates user info dictionary , passes notification posting. track down problem.

HTML5 integration on Java Frameworks -

i'm developing project, involves studying html5 , j2ee integration. we big part of j2ee frameworks. state of html5 integration frameworks (like spring/struts/jsf)? is there implemented or plans implement it? see features web sockets, web messaging, web workers, etc part of frameworks in near future? best regards

asp.net - .NET Membership Profile consistency before and after user login -

when enable profile in web app, can store info registered users , anonymous visitors. e.g. supposed have "what colour like" textbox @ whatcolourdoyoulike.cshtml or whatcolourdoyoulike.aspx, now before login, anonymous visitor put in "hot pink" , info stored in aspnet_profile table, cool. after logged website registered user, visit same page again , put in "ocean blue". when log off , visit page check colour preference now, however, don't have "ocean blue". come "hot pink". guess what, dig db aspnet_user , aspnet_profile tables, found myself having 2 sets of profiles. 1 profile anonymous me when log off = "hot pink"; second profile registered me when logged in = "ocean blue". i had impression registered/signed up/logged in, .net know same person , merge anonymous profile towards registered user profile. however, turns out not. doing wrong? how keep consistency of profile before , after login? ...

css - Optional non-scrolling header in a fixed-height element -

i have fixed-size box set scroll when overflows. however, has header, , doesn't; , can't figure out way style when header appears. know why happens (the header pushes 100%-height scrolling element down , out of container), can't figure out non-table way fix it. here's fiddle showing problem; , full code archives: html: <div class="fixed-size"> <ul class="scrollable"> <li>one</li> <li>two</li> <li>three</li> <li>four</li> <li>five</li> <li>six</li> <li>seven</li> <li>eight</li> <li>nine</li> <li>ten</li> </ul> </div> <div class="fixed-size"> <div class="stays-at-top"> header </div> <ul class="scrollable"> <li>one</li> <li>two</li> <li>three</li>...

jvm - Case sensitivity of Java class names -

if 1 writes 2 public java classes same case-insensitive name in different directories both classes not usable @ runtime. (i tested on windows, mac , linux several versions of hotspot jvm. not surprised if there other jvms usable simultaneously.) example, if create class named a , 1 named a so: // lowercase/src/testcase/a.java package testcase; public class { public static string mycase() { return "lower"; } } // uppercase/src/testcase/a.java package testcase; public class { public static string mycase() { return "upper"; } } three eclipse projects containing code above available website . if try calling mycase on both classes so: system.out.println(a.mycase()); system.out.println(a.mycase()); the typechecker succeeds, when run class file generate code directly above get: exception in thread "main" java.lang.noclassdeffounderror: testcase/a (wrong name: testcase/a) in java, names in general case sen...

html href to a https. but it doesn't work -

i'm user link https website. this: <a href="https://site/#create/new/?"> but when click on link, cannot direct correct page, instead, direct https://site/#create%2fnew%2f%3f how fix this? help? thanks what adaman saying #create... fragment identifier page /site/index.[html|htm|php] . sure url correct? should following: https://example.com/create/new/ ?

qt - I cant paint QVideoWidget with QPainter -

i trying draw strings while have video palying, subtitle... have phonon::qvideowidget, in constructor do: painter = new qpainter(this); and have overrided paint event this, test: void myvideowidget::paintevent(qpaintevent* event) { painter->drawline(0, 0, 1, 1); //painter-> shows } so when start player see nothing qpainter did, normal video playing ideas? it more common make qpainter local instance in paintevent() function. qpainter painter(this); this results in begin() , end() methods being called automatically. these necessary qpainter work correctly. try calling them manually in paintevent() see if makes difference. another thing might try overlaying text on video create qlabel in code , make video widget parent. not require sub classing video widget or overriding paint event.

jQuery autocomplete populate array on input text -

Image
here's code populate same array given file source; $("#input-search").autocomplete({ source: function(request, response) { $.ajax({ url: "searchlist.igx", data: { name: request.term, maxresults: 10 }, //datatype: "json", type: "get", success: function(data){ response(data); } }); }, select: function(event, ui) { $('#input-search').val(ui.item.value); }, cache: false, }); and here's searchlist.igx populated; [{label:"john doe", value:"0123"},{label:"joshua poe", value:"0124"}] it's view this: how can view populated suggested text autocomplete output view?

Safari jquery ajax redirect -

i making $.ajax call external server. server returns redirect, redirected page returning json. works fine on ff , chrome, safari , opera don't it. here $.ajax code: $.ajax( { url:url, datatype:"json", success:function(data) { console.log("success"); }, complete:function() { console.log("complete"); } }); in firefox , chrome, works - 'success' called each of ajax responses. in safari , opera however, 'success' never called, 'complete'. network requests console gives me following information: resolve.json 302 application/json 1817995.json (canceled) undefined where 1717995.json redirection sent resolve.json. i'm not sure why request being canceled (as seems indicated response). can give assistance on this? imho it's cross-domain (origin) problem. browser doesn't cross browser ajax requests default. should try use jsonp instead of json: da...

android - Styling none actionbar-tabs -

in application i'm using mix of actionbar tabs , "old" tabwidget. have no problems styling actionbar tabs using custom style theme. <style name="mytheme" parent="@android:style/theme.holo"> <item name="android:logo">@drawable/logo</item> <item name="android:actionbartabstyle">@style/myactionbarstyle</item> <item name="android:tabwidgetstyle">@style/mytabstyle</item> </style> the tabwidgetstyle doesn't seem have same effect on "old" tabwidget though. i've been trying change blue bottom tab-indicator color red without success. have tips on how this? have create separate tab class , use tab indicator? thanks.

javascript - Progress bar element breaking Chrome rendering (unless Dev Tools open) -

updated add fiddle: http://jsfiddle.net/wvuqy/6/ i have page_action in chrome parses response xhr make menu of video clips download. there <span class="status"> each clip defaults blank, shows "pending" when queued, , changes either "interrupted" (in red) or "complete" depending on how download stops. these behaviors, , updating <span class="status"> percentage of download complete progressed work fine. i tried swap out displaying percentage string <progress> bar instead, introduce element document, start getting rendering problems only when i'm not using chrome dev tools. here's 2min video of odd behavior in action: http://www.youtube.com/watch?v=m50f5ly93mm the fiddle link @ top output console periodically (every 5s) changes display property <span> , <progress> elements, never appear. if comment out line subdiv.appendchild('progressbar') , change nothing else, behavior o...

iphone - iCarousel's index -

how determine index of carousel?. or array's index loaded in it?. have loaded image nsdocumentdirectory. self.myimages = [nsmutablearray new]; for(int = 1; <= 30; i++) { nsarray *paths = nssearchpathfordirectoriesindomains(nsdocumentdirectory, nsuserdomainmask, yes); nsstring *documentsdir = [paths objectatindex:0]; nsstring *savedimagepath = [documentsdir stringbyappendingpathcomponent:[nsstring stringwithformat:@"myimages%d.png", i]]; if([[nsfilemanager defaultmanager] fileexistsatpath:savedimagepath]){ [images addobject:[uiimage imagewithcontentsoffile:savedimagepath]]; nslog(@"file exists"); } } and added them in icarousel view: - (uiview *)carousel:(icarousel *)_carousel viewforitematindex:(nsuinteger)index reusingview:(uiview *)view { view = [[uiimageview alloc] initwithimage:[myimages objectatindex:index]]; return view; } if don't misunderstand question, can tr...

ios - List all living nodes / actions / animations in a Cocos2D app -

is possible list living nodes (actions , animations of interest me too) in cocos2d app? currently fighting memory issues in app , though profiler helps try other approaches too. you can recursively list child nodes. start node scene. actions, know can number of actions given node, don't know if possible list actions in way. also, may use cctexturecache check if of unused textures removed memory. has no public methods access data, can see loaded textures names in debugger or add dumping method. to prevent memory leak scheduling action on node, want remove parent, send cleanup message of nodes before removing parent. or if instance of class, make [self cleanup]; in it's onexit() method. i don't think, can receive list of created nodes. sounds garbage collection in .net =) in objective-c must watch leaked objects yourself.

Relationship between obr and repository in apache ace -

what relationship between repositories accessed using /obr , /repository in apache ace?? there no strict relationships between these. /repository contains ace's metadata deployment, i.e., states artifact should go where, in artifact represented url. /obr/ contains ace's own implementation of obr . packaged separate bundles, , ace can deployed or without it. to provision, ace doesn't need obr. however, web ui assumes obr available uploading artifacts to, can provisioned. ace obr extends specification, in allows non-bundle artifacts uploaded.

c# - AutoPopulate DropDownList Using Ajax -

i have 2 dropdownlist binded on pageload , want rebind these 2 dropdownlist after firing ajax function.here have written sql server stored procedure data needed dropdownlists.but how value dropdownlist,so can bind new data using ajax function.the screen developed using asp.net c# coding. here drop down list of asp.net <asp:dropdownlist id="ddlcourse" runat="server" autopostback="false" height="28px" title="select course" width="290px" ></asp:dropdownlist> and here jquery method calling web service method function bindcourse() { $.ajax({ type: "post", url: "/webservice/collegewebservice.asmx/getcoursedetails", data: "{}", async: true, contenttype: "application/json; charset=utf-8", datatype: "json", success: oncoursepopulated, erro...

Android lock screen show again after it has been disabled (using lock.disableKeyguard()) -

hey im writing launcher, in im building own custom lockscreen. the custom lockscreen activity being launched whenever screen off (by listening intent.action_screen_off) to disable android's lockscreen use code: keyguardmanager keyguardmanager = (keyguardmanager) getsystemservice(keyguard_service); keyguardlock lock = keyguardmanager.newkeyguardlock(keyguard_service); lock.disablekeyguard(); it works good, till point, in android's lockscreen turned on again (like has never beem disabled before). it happens lot on samsung galaxy 2 (but happens on other phones). what im doing wrong? thanks! have enabled devicepolicymangnager? if not function won't work. this comes documentation : note: call has no effect while devicepolicymanager enabled requires password. here tutorial it. anyway think it's not looking cause anytime app user have give password give admin permissions. in general there no way programmatically disable keyguard ( if...

Storing tic toc values in R -

i'm looking way store running times in variable in r. in matlab 1 can along lines: tic; ... x=toc; and running time stored in variable x. have tried doing same thing tic() toc() function in r coming matlab-package without success. furthermore can't see how can done using system.time() function of r neither. here appreciated. use built-in system.time function: tm1 <- system.time( { #your code here }) or, alternatively benchmark function rbenchmark package: tm2 <- benchmark( { #your code here }, replications=1)