Posts

Showing posts from February, 2015

java - Play media (video) from a network stream(http) directly -

i play media (video) network stream(http) directly, hence have somehow feed android mediaplayer data. i have fileoutputstream outstream = new fileoutputstream(outputfile); write outputfile outstream.write(buffer, 0, count); is there api takes stream input....???.... please help... android supports progressive download , http live streaming(only in 3.0) , both of these work on http. you can use videoview or mediaplayer leverage progressive downloading , play videos: see this discussion. also, if server, delivers segmented files(.ts) in conformance apple's http live streaming ietf draft , can directly supply url mediaplayer , play video using surfaceview . note: have replace "http" "httplive:" in url.

java - In memory and embeddable OLAP implementation compatible with olap4j -

i looking olap implementation, embedded in java application. best -- not -- if use olap4j connect it. need such library testing purposes of application evaluate ideas before go standalone olap server. mondrian seems perfect solution. implemented in pure java, embeddable, , native interface olap4j. if need database embedded also, use embedded java database such apache derby or hsqldb.

Smooth JavaScript/jQuery scroll to element -

i'm trying make horizontal scroll website, don't know how smoothly scroll 1 element other. tried following code: $("a[href='#top']").click(function() { $("body").animate({ scrolltop: 0 }, "slow"); return false; }); but scrolls top, tried jquery-plugin scrollto , can't work, tried jquery plugin: $('.click').click(function(){ $.scrollto( '.last', 800, {easing:'elasout'}); }); but without succes. does know good, easy understand, sample can use? in advance! untested $('.click').click(function(){ $.scrollto( $('.last'), 800); });

.htaccess rewrite remove directory name from request -

i trying make redirect request [http://test.site.com/ pagename--city /] [http://test.site.com/ state/pagename--city /] , [http://test.site.com/pagename--city/]. 'state/pagename--city' physical directories on server. if clicks on [http://test.site.com/pagename--city/] need execute [http://test.site.com/state/pagename--city/index.php] url remain [http://test.site.com/pagename--city/]. appreciated. thnx. .htaccess file options +followsymlinks rewriteengine on rewritebase / rewritecond %{request_uri} /(.*)--(.*)/?$ rewritecond %{request_uri} !/state/ rewriterule .* http://%{http_host}/state%{request_uri} [l] rewritecond %{request_filename} !-d rewritecond %{request_filename} !-f rewritecond %{request_filename} !-l rewriterule .* page.php?&[|]v1||%{request_uri}[|]v2||-[|]v3||%{http_host}[|]v4||%{request_filename}[|]v5||eol[~|~]= [qsa,l] rewriterule ^(.*)--(.*)$ /state/$1--$2/index.php&%{query_string} [l]

How to get the (current url + query string) using python code with urllib2? -

i need read current url query string used ? means need browser current address bar url.. a urllib2.request object provides geturl() method, returns full url of request. may pass urlparse.urlparse() , splits url 6 components of every url. may access query part via query attribute. an example: >>> urllib2 import urlopen >>> urlparse import urlparse >>> req = urlopen('http://capitalfm.com/?foo=bar') >>> req.geturl() 'http://www.capitalfm.com/?foo=bar' >>> url = urlparse(req.geturl()) >>> url.query 'foo=bar'

regex - Can anyone explain this regular expression to me in detail? -

i have regex here , need know if 100% omit bad email addresses not understand them need call on community experts. the string follows: ^[_a-za-z0-9-]+(.[_a-za-z0-9-]+)*@[a-za-z0-9-]+(.[a-za-z0-9-]+)*(.[a-za-z]{2,3})$ thank in advance! ^[_a-za-z0-9-]+(.[_a-za-z0-9-]+)*@[a-za-z0-9-]+(.[a-za-z0-9-]+)*(.[a-za-z]{2,3})$ piece piece ^ start of string [_a-za-z0-9-]+ 1 or more characters of "_" (no quotes), letter (a-z, a-z), number (0-9), or "-" (no quotes) (.[_a-za-z0-9-]+)* 0 or more substrings of type .something, or .123, or .a123. substring must formed . , letter (same group of letters before). "." not valid. ".a" or ".1" or ".-" is. (up until accept example my.name12 or my.name12.surname34 ) @ "@" (like max@something) [a-za-z0-9-]+ 1 or more characters same pattern before (.[a-za-z0-9-]+)* 0 or more substrings of type ".something"... before (.[a-za-z]

python - how to import mysqldb -

i have installed mysqldb through .exe(precompiled). stored in site-packages. don't know how test, accessable or not. , major problem how import in application import mysqldb. me new techie in python want work existing mysql. in advance... just open cmd/console, type python , press enter , type import mysqldb , press enter again. if no error shown, you're ok!

c++ - libgcc_s.so: undefined reference to `__stack_chk_fail@GLIBC_2.4' -

at first warn i/m not programmer, administrator try understand actions when installed program made oracle, got log message: /usr/bin/make -f ins_precomp.mk relink oracle_home=/u01/oracle/orahome_1 exename=proc/linking /u01/oracle/orahome_1/precomp/lib/proc libgcc_s.so: undefined reference to __stack_chk_fail@glibc_2.4'` ls -l ../libgcc_s.so -> /lib/libgcc_s.so.1 so next tried diagnose by: objdump -t /lib/libgcc_s.so.1 | grep __stack_chk_fail 00000000 df *und* 00000000 glibc_2.4 __stack_chk_fail and ldd /lib/libgcc_s.so.1.org linux-gate.so.1 => (0x00fc5000) libc.so.6 => /lib/libc.so.6 (0x00110000) /lib/ld-linux.so.2 (0x00b39000) and objdump -t /lib/libc.so.6 |grep __stack_chk_fail 00c52f80 g df .text 0000001a glibc_2.4 __stack_chk_fail 1) don't know why problem occured if symbols inside shared libraries (mabye isn't, please correct me, or how check it) when put older library libgcc_s.so.1 without symbol __stack_chk_

