Posts

Showing posts from February, 2015

c++ - mvrnorm & riwish -

i sample multivariate normal , inverse-wishart distribution. know r has mvrnorm (mass) , riwish (mcmcpack). possible through rinside use functions? yes, is. can post on rcpp-devel more --- list archives show how access different r functions c++ via rcpp, , rinside lets have c++.

Why isn't PlayFramework recompiling my edited .java files properly? -

Image
i have been working play! framework few weeks now, , enjoying it. have issue come frustrating me. starts when encounter compile error. refresh, , see (excellent) play! error message. here's simple example. i go appropriate file, fix error, , reload page. compiler error: strangely, shows updated source code, bug fix, throwing same compiler error previous message. if restart play! server, compiles , can go on expected, of course 1 of great things play! being able edit .java source files , see changes right away in browser. would appreciate tip who's bumped before, or has clue causing it! much! running osx 10.6. edit have tried manually deleting tmp/ directory, .class files stored. not help, , same behavior, edited source code appears, old compiler error still dsiplayed. my best stab @ clock screwed up. use time synchronization? keep terminal open running: while true; sleep 1; date; done and check whether there correlation clock changes ,...

css - compass hand in hand with wordpress -

i've got dilemma. compass creating output file screen.css (and ie, print) wordpress requires name style.css default theme stylesheet. how can solve this? can change compass default ouput name, or can change wordpress defaul "input" stylesheet scource? -- update -- i did solve problem. not naturally. can temporarily create style.css in theme directory required information. after can customize stylesheet link href in header.php usual. style.css in root theme directory "fake". you can change path css file in header.php change : <link rel="stylesheet" type="text/css" media="all" href="<?php bloginfo( 'stylesheet_url' ); ?>" /> to <link rel="stylesheet" type="text/css" media="all" href="http://www.yoursite.com/path/to/style/sheet.css" />

ruby on rails - Is there an 'updated Railscast episode source code' site? -

i've searched railscast 198 updated rails 3, can find snippets here , there can't find full source code.. hey it's worth search; i'm noob , don't know changes transitioning rails 2 rails 3 takes. i run problem periodically want use method in railscast episode, it's older version of rails, , run few bumps along way. i've benefited railscasts more information on rails out there, (even stackoverflow distant 2nd), this, seems me, biggest problem railscasts. should able update episode source code, great if easy others find. is there site or group of people or easy way find fork updates full episode source code current version of rails? +1 if use this! is looking for? https://github.com/ryanb/railscasts-episodes ryan updates casts(198 updated version of 165) if has it, it's him.

serialization - $(this).serialize() -- How to add a value? -

currently have following: $.ajax({ type: 'post', url: this.action, data: $(this).serialize(), }); this works fine, add value data, tried $.ajax({ type: 'post', url: this.action, data: $(this).serialize() + '&=nonformvalue' + nonformvalue, }); but didn't post correctly. ideas on how can add item serialize string? global page variable isn't form specific. instead of data: $(this).serialize() + '&=nonformvalue' + nonformvalue, you want data: $(this).serialize() + '&nonformvalue=' + nonformvalue, you should careful url-encode value of nonformvalue if might contain special characters.

XSD (XML schema): Element must have one more more children -

let's have xml element this, , i'm trying write xsd element: <foo name="bar"> ... </foo> the rules element are: its name "foo" it has attribute name "bar" its "bar" attribute value string it must have 1 or more children this xsd encapsulate of rules except last: how specify last rule—that element must have children? use <xs:any> element allow elements child content. example code match rules: <xs:schema elementformdefault="qualified" xmlns:xs="http://www.w3.org/2001/xmlschema"> <xs:element name="foo"> <xs:complextype> <xs:sequence> <xs:any minoccurs="1" maxoccurs="unbounded" /> </xs:sequence> <xs:attribute name="bar" type="xs:string" /> </xs:complextype> </xs:element> </xs:schema> you can control allowed elemen...

hyperlink - IE7 link issues? -

