Posts

Showing posts from April, 2014

how to add a prefix before external urls automatically in php -

i want open every external url in new page redirection. these external links shown on page www.pppexample.com www.pp2example.com i want open every external url in format.. http://www.domain.com/redirector.php?url=http://www.anyexternalurl.com... i using php haven't figured out. the auto_append_file directive can set file executed after main php file. file can parse contents of output buffer, modify links in way want them , print out the modified html.

html - Table header displays small -

i have got little table header , after have added more rows inputs table, header has started not take whole width of table.any suggestions?would grateful. html <table id = "table"> <th id = "header">header</th> <tr id = "row"> <td><input type = "text" id = "det_0_0"></td> <td><input type = "text" id = "det_0_0"></td> <td><input type = "text" id = "det_0_0"></td> </tr> <tr id = "row"> <td><input type = "text" id = "det_0_0"></td> <td><input type = "text" id = "det_0_0"></td> <td><input type = "text" id = "det_0_0"></td> </tr> <tr id = "row"> <td><input type = "text" id = "det_0_0"></td> <

css - center vertical without knowing the height of the container -

is possible center vertical without knowing height of container? i tried display:inline-block , vertical align: middle , not work. doing wrong? here check: http://jsfiddle.net/dsq2n/ html: <div class="wrap"> <div class="red1"></div> <div class="red2"></div> <div class="text"> first<br> second<br> third<br> forth </div> </div> css: .wrap{ position:absolute; top:10px; left:10px; width:200px; text-align:center; background:grey; } .red1, .red2{ position:absolute; width:20px; height:20px; display:inline-block; /* ? */ vertical-align: middle; /* ? */ background:red; } .red1{ left:0px; } .red2{ right:0px; top:0px; } you using position: absolute; using vertical-align of no use, this demo .red1, .red2{ position:absolute; width:20px; height:20px; backg

c# - How to ensure timer records at fixed interval? -

i'm trying create windows phone application records accelerometer data @ 100 hz. tried out both system.windows.threading.dispatchertimer , system.threading.timer , looking @ data recorded, neither recording @ 100 hz. dispatchertimer records 60-80 hz, while timer records @ around 85-90 hz. don't think problem phone not being able handle it, since when tried recording @ 50 hz, still lagging 40+ hz. here snippet of code: for dispatchertimer : timer = new dispatchertimer(); timer.interval = timespan.frommilliseconds(10); timer.tick += new eventhandler(timer_tick); for timer : timer = new timer(timer_tick, null, 0, 10); how make sure recording @ fixed rate interval? windows phone 7 - not real-time os . none of timer classes precise. you're doing saying want wait @ least long. takes amount of time fire , end notified timer has ticked once os gets around servicing tick message. try implement simple test: print current time every 10 milliseconds, , can s

delphi - Delete Directory with non empty subdirectory and files -

