Posts

Showing posts from September, 2010

jQuery Encrypted API - XML display -

is there way parse xml encrypted api via jquery? need use ajax? have examples? have: http://www.mysite.com/net/webservice.aspx?login=email@email.com& encryptedpassword=xxxxx&edi_name=generic\products& select_columns=p.productcode,pe.productprice this returned xml return , parse table or something: <?xml version="1.0" encoding="iso-8859-1"?> <export> <products_joined> <productcode>product 1</productcode> <productprice>1500</productprice> </products_joined> </export> yes, assuming have access run javascript on server, this: var url = 'http://www.mysite.com/net/webservice.aspx?...'; $.ajax({ type: 'get', url: url, datatype: 'xml', success: function(xml) { var table = $('#mytable-id'); $(xml).find('products_joined').each(function(){ var product = $(this), code = product.find(

xaml - prevent WPF clipping of Grid content when translated vertically -

i have following xaml displays stack panel of text blocks. because of main grid size, last few items in stack panel naturally clipped. if translate stack panel's parent grid (not main grid) vertically up, stack panel's contents still clipped instead of displaying items @ bottom. how can perform vertical translation on grid without clipping bottom contents of stack panel? the viewbox important - first grid needs size max height of main window or monitor. <window x:class="wpfapplication5.mainwindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" title="mainwindow"> <viewbox> <grid width="500" height="888" background="#cccccc"> <grid background="#cc99cc"> <grid.rendertransform> <translatetransform y="-

android - Find best matching routes from GPS data -

i'm making application users can save gps data phone server when travel everyday routes. example heading home work. gps data stored in database. now, user wants know maybe there's more people travels route too. want compare different users routes , give user example 3-5 best matches other users routes. important compare whole trip, because users can join routes , go work starting @ point not beginning , end. think important destination point users view, searching other users routes. other user route must near searchers route end. there 2 factors - time , location. 1 user drives car , walks , takes bus example. 1 walks starts trip earlier, later, because travels route faster. in 1 point @ time routes matching. how can routes compared? there algorithm(s) that? need compare every point in route? essentially talking combination of routing algorithms , traveling-sales-man the common routing algorithm invented dijkstra 50 years ago, , calculate best way of get

posting page title on the facebook when user clicks on like button in asp.net -

i have button on website, whenever click on button, information posted on facebook wall proper url, issue there no proper page title, , image on facebook wall, want customize information. mean want post page title, coz page title changes every article, , want post image of article on facebook... how can post customize information on facebook on button click. you need include open graph tags on site in order customize title. you <meta property="og:title" content="my title"/> https://developers.facebook.com/docs/opengraph/ make sure include required tags (title, url, site_name, type, image) , include namespaces: <html xmlns="http://www.w3.org/1999/xhtml" xmlns:og="http://ogp.me/ns#" xmlns:fb="https://www.facebook.com/2008/fbml"> hope helps.

mysql - Deliver rows to JavaScript using JSON -

i'm trying rows of mysql table arrays, haven't found out how correctly till now. appreciate if give me hint. it's very, wrong way i'm doing it, haven't found information regarding json , problem till now. function updatemap(){ var latlngarray = new array(); var titlearray = new array(); var ogvarray = new array(); var mp4array = new array(); var webmarray = new array(); $.getjson('getpoi.php', function(data){ for(var i=0; data.length; i++){ latlngarray[i] = data[i][0]; alert(latlngarray[i]); titlearray[i] = data[i][1]; ogvarray[i] = data[i][2]; mp4array[i] = data[i][3]; webmarray[i] = data[i][4]; } }); } the phpfile: $con = mysql_connect($server,$benutzername,$passwort) or die ("keine verbindung moeglich"); mysql_select_db($datenb

c# - How do I write a list using BinaryWriter? -

i want use generic writelist(list value) function write list using binarywriter. here code using: public void writelist<t>(list<t> value) { (int = 0; < value.count; i++) { _writer.write(value[i]); } } the error receiving is: error 1 best overloaded method match 'system.io.binarywriter.write(bool)' has invalid arguments error 2 argument 1: cannot convert 't' 'bool' the binaryformatter absolutely not option. if check out docs binarywriter you'll see doesnt accept argument of object ( writes primitive types ), , compiler trying best @ overload, , failing, since can't cast t bool, or else binarwwriter like. you're going have convert object binarywriter work with.

How I check in PHP if a string contains or not specific things? -

