Posts

Showing posts from April, 2015

sdl - SDL2 C++ - Multiple Image Rendering Bug -

before begin, ide use code::blocks. i going practice things learned online sdl in project separate study project. wanted load image of ball on top of background. worked fine in study project. replicated code on test project, , ball disappeared. background visible. i removed codes involve background , worked fine. my code: #include <iostream> #include <cstdlib> #include <sdl.h> #include <sdl_image.h> #undef main using namespace std; sdl_texture *loadtexture (string filepath, sdl_renderer *rendertarget){ sdl_texture *texture = 0; sdl_surface *surface = img_load(filepath.c_str()); texture = sdl_createtexturefromsurface(rendertarget, surface); sdl_freesurface(surface); return texture; } int main () { sdl_window *window = 0; sdl_texture *ball = 0; sdl_texture *background_sky = 0; sdl_renderer *rendertarget = 0; int framew, frameh; int texturew, textureh; //--crop instructions--// framew = textu...

c# - Caching a Dynamic Portal -

currently working on large portal website , information shows user specific .now experiencing performance issues , have address possible number of users keep increasing.i heard caching in mvc4 , want know how effective in dynamic sites portal , kind of caching method should adopt.is there chance of backfire ? in general important understand caching bringing resources closer consumer in order choose caching method use, should analyze portal potential bottlenecks. if example, bottleneck remote database - use local database runs on same machine portal (embedded data base/ in memory storage / key-value storage , etc.) or using session cache user data - in case resource consumer mvc application. in 1 of our projects, had similar issue describing in question. in case bottleneck remote database, implemented sessionstate provider redis db (we couldn't use default session provider because of load ballancer) , solved issue us. another caching may performed bring data ...

asp.net - "Could not load file or assembly" error when installing Google.api.customsearch.v1 client library -

i trying install google.api.customsearch.v1 client library nuget error when try run asp.net website. could not load file or assembly 'newtonsoft.json, version=4.5.0.0, culture=neutral, publickeytoken=30ad4fe6b2a6aeed' or 1 of dependencies. located assembly's manifest definition not match assembly reference. (exception hresult: 0x80131040) i have discovered stackoverflow such issue, non of them resolved problem. suggestion? ok, fixed problem updating newtonsoft.json package. run following command in package manager console update-package newtonsoft.json

r - Unable to reference an object in a variable within colnames -

i unable reference object contained in variable "symb" within colnames function. example: symb <- "ibm" colnames(paste0(symb)) <- c("open","high","low","close","volume","adjusted") if understand question correctly, name columns of data frame called ibm, , variable symb character vector contains string "ibm". if so, might try df <- get(symb) colnames(df) <- c("open","high","low","close","volume","adjusted") assign(symb, df)

android - How to align ViewGroup to the bottom of the screen -

so, have activity launched dialog (theme.dialog). use play video, dimming background, , looks pretty cool... it's centered on screen , don't know how move bottom programmatically. <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/lr_layout" android:background="#ff000000" android:padding="0dp" > <relativelayout android:id="@+id/lr_progresscontainer" android:layout_width="match_parent" android:layout_height="match_parent" android:background="#ff000000"> <progressbar android:id="@+id/lr_progress" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerinparent="true" ...

javascript - Responsive DIv Containing 2 images -

Image
i working on joomla based website template called xtec www.crosstec.de not me using jquery based code inserted articles. i trying create responsive div has 2 images in , trying entirely in css. this trying acheive. 1) normal width screen/browser has both images each 465px wide x 507 pixel in height - side side 2 pixel gap between them centered horizontally in browser window 2) reduce screen/browser width images should both shrink proportionally until @ point of screen / browse rreaching 850px wide images should move single column , both images aligned vertically on top of each other, reduce screen / browser continue reduce proportionally in size, still centered in column. i used code " 2-column css responsive layout responsive image " as starter my site url http://www.clickandrent.mobi , 2 images trying perform on below full width slider , above bottom 2 images. many - martyn please add code stylesheet, should work. tested on website , it's w...

java - Printing numbers divisible by 2 but not 3? -

