Posts

Showing posts from June, 2011

octree - Barnes Hut worst case memory scenario -

i want run barnes hut n-body simulation ( wikipedia article ). know how memory single node of octree occupy, can't figure out worst case memory usage scenario given number of particles. in short, i'm wondering how many nodes possibly exist in octree given number of particles. need know know how memory allocate octree. edit: oh, , i'm writing in c if wants give me code instead of , explanation. i have this, way worse worst case scenario. it's guaranteed @ least allocate enough memory. i'm hoping can give me little more memory efficient. int kbh_worstcase(int particles) { // returns number of nodes required store number of particles in worst case scenario int worst; unsigned int n; worst=1; n=1; while(n<particles) { n=n<<3; worst+=n; } return worst; } i'm not sure if such suitable criterion exists. octree takes account particles distribution change during simulation. effective depth of t...

CSS and form input:text not showing input text -

i trying make input form have background image, apply css class input, default value not show (it work if there no css class applied). here html: <form> <input type="text" class="emailinput" value="enter email address"> <input type="submit" class="emailbtn" value=""> </form> and here css associated it: input.emailinput { color:#000; background:url('images/emailbackground.png') no-repeat; display:block; width:313px; height:31px; text-indent:-5000px; position:relative; top:0px; left:-2px; border:none; } input.emailbtn { background:url('images/emailbtn.png') no-repeat; display:block; width:55px; height:38px; text-indent:-5000px; position:relative; top:-32px; left:323px; border:none; } i @ total loss. appreciated. perhaps text-indent:-5000px; causing text positioned out of visible area.

refactoring - Is there command-line tool to extract typedef, structure, enumeration, variable, function from a C or C++ file? -

i desiring command-line tool extract definition or declaration (typedef, structure, enumeration, variable, or function) c or c++ source file. way replace existing definition/declaration handy (after transforming extracted definition user-submitted script). there such generic tool available, or resonably close approximation of such tool? scriptability , ability hook-up user created scripts or programs of importance here, although academically curious of gui programs too. open source solutions unix/linux camp preferred (although curious of windows , os x tools too). primary language interests c , c++ more generic solution better (i think not need super accurate parsing capabilities finding, extracting , replacing definition in program source file). sample use cases (extra - curious mind): given nested struct s , variable (array) initializations of these types, suppose there need change struct definition adding or reordering fields or rewriting variable/array definitions in ...

javascript - how can i toggle a <p:password> field to text and password with a checkbox check uncheck -

i using p:password tag registration. want toggle field text when checked check box, change password type mode when unchecked. how solve problem primefaces component. using primefaces 3.0 , jsf 2.0. under cover generates <input type="password"/> field (with other attribute name etc..) so if need show password have check box like <input type="checkbox" id="showpassword" onclick="showpassword()"/> show password in javascript function showpassword(){ var showpasswordcheckbox = document.getelementbyid("showpassword"); if(showpasswordcheckbox.checked){ document.getelementbyid("id_for_your_password_field").type="text"; }else{ document.getelementbyid("id_for_your_password_field").type="password"; } }

javascript - How to scroll when cursor is on the edge of div? -

Image
i have div(menubar) has lot of links , these links out of view. must make div scroll right or left when cursor @ edge of menu div, in order bring these menu items view. i beginner jquery, appreciated. markup in jsfiddle short: use-ready solutions: scrolling-carousel jmycarousel ( demo ) smooth div scroll full answers can read on relative questions: jquery plugin continually horizontally scroll on mouseover looking jquery plugin (or code) automatically scroll carousel items on mousover

android - How to reference the current or main activity from another class -

i find myself needing access methods require referencing activity. example, use getwindowmanager , need access activity. code using these methods in other class has no reference activity. until now, i've either stored reference main activity or passed context of activity class. there better way this? passing context better way refrence activity. you can pass context class. in activity :: anotherclass obj = new anotherclass(this); in class class anotherclass{ public anotherclass(context context){ } }

java ee - Primefaces dataTable only adding a single row -

i've been digging through archives find answer might help, nothing seems apply. i have page in jsf nested datatables holding list backing bean. page seems holding data without issues, when attempt add rows either of datatables using p:collector primefaces object, datatable ever displays single row. adding empty object both lists. the objects contained in list custom objects implement serializable. my backing bean conversationscoped, , data in backing bean instantiated when conversation started. here main page: <ui:composition template="/templates/pagelayout.xhtml"> <ui:define name="pagecontent"> <h:form id="genericworkflowmainform" enctype="multipart/form-data"> <p:panel id="actionlist"> <div align="right"> <p:commandbutton id="addactionbutton" value="add action" update="actiontable"...

c# - Returning Azure Blob Stream directly from WCF service -

i looking return stream azure blob storage directly browser via wcf. have rest wcf service , looking have users download files via service while files stored in azure blob storage. in question returning azure blob wcf service stream - need close it? it downloads entire file new stream first, there way give blob stream return stream wcf wcf acts more proxy stream? my issue large files (> 10mb), not want download entire stream azure storage before can start returning user. the reason doing way doing security checks on user before allow access file stored in azure blob storage, of files 1gb in size. i have done similar wcf used authorize client (and check blob still exists , on). if ok wcf service returned url shared access signature - allowed client access stream directly storage. saving transaction costs of pulling blob wcf role , streaming there. might work you?

include - How to assign the contents of a file to a variable in PHP -

i have document file containing html markup. want assign contents of entire file php variable. i have line of code: $body = include('email_template.php'); when var_dump() string(1) "'" is possible assign contents of file variable? [note: reason doing want separate body segment of mail message mailer script -- sort of template user modifies html markup , not need concerned mailer script. including file entire body segment on mail($to, $subject, $body, $headers, $return_path); thanks. if there php code needs executed, indeed need use include . however, include not return output file; emitted browser. need use php feature called output buffering: captures output sent script. can access , use data: ob_start(); // start capturing output include('email_template.php'); // execute file $content = ob_get_contents(); // contents buffer ob_end_clean(); // stop buffering , discard contents

How to restore the default html output destination in SAS? -

this must simple, can't find it: how restore default output destination in sas 9.3? unlike 9.2, html. in other words, commands voids statement. ods html close; you can turn html on with ods html; but there other options need...like filename ods html file="my file.htm"; ods html

jsf - f:setPropertyActionListener can not set the property -

i trying set value of backingbeans property via <f:setpropertyactionlistener value="#{customer}" target="#{customersviewbean.selectedcustomer}" /> but not set value.it surprising have initialized property in class when pushed command link, set null , gives null pointer exception.do have idea wrong? <p:datalist id="datalist5" value="#{customersviewbean.filteredpositioncustomer}" rendered="#{customersviewbean.positionagoreliste}" var="customer"> <p:column style="padding-bottom:1px!important;"> <p:commandlink id="commandlink" action="#{customersviewbean.getcustomerdetail}"> <f:setpropertyactionlistener value="#{customer}" target="#{customersviewbean...

iphone - Performance of drawRect -

hey guys quick question performance of drawrect: i've noticed lot of topics people complaining performance issues. in app, need draw ~150 squares overtop underlaying views. many calls isn't going have noticeable user difference, i'm wondering pros , cons going forward. i'm debating 2 ways: 1) add transparent uiview subclass on top custom drawrect: facilitate drawing 2) add normal square subviews as said, using cadisplaylink there won't difference user, i'm curious more efficient? (2) kind of ridiculous way of doing it, adding instances useless functionality appearance, these posts have scared me using drawrect . drawrect inefficient? thanks perhaps unintuitively, drawrect: isn't called every frame. in fact, if nothing special in view , view doesn't changed, gets called once. you can force called calling [myview setneedsdisplay] , there no reason to. if have view overlapping subviews, still each of views, including supervie...

