Posts

Showing posts from March, 2014

html - Right-to-left when using webkit-column -

is there way right-to-left scrolling/content when using -webkit-column ? it seems it's not possible now, columns take entire width of container enlarge or children hides overtaken content without showing scrollbar, overflow:auto. hope fixed if not mistaken !

php - What is the best way of reading parameters in functions? -

i've created several helper functions use when creating templates wordpress. example this: function the_related_image_scaled($w="150", $h="150", $cropratio="1:1", $alt="", $key="related" ) the problem is, if want pass along $alt parameter, have populate $w , $h , $cropratio . in 1 of plugins, use following code: function shortcode_display_event($attr) { extract(shortcode_atts(array( 'type' => 'simple', 'parent_id' => '', 'category' => 'default', 'count' => '10', 'link' => '' ), $attr)); $ec->displaycalendarlist($data); } this allows me call function using e.g. count=30 . how can achieve same thing in own functions? solution name brother (steven_desu), have come solution works. i added function (which found on net) create value - pair string. the code looks fol...

c# - Keyboard Map Binding -

i'm having trouble coming xaml page bind keyboard layout displayed on page. have observablecollection of rows contain keyboardkey datatypes specify width of button. collection bound listbox in xaml. problem i'm having on keyboards the height of key spans 2 rows, xaml listbox not support. avoid hard coding bunch of keys in xaml. thoughts on how approach this? you can create own layout buy inheriting 1 of container controls , overriding arrangeoverride method. you can find example here: http://www.wpftutorial.net/customlayoutpanel.html when creating virtual keyboard, declined automatic layout , put buttons manually in designer. think in cultures better put key rows horizontal shift , in others better to place buttons under each other. have flexible layout , can edit in designer.

jquery - IE7 failing to remove an element according to it's href attribute -

ah, ever on if there's still ie? thanks invaluable of stack overflowers, have jquery working in ff, safari, chrome & oprah. naturally, fails in ie7, evidently has trouble href attributes, e.g.: $('li a[href="' + title + '"]').parent().remove(); can shed light on alternative syntax ie7 understand remove un-checked item list? many in advance! here's works: <div class="product-module"> <div class="product-pic"> <div class="checkbox-wrapper"> <label for="compare1"> <input type="checkbox" class="checkbox" name="compare" id="compare1" /> compare </label> </div> </div> <div class="product-info"> <p><a href="#" title="#"><span class="product-name">product name here</span></a></p> ...

php - Why isn't my simple regex working? -