my internet shut off... i'm @ library trying fix 1 last feature of test page (and site) before portfolio review date on 1st (tomorrow!!!). here's problem, time i've been testing compatibility of site ie9/ff4/chrome12/safari (latest) not ie7/8. site/test page works want in browsers i've been testing with. as luck have it, library i'm @ has ie7 installed , apparently won't upgrade ie8, think render page correctly. think due finding many instances of issues page renderings in ie7 while there none in ie8 same page through investigating. anyway, on test page linked above, text tab slide-out div in top-left corner of page isn't displaying , oddly enough, simple image link @ bottom right of page isn't either. 2 happen first , last links on page, if helps @ (i'm thinking may have that). else on test page functioning/displaying properly. view test page through of above browsers i've tested see how should display/function. i've tried adjus...

mongodb - Counting sub-document matches in a mongo document -

i have failry simple structure documents: {regid: 1, data: {[{val: 123456}, {val: 324234}, {val: 4353453}, .......]}} the data element array may contain between 30 , 60 sub-documents , collection has ~53000 documents, grow larger. given array of vals, input, [11563012,11563011,82867218,83866648, ....], want return documents have @ least 3 matching data.val. currently, query using $in modifier , $where clause calls js function (countmatches). $in modifier returns document contains @ least 1 item imput , $where function iterates through each document.date, counting matches in input , returns documents above threshold: db.foo.find({"data.val": {$in: [11563012,11563011,82867218,83866648,.......]}, $where: "countmatches(this.data, [11563012,11563011,82867218,83866648,......])>=3"}).count(); similar questions (http://groups.google.com/group/mongodb-user/browse_thread/thread/fa291575fd47c010) seem indicate way count matchs in "sub-documents"...

service - silverlight 4: setting selectedvaluepath, how do i extract it?> -

im new wcf service things im bit lost on approach here. have operation in service called getholdsjoined. listbox im binding called lbxopenholds. able set result itemsource following: public frmholdsdashboard() { initializecomponent(); dbserviceclient db = new dbserviceclient(); db.getholdsjoinedcompleted +=new eventhandler<getholdsjoinedcompletedeventargs>(db_getholdsjoinedcompleted); db.getholdsjoinedasync(); } private void db_getholdsjoinedcompleted(object sender, getholdsjoinedcompletedeventargs e) { lbxopenholds.itemssource = e.result; } but want set selectedvaluepath attribute in 1 of result list items. result list collection. there attribute in each 1 of list objects called a.holdid, composite. want selectedvalue member. how unbox getholdscompletedeventargs ?? or there other way this? sorry if question asked kind of scatterbrained, didn't know how else explai...

ios - Asynchronous calls not working in multithreaded section of code (MKOverlay canDraw) -

i can retrieve data asynchronously through nsurlconnection other part in code base except in candrawmaprect function in subclassed tileoverlayview class. i'm modifying mapkit sample called tilemap download tiles server , overlay information on map. in candrawmaprect call function in overlay class in turn creates url , opens connection. have tested connection class , have confirmed indeed work. i've run in init functions of overlay , overlayview success. urls since can throw them in browser , show right pngs. know candrawmaprect running on multiple threads , have novice experience threads. here connection code, - (id)initwithstringurl: (nsstring*) url { nslog(@"test connect init url %@", url); self = [super init]; if (self) { [self loadurl:[nsurl urlwithstring:url]]; } return self; } + (uiimage*)connectsynchronouswithurl:(nsstring*) url { nsurlrequest *request = [nsurlrequest requestwithurl:[nsurl urlwit...

ASP.NET MVC Routing Debugger - Do I have to recompile to switch back from debugger to my application? -

looking routing debugger . works described. looks have recompile switch debugger browse application. there simpler way switch or way works? i took code , refactored own controller/view/model. way, navigate routedebugger view when need it. i added text input box enter url want debug on view.

css - Firefox webfonts not loading -

i'm having issue webfonts in firefox, other browsers (including ie) work perfectly. my issues webfonts won't load @ all. i've looked @ possible solution, editing htaccess file ( http://www.fontsquirrel.com/blog/2010/11/troubleshooting-font-face-problems ) i've had no luck. the other thing can in firefox's error console following warning: error in parsing value "src". skipped next declaration. here's sample of font-face code: @font-face { font-family:angelinaregular; src:url(../fonts/angelina-webfont.eot); src:url(../fonts/angelina-webfont.eot?iefix) format(eot), url(../fonts/angelina-webfont.woff) format(woff), url(../fonts/angelina-webfont.ttf) format(truetype), url(../fonts/angelina-webfont.svg#webfontovuhcgpn) format(svg); font-weight:normal; font-style:normal; } any ideas? in experience, firefox picky expecting quotes in @font-face rules: @font-face { font-family: angelinaregular; src: ...

c# - How to propagate PropertyChanged changes in DependencyProperty -

i have class implements inotifypropertychanged. instance of class declared dependencyproperty in window, e.g., public imyclass myclass { { return (imyclass)getvalue(myclassproperty); } set { setvalue(myclassproperty, value); } } public static readonly dependencyproperty myclassproperty= dependencyproperty.register("myclass", typeof(imyclass), typeof(mainwindow), new uipropertymetadata(null)); in xaml, have element bound class using text="{binding myclass, converter={staticresource someconverter}} whenever change property in myclass, someconverter triggered. however, happens when swap out myclass. there way tie dependencyproperty updates myclass propertychanged? update. in spirit of aresavatar's solution, here's have far. issue remaining how call invalidateproperty (without having myclass track it...) public imyclass myclass { { return (imyclass)getvalue(myclassproperty); } set { ...

Sending Email to Righfax via VB6 api -

does know how send email righfax? send faxes righfax through vb6 api calls, when send email address invalid character in phone number field. fax info uses same field. don't know how set flag tell email. help...someone...please:( i've used years ago , used vendor's rightfax api achieve wanted. the docs api here .

forms - Controlling PHP WebApp State with SESSION -

i'm creating form wizard requires user step through , complete each step before moving on next. right now, once step validated , completed, switch $_session['step'] next step in line, , check variable when next step loads make sure valid. if user tries skip step out of sequence, $_session['step'] prevents step loading. is proper approach? also, once step completed, want user able go , edit values entered on given previous step. approach doesn't allow this, i'm not sure how i'd set change session step revisiting without knowing if valid request or not. any input on appreciated! there's nothing wrong approach, although might bit limited in doesn't work more 1 form only. however, if 1 small app, no worries. the second question i'm not sure understand, $_session can accept data type, including arrays, fill $_session , you've done in form far ; $_session['my_form'] = array ( 'current_step' = 'ste...

ruby on rails - What's the best way to keep track of ActiveRecord's i18n validation messages? -

i'm forgetting translate things activerecord.errors.models.user.attributes.name.blank in app's languages. have advice keeping track of translations missing? one thing can set i18n.config.exception_handler = :raise_i18n_exception in test environment. won't catch it's super easy , better nothing. (in config/environments/test.rb it'd i18n.exception_handler = :raise_i18n_exception )

php - How to dynamically save all the .css paths and then pass them to assetic for compression? (in Symfony 2) -

i'm having hard time dealing stylesheets , javascripts. all examples assetic + twig assume know beforehand paths of files need. suppose want create 'about' page. the 'about.html.twig' template extends 'layout.html.twig'. the layout must have couple of .css , .js used throughout entire site. the template must load other .css , .js files specific it. so stylesheets block looks this: {% block stylesheets %} {{ parent() }} <link href='bla'> {# more stylesheets #} {% endblock %} then how use assetic in case? am supposed send assets of site beginning, because then, performance boosted? the problem there may conflicts between .css, load .css override own base settings, can't create single .css whole site. i tried setting array store paths, loop, , pass paths assetic. seems syntax css[] = 'another_path.css' not supported twig. have set entire array in 1 assignment yes correct syntax assetic twig extensions...

user interface - How can I use imported .PSD files in GWT-Designer? -

i have various .psd files compose interface. trying learn gwt , gwt-designer. can point me way import files gwt-designer may code interface ? thank you gwt-designer doesn't import psd files directly. @ various panels , widgets available in gwt designer , try map elements in image file. since you're learning, start simple , move there.

php - Running code igniter, several sites, one server, different timezones? -

i using code igniter power our site, not using code igniter date library (just default php date), we have several, sites on same server, they reside in www-nz www-au www-us because these sites use same php.ini cannot use date.timezone. so thinking, sweet as, ill use .htaccess setenv tz location e.g pacific/auckland but having no effect, have feeling code igniter might resetting timezone somewhere... anyone have solution? date_default_timezone_set() place top of index.php files in codeigniter. i've learned setting utc , making time zone conversions on client side save lot of headaches :)

bash - how do I disable stdout redirection-to-file buffering in perl? -

here's script launchs 10 processes, each writing 100,000 lines stdout, inherited parent: #!/usr/bin/env perl # buffer.pl use 5.10.0; use strict; use warnings fatal => "all"; use autodie; use parallel::forkmanager; $pm = parallel::forkmanager->new(4); $|=1; # don't think syswrite... # start 10 jobs write 100,000 lines each (1 .. 10 ) { $pm->start , next; $j (1 .. 100_000) { syswrite(\*stdout,"$j\n"); } $pm->finish; } $pm->wait_all_children; if pipe process, well.. $ perl buffering.pl | wc -l 1000000 but if pipe disk, syswrites clobber each other. $ perl buffering.pl > tmp.txt ; wc -l tmp.txt 457584 tmp.txt what's more, if open write-file handles in child processes , write directly tmp.txt: #!/usr/bin/env perl # buffering2.pl use 5.10.0; use strict; use warnings fatal => "all"; use autodie; use parallel::forkmanager; $pm = parallel::forkmanager->new(4); $|=1; (1 .. 10) { ...

objective c 2.0 - Returning an Array Of ImageViews (IPhone)? -

i understand that: (nsarray *)methodname return array. (uiimageview *)methodname return imageview. but how if wanted return array of imageviews? if you're worried not being clear fact array has uiimageviews, can specify on name of method, like: -(nsarray *)imageviewsforsomething:(id)something; otherwise, there's no reason you'd need return explicitly array of uiimageviews, nsarray trick.

javascript - Bind enter key to specific button on page -

<input type="button" id="save_post" class="button" value="post" style="cursor:pointer;"/> how can bind enter key on persons keyboard specific button on page? it's not in form, , nor want be. thanks! this click button regardless of "enter" happens on page: $(document).keypress(function(e){ if (e.which == 13){ $("#save_post").click(); } });

jquery - Detect the browser tab switching/ browser minimising using javascript -

i trying code own versions of popular games such minesweeper, snake etc using javascript. of games require timer, wonder possible detect whether user switched tab or minimized browser can put game on pause mode? provided! you set var when window catches onblur event. <script> var has_blurred = 0; function meep() { has_blurred = 1; game.pause(); } window.onblur=meep; </script> edit adding onfocus then later on in same window/tab, can handle if window/tab has ever blurred onfocus handler. <script> function handlefocus() { if( has_blurred ) game.unpause(); has_blurred = 0; // reset has_blurred state } window.onfocus=handlefocus; </script>

Use javascript to insert letters -

is there way use javascript insert letter in textarea via onclick? letters dont need fancy, basic. have no code show because dont know begin. maybe clickable div? edit: how can insert letters textarea typed words? not want erase in there simple: html: <textarea id="input"></textarea> <button onclick="maketextappear();">presto!</button> javascript: function maketextappear() { var text = document.getelementbyid('input'); text.value = "hello world"; }

.net - c# using namespace statement ordering -

i thought read somewhere ordering using statements , getting rid of unused ones had kind of performance benefit...but can't seem find evidence or resources support that...is there truth this? from msdn , using-namespace-directives in same compilation unit or namespace body not affect each other , can written in order. very useful link visit.

android - TabActivity Implementing -

i trying make tab activity. works fine . make android:theme="@android:style/theme.notitlebar.fullscreen" in definition in manifest file. not take full screen when launching. program starts splash screen. normal activity. tab @ buttom of screen. tabs go inside screen. does know problem? remove .fullscreen , instead use android:theme="@android:style/theme.notitlebar" with activity tags in androidmanifest.xml, worked out me edit in activity oncreate method use getwindow().setflags(windowmanager.layoutparams.flag_fullscreen, windowmanager.layoutparams.flag_fullscreen);

c - Make sure bad patterns don't come back after refactoring -

i'm refactoring old c code. code has absolutely no layered architecture (everything being accessed everything) , i'm trying change that. i cut direct access structure members (at least write now) , allow access through access functions. there tool (or perhaps directly compiler) check rule me? i need since i'm maintaining fork , upstream isn't concerned code quality. the best way ensure no new code accesses structures directly not make them available using total encapsulation. comes @ cost of not being able use structure on stack anymore. provide function allocate structure, free it, , module functions accept pointer structure. however, definition of structure in c file, , not header file. disadvantage may need write lot of functions manipulate/query structure. i provide snippets old code base i've used approach. header contains: #ifndef inc_queue_h #define inc_queue_h typedef enum { que_ok, que_bad_param, que_no_memory, que_sys_...

javascript - Allow at most 3 consecutive whitespaae charecters -

i'll info user using textarea. can not type 3 consecutive white space characters, invested code :d function trim(mystring) { str = mystring; str = str.replace(/\s/g, " "); alert(str.lastindexof(" ")); if (str.lastindexof(" ")>-1) { alert("at 3 consecutive white space allowed !"); return false; } return mystring.replace(/^[\s]+/,'').replace(/[\s]+$/,'').replace(/[\s]{2,}/,' '); } but not work, can me correcting error ? the above code first replaces types of white characters space, search 3 consecutive white space, if founds shows alert ! you can have @ allowing @ 2 newline in textarea try alternative, simplified version: function trim(str) { if (str.match(/\s\s\s+/)) { alert("at 3 consecutive white space allowed !"); return false; } return str.replace(/\s\s\s+/g,' '); }

php - How to change apache 2.2 htdocs folder out side of apache folder? -

hi want store php project folder out side apache folder. how can that? i changed documentroot "c:/sbnproj" this. after created 1 folder named mytest.php , write &lt?php phpinfo(); ?&gt this code on that. when try access http://localhost/ is working when type http://localhost/mytest.php not working. shows forbidden don't have permission access /mytest.php on server. why happening please me. thanks you need trailing forward slash. c:/sbnproj/ also, check paths... if getting root page it's working, make sure c:/sbnproj/foldername/ exists.

date - Convert string to timestamp in PHP using strtotime -

trying change string like tue jun 28 15:24:51 +0000 2011 to php unix time. found parsing twitter api datestamp strtotime returns -1 me. echo strtotime('fri apr 09 12:53:54 +0000 2010'); any ideas? hosting problems? thanks this dinosaurs use php 4.4.9, code doesn't work. added addtype x-mapp-php5 .php and starts work:) $date = strtotime('fri apr 09 12:53:54 +0000 2010'); echo date('d/m/y',$date); echo $date; works me. check the php version compability: strtotime() api

memory - What are the alignment restrictions on the new Haswell AVX "gather" instructions? -

i'm looking @ avx programming reference . new haswell instructions include eagerly awaited "gather" loads. however, can't figure out alignment restrictions on indexed data items. section 2.5 "memory alignment" of reference seems ought list various vgather* instructions in 1 of tables 2.4 or 2.5... doesn't. background: while gather instructions' supported data sizes 4 , 8 bytes, application benefit gather-loading adjacent 16-bit data value pairs dwords. odd indices 2-byte scale produce 2-byte aligned 4-byte loads , it's not clear me manual whether fault or otherwise fail work intended (i rather suspect i'm out of luck given instructions supporting unaligned accesses seem have 'u' in them). this first time hear avx2. i'm guessing memory alignment restriction won't different current implementation of avx on sandy bridge new vex coding scheme. i.e. no alignment required unless explicitly using aligned vmov in...

visual c++ - a small issue in using exception handling in c++ -

the below given simple exception program giving unhandled exception "microsoft c++ exception: int @ memory location 0x0012fe94..". getting error after function excep() returned. please can tell why error coming here. helpful if possible mistakes in code explained/analysed. learning code better. i using visual c++ 2005. #include <iostream> using namespace std; int main () { int excep(int); throw excep(20); return 0; } int excep(int e) { cout << "an exception occurred. exception nr. " << e << endl; return 0; } in line throw excep(20); excep(20) called first, return value thrown, i.e. throw integer. equivalent to: const int = excep(20); throw i; to idea how exception-snytax looks: #include <iostream> #include <stdexcept> using namespace std; int main () { try { // throw std::runtime_error("test"); } catch (const std::exception &e) { std::cout...

android - Storing video files in database -

i have application containing database pictures. wanted database contain videos. possible store videos in database converting them byte array or other format? you store binary object within database, why bother? store path/file name pictures/videos.

java - wildcard generics in HashSet constructor -

the java hashset implementation has constructor: public hashset(collection<? extends e> c) { map = new hashmap<e,object>(math.max((int) (c.size()/.75f) + 1, 16)); addall(c); } why collection<? extends e> c ? isn't enough: collection<e> c ? the concept here called variance (covariance, contravariance). let's have following 2 classes: class {} class b extends {} in case, can an instance of b instance of a . in other words, following code valid: a instance = new b(); now, generic classes in java are, default, invariant. means list<b> not list<a> . in other words, following code not compile: list<a> = new arraylist<b>(); // error - type mismatch! however, if have instance of b, sure can add list of (because b extends a): list<a> = new arraylist<a>(); as.add(new b()); now, let's have method deals lists of consuming instances: void printas(list<a> as) { ... } it t...

c - Embedding a filesystem in an executable? -

i'm sort of curious: if wanted embed filesystem in executable, assume i'd embed image of filesystem using objcopy. however, sort of filesystem should use? there going easy library directly accessing filesystem image? i don't have use this, responses "don't it, use actual files instead" irrelevant. there exist so-called virtual file system implementations, designed custom storage in mind. name few: our solid file system , codebase file system , single file system aidaim. most of them use files container, (eg. our solfs) let have container in custom places , access via callbacks. depending on practical requirements can use zip or tar format well. if want expose filesystem contained in executable os other applications read it, 1 of our virtual storage solutions (callbackdisk or callback file system) job on windows. on linux , macos x there exist other ways this, including fuse , macfuse libraries (analogs our cbfs).

java - Ideal data source for Standalone Applications? -

suppose created standalone application in java , distributed through website. what need know ideal database solution can use users can use application without installing extra. for example, if use sql server or mysql database, downloader need installed can dump database on it. solution see use database file microsoft access .mdb file. need microsoft office installed on client. xml files platform independent can open , change them. what solution used of applications? h2 potent candidate need. use default rdbms in our demo applications , db-driven unit testing.

bash - echo -n aWord | md5 not returning expected result -

when pass line echo -n aword | md5 directly in shell expected result - same php md5('aword') - when call code file different string. please help. if following md5s: =$ echo -n aword | md5sum a72ef25b2fa8080e6e0643c967284842 - and file: =$ cat test.file aword =$ md5sum test.file 1d03663ed556e850007c886ce5ad3ade test.file this because there additional character in file - new line character: =$ hexdump -c test.file 00000000 61 57 6f 72 64 0a |aword.| 00000006

java - HttpClient - logs in, then loses cookie -

i've been banging head against wall on past couple of days , can't work out i'm praying can me it. basically i'm logging wordpress account, post login details , cookie shows i'm logged in, try access user maintenance panel , redirected logon page. when cycle through cookies seems logon cookie has gone. i'm using new v4 httpclient, supposedly has better cookie management. if has idea of going on, i'd appreciate it. here functional example: import org.apache.http.httpentity; import org.apache.http.httpresponse; import org.apache.http.namevaluepair; import org.apache.http.client.entity.urlencodedformentity; import org.apache.http.client.methods.httpget; import org.apache.http.client.methods.httppost; import org.apache.http.cookie.cookie; import org.apache.http.impl.client.defaulthttpclient; import org.apache.http.message.basicnamevaluepair; import org.apache.http.protocol.http; import org.apache.http.util.entityutils; import java.util.arraylist; ...

Persistent data structures in Java -

i need persistent storage in java (possibly large) data structures, such as: dense , sparse matrices of integers, doubles, booleans directed graphs labeled nodes , edges binary trees maps: string->string, string->integer (with fast retrieval of keys largest values) sets of integers or strings i don't mind if there separate storage each data structure, long storages have similar, consistent interfaces. i need able efficiently modify data structures "remotely", is, without fetching entire structure ram, modifying it, , storing back. example operations: put key-value in map, remove node tree, modify node's label in graph, add value set. it nice if these storages accessed other programming languages, notably python. i'm thinking of restful service in backend , client apis in java , python. motivation: need process large collection of documents , perform various analyses on them. want explore various approaches , create fast prototypes (for...

Jruby rails application on Tomcat. War generated through warbler -

i using warbler create war of jruby application. creates war without problem, when deploy in tomcat (webapps) gives me following exception: severe: parse error in application web.xml file @ jndi:/localhost/poc_rails_1_3_1_/web-inf/web.xml org.xml.sax.saxparseexception: comment must start "<!--". @ com.sun.org.apache.xerces.internal.parsers.abstractsaxparser.parse(abstractsaxparser.java:1231) generated (web-inf/web.xml) below. let me know if have forgotten configure something. <!doctype web-app public "-//sun microsystems, inc.//dtd web application 2.3//en" "http://java.sun.com/dtd/web-app_2_3.dtd"> <web-app> <context-param> <param-name>public.root</param-name> <param-value>/</param-value> </context-param> <context-param> <param-name>rails.env</param-name> <param-value>developement</param-value> </context-param> <filt...

android- How to get the width and height of the list view dynamically -

in application want display list view using adapter. want current height , width of list view (means after generating list using adapter). how it. can me. thanks use getwidth() , getheight() method of listview in onwindowfocuschanged width , height. @override public void onwindowfocuschanged(boolean hasfocus) { super.onwindowfocuschanged(hasfocus); system.out.println("width:" + listview.getwidth()); system.out.println("height:" + listview.getheight()); }

php - How to show text outside input ONFOCUS? -

i have form this: <form action="search.php" class='search' method='get'> <input type="text/submit" class="home_search_area" value="search" name="search" onblur="if(value=='') value = 'search'" onfocus="if(value=='search') value = ''" /></form> now form hides word "search" on focus. want show text "press enter start searching" outside textarea onfocus. how can this? add element under input field: <div id="tips"></div> add onfocus event: onfocus="if(value=='search') value = ''; document.getelementbyid('tips').innerhtml = 'press enter...'"

CamelCase Expansion in Vim like Intellij Idea? -

in intellij idea, there's feature. let's have used variable mycamelcase somewhere in code. if type mcc , press ctrl - enter or such key combination, expands mycamelcase . there similar in vim? okay, forgive me answering twice, since first attempt missed point, i'll have go. more complicated thought, possibly not complicated have made (!). this modified suggest matching variable names. first of all, here's function generate 'mcc' abbreviation 'mycamelcase' string: function! camel_initials(camel) let first_char = matchstr(a:camel,"^.") let other_char = substitute(a:camel,"\\u","","g") return first_char . other_char endfunction now, here's function takes abbreviation ('mcc') , scans current buffer (backwards current line) "words" have abbreviation. a list of matches returned: function! expand_camel_initials(abbrev) let winview=winsaveview() let candid...

actionscript 3 - Flash CS5 generates unwanted preloader -

one of our external developers has created minigame in flash cs5 embedding in our container loading swf. minigame's document class ( icegame ) should , implement specific interface dreambearminigame . however, appears when game published kind of preloader generated, since when loading game in container , casting loader.content dreambearminigame error cannot convert icegame__preloader__@blabla dreambearminigame we've rummaged through publish settings of minigame's fla can't find place turn off. what's going on? this has been solved since july 1st asker, no accepted answer. therefore, drop bottom of unanswered (and maybe remove tab if gets accepted...) i'm posting rote answer community courtesy. here link posted above, asker said answered question: flash cs5 tlf engine causes errors loaded swfs . if can offer better (read more detailed) answer, please feel free so. can't answer because don't have expertise so. again, community servi...

uiimageview - Dragging an image and leaving it where it was dragged on the iphone -

i have map image , able drag image somewhere on screen , able go image webserver new map image being old image dragged. i've tried uiimageview in uiscrollview image bounced fill screen if try drag off. setting uiscrollview .bounces = no isn't need either because prevents me dragging image off of screen. there easy way functionality? i think want @ uiresponder methods touchesbegan , touchesmoved , touchesended .

javascript - How do I use scrollTop when trying to figure out sidebar position? -

i posted question yesterday , answer go mentioned should check if scrolltop higher header height. question how do query. how do when different people have different screen sizes $('selector').height () return height of first element match selector in pixels. it's in manual. http://api.jquery.com/height/

javascript - document.form[0] does not work on Firefox -

function func(){ (document.forms[0]){ inputid.value = "text"; //works! spanid.innerhtml = "text"; //err, spanid not defined. } } this not working in firefox in ie7. debug in firebug, spanid not defined , can use document.getelementbyid("spanid") select element. don't know why? input element works fine! shouldn't document.forms[0] (notice s on form) **edit** since answers aren't rolling in on one, here's suggestion. it. use methods you're familiar , don't waste time trying work. function yourfunction() { var objspan = document.getelementbyid([insert element id]); var objinput = document.getelementbyid([insert element id]); objspan.innerhtml = "text"; ... }

performance - Same code on one server runs super slow on one site but fast on another -

i'm trying troubleshoot why our asp pages pages running agonizingly slow. test created simple hello world asp page. on same server, 1 site pull fast expected, on site 30+ seconds! **update: realized it's not asp, it's pages, kind of core issue. 404 page take 15 seconds display even. sites on same server pop right without delay. the difference know of site generates @ acceptable speed running coldfusion code, can't imagine reason why effect @ all. i'm not sure go , check here. fyi running iis7 on server 2008r2 ok, found problem. defaultapppool stopped :-/. started , cosmos

email - Use special characters in PHP mail() function -

i send special characters (like é, à, ü,...) using php mail() function. tried this: (just fragment of code) $headers = 'from: info@something.be'; $header_ = 'mime-version: 1.0' . "\r\n" . 'content-type: text/plain; charset=utf-8' . "\r\n"; $to = "me@gmail.com"; $subject = 'confirmation de commande'; $message = "bonjour $firstname"; if (mail($to, '=?utf-8?b?'.base64_encode($subject).'?=', $message, $headers)) {... but reason, things sâélève. advice? make sure set internal encoding utf8 iconv_set_encoding .

ruby on rails - My has_many :through association of Users, Groups, and Memberships is causing trouble in some methods -

i working has_many :through association: users join groups through membership. having trouble methods created in user model determine if user member of group, , allow user join , leave group. using console, memberships.find_by_group_id returns nil. not sure why , think might way have set has_many :through associations, though after looking on many, many times , consulting railscasts/blogs seems ok. if want me post more info, schema.db or something, let me know class user < activerecord::base has_many :memberships, :dependent => :destroy has_many :groups, :through => :memberships . . . def member?(group) memberships.find_by_group_id(group) end def join!(group) memberships.create!(:group_id => group.id) end def leave!(group) memberships.find_by_group_id(group).destroy end . . . end class group < activerecord::base has_many :memberships has_many :members, :through => :memberships, :source => :user has_attached_file :photo, :style...

ruby on rails - Mailer Broken from Controller -

so i've written mailer entitled usermailer containing method entitled test. method accepts 2 parameters: user (object) , recipient (email). from console can send mailer command usermailer::deliver_test(user.find(1), 'email@email.com') , email sends successfully. but if define same command or counterpart usermailer.test(user.find(1), 'email@email.com').deliver in users#mail , accessing action via users/mail returns nothing. what have controller trigger delivery properly? you need call mailer's class method inside controller usermailer.deliver_test(user.find(1), 'email@email.com') or user's instance method: usermailer.deliver_test(self, 'email@email.com')

excel vba - VBA: Handling multiple message items -

i tried figuring out how handle multiple message objects programmatically following snippet, having trouble it. ultimately, want send message list of recipients in spreadsheet file. objects , methods job in easiest way? dim w outlook.application dim winbox outlook.mapifolder dim objoutlookmsg outlook.mailitem dim objoutlookrecip outlook.recipient dim count, x, msgnum integer ' handle microsoft outlook set w = getobject(, "outlook.application") if err = err_app_notrunning ' open new instance if none running set w = new outlook.application winbox = w.getnamespace("mapi").getdefaultfolder(olfolderinbox) end if 'count number of emails required count = cells(1, 2).end(xldown).row msgnum = winbox.items.count x = 1 count set objoutlookmsg = w.createitem(olmailitem) msgnum = winbox.items.count next x -------edit--------- if handle code this? dim w out...

Find the location of android device's Environment.getExternalStorageDirectory using ADB? -

is there way using adb know location of specific plugged in device return environment.getexternalstoragedirectory ? i push file there , read file activity running on device. think path can vary based on device, , have run on numerous different android devices. thanks! for away using "/sdcard" in case don't find better solution. it's defined pretty static in android source .

c# - Unable to declare an ArrayList -

i'm not able declare arraylist. here's code. (i'd rather use lists, i'm trying understand concept of arraylist). private void button1_click(object sender, eventargs e) { arraylist salestotals = new arraylist(); decimal[] decimalsales = { 1000m, 2000m, 3000m }; foreach (decimal singlesales in decimalsales) { salestotals.add(singlesales); } } when compile this, error: 'arraylist' 'namespace' used 'type' i'm using namespace system.collections (not .generic ) what causing , how fix it? it sounds using arraylist within namespace called arraylist . symbol resolving namespace definition, invalid in symbol's context, causing error describe.

c - Why does LD_PRELOAD not seem to work for write with wc -

i playing around ld_preload intercept libc calls, appears write call doesn't intercepted wc, though seem work cat. stripped down version of problem appears below. redhat linux 2.6.9-42.elsmp makefile writelib: gcc -wall -rdynamic -fpic -c write.c gcc -shared -wl,-soname,libwrite.so -wl,-export-dynamic -o libwrite.so write.o -ldl write.c: #include <stdio.h> #include <string.h> #ifndef __use_gnu #define __use_gnu #define __use_gnu_defined #endif #include <dlfcn.h> #ifdef __use_gnu_defined #undef __use_gnu #undef __use_gnu_defined #endif #include <unistd.h> #include <stdlib.h> static ssize_t (*libc_write)(int fd, const void *buf, size_t len); ssize_t write(int fd, const void *buf, size_t len) { static int already; ssize_t ret; if (!already) { if ((libc_write = dlsym(rtld_next, "write")) == null) { exit(1); } = 1; } ret = (*libc_writ...

jquery - Incremental CSS positioning not working -

i swear should work, it's not. must missing simple: html: <div id="box"></div> css: #box { position: absolute; background: blue; width: 200px; height: 200px; left: 20px; top: 20px; } javascript: $('#box').click(function(e) { if (e.shiftkey) $(this).css('left', '70px'); else $(this).css('left', '+=50'); }); if shift+click, box moves should. try clicking without shift, , box not increase left edge position 50px. gives? see http://bugs.jquery.com/ticket/9237 the bug fixed in 1.6.2 . broken: http://jsfiddle.net/kwpuq/ fixed: http://jsfiddle.net/kwpuq/1/ - that's using "jquery (edge)"

ruby on rails - Phusion Passenger on shared server -

does have advice on fixing passenger's slow initial load on shared server? typically work engineyard , lovely gem, makes deploying easier. i'm wondering if has advice on how speed passenger or advice on switching passenger else. are there passenger alternatives wont have same initial delay issues? if have access passenger configuration, believe passengerprestart option better wget . http://www.modrails.com/documentation/users%20guide%20apache.html#passengerprestart

security - User Uploaded CSS safe? -

is there tricky user-uploaded css harm site? if wanted allow users upload/share own css themes site, there should or disallow? edit: assume know how check if it's valid css file etc. i'm looking css specific exploits need avoid. even if parse file valid css hacker still malicious using :before , :after . ensure security want whitelist subset of css properties & selectors in validation.

graphics - How can I upload an icon for my app on facebook with out the black grainy borders? -

i have logo , when upload facebook has black border around it. think because has transparent background , has shadow. there anyway fix this? facebook doesn't support transparent images , coverts jpg file. save file jpg (using appropriate background color) , try upload it.

html - Jquery delay disabled -

why following code doesn't work? want input disabled 1 second , go normal again. $('#chat_bg').attr('disabled', true).delay(1).$('#chat_bg').attr('disabled', false); aside syntactically invalid javascript, , fact .delay() interprets argument milliseconds, not seconds: .delay() affect events queue default, .attr() not interact with. keep simple, , use settimeout . var $elt = $('#chat_bg').attr('disabled', true); settimeout(function () { $elt.attr('disabled', false); }, 1000);

How do I debug a pre-existing Android .apk with Eclipse? -

Image
i need debug android apps built our makefile-based build system. there way eclipse debug existing .apk? recreating source builds these apps in eclipse ide impractical due number , size of them. i'm assuming debuggable set true in manifest. attach: select process list , press green debug icon @ top detach: press disconnect button in debug perspective

How can you change the order of the values of every field in a structure without knowing the amount of fields? (MatLab) -

write function called sortstruct takes in structure array , sorts structure array values in inputted field. if values numeric, function sorts them lowest highest. if values characters, function sorts words alphabetically case mattering (e.g. 'apples' before 'apples'). if field not exist in structure array, function returns string 'invalid field name'. here have far: function [ structsort ] = sortstruct( strucarray, fname ) if isfield(strucarray, fname) ~= '1' structsort = 'invalid field name'; end = class(fname); = 'double' [sorteddoub inddoub] = sort(fname); fieldn = fieldnames(strucarray); num = length(fieldn); strucarray = setfield(strucarray, fname, sorteddoub); structsort = setfield(strucarray, fieldn, fieldn(inddoub)); end = 'char' [sortedchar indchar] = sort(char2num(fname(1))); end you seem on right track, aside sy...

How to connect Android SQLITE Database to Remote MSSQL database -

we have scheduler application in android storing data in sqlite database. have connect our application remote mssql server database , should store our data in database , vice versa should happen.can u please solution thank you. you can not connect directly mssql database need development environment(like php ) , create db in , generate web-services of insert , select db. when call services can directly sore data in mssql.and when show can fetch calling select webservices.

android - Problem with View.playSoundEffect? -

i'm trying play soundeffect (using view.playsoundeffec() method) when button focused. the problem effects never played unless target phone's audible selection enabled ( can enabled from: settings => sounds & display => audible selection ) what want is, when audible selection isn't enabled, want enable in programmatic way. possible ?

how to install services in .net -

i trying install services in .net. i have install 'installutil.exe' in c:\windows\microsoft.net\framework\v2.0.50727' folder. but failing install that. can 1 me. i found article . hope, may you, if wish make programmaticaly. regards.

Bash if and or conditionals -

i have perl script runs in cron , if script fails run leaves behind lock file prevent script run again. i'm trying run bash script checks if process running , checks see if lock file left behind if processes running , lock file exists exit 0; if process not running , lock file exists rm lockfile. exit 0; if process not exist , lock file 'not present' exit 0; i've been checking if process exists running ps ax |grep -v grep |grep process.pl i'm looking conditionals in bash should running here. thanks the process.pl should write process id lockfile, wihch common pattern. can write following code: if [ -f "$lockfile" ]; pid=$(cat "$lockfile") if kill -0 "$pid"; : "running normally" else : "terminated somehow" rm -f "$lockfile" fi fi

i need help php css div and flash -

hello wanted include flash clock on header overlaps causing existing header not being displayed. please refer image link thanks. <?php echo " <p align=\"center\"> <embed title=\"clock\" src=\"http://www.respectsoft.com/onlineclock/onlineclock.swf?ccolor=red\"quality=\"high\" wmode=\"transparent\" bgcolor=\"#ffffff\" width=\"88\" height=\"31\" align=\"middle\" allowscriptaccess=\"samedomain\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" /> <br>\n"; ?> this working still interferring... <?php echo "<div style=\"position: relative; z-index: 1;\"> <embed title=\"clock\" src=\"http://www.respectsoft.com/onlineclock/onlineclock.swf?ccolor=red\" quality=\"high\" wmode=\"transpar...

activerecord - rails 3 + active record: is there a clever way to "round robin" the order of records -

(the actual numbers 100x larger, easier explain follows) we have record set of 100 reviews 5 restaurants. restaurants have 3 or 4 reviews, have 20-30 reviews. currently have simple report arranges them newest oldest: @reviews = review.joins(:store). where('reviews.published= ?',true). order("reviews.created_at desc") for 1 of report views, need display reviews in round-robin order ensures each restaurant gets equal coverage @ top of list. most recent restaurant #a recent restaurant #b ... recent restaurant #e then repeat next-most-recent #a, #b,... #e etc ideally order of round-robin restaurant has total reviews. it's not hard slow way in code, i'm wondering if there's faster/better activerecord approach? === is there way (a) sort restaurant, (b) create temporary "counter" column counts 1 n each entry each restaurant, (c) re-sort on counter column? it. for example, after (a) , (b) recordset be a , <some review...

multithreading - Qt - Worker thread freezes the UI -

this first experience on threading qt, bear me. i have singleton "system" object periodically executes heavy piece of code. control system singleton ui, system not aware of ui. i create thread in main, , move system it: qthread systemthread; system::instance()->movetothread(&systemthread); systemthread.start(); qapp.exec(); the ui hangs until system's periodical processing cycle complete. i have tried subclass qthread , calling exec run method. what problem? i'm doing wrong. best regards see excellent article threads, events , qobjects in qt developer wiki. seems wrong thread affinity, can check qobject::thread().

c++ - Using MFC and ATL libraries without Visual Studio -

my question if can use mfc , atl libraries come psdk windows server 2003 r2, without visual studio. mean @ command prompt bcc32.exe or cl.exe? i have found mfc , atl libraries in psdk windows server 2003 r2 not know if these libraries can used without visual stuio ide! need before using mfc , atl @ command prompt? thanks! if have headers, , either source code or compiled version of rest, yes can used without visual studio. visual studio ide invokes compiler etc. you. command line tools job yourself. here's minimal mfc program can try out: #define winver 0x0500 // windows 2000 , up. #include <afxwin.h> // mfc core , standard components typedef cframewnd mainwindow; class app : public cwinapp { private: bool createthemainwindow() { static char const title[] = "a general top level mfc window"; mainwindow* const pwnd = new mainwindow; if( !pwnd ) { return false; } // pre-stan...

javascript - function with radiobuttons groups -

welcome i have problem. i'm trying build javascript function retrieve me selected radiobutton value div dynamically, after page loads. on side have several groups radiobutton. function check radiobutton selected, regardless of group , return value div. additionally, not selected range value has been added same div. function returnradio(){ return $('div :radio:checked'); // can use class or id div } returnradio();

pattern matching - What does s-/-- and s-/\Z-- in perl mean? -

i beginner in perl , have query regarding pattern matching. came across line in perl written $variable =~ s-/\z--; and code goes ahead variable assigned $variable1 =~ s-/--; can please tell me these 2 lines do? want know s-/\z-- , s-/-- mean. $variable =~ s-/\z--; - used delimiter here. however, best practice suggests either use / or {} delimiters. it re-written as: $variable =~ s{/\z}{}; # remove / @ end of string consider: $variable1 =~ s-/--; again, re-written as: $variable1 =~ s{/}{}; # remove first /

php - Lost in jQuery .each() -

in script below, i'm trying parse through select list , each option, call php returns value (psuedo true/false) based on options "value" attribute. however, when i'm inside $.get [to evaluate return value , execute script against current option in each(),] can't figure out how reference current option element in order modify it. $('#my_select').click( function(){ $('#my_select option').each( function(){ $.get( '<?php echo getstyle.php',{option: $(this).val()}, function(response){ alert($(this).val()); //returns empty alert. should return value of current option //$(this).attr("disabled","disabled"); //if (response.success){$(this).attr("disabled","disabled");} }); }); }); here's php script reference...

servlets - i want to get Async Fetch Response (Google App Engine) -

i make web application on google app engine , use asyncurlfetch api. but, cannot response. please me... searc.java private arraylist<future<httpresponse>> fetchurl() { arraylist<future<httpresponse>> futurelist = new arraylist<future<httpresponse>>(); (searchresult searchresult : searchresultlist) { if (!searchresult.isempty()) { (webpage webpage : searchresult.getwebpagearray()) { try { url url = new url( "http://myapi.appspot.com/htmlparser?url=" + webpage.getpageurl()); urlfetchservice = urlfetchservicefactory .geturlfetchservice(); futurelist.add(us.fetchasync(url)); } catch (malformedurlexception e) { // todo auto-generated catch block e.printstacktrace(); } ...