for (int i=n1; < n2; i++){ if (i % 2 == 0){ system.out.println(i); } } this code prints out numbers between n1 , n2 (which generated randomly) both divisible 2 , 3, want print out numbers divisible 2. how do this? you're literally halfway there. you need second condition in mandate number not divisible 3. this: !(i % 3 == 0) now, need boolean operator return true if both conditions true. that, i'll leave exercise reader.

r - How can I draw a line beside a boxplot -

Image
how can draw line beside boxplot show place of value something red line: try arrows function: arrows(x1,y1,x2,y2)

ios - Does setting an NSMutableDictionary to nil release the reference to all it's content? -

so let's have nsmutabledictionary filled objects this: nsmutabledictionary* dict = [nsmutabledictionary dictionary]; (int i=0; i<10; i++) { someclass* tmp = [[someclass alloc] init]; [dict setobject:tmp forkey:[nsstring stringwithformat:@"%i", i]]; } if set dictionary equal nil , release objects put in (thus freeing allocated memory each one)? i want use nsmutabledictionary cache basically, , whenever app receives call system didreceivememorywarning , want clear out cache , release every object in it. so setting dictionary nil enough, or have call method wipe out data , free memory allocated creating someclass instances? if there no references dictionary dict = nil; will cause dict deallocation. deallocation method called - [nsmutabledictionary dealloc]. , inside method references content released. you cal call nsmutabledictionary's - (void)removeallobjects; method instead. i suggest @ nscache class - handles didreceivem...

objective c - SCNScene - Not rendering changes to SKNode made on touchesBegan handler -

i'm subclassing sknode , implemening touchbegan handler. when user clicks on node, node position changed node not move on screen. i guess need force rendering of skscene somehow. to test did following minor changes template games of xcode6. here changes template: gameviewcontroler.swift let hud = skscene(filenamed: "hud.sks") scnview.overlayskscene = hud var customnode = customnode() customnode.text = "touch here" customnode.position = cgpointmake(200, 200); hud.addchild(customnode) new class customenode.swift import foundation import spritekit public class customnode:sklabelnode{ public override init() { super.init(); userinteractionenabled = true; } public required init(coder adecoder: nscoder) { fatalerror("init(coder:) has not been implemented") } public override func touchesbegan(touches: nsset, withevent event: uievent) { position.y = (position.y + 100) % 300 + 100; //does not update on screen } ...

How to remove ios today extension from app -

i've added today extension app (for test only) , now, want remove it. i've tryed delete files seemd connected extension, when run app again, extension still available in today notification view... can me remove that? alot! clean project ( cmd + shift + k ) run again.

variables - android data passing to another class by a button click -