Compiling and executing Redis ziplist.c -

how compile , execute redis ziplist.c individual executable ? i want execute ziplist.c main function only. you can use following command: gcc -std=c99 -o2 -dziplist_test_main ziplist.c zmalloc.c util.c sds.c adlist.c note: use default system allocator.

c++ - Custom System Dialog - Windows Mobile 6.5 -

i tryng override system dialog (system sound), closing notification , showing mine. questions: 1- how close notifycation dialog system 2-how cacth key (volume key) initiates notification 3-show mine have googling issue cannot advance: application qt based. first of need hook keyboard. links tryng now: http://www.codeproject.com/articles/12154/keyboard-hooks-in-wince studyng , adapting article needs. second: need customized system notification (volume control): wil apply approach. inform result

php - How to get a specific object from array of objects inside specific MongoDB document? -

there struct of mongodb documents: { _id : "12345", name : "foo", object : { array_of_objects : [{ id : 507, name : "some name", dt : "2012-06-27 16:35:50" },{ id : 506 name : "some other name", dt : "2012-06-21 16:09:05" }, … ] } } i need object array_of_objects id of document specified name . use php , tried execute next code: $collection->find(array('name' => 'foo', 'object.array_of_objects.id' => 507)); it returns elements of array_of_objects instead of element id 507. after try make query $elemmatch: $collection->find(array('name' => 'foo', 'object.array_of_objects' => array('$elemmatch' => array('id' => 507)))); but had return same. :( mongodb version 2.0.6. please help. this issue...

javascript - Dymanic loading in Extjs4.1.0 -

i new extjs, have read in extjs 4 make use of dynamic loading of classes , didnt quiet concept. meant dynamic loading in extjs, mean load javascript files on demand. eg if have 10 different components (in card layout lets say) 1 has displayed on initial load, javascript file of rest of 9 components not loaded until components has displayed? tried pandora application (extjs 4 version) found loading javascript files browser upfront on initial load (even loaded javscript files components not been displayed). if case purpose dynamic loading solve ? you got right. if read guides though says dynamic loading not meant used in production. meaning loading 1 file @ time not optimal, tremendously debugging code. other thing eliminates need list out of files 1 one in html of page going run app. dont have create script tags each class right - , believe me mvc app right lot of classes, each 1 in it's own file. do? recommended approach use sencha sdk build tool concatenate , minify...

android - Getting low memory warning but I don't appear to be leaking memory -

my application closing without error messages , re-launching automatically after switching activities approximately 20 or 30 times. i'm testing tapping button relaunches current activity different data (and cycles around beginning once end of data reached). activity launched flag_activity_clear_top flag there should ever 1 instance of activity in memory @ time. if set flag_activity_no_history problem still occurs. this appears in logcat output when app crashes: 06-28 19:32:10.472: i/activitymanager(115): process com.mypackage.myapp (pid 3718) has died. 06-28 19:32:10.476: i/windowmanager(115): win death: window{406d06e0 com.mypackage.myapp/com.mypackage.myapp.welcome.loginactivity paused=false} 06-28 19:32:10.480: e/inputdispatcher(115): channel '406ade20 com.mypackage.myapp/com.mypackage.myapp.matchup.matchupactivity (server)' ~ consumer closed input channel or error occurred. events=0x8 06-28 19:32:10.480: e/inputdispatcher(115): channel '406ade20 com.my...

ruby on rails - Saving the posted data from four random rows so they don't randomize after page generation -

i'm using code: <h2> <% random_bullets = bullet.all %> <ul> <% random_bullets.shuffle.first(4).each |r| %> <br> <li><%= db.save(r.content) %></li> <% end %> </ul> </h2> to pull 4 random bullets db , post them page; i'm trying them save bullets they're randomized after page generated. there can code achieve this? if not, can achieve this. code in embedded ruby , db sqlite3 database. setting random bullets , randomising belongs in controller. once there recommend setting cookie contains array of bullet.ids in order. can iterate on array if exists else create new 1 , save it. in controller: if cookies[:bullets].nil? @bullets = bullet.all.shuffle.first(4) cookies[:bullets] = @bullets.collect(&:id) else @bullets = [] cookies[:bullets].each |id| @bullets << bullet.find(id) end end in view: <ul> <% @bullets.each |r| %> <li><%= r.cont...

c# - Building a Mac .app file in Windows using Mono -

we have team built agent in mono using monodevelop on mac , want build rest of our native , c# source code in windows cannot seem either msbuild or mono build .app file on windows. error proect type not supported. other projects created in mono build fine, .app giving trouble. has had success building mac/mono .app files in windows? or there alternative .app file running service type application on mac? despite having monodevelop on both windows , osx not able build .app in windows - windows doesn't have of required libraries (you need have xcode installed monodevelop compile application in osx) you can compile dll's aren't ui related in windows, link them app in osx, there's not benefit unless need unit tests windows or something. mono project focused on moving .net development osx, rather other way around.

php - Deleting/Renaming a locked file -

with php, there way force unlock file (for renaming/deleting) locked running program on same server? more details: have image service running on server caches large pathology images web when try delete or rename images through php interface, cannot when image files locked , still being accessed web image service. i have no control on web service cannot tell close image. work around restart web service , delete/rename files cause service interruption other users trying access other images through web. os: windows server 2003

iPhone iOS4 Calendar -

i working on booking application need use similar kind of iphone calendar in ios 4. know there excellent calendars monthview : tapku library kal calendar but didn't found useful since looking controller similar iphone calendar in landscape mode.something link . here screen shot : below pre-requisite : having, scrolling features till date scrolling months custom labels show coach & dates on top priority on drag & drop so, there open-source controller or framework gives access the

wcf - How to change timeout in machine config in azure platform and/or emulator? -

we hosting wcf service in azure webrole. timeoutexception if want send large files. we've adjusted send , receive timeout in config files on client on serverside. even after these adjustments exception still occuring after +- 10 minutes. we think have adjust machine config in azure, don't know how this. help appreciated. you working blobs. with blobs can specify blobrequestoptions in timeout value. try change this: blobrequestoptions largeblobdownloadoptions = new blobrequestoptions() { timeout = timespan.fromminutes(60) // larger timeout larger file }; blob.downloadtofile(largeblobdownloadoptions);

sql - SMSS Formatting of characters -

Image
in ssms 2005, if inset following character (‑) changes font of adjacent letters , i'm unsure why. doesn't seem have adverse effect selects data want (which parts of order number) i'd ensure character isn't altering data in anyway. visual change or characters changing? select 'hello', '‑hello', '‑he110', edit: output when adding n per comments.

asp.net - sending email in c# using port no -

i want send email yahoo yahoo bt failed send it. use network received. please review code credential. there no exception or error when mail box opened, there no email. used label show succesfull text, @ time, not showing successfull. .aspx code: <form id="form1" runat="server"> message from: <asp:textbox id="text1" runat="server"></asp:textbox> message to: <asp:textbox id="textbox1" runat="server"></asp:textbox> message subject: <asp:textbox id="textbox2" runat="server"></asp:textbox> <asp:button id="b1" runat="server" onclick="click" /> <asp:label id="label1" runat="server" text="label"></asp:label> </form> .aspx.cs: public void click(object sender, eventargs e) { try { //mail message mailmessage mm = new mailmessage(); ...

web services - Get Interest Rate by Country -

i'm having heck of time getting data on interest rate. guess scrape small pile of central bank websites. better service can central bank interest rate or prime rate info. does know of free resource this? thanks! the federal reserve of st. louis source. have excel interface web services interface. have used python api provided here https://github.com/zachwill/fred . general api here http://api.stlouisfed.org . hope helps.

c# - How can I keep track of changes to a Database? -

i creating website used accounting dept. track budget expenditures different projects. i using sql server 2008 r2 database , asp.net c# mvc 3 website. what boss has asked me every time user updates or creates project, need log change new table called mapping_log . should record whole mapping row being saved or created, , additionally user , datestamp. notes field mandatory, , note should saved mapping_log . now when editing pa, notes field empty , below it, should have list of older notes organized date. have been looking maybe using nlog , log4net have not been able find tutorials situation mine. seems modules used error logging, although important not try @ moment. i need direction... have advice or tutorials use learn how can implement process keep track of changes made data users of site. thanks help/advice! you can consider 2 new features sql server 2008 introduced: change tracking , change data capture . you use , avoid custom mapping_log table. but ...

graphics - Blender 2.6: How to undo 3D cursor movement -

hi, mouse sensitive, , that's why place 3d cursor on wrong location undesigned left click. but when i'm trying click control + z in order undo accidental 3d cursor movement, doesn't revert. so my question is: there easy way blender's (2.6) 3d cursor it's previous location? thanks. shift - c moves cursor (0,0,0) another way switch "edit mode" , select edge. press shift - s , select " cursor selected ".

Can JavaScript and PHP prove an online card game? -

i want ask, possible create on-line card game, using javascript, php , ajax (no flash)? the game should work - every player have deck x cards (sixty instance) play, each original abilities. game must assess every action in game (for instance - card has ability draw card, game must draw card, , so) , system must control action possibility. stuff control php. javascript send questions accros ajax , receive simple commands (like draw card, move card hand play). another thing game synchronize (using ajax again), player must see, opponent doing (about 1 request second, gues). can javascript hold these stuffs? ajax request fast enough? can php assess game fast enough (with good-writed core application)? thank you ps: not insist on supporting older browsers (like ie7,8) the answer yes . possible.

html - Manage signup, login and forgot password divs with jQuery -

i want create animated login, sigup , forgot password jquery. i found idea in http://vox.io i created hard work still unable show div of forgot password. i have 3 div : login, signup , forgot ; here's full code : <!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title>untitled document</title> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.js" type="text/javascript"></script> <script type="text/javascript"> $(document).ready(function(){ $(".login").hide(); $(".forgot").hide(); $(".show_hide").show(); $('.show_hide').click(function(){ $(".login").slideto...

Blackberry In App purchase using valid credit card returning Failure reason "-224718155" -

i trying purchase in-app goods valid credit card, using sandbox account while application in draft mode on appworld. sending me purchaseresult object containing failure reason -224718155. why failing while using valid credit card? that code successful purchase user:) http://www.blackberry.com/developers/docs/payment/1.8api/constant-values.html

sql server - Conversion failed when converting datetime from character string while procedure execution -

i need favor on resolve conversion issue.the code have alter procedure [workflow_app].[diagnosiscd_car] @v_monthstr char , @v_monthend char , @v_year char , @v_state_cd char , @v_claim_key char , @v_contractor char declare @v_makedatestr varchar(10) declare @v_makedateend varchar(10) select @v_makedatestr = '01-' + @v_monthstr + '-' + @v_year select @v_makedateend = '01-' + @v_monthend + '-' + @v_year select @v_datebegin = convert(datetime, @v_makedatestr,105)----error select @v_dateend = dateadd(d, -day(dateadd(m, 1, convert(datetime, @v_makedateend ,105))), dateadd(m, 1, convert(datetime, @v_makedateend ,105)))---error this code formed using tool , changed somewhere manual. i getting 'conversion failed when converting datetime character string.' at "error" comment. i tried using convert, cast functions unable resolve. any 1 suggest err...

c# - Sockets doesn't send data after a long break -

i'm writing client-server application (client in as3-air, server in c#). after establishing connection can transfer files each other, etc. good. however, if socket connections have long break (while still connected), connection stops sending data. it's weird, because actionscript socket ".connected" returns true . same c# server. did face problem? i'd suggest sending ping (and replying pong ) every 10 seconds.

Twitter API and operator -

i want make simple twitter api using json. idea posts known corporation (say bigcorporation) sent main corporation (@bigcorporation). idea main annoncements , filter out anytime bigcoporation answer question follower (i.e. bigcoporation tweets: @someguy anwering question) so tweets from:bigcoporation @bigcorporation i came api seem both @bigcorporation or from:bigcorporation tweets. want tweets @bigcorp , from:bigcorp http://search.twitter.com/search.json?q=@bigcorporation&q=from:bigcorporation&result_type=mixed your search query malformed. it should be: http://search.twitter.com/search.json?q=@edent%20from:edent&result_type=mixed that show tweets have sent contains string "@edent"

javascript - dom jquery behavior not functioning -

i have following function works properly: $(function() { var availabletags = <? echo htmlspecialchars($jsenc,ent_noquotes,'utf-8');?>; $( "input.tags" ).autocomplete({ source: availabletags }); }); on pre-existing: <input class="tags"/> function should (an autocomplete list database dump). now, these inputs exist in <table> , rows can added or removed on fly. when adding cells table following: if(i== document.getelementbyid("soldto").cellindex){ element2.setattribute('class','tags'); } which makes input (element2) capable of being target (at least thought) of jquery function. i assuming jquery function not "conscious" of new element , must re-initialized in way see new members. is true? done @ time of adding new element? sort of $(x).add(mybehavior) ? edit i tried following: $("table.i...

sql - Can this MySQL join query be optimized? -

i have query takes 27 seconds execute: select ocal_files.*, count(distinct ocal_favs.username) favs ocal_files inner join ocal_favs on ocal_favs.clipart_id = ocal_files.id group ocal_files.id order favs desc​ (instead of username should user_id, because have table users) ocal_files has 37457 rows , ocal_favs has 18263 edit result of explain mysql> explain select ocal_files.*, count(distinct ocal_favs.username) favs ocal_files inner join ocal_favs on ocal_favs.clipart_i d = ocal_files.id group ocal_files.id order favs desc; +----+-------------+------------+--------+----------------+---------+---------+---------------------------------+-------+---------------------------------+ | id | select_type | table | type | possible_keys | key | key_len | ref | rows | | +----+-------------+------------+--------+----------------+---...

c# - Visual Studio 2010 My.Settings import -

i have solution multiple projects in, , need share same my.settings, or @ least have local copies of same set. how my.settings 1 of projects others? i think can add existing item in each project create shurtcut it. here reference , no need update each project aside. hope helps

c# - WPF - Databinding Issue -

i have bound control property on page. property binding returns class. binding works if set property new instance of class ui not updated. could point in right direction solve issue, have tried implementing inotifypropertychanged doesn't work. the code follows.. xaml - basic trying bind label property @ minute. <grid> <label content="{binding studentname}"></label> <button width="100" height="75" click="button_click" ></button> </grid> c# this.datacontext = parentwindow.selectedstudent; the parent window c# note parent window implements inotifypropertychanged public event propertychangedeventhandler propertychanged; public ucstudent selectedstudent { { if (_selectedstudent == null) { _selectedstudent = new ucstudent(); } return _selectedstudent; } ...

iphone - Is there a way to load sqlite tables without knowing the name of the table? -

my application allows users save data sqlite file. ensure unique table name, want create table name of (date/time) kind of format when user presses "save". there way load of tables in sqlite file without explicitly stating names of tables? i have list of foods in sqlite file. sqlite file contains bunch of information each of food items in it. user can create own recipe going through sqlite file , adding items list. each item in list represented cell in tableview. when recipe done, want user able save it, , have system automatically add recipe cell in different table view. way, when selects cell, entire recipe displayed (not name of recipe cell title) in next tableview i don't think you're using sqlite database correctly. it sounds you're using table per user data item. the strength of database store data multiple users, multiple items or multiple whatever few tables , retrieve data specific users or items later. tables should have rows a...

javascript - jquery val() will not display value -

html() should used setting content in non-form elements such div's. ** question has been answered few times, unaware of. i trying set value after retrieving comments $.ajax call. when alert out values of commentoutput , commentspan, showing correct data. however, when try set value comments in span, not show up, not appear in generated source. here javascript. can see return post in console. can see value grabbing span, have alerted onclick. to invoke this, click first picture of cat, none of others have comments @ point. var ajaxoptions = { type: 'post', datatype: 'json', url: 'ajax/comments.php', data: { id: photoid, action: 'getcomments' }, success: function(data) { for(i=0; i<data.length; i++) { var commentoutput = '<div><h4>'+data[i].comment_user+' says:</h4>'; commentoutput += '<span>'+data[i].comment_msg+...

java - JTextArea consumes a lot of memory -

i having memory issue java , swing. have jtextarea (same issue jtextpane ) use redirect stdout c++ executable. , because i'm outputting lot of stdout, jtextpane consuming lot of space. in case, boiled down following code, in java. private javax.swing.jtextarea jtextareastdout; .... (int = 0; < 200000; i++) { string randomstr = uuid.randomuuid().tostring(); jtextareastdout.settext(randomstr); //<tag_memory> if (i % 100 == 0) system.gc(); //<tag_no_help> } the above code consumes 100mb. tag_memory line commented out, lot less (30mb other code & ui). how can reduce java's memory usage? using java 7 update 4. thanks in advance. i don't understand memory going. plaindocument tells story: either 1 or 2 16-bit code units per code point, map of line starts , impedimenta needed make editable. read-only viewing, i'd use redirection: yourprogram 2>&1 > view . in java, read stdin list<string...

php - What is the best way to add a reply system on a message board im programming? -

i coding board, quite similar chan @ point in it's life wont end such. anyways have basic system working boxes top, type in posts down below. display information (it inserted mysql table) perform mysql query pull out information , mysql_fetch_assoc, goes while loop parameters , put in want loop section follows. $get_posts = mysql_query("select `title`, `content`, `time`, `id`, `user` `general - off topic` order time desc"); while($get_posts_thing = mysql_fetch_assoc($get_posts)) { echo $get_posts_thing['title']; echo $get_posts_thing['content']; } thats looks it's in div styling. anyways want make reply system click reply button , text box appears , type in reply , click post. want post appear under post being replied to, styled in div. since it's in while loop cant individually pick things out. suggestions? , sorry first post , first real php project don't know things. inside loop, have <button onclick="reply(thi...

ruby on rails 3 - Anyone can think of any way to customize Email( Mailboxer gem's) template view on rails3? -

i'm using gem called "mailboxer" on rails3. everytime, mailboxer delivers email, , seems it's using template shown below. knows how customize template? even though install mailboxer, views won't produced can't customize it! you have new message: subject have received new message: body rails g mailboxer:views will generate view files need can edit them.

All overlapping substrings matching a java regex -

is there api method returns (possibly overlapping) substrings match regular expression? for example, have text string: string t = 04/31 412-555-1235; , , have pattern: pattern p = new pattern("\\d\\d+"); matches strings of 2 or more characters. the matches are: 04, 31, 412, 555, 1235. how overlapping matches? i want code return: 04, 31, 41, 412, 12, 55, 555, 55, 12, 123, 1235, 23, 235, 35. theoretically should possible -- there obvious o(n^2) algorithm enumerates , checks substrings against pattern. edit rather enumerating substrings, safer use region(int start, int end) method in matcher . checking pattern against separate, extracted substring might change result of match (e.g. if there non-capturing group or word boundary check @ start/end of pattern). edit 2 actually, it's unclear whether region() expect zero-width matches. specification vague, , experiments yield disappointing results. for example: string line = "xx90xx"; strin...