drop down menu - jquery and selecbox, disallowing -

$('#my_select').live("click", function(e) { e.preventdefault(); //return false fails. alert("test"); //or show dialog }); having such live action, want disable how dropdown options appear once click selectbox, instead want display own div changes value. code above doesn't disallow , don't want used disabled= "disabled" attribute fails further server based validations. http://jsfiddle.net/mhtet/ this should :) in case link broken :) $('select').live("mousedown", function(e) { e.preventdefault(); //return false fails. //alert("test"); //or show dialog return; });

iphone - Non english character in NSString -

in application server give response text in non english characters. parse data , store in string. i want string operation on string due non english characters, got error , crash. specially happen when hindi characters available in response. please me. thanks in advance. the problem way getting data server , storing in nsstring. might decoding data ascii characterset. try nsutf8stringencoding. solve problem: nsstring *string = [[nsstring alloc] initwithdata:data encoding:nsutf8stringencoding];

Web Color List in C# application -

hallo everbody, if example set backcolor of panel in winform using visual studio, can pick color 3 lists: custom, web, system is possible retreive web colors in c# code application? part of knowncolor far find how eliminate system control list. i use web colors because sorted in nice way , insert them self-implemented combobox. thank you color struct contains web colors constants (system colors defined constants in systemcolors class) to list of these colors do: var webcolors = getconstants(typeof(color)); var syscolors = getconstants(typeof(systemcolors)); having getconstants defined follow: static list<color> getconstants(type enumtype) { methodattributes attributes = methodattributes.static | methodattributes.public; propertyinfo[] properties = enumtype.getproperties(); list<color> list = new list<color>(); (int = 0; < properties.length; i++) { propertyinfo info = properties[i]; if (info.prope

jquery - 2 AJAX forms on same page: prevent open one if the other is already oppened -

i have page user views data 2 forms. 1 called data part 1 , other data part 2. 2 forms, @ top, have button edit user can edit forms in same pages. when user clicks edit, sends ajax request php controller , return html rendered input fields filled. works. my problem want prevent user clicking on first edit , second edit. if he's editing part 1 (or part 2), has save , can edit second. when save form don't save via ajax, form sent normal http form. how can that? it's explained or need image example? thank in advance update: <h2> form1 <a id="projects_historics_edit_part_1" href="#" class="submitbutton submit insideh"><span>edit</span></a> </h2> <div id="projects_historics_part_1"> <!-- display form 1, when click @ button edit inside h2, loads form via ajax --> </div> <h2> form2 <a id="projects_historics_edit_part_2" href="

html - How can I make "display: block" work on a <td> in IE? -

Image
is there can make ie display table cells actual blocks? given style: table,tbody,tr,td,div { display: block; border: 1px solid #0f0; padding: 4px; } and html: <table> <tbody> <tr> <td>r1c1</td> <td>r1c2</td> <td>r1c3</td> </tr> </tbody> </table> <div> <div> <div> <div>r1c1</div> <div>r1c2</div> <div>r1c3</div> </div> </div> </div> the table renders same nested divs in both firefox , safari/chrome. in internet explorer (8) property display: block has no effect. table renders if don't set property. my main problem cells don't break; render on 1 line. (the tbody , tr elements don't borders nor padding. not problem me right now, though.) i haven't found information on problem when searching. compatibility charts on quirksmode , elsewhere states

winforms - C# Form with custom border and rounded edges -

Image
i using code make form (formborderstyle=none) rounded edges: [dllimport("gdi32.dll", entrypoint = "createroundrectrgn")] private static extern intptr createroundrectrgn ( int nleftrect, // x-coordinate of upper-left corner int ntoprect, // y-coordinate of upper-left corner int nrightrect, // x-coordinate of lower-right corner int nbottomrect, // y-coordinate of lower-right corner int nwidthellipse, // height of ellipse int nheightellipse // width of ellipse ); public form1() { initializecomponent(); region = system.drawing.region.fromhrgn(createroundrectrgn(0, 0, width, height, 20, 20)); } and set custom border on paint event: controlpaint.drawborder(e.graphics, this.clientrectangle, color.black, 5, buttonborderstyle.solid, color.black, 5, buttonborderstyle.solid, color.black, 5, buttonborderstyle.solid, color.black, 5, buttonborderstyle.solid); but see . the inside form rectangle doesn't have rounded edges.

classification - C5 algorithm implementation? -

do know can find information of algorithm, study it??. there example of implementation, or, quinlan knows implementation?? his company, rulequest, has it: http://rulequest.com/gpl/c50.tgz

sql - how do I subtract date oracle with one record -

i have table 1 column in date format. want calculate time difference between 2 records, can me? need query in sql or pl/sql. order_id;order_status_id;order_date 8296;16;22-2-2011 13:56:31 8295;22;22-2-2011 13:07:15 the query should result in 00:49:45 or close this. can help? thx! br the question isn't how want calculate - how want shown. date arithmetic simple: select date2 - date1 (select to_date('22-2-2011 13:07:15','dd-mm-yyyy hh24:mi:ss') date1, to_date('22-2-2011 13:56:31','dd-mm-yyyy hh24:mi:ss') date2 dual); gives answer, decimal. how translate visual display? select to_char(trunc(sysdate) + mod(date2 - date1,1),'hh24:mi:ss') (select to_date('22-2-2011 13:07:15','dd-mm-yyyy hh24:mi:ss') date1, to_date('22-2-2011 13:56:31','dd-mm-yyyy hh24:mi:ss') date2 dual); ok, nicely formatted. oh, except if want store interval? or if interval mo

asp.net mvc - Trying to edit an entity with data from dropdowns in MVC -

i'm having trouble getting head around sending multiple models view in mvc. problem following. using ef4 have table attributes organised category. couldn't post image :-( [have table called attributes (attributetitle, attributename, categoryid) connected table called category (categorytitle).] what want able edit attribute entity , have dropdown of categories choose from. i tried make custom viewmodel public class attributeviewmodel { public attributeviewmodel() { } public attribute attribute { get; set; } public iqueryable<category> allcategories { get; set; } } but ended being mess. <div class="editor-field"> <%: html.dropdownlist("category", new selectlist((ienumerable)model.allcategories, "categoryid", "categoryname")) %> </div> i getting controller... [httppost] public actionresult edit(int attributeid, formcollection formcollection) {

python - Use app engine yaml parser in scripts -

i have configuration files want write in yaml , read in python script running on google app engine. given app engine uses app.yaml, index.yaml among others seems reasonable assume there python yaml parser available. how can gain access parser (what import) , can find documentation. i'd use parser scripts running outside of agg engine (build scripts , such) how can gain access same import script run command line? the yaml library included appengine sdk. located in google_appengine/lib/yaml. should able use in appengine code having import yaml in code. for non-appengine work, quick google search reveals http://pyyaml.org/ home many , various python implementations.

user interface - Implementing a macro recorder for a python gui? -

i'm wondering how go implementing macro recorder python gui (probably pyqt, ideally agnostic). in excel instead of getting vb macros, create python code. made tkinter callbacks pass through single class logged actions. unfortunately class doing logging bit ugly , i'm looking nicer one. while did make nice separation of gui rest of code, seems unusual in terms of usual signals/slots wiring. there better way? the intention user can work way through data analysis procedure in graphical interface, seeing effect of decisions. later recorded procedure applied other data minor modification , without needing start gui. you apply command design pattern: when user executes action, generate command represents changes required. implement sort of command pipeline executes commands themselves, calling methods have. once commands executed, can serialize them or take note of them way want , load series of commands when need re-execute procedure.

What is the SQL query for creating a new database in Oracle 10G Express? -

what sql query creating new database in oracle 10g express? create database database_name options list of other commands here i googled , took 2 mins, , know nothing dbs!!!!!

asp.net mvc 3 - Razor mvc3 + jquery + UrlAction + PartialViews -

i have question jquery + razor.. want build javascript variable using razor @url.action , html attributes values of inputs. this: var d1 = $('#d1').val(); var d2 = $('#d2').val(); var url = "@url.action("links", "partialaccount", new { begindate = "d1", enddate = "d2" })" $("#links").fadeout("slow").load(url).fadein("slow"); how can this? is same below? var url = "/partialaccount/links/?begindate=" + d1 + "&enddate=" + d2; you should use load method proposed infernalbadger: load('@url.action("links", "partialaccount")', { begindate: d1, enddate: d2}) because encode parameters in d1 , d2 correctly. if can pass parameters part of querystring, not when should part of url itself. so can use if want url be: /bar/foo?begindate=1-1-2001&enddate=2-2-2001 (note /'s in date encoded) you cannot use i

C++ To Cuda Conversion/String Generation And Comparison -

so in basic high school coding class. had think 1 of our semester projects. chose base mine on ideas , applications arn't used in traditional code. brought idea use of cuda. 1 of best ways know compare speed of traditional methods versus unconventional string generation , comparison. 1 demonstrate generation , matching speed of traditional cpu generation timers , output. , show increase(or decrease) in speed , output of gpu processing. i wrote c++ code generate random characters input character array , match array predetermined string. cpu programming incredibly slow comparatively gpu programming. i've looked on cuda api , not find possibly lead me in right direction i'm looking do. below code have written in c++, if point me in direction of such things random number generator can convert chars using ascii codes, excellent. #include <iostream> #include <string> #include <cstdlib> using namespace std; int slength = 0; int count = 0; int stop = 0

c - fork(), pipe() and exec() process creation and communication -

i have write program create process using pipe() . my first task write parent process generates 4 child processes using fork() function. once fork() successful, replace child process process rover1, rover2, rover3, , rover4 , though of them have same code. the function of processes follows. each child process given own number. receives new number parent. using following formula creates own new number follows , forwards parent: mynumber = (3 * mynumber + 4 * numberreceived)/7 this process continues until parent sends message system stable. parent has initial number. receives numbers of children , computes new number follows: mynumber = (3 * mynumber + numbers sent children )/7 the parent send number children. process continue until parent finds number not changing anymore. @ time tell children system has become stable. this did professor said have use exec() execute child , replace child process child process. not sure how use exec(). please me this. i at

java - Countlines of code : include deleted lines? -

should need consider deleted lines of code , along inserted(added)/modified lines of code while taking metrics? ( revision's code made me delete lines of code) that depends on metrics trying show. personally i'm more smug , self-satisfied after deleting code after adding it. i've never found "lines of code" ends particularly useful metric in first place. careful of importance place on such figure.

java - SeleneseTestCase is deprecated - how to call verify* methods? -

when use code generated junit 4 formatter in selenium ide, warnings class selenesetestcase deprecated - makes sense since it's supposed b junit 4 syntax , use annotations instead of deriving test class. the issue when modify code not extend selenesetestcase i'm not sure how call verify* methods - appear exist in deprecated class. can run selenium actions using code below verifytrue undefined. correct way call verify methods in selenium 2.0b2? private static selenium selenium; @before public void setup() throws exception { selenium = new defaultselenium("localhost", 4444, "*chrome", "http://testurl.com/"); selenium.start(); } @test public void testlogin() throws exception { selenium.open("/test.html"); verifytrue(selenium.istextpresent("please sign in")); ..... i think idea use junit's assert.assertxxx() difference verifyxxx fail during teardown instead of think selenium tests want f

c# - How to call a function JQuery -

i'm beginner in jquery (i know nothing framework). i found code display calendar or hours using jquery , cool. how can use code? follow link code i'm trying implement in system (with razor webmatrix) http://trentrichardson.com/examples/timepicker/ it's matter of including necessary script , style references, wiring components. in particular case: include jquery engine core script within <head> of page. use recent version available (currently, 1.5). script in sample page uses jquery 1.4.4: <script type="text/javascript" src="jquery-1.4.4.min.js"></script> include jquery ui core script (same here version): <script type="text/javascript" src="jquery-ui-1.8.6.custom.min.js"></script> include plugin script(s): <script type="text/javascript" src="jquery-ui-timepicker-addon.js"></script> don't forget reference plugin ui elements styles: <

commit - Strange behavior with git fetch -

i'm getting big problem git fetch...look this $ git fetch server:project 422b4cb..a04c062 master -> origin/master $ git show-ref ba113be885e66a5306d1646cd3db0801170c04f8 refs/heads/alpha-release a04c062261beeb4a951337ebb58745945cac3562 refs/heads/master a04c062261beeb4a951337ebb58745945cac3562 refs/heads/test a04c062261beeb4a951337ebb58745945cac3562 refs/remotes/origin/head ba113be885e66a5306d1646cd3db0801170c04f8 refs/remotes/origin/alpha-release a04c062261beeb4a951337ebb58745945cac3562 refs/remotes/origin/master and git fetch : $ git fetch server:project + a04c062...422b4cb head -> origin/head (forced update) $ git show-ref ba113be885e66a5306d1646cd3db0801170c04f8 refs/heads/alpha-release a04c062261beeb4a951337ebb58745945cac3562 refs/heads/master a04c062261beeb4a951337ebb58745945cac3562 refs/heads/test 422b4cbac3db2784c8f6e94ffd99c7afcda9122d refs/remotes/origin/head ba113be885e66a5306d1646cd3db0801170c04f8 refs/remotes/origin/alpha-release 422b4

c# - Encoding parameters for a URL -

i have silverlight application building url. url call rest-based service. service expects single parameter represents location. location in form of "city, state". build url, i'm calling following code: string url = "http://www.domain.com/myservice.svc/"; url += httputility.urlencode(locationtextbox.text); if user enters "chicago, il" locationtextbox, result looks this: http://www.domain.com/myservice.svc/chicago%2c+il in reality though, kind of expecting url like; http://www.domain.com/myservice.svc/chicago,%20il when testing service via browser url, 1 expecting works. however, url being generated not working. doing wrong? i recommend uri . escapedatastring instead of using httputility functions. see discussion in server.urlencode vs. httputility.urlencode .

Reading Pipe from cmd.exe that uses "start" builtin -

i'm attempting "leave message" current user (on windows) using wscript.exe, without waiting user acknowledge message. my thought create new process, using "start" builtin (it opens new window , execution control returns caller) , call wscript short script open message box on screen , exit. this works ok unless attempt open pipe script (and read it). if attempt read pipe, read i/o never gets eof until wscript.exe exits, though program continues execution after "start" command. here's example: test.vbs wscript.echo "hello world!" invoke.cmd start wscript.exe //nologo test.vbs @echo exiting... exit /b if run invoke.cmd in command prompt, wscript window opens , control returns prompt. however, if attempt pipe output command (that attempts read pipe), subcommand never seems see pipe has closed until wscript.exe exits. this behavior doesn't require wscript.exe, however. seems behave way long process created "st

javascript - different times shown for different users of our site -

we seeing issues on our site in different times being shown different users. so if user logs site, pull time server , quick calculation determine how time left in auction , display that. once page loaded using java script setinterval() method. @ each 1000 milliseconds subtract 1000 milliseconds time difference value. when second user logs site , goes same auction there time difference second user 5 6 seconds 20 seconds. wondering if others have run issue , have been able determine solution.

iphone - why does this code use presentModalViewController? (not pushViewController) -

anyone understand why in coredatabooks example code that: (a) method controller swapping difference whilst click item , go detailed view uses seems standard uinavigationcontroller concept of " pushviewcontroller ", when when click on "add" new record button launches new view add record via " presentmodalviewcontroller " approach? is, couldn't approach have been same in both cases, using pushviewcontroller approach? are there advantages using each approach it's been used? can't quite see. i'd guess there must have been apple choose these different approaches different scenarios. example: any differences user (i.e. ui differences or functional differences) see? any differences developer (or advantages/disadvantages) for example, if consider using pushviewcontroller approach instead of presentmodalviewcontroller approach for "add" scenario... (b) data sharing approach difference the approach how share common

c++ - What does string::npos mean? -

this question has answer here: what string::npos mean 9 answers what following statement mean? string s="joe alan smith""; cout << (s.find("allen") == string::npos) << endl; actually string::find() returns position of found string, if doesn't find given string, returns string::npos , npos means no position . npos unsigned integral value, standard defines -1 (signed representation) denotes no position. //npos unsigned, why cast needed make signed! cout << (signed int) string::npos <<endl; output: -1 see @ ideone : http://www.ideone.com/vrhuj

c# - Automatically binding to custom domains in IIS 7.5 from .NET Web Application (MVC 3) -

i building web application in there core library , database shared many instances. give more concrete example lets have blogging engine , users can sign own blog act independently of others on system. each instance must have own subdomain eg: http://john.extremeblogging.tld/ , have option have own domain mapped eg: http://jonnyblogger.tld/ the problem have not knowing how notify iis 7.5 when requests come in either of domains. simple setting web application default site within iis , application can use request headers take appropriate action? it strikes me should pretty common task don't anticipate difficult solve @ moment not sure how approach it. any guidance appreciated. thanks id its been long question asked, still answering might helpful others in need. i happened work on big saas based multi-tenant project involved unique subdomains each of users site. user design , manage content on own site. on registration of tenant/user can add domain bindin

php - Cleaning pixels from a map -

Image
we have map, need use php take shades of blue out, percentages. problem is, of percentages in same color borders, , other times, percentages go border. need use image. there not (afaik) easy ways. the easiest way doesn't give results: separate channels , delete small components. the result this: as can see there few numbers , percent signs remaining because connected delimiting lines , deleting small components doesn't work them. if need better job, should correlate image template of each number, , once identified, delete it. here can see result of correlation number "2": one wrong "2" identified, (see top left), more sophisticated approach may needed general procedure. anyway, think these kind of manipulation beyond can expect k-12. hth! edit as per request, detail first method. you first separate 3 channels, , 3 images: you keep third (the blue channel) then need delete smaller components. the

windows - Delete a list of files from SQL Server table -

i have sql server table list of file paths files need delete windows system, there way can accomplish using batch file in command prompt or software me this?? appreciate help. you write select statement create commands you, run command line: e.g. select 'del /q ' + file_name your_table; save output results file, can run command line.

wpf controls - WPF ListBox IsEditable = True behavior? -

i have 'listbox' using fill items. however, need behavior similiar how combobox behaves if 'iseditable '= "true" . that combox filters items based on enter text field... i want similiar behavior in listbox. and cannot make use of combobox in case .. need manipulate listbox behave that. possible? you can. there's no built-in mode there combobox (since default listbox has no text-entry capacity - displays items), can achieve same behavior binding listbox collectionview , using view's filtering abilities. this blog post gives example (with source) how that's done. update: whole domain seems offline, here's post on wayback machine .

java - Do Nlog(logN), NlogN, Nlog(N^2) have equivalent running times? -

i think nlogn , nlog(n^2) equivalent, , nlog(logn) has better rt nlogn , nlog(n^2). can confirm? no. big o notation has nothing actual run time. o(n) can run shorter o(1) given n value depending on actual implementation. big o notation comparing how algorithms scale . meaning n increases, how change relative each other. so, example: function add100(x) { (i = 0; < 100; i++) { x++; } return x; } function twice(x) { tmp = x; (i = 0; < tmp; i++) { x++; } return x; } i know these functions can reduced x+100 , 2 * x respectively, demonstration purposes simple , show want them to. (and compilers may optimize them, there may not difference depending on environment). now, add100(x) has algorithmic complexity of o(1) . , double(x) has complexity of o(n) . however, values of x < 100, twice(x) faster add100(x) . arbitrary input won't. won't scale well, is faster range of input. now, trivial implem

javascript - jQuery templates plugin: how to create two-way binding? -

i started using jquery templates plugin (the 1 microsoft created), face problem: template bunch of forms bound array of objects; when change on 1 of forms, want bound object update , can't figure out how automate that. here's simple example (real life template , object more complex) : <!-- template --> <script type="text/html" id="tmpltest"> <input type="text" value="${textvalue}"/> </script> <!-- object bind --> <script type="text/javascript"> var obj = [{textvalue : "text1"},{textvalue : "text2"}] jquery("#tmpltest").tmpl(obj) </script> this populate 2 textboxes, each bound value corresponding object. now, if change value in 1 of textboxes, need update corresponding data object's value. idea how that? jquery template doesn't implement two-way data binding, microsoft developed jquery plugin does. scott guthrie post

silverlight - Content of ContentControl in Resource -

i have contentcontrol in radtileview. if put in hard coded text content property works fine. (code below) <contentcontrol grid.row="2" grid.column="0" content="hello world"></contentcontrol> that works...if put content usercontrol.resources section application freezes , displays nothing. <contentcontrol grid.row="2" grid.column="0" content="{staticresource tabcontrolcontent}"></contentcontrol> <usercontrol.resources> <textblock x:key="tabcontrolcontent" text="hello world"></textblock> </usercontrol.resources> ultimately have context radtabcontrol..but id settle on having textblock render. to string contentcontrol would, add xmlns:sys="clr-namespace:system;assembly=mscorlib" to usings. add this <usercontrol.resources> <sys:string x:key="singlestring">hello world</sys:string> <

how to uninstall vs 2010 sp1 beta -

i installed sp1 beta visual studio 2010 when open vs2010, crashes. there convenient method uninstall sp1 without uninstalling vs 2010? "programs , features" should have vs2010 sp1 beta uninstaller , allow rollback install. otherwise maybe have uninstall of vs , reinstall.

wordpress - Advanced link category functionality Window fix Problem -

Image
i'm working on wordpress theme , find out problem link function in body post section. when click windows out of margins cause dropdown's width huge: does know how fix window???? find out css class controls text boxes , set fixed size on it. if drop down have limit text length can shown. can view database ensure don't have entry there worded long.

GET ALL Skype Friends using skype APIs With C# -

is there way user friend using skype c#? how can active(online friends). first must add reference @ skype4comlib com reference tab on project, make sure apllication builded x86 try use code snippet: using system; using system.collections.generic; using system.linq; using skype4comlib; namespace example { class skypeexample { static void main(string[] args) { skypeclass _skype = new skypeclass(); _skype.attach(7, false); ienumerable<skype4comlib.user> users = _skype.friends.oftype<skype4comlib.user>(); users .where(u => u.onlinestatus == tonlinestatus.olsonline) .orderby(u => u.fullname) .tolist() .foreach(u => console.writeline("'{0}' online friend.", u.fullname)); console.readkey(); } } } hope helps.

using mysql instead of sqlite in a rails app -

i'm not sure how find i'm looking here, i've cloned rails app else , using sqlite, how switch project on mysql? there no migrations has schema. thanks. you don't need migration. rake db:setup (or rake db:schema:load ) edit : assuming schema schema.rb file. if it's sql file you'll have convert , run using mysql client.

xslt - Removing an XML tag that is named like xfdf:field (with a namespace) -

i want remove xml element xml file. tag want remove named xfdf:field. how specify in xslt ? tried , getting error saything "org.apache.xpath.domapi.xpathstylesheetdom3exception: prefix must resolve namespace: xfdf ". here xslt. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/xsl/transform"> <xsl:output omit-xml-declaration="yes" /> <xsl:template match="node()|@*"> <xsl:copy> <xsl:apply-templates select="node()|@*" /> </xsl:copy> </xsl:template> <xsl:template match="xfdf:field"></xsl:template> </xsl:stylesheet> here xml. <xfa:datasets xmlns:xfa="http://www.xfa.org/schema/xfa-data/1.0/" xmlns:dd="http://ns.adobe.com/data-description/" xmlns:tns="http://hostname" xmlns:xfdf="http://ns.adobe.com/xfdf/"> <xfa:data> <tn

c++ - How can I obfuscate/de-obfuscate integer properties? -

my users in cases able view web version of database table stores data they've entered. various reasons need include stored data, including number of integer flags each record encapsulate adjacencies , forth within data (this speed , convenience @ runtime). rather exposing them one-for-one in webview, i'd have obfuscated field that's called "reserved" , contains single unintelligible string representing flags can encode , decode. how can efficiently in c++/objective c? thanks! why not convert each of fields hex, , append them string , save value? as long append strings in same order, breaking them apart , converting them numbers should trivial.

iphone - View without active TabBarItem -

is there way add tabbarcontroller view displayed without tabitem must active? if so, how can implemented? update: i have tabbarcontroller 5 tabbaritems. when start app, default first tabitem active. would, however, none of tabbaritems active , view displayed (tabbar remains visible). if type in first tabbaritem, appropriate view becomes visible. well came across need, , must tell had implement own tab bar so. the tabbarcontroller designed have @ least 1 tab active. there few hacks posted online, 1 of them here in stackoverflow. wouldn't waste time trying stuff. didn't work me , quicker start coding being "trial , error" hack can app kicked out of app store. the tabbarcontroller not meant subclass reason. wouldn't recommend extend it. since change in api can make app crash. here's tutorial on how tabbar 1 on twitter app. http://idevrecipes.com/2010/12/17/twitter-app-tab-bar-animation/ i'm sorry can't share code community. contr

javascript - Extending, instead of overwriting, the prototype -

in our current codebase, creating classes this my_class = function(){ //do constructor stuff } my_class.prototype = { var1 : 'value', var2 : 'value', var3 : 'value' . . . //etc } there several classes like inherit super class. however, if this, end overwriting superclass' prototype. my_super_class = function(){ } my_super_class.prototype.generic_function = function(){ //all subclasses should have function } my_subclass = function(){ //constructory stuff } //inherit superclass my_class.prototype = new my_super_class(); my_class.prototype = { //oops, there goes superclass prototype... var1 : 'value', var2 : 'value', var3 : 'value' . . . //etc } is there better way my_class.prototype.val1 = 'value'; ... etc after inheriting superclass? follow convention our current codebase because short , point. do use library or framework? if chances can use prototype's object

php - check if files exists in folder on network/lan -

i want check if files exists in network folder (eg. path = "u:\abc\def\") using php. i tried use following: if(file_exists("u:/abc/def/400abc.doc")) { echo "yes"; } else { echo "no"; } i no. tried path = "//abc-drive/folder-main/abc/def/400abc.doc" still doesn't work. the files on network/shared folder , not in subfolders php server runs can please tell help? regards this won't work if php has safe_mode enabled. try setting safe_mode_include_dir add exception, , reference location syntax \\computername\share\filename .

symfony1 - PHP: problems with url encoding (rawurlencode and rawurldecode) -

i creating token passing part of url on page. encode string using rawurlencode () , send token, however, find when decode received token (passed url parameter), different string. my url looks this: /path/to/file.html?token=abcd123 here snippet of code using. doing erong?. failing that, there better way create (encrypted) tokens , pass them in url? <?php //send $raw = "some secret string"; $token = rawurlencode($raw); //recieve $data = rawurldecode($token); ?> [edit] i have removed enc(dec)ryption functionality - not cause of problem - , red herring. have narrowed problem down rawurlencode/decode not being symmetric in way working. a rawurlencoded string when decoded, giving different string (similar string, parts missing). surely, there cant bug in fundamental urls - must doing wrong. problem can't spot it, , far no 1 else seems able spot either ... [additional info] i using symfony web framework (v1.3.8), messing requests encoding , decoding

internet explorer 9 - IE9 RC1 incorrectly encoding input field names that have character entities -

i think may have found bug latest ie9 release candidate, before log issue on connect.microsoft.com, wanted validate brains-trust here understanding correct. problem: a html form contains input field, name attribute contains character entities (&quot), eg. <input type="text" name="mytext[identifier=&quot;test&quot;]" value="hello"> in ie8, ff, safari & chrome, when form submitted, non-safe ascii chars encoded in http request. above input field sent in post as mytext%5bidentifier%3d%22test%22%5d=hello here, can see square brackets encoded %5b , %5d, equals symbol encoded %3d, , &quot entities encoded %22. in ie9 rc1, input field being sent in post as mytext%5bidentifier%3d% 25 22test% 25 22%5d=hello what seems have happened here is, after non-safe ascii chars encoded, ie9 further encoding percent symbols of %22 %25 (giving %2522). i don't think should doing (and mentioned above, no other b

iphone - Crash when using Between Predicate Statement and Float -

so i'm searching core data item inside current map's longitude , latitude. everytime run statement crashes. the code: nserror *error = nil; nsfetchrequest *boutiquerequest = [[nsfetchrequest alloc] init]; nspredicate *predicatetorun = nil; [boutiquerequest setentity:[nsentitydescription entityforname:@"boutique" inmanagedobjectcontext:managedobjectcontext]]; nslog(@"ne longitude: %f", [necoordlong floatvalue]); nslog(@"ne latitude: %f", [necoordlat floatvalue]); nslog(@"sw longitude: %f", [swcoordlong floatvalue]); nslog(@"sw latitude: %f", [swcoordlat floatvalue]); nspredicate *longpredicate = [nspredicate predicatewithformat: @"longitude between %@", [nsarray arraywithobjects:necoordlong, swcoordlong, nil]]; nspredicate *latpredicate = [nspredicate predicatewithformat: @"latitude between %@", [nsarray arraywithobjects:necoordlat, swcoordlat, nil]]; predicatetoru

SQL Server 2008 - Multiple Cascading FK's - Do i need a trigger? -

Image
i have 1..* relationship between user , post . (one user has many posts) post has fk called "userid", maps "userid" field on user table. i tried set fk cascade update/delete, error: 'users' table saved 'posts' table - unable create relationship 'fk_posts_users'. introducing foreign key constraint 'fk_posts_users' on table 'posts' may cause cycles or multiple cascade paths. specify on delete no action or on update no action, or modify other foreign key constraints. not create constraint. see previous errors. i have table called posthelpful. 1 post has many helpful's. helpful has cascading fk user (so when user deleted, helpful's deleted). but think cause of complaint "multiple cascade paths". because if delete user (currently), delete helpfuls. im trying add cacade post also, delete post, try , delete helpful's post (as helpful has cascading fk post). in scenario, cascadi

iphone - How to use Audio File Services to get the raw data of an audio file? -

i'm trying use audio file services audiotoolbox framework raw data wav file. specifically, i'm using audiofilereadbytes() call bytes. here relevant code have: nsstring *audiofilepath = [[nsstring stringwithcstring:argv[1] encoding:nsutf8stringencoding] stringbyexpandingtildeinpath]; nsurl *audiourl = [nsurl fileurlwithpath:audiofilepath]; audiofileid audiofile; osstatus theerr = noerr; uint64 filedatasize = 0; audiostreambasicdescription thefileformat; uint32 thepropertysize = sizeof(thefileformat); theerr = audiofileopenurl((cfurlref)audiourl, kaudiofilereadpermission, 0, &audiofile); thepropertysize = sizeof(filedatasize); theerr = audiofilegetproperty(audiofile, kaudiofilepropertyaudiodatabytecount, &thepropertysize, &filedatasize); //read data buffer uint32 datasize = filedatasize; void* thedata = malloc(datas

Animating GridView with jQuery in ASP.NET -

i have button on home page... onclick i'm getting data database , binding gridview. want "slidedown" gridview on buttonclick. code: $(document).ready(function() { $("#showallrecordsbtn").click(function() { $("#gridview1").slidedown(100); }); }); and have gridview: <asp:gridview id="gridview1" runat="server" cellpadding="4" gridlines="none" style="z-index: 1; left: 65px; top: 93px; position: absolute; height: 180px; width: 304px" autogenerateeditbutton="false" autogeneratecolumns="false" autogeneratedeletebutton="true" datakeynames="empid" onrowdeleting="gridview1_rowdeleting1" onrowcommand="gridview1_rowcommand" forecolor="#333333"> <rowstyle backcolor="#eff3fb" /> <footerstyle backcolor="#507cd1" forecolor="white" font-bold="true" /&g

deployment - Deploying a netbeans 6.9 java web application on websphere application server 6.1 with Java EE 5 specification -

i have developed java web application in netbeans 6.9 java ee 5 specifications .the .war file of project in "dist" folder converted .ear file. tried deploy either .war file or .ear file on websphere application server 6.1 getting exception either .ear file may corrupted or incomplete or deploymentdescriptionexception . me in matter. and netbeans 6.9 have plugin websphere application server 6.1 0r 7 , netbeans 6.9 doesn't show websphere application server in servers list. as far have been told in forums, netbeans not support officially websphere, unfortunatelly.

sql - Manipulations with temp tables on the same connection don't work with sprocs -

i have long-lived connection, on application creates temp table , uses fetch dynamic runtime data. understanding should possible reference temp table long done on same connection. possible indeed when bunch of raw queries, not possible sprocs. use ado.net. am missing obvious here? works create table #customernames (customername nvarchar(200) primary key) declare @customername nvarchar(200) set @customername ='joe baker' insert #customernames (customername) values (@customernames) doesn't work exec customernames_createtemptable exec customernames_addcustomername 'joe baker' where sprocs encapsulate queries edit : solution create temp table outside of sproc using query , manipulations table on same connection using sprocs. way temp table doesn't go out of scope. it's been while since worked sql server, far know, temporary tables created within stored procedure exist duration of procedure execution. in other words, dropped when proced

java - Can sockets accessed in different programming languages communicate? -

are sockets programming language independent ? can keep server written in java , client written in c? absolutely. otherwise pretty hard write web browser , web server, example... of course, data communicate on socket may easier read 1 language - example if use java's dataoutputstream , that's going easier manage java @ other end read data. still could read data, format documented. if put absolutely platform-specific data across network though, makes things harder - tricky use object serialized java's objectoutputstream non-java platform, example. but @ raw sockets level, there's no concept of programming language source happened written in.

Android ListView with complex header -

i'm trying add complex / non-trivial header listview (and less complex footer) needs scroll along rest of content. the header consists of a textview bold text, black transparent background , rounded corners a textview normal text, black transparent background an imageview a clickable button (actually imageview onclick) , divider i'm familiar addheaderview, if try add complex view (consisting of linearlayout multiple children), see first child of complex header in listview header. also, design breaks (because header may styled transparently, listview isn't. perhaps can solved adding more styling listview , entries (which shouldn't transparent), have impression i'm reaching listviews limits here. can done? know of applications (or better, code examples) have similar complex header? other examples i've been able find trivial headers: buttons, textviews or images (online , on so) hardly interesting styling. i've attempted reimplement