Posts

Showing posts from February, 2012

javascript - Make a function in .replace() -

i have following code uses regex: var mystring = "<<cool>> <<stuff>>" var regexstring = /<<([^\:]{0,})>>/gi mystring.replace(regexstring, "$1") i able replace string based on text on capture group. like: var mystring = "<<cool>> <<stuff>>" var regexstring = /<<([^>]{1,})>>/gi mystring.replace(regexstring, function(var0) { //var0 being text capture group if(var0 == "cool") { console.log("got cool") } else { console.log("didn't cool") } }) is there someway this? yes, can use function second argument of .replace() . example: mystring.replace(regexstring, function(match, group1) { // group1 here }); reference: https://developer.mozilla.org/en-us/docs/web/javascript/reference/global_objects/string/replace

sockets - C++ overload << operator for class object acting as stream -

so i've browsed bunch of other threads, none pertain questions have on exact topic. writing c++ library socket communication. have tcp socket class handles operations on tcp socket (setup, read/write, etc). want able read , write data to/from tcp socket object using << , >> operators. example, want able write, say, double socket in fashion: double x; tcpsocket *sock = new tcpsocket(); //socket setup stuff here... sock << x; at moment, have 2 templated overloaded operator functions within tcpsocket class: template<typename t> tcpsocket operator<<(tcpsocket sock, t &val) { unsigned char bytesofval[] = //parse bytes of val here... sock.write(bytesofval, sizeof(bytesofval)); } - template<typename t> tcpsocket operator>>(tcpsocket sock, t &val) { std::stringstream ss; byte buf[sizeof(val)]; sock.read(buf, sizeof(buf)); ss.str(std::string(buf)); ss >> val; } where sock.read( ) , sock

Android task/stack: why new task created in this case? -

Image
i'm trying clear task/back stack on android @ http://developer.android.com/design/patterns/navigation.html . when reach part below have question. please take on first (or go link above read post) however, touching compose activity, user indicates desire remain within gmail. gmail's conversation list activity appears, , new task b created it. new tasks rooted home, touching conversation list returns there. task persists in background, , user may return later (for example, via recents screen). if gmail had own task running in background, replaced task b—the prior context abandoned in favor of user's new goal. now, question. why create new task b in case? (when user touching compose activity) what means "it replaced task b" could make clear, please!? check link, that's because recent task have change in lollipop

npm search is not to work.Why? -

want know npm search not going official website find package? if , why npm search query seems set in local index , results did not find.please me! the npm repo official site find node modules. if don't results want can use other alternative search sites like: http://search.node.modules.by.locoticket.com (this best far) http://nipstr.com/

vba - Copying a row in excel from one sheet to another after searching for a given value -

disclaimer... not looking code me, point me in correct direction or give me examples can work with. problem: have workbook has 2 pages. first if formatted this hostname chassis service tag asset tab location u lcldhv003-25 pe r610 1*v4yq1 1*1315 d3sf85.08 21 lcmntypxyb02 pe r610 bz00l1 19368 x3sd04.34 36 lemailmig001 pe 1950 9zvsj1 12078 x3se07.12 29 lpasscdb01-01 pe r710 3xsvh1 11415 p3sd02.22 03 i need search in in location field given value (example x3sd04) , insert row second table. need have existing data moved down page. i have seen vlookup index, match , vba options. have tried has failed. try this: sub test() dim searchstring$, cl range, n& searchstring = "x3sd04" n = sheets("sheet2").cells(rows.count, "a").end(xlup).row + 1 'get row insert copied row set cl = sheets("sheet1").cells.find(searchstring) 'fin

elasticsearch - JsonParseException Unexpected character (':') (for unquoted name) or double-quote (for quoted) to start field name -

jsonparseexception: unexpected character (':' (code 58)): expecting either valid name character (for unquoted name) or double-quote (for quoted) start field name my mapping structure { "patientinfo": { "properties": { "address": { "type": "nested", "properties": { "patient_current_address": { "type": "string" }, "patient_old_address": { "type": "string" }, "patient_origin_address": { "type": "string" } } } } } } the code build bulk request looks this: bulkrequestbuilder bulkrequest = client.preparebulk(); xcontentbuilder xb = xcontentfactory.jsonbuilder().startobject(); xb.startobject(); xb.field("globalid","196ad302157add3ad63cd1154e968dfa&quo

wordpress - How to fix this invalid php code -

in error.log i'm seeing appear multiple times before suffer serious memory leaks php warning: implode() [function.implode]: invalid arguments passed in /home/daxcentr/public_html/wp-content/themes/reload/masonry-layout/fishtail/style.php on line 3 the code style.php here: <?php $mediaurl = wmlp_layout_url(__file__); // donot remove ?> <style> .wmle_container .wmle_item{box-shadow:<?php echo implode($layoutsettings['box_shadow'],' '); ?>; margin:10px;-webkit-border-radius: <?php echo implode($layoutsettings['box_border'],' '); ?>; border-radius: <?php echo implode($layoutsettings['border_radius'],' '); ?>;} .wmle_container .wmle_item .wpme_image a{ display:block; padding:10px;} .wmle_container .wmle_item .wpme_image img{box-shadow:none !important; display:block; margin:auto;-webkit-border-radius: <?php echo $layoutsettings['border_radius'][0]; ?> <?php echo $layoutset

scala - spray.io upgrade causes missing mock library in specs2 -

i use specs2 in spray.io project. works fine , when use following versions. val akkav = "2.3.6" val sprayv = "1.3.2" val specs2v = "2.3.11" however, tried upgrade akka , spray version following. val akkav = "2.3.9" val sprayv = "1.3.3" when run tests now, following error. object mock not member of package org.specs2 i'm not sure how spray or akka versions affect specs2, somehow find behaviour odd. tried different versions of specs2, latest one, error persists. you need add specs2-mock build.

Android DatePickerDialog and TimePickerDialog not rendering preview -

Image
i'm creating form consists of edittexts launch datepickerdialogs , timepickerdialogs. here sections of code: datepickerdialog datepickerdialog datepicker = new datepickerdialog(context, new datepickerdialog.ondatesetlistener() { @override public void ondateset(android.widget.datepicker view, int chosenyear, int chosenmonth, int chosendate) { year = chosenyear; month = chosenmonth; date = chosendate; set(year, month, date); } }, year, month, date); datepicker.settitle("select date"); datepicker.show(); timepickerdialog timepickerdialog timepicker = new timepickerdialog(context, new timepickerdialog.ontimesetlistener() { @override public void ontimeset(android.widget.timepicker view, int chosenhour, int chosenminute) { hour = chosenhour; minute = chosenminute; set(hour, minute); } }, hour, minute, false); timepicker.settitle(&

c# - How to delete a row from database using lambda linq? -

i want perform delete operation unfriend user in android application i'm developing. following method returns "done" data doesn't delete table. problem here? public string deletefriend(int user, int friend) { int = db.friends.where(x => x.person.id == user && x.person1.id == friend).select(x => x.id).first(); var rec=db.friends.tolist(); rec.removeall(x=>rec.any(xx=>xx.id==i)); db.savechanges(); return "done"; } i'm working entity frame work linq. try this: var friend = db.friends.where (x=>x.person.id == user && x.person1.id == friend).firstordefault(); if (friend != null) { db.friends.remove(friend); db.savechanges() } if have got multiple records can rid of firstordefault , add .tolist() in end. , use db.friends.removerange(friend) it cleaner , hope helps thanks

c# - How can i get a file name size in bytes and then reportprogress? -

in top of form1 have string array , string file name: string[] stringprogressreport = new string[4]; string filename = ""; then in openfiledialog i'm getting filename . then have 2 events: private void videosinsertrequest_responsereceived(video obj) { stringprogressreport[0] = obj.status.uploadstatus; backgroundworker1.reportprogress(0, 0); } and private void videosinsertrequest_progresschanged(iuploadprogress obj) { stringprogressreport[1] = obj.status.tostring(); backgroundworker1.reportprogress(0, 1); double mbsent = ((double)obj.bytessent) / (1 << 20); stringprogressreport[2] = mbsent.tostring(); backgroundworker1.reportprogress(0, 2); double percentcomplete = ((double)obj.bytessent) / totalbytes * 100; stringprogressreport[3] = percentcomplete.tostring(); backgroundworker1.reportprogress(0, 3); } totalbytes should file size in bytes if i'm not wrong calculation of percentcomplete . then, in end,

java - Getting instance of object? -

i have slight problem. wrote function should generate table list of objects (it date or custom 1 or whichever). parametars of function "list list" , "list headings". so, here question, why line if (value.getclass().isinstance(date.class) ... not executing, thou when print value.getclass() says the: class java.util.date. question, how check if "value" list? lot in advance :) here part of code: for (object o : list) { list<string> atributes = new arraylist<string>(); (java.lang.reflect.field field :o.getclass().getdeclaredfields()) { field.setaccessible(true); object value = field.get(o); if (value != null) { if (value.getclass().isinstance(date.class)) { atributes.add(convertdatetostring((java.util.date) value)); } atributes.add(value.tostring()); } } ... you're misusing class#isinstance , returns true if date.class in

ruby on rails - Migrating from sorcery to devise -

i have project that, title suggests, on authentication library sorcery. migrate user database devise, because client's developer wants use it. i understand both libraries use similar encryption methods, not sure of steps. currently on rails latest version.

r - Why does this code double transpose a vector - is this a noop? -

i have legacy r code does: b = t(a) c = t(b) what code do? looks noop me. a vector constructed c(1:20) . edit: bonus points on how better. have @ structure using str : > str(a); str(b); str(c) int [1:20] 1 2 3 4 5 6 7 8 9 10 ... int [1, 1:20] 1 2 3 4 5 6 7 8 9 10 ... int [1:20, 1] 1 2 3 4 5 6 7 8 9 10 ... the final transpose operation sends vector a matrix 20 rows , 1 column. equivalent to: c <- as.matrix(c(1:20))

java - Why do we need break after case statements? -

why doesn't compiler automatically put break statements after each code block in switch? historical reasons? when want multiple code blocks execute? sometimes helpful have multiple cases associated same code block, such as case 'a': case 'b': case 'c': dosomething(); break; case 'd': case 'e': dosomethingelse(); break; etc. example. in experience, bad style "fall through" , have multiple blocks of code execute 1 case, there may uses in situations.

c# - Deploying service to remote web server throws exception: 'There was an error deserializing the object of type XXXX' -

i've seen few questions answered on subject none seem match scenario. i have local asp.net mvc app that's connecting local development instance of wfc service. if send large string param local development service, fine. when deploy exact same service remote web server, following error (where xxxx namespaced object in service): "the formatter threw exception while trying deserialize message: there error while trying deserialize parameter http://tempuri.org/:formpost . innerexception message 'there error deserializing object of type xxxx. maximum string content length quota (8192) has been exceeded while reading xml data. quota may increased changing maxstringcontentlength property on xmldictionaryreaderquotas object used when creating xml reader. line 1, position 10304." here's odd thing: the codebase on local service (on localhost) , on remote service (at www.myurl.com) same. yet when switch client app (running on localhost) between them err

javascript - Creating unique Mongoose objects from CSV -

let's have csv containing information needs parsed different mongoose objects. need either find or create "user" based on information in csv file. if run this, however, create new user each time, since not wait until database save has finished execute rest of csv. fs.readfile(file, function(err, data) { if (err) throw err; parse(data, function(err, output) { if (err) throw err; user.findone({name: output[0] }, function(err, user) { if (err) throw err; if (!user) { var user = new user({ name: output[0] }); user.save(function(err, user) { anotherfunctionwithrestofdata(user, output); }); } else { anotherfunctionwithrestofdata(output); } }); }) }) how can control duplicate data not being saved? thanks. you can use async's eachseries method. i assume output array of users. async's eachseries iterate on array, process item and, once callback method called, go n

spring - NamedEntityGraph Returns All Columns and Objects -

i trying utilize namedentitygraph limit return data specific queries. not want return full object details when listing object. simple class example below. @entity @table(name="playerreport",schema="dbo") @namedentitygraphs({ @namedentitygraph(name = "report.simple", attributenodes = {@namedattributenode(value="intid") } ) }) public class playerreportentity { @id @column(name="intid",columndefinition="uniqueidentifier") private string intid; @column(name="plyid",columndefinition="uniqueidentifier") @basic(fetch=fetchtype.lazy) private string plyid; @manytoone(fetch=fetchtype.lazy) @joincolumn(name = "plyid", insertable=false,updatable=false) private playerentity player; no matter plyid , player returned. there way return requested columns (intid) ? as collection hibernate not join player object still returns player n

Azure - is one 'block blob' seen as one file? -

Image
question background: this may simple question cant find answer it. i've started using azure storage (for storing images) , want know if 1 'blob' holds maximum of 1 file? this container called fmfcpics : within container have block blob named myblob , within have 1 image: through following code, if upload image file myblob block blob overwrites image in there: cloudblockblob blockblob = container.getblockblobreference("myblob"); using (var filestream = system.io.file.openread(@"c:\users\me\pictures\image1.jpg")) { blockblob.uploadfromstream(filestream); } is overwriting correct? or should able store multiple files @ myblob ? each blob separate entity, direct-addressable via uri: http(s)://storageaccountname.blob.core.windows.net/containername/blobname if want manage multiple entities (such image jpg's in case), upload each 1 separate blob name (and you're free store many wa

php - line breaks in a textarea -

i know when saving textarea can use nl2br() or str_replace change /n br tags etc. im not sure how insert line breaks textarea. cant seem find putting data textarea line breaks. for example have form users can update fields. user may enter: foo bar baz when saved database saved as: foo<br />bar<br />baz<br /> now when user goes form after page refresh fields automatically populated previous data taking data database. however textarea shows br tags text instead of adding in line breaks. tried changing br tags /n hoping textarea interpret these line breaks no joy. tried escaping etc. so questions can done? or more importantly can done using html/php (im using smarty). if isnt possible can done using javascript? examples appreciated. thanks reading don't nl2br when save database. nl2br when you're displaying text in html. can recommend not store html formatting in database (unless you're using rich html editor well, in case sil

javascript - Angular filter on select menu disables buttons in filtered element directives -

i have angular app running hosted service. issue i'm having relatively small 1 frustrating nonetheless. i have set of custom directives loaded page ng-repeat , filter based on value of select element using ng-model. works fine. in element directives have 'close' button removes element page. issue arises when change value of select menu show closed element. once element reappears, buttons in element won't fire callbacks. thought had fact link function happens once, functionality returns after few more toggles select menu. if has insight on this, appreciate it. filter when removed, or brought back? why cause event handles not function? here's example . angular.module("app",[]) .directive("test",function(){ return { restrict: 'e', scope:{ name:'@' }, templateurl:"test.html", link: function(scope,element,attrs){ scope.hide=functio

osx - How to add http server to eclipse server runtime environments? -

i trying deploy code apache http server. when try add new http server in eclipse(luna) eclipse->preference->server->runtime environment->add->under folder “basic” don't see “http server” listed. i using os x , have apache installed on machine. how can add http server option list. thanks. eclipse luna supprts version 7.0.47 or 7.0.43 try this

amazon s3 - How to download a file with Rails 4 Paperclip using s3 -

i have project upload files attachments paperclip , s3. how can have users download these files. model class assets has_attached_file :file end routes resources :assets member 'download' end end controller def download data = open(@asset.file.url) send_data data.read, :type => data.content_type, :x_sendfile => true, :url_based_filename => true end error: openuri::httperror in assetscontroller#download 403 forbidden i found solution problem here answer: def download extension = file.extname(@asset.file_file_name) send_data open("#{@asset.file.expiring_url(10000, :original)}").read, filename: "original_#{@asset.id}#{extension}", type: @asset.file_content_type end

c++ - Extracting elements from a struct stored in an std::container -

i have std::vector stores complex struct s (coming real time source) consists of nested structs n1, n2, n3. struct s has time field. a common task, retrieve of 3 nested structs between 2 times, example getsequencen1(starttime, stoptime, itrstart, itrstop), gives 2 iterators start , end of subsequence. so code this: struct { double time struct n1; struct n2; struct n3; } s; class d { public: void getsequencen1(starttime, stoptime, itrstart, itrstop); void getsequencen2(starttime, stoptime, itrstart, itrstop); void getsequencen3(starttime, stoptime, itrstart, itrstop); private: std::vector<s> stream; }; what right way of implementing functionality of getsequencen1 ? one way of course have vector each n1, n2, n3, (in real live there more 3 subtracts) wondering if std offers nice feature this? i not forced use vector btw, std container (maybe boost) works. hoping provide view vector either see n1 n2 or n3. one way provide customized ite

cannot open fortran module in ubuntu -

i wring fortran code in linux. module file in *.f90 file. "program main" in *.f90 file. when tried compile code in ubuntu "gfortran main.f90", errors said can't find module file. program main use module_name just now, see files compiled alphabetically. if reason, in big trouble. because program has called many subroutines , functions in different f90 files. how resolve problem? thanks. suppose have file containing main program main.f90 , file containing module mod.f90 . correct way compile , generate executable named main be gfortran mod.f90 main.f90 -o main you have not specified module file while compiling therefore unable compile

How to Use Pixel Coordinates with the imshow() command in order to make images from specific sections of a fits image in python? -

i have fits image many astronomical objects in it. trying create small 4x4 "stamps" (sections/images around objects) objects interest me. have calculated pixel coordinates objects in original fits file, , created document contains coordinates. know imshow() command best option, stumped how can use pixel coordinates complete task. from pylab import * import numpy np import pyfits import matplotlib.pyplot plat coord = loadtxt('/users/seadr/data/sky_coordinate_selection.txt') x = coord[:,0] y = coord[:,1] data = pyfits.getdata('/users/seadr/data/sky_bkgdcor_match.fits') #vimin calaculate median of data not equal 0 vmin = median(data[where(data != 0)]) #vmax calculate normalized median vmax = 1.483 * np.median(abs(np.array(data[where(data!= 0)]) - np.median(data[where(data!= 0)]))) print vmax, vmin plt.imshow(data,vmin = vmin,vmax = vmax) the first imshow() gives me original fits document. if wanted @ single star in image, while knowing pixel c

ios - UIGraphicsGetImageFromCurrentImageContext crash when using a queue -

i'm trying understand way code crash when using queue, working when using main thread. code works fine: - (void)penmoved:(nsset *)touches { uitouch *touch = [touches anyobject]; cgpoint currentpoint = [touch locationinview:self]; cgpoint midpoint = midpoint(previouspoint, currentpoint); cgrect bounds = self.bounds; uigraphicsbeginimagecontextwithoptions(bounds.size, yes, [uiscreen mainscreen].scale); [path addquadcurvetopoint:midpoint controlpoint:previouspoint]; [incrementalimage drawatpoint:cgpointzero]; [path stroke]; previouspoint = currentpoint; incrementalimage = uigraphicsgetimagefromcurrentimagecontext(); uigraphicsendimagecontext(); [self setneedsdisplay]; } but version of code crashes after while when incrementalimage = uigraphicsgetimagefromcurrentimagecontext(); called. - (void)penmoved:(nsset *)touches { dispatch_async(drawingqueue, ^{ uitouch *touch = [touches anyobject]; cgpoint curr

html - Using Bootstrap column classes with divs of varying heights -

i setting seemingly easy layout using bootstrap 3 8 text divs, same height taller others depending on screen width. i'd them fit 3 columns on desktop , shrink 2 columns on smaller screens. what i've tried setting each div col-xs-6 , col-md-4. however, on desktop, size of div causing gaps in 'cells'. wrapping each set of 3 divs in .row fixes problem on desktop adds new problem on mobile. (see code below) adding clearfix div visible-md not solve problem. how can make following markup display in 3 columns on desktops , 2 columns (with no gaps) on mobile devices? <div class="row"> <div class="col-xs-6 col-md-4"> <h4><a href="#bond">text text</a></h4> <p class="subtitle">managing director</p> </div> <div class="col-xs-6 col-md-4"> <h4><a href="#buffa">text tex

swing - Keystroke/Hot Key for JButton in Java -

initially using jmenu , establishing hot keys work using accelerator. working perfectly. want same behavior in jbutton stuck. here code wrote : please share ideas can go in right path. import javax.swing.*; import java.awt.event; import java.awt.event.*; import java.util.arrays; public class showdialogbox{ jframe frame; public static void main(string[] args){ showdialogbox db = new showdialogbox(); } public showdialogbox(){ frame = new jframe("show message dialog"); // create action doing want keystroke keysave = keystroke.getkeystroke(keyevent.vk_s, keyevent.ctrl_mask); action performsave = new abstractaction("click me") { public void actionperformed(actionevent e) { //do save system.out.println("clickme"); } }; jbutton button = new jbutton("click me"); button.getactionmap().put("cli

JSF: JSF1090: Navigation case not resolved for component j_idt72 -

i working on managed bean , used configurablenavigationhandler handle case implicit redirection. view id valid, , first time redirection method called, user redirected correct page , user logs in. if method called again , redirected view not closed, report error , user directed unwanted views. how resolve this? thanks in advance.

java - What is a NullPointerException, and how do I fix it? -

what null pointer exceptions ( java.lang.nullpointerexception ) , causes them? what methods/tools can used determine cause stop exception causing program terminate prematurely? when declare reference variable (i.e. object) creating pointer object. consider following code declare variable of primitive type int : int x; x = 10; in example variable x int , java initialize 0 you. when assign 10 in second line value 10 written memory location pointed x. but, when try declare reference type different happens. take following code: integer num; num = new integer(10); the first line declares variable named num , but, not contain primitive value. instead contains pointer (because type integer reference type). since did not yet point java sets null, meaning "i pointing @ nothing". in second line, new keyword used instantiate (or create) object of type integer , pointer variable num assigned object. can reference object using dereferencing operator . (a dot

sass - Shorthand syntax gutters being ignored for span mixin -

i've set global settings susy: $susy: ( columns: 8, gutters: 1/4, ); i want override gutters couple of span .tile-left { @include span(1 of 2 1px); } .tile-right { @include span(1 @ 2 of 2 1px); } generated css .tile-left { width: 44.44444%; float: left; margin-right: 11.11111%; } .tile-right { width: 44.44444%; float: right; margin-right: 0; } i've tried these , these don't seem working either @include span(1 of 2 no-gutters); & @include span(1 of 2 (gutter-override: 1px)); looks "1px" argument didnt work because gutters can defined ratio value; documentation furthermore, i've solved issue of wanting fluid elements , static gutter doing this: .tile-left { @include span(1 of 2 (gutter-override: no-gutters, gutter-position: inside-static)); border-right: 1px solid #e5e5e5; } .tile-right { @include span(1 of 2 (gutter-override: no-gutters, gutter-position: inside-static)); } it loo

sql - How to specify year only as a datatype? -

i'm creating table , want store 1 field date datatype. want store year , not additional info (ie: month, day, or time.) here have far: create table project (projectid int not null identity(1,1) unique ,previousyear1 date -- need format: (yyyy) ) any suggestions on how store year date data-type? i'm working in ssms -2012. aim accomplish without later having convert datatype or alter show year. create table project (projectid int not null identity(1,1) unique ,previousyear1 smallint constraint chk_previousyear1_validity check (previousyear1 >= 1000 , previousyear1 <= 9999) ) smallint goes 32,767 use update , insert trigger limit 1000 - 9999 or more 1900 - 9999 check constraint better answer borrowed roit, give check

javascript - CSS Animated type blocked/blocking Hero Image with JS effect attached -

hey ux designer learning code here, please forgive ignorance , crappy code. i have css animated type overlayed hero image has js effect applied it. originally couldn't both images render. type render couldn't see hero image behind it, or hero image appear couldn't see type. at first thought class applied type creating opaque background on hero image eliminated possibility selectively commenting out stuff. then realized needed put type div inside hero image div. had done before tried again , worked! reason worked because had selectively commented out javascript effect being applied hero image. so problem must tilt-effect (the javascript effect) class. have little knowledge of javascript unsure of causing problem. i'm guessing has way javascript manipulating stuff on page? i've had similar problem before when had page footer , responsive image gallery driven js. html footer render , js gallery re-position objects on page. i'm thinking similar happe

java - Understanding conditions for precise rethrow -

static class firstexception extends exception { } static class secondexception extends exception { } public void rethrowexception(string exceptionname) throws firstexception, secondexception { try { if (exceptionname.equals("first")) { throw new firstexception(); } else { throw new secondexception(); } } catch (exception e) { throw e; } } in detail, in java se 7 , later, when declare 1 or more exception types in catch clause, , rethrow exception handled catch block, compiler verifies type of rethrown exception meets following conditions: the try block able throw it. there no other preceding catch blocks can handle it. it subtype or supertype of 1 of catch clause's exception parameters. can explain meaning of these conditions?(examples counter these conditions) also in last condition, it refers , catch clause's exception parameters in above code?

asp.net - Trying to fire onclick event asp:ImageButton -

my asp:imagebutton doest not fire onclick event on ie, working on chrome or firefox. don't know if code right, here: <asp:imagebutton id="savebtn" runat="server" onclick="save_click" tooltip="save" imageurl="images/save.png" /> using .net framework 3.5 note: ie10 just install .net framework 4.5 ie10 has bug. ie10 incorrectly convert coordinates decimal rather integer. causes imagebutton clicks fail. you try workaround, like: - change imagebutton linkbutton , put button image inside of it. your code this: <asp:linkbutton id="savebtn" runat="server" onclick="save_click"> <asp:image id="image1" runat="server" imageurl="images/save.png" tooltip="save" /> </asp:linkbutton> take here too.

What happens to a non-matching regex in a Perl subroutine call? -

i'm trying make sense of what's happening non-matching regex in subroutine call. consider script: sub routine{ print dumper(\@_); } $s = 'abc123'; # these pass single element &routine &routine( $s =~ /c/ ); # 1. passes (1) &routine(2 == 3); # 2. passes ('') &routine(3 == 3); # 3. passes (1) # following 2 calls appear identical &routine( $s =~ /foobar/ ); # 4. passes () &routine(); # 5. passes () in above script, numbers 1, 2 , 3 pass single value &routine . i'm surprised number 4 doesn't pass false value, rather passes nothing @ all! it doesn't seem possible non-matching regex evaluates nothing @ all, since same sort of signature in conditional isn't valid: # fine if( $s =~ /foobar/ ){ print "it's true!\n"; } # syntax error if( ){ print "hmm...\n"; # :/ } what happens non-matching regex when it's used in subroutine call? f

sql - Searching for Processor and other information with Active Directory Search in Visual Basic -

so i'm writing script in vb scan network , return information on of computers finds. far i've been able computer names , os information. have: set objcommand.activeconnection = objconnection objcommand.commandtext = _ "select name, operatingsystem, operatingsystemversion, operatingsystemservicepack 'ldap://dc=mydomain,dc=com' " _ & "where objectclass='computer'" objcommand.properties("page size") = 1000 objcommand.properties("searchscope") = ads_scope_subtree set objrecordset = objcommand.execute unfortunately, resources on specific terminology grab information make, model, processor data, memory data, internet browser info, , forth has been hard find. know more me? thanks.

c++ - VC++ Access violation reading from private member value types (bool) -

i getting weird error access violation reading private class-level values (no pointers). hresult windowedsinkrenderer::initialize(imlteesink3 *sink) { std::cout << "test\n"; // exception throw here std::cout << "test" << _isinitialized << "\n"; std::cout << "test\n"; return s_ok; } here header class windowedsinkrenderer { public: windowedsinkrenderer(); ~windowedsinkrenderer(); hresult initialize(imlteesink3 *sink); hresult deinitialize(); hresult setrenderowner(hwnd handle); hresult setrenderdimensions(int width, int height, bool fillvideo); hresult getcurrentimage(bitmapinfoheader* bitmapheader, byte** data, dword* size, bool* bufferhasinfoheader); private: dword _remotegraphregister; smartptr<igraphbuilder> _graphbuilder; smartptr<ifiltergraph2> _filtergraph; smartptr<imediacontrol> _mediacontrol; windowedvideoren

c - Pi calculator with mutex Synchronization -

finishing assignment here. got code work , calculate pie except random values receive following errors: ./piesync 10 3 pi computed 10 terms in 3 threads 3.14183961892940200045 * error in `./piesync': free(): invalid next size (fast): 0x0000000001ca3010 * ./piesync 100 5 * error in `./piesync': double free or corruption (out): 0x0000000000ee5040 * i know might array or mutex cant figure out what. code: //pini vaknine #include <stdio.h> #include <stdlib.h> #include <pthread.h> //global variables int n, t; double gpie = 3.0; pthread_mutex_t mutex; //pie function void* pie_runner(void* arg) { long j = (long)arg; long lower = (n/t)*(j-1)+1; long upper = ((n/t)*(j)); double mypartialsum = 0; //printf("lower=%lu upper=%lu\n",lower , upper); for(long = lower; <= upper; i++) { if(i % 2 == 0){ mypartialsum -= 4.0/((2*i)*(2*i+1)*(2*i+2)); //printf("vsum %lu = %f\n

android - Putting drawables in front of one another causes dramatic used memory increase -

Image
usual memory footprint of app around 20mb. however, when put drawables 1 in front of other (for sake of animating each individual element)... there 2 drawables in picture: green base , pin (with shadow) ...my memory usage goes ~40mb!the layout using xhdpi drawables, have around 2.1mb in total. layout of these drawables is: <relativelayout android:layout_width="match_parent" android:layout_height="0dp" android:layout_weight="1.2"> <imageview android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/serbia" android:src="@drawable/serbia" android:adjustviewbounds="true" /> <imageview android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/pin"

SQL: GROUP BY for number ranges? -

i'm first time poster , new sql, colleagues. have column of numbers (let's call "numbers") , values in range 1-9999. need create grouping column (let's call "numbers level") , assign values of aa numbers 1-999, bb 1000-6999 , cc 7000-9999. so, final output below (output not need ordered): numbers | numbers level ------------------------------------- 136 | aa 2935 | bb 4288 | bb 8987 | cc 436 | aa 3737 | bb is there easy way script this, i.e.: using group clause? or grouping column have exist , need populate command? please let me know if question wreaks of cluelessness , i'll clarify best can. this easiest case statement (assuming you're using sql-server; if not, please add tags correct version). select [numbers] , case when [numbers] between 1 , 999 'aa' when [numbers] between 1000 , 6999 'bb'

python 2.7 - using String.startswith() with a unicode string -

i trying trim string scraped html page using beautifulsoup. starts &#160;–&#160; in html page. trying following code: if thestring.startswith(unichr(160) + '-' + unichr(160)): print "found starting sequence" thestring= thestring[3:] however, if condition not being triggered (as confirmed fact print statement not happening). how set condition? (also in cases, thestring 3 characters, in case want thestring end empty string -- or need separately test case?) by using thestring.__repr__() able determine bs giving me string started u'\xa0\u2013\xa0' then following code works me: if thestring.startswith(u"\xa0\u2013\xa0"): print "found starting sequence" thestring = thestring[3:]

javascript - Simple jQuery call to change input value continues returning TypeError $(...) is null -

my hair falling out while i'm trying figure out why jquery keeps throwing typeerror think valid call replace input value in html. the line below being called in 1 of functions change of input values name "form_key." $('input[name="form_key"]').val("itworks!"); (resides in http://vt2.net/js/warp/warp.js ) there multiple pages have hidden input name , pages have more once, , i'm trying change value on page. the page below has 1 firebug keeps showing typeerror no matter how many ways try replace value. http://vt2.net/my-test-product.html it's simple , stupid keep missing it! ideas? you use http://vt2.net/js/lib/jquery/noconflict.js where define // avoid prototypejs conflicts, assign jquery $j instead of $ var $j = jquery.noconflict(); so operation jquery, need use $j instead $ and $ prototype.js function $(element) { if (arguments.length > 1) { (var = 0, elements = [], length = arguments.le

python - How to send multiple messages to mandrill -

i have around 1000 unique mails unique content. want bulk send them mandril i.e. dont want make individual network calls every message sending. following document shows api. not define want to. https://mandrillapp.com/api/docs/messages.python.html what want mandrill_client = mandrill.mandrill('your_api_key') messages ={ message1, message2 ....} result = mandrill_client.messages.send(messages=messages, async=true, ip_pool='main pool', send_at='example send_at') i not find above. want. try this message = { #other details 'from_email': 'message.from_email@example.com', 'from_name': 'example name', 'to': [{'email': 'recipient.email@example.com', 'name': 'recipient name', 'type': 'to'},2nd reciepient,....], } result = mandrill_client.messages.send(messages=messages, async=true)

.htaccess - How do i set a 410 status for any page with a .html file extension? -

i had site became victim of spam hacks. resolved, trying set 410 status these pages part of google's index. 404 right want them gone quick can be. thankfully used .html , have no other .html pages in directory. how can use .htaccess set 410 fit below pattern? http://domain.com/anyfilename.html this should not target in subdirectory, below ignored: http://domain.com/folder/anyfilename.html below have tried, it's still returning 404. <ifmodule mod_rewrite.c> rewriterule \.html$ - [g] </ifmodule> you can use: rewriteengine on rewriterule ^[^/.]+\.html$ - [g,nc,l] [^/.]+ make sure match these html files in site root leaving html files in sub directories untouched.

AngularJS: POST request payload empty for ArrayBuffer -

i tried use post send bytes using arraybuffer , seems request payload empty. here's code snippet: var buffer = new arraybuffer(10); var dataview = new dataview(buffer); dataview.setint32(0, 0x1234abcd); var request = { method: 'post', url: 'url', headers: {'content-type': 'application/octet-stream'}, data: buffer, responsetype: 'arraybuffer' }; $http(request) .success(function(data, status, headers, config) { ... }) .error(function(data, status, headers, config) { ... }); as commented, send arraybuffer, need use xhr2 directly (seems angularjs doesn't support it). here's code of how it: var buffer = new arraybuffer(10); var dataview = new dataview(buffer); dataview.setint32(0, 0x1234abcd); var xhr = new xmlhttprequest(); xhr.open('post', 'url', true); xhr.onload = function(e) { console.log('data received'); }; xhr.send(buffer); more details xhr2: http://www.html5rocks.com/en/tu