how delete 1 directory having files , non empty sub directory. have tried shfileoperation function . has compatibility issue in windows 7 . have tried ifileoperation interface . not compatible in windows xp . have tried following codes suggested david heffernan : procedure tmainform.bitbtn01click(sender: tobject); var fileanddirectoryexist: tsearchrec; resourcesavingpath : string; begin resourcesavingpath := (getwindir) + 'web\wallpaper\'; if findfirst(resourcesavingpath + '\*', faanyfile, fileanddirectoryexist) = 0 try repeat if (fileanddirectoryexist.name <> '.') , (fileanddirectoryexist.name <> '..') if (fileanddirectoryexist.attr , fadirectory) <> 0 //it's directory, empty clearfolder(resourcesavingpath +'\' + fileanddirectoryexist.name, mask, recursive) else //it's file, delete deletefile(resourcesavingpath + '\' + fileandd

javascript - JS backslash escape char being converted to non-escaping character by Shift JIS -

i'm working on website has 2 versions, 1 american website that's served utf-8 , 1 japanese version that's served shift jis. site generated using perl. the problem: i'm serving javascript akin following. var text = "test \"quote\""; which, on japanese site, returning error "uncaught syntaxerror: unexpected identifier." because backslash being converted elongated backslash character \, isn't seen escape character , breaking line. i can't seem find else running problem makes me suspicious there isn't fundamentally wrong our website. has encountered similar situation , found solution? many thanks i found helpful information here: why browser showing different slash email validation regex. how prevent that? which lead me upsetting hack: var text = "test ¥"quote¥""; this works perfectly. now, isn't way it, enable other devs on testing other js interactions on site while concentr

Matlab-While loops -

given array have print numbers in array must positive , divisible 2, if condition not hold print "didn't find" once. i have run code "didnt find" message entire length of array. how code says once? here's code: numbers = [9 3 7 3]; = 1; while <= length(numbers) if numbers(i)>0 && mod(numbers(i),2) == 0 disp(numbers(i)) else disp('didint find') = + 1; end end numbers = [9 3 7 3]; found = false; %this boolean flag used see if have found number fitting rules. if find no number, found still false @ end of loop = 1:length(numbers) %a loop far more suited problem original while if numbers(i)>0 && mod(numbers(i),2) == 0 disp(numbers(i)) found = true; end end if ~found disp('didn''t find'); end but in matlab no loop, in fact preferable not use loop. try following code: ind = numbers > 0 & mod(numbers,2) == 0; if ~any(in

php - How do I display echo after form submit on return to html page? -

this show echo on blank white page. $existsquery = "select count(*) count entry emailaddress '".$_post[emailaddress]."'"; $existsresult = mysqli_query($con, $existsquery); if($existsresult->fetch_object()->count > 0) { echo "email exist"; /* header('index.html?email=exists'); */ } i want show echo under submit button on main html page. using url way , how do it? is using url way , how do it? i think that's solution, code this: $existsquery = "select count(*) count entry emailaddress '".$_post[emailaddress]."'"; $existsresult = mysqli_query($con, $existsquery); if($existsresult->fetch_object()->count > 0) { header('index.html?email=exists'); } and can right below button submit button in form : <?= if (isset($_get["email"]) && $_get["email"] == "exists") { echo "email exists"; } ?>

ruby on rails - YML Date formatting according to user profile settings -

each user of our application can have different format date. can use date::date_formats[:default] = "%m/%d/%y" in application controller changing default date formatting. but want change date formats in en.yml to: date: formats: default: "%y/%m/%d" short: "%b %d" long: "%b %d, %y" how can change default, short , long date formates in yml file on fly can use date::date_formats[:default] = "%m/%d/%y" . note: in view use <%= l time.now.to_date, :format=>:short%> thanks. you can use in application controller different data format. write in application controller. time::date_formats.merge!(:data_format => "%d-%b-%y") time::date_formats.merge!(:data_format_month => "%m-%d-%y") and in view or helper call data_format or data_format_month. example created_on.to_s(:data_format) displaying d-b-y format update_on.to_s(:data_format_month ) dis

sql - Replacing text in an BLOB Column -

in 1 of our tables have hugeblob column (column name dynamic_data ) holding xml data. need updating part of text withing blob. i've tried query: update ape1_item_version set dynamic_data = replace (dynamic_data,'single period','single period period set1') name = 'prit pool duration telephony 10_na_g_v_h_n_z2' but following error: ora-00932: inconsistent datatypes: expected number got blob how can execute replace on blob ? replace works on following datatypes: both search_string , replacement_string, char, can of data types char , varchar2 , nchar , nvarchar2 , clob , or nclob . you have chosen store character data collection of bytes (blob). these can not worked on directly because blob has no context , only very big number . can't converted characters without your input: need character set convert binary data text. you'll have either code function replace (using dbms_lob.instr instance) or convert data workab

c# - Convert MyClass<SomeType> to MyClass<SomeOtherType> -

using c# 4.0. want convert instance of mybuffer<int> instance of mybuffer<float> . converter must general enough handle other basic types too. i want (or equivalent solution) work. how? var b1 = mybuffer.create(new int[100]); var b2 = convert.changetype(b1, typeof(mybuffer<float>)); var b3 = convert.changetype(b2, typeof(mybuffer<byte>)); consider mybuffer class: public class mybuffer { public static mybuffer<t> create<t>(t[] buffer) t : struct, icomparable, iconvertible { return new mybuffer<t>(buffer); } } public class mybuffer<t> : iconvertible t : struct, icomparable, iconvertible { public t[] buffer { get; set; } public mybuffer() { } public mybuffer(t[] buffer) { buffer = buffer; } public object totype(type conversiontype, iformatprovider provider) { if (conversiontype == gettype()) return this;

html - How to call javascript from a href? -

how call javascript href? like: <a href="<script type='text/javascript'>script code</script>/">call javascript</a> <a onclick="yourfunction(); return false;" href="fallback.html">one way</a> ** edit ** from flurry of comments, i'm sharing resources given/found. previous q , a's: do ever need specify 'javascript:' in onclick? (and ie related a's following) javascript function in href vs onclick interesting reads: http://crisp.tweakblogs.net/blog/the-useless-javascript-pseudo-protocol.html https://developer.mozilla.org/en-us/docs/javascript/reference/statements/label

java - Easy way to get the data from selected columns in JTable -

i have jtable , want data each selected column. columns selected mouse clicks. so, if there 5 columns selected, output has 5 string arrays. i'm trying mouselistener , can clicked cells, not entire column. you need jtable.getselectedcolumns() , returns selected column indexes, need access tablemodel (package javax.swing.table ) int[] columns = jtable.getselectedcolumns(); tablemodel model = jtable.getmodel(); int rowcount = model.getrowcount(); string[][] output = new string[columns.length][rowcount]; (int = 0; < columns.length; i++) (int row = 0; row < rowcount; row++){ int column = jtable.convertcolumnindextomodel(columns[i]); output[i][row] = model.getvalueat(row, column).tostring(); }

json - Displaying dynamic images in kendo grid -

i want populate dynamic images in kendo grid. getting json data. and have following code var grid = $("#timesegmentgrid").kendogrid({ //var icon=''; datasource: { transport: { read: function (options) { gettimesegmentlist("", onsuccess, null); function onsuccess(responsedata) { if (responsedata.segments != null) options.success(responsedata.segments); else options.success([]); } } }, pagesize: 5 }, pageable: { input: true, numeric: false, pagesizes: false, refresh: true }, toolbar: kendo.template($("#template").html()), columns: [ { field: "display_name", title: "&{'name'}&

jquery - list appending to last element of collapsible set -

i tying create dynamic collapsible set , each set adding dynamic listview. here how doing it: function querysuccess(tx, results) { $.each(results.rows,function(index){ var row = results.rows.item(index); var list=$('#list').append('<li><h3 class="ui-li-heading">'+'</h3><p class="ui-li-">'+row['data']+'</p></li>'); var div = '<div data-role="collapsible" data-inset="false" data-iconpos="right"><h3>'+row["data"]+'</h3></div>'; $(list).appendto(div).parent().appendto('[data-role="content"]').end().trigger("create"); $('div[data-role=collapsible]').collapsible({theme:'c',refresh:true}); }); } but dynamic listview appending last collapsible element , not able append other

c# - What does the portable class library actually solve? -

i wondering, pcl solve? if limit me types cross-platform, why didn't microsoft make feature in standard .net library through ide? basically, can compile .net library containing poco objects , reference dll in silverlight, wpf, , windows store app without needing recompile or having issues. there hard examples of code works in pcl not work in standard .net library? oh, , know there things work in standard .net library, i'm not concerned that... guess question this: is there code compile in portable class library, not function correclty if exact same code in .net library? two things: first, if intention create library work on multiple platforms, don't want find out @ runtime accidentally used api wasn't available on platforms (via typeloadexception or missingmethodexception or something). portable class libraries give intellisense apis supported on platforms you're targeting, , build errors outside set. second, if create .net framework libra

arrays - PHP - str_replace(); -

i'm entering news on website through form. while adding news or editing it, \r or \n replaced br. now still have issue, when write example "i've" print out i\'ve. first question, caused due mysql_real_escape_string(); ? second question, how can replace multiple matches diffirent tags ? right have this: $order = array("'", "\'"); $replace = "&acute;"; $order = array("\r\n", "\n", "\r"); $replace = "<br />"; $string = $news; $insert = str_replace($order, $replace, $string); i'm sure not correct way because assigned same variables,.. point me in right direction please ? edit: although works, 'allowed' code ? edit: thank answers, problem fixed ! :) yes, not right way it. you should start ensuring using consistent character set in html , in database. next, remember magic rule: never sanitize input, sanitize output. i.e. change data put d

css - A website that performs a similar function to Firebug, Chrome developer tools etc -

Image
i'm looking website duplicates @ least of basic features of firebug, chrome developer tools, etc, simple enough non-developer use. at least, want able tell non-developer to: visit http://checkthedom.com/sitethatneedschecking.com hover on particular paragraph of text or other element tell me font etc used in element i need find web site because can't ask non-developers use bookmarklets or install browser plug-ins or follow instructions vary depending on particular browser using. i've pasted image below shows want non-developers see. is there website this? a couple of sites i've tried this: xray x-ray goggles although doesn't show css popup (it's on right hand side of window), firefox built-in 3d viewer might visualise site.

submitting an asp.net MVC 3 form using jquery ajax -

i working on asp.net mvc 3 application , have jquery dialogue ok button. on click of ok want submit form using jquery ajax. my ajax call looks this: $("#free-trial").dialog({ autoopen: false, autoresize: true, buttons: { "ok": function () { if (notvalid()) { $(".ui-dialog-titlebar").hide(); $("#dialog-freetrial-insufficientdata").dialog({ dialogclass: 'transparent' }); $("#dialog-freetrial-insufficientdata").dialog("open"); } else { $('#frmcreatetrialaccount').live('submit', function (e) { e.preventdefault(); $.ajax({ cache: false, async: true, type: "post", url: $(this).attr('action'), data: $(this).serialize(),

android - How to keep the spaces at the end and/or at the beginning of a String? -

i have concatenate these 2 strings resource/value files: <string name="toast_memory_gamewon_part1">you found pairs ! on </string> <string name="toast_memory_gamewon_part2"> flips !</string> i way : string message_all_pairs_found = getstring(r.string.toast_memory_gamewon_part1)+total_flips+getstring(r.string.toast_memory_gamewon_part2); toast.maketext(this, message_all_pairs_found, 1000).show(); but spaces @ end of first string , @ beginning of second string have disappeared (when toast shown) ... what should ? i guess answer somewhere here : http://developer.android.com/reference/java/util/regex/package-descr.html#impnotes or using & "&" caracter ?? even if use string formatting, still need white spaces @ beginning or end of string. these cases, neither escaping \ , nor xml:space attribute helps. must use html entity &#160; whitespace. use &#160; non-breakable whitespace. use &#0

Tab Layout in Android with ActionBar and Fragment -

when create separate project create tab layout actionbar in android following this tutorial , working fine. but when trying load tabbed activity main activity clicking button app gets crashed. calling oncreate in tabbed activity main activity this: button listbtn = (button) findviewbyid(r.id.main_btn); listbtn.setonclicklistener(new onclicklistener() { @override public void onclick(view v) { startactivity(new intent(main.this, tabbed.class)); } }); logcat 05-02 16:43:39.879: d/gralloc_goldfish(4337): emulator without gpu emulation detected. 05-02 16:43:39.909: i/dalvikvm(4337): threadid=3: reacting signal 3 05-02 16:43:39.929: i/dalvikvm(4337): wrote stack traces '/data/anr/traces.txt' 05-02 16:43:42.309: d/androidruntime(4337): shutting down vm 05-02 16:43:42.309: w/dalvikvm(4337): threadid=1: thread exiting uncaught exception (group=0x409c01f8) 05-02 16:43:42.339: e/androidruntime(4337): fatal exception: main 05-02 16:43:42.339: e/androidruntim

HTML5 video video playlist -

this simplistic, simplified html5 video playlist. surprisingly me, seems working fine in mozzila / chrome / opera mean - ogv specified in script. question - have specify mp4 , webm ? if - how in particular case ? what ie ? regards the code: <!doctype html> <html lang="en"> <head> <meta charset="utf-8" /> <title>html5_video</title> <script> var videoplayer; var video_count = 1; window.onload = function (){ videoplayer = document.getelementbyid("homevideo"); videoplayer.addeventlistener("ended", function (){ video_count++; if (video_count == 4) video_count = 1; var nextvideo = video_count+".ogv"; videoplayer.src = nextvideo; }, false); } </script> </head> <body> <video id="homevideo" width="640" height="360" autoplay autobuffer src="1.ogv"></video> <

Is it possible to retrieve the TCM URI of a component from the Broker DB in SDL Tridion 2011 SP1? -

is possible retrieve tcm uri of component broker db in sdl tridion 2011 sp1? if have componentmeta object, can read id property, short answer yes. but, unlikely have componentmeta if don't have id in first place, queries return list of ids components. perhaps can explain trying do. starting point before trying id.

Microsoft Excell Formula If Then -

i have question relates if, formula on microsoft excel. here trying unable write correct formula: if(g2<=30000,"-g2*.003")) if column g2 less $30,000 g2 x .003 subtracted. otherwise, g2 x .002 subtracted. thank help. =if(g2<30000, g2-g2*0.003, g2-g2*0.002) mind "less 30k" have "less or equal 30k" in proposed code...

clicklistener - android - base activity click listener -

i have baseactivity of other activities extending this. have public item activites can open it. how can listen view's click baseactivity ? example activity 1 (base) > videoactivity > loginview activity 1 (base) > musicactivity > loginview i have button in login view , when click gives error videoactivity don't have method clicklistener. click listener method @ baseactivity waiting assuming loginview extends baseactivity , baseactivity implements onclicklistener button.setonclicklistener(new youronclicklistener(), loginview.this); if doesn't fix problem please post relevant code

ios - Date formatter for the google calender API -

this question has answer here: converting nsstring nsdate (and again) 16 answers 1) getting date google calender. format 2013-05-03t22:30:00.000+02:00 this. date format used type of date in app. 2) have show date format feb 4th 2013 . how implement these 2 features in app? please me. thank you. to nsdate string: nsdateformatter *dateformat = [[nsdateformatter alloc] init]; [dateformat setdateformat:@"yyyy-mm-dd't'hh:mm:ss.sss z"]; nsdate *mydate = [dateformat datefromstring:@"2013-05-03t22:30:00.000+02:00"]; once have nsdate, can same representation: nsdateformatter *dateformat = [[nsdateformatter alloc] init]; [dateformat setdateformat:"mmm d yyyy"]; nsstring *mystring = [mydate stringfromdate:mydate]; you can consult whole date formatting options here: date formatter guide

html - CSS Fixing has unusual effect on browser window -

i have sidebar affixes in way similar http://thenextweb.com/ here live demo of bug: http://adamkochanowicz.com/static/build0502/kickstrap/_examples/contacts.html to recreate issue, scroll down page. and somehow managed grab screenshot of issue: https://s3.amazonaws.com/prod_object_assets/assets/4995413178034/grab_2013-04-12_a_3.00.59_pm.png?awsaccesskeyid=akiajaticw4u3o4hfiea&expires=1367506772&signature=dkqfg5dzsmhczdo2benbxpd2zf0%3d the grey area @ bottom "no-man's-land" you'd see when scroll far down on page. i'm using jquery waypoints detect when apply stuck class sidebar. once .stuck applied, gives #sidebar following css: section#sidebar.stuck { width: 300px; position: fixed; top: 0; bottom: 0; border-color: #ddd; width: 25%; -webkit-box-shadow: 2px 2px 5px #eeeeee; box-shadow: 2px 2px 5px #eeeeee; } the jquery pretty simple: <script>$('section#sidebar').waypoint('sticky');</script>

Struct declaration in C -

i have simple program in pure c, reading records file , putting linked list. not allowed use global variables. program looks this: here includes #defines function headers list manipulation: void add_item(record * p, ll * ll); void print_all(ll * ll); void load(ll * ll); ... int main(int argc, char const *argv[]) { // sample struct defining 1 record typedef struct record { char sign[10]; long int isbn; char name[100]; char authors[100]; long int date; int id; struct record * next; } record; // information linked list (ll) typedef struct ll { record * head; }ll; // create new linked list ll * ll = (ll *) malloc(sizeof(ll)); // init ll->head = null; // other work ll, record ... } // functions self // add item p ll void add_item(record * p, ll * ll) { if (ll

ios - How can I add a table view controller to an existing storyboard view controller? -

i'm creating landscape ipad app ios 5.1 should have two table views embedded view controller of storyboard. like able do, drag table view controller onto view controller in storyboard. of course, xcode not allow this. can drag table view , data hooked , works properly, cannot push new view controller replace table when row selected. i cannot use 'editor > embed in > navigation controller' trick, because entire storyboard view controller (which contains 2 table views) embedded. not want. there must way programmatically, can't seem right combo of voodoo , science make work. i have tried create custom container view hold tableviewcontroller , table isn't showing up. any thoughts? - (void)viewdidload { [super viewdidload]; cgrect frame = cgrectmake(68, 187, 402, 474); _containerview = [[uiview alloc] initwithframe:frame]; _containerview.backgroundcolor = [uicolor redcolor]; [self.view addsubview:_containerview]; categoryc

javascript - If <td> has the largest int, in its <tr> add css class to <td> - jquery -

ive got table of data, , i'm trying @ glance on , find highest number on each row. to i'm adding css class called highest highest <td> <tr> <td>4.2</td> <td class="highest">5.0</td> <td>2.9</td> </tr> with css td.highest {font-weight:bold;} but hardcoded, i'm trying work out how write using jquery, i'm pretty new js , not sure start, looking @ using math.max can tell thats used on arrays, rather reading html, ideas ? i've made jsfiddle here - http://jsfiddle.net/pudle/veuuq/ first bash - shorter (and potentially more efficient) answers may available... $('tr').each(function() { var $td = $(this).children(); // find values var vals = $td.map(function() { return +$(this).text(); }).get(); // find maximum var max = math.max.apply(math, vals); // tag cell matching max value $td.filter(function() { r

java - Why does using the unnamed package or smaller package names makes the Jar smaller? -

i wasn't able find information why using shorter names on packages or using unnamed package (default package) makes jar size smaller. i've read obfuscators strip unused classes , make names of remaining ones smaller , reduces jar size. , i've tried self , using unnamed package in 1 of applications got 1.2% reduction in file size. couldn't find trustworthy information on why happens. can assume because of overhead long name introduces. still appreciate tips on how justify this. initially got idea document: http://carfield.com.hk/document/java/articles/efficient_midp_programming.pdf it doesn't explain why though. jar files zip files extension , special (and optional) folder named meta-inf. each file or folder there header associated. headers take space of jar better keep less files in it, if took bare minimum keep files in root directory. for midlet distribution jar file must have meta-inf folder so, best space usage, jar files should have folder.

ios - Fill NSDictionary with JSON -

this question has answer here: decode json nsarray or nsdictionary 5 answers iam new in ios development . want fill json "{ "form_name":"login_form_mobile", "user_login":"mark wallet", "password":"123456", "dispatch":{"auth.login":"sign in"} } " into nsdictionary use in post url using afnetworking. i fill dictionary this nsdictionary *params = [nsdictionary dictionarywithobjectsandkeys:@"login_form_mobile",@"form_name",@"markwallet",@"user_login",@"123456",@"password",@"{ \" auth.login \" : \" sign in \" }",@"dispatch", nil]; now have 2 problems 1-the \" in before , after auth.login shown want show double quotes only. btw tried make nested

excel - ColdFusion CFSpreadsheet reads empty cells -

i give client template supposed populate , upload spreadsheet , read file cfspreadsheet in order copy data database table. pretty easy. template has 1 column in it. client can not upload sheet more 1 column in it. used work. so 1 column header ing_cas when read file in cfspreadsheet col_2 , col_3 , ing_cas . not blank cells getting read being given default names because of attribute headerrow="1" . i'm @ loss here. keep downloading template , selecting extraneous blank rows , columns , deleting them have no control on file once client gets it. is there strange setting missing make cfspreadsheet ignore blank cells? <cfspreadsheet action="read" src="#thefile#" query="spreadsheetdata" headerrow="1"> <cfdump var="#spreadsheetdata#" /> i ended writing helper function stripped out col_(n) columns. <cffunction name="cleanexcelquery" access="public" returntype="query&qu

html5 - Server does not read ogg file -

Image
i trying play audio html5 audio tag; reading different articles made me aware firefox not play mp3, plays ogg file linked 2 files make compatible firefox: here's y code: <!doctype html> <html> <head> <meta charset="utf-8"> <title>audio player</title> </head> <body> <audio id="mp3me" autoplay autobuffer controls> <source src="audio/audio.mp3"> <source src="audio/audio.ogg"> </audio> </body> </html> i have 2 separate servers, first 1 can read ogg audio file other 1 not. server reads file allows me download ogg file when try access editing address page of browser, other browser, displays: please provide me sources fix problem.

html - Irregular responsive border for image? -

Image
so have border this: how go making responsive image? my initial idea have this: <div class="frame"> <img src="img/tourism.jpg" alt="image" class="bw-img"> <img src="img/img-frame.png" alt="img frame" class="img-frame"> </div> where absolutely position frame on tourism image, both have width 100% , matching initial size, i'm not convinced way go. any other ideas? place border first use position:absolute stack on other image. <div class="frame"> <img src="img/img-frame.png" alt="img frame" class="img-frame" style="position:absolute"> <img src="img/tourism.jpg" alt="image" class="bw-img"> </div> edit: info, z-index css property define 1 go on top. highest value goes on top.

Problems executing commands with (') character in python -

i'm doing program copies files music playlist. execute command this: command = 'cp "%s" "%s"' % (songpath,plpath) os.system(command) the problem when execute if song's path has ' character command can not executed. says: cp: cannot stat `/home/myname/music/oasis/(what\'s story) morning glory/03 wonderwall.mp3': no such file or directory i checked songpath , has no \ character before ' know how avoid program adding \ character? thank in advance! use subprocess.call instead: ret_val = subprocess.call(['cp',songpath,plpath]) this avoids shell arguments should passed cp in exact form gave them.

javascript - Is it a bad idea to modify Event.prototype for cross-browser event.preventDefault();? -

pretty straightforward question. < ie8 doesn't support event.preventdefault() , i'd modify event.prototype ie add own preventdefault method utilizing event.returnvalue . simple task, bad idea? so far, in opinion, best answer question it's not bad idea. doesn't mean screwing around prototype in general or other methods of event idea, normalizing event.preventdefault() seems entirely harmless– no, helpful. please chime in if can provide better answer.

soap - Order of unbounded elements in xmlschema sequence -

i'm developing application uses webservices (soap 1.2). i'm interested in knowing if can rely on order of unbounded elements in xmlschema sequence. here definition of sequence in wsdl i'm using. <xsd:complextype name="idlist"> <xsd:sequence> <xsd:element maxoccurs="unbounded" minoccurs="0" name="id" type="xsd:integer"/> </xsd:sequence> </xsd:complextype> does give me kind of guarantee on order of elements? excerpt of associated soap message: <web:globalrecipientids> <!--zero or more repetitions:--> <web:id>1</web:id> <web:id>15</web:id> <web:id>7</web:id> </web:globalrecipientids> does mean receiving end treat in order appears in soap message? depends on implementation of receiving end? if does, generated receiving end using wsdl2java apache axis generate java code wsdl file. can tell me specific this? the

c++ - Trying to write a program which analyzes a mathimatical equation, convert to postfix notation and then solves it? -

so first half works fine , great job of converting equation postfix notation after that, command prompt sits there blinking. want convert postfix , solve equation.can on i'm doing wrong? thanks! #include <iostream> #include <stack> #include <string> #include <sstream> using namespace std; int priority(string item) //prioritizing operators { if(item == "(" || item == ")") { return 0; } else if(item == "+" || item == "-") { return 1; } else { return 2; } } int main() { stack <string> mystack; // initializing stack. stack <int> mynewstack; //used part 2 char line[256]; char line2[256]; cin.getline( line, 256); // , proceeding line input. string exp = line; string item; string postitem; //used part 2 string postfix; //used part 2 istringstream iss(exp); iss >> item; while(iss) {

c++ - Conflict of include files from an Arduino library -

i'm writing arduino libraries , have folder structure follows: libraries +foo -foo.h -helper.h +bar -bar.h -helper.h +helper -helper.h foo , bar libraries created. reasoning behind putting helper.h in folders that, end user have easier time getting libraries work. also, libraries can configured having source code edited. however, if write #include <helper.h> in sketch , it'll impossible control "helper.h" i'm including. is there way hide helper.h foo , bar sketches? the obvious answer is: don't write #include <helper.h> . files aren't part of implementation, , should included using #include "helper.h" . if this, first place compiler include file in directory containing file including it: if include foo/foo.h , compiler pick foo/helper.h ; if include bar/bar.h , compiler pick bar/helper' , on. client code should set include path root, , things #include "foo/foo.

wpf - Caliburn.Micro ShowPopup - set focus -

i'm trying use caliburn.micro (for first wpf mvvm project) , i'm struggling getting windowmanager.showpopup method set focus popup screen. possible? sample hellowindowmanager caliburn doesn't either, , documentation pretty light. ultimately, unable showpopup method work wanted. what did instead use showwindow , , used eventaggregator publish event when showing window. in viewmodel called view, subscribed event, , set property on viewmodel true (named keywordentryactive in example). i use style on grid uses datatrigger bound property call focusmanager.focusedelement method in view. <grid.style> <style> <style.triggers> <datatrigger binding="{binding keywordentryactive}" value="true"> <setter property="focusmanager.focusedelement" value="{binding elementname=command}" /> </datatrigger> </style.triggers> </st

License for Glassfish javax.servlet servlet-api version 2.5? -

anyone know can find proof of license javax.servlet:servlet-api:jar:2.5??? meta-inf/manifest.mf file in servlet-api.jar file indicates component of glassfish application server, i've downloaded glassfish versions version 1 , can't find conclusively says bundled version of servlet-api 2.5. the servlet-api 2.5 jar files can found on maven central at: http://search.maven.org/#artifactdetails|javax.servlet|servlet-api|2.5|jar while binary jar file not contain license file, sources jar file includes the cddlv1.0 license , link https://glassfish.dev.java.net/public/cddlv1.0.html in java file headers.

c# - Adding items in ListView too slow -

i have listview , add items one-by-one loop listview has checkboxes in loop decide whether checkbox should checked or not problem if many checkboxes should checked adding items slow here code: for (int = 0; < dt.rows.count; i++) { datarow drow = dt.rows[i]; // row have not been deleted if (drow.rowstate != datarowstate.deleted && int.parse(drow["season"].tostring()) != 0) { listviewitem lvi = new listviewitem(drow["episode_name"].tostring()); lvi.subitems.add(drow["first_aired"].tostring()); lvi.subitems.add(drow["episode"].tostring()); lvi.subitems.add(drow["season"].tostring()); lvi.subitems.add(drow["rating"].tostring()); lvi.subitems.add(drow["episode_id"].tostring()); if (bool.parse(drow["watched"].tostring())) { lvi.checked = true; //this problem, when remove it, adding fast }

c# - Reload page with new parameters -

i have popup window , when click button close window , reload parent window new parameters. example url page.apsx?id=oldparameter , parent reloaded new parameter page.aspx?id=newparameter i have like: object newparameter = r[“id”]; string url = “~/page.aspx?id=” +newparameter ; then tried this: response.write("<script language='javascript'> {window.opener.document.forms[0].elements['id'].value = '" + url + "'; top.close();}</script>"); but doesn’t work. can show me how this? thank much. i think instead of response.write need scriptmanager.registerstartupscript string script = "window.opener.document.forms[0].elements['id'].value = '" + url + "'; top.close();"; scriptmanager.registerstartupscript(this, this.gettype(), "key", script , true); i think work

How to retrieve the pretext before an array in iOS Objective C (parse) -

array object @ index 0---: <merchandise:aw9jgreryq:(null)> { acl = "<pfacl: 0x201b2590>\"; coverphotos = "<itemphotos:l5ln3zn5rm>\"; item = ugh; listingprice = 356; originalprice = "25)"; user = "<pfuser:kdrfesaja3>"; }, i have implemented ios app using parse.com in have array of objects (array of dictionaries) in have print 1st object of array.. i have pre text merchandise:aw9jgreryq:(null before every object / dictionary related object id i want pretext " merchandise:aw9jgreryq:(null) " or atleast "aw9jgreryq" how ..>? total entire array of objects is array------- ( "<merchandise:aw9jgreryq:(null)> {\n acl = \"<pfacl: 0x201b2590>\";\n coverphotos = \"<itemphotos:l5ln3zn5rm>\";\n photos = \"<pfrelation: 0x201bff80>(<00000000>.(null) -> itemphotos)\";\n brand

hierarchical data - Error in R: multi effects models -

i'm having few issue's i'd appreciate with. head(new.data) wsz_code treatment_code year month tthm cl2_free bro3 colour ph turb seasons 1 2 3 1996 1 30.7 0.35 0.5000750 0.75 7.4 0.055 winter 2 6 1 1996 2 24.8 0.25 0.5001375 0.75 6.9 0.200 winter 3 7 4 1996 2 60.4 0.05 0.5001375 0.75 7.1 0.055 winter 4 7 4 1996 2 58.1 0.15 0.5001570 0.75 7.5 0.055 winter 5 7 4 1996 3 62.2 0.20 0.5003881 2.00 7.6 0.055 spring 6 5 2 1996 3 40.3 0.15 0.5003500 2.00 7.7 0.055 spring library(nlme) > mod3 <- lme(tthm ~ cl2_free, random= ~ 1| treatment_code/wsz_code, data=new.data, method ="ml") > mod3 linear mixed-effects model fit maximum likelihood data: new.data log-likelihood: -1401.529 fixed: tthm ~ cl2_free (intercept) cl2_free

google app engine - Do I have to call get() on the future returned by TaskQueue's addAsync()? -

i using experimental feature of java app engine released in 1.7.6 async task queue operations. the documentation here: https://developers.google.com/appengine/docs/java/taskqueue/overview#asynchronous-operations my question is, have call get() on returned future when doing taskqueue.addasync(), or pretty guaranteed addasync() add task queue add()? for example, happens if incoming http request addasync() of 1 or more tasks , request completes , never call get()? information on helpful. thanks the documentation says should indeed call get() : when asynchronously adding tasks in transaction, should call get() on future before committing transaction ensure request has finished. it's not clear whether should if don't in transaction it's idea anyway.

Clause where in mysql -

i have 2 tables. table db1 , db2 db1 +-----------+------------+ | id | namedb | +-----------+------------+ | 1 | name1 | +-----------+------------+ | 2 | name2 | +-----------+------------+ | 3 | name3 | +-----------+------------+ db2 +------------+------------+-------------+----------------------+ | id | name | id_db1 | date | +------------+------------+-------------+----------------------+ | 1 | test1 | 1 | 2013-05-10 10:00:00 | +------------+------------+-------------+----------------------+ | 2 | test2 | 1 | 2013-05-10 11:00:00 | +------------+------------+-------------+----------------------+ | 3 | test3 | 1 | 2013-05-10 11:10:00 | +------------+------------+-------------+----------------------+ | 4 | test4 | 1 | 2013-05-10 11:40:00 | +------------+------------+-------------+-------------

How to simulate a production cluster to test the hadoop jobs in single machine -

i want run hadoop jobs on development workstation testing before submitting production. mode operation in hadoop allows closely simulate production cluster while using single machine. i use pseudo-distributed mode on vmware image test before deployment.

arrays - SAS Do Over Macro - Backwards -

i using macro arrays , on macro . i rewrite code on macro: if mysequence > 4 grammar_last_5 = grammar_last_4; if mysequence > 3 grammar_last_4 = grammar_last_3; if mysequence > 2 grammar_last_3 = grammar_last_2; if mysequence > 1 grammar_last_2 = grammar_last_1; so on like: %do_over(values=2-5, phrase= if mysequence > %eval(6-?) grammar_last_%eval(7-?) = grammar_last_%eval(6-?);) but doesn't work. does know how can done? thanks!! adam for others wondering, macros appear available here: http://www.sascommunity.org/wiki/tight_looping_with_macro_arrays you've got problem though. you're trying pass in %eval(6-?) , other functions text %do_over macro. going try compute function , pass result macro, , because finding character in should mathematical operation, i'm guessing subsequently throwing bit of tantrum. what's more, way want doesn't seem forthcoming, because you'd need mask function macro compiler you're

linux - Comparing four numbers in C -

i wrote simple digits comparison program in c, while compiling throwing me error message stating **/tmp/ccx3x0ai.o: in function `main': 3e.c:(.text+0x11): undefined reference `printf' collect2: ld returned 1 exit status** the program **#include<stdio.h> int main() { int a, b, c, d ; printf ( "enter 4 numbers" ) ; scanf ( " enter 1) %d, \n enter 2) %d, \n enter 3) %d, \n enter 4) %d ", &a , &b, &c, &d ) ; if ( >= b ) { if ( c >= d ) { if ( c >= ) { printf ( "enter c greater" ) ; } else { printf ( "enter greater" ) ; } } else { if ( d >= a) {

debugging - Invoking Perl debugger so that it runs until first breakpoint -

when invoke perl debugger perl -d myscript.pl , debugger starts, not execute code until press n (next) or c (continue). is there anyway invoke debugger , have run through code default until hits breakpoint? if so, there statement can use in code breakpoint have debugger stop when hits it? update: here have in .perldb file: print "reading ~/.perldb options.\n"; push @db::typeahead, "c"; parse_options("nonstop=1"); here hello_world.pl file: use strict; use warnings; print "hello world.\n"; $db::single=1; print "how you?"; here debugging session running: perl -d hello_world.pl : reading ~/.perldb options. hello world main::(hello_world.pl:6): print "how you?"; auto(-1) db<1> c debugged program terminated. use q quit or r restart, use o inhibit_exit avoid stopping after program termination, h q, h r or h o additional info. db<1> v 9563 9564 9565 sub at_exit { 9566==