i need function in php work in way. $string = "blabla/store/home/blahblah"; if in $string find /store/ this, else that. how can it? thanks! $string = "blabla/store/home/blahblah"; if (preg_match("|/store/|", $string)){ //do } else{ //do } or $string = "blabla/store/home/blahblah"; if (false !== strpos($string, "/store")){ //do } else{ //do }

user interface - Location of Yahoo Astra Flash componenents zip? -

http://p.yimg.com/c/ycs/ydn/flash/pkg/astra-flex-1.4.zip is 404 page. know location of file? from yahoo! flash developer center , can see download links both flash , flex components: http://yui.zenfs.com/astra/astra-flash-1.4.zip http://yui.zenfs.com/astra/astra-flex-1.4.zip note: of these components have been marked "deprecated", use caution. (yahoo no longer supporting them.)

jquery - Can a td be the relatively positioned ancestor of an absolutely positioned element? -

i have image want transition image. child of containing td element. so first style td .css('position', 'relative') then create second image , give properties: var img = $('<image src="a.png" />') .css({ position: 'absolute', top: 0, left: 0, opacity: 0, 'z-index': 1 }) .appendto($td) ; finally animate old image , new one: img.fadein(1000); oldimg.fadeout(1000); at end of animation can remove old image , reset css properties. now, works great in ie7, firefox 5 sending replacement image top left of div containing table instead of overlaying existing image in td . correct behavior? td not valid relatively positioned ancestor because it's not block element or that? suggestions of better ways make 1 image fade welcome. update i switched having image inline usual, added negative top margin equal own height (since image fills cell, displays underneath image want repla

Javascript/JQuery Image Picker -

i'm looking js/jquery way following 1: display series of paint chips side side along 'none' image 2: when chip clicked a: highlight border show has been selected b: change value of text field/perhaps hidden field appropriate color name (so images should flagged indigo, solaria, etc , update accordingly) i had found post on stackoverflow, couldn't working: jquery image picker and here's current code based on above link <!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title>untitled document</title> <script language="javascript" type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js&

Simultaneously generate multiple sine waves into sample buffer for audio unit (iOS) -

given array (of changing length) of frequencies , amplitudes, can generate single audio buffer on sample sample basis includes tones in array? if not, best way generate multiple tones in single audio unit? have each note generate it's own buffer sum output buffer? wouldn't same thing doing @ once? working on ios app generates notes touches, considering using stk don't want have send note off messages, rather generate sinusoidal tones notes i'm holding in array. each note needs produce 2 sinusoids, varying frequency , amplitude. 1 note may playing same frequency different note note off message @ frequency cause problems. want manage amplitude (adsr) envelopes each note outside of audio unit. want response time fast possible i'm willing work/learning keep audio stuff low level can. i've been working sine wave single tone generator examples. tried doubling 1 of these, like: buffer[frame] = (sin(theta1) + sin(theta2))/2 incrementing theta1/theta2 fre

java - What is the JDO equivalent of datastore's query.setAncestor(Key key)? -

i have been looking everywhere trying figure out jdo equivalent of google app engine's low-level api function: .setancestor(key key) is. have not been able find anywhere! i've read type of behavior not supported in native jdo. true? can't this? i don't think supported natively, can use query: pm.newquery("select myelement myparent == :parent"); note little different, though, low-level api setancestor search all descendants. , have establish one-to-one or one-to-many relationship via jdo. see: http://groups.google.com/group/google-appengine-java/browse_thread/thread/b07c62030e7bbcb8

c# - Do anyone know why I'm getting Null exception error? -

i keep on getting null exception. instantiated myhello inside program , still gives me error. in advance. class hello { public dictionary<int, string> one; public dictionary<int, ushort> two; public dictionary<int, bool> three; public hello() { this.one = new dictionary<int, string>(); this.two = new dictionary<int, ushort>(); this.three = new dictionary<int, bool>(); } public dictionary<int, object> values { get; set; } public object this[int index] { { return this.values[index]; } set { this.values[index] = value; } } } class program { public static void myfun(ref hello hu) { hu[0] = "hello"; hu[1] = 25; hu[2] = true; } static void main(string[] args) { try { //program myprog = new program()

ruby on rails - Trouble with parsing source html with Nokogiri -

i'm trying use nokogiri select dom element seems returning empty array. i run code: require "open-uri" require "nokogiri" doc = nokogiri::html(open("http://twitter.com/#!/ladygaga")) and returns whole source code parsed nokogiri. however, when run doc.css(".stream-tweet") it returns empty array. .stream-tweet class multiple div elements @ http://twitter.com/#!/ladygaga found inspecting source code. what's going on here? because there no div element stream-tweet class if @ doc . div loads afterwards ajax request twitter api.

How to define a simple dataset in R -

i have simple dataset i.e.(1.22 -0.86 -1.35 -1.46 0.67 2.77 -0.50 0.34 -0.57 -0.05). define data set in r don't have manually calculate mean , variance , possibly plot this. how do this? i have tried data<-[1.22 -0.86 -1.35 -1.46 0.67 2.77 -0.50 0.34 -0.57 -0.05] error: unexpected numeric constant in "data<-1.22 -0.86 -1.35 -1.46 0.67" data <- c(1.22,-0.86,-1.35,-1.46,0.67,2.77,-0.50,0.34,-0.57,-0.05) mean(data) var(data) plot(data) plot(sort(data)) hist(data) may recommend http://cran.r-project.org/doc/manuals/r-intro.pdf ?

nullpointerexception - Strange Java compiler warning: incorrect "potential null access warning" -

(jdk 1.6.0_23, eclipse 3.7.0 "potential null pointer access" warning level @ "warning") consider following example code: object obj = null; (;;) { obj = getobject(); if (obj != null) break; thread.sleep(25); } obj.tostring(); i'm getting following warning on last line: potential null pointer access: variable obj may null @ location . there real way obj null or why compiler thinks so? the compiler seeing potential object not initialized. not able see loop breaking condition object not null or run forever or until no longer null. warning on jdk mentioned. using more updated version warning not appear.

sql - Oracle Set operator query -

have sql query on oracle 11g returns count of whether record having id , status exists within +/- 15 minutes range in table. now wish ignore current date adding condition and timestamp < trunc(sysdate) . however, cases record exists in todays date wish ignore date comparison check in query '2010-07-20 19:15:11' >= to_char(timestamp - (1/1440*15), 'yyyy-mm-dd hh24:mi:ss') , '2010-07-20 19:15:11' <= (to_char(timestamp + (1/1440*15), 'yyyy-mm-dd hh24:mi:ss')) select count(1) count master_one id='123' , status= 'active' , '2010-07-20 19:15:11' >= to_char(timestamp - (1/1440*15), 'yyyy-mm-dd hh24:mi:ss') , '2010-07-20 19:15:11' <= (to_char(timestamp + (1/1440*15), 'yyyy-mm-dd hh24:mi:ss')) union select count(1) count master_two id='321' , status= 'active' , '2010-07-20 19:15:11' >= to_char(timestamp - (1/1440*15), 'yyyy-mm-dd hh24:mi:ss') , 

php - Download while uploading -

how use php or other language read uploading-file allow download of uploading-file while uploading? example sites are: http://www.filesovermiles.com/ http://host03.pipebytes.com/ use this: http://www.php.net/manual/en/apc.configuration.php#ini.apc.rfc1867 in array file name included temp_filename - can pass other program, can read file , stream live. array includes file size program can make sure not try read beyond end of file.

java - The maximum digit width on different font and font size -

i need maximum width of 1,2,3,....8,9 on different font , font size. in c#, open source code is: protected double maxdigitwidth(string fontname, double dblsizept) { double dblmaxdigitwidth = 0.0; // excel not use specified font size, // instead, font size rounded integral pixel size // check if works on non-windows platforms, otherwise 96dpi fine here // graphics g = system.drawing.graphics.fromhwnd(new intptr()); float fsizepxl = (float)math.round(96 * dblsizept / 72); float fsizept = (72 * fsizepxl / 96); fontstyle fontstyle; if (fontname == "monotype corsiva") fontstyle = fontstyle.italic; else fontstyle = fontstyle.regular; font font = new font(fontname, fsizept, fontstyle, system.drawing.graphicsunit.point, ((byte)(0))); (int = 0; < 10; i++) { // use label on .net 2.0 form measure width of digit form

php - can you help me with these sql problem? -

hi using phpmyadmin 3.3.9 . have sql prblem in dont know problem @ all.. heres code looks like: create table metars( metar varchar( 255 ) not null default '', timestamp timestamp( 14 ) not null , station varchar( 4 ) not null, primary key ( station ) , unique key station( station ) ) engine = myisam and heres error: #1064 - have error in sql syntax; check manual corresponds mysql server version right syntax use near '( 14 ) not null , station varchar( 4 ) not null default '', primary ke' @ line 3 try timestamp timestamp not null , there's no length/format option timestamp (that is: not mysql 5.1, see ypercube's comment) see http://dev.mysql.com/doc/refman/5.1/en/create-table.html data_type: bit[(length)] | tinyint[(length)] [unsigned] [zerofill] | smallint[(length)] [unsigned] [zerofill] | mediumint[(length)] [unsigned] [zerofill] | int[(length)] [unsigned] [zerofill] | integer[(length)] [unsigned] [zerofill] |

php - XML File posting through CURL not Hitting the url -

while posting xml content 1 server other server, not getting added. i'm using curl post xml files server. getting following response: http/1.1 200 ok date: thu, 21 jul 2011 08:13:02 gmt server: apache/2.2.8 (ubuntu) php/5.2.4-2ubuntu5.6 suhosin-patch mod_ssl/2.2.8 openssl/0.9.8g x-powered-by: php/5.2.4-2ubuntu5.6 set-cookie: phpsessid=6846cb7e65f6f6d6d87f163a681f0543; path=/ expires: thu, 19 nov 1981 08:52:00 gmt cache-control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0 pragma: no-cache content-length: 5721 content-type: text/html; charset=utf-8 this code $file_path= www_root.$xmlfilename; $xmldata = file_get_contents($file_path); $request = 'http://www.sample.com/someaction'; $postargs = 'xml='.urlencode($xmldata).'&filename='.urlencode($xmlfilename); // curl session object $session = curl_init($request); // set post options. curl_setopt($session, curlopt_post, true); curl_setopt($session, curlopt_postfields, $p

Maven-generated GWT Servlet not Responding -

i used gwt maven plug-in (version 2.3.0) generate gwt project. nice thing maven plug-in takes care of generating async part of service. appears work servlet not responding both when running in hosted mode (running in jetty) , when deploying resulting war tomcat. my problem servlet not responding. onsuccess() callback invoked null values. pretty copied tutorial gwt homepage, service created in way: final statusserviceasync statusservice = gwt.create(statusservice.class); here service interface: @remoteservicerelativepath("status") public interface statusservice extends remoteservice { string getstatus(string someinput); } as mentioned, async counterpart generated maven plug-in. web.xml looks this: <servlet> <servlet-name>statusservlet</servlet-name> <servlet-class>my.package.statusserviceimpl</servlet-class> </servlet> <servlet-mapping> <servlet-name>statusservlet</servlet-name> <url-patt

objective c - No results returned when doing Facebook Query -

i'm trying list of aid (album ids) using facebook query. what works: running query browser returns results, when run using facebook connect no values returned. the problem i'm having specific album object, results when querying user table. the real difference can think of when running browser access_token parameter included, running browser without returns nothing. authentication: i using oauth authenticate outlined here: mobile apps - getting started need include access_token in parameter list when doing query? the code: - (bool)application:(uiapplication *)application didfinishlaunchingwithoptions:(nsdictionary *)launchoptions { facebook = [[facebook alloc] initwithappid:@"<myappid>"]; nsuserdefaults *defaults = [nsuserdefaults standarduserdefaults]; if ([defaults objectforkey:@"fbaccesstokenkey"] && [defaults objectforkey:@"fbexpirationdatekey"]) { facebook.accesstoken = [def

android - Auto click on WebView -

how can perform click on webview java code? possible click on specified location (x,y)? webview.performclick() doesn't work! you can injecting javascript webview using loadurl(): mwebview.loadurl("javascript:<your javascript here>"); this example code perform click on element id 'button_submit': mwebview = new webview(context); mwebview.getsettings().setjavascriptenabled(true); mwebview.loadurl("javascript:getelementbyid('button_submit').click();");

Startting and Stopping GPS from Android App (Not from single Activity ) -

i have app need current gps location 1 or many activities, in attempt reduce waiting time user, trying start gps locationlistener @ app launch. want when app exits (go home screen) of activity, gps listener should stop. having several activities , activity can use gps due app flow not sure activity user exit want maintain global state of gps start , stop. binding start , stop app start , stop. i looking concrete solution this, pointers great..please guide!! that doesn't sound idea. should manage gps listeners on activity level - attach them in onresume , detach in onpause . believe problem have many activities , want same stuff in every of them. create base abstract activity class manage gps connect/disconnect , extend every activity class.

debugging - How to debug CSS when using GWT -

how guys debug css when using clientbundle s in gwt given css class names obfuscated. i'm using celltable , rows have 4-5 class names. is there way @export these classes in css file? don't want explicitly export them all, automated way of extracting class names. maybe, last resort. thanks! in gwt.xml file, <set-configuration-property name="cssresource.style" value="pretty" /> see cssresource docs @ http://code.google.com/p/google-web-toolkit/wiki/cssresource#levers_and_knobs

iOS StackPanel Equivalent -

in wp7\silverlight\wpf have stackpanel container stack contained items in specific , predefined orinetation (horizontally\vertically). is there equivalent container ios? the equivalent i've been able find https://github.com/aaronbrethorst/stackpanel under mit license.

how to have perl repeat the entire sentence with each variable -

#! /usr/bin/perl @no = (1 .. 20000); foreach(@no) { print "<div id=\"world@no\" onclick=\"javascript:showdiv_postscreen(); javascript:hidediv_welcomebuttons()\">&nbsp;</div>\n"; } this perl script how re-write sentence new variable each time? i.e how output <div id="world1" onclick="javascript:showdiv_postscreen(); javascript:hidediv_welcomebuttons()">&nbsp;</div> . . . <div id="world20000" onclick="javascript:showdiv_postscreen(); javascript:hidediv_welcomebuttons()">&nbsp;</div> the @ in print statement confusing interpreter. also, isn't want, since print "@no" print out same thing join(' ',@no) . instead, want interpolate each element of @no string that's printed out: #! /usr/bin/perl use strict; use warnings; #always use these! @no = (1 .. 20000); foreach(@no) { print "<div id=\"world" . $

utf 8 - Rails 3.1, Ruby 1.9.2-p180 and UTF-8 issues -

i'm having trouble utf-8 characters. here's db/seeds.rb user.create(username: 'eml', first_name: '****', last_name: '****äck', email: 'somemail@example.com', password: 'asdasd') my terminal (osx 10.5.8) set use utf-8, rails (according application.rb) set use utf-8. here's error: $ rake db:seed rake aborted! /projects/***/db/seeds.rb:8: invalid multibyte char (us-ascii) /projects/***/db/seeds.rb:8: invalid multibyte char (us-ascii) /projects/***/db/seeds.rb:8: syntax error, unexpected $end, expecting ')' ...ame: '****', last_name: '****äck', ... ^ tasks: top => db:seed (see full trace running task --trace) add line # encoding: utf-8 on top of seeds.rb file , ruby file use spécials chars i recommed adding encoding.default_external = "utf-8" config.ru file , in config/environment.rb encoding templating and can add "".fo

c# - StructureMap MVC 3 IDependencyResolver -

interface idependencyresolver has 2 method getservice , getservices implement like: public class smdependencyresolver : idependencyresolver { private readonly icontainer _container; public smdependencyresolver(icontainer container) { _container = container; } public object getservice(type servicetype) { if (servicetype == null) return null; try { return servicetype.isabstract || servicetype.isinterface ? _container.trygetinstance(servicetype) : _container.getinstance(servicetype); } catch (exception ex) { return null; } } public ienumerable<object> getservices(type servicetype) { return _container.getallinstances<object>().where(s => s.gettype() == servicetype); } } but nead namedinstace dependencyresolver. objectfactory.getnamedinstace("instancename"); container how can that.. sorry b

php - Drupal function basic usage -

i learning drupal , found using drupal_add_js( array('philquotes' => array("json_url" => $json_url)), 'setting'); and says converted drupal.settings.philquotes.json_url and used pass php variable js. got doubt used create js variable in php can accessible in js or other meaning there in ? drupal_add_js function can used add setting, can used add file or inline javascript. drupal has documentation in api. see drupal_add_js documentation @ http://api.drupal.org/api/drupal/includes--common.inc/function/drupal_add_js/7

javascript - A problem when Inject ajax to colorbox -

i have wordpress plugin play vedio. developer has long gone. play vedio button not working. firebug can see code works till bpl_split_response(response); firebug says it's not defined. checked ajax file comes plugin, there isn't "bpl_split_response". point me else check problem? jquery(document).ready( function() { var j = jquery; j("a.link-play").live('click', function() { var link = j(this).attr('id') link = link.split('-'); j.post( ajaxurl, { action: 'link_lightbox', 'cookie': encodeuricomponent(document.cookie), 'link_id': link[2] }, function(response) { var rs = bpl_split_response(response); if ( rs[0] >= 1 ) { j.fn.colorbox({ html: rs[1], maxwidth: '90%'

How to I bind EXCEL range in VBA macro from a C# Library that returns object[,] -

i have c# library has 2 methods. 1 returns integer , returns object[,] public int returnint() { //something return int } public object[,] return2darray() { //returns twodimensionalarrayresponse; } now new vba , due legacy reasons need write vba macro rather vsto excel addin call library. getting result first meathod easy. made assembly com visible , registered com interop , added reference in vba project , called using code below sub gxsdata() dim interopclass new excelinteropwrapper dim result integer result = interopclass.returnint() msgbox "rows returned =" & cstr(result) end sub so far , good. want call second method data , bind excel. sounds simple --> type should use hold data. tried dynamic array , did not work --> how bind dynamic range. let's 2d array 100*10 want bind range range.value = array know how in excel addin application in c# vba giving me real problems any on great i have found way . not per

c# - Visifire MVVM: Is it possible to have visifire chart's data series collection property in view model? -

i have created silverlight 4 application , using visifire charting components. i using mvvm pattern , have created view contains: <charts:chart x:name="mychart"> the issue number of data series of chart change. i have got of logic in place , working if don't use mvvm model , directly set mychart's series property. now, want set data series collection of chart in view model. i have created dataseriescollection property in view model. if setting data series collection in backend code (if not using mvvm), simply: this.mychart.series = mydataseriescollection; where mydataseriescollection collection of dataseries but don't know how need set binding of dataseriescollection in xaml. as @ sep 2010 looks dataseries property not bindable: see forum post, aswered visifire: databinding series property? it may visifire few steps behind latest trends towards mvvm , binding everything .

mysql - Problems with query optimization -

i had 2 queries - 1 selects group_id knowing post_id , , 1 checks user in group. tried optimize them - put them together, throws error... select count(bio_community_group_members.id) count `bio_community_group_members` join `bio_community_posts` on (`bio_community_posts`.`id` = `180`) `bio_community_group_members`.`group_id` = 'bio_community_posts.group_id' , `bio_community_posts`.`user_id` = '34' it says: unknown column '180' in 'on clause'. problem: have entry! table structure: bio_community_posts : id , user_id , group_id , other stuff; bio_community_group_members : id , user_id , group_id , status , other stuff; i need retrieve status bio_community_group_members if exists. count thing because didn't knew how start build query. :( thanks in advice. edit: hmm... works..... idea how optimize 2 queries , 1 selects status ? select `group_id` `bio_community_posts` `id` = 180 select count(id) c

java - Returning a Constant in an iBatis resultMap -

i have resultmap set number of result elements in it. able set constant 1 of results. instead of <result property="name" column="name"/> i'd able make sure name come string 'joe'. in ideal world i'd have query changed return constant unfortunately that's not option me. i've scanned on ibatis dtd , unable find suitable attribute. know iterate on list returned ibatis i'd prefer able in ibatis map. thanks yesnotypehandler.java compatible mybatis 3 : abc-sqlmaps.xml <resultmap id="resultmapabc" class="com.abc.dto.abc"> ... <result property="isa" column="is_a" typehandler="yesnotypehandler"/> ... </resultmap> ibatis.xml <sqlmapconfig> ... <typealias alias="yesnotypehandler" type="com.abc.dao.sqlmap.yesnotypehandler"/> <typehandler javatype="boolean" jdbctype="bo

java - Replace a substring in a string except when the string is inside quotes -

regex dialect: java problem: given string, replace occurrences of substring inside it, except when these occurrences inside quotes. example1: string: "test substr 'test substr' substr" substring: "substr" replacement: "yyyy" output: "test yyyy 'test substr' yyyy" example2: string: "test sstr 'test sstr' sstr" substring: "substr" replacement: "yyyy" output: "test sstr 'test sstr' sstr" example3: string: "test 'test substr'" substring: "substr" replacement: "yyyy" output: "test 'test substr'" this best try far: regex: ((?:[^']*'[^']+')*?[^']*?)substring replace: $1replacement the problem needs substring outside quotes after last string within quotes otherwise doesn't work, example3 fail (output: "test 'test yyyy'"). many help. here's way: pub

Is it possible to Determine which OAuth Library to use? -

as have oauth , oauth2 protocol various services facebook, twitter, etc. know if possible detect service uses oauth backend programming , hence proceed use best suited oauth 1 or oauth 2 class library oauth? thanks. you have read each service provider's(facebook, twitter, etc) api documentation , decide based on that

Trouble when trying to open WPF project in Expression-Blend 4, which was created in Visual Studio 2010 -

i'm create wpf project in vs 2010. after finished work functional gui, wanted edit template of controls in blend 4. when open project in blend, in designmode, tell me invalid xaml in result window wrote: [controlname] not supported in windows presentation foundation (wpf) project where [controlname] list of default controls, have used in project (such window, dockpanel, etc.) what avoid issues , able edit wpf forms @ designmode of expression-blend4? edit: possible workaround. after comparasion of empty projects (*.csproj file), created blend , studio , have find out visualstudio create next line: <propertygroup> <configuration condition=" '$(configuration)' == '' ">debug</configuration> <platform condition=" '$(platform)' == '' ">x86</platform> ... while blend uses following lines: <propertygroup> <configuration condition=" '$(configuratio

f# - What to choose fsyacc/fslex or FParsec? -

i need parse simple dsl language following: import "library.txt" def <int, bool, byte> main(int param1, bool param2) { var = f4(param1); // or var d = f1(f2(f3(f4(param1)))); var b = f3(a); var c = f2(b); var d = f1(c); return <d, param2, b0>; } what suitable tool parse such kind of language? lex/yacc better complete languages complicated grammars. parsec faster work when have short semi-simple tasks. think case, lex/yacc more suitable.

before.jstree called twice during drag and drop of a node in jquery -

i trying move nodes within the jstree(which build json_data). when move node want display confirmation "are sure want move?". using following code. $("#demo2").bind("before.jstree", function (e, data) { if(data.func == "move_node" && data.args[1] == false && data.plugin == "core") { if (confirm('are sure want move?') === false) { e.stopimmediatepropagation(); return false; } } }); but "are sure want move?" confirm message displayed twice. may know how fix ? using latest jstree,jquery commit.and not using crrm plugin.i using dnd plugin. please advise. regards, peri thanks reply chris. tried still not working. alert appears twice here also. please advice. $("#demo2").bind("before.jstree", function(e, data) { try{ var flag = 1; var nodemoved = data.args[0].o; } catch(e){ flag = 0; } if

Does Aptana Studio 3 support Caller Hierarchy? -

i used radrails version 2.0 aptana. have upgraded studio version 3.0 unable find "open caller hierarchy" button. not available in drop down on right click nor in main menus. know if action still exist or not available? i talking ruby code here. thanks in advance nope, not yet available. create feature request @ http://jira.appcelerator.org/browse/apstud cheers, max

javascript - CSS not applying in bookmarklet -

i'm creating simple bookmarklet (never done before) , while script executes fine (doesn't right now), css style sheet gets embed doesn't apply html. the activation link follows (domain changed): <a href="javascript:(function(){document.head.appendchild(document.createelement('script')).src='http://www.mydomain.co.uk/cloudlr/app/js/cloudlr.js?rand=' + math.floor(math.random()*99999);})();">do this</a> then script called is: if (typeof jquery == 'undefined') { appendjquery(); } else { jsversion = $().jquery; versionarray = jsversion.split('.'); if (versionarray[1] < 6) { appendjquery(); } else { runthis(); } } function appendcss() { var cloudlrcss = document.createelement('link'); cloudlrcss.type = 'text/css'; cloudlrcss.href = 'http://www.mydomain.co.uk/cloudlr/app/css/screen.css'; cloudlrcss.media = 'all';

android - Link to the SDK Bluetooth chat example -

can give me link eclipse project in zip format contains bluetooth chat example developer site link example ? tried myself im getting bunch of errors , searched there strange api level requirements see this . how can possible have api level 11 requirement in project made in 2009? i'm developing api level 7 (2.1). you need download samples api level 7, use android sdk , avd manager.

android - AVD resolution issue with my app -

i'm writing android app android tablets, tablet 10.1" 600x1024 archos tablet running android 2.2 when throw app device works fine, no problems @ all, when throw avd (600x1024, tested 120, 160, 240 , 320 dpi) ever open in small area of display. screen shows 600x1024 screen , standard android desktop shows fine, app display in 480x320 box in middle of screen. an example: avd running desktop - http://www.flickr.com/photos/45270706@n03/5960464995/ and running app - http://www.flickr.com/photos/45270706@n03/5961001468/ as can see, app believes screen size 480x320 - code used display text is: canvas.drawtext("screen width = " + canvas.getwidth(), 50, 20, paint); canvas.drawtext("screen height = " + canvas.getheight(), 50, 40, paint); which should accurate enough. i'm either doing wrong in code (which don't think new 'hello world' same), doing wrond when setting avd (though same if use galaxytab avd) or don't know else. i&#

ruby - What's that long garbled string of character and the end of Ocra or Ruby2Exe? -

here's part of it... __end__ 24295 tvqqaamaaaaeaaaa//8aalgaaaaaaaaaqaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaagaaaaa4fug4atannibgbtm0hvghpcybwcm9ncmft ignhbm5vdcbizsbydw4gaw4gre9tig1vzguudq0kjaaaaaaaaabqrqaataef akxo5ekaaaaaaaaaaoaadwmlaqi4adyaaabcaaaaagaambeaaaaqaaaauaaa aabaaaaqaaaaagaabaaaaaeaaaaeaaaaaaaaaacqaaaabaaakryaaamaaaaa acaaabaaaaaaeaaaeaaaaaaaabaaaaaaaaaaaaaaaacaaadibqaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaac50zxh0aaaaddqaaaaqaaaangaaaaqaaaaaaaaa aaaaaaaaagaaagauzgf0yqaaafaaaaaauaaaaaiaaaa6aaaaaaaaaaaaaaaa aabaaadalnjkyxrhaaawawaaagaaaaaeaaaapaaaaaaaaaaaaaaaaaaaqaaa qc5ic3maaaaa4aeaaabwaaaaaaaaaaaaaaaaaaaaaaaaaaaaaiaaamauawrh dgeaamgfaaaagaaaaayaaabaaaaaaaaaaaaaaaaaaabaaadaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa

android - Can't get preference set with PreferenceActivity -

i have main activity: public class home extends activity { @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.home); initializestyle(); } private void initializestyle() { sharedpreferences prefs = preferencemanager.getdefaultsharedpreferences(this); string foobar = prefs.getstring("foobar", "hi"); log.i("myactivity", foobar); } // ... } and preferenceactivity: public class preferences extends preferenceactivity { @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); addpreferencesfromresource(r.xml.preferences); } } with xml: <?xml version="1.0" encoding="utf-8"?> <preferencescreen xmlns:android="http://schemas.android.com/apk/res/android"> <preferencecategory android:key="pre

asp.net mvc 3 - Custom membership provider get current login user -

i have little problem, implement own membership provider , works fine. added userid articles code in controller: [httppost, authorize, validateinput(false)] public actionresult vytvorit(article newarticle) { if(modelstate.isvalid){ if(!user.identity.isauthenticated) return view(newarticle); newarticle.user.userid = (int)membership.getuser().provideruserkey; repo.save(newarticle); return redirecttoaction("zobrazit", new {id=newarticle.articleid}); } return view(newarticle); } and working after many changes (in controllers, models , so) tried , there problem membership.getuser returns null. i tried google , found there might problem authenticated user can't found in membership datasource. dont know how fix it. thanks edit: mymembershipprovider don't know if found useful tutorial when putting custom membershi

regex - Altering HTML tags using Notepad++ -

i have long list of html tags following: <option>text 1</option> <option>text 2</option> etc... i wish use notepad++ make list following: <option value="text 1">text 1</option> <option value="text 2">text 2</option> thanks use regular expression? find: <option>([^<]+)</option> replace: <option value="\1">\1</option> then use individual find/replace don't accidentally clobber didn't intend to.

php - Get color value from numeric values -

i need projet color value. explain, have datas , each data must represented color. the red color maximum, , blue minimum , green middle value. kind of heatmap. so, need have function returning right color. i tried : function datatocolor($min, $max, $value) { $half = (($min + $max) / 2); if ($value > $half) { $r = (255 * ($value+$min-$half)) / $half; $g = 255 - $r; $b = 0; } else { $b = (255 * ($half-$value+$min)) / $half; $g = 255 - $b; $r = 0; } $color = array(intval($r), intval($g), intval($b)); return $color; } but, red , blue, , never green ... tried lot of operations, must stupid don't find right operation ... in advance ! i'm not php expert, far can tell, problem isn't code block. tested algorithm in java sure, , looks correct: public static void main(string[] args) { int min =

.htaccess - mod_rewrite old urls with parameters to new URL's, but using the old parameters with the new URL -

i have tricky rewrite situation needing rewrite old url's have parameters, new url's, @ same time appending parameters of old (now invalid) url new url. example: old link of ring-details.php?product= mq== &hash=376fge367er872cbd5 become rings/ring-detail/ 23 .htm number 23 base64_decoded value of product url above. so need this: check if page being requested ring-details.php , there parameter 'product' present. hash no longer used. take product parameters value (mq==), base64_decode it append decoded value new url: rings/ring-detail/$1.htm $1 decoded product url parameter. i not asking spoon fed, hints or resources great. thanks, as far know, cannot decode base64 in .htaccess/mod_rewrite. make workaround via php. so have catch old url , rewrite php file, decodes base64 , redirects new url. content of .htaccess : rewriteengine on rewritecond %{query_string} ^product=([^&]+) rewriterule ring-details\.php$ redirect.php?product=%1 [l]

.net - Nested queries from multiple Oracle databases -

in .net, possible run nested query 2 separate oracle databases? e.g. "select my_value, table_in_database_1 my_value in ( select my_value table_in_database_2 )" if so, how go doing this? ultimately, effort overcome "ora-01795" error using "in" statement on 1000 items in conditional list, without having break query out multiple "or value in" lists. you might able away building database link , joining on link, can have performance issues. this: build link database 2 on database 1. create database link db2 connect user identified pw using tns-alias; join table on database 1 table on database 2: select my_value table_in_database_1 t1 join table_in_database_2@db2 t2 on t1.my_value = t2.my_value depending on performance of link, may opt use hybrid approach this, involving both database link , temporary table. build database link above. build temporary table on database 1 holds values use

javascript - How do you use Google Analytics / _trackEvent on Mobile Safari (iPad)? -

i've been looking use google analytics _gaq.push() function on single-page javascript application targeting ipad (in particular, mobile safari). my page loads once , continues load data asynchronously user uses application. want track interactions user moves through application, decided on asynchronous api ( _gaq.push() ). i've heard method, ga data gets pushed on document unload. if true, have doubts whether work on mobile safari user might not unload document long time. is best way want, , if not, preferred way push finely-tracked events google analytics application in timely manner? thanks. ga data not sent on document unload; there no association @ between document unload , google analytics. when using async syntax, google analytics loaded dom asychronously wherever put it. @ same time, _gaq.push() creates queue of functions execute once google analytics loaded, executed in sequence. of happens without regard document unload, onload, ready, etc. w

mysql - include and header php advice -

im building first dynamic site. have index.php based on whether following session variable true or false if($_session['loggedin']) { include 'logged-in/logged-in.php'; } else{ include 'not-logged-in/not-logged-in.php'; } the not-logged-in.php displays forms can either login or register calls function within included php file. if login() function validates via login via mysql sets $_session['loggedin'] = 1; header("location: ../index.php"); i error... warning: cannot modify header information - headers sent (output started @ / /index.php:8) in / /not-logged-in/not-logged-in.php on line 5 sorry '*' out url keep project private. come simple graphics programming background , new me. tips or advice appreciated. this error caused having output browser, either echo, print, etc. before call header() . personally wouldn't use session variable store whether user logged in or not because may want disable user, ,

C# Recursion Problem -

i have range class want able subtract set of ranges. i can single 1 fine. e.g. range range1 = new range(0,100); range range2 = new range(40,60); list<range> differences = range1.difference(range2); differences[0]; // 0 40 differences[1]; // 60 100 the problem stuck on when finding difference between range , set of ranges: list<range> rangeset = new list<range>(); rangeset.add(new range(10, 30); rangeset.add(new range(25, 70); rangeset.add(new range(90, 120); list<range> results = range1.difference(rangeset); the results should be: results[0]; // 0 10 results[1]; // 70 90 the algorithm should take result difference between range , rangeset[0] , use result input next iteration etc etc. , return set of ranges result. i'm guessing require recursive method cant head around it???? to 'clarify'. problem more complex range example have given. here test trying pass. [test] public void bandcanreturndifferencewithasetofother