i have list of steps, , being echo 'd view li items in ol . so, need remove leading numbers (that ol { list-style: decimal } . here example array member combine 1 tbs oil... i tried regex /^\d+\.\s*/ however, didn't remove 1. in example above but , when remove start of line anchor ( ^ ), works. here complete code. foreach($method &$step) { $step = trim(preg_replace('/^\d+\.\s*/', '', $step)); var_dump($step); // quoted above } what doing wrong? thanks! update sorry guys, here var_dump() of 1 of lines.. string(43) "4. remove heat , cover keep warm." to me, doesn't there before digit. is there whitespace before digit? try /^\s*\d+\.\s*/

How do i create a structured header in ALV or any other grid layout in SAP ABAP? -

so illustrate: | category | category b | c | | a.a | a.b | a.a | a.b | | | a.a.a | a.a.b | a.b.a | a.b.b | b.a.a | b.a.b | b.b.a | b.b.b | | i need header looks , wondering if there's way other manually write each line. :d depending on scenario, might able bend xxl api generate list in excel. try executing demo program xxlftest , have export results pivot table - maybe use this? other that, know of no control able this. write stuff yourself, of course, or try persuade users have hierarchy on vertical axis , use standard column tree...

Getting an error about an undefined method(constructor) when I'm looking right at it? (Java) -

i'm getting error here says haven't defined method, right in code. class subclass<e> extends exampleclass<e>{ comparator<? super e> c; e x0; subclass (comparator<? super e> b, e y){ this.c = b; this.x0 = y; } exampleclass<e> addmethod(e x){ if(c.compare(x, x0) < 0) return new othersubclassextendsexampleclass(c, x0, subclass(c, x)); //this error ^^^^^^ } i did define constructor subclass, why saying didn't when try pass in return statement? you want new subclass(c, x) instead of subclass(c, x) . in java invoke constructor in different way method: new keyword. more on subject .

system.reactive - Are there any conventions on throwing exceptions from implementations of IObserver? -

i'm implementing iobserver. are there conventions throwing exceptions iobserver? can onnext or other method of implementation throw exceptions? what should happen if exception thrown in onnext or oncompleted - should catch exceptions , call this.onerror(ex)? what happen if onerror throws? from previous discussions in rx forums, best practice if onnext throws, let bubble handled subscribe method, if user decides handle it, so. actually answer not simple, can check out thread related question, here : more closely related thread: what if exception thrown observer in onnext

java - How to store many small integers into a byte array? -

im making online game, , in many online games need loads of data being transfered via internet, need able compress data efficiently. for instance want send client server character coordinates. edit: yeah bad example, let me change values... x coordinate(say -32 32).(65 diferent possible values) y coordinate(-32 32).(65 diferent possible values) z coordinate(-16 16).(33 diferent possible values) i know x stored before y stored before z on byte array before sending. i know in server x cannot lower -31 nor higher 32, same other values. 65*65*33 = 139.425 diferent possible combinations of values 3 numbers = 17 bits. 7 + 7 + 5 = 19 bits. so if store x in first 7 bits, y in next 7 bits , z in next 5 bits take 19 bits , able read them in other side ease, since posible combinations of values 3 numbers can take take 17 bits store feel im losing space here. there way compress 3 numbers using less 19 bits? of course 19 bits , 17 bits both need 3 bytes, if 17 bits , 15 bits m...

performance - how quick read 25k small txt file content with python -

i download many html store in os,now content ,and extract data need persistence mysql, use traditional load file 1 one ,it's not efficant cost nealy 8 mins. any advice welcome g_fields=[ 'name', 'price', 'productid', 'site', 'link', 'smallimage', 'bigimage', 'description', 'createdon', 'modifiedon', 'size', 'weight', 'wrap', 'material', 'packagingcount', 'stock', 'location', 'popularity', 'instock', 'categories', ] @cost_time def batch_xml2csv(): "批量将xml导入到一个csv文件中" delete(g_xml2csv_file) f=open(g_xml2csv_file,"a") import os.path import mmap file in glob.glob(g_filter): print "读入%s"%file ff=open(file,"r+") size=os.path.getsize(file) data=mmap.mmap(ff.fileno(),size) s=pq(data.read(size)) data.close() ff.cl...

regex - Need to block all personal info like url , email, messenger ids, telephone etc using php -

i need regex or functions block user post there private information . have used regex by pass using patterns email dot com , or [dot] or (doe). need block there personal info email, url , chat ids , telephone numbers . have found few patterns members used "www, @, .com, (at), dot, (dot), ++, e-mail, email, website, msn, tel, yahoo, hotmail, gmail, hotmail(dot)com, gmail(dot)com, http://, email, g-mail, , www, .com, skype, tel, yahoo, yahoo(dot)com, g-talk, gtalk, com, www , fax, google talk, web, " no matter how many patterns have, find new 1 around protection. there's no sure way want do.

I want to create a makefile *.c to *.o *.o to executable -

i want create makefile *.c *.o *.o executable go here makefile tutorial.

logging - How to log unit test entry and leave in MSTest -

i'm using mstest , want write log entry before test executes , after finishes. don't want add custom logging code @ beginning , end of each test - make test unreadable , seemed lot of effort (i have > 500 tests) using testinitialize , testcleanup seemed way go can't test name. does knows how this? in mstest, name of test case available in test context property . access in test initialize (as test cleanup) method, can use this: - [testinitialize()] public void mytestinitialize() { if (string.equals(**testcontext.testname**, "testmethod1", stringcomparison.ordinalignorecase)) { } } regards aseem bansal

.net 4.0 compatibility -

i write winforms application, using .net 4.0, linq, etc. work on machines .net 2.0? if use .net 4 features no, won't work on .net 2. if just want use linq objects , no other newer features, should linqbridge , port of linq objects .net 2. can make visual studio target .net 2 in project properties, use linqbridge libraries, , app should work on .net 2 machine. note still able use lot of features c# 3 , 4, such lambda expressions (but not expression trees), automatically implemented properties, anonymous types, optional parameters , named arguments etc. not available though - dynamic won't work on .net 2 example.

java - StringBuffer find 'start' and 'end' and write anything between them -

stringbuffer find 'start' , 'end' , write between them example: text1 text2 start text3 text4 end text5 can print out of stringbuffer text3 , text4' text between 'start' , 'end' assumming have stringbuffer sb contains text: int start = sb.indexof("start"); int end = sb.indexof("end"); if (start != -1 && end != -1) { string fragment = sb.substring(start + "start".length(), end); system.out.println(fragment); } note finds text between "start" , "end" asked in question. if text in stringbuffer has line breaks, might want search text between "start\n" , "end\n" .

java - is there a tab control in RichFaces or JSF that doesn't render ugly nested tables? -

the richfaces 3.3.3 tabpanel control i'm using renders 4 level nested tables. there other tab control render clean html or atleast allow me control it? <ul> ? this kind of ugly code (and not related <rich:tab> component) used in order assure compatibilities , identical behaviors among browsers, including ie (and ie6 also), firefox, safari, chrome, , on... that's why html code, javascript code, not optimized richfaces components. if problem you, can try use own components (some examples have been provided org.life.java ). eventually can simulate behavior buttons , javascript (that hide or show different panels) or using 1 <a4j:commandbutton> per tab refresh content of basic panel.

c++ - Floyd's cycle-finding algorithm -

i'm trying find algorithm on c++ in .net can't, found one: // best solution function boolean hasloop(node startnode){ node slownode = node fastnode1 = node fastnode2 = startnode; while (slownode && fastnode1 = fastnode2.next() && fastnode2 = fastnode1.next()){ if (slownode == fastnode1 || slownode == fastnode2) return true; slownode = slownode.next(); } return false; } but doesn't seem right, or wrong? how can prove hare meet tortoise @ end? in advance explanation how work , proof edited about solution, found in regular algorithm use 1 fast iterator here use two, why? the idea in code you've found seems fine. 2 fast iterators used convenience (although i'm positive such kind of 'convenience', putting lot of 'action' in condition of while loop, should avoided). can rewrite in more readable way 1 variable: while (fastnode && fastnode.next()) { if (fastnode.next() == slownode || fastnod...

c# - Why *should* we use EventHandler -

i hate eventhandler. hate have cast sender if want it. hate have make new class inheriting eventargs use eventhandler<t> . i've been told eventhandler tradition , blah, blah...whatever. can't find reason why dogma still around. is there reason why bad idea make new delegate: delegate void eventhandler<tsender, t>(tsender sender, t args); that way sender typesafe , can pass whatever heck want arguments (including custom eventargs if desire). there reason requiring second argument derive eventargs if fully-trusted code hosts third-party code partially-trusted. because callback event handling delegate done in context of raising code , not third party code, possible malicious third-party code add privileged system operation event handler , potentially execute escalation of privilege attack running code in fully-trusted context partially-trusted context not run. for example, if declare handler type int -> void third-party code enqueue yo...

visual studio 2008 - How to back up or move a project -

someone set large complex visual studio project on pc. source sits on more 1 directory , uses boost libraries. wish make modifications source code experiment ideas. before want make back-up of project elsewhere on pc i have , so can compare old , new. my problem don't know files should put , don't know how modify backed project such compile in new location. is there short guide somewhere me? ok @mick, if refuse use source-code control; clean project, removing .o files , other built artefacts. copy entire directory tree; luck boost not in copy, if is, either copy or not, wish. if don't copy it, don't forget update project's definition of find it. declare 1 of (right identical) versions of project original. might want write-protect it. open visualstudio project in copy. build project. or rather, attempt build project , start dealing problems thrown up. if build uses exclusively relative file locations may find builds first time withou...

asp.net - Repeater databound loses data & event on postback - is there a best practice solution? -

currently struggling problem i've encountered variations on in past. @ moment worthwhile solution escapes me, seems such obvious issue can't wondering whether or not there's "best practice" approach should adopt. without code, here's issues in nutshell: page has databound control (a repeater) isn't populated until user inputs data , clicks button. repeater item template contains button user clicks button, page posts back. on load, repeater empty event never handled because originating control no longer exists go beginning of wretched cycle i've confirmed problem because if provide repeater static data on page load, works fine. of course that's no use because has populated dynamically. is there commonly approved way round headache? can store data in session , re-use on page load, seems terribly clumsy. cheers, matt if of controls created dynamically, have recreated during post in order events etc hooked up. if case, tak...

html - Problem with form validation using jquery validate plugin -

i have following code perform validation of submitform shown below .when click on addresslisting div tag , call validation function ,it performs validation businessname field not other remaining feilds.only businessname name field highlighted in red color,but not other feilds. using following jquery plugin validate fields http://jquery.bassistance.de/validate/jquery.validate.js example.html <fieldset id="fieldset1"> <legend>registration details:</legend> <form id="submitform"> name of business:<br/> <input size="30" type="text" id="businessname" class="required" /><br/> zipcode:<br> <input size="30" type="text" id="zipcode" class="required zipcode"/><br> telephone:<br/> ...

sql - Grouping totals by date ranges -

i have totals table using different criteria, this: select distinct sum(case when mycondition1 1 else 0 end) total1, sum(case when mycondition2 1 else 0 end) total2 table1, table2 common_condition1 , common_condition2 , between date1 , date2; this works fine , intended result. now, have repeat every week last 12 months, excluding holidays period. so, generate set of date ranges used in queries. so, repeat above sql statement date ranges, lengthy process. i have totals every week. example 26-sep-2010 02-oct-2010, 19-sep-2010 25-sep-2010, 12-sep-2010 18-sep-2010, etc.. how should put ranges in query grouping , in select list, don't have them in table. how can in single shot , totals each date range. please me sql. thank you. you create table contains date ranges. can join on new table; you'll have replace distinct group by. example: select table3.date1 , table3.date2 , sum(case when mycondition1 1 else 0 end) total1 , sum(ca...

Sql Server 2008 Instalation -

can install , use sql server 2005 , 2008 in same time on same machine because have old software use sql server 2005 , new 1 use sql server 2008 yes, asked instance name during installation of each one. give different name each instance.

python - Future and stability of IronPython -

i looking possible way integrate c++/c# application of python scripts. @ point, ironpython seems way go. however, before proceeding, ask following: how stable ironpython right now? ready production use? there known major quirks/bugs? what future of ironpython? maintained bug fixes? there new versions? i particularly interested in using ironpython run python web framework such django or web2py. aware current python web frameworks don't play it . therefore insights on future of ironpython's web framework support appreciated well. to answer second question, yes, ironpython developed in future. right now, there "language change moratorium" on cpython, main branch of python (see pep 3003 . python folks want cpython, jython, , other branches of python development catch cpython, , they've been doing that. if goes planned, time moratorium over, ironpython , others speed , have implementations follow syntax , features of python 3.x. also, since ironp...

Android Send mail Application -

use following send mail application in android sending email in android using javamail api without using default/built-in app , got warning 10-07 17:58:22.762: info/sslsocketfactory(925): using factory org.apache.harmony.xnet.provider.jsse.opensslsocketfactoryimpl@4007ed70 10-07 17:58:23.063: debug/nativecrypto(925): ssl_op_no_sslv3 set 10-07 17:58:23.573: info/global(925): default buffer size used in bufferedoutputstream constructor. better explicit if 8k buffer required. 10-07 17:58:23.573: info/global(925): default buffer size used in bufferedinputstream constructor. better explicit if 8k buffer required. 10-07 17:58:24.172: info/global(925): default buffer size used in bufferedreader constructor. better explicit if 8k-char buffer required. please me find solution to set buffer size (the default 8k ). i use like: //( set 2k in case) bufferedreader in = new bufferedreader(inputstr...

ruby on rails - RoR array -count identical elements-on including value -

how count idential values on after appending value in array such that a=[] a<<1 count of 1 1 a<<1 count of 1 2 thanks you do: a.select{|v| v == 1}.size it's 1 solution

wpf - How can I display multiple colored underlined Text in a Textbox -

this code underlines text in textbox, can underline specific text? brush brush = brushes.blue; pen pen = new pen(brush,2); textbox tb1 = new textbox(); tb1.acceptsreturn = true; tb1.text = "this long text not?"; textdecoration textdec = new textdecoration(textdecorationlocation.underline,pen,1,textdecorationunit.pixel,textdecorationunit.fontrecommended); tb1.textdecorations.add(textdec); tb1.width = 400; tb1.height = 30; this.addchild(tb1); the textbox doesn't provide ability alter characteristics individual characters. it's or none control. the richtextbox control need.

How to program 3D in OpenGL -

i want program in opengl in 3d (have special screen , glasses). what have that? (options, code, ..?) i can't own experience, should find resources searching internet "stereoscopic opengl". for example, the "stereoscopic opengl tutorial" on gali-3d.com recommends following rendering procedure: an opengl application stereo capabilities must following things: 1) set geometry view left human eye 2) set left eye rendering buffers 3) render left eye image 4) clear z-buffer (if same z-buffer left , right image used) 5) set geometry view right human eye 6) set right eye rendering buffers 7) render right eye image 8) swap buffers

c++ - Replace\remove character in string -

string delstr = "i! am! bored!"; string repstr = "10/07/10" i want delete '!' on delstr , want replace '/' '-' on repstr string. is there way without doing loop go through each character? remove exclamations: #include <algorithm> #include <iterator> std::string result; std::remove_copy(delstr.begin(), delstr.end(), std::back_inserter(result), '!'); alternatively, if want print string, don't need result variable: #include <iostream> std::remove_copy(delstr.begin(), delstr.end(), std::ostream_iterator<char>(std::cout), '!'); replace slashes dashes: std::replace(repstr.begin(), repstr.end(), '/', '-');

android - Updating SeekBar in ListView -

i have listview each item represents podcast can run 90 minutes. selecting item display seekbar , start streaming in audio url using mediaplayer. i use pointers on how handle maintaining state of seekbar after scrolls off page , scrolled view. know views recycled , i've read caching views in adapter bad idea i'm wondering other options there are. i know views recycled , i've read caching views in adapter bad idea it's bad idea cache all views, except via recycling mechanism. caching 1 seekbar , or row containing seekbar , won't big of problem. caching 1,000 rows trouble lies. so, i'd note position 1 playing podcast. in getview() implementation in adapter, if requested position 1 playing podcast, use cached row. otherwise, go through normal recycling.

Applying ControlTemplate to Textbox causes .Text to become blank (Silverlight) -

i have bunch of textboxes on xaml page wanted same size. created control template , put in grid.resources section of page <grid.resources> <controltemplate x:key="basictextbox" targettype="textbox" > <textbox minwidth="200" /> </controltemplate> </grid.resources> and apply textbox following: <textbox x:name="txtnewsec1" template="{staticresource basictextbox}"/> i have button user can press , in code behind take text user has entered , apply object. surprised everytime when text come blank when text in textbox. after removing template textbox , clicking button again, text magically available during button's click event handler. there have set in controltemplate allow textbox have text during code-behind events? or sort of bug in silverlight? you shouldn't use control template achieve want do. need is... styling (tada) <grid.resources> <sty...

Visual studio 2010 Requires Run as Admin to build website -

i using visual studio 2010 ultimate , have solution contains website project. under xp pro evrything built fine. moved on new machine running windows 7 ultimate, , when go build website following error meesage: ------ build started: project: c:...\website\, configuration: debug cpu ------ validating web site : build (web): failed map path '/' if pick "run administrator" option launching visual studio website builds , have no errors ata all. i prefer not have run visual studio administrator. suggestions? you can right have visual studio permanently running administrator . simply follow these steps: 1) find visual studio executable. visual studio 2010 c# express: c:\program files\microsoft visual studio 10.0\common7\ide\vcsexpress.exe visual studio 2010 professional: c:\program files\microsoft visual studio 10.0\common7\ide\devenv.exe 2) right-click on visual studio executable , left-click properties 3) on new wi...

regex - Matlab - how to replace all the special characters in a vector? -

is possible replace special characters in matlab vector through regular expression? thank you * edit: * thank responses. i'm trying achieve following. have text file contains few paragraphs novel. have read file vector. filetext = ['token1,' 'token_2' 'token%!3'] etc. in case , _ % ! special characters , replace them blanks (''). can achieved through regular expressions? can javascript, can't work in matlab. thank you if "special characters" mean less-frequently used unicode characters ¥ , ¶ , or ¼ , can use either function regexprep or set comparison functions ismember (and can convert character string equivalent integer code first using function double if needed). here couple examples standard english alphabet characters (lower , upper case) removed string: str = ['abcdefabcdefÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐ']; %# sample string str = regexprep(str,'[^a-za-z]',''); %# remove characters usi...

Select most recent from mysql table -

i have 2 mysql tables: item containing items 1 can buy: create table `item` ( `itemid` int(11) not null auto_increment, `name` varchar(50) default null, primary key (`itemid`) ) engine=innodb; purchase containing purchases: create table `purchase` ( `purchaseid` int(11) not null auto_increment, `date` date default null, `amount` int(11) default null, `itemid` int(11) default null, primary key (`purchaseid`) ) engine=innodb; i want select 20 recent purchases based on date , purchaseid , join item table show name of these purchases. if item has been purchased more once in 20 recent purchases should show once. no duplicates. can't figure out.. maybe can? thanks! wouldn't be: select `name` `item` join `purchase` using(`itemid`) group `itemid` order `date` desc limit 20 or select distinct `name` `item` join `purchase` using(`itemid`) order `date` desc limit 20 using distinct allows omit duplicates, group by (which allows perform f...

iphone - using remoteio together with AudioServicesPlaySystemSound -

we trying use remoteio audio recording in conjunction audioservicesplaysystemsound function audio playback. problem whenever remoteio running playback volume drops significantly. seems if final mixing takes place behind scene not no how change behavior. the implementation of remoteio based on fallowing blog http://atastypixel.com/blog/using-remoteio-audio-unit/ for audio playback use code one nsstring *sndpath = [[nsbundle mainbundle] pathforresource:@"test" oftype:@"wav" indirectory:@"/"]; cfurlref sndurl = (cfurlref)[[nsurl alloc] initfileurlwithpath:sndpath]; systemsoundid soundid; int e = audioservicescreatesystemsoundid(sndurl, &soundid); if (e) { nslog(@"couldn't create sound"); exit(0); } audioservicesplaysystemsound(soundid); thanks lot help you may have disable voice processing agc.

PHP Split PayPal Charge -

is there way can split paypal charge php? im looking 90% going 1 account , 10% going account, when person charged should going 10% account. i'd person charged using ipn. anyway php? thanks this method should adaptable challenge: https://www.x.com/thread/40474

java - how to read RGB Data from png in j2me -

hey have using j2me read image i want process on image darkenes , lightens i read image input stream inputstream istrm = getclass().getresourceasstream("/earth.png"); bytearrayoutputstream bstrm = new bytearrayoutputstream(); int ch; while ((ch = istrm.read()) != -1){ bstrm.write(ch); byte imagedata[] = bstrm.tobytearray(); image im = image.createimage(imagedata, 0, imagedata.length); how can rgb values or how can add values array of pixles imagedata[] can more lightens or darkness , is there header data including in input stream had read , cause me error when iam adding values ? i think should able following: int width = im.getwidth(); int height = im.getheight(); int[] rgbdata = new int[width*height]; // since working rgba im.getrgb(rgbdata, 0, width, 0, 0, width, height); // now, data stored in each integer 0xaarrggbb, // high-order bits alpha channel each integer now, if want put them 3 arra...

flex - Flex3: Is it Possible to Embed only a Few Letters from a Font? -

is there way embed few letters font instead of embedding whole thing? need 7 capital letters font. thank you. -laxmidi yes, can that. specify characters or character ranges want embed font , characters embedded: http://www.adobe.com/livedocs/flex/3/html/help.html?content=fonts_07.html

Loading SVG into SVGWeb dynamically with JQuery -

i trying dynamically display svg content. content stored string in data source. example string following: <svg width="200" height="200" style="background-color:#d2b48c; margin-bottom:5px;" id="embeddedsvg"> <g id="mygroup" fill="blue" style="font-size:18px; text-anchor:middle; font-family: serif;"> <circle id="mycircle" cx="100" cy="75" r="50" stroke="firebrick" stroke-width="3" /> <text x="100" y="155">hello world</text><text x="100" y="175">from embedded svg!</text> </g></svg> to accomodate ie, i'm using svgweb . problem is, display svg content, need wrap in <script type="image/svg+xml"></script> tag combo. challenge is, svg being pulled asynchronously via jquery. and, knowledge, can't dynamically write 'script' tag j...

Question about nested CSS? -

i have box center , , want color box differently depend on page. try this #center { margin-top: 2px; padding: 10px 20px; /* cc padding */ width: 100%; height: 800px; color: black; font-size: 11px; } #backgroundred{ background-color: red; } #container { padding-left: 200px; /* lc fullwidth */ padding-right: 240px; /* rc fullwidth + cc padding */ } #container .column { position: relative; float: left; } so try this <div id="containder"> <div id="backgroundred"> <div id="center" class="column"> abc </div> </div> </div> however background of box not turn red, explain me did wrong? btw, must have class="column" maybe wanted rule? #backgroundred div#center { background-color: red; } that means "if div#center child of #backgroundred..." your example...

Exposing Sharepoint Metadata to web service search -

our organization has started project hoping use sharepoint create electronic records clients rather paper method tends have documents lost etc. i have been tasked interfacing sharepoint find documents associated given client. each document has sharepoint metadata stores clientnumber, having issues finding how use queryservice web service search on specific field. there 30 document libraries search through, believe queryservice better fit particular situation listservice. i using vb code searching, , following querytext sending queryex function. ...<querytext type='mssqlft'> select rank, title, path, description, write, size, author, sitename, fileextension, hithighlightedsummary, hithighlightedproperties, keywords, isdocument scope() freetext(defaultproperties,'" & me.clientnumber.text & "') , isdocument = 1 order rank desc -- </querytext>... i able include in clause explicitly says match must found in clientnumber field have ...

Vim Regex : How to search for A AND B NOT C -

i have many lines containing names of presidents carter, bush, clinton, obama. contain 1 of names, 2, 3, 4 of them (in order). i know how search carter , clinton , obama -> :g/.*carter\&.*clinton\&.*obama/p i know how search carter , (clinton or bush) -> :g/.*carter\&\(.*clinton\|.*bush\)/p (there better ways that) but can't figure how search (and looked @ related questions), e.g., bush , clinton not carter , less how search, e.g., bush , clinton not (carter or obama). to represent not, use negative assertion \@! . for example, "not bush" be: ^\(.*bush\)\@! or using \v : \v^(.*bush)@! important: note leading ^ . while it's optional if use positive assertions (one match other), required anchor negative assertions (otherwise can still match @ end of line). translating "bush , clinton , not (carter or obama)": \v^(.*bush)&(.*clinton)&(.*carter|.*obama)@! addendum to explain relationship betwee...

model view controller - java MVC + vetoable/deferred property -

i have interface foomodel , class defaultfoomodel have few simple properties. getting stuck on boolean enable property because want have vetoable/deferred: public interface foomodel { public boolean isenabled(); /** returns old value */ public boolean setenable(boolean enable); public void addfoolistener(foomodel.listener listener); public void removefoolistener(foomodel.listener listener); public interface listener { public void onfooenableupdate(boolean newenable, boolean oldenable); } } what want model m central point of access enable property. here's sequence of events want occur: view v (or user of model m) calls foomodel.setenable(enable) on arbitrary thread. foomodel may either: a. call onfooenableupdate(newenable, oldenable) on each of listeners in arbitrary order b. start potentially long sequence of events whereby entity (e.g. controller c) can decide whether enable, , somehow let foomodel know, whereby enable property ...

javascript - HTML file upload: is there a way to force content-type="application/octet-stream" -

we custom handling file uploads on server end due embedded limitations. the html file upload code used in firefox browser: <html> <body> <form action="http:///192.168.1.1/upload.cgi" name="form_1" method="post" enctype="multipart/form-data" > <input type="file" id="file" name="filename" content-type="application/octet-stream"> <input type="submit" name="mysubmit" value="send"> </form> <body> </html> if selected file called "fish.jpg", server receives content-type "image/jpeg". if file renamed "fish" without file extension, server receives content-type "application/octet-stream" want. is there way force "application/octet-stream" in html page (with or without regular javascript)? thanks in advance, bert no. there no content-type="...

in or out of a for loop in R - calculating the diagonal product of a matrix -

i'm trying find maximum diagonal product of 2 digit numbers in 20x20 matrix. this gives error message : i <- 17:1 z <- (j in 1:(18-i)) {b <- max ((x[i,j]*x[i+1,j+1]*x[i+2,j+2]*x[i+3,j+3]))}} but doesn't: z <- (i <- 17:1) {for (j in 1:(18-i)) {b <- max ((x[i,j]*x[i+1,j+1]*x[i+2,j+2]*x[i+3,j+3]))}} but second version gives me number small . why first 1 not work, think yield correct answer, don't understand error message. this looks wrong. you cannot assign result of for loop variable. , max() on scalar variable nonsense. lastly, matrix x isn't specified. i'd retry smaller, , maybe print interim results screen. walk before run still advice. later can still vectorise sprint solution.

iphone - UIButton event 'Touch Up Inside' not working. 'Touch Down' works fine -

i've got uibutton in uiview, in uiviewcontroller i've allocated , inited .xib file. when hooking ibaction 'touch down' event of uibutton triggers correctly. if hook 'touch inside' event doesn't respond. other events don't work either. 'touch drag enter', 'touch drag exit', 'touch outside' etc. touch down. does have idea why might be? rich first, can absolutely, positively guarantee uibuttons correctly connected in ib responds expected touch-up-inside events. (can imagine if didn't?!) given that, it's fair bet have not hooked things expect. here things try: make action print log statement first thing: nslog(@"%s", __pretty_function__); check in ib function button wired touch-up-inside action. (later, can wire multiple events but, testing, want simplify as possible.) make sure button 50x50 or bigger. (small buttons hard press.) for now, make button rounded-rect button. if had im...

ocx - Running rgsvr32 in program files\myapp seems to fail even when run as admin -

our software needs able register ocx @ runtime. ocx lives in program files directory of app. find if manually fire cmd line admin , run command works great, if fire our app admin , let app try register ocx, fails. notice app able run regsvr32 when run build directory, presumably because own build dir. still have run admin though. have ideas going wrong? thanks, brian the answer firstly, i'm sloppy, , secondly command line args passed regsvr32 need wrapped in double quotes. never occurred me because wrote code so: string args = "/s " + path.combine(mp_xxxx_dir.fullname, map_point_ocx) ; when should have looked like: string args = "/s " + "\"" + path.combine(mp_xxxx_dir.fullname, map_point_ocx) + "\""; hope helps else :)

osx - Installer for a simple Mac OS command-line tool? -

how can build novice-usable (clickable download) installer mac os x command-line tool, , should binary installed novice user no knowledge of shell paths can open terminal app , type "foo" run freshly installed foo tool? can installer install documentation user can type "man foo"? are there other options should considered make use of pure command-line (stdin, stdout) tool accessible novice mac user? what's minimum version of os x you're targeting? 10.6 (and iirc 10.5) include /usr/local/bin in default path, 10.4 did not. long don't need support 10.4, should put executable in /usr/local/bin , man page in /usr/local/share/man/man1 (or whatever appropriate chapter number is). for building installer itself, can use apple's packagemaker utility (part of xcode). create prototype local folder bin , share/man/man1 subfolders , populate them files. create package project in packagemaker, , choose organization name , minimum target os. d...

for loop - How to express this sum concisely in R? -

i have simple r beginner's question: how express sum below concisely in r ? sum_{i=1}^n / (a+i) i tried following, there must better way, without calling for : r<-0 for(i in 1:n){ r <- r + (a / (a+i)) } thanks! i believe it's simple as: sum(a/(a+1:n))

Upgraded to MVC3 Beta, Razor views generate a different base class than a newly created project -

i have been working on website using mvc preview 1 since came out. beta out, have updated system beta. there not alot of out there upgrading preview 1 beta, , rebuilding caused lot of problems. have done far: 1) copied web.config new mvc3 beta project (to correct sections , values). 2) added references system.web.helpers , system.web.webpages, references match newly created project. 3) changed @import @model per new format. the problem getting, views in existing project, being derived off of system.web.web.pages , in new project being derived off system.web.mvc.webviewpage<>. what missing causing base class issue. you need copy /views/web.config new mvc 3 project - base page class defined

control theory - Scaling PID (Proportional Integral Derivative) Output -

i have implemented pid function using formula, correction = kp * error + kd * (error - preverror) + ki * (sum of errors) what should keep output between range? 0-255 if disregard value not between 0 255 produces jiggly behavior? correction = ... correction2 = correction; if(correction < least) {correction2 = least;} if(correction > most) {correction2 = most;} then use correction , correction2 output appropriate. don't correct based on correction2 , wonder why behaves in odd way when reach edge of least <-> most.

javascript - How do I check that a number is float or integer? -

how find number float or integer ? 1.25 --> float 1 --> integer 0 --> integer 0.25 --> float check remainder when dividing 1: function isint(n) { return n % 1 === 0; } if don't know argument number need 2 tests: function isint(n){ return number(n) === n && n % 1 === 0; } function isfloat(n){ return number(n) === n && n % 1 !== 0; }

Creating custom components in Java AWT -

i trying create custom component using java awt or swing rectangle number of components inside of it, including other rectangles. this: ╔══════╗ ║ ┌┐ ║ ║ ├┘ ║ ║ ║ ╚══════╝ and needs component can preferably draw 1 instruction. myframe.add(new mycomponent()) . what best way this? there way can using rectangle , or should go jpanel or swing? i recomend extending jpanel , overriding it's paintcomponent() method. see another answer of mine on that. basically, when rectangle 'drawn' on panel, want save member of jpanel . then, in paintcomponent method, draw of rectangles have saved in jpanel . this how implement 'draw' method: list<rectangle> recs; list<stroke> strokes; list<color> colors; public void drawrectangle(rectangle newr, stroke stroke, color c){ recs.add(newr); strokes.add(stroke); colors.add(c); } and, paint component similar to: protected void paintcomponent(graphics g){ super.pain...

objective c - iPhone SDK Background threads calling other methods -

i seemingly straightforward question can't seem find answer (and hindering app). i have background thread running paricular method: -(void)processimage:(uiimage *)image { nsautoreleasepool * pool = [[nsautoreleasepool alloc] init]; //process image here in background here [pool drain]; } this works great, question comes when want call method inside already-background method. call stay in background? need add nsautoreleasepool * pool = [[nsautoreleasepool alloc] init]; , [pool drain]; new method make run in background well? any advice helpful. bit confused this. many thanks, brett it stay in background, on same thread called from. some threading notes consider this: it may not obvious, if call timer background thread, , thread exits before timer supposed go off, timer not called. recommended setup timers main thread you dont need autorelease pool unless spawn thread. any ui updates should done on main thread

linq - Dynamically Adding a GroupBy to a Lambda Expression -

ok, i'll admit don't entirely "get" lambda expressions , linq expression trees yet; lot of i'm doing cutting , pasting , seeing works. i've looked on lots of documentation, still haven't found "aha" moment yet. with being said... i'm attempting dynamically add groupby expression linq expression. followed question here: need creating linq.expression enumerable.groupby and tried implement saw there. first off, i've got entity classes database, , table calledobjcurlocviewnormalized i've got method initial call, public iqueryable<objcurlocviewnormalized> getlocations() { iqueryable<objcurlocviewnormalized> res = (from loc in tms.objcurlocviewnormalized select loc); return res; } so can call: iqueryable<metamericanlinqdatamodel.objcurlocviewnormalized> locations = american.getlocations(); no problem far. now, want group arbitrary column, call this: var group...

glassfish - org.xml.sax.SAXParseException: cvc-elt.1: Cannot find the declaration of element 'beans' -

i've built simple spring ws (1.5.9) , i'm trying deploy glassfish v3. unfortunately deployment fails above reason. i've struggled resolve issue myself not able resolve "bean" element. heres me spring-ws-servlet.xml (bean definitions): <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance"> ...bean definitions </beans> i've tried schemalocation set spring-beans-3.0.xsd same result. my war has 1 dependency , spring-ws. you haven't provided standard collection of schema locations, particularly not required schema location beans schema. here's 1 of mine: <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:context="http://www.springframework.org/schema/context" xmlns:gate="http://gate.ac.uk/ns/spring" xsi:schemalocation=...

Determining the input of a function given an output (Calculus involved) -

my calculus teacher gave program on calculate definite integrals of given interval using trapezoidal rule. know programmed functions take input , produce output arithmetic functions don't know how inverse: find input given output. the problem states: "use trapezoidal rule varying numbers, n, of increments estimate distance traveled t=0 t=9. find number d trapezoidal sum within 0.01 unit of limit (468) when n > d." i've estimated limit through "plug , chug" calculator , know regular algebraic function, do: limit (468) = algebraic expression variable x (then solve x) however, how programmed function? how determine input of programmed function given output? i calculating definite integral polynomial, (x^2+11x+28)/(x+4), between interval 0 , 9. trapezoidal rule function in calculator calculates definite integral between interval 0 , 9 using given number of trapezoids, n. overall, want know how this: solve n: 468 = trapezoidal_rule(a = 0, b...

I have set php-mysql-apache to work on latin1 but when doing back-ups my character-set client is still utf8 -

yes, know think, moment decided go latin1. this mysql config: • mysql> show variables 'character_set_%'; • +--------------------------+--------+ • | variable_name | value | • +--------------------------+--------+ • | character_set_client | latin1 | • | character_set_connection | latin1 | • | character_set_database | latin1 | • | character_set_results | latin1 | • | character_set_server | latin1 | • | character_set_system | utf8 |> impossible change since default system parameter. for php use following commands @ php.ini: mssql.charset = "iso-8859-1" for apache usual: adddefaultcharset iso-8859-1 with everytime following added each table: /*!40101 set @saved_cs_client = @@character_set_client /; / !40101 set character_set_client = utf8 */; why character_set_client still in utf8 connections between apache/php , mysql? mysqldump doesn't @ php or apache settings. you...

bash - How would I use grep on a single word in UNIX? -

i want run script in unix specific pattern inside passed argument. argument single word, in cases. cannot use grep, grep works on searching through files. there better unix command out there can me? grep can search though files, or can work on stdin: $ echo "this test" | grep test

java - HTML Custom JUnit Report Uneven Table Alignment -

i coding java class generates html table reports junit tests , use css visual formatting. having issue aligning cells since number of colummns generated unforseeable since of these columns represent parameters passed variadic function. therefore there inherent misalignment in columns. there way align these cells through css attribute or something? dont want alter underlying java code change aesthetic issue. here sample table generated like: http://lh5.ggpht.com/_n67dmbmmqmq/tk6q-vlhd3i/aaaaaaaaab8/jdfr1b5hx-k/junitreportexample.png here html source table (formatted properly): <html> <head> <style type="text/css"> td { font-family: "trebuchet ms", arial, helvetica, sans-serif; font-size: 1em; border: 1px solid black; padding: 3px 7px 2px 7px; } </style> </head> <body> <table> ...

assembly - What x86 register denotes source location in movsb instruction? -

what x86 register denotes source location in movsb instruction? in 32-bit mode, esi . in specific, movsb copies 1 byte ds:esi es:edi , adjusts both esi , edi 1, either or down depending on direction flag.

c++ - Trouble understanding whence a copy constructor came -

i have following small code: template <typename t> class v { public: t x; explicit v(t & _x) :x(_x){} }; int main() { v<float> b(1.0f); // fails return 0; } and happens fail. message returned g++ 4.4.5 is: g++ -o0 -g3 -wall -c -fmessage-length=0 -mmd -mp -mf"main.d" -mt"main.d" -o"main.o" "../main.cpp" ../main.cpp: in function ‘int main()’: ../main.cpp:19: error: no matching function call ‘v<float>::v(float)’ ../main.cpp:10: note: candidates are: v<t>::v(t&) [with t = float] ../main.cpp:6: note: v<float>::v(const v<float>&) the thing is... whence second constructor came? have no clue... other answers discuss why you're getting compile-time failure (which questions when such failures prominent part of question). however. regarding explicit question, "whence second constructor came?": 12.8/4 "copying class obj...

javascript - Sliding out Div, Slide in another Div at the same time -

ok, have few divs within section of html. need getting div tags slide out (either horizontally left/right or vertically going up/down, depending on setting). @ same time when div sliding out of page, need div slide in opposite side of page. sort of slideshow, it's not slideshow. when user clicks on next button/link, should slide out (to left) showing on there, , slide-in (coming right) next tag. i can tags hide , show using blocks, , fine without sliding, need slide. here's got far... <!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" xml:lang="en" lang="en"> <head> <title>slideshow</title> <script language="javascript" type="text/javascript"> //<!-- //<![cdata[ first = 1; ...