im trying pass data testsearch class googlesearch class. assigned values of tedit test string variable , want pass googlesearch class. app crash when run it. button disp=(button)findviewbyid(r.id.btn_search); disp.setonclicklistener(new view.onclicklistener() { @override public void onclick(view arg0) { edittext inputtxt = (edittext) findviewbyid(r.id.edittext1); string str = inputtxt.gettext().tostring().tolowercase().trim(); arraylist<hashmap<string, string>> userlist = controller.searchbook(str); if (userlist.size() != 0) { //do } else { intent intent = new intent("com.example.captchalib.googlesearch"); intent.putextra("message", str); startactivity(intent); } } }); in googlesearch class used below code catch intent protected void ...

php - GuzzleHttp\Stream\create() undefined function when called by composer cmd -

i'm trying create composer post-install-cmd send simple post request. i'm using simple block elsewhere in application submit same request development server: $esmapping = file_get_contents('path/to/mapping.json'); /** @var guzzlehttp\message\response $esresponse */ $esresponse = (new guzzle())->post($esmappingurl, ["body" => $esmapping]); this exact code works in symfony2 console command, when try send request in composer command, fails following: php fatal error: call undefined function guzzlehttp\stream\create() in /srv/www/htdocs/instagram-extractor/vendor/guzzlehttp/guzzle/src/message/messagefactory.php on line 179 fatal error: call undefined function guzzlehttp\stream\create() in /srv/www/htdocs/instagram-extractor/vendor/guzzlehttp/guzzle/src/message/messagefactory.php on line 179 i tried creating stream beforehand using $stream = stream::factory('string data');, failed same error (undefined stream\create()), diffe...

c++ - Behavior of fstream as a bool and fstream.good() function -

i used fstream homework assignment , wondering how 2 things worked. #include <iostream> #include <fstream> using namespace std; int main(int argc, char** argv) { ifstream myfile; myfile.open("fileone.txt"); int myint = 0; while (myfile.good()) { // difference between myfile , myfile.good()? if (!myfile.eof()){ myfile >> myint; cout << myint << endl; } } return 0; } this snippet of actual code working on. in post, said if used while(myfile) , automatically convert bool. difference between using , using member function .good() of ifstream class? know .good() breaks out of while loop when reach end of text file how using stream name behave? iostream classes have 4 functions assessing stream state : good() , bad() , fail() , , eof() . excluding good() , each function checks single bit in underlying stream state , returns whether or not bit on (are there errors?)...

office365 - Why does my Mail App for Office show in Outlook online but not in my installed Outlook Client? -

Image
i have developed mail app office. it showing in office 365 outlook in browser not in installed client. but in installed client looks this. ie app not showing: i have looked @ managing apps etc can't find settings force show in installed client. any ideas? here manifest: please note, not real app more of "trying things out" app. ok here version of office: and here updated manifest file @andrews requested remove regex rules simplify trouble shooting: i un-installed app, restarted , still cant see in outlook desktop client. thanks russ your manifest version 1.1, outlook build not 2013 sp1. outlook 2013 sp1 builds 15.0.4569 , higher. please update outlook client, , app appear!

Guacamole - LibPNG undefined reference to 'png_set_longjmp_fn' -

when running make while installing guacamole 0.9.0, following error: undefined reference 'png_set_longjmp_fn'` in /home/src/libguac/.libs/libguac.so. apparently, error pops when there wrong libpng. tried install new version of libpng (16) error persisted. know how fix this? running ubuntu 14.01 , libpng version 12. in advance.

html5 - set url in JavaScript for jsoup -

i want set url in javascript script use jsoup not know how. here have tried: <script language="javascript"> var flobject = swfobject.getflashplayerversion(); var ishtml5 = (location.search.indexof('ishtml5') != -1) ? true : false; var isdishtml5 = false; switch (true) { case navigator.useragent.indexof('firefox') > -1: isdishtml5 = true; break; case navigator.useragent.indexof('msie') > -1: isdishtml5 = true; break; } if ((!isdishtml5 && flobject.major == 0) || ishtml5) { zm('#oplayer').remove(); zm('#_htmlplayer').removeclass('none'); var html5_skin = 'skins/jplayer_01'; document.write('<link href="http://static.mp3.zdn.vn/' + html5_skin + '/css/skin.css" rel="stylesheet" type="text/css" />'); zmcore.adds...

scala - How to get Akka actor by name as an ActorRef? -

in akka can create actor follows. akka.system(app).actorof(props(classof[unzipactor]), name="somename") then in different class, how can actor? i can actorselection lazy val unzip: actorselection = akka.system.actorselection("user/" + "somename") however, actorselection not want; want actorref . how can actorref ? i want have actorref since wish schedule call actorref using scheduler. akka.system(app).scheduler.schedule( 5 seconds, 60 seconds, mustbeactorref, messagecaseclass()) you can use method resolveone on actorselection actorref asynchronously. implicit val timeout = timeout(finiteduration(1, timeunit.seconds)) akka.system.actorselection("user/" + "somename").resolveone().oncomplete { case success(actorref) => // logic actorref case failure(ex) => logger.warn("user/" + "somename" + " not exist") } ref : http://doc.akka.io/api/akka/2.3.6/index.html#akka....

actionscript 3 - as3 how to change a number by a class? -

the following code isn't working: package { public class num { public function num() { } public function numto(num1:number) { num1 = 47; } } } when use in main timeline: import num; var n:number = 17; numto(n); trace(n); // must 47 instead of 17 it gives me different error messages such as: access of undefined property numto; you should try learn basics of actionscript language. read general books, understand going on. as question specifically. there such things reference types , value types. not explain here because there plenty of material on topic, can google it. number value type. means when pass number method parameter arrives there new "instance". not hold reference original number.

css - Static Dropdown Menu -

i have question dropdown menu customization. have dropdown set appears on fixed part of screen. please @ screenshot: http://snag.gy/pw12x.jpg currently, have this: http://snag.gy/fgqs3.jpg per reference, code snippet ul: .pagemenu li ul { display: none; position: absolute; margin: 0 auto 0 auto; z-index: 10; top: 100% !important; width: 400px; left: 0; background: #262425; list-style-image: none; list-style: none; } i new @ css. possible css code or have insert script take care of this? if so, nudge right direction helpful. thank you! adding styles: position: fixed; left: 0 top: 0 should you. nails element top top left corner of screen.

javascript - How to generate a segment of a page in html when an element is chosen -

Image
i want when page first loads, below date , week element not visible or accessible; when choose week week element in date part of page, entire rest of page generates automatically. i know involves javascript, other don't know. <!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 runat="server"><meta http-equiv="content-type" content="text/html; charset=windows-1252"> <style type="text/css"> <!-- .style1 { font-size: 12px; font-weight: bold; } --> </style> </head> <body> <div id="pagecontainer"> <br class="clearfloat"> <div id="contentarea"> <div id="backgroundlines"> <div id="maincontentadmin"> ...

python - How to optimize converting DataFrame to dict? -

i have pd.dataframe need converted dictionary. here's example dataframe (call mydf): user_id colors 0 1000 red 1 1000 yellow 2 1000 blue 3 2000 yellow 4 2000 green i keys in dictionary distinct user_id values (in case 1000 , 2000). need values subset of dataframe corresponding respective key. what's fastest way convert dictionary when call mydict[1000] it returns user_id colors 0 1000 red 1 1000 yellow 2 1000 blue ? i'm seeking alternative calling mydf[mydf['user_id']==1000] because .csv super large , think optimize lookup. other suggestions appreciated! my current solution below, i'm looking alternatives because takes 40 minutes build on 1.1gb .csv. mydict = {} idx, row in mydf.iterrows(): if row['user_id'] not in mydict: mydict[row['user_id']] = [mydf.loc[idx]] else: mydict[row['user_id']].append(mydf.loc[idx]) ...

r - Missing value when using while loop -

i apologize in advance simple question, have not been able find solution while. trying find least common multiple of f0 , f1. here code: f0 = 200 f1 = 300 = f0 b = f1 r = 0 while (a!=b) { r = %% b = b b = r } from this, get: error in while (a != b) { : missing value true/false needed because after second iteration r = nan 100 = 300 %% 200 0 = 200 %% 100 nan = 100 %% 0

java - Unable to run Applet from Struts Web Application -

i have followed relevant tutorials, still stuck. want embed applet jsp driven struts 1.x. i've packed jar helloworld.jar single applet helloworld.class . hosted on local websever localhost:7001/webcontent/ . other parts of application work, , jsp loads fine without applet. when applet makes post server retrieve jar , class location, receive filenotfoundexception , classnotfoundexception . strange thing posts path did not expect: network: connecting http://localhost:7001/webcontent/helloworld.jar proxy=direct network: connecting http://localhost:7001/webcontent/helloworld.jar cookie "jsessionid=ws7ljg3p3fffjl4rtcz7ylmpf68jllmgrd2jtyh7zyywlqkcqy5p!2106205894" java.io.filenotfoundexception: http://localhost:7001/webcontent/helloworld.jar @ sun.net.www.protocol.http.httpurlconnection.getinputstream(unknown source) @ sun.plugin.pluginurljarfilecallback.downloadjar(unknown source) @ sun.plugin.pluginurljarfilecallback.access$000(unknown source) ne...

java - Split number into an integer and decimal -

input 23.893 become integer - 23, decimal - 0.893 here's key snippet code double realnumber = scan.nextdouble(); \\store keyboard input in variable realnumber double integerpart = math.floor(realnumber); \\round down eg. 23.893 --> 23 double fractionpart = realnumber - integerpart; \\find remaining decimal when try long numbers decimal part differs actual. input - 234.324112341234134 becomes integer - 234.0, decimal - 0.3241123412341267 as stated @dasblinkenlight can use methods bigdecimal , combine them splitter. wouldn't count decimal points though, easier stick bigdecimal. for example: public static void main(string[] args) { string realnumber = "234.324823783782"; string[] mysplit = realnumber.split("\\."); bigdecimal decimal = new bigdecimal(mysplit[0]); bigdecimal real = new bigdecimal(realnumber); bigdecimal fraction = real.subtract(decimal); system.out.println(string.format("dec...

linux - How can I remove and replace specific field value by name instead of fix column -

i want replace , remove substring text file line line. info want change under specific field. example, have following text: {name:x, version:1.0, info:"test", ...} {name:y, version:0.1, info:"test again", ...} {name:z, version:1.1, info:"test over", ...} {name:x, info: "test", ..., version:1.2, ...} the field in random order. want remove version value , replace info value specific string, "foo". the expect result: {name:x, info:"foo", ...} {name:y, info:"foo", ...} {name:z, info:"foo", ...} {name:x, info:"foo", ...} is there smart way shell script? have no idea how replace substring above? i know stupid command as sed 's/info:\([^,}]*\)/info:\"foo\"/' file sed 's/version:\([^,}]*\)//' file sed 's/\(version:[^,}]*,\)*\(.*\)info:[^,}]*\(,\{0,1}\)\(.*\)\(, *version:[^,}]*,\)*/\2info:"foo"\3\4/' file (not tested) should trick ( -...

java - Hibernate: Unexpected Error while using Named Query -

i getting error when trying display few contents of table using named query in hibernate. have tried looking answers, no success. code listed below. <sql-query name="activecustomers"> <return alias="cts" class="customer"/> select cts.cid {cts.cid}, cts.cname {cts.cname}, cts.email {cts.email}, cts.status {cts.status} customers cts cts.status=:st </sql-query> from client side invoking shown below: sessionfactory sf=chibernateutil.getsessionfactory(); session session=sf.opensession(); tx=session.begintransaction(); list=session.getnamedquery("activecustomers").setstring("st","active").list(); for(customer c:list){ system.out.println(c); } tx.commit(); session.close(); but getting error: hibernate: select cts.cid cid0_, cts.cname cname0_0_, ct...

c# - "Operation is not valid due to the current state of the object." Error when trying to create new List< AudioTrack> from JsonFile in WP8 -

i'm trying make music app , have 2 project in solution: main project , audioplaybackagent (apa) project. when chose song main project (which contained in list of song) , copied whole list json file in isolate storage , read apa project. problem is, error when tried create new audiotrack items in json file code create file (from main project) public static void createonlinelist(string id, observablecollection<basicitemmodel> list) { using (isolatedstoragefile file = isolatedstoragefile.getuserstoreforapplication()) { string filename = "onlinelist.json"; jobject obj = new jobject(); jarray arr = new jarray(); (int dem = 0; dem < list.count(); dem++) { if (list[dem].id == id) obj.add("index", dem); jobject item = new jobject(); item.add("name", list[dem]...

javascript - JSON.stringify adding \n to the array -

why \n appending value after json.stringify. here example link http://jsfiddle.net/7nketlmy/ var formdata = new array(); if ($(this).get(0).tagname.touppercase() === 'div' ){ content = $(this).html(); } alert(json.stringify(formdata)); note: content in div dynamic , don't have control on displaying there. should use .html() data in div you added new line in div. that's why /n appearing <div contenteditable="true" placeholder="" name="content[0]" id="pres_preview_58c57bd0044aa58704f13133b381e97a_0" class="pdfelement tempcontent txtfield">empire city casino @ yonkers raceway</div> use this.

linear layout error resource android:layout_width -

please new android apps, , following guide on android developers site, when want run code iam getting , error "no resource identifier found attribute layout_width... here copy of xml code <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="horizontal"> <edittext android:id="@+id/edit_message" android:layout_weight="1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:hint="@string/edit_message"/> <button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/button_send" /> xml case sensitive. have capital ls in code, should this: <linearlayout xmlns...

xslt - Wrapping and moving child nodes -

could please me transforming following snippet? <root> <topic> <!-- first topic --> <p>content1</p> <topic> <!-- second topic --> <p>content2</p> </topic> <topic> <!-- third topic --> <p>content3</p> </topic> </topic> </root> i need cut second topic , third topic off first topic, wrap them in new / empty topic , attach new topic children root node. <root> <topic> <!-- first topic --> <p>content1</p> </topic> <topic> <!-- new topic --> <topic> <!-- second topic --> <p>content2</p> </topic> <topic> <!-- third topic --> <p>content3</p...

javascript - How do I remove all style tags without jquery -

its simple, removes style tags on code below want to $('*').removeattr('style'); now need exact same thing without jquery, since whole code written without jquery, don't want include library simple task among other things, tried far won't work document.getelementsbytagname('*').style.csstext = null; document.getelementsbytagname('*').style.csstext = ""; document.getelementsbytagname('*').removeattribute("style"); solution var allstyles= document.getelementsbytagname('*'); for(var a=0; a<allstyles.length; a++) { allstyles[a].removeattribute("style"); } the document.getelementsbytagname('*') returns array. need go through each item individually in loop , remove attribute. an example of such loop be var elements = document.getelementsbytagname('*'); (var = 0; < elements.length; i++) elements[i].removeattribute("...

php - SQL injection protection ERROR -

this question has answer here: warning “do not access superglobal $_post array directly” on netbeans 7.4 php 3 answers am using following code protect sql injection work am using in net beans getting error in $_post error do not access supergloab $_post directly how solve warning message $place = mysql_real_escape_string($_post['place']); $product = mysql_real_escape_string($_post['product']); $type = mysql_real_escape_string($_post['type']); $title = mysql_real_escape_string($_post['title']); $detail = mysql_real_escape_string($_post['detail']); $mobilebrand = mysql_real_escape_string($_post['mobilebrand']); $mobilemodel = mysql_real_escape_string($_post['mobilemodel']); $mobilecond = mysql_real_escape_string($_post['mobilecond']); $price = mysql_real_escape_string($_post['price']); $loca...

authentication - Log in to web site via c# fails -

i'm trying login website parsing purpose. while program runs seems login web site. can see fiddler. @ end of program, status code seems tobe 200, ı find myself not logged in. string loginuri = "https://www.sample.com"; string username = "username"; string password = "password"; cookiecontainer cc = new cookiecontainer(); var handler = new httpclienthandler { cookiecontainer = cc }; var request = new httprequestmessage(httpmethod.post, loginuri); handler.allowautoredirect = true; request.content = new formurlencodedcontent(new dictionary<string, string> { { "return_url", "emagaza.php"}, { "user_login", "sampleuser"}, { "password", "sapmplepass"}, { "dispatch[aut...

c++ - Erase operation on vector not working -

i new c++ , having difficulties getting vector.erase operation work. i have database class such: template <class t> class database { protected: std::vector<t> m_database; int m_counter; public: database(); virtual ~database(); // accessor methods. t& getobject(int objectid); bool exists(int objectid); // mutator methods. void add(t object); void del(int objectid); }; and in practice, using code such: database<account> accountdatabase; account base class, 2 derived classes, chequingaccount , savingsaccount . i inserting accounts, regardless of type (could account , chequingaccount , savingsaccount ) database using: template <class t> void database<t>::add(t object) { m_database.push_back(object); ++m_counter; } however, having issues delete operation. searching corresponding objectid , deleting vector. // deletes specified object da...

Clearing macros in Stata -

i see clear all removes (column) variables, scalars , programs add, global , local macros stick around. i'd know how clear them out interactively command line and/or as opening line in .do files. you can drop macros using macro drop _all . documented in help macro , corresponding manual entry.

Regex find and replace between <div class="customclass"> and </div> tag -

i cant find anywhere working regex expression find , replace text between div tags so there html want select between <div class="info"> , </div> tag , replace other texts <div class="extrauserinfo"> <p>hello world! sample text</p> <javascript>.......blah blah blah etc etc </div> and replace with my custom text codes <tags> asdasd asdasdasdasdasd</tags> so <div class="extrauserinfo"> custom text codes <tags> asdasd asdasdasdasdasd</tags> </div> here refiddle code there , can see want replace whole bunch of codes between , tag http://refiddle.com/1h6j hope mean :) if there's no nesting, plain match non-greedy (lazy) (?s)<div class="extrauserinfo">.*?</div> .*? matches amount of character (as few possible) meet </div> used s modifier making dot match newlines too. edit : here javas...