Posts

Showing posts from April, 2014

performance - Profiling ASP.net applications over the long term? -

Image
what accepted way instrument web-site record execution statistics? how long takes x for example, want know how long takes perform operation, e.g. validating user's credentials active directory server: authenticated = checkcredentials(login1.username, login1.password); a lot of people suggest using tracing , of various kinds, output, or log, or record, interesting performance metrics: var sw = new system.diagnostics.stopwatch(); sw.start(); authenticated = checkcredentials(login1.username, login1.password); sw.stop(); //write number log writetolog("timetocheckcredentials", sw.elapsedticks); not x; x the problem i'm not interested in how long took validate user's credentials against active directory. i'm interested in how long took validate thousands of user's credentials in activedirectory: var sw = new system.diagnostics.stopwatch(); sw.start(); authenticated = checkcredentials(login1.username, login1.password); sw.stop(); timetocheck...

ios - Reorder EKReminder in a list -

is possible reorder ekreminders in ekcalendar of type reminders? in native reminders app possible, can't seem find option in api. so, ekcalendaritem objects have calendaritemexternalidentifier unique event across devices. can use advantage ordering strategy. every time fetch events calendar api, keep track of calendaritemexternalidentifier in whatever persistence store choose (core data, sqlite, property lists, etc...) , keep track of it's order. so if used core data might have entity 2 attributes, calendaritemexternalidentifier , order . whenever present events user, query persistent store order of each event , display accordingly. if new events come in, find highest order , increment there. when user re-orders, set order key appropriate record in persistent store.

caching - 2-level cache implementation in Java -

i'm working on 2-level cache implementation in java studying purpose. have 2 levels: ram first , fs second. chose lru strategy implementation , "write-back" policy between 2 levels. please clarify: is possible make objects stored in 2nd level (file system) up-to-date in case when object changes internal state? normal practise 2-level cache? how can write object (serialize) file in binary form if know object object object type? possible or have make requirment object should implement serializable? edit: actually question internal state - how can impelment it? yea can normal practice have 2nd level cache in application @ least can on basis of experience. more can refer java specs here . we implemented 2nd level cache in our application enhance performance in database read operations. achieve used ehcache api , found easier integrate spring in our application running on spring framework.

javascript - how do you create custom buttons with highcharts that each data buttons calls anather php script for its data -

i trying create custom selectors highcharts. based on buttons on top right clicked, need call different php file outputs different data sets. example, following script reads 1 file , zooms in/out based on 1 file data. have 6 different files, 1) 5 minute data 1 day 2) hourly data 1 month, 3) daily data 3 months 4) weekly data 6 months etc. based on buttons clicked on top left corner need issue soemthing this: i trying create own buttons jsfiddle in each button need call external file graph chart: http://jsfiddle.net/yqnjm/4/ i have tried this: (function() { var genoptions = function(data) { return { chart : { renderto : 'container' }, rangeselector : { enabled:false }, series : data }; } $.getjson('db.php', function(data) { var options = genoptions(data); var chart = new highcharts.stockchart(options); normalstat...

css - Add flexslider(s) on Jquery UI tabs - making them work -

i have flexslider working on first jquery ui tab, when place on second 1 nogo....anyone know else have add make function work? included jfiddle of 1 thats not working: $('#slider').flexslider({ animation: "slide", controlnav: false, animationloop: false, slideshow: false }); $('#slider2').flexslider({ animation: "slide", controlnav: false, animationloop: false, slideshow: false }); jfiddle that link had answers nothing proof working.... saw advanced slider has method make work: <script type="text/javascript"> jquery(document).ready(function($) { $(".ui-tabs").tabs({ select: function (event, ui) { if ($(ui.panel).find('.advanced-slider').length) { var interval = setinterval(function() { if ($(ui.panel).css...

ios6 - ios 6 multiple pages in popover -

i want create view has button in top bar provides popover list of choices, tableview, , when user selects item popover has flip transition secondary set of choices. first set categories, , second set actual choices display. what best approach situation? i'm rather new ios development. can popover, i'm not sure how flip transition table in same popover. also if believes poor user interface design, i'm ears suggestions in accomplish same functionality. said, i'm new , i'm still learning better ui designs. you can create uitableview presented viewcontroller , have presrnt second view controller.

python - Download image from URL that automatically creates download -

i have url when opened, initiate download, , closes page. need capture download (a png) python , save own directory. have tried usual urlib , urlib2 methods , tried mechanize it's not working. the url automatically starting download , closing causing problems. update: using nginx serve file x-accel-mapping header. there's nothing particularly special x-accel-mapping header. perhaps page makes http request ajax, , uses x-accel-mapping reader value trigger download? here's how i'd urllib2 : response = urllib2.urlopen(url_to_get_x_accel_mapping_header) download_url = response.headers['x-accel-mapping'] download_contents = urllib2.urlopen(download_url).read()

php - phpunit gives errors even with no tests (Laravel) -

hi download phpunit.phar in laravel project (which developed partly). started doing simple php phpunit.phar but outputs things whole viewfiles @ end: {"error":{"type":"errorexception","message":"undefined variable: currency","file":"c:\\wamp\\www\\project.dev\\app\\views\\front\\settings.php","line":79}} this not test , code works when testing out in browser. using default phpunit configuration file shipped laravel. edit: code <label class="radio"> <input type="radio" name="settings_currency" id="set_curr_<?=$currency->id?>" value="<?=$currency->id?>" checked> <span class="symbol"><?=$currency->symbol?></span> <?=$currency->name?> <span><?=$currency->abbr?></span> </label> you cannot run phpunit , expect test useful. have configure it! ...

Only add csv values to PHP array that do not contain string -

i'm trying create array of values ($import_data) csv file contains 42,000 rows, each row contains sku. want add values array not contain string "cnv". there easy way this? here how adding values csv array: while ( ( $line = fgetcsv($handle, 0, $post_data['import_csv_separator']) ) !== false ) { $import_data[] = $line; } this solved it! while ( ( $line = fgetcsv($handle, 0, $post_data['import_csv_separator']) ) !== false ) { $test_str = print_r($line,true); if (strpos($test_str, "cnv") === false){ // add $import_data[] = $line; }

dependency injection - Why does Autofixture w/ AutoMoqCustomization stop complaining about lack of parameterless constructor when class is sealed? -

when use moq directly mock ibuilderfactory , instantiate builderservice myself in unit test, can passing test verifies create() method of ibuilderfactory called once. however, when use autofixture automoqcustomization , freezing mock of ibuilderfactory , instantiating builderservice fixture.create<builderservice> , following exception: system.argumentexception: can not instantiate proxy of class: oddbehaviortests.cubebuilder. not find parameterless constructor. parameter name: constructorarguments if make cubebuilder sealed (represented replacing sealed class sealedcubebuilder called ibuilderfactoryforsealedbuilder.create() , test passes using autofixture automoqcustomization, no exception thrown. am missing something? since passing tests using moq directly, believe related autofixture and/or automoqcustomization. desired behavior? if so, why? to reproduce, i'm using: using moq; using ploeh.autofixture; using ploeh.autofixture.automoq; using...

ios - UIScrollview jumps off screen when switching between views -

i have tab-bar app scroller view in first tab , other stuff in second one. scrolling works fine, if scroll down , switch second tab , again scrollview jumped far whole thing out of frame , can barley scroll , reach half way top. if go second tab , tab scroll view again in spot fine, every time switch first time run app flies far off screen. so added method thought fix problem, , looks this: @property (nonatomic) float lastscrollheight; @synthesize lastscrollheight = _lastscrollheight; -(float)lastscrollheight{ if(!_lastscrollheight) _lastscrollheight = 0; return _lastscrollheight; } -(void)viewdidlayoutsubviews{ [super viewdidlayoutsubviews]; [self.scroll setcontentoffset:cgpointmake(0.0f, self.lastscrollheight) animated:no]; } -(void)viewwilldisappear:(bool)animated{ [super viewwilldisappear:animated]; self.lastscrollheight = self.scroll.bounds.origin.y; [self resetapplesbrokenscrollview]; } -(void)resetapplesbrokenscrollview{ [self.scrol...

passport.js - Node.js Passport SAML from multiple Identity Providers -

i've implemented passport-saml site, , i've been tasked connecting our site 2 other identity providers. in code, seems use recent definition of samlstrategy. how can set passport allow multiple different implementations of same strategy? my implementation looks this: passport.use(new samlstrategy( { path: '/saml', entrypoint: "https://idp.identityprovider.net/idp/profile/saml2/redirect/sso", issuer: 'https://www.serviceprovider.com/saml', identifierformat: 'urn:domain:safemls:nameid-format:loginid' }, function(profile, done) { console.log("samlstrategy done", profile) user.findone({email:profile.email}, function(err, user) { if (err) { return done(err); } if(!user) return done(null, false, {message: 'no account associated email.'}) return done(null, user); }); } )); you can ...

php - Use bound variables more than once? -

i have lots of queries variable bound needs used more once. here's simple example. $stmt = $db->prepare('select sum(col1), (select sum(col2) table2 col3 > :val) quantity table1 col4 = :val'); when this, error: error!: sqlstate[hy093]: invalid parameter number in ... there typically reasons why can't like where col3 = col4 in other words, there situations need use bound variable more once. in past, i've bound values multiple times different names. is possible use bound variable more once? either set pdo::attr_emulate_prepares true or use "slightly different names" approach. doesn't make difference though

html - How to horizontally center a <div> in another <div>? -

how can horizontally center <div> within <div> using css (if it's possible)? <div id="outer"> <div id="inner">foo foo</div> </div> you can apply css inner <div> : #inner { width: 50%; margin: 0 auto; } of course, don't have set width 50% . width less containing <div> work. margin: 0 auto actual centering. if targeting ie8+, might better have instead: #inner { display: table; margin: 0 auto; } it make inner element center horizontally , works without setting specific width . working example here: #inner { display: table; margin: 0 auto; } <div id="outer" style="width:100%"> <div id="inner">foo foo</div> </div>

javascript - How can I replace this text in an HTML element? -

i have string shows "banana" i want replace "apple" this have <span id="fruit">banana</span> this script i'm using. var td1 = document.getelementbyid('fruit'); var text = document.createtextnode("apple"); td1.appendchild(text); and shows as. bananaapple <span id="fruit"> "banana" "apple" </span> how can rid of banana , replace apple? <span id="fruit">apple</span> just update innerhtml: http://jsfiddle.net/sntml/ document.getelementbyid('fruit').innerhtml = "apple";

backbone.js - why does backbone think I'm treating an object like a function? -

adding backbone rails app, created post model inside app namespace this var app = { this.models.post = new app.models.post(); in router, created following route "posts/:id": "postdetails" when navigate /posts/4, i'm getting uncaught typeerror: object not function error when try call fetch on model this postdetails: function (id) { console.log(id); var post = new app.models.post({id: id}); this.post.fetch({ success: function (data) { $('#content').html(new postview({model: data}).render().el); } }); } according backbone docs http://backbonejs.org/#model-fetch , should able call fetch on model retrieve data server. why backbone think i'm treating object function? you're doing this: this.models.post = new app.models.post(); to, presumably, set app.models.post instance of app.models.post model. try this: var post = new app.models.post({...

can run C++ code from command line but not from debug mode in visual studio -

i compiled program below in debug mode without error. run .exe file command line when try debug code inside visual studio exception gets thrown line detectioninternalsettings* internal_settings = detectioninternalsettingsfactory::createfromfilesystem( "c:/data/card_detection_engine.yaml"); anyone faced situation before behavior different running command line , in debug mode. int main(int argc, char **argv) { detectionsettings settings; try { detectioninternalsettings* internal_settings = detectioninternalsettingsfactory::createfromfilesystem("../data/card_detection_engine.yaml"); } catch (const myexception &e) { fprintf(stderr, "exception raised: %s\n", e.what().c_str()); return 1; } return 0; } i went exception details , here first-chance exception @ 0x76e1c41f in ocrcarddetectionengine_sample.exe: microsoft c++ exception: yaml::typedbadconversio...

How to convert sys.argv to argparse in python -

i have file1 = sys.argv[1] file2 = sys.argv[2] file2 = sys.argv[3] how can put in argparse? ready-opened file objects: import argparse, sys parser = argparse.argumentparser(description='process src dst') parser.add_argument('src', type=argparse.filetype('r'), default=sys.stdin) parser.add_argument('dst', type=argparse.filetype('w'), default=sys.stdout) options = parser.parse_args() then use options.src , options.dst already-open file objects. prints following when use --help command-line switch: usage: somescript.py [-h] src dst process src dst positional arguments: src dst optional arguments: -h, --help show message , exit

How to specify an address in a Google Maps Directions API URL -

how specify address in google maps web services directions api url? maps web services page states converting url receive user input tricky. example, user may enter address "5th&main st." generally, should construct url parts, treating user input literal characters. however isn't clear. there no examples , haven't been able find on web. mean that, given example, "5th&main st." following valid? https://maps.googleapis.com/maps/api/directions/json?destination=5th%26main+st.&sensor=true if not, correct conversion? thanks reading. as per understanding, looking uri encode . in javascript: encodeuri used encode string special characters including foreign language. example: var address = "5th&main st."; var encodedaddress = encodeuri(address); then pass encodedaddress in google maps api. https://maps.googleapis.com/maps/api/directions/json?destination=encodedaddress&sensor=true a small l...

c# - Setting AutoGenerateColumns property from VS 2012 -

Image
just got strange problem , wonder if there miss in vs2012 solve it. i'm working mdi windows forms , have datagridview retrieve data database , set datasource property of grid data database. though use old project scaffold one, datagridview designed in vs2012 , next data database if it's part datagridview design except header columns names of columns database. however did little reearch , find out in fact problem solved setting autogeneratecolumns property false. can't find property in vs2012 designer. i'm using : dgvclients.autogeneratecolumns = false; dgvclients.datasource = maingridinfolist; in load event i'd rather prefer use designer (if possible of course) , remove line - dgvclients.autogeneratecolumns = false; code. problem can't see property exact name datagridview wonder - name changed? kinda strange because can still use in code, or there never way ide designer , must written in source code explicitly? p.s it occurs...

c# - How to Print Text from ComboBox into a MessageBox -

will work using c#. trying text out of combobox compare , use. want text selected in combobox , put in string. string mytext = ""; mytext = combobox1.getitemtext(combobox1.selecteditem); messagebox.show(mytext); i new, use help. as far remember work you: mytext = combobox1.text;

java - Play2 "include" directive override configuration with substitution -

i have following conf files in play2.1.0 application application.conf override.dev.conf override.qa.conf override.prod.conf and there application.mode property in application.conf file have either 1 of dev/qa/prod values. application.conf has line include env/mode specific conf files override. not working substitution. reason: have override properties in env/mode specific conf files. referred: http://www.playframework.com/documentation/2.0/configuration if unquoted include @ start of key followed anything other single quoted string , invalid , error should generated. no substitutions allowed , , argument may not unquoted string or other kind of value. tried: able substitution done property not include this my.prop="override."${?application.mode}".conf" the above outputs override.dev.conf if application.mode=dev if have below not working , suppose expected per documentation reference. include "override."${?a...

objective c - Why does this method pass 'stop' by reference instead of return? -

does have insight why block parameter of - (void)enumeratematchesinstring:(nsstring *)string options:(nsmatchingoptions)options range:(nsrange)range usingblock:(void (^)(nstextcheckingresult *result, nsmatchingflags flags, bool *stop))block passes stop reference instead of returning it? it seems 'obvious' me use return value proabbly means missing , know missing. (the thing can think of able provide name pass reference variables make meaning clearer.) my guess because stop functionality not needed, , making block return void keeps syntax lighter, because can fall off end of code return: usingblock:^(nstextcheckingresult *result, nsmatchingflags flags, bool *stop) { nslog(@"result: %@", result); }]; rather than: usingblock:^(nstextcheckingresult *result, nsmatchingflags flags) { nslog(@"result: %@", result); return yes; }]; also, point out, ther...

java - Removing duplicate characters in a String (user inputted keyword) -

private string removeduplicates(string userkeyword){ int wordlength = userkeyword.length(); int lengthcounter; (lengthcounter=0; lengthcounter<wordlength; lengthcounter++){ if (userkeyword.charat(lengthcounter) != userkeyword.charat(lengthcounter + 1)){ string revisedkeyword = "" + userkeyword.charat(lengthcounter); userkeyword = revisedkeyword; } } return userkeyword; } im new java, havent used string builders, strung buffer,, arrays, etc yet.... havent gotten loops figured ll easiest way use... please help. there infinitely many ways this. finding own solution within bounds of toolset you've established learning program about. here 1 possible solution thinking: create set, default can hold unique values set<character> myset = new hashset<character>(); then loop on characters in string, adding each myset myset.add(c); when you're done, set have list of characters unique , in order, can print them o...

c# - ASP.NET MVC 4 Action on AJAX Request -

is there way call javascript function every time ajax request sent, , when call finished? know can individually each form onbegin , oncomplete functions, want universal one. specifically, wait cursor show every time sends ajax call, , go default cursor when done. with webforms sys.webforms.pagerequestmanager.getinstance().add_beginrequest(beginrequest); sys.webforms.pagerequestmanager.getinstance().add_pageloaded(pageloaded); but need mvc 4. any suggestions on how accomplish task appreciated, or alternatives if it's bad idea. tr global ajax event handlers

javascript - Select menu item link returns undefined -

the action want change video respective item when keyboard "enter" returns me error "undefined" has plugin i'm using select items. aspect video alone should not loaded page (ajax). javascript: $.getjson("http://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20xml%20where%20url%3d'http%3a%2f%2frss.cnn.com%2fservices%2fpodcasting%2fac360%2frss.xml'%20and%20itempath%3d%22%2f%2fchannel%22&format=json&diagnostics=true&callback=?", function (data) { // load titles patch json console.log(data.query.results.channel.item); var titles = data.query.results.channel.item.map(function (item) { return item.title; }); var urls = data.query.results.channel.item.map(function (item) { return item.origlink; }); console.log(titles); $(".container-list-podcast ul").append('<li>' + titles.join('</li><li>')); $(".container-list-podcast ul ...

google chrome - Accessing the Cast API from within an extension page -

i working on chromecast app, , wanted incorporate chrome extension. i'm using knockout.js in order of ui. have 2 pages, 1 unsandboxed ( http://jsfiddle.net/aujax/3/ ), , other sandboxed ( http://jsfiddle.net/v2djc/1/ ). none of console.log's ever called. manifest below: { "manifest_version": 2, "name": "__msg_app_title__", "description": "__msg_app_description__", "version": "0.1", "content_scripts": [ { "matches": ["<all_urls>"], "js": ["js/content/content.js"] } ], "background": { "scripts": ["js/back/background.js"], "persistent": false }, "permissions": [ "tabs", "contextmenus" ], "page_action": { "default_title": "__msg_app_title__", "default_icon": { "19": ...

html - Why do images that have a specified height and width render faster than those that do not? -

it general best practice set height , width value <img> tag render faster, why case? because if specify width , height, browser can preserve space before downloading image, , continue parsing html below. then, when image being downloaded, fills space. if don't that, browser doesn't know how space should preserve beforehand. then, html elements below image need moved when image downloaded.

PHP Array Turns me banging my head -

have variables retrieve withem data database so: foreach ($row $result) { if ($row[28] == '') { $string28 = ''; }else if( $row[28] == 0){ $string28 = ''; } else{ $string28 = '<div class="add_img"><h1>connexion</h1><img src="images/'.$row[28].'.jpeg"></div>'; } } foreach ($row $result) { if ($row[30] == '') { $string30 = ''; }else if($row[30] == 0){ $string30 = ''; } else{ $string30 = '<div class="add_img"><h1>fixation</h1><img src="images/'.$row[30].'.jpeg"></div>'; } } foreach ($row $result) { if ($row[31] == '') { $string31 = ''; }else if($row[31] == 0){ $string31 = ''; } else{ $string31 = '<div class="add_img"><h1>schéma</h1>...

How to hide, fade in and fade out div with jQuery and keyboard controls? -

i'm wanting show , hide div using keyboard controls, required functionality is: hide div on page load fade in div when doing key combination (either ctrl + shift + i or f + i ) fade out div when doing key combination (either ctrl + shift + o or f + o ) i working with: http://www.michaelckennedy.net/samples/blog/hotkeys/ but doesn't seem work firefox. i attempting use: https://keithamus.github.io/jwerty/ which has detailed readme here: https://github.com/keithamus/jwerty/blob/master/readme-detailed.md i not familiar jquery terminology , therefore can't quite figure out how implement required functionality. my first attempt was: <script src="js/jwerty.js"></script> <script> $(document).ready(function() { $("#mydiv").hide(); }); jwerty.key('f+i', function () { $("#mydiv").fadein(400); }); jwerty.key('f+o', function () { $("#mydiv").fadeout(400); }); </script> ...

java - Cannot find Scanner Class -

import util.java.scanner; class anagram { public static void main(string args[]) { string s1=new string(); scanner s=new scanner(system.in); s1=s.nextline(); } } this gives error : cannot find symbol scanner.... whats wrong here? the correct import statement java.util.scanner . avoiding these kind of errors, use , ide.

javascript - YUI3 custom async events not working on Y.Global -

i trying implement async event leveraging yui3 library . application had been notified event passed late subscription, simular load or ready events do. here is have far, no luck around. yui().use('event', 'event-custom', function(y){ function oncustomevent () { y.global.on('custom:event', function(){ alert('custom fired'); }); } window.settimeout(oncustomevent, 2000); }); yui().use('event', 'event-custom', function(y){ y.publish('custom:event', { emitfacade: true, broadcast: 2, fireonce: true, async: true }); function firecustomevent () { y.global.fire('custom:event'); } window.settimeout(firecustomevent, 1000); }); if give hint what's wrong code? thank you. upd: after bit investigations turns out async events work fine inside 1 use() instance , when not using global broadcasting. that's either bug or limitation. still discovering okay...

Writing a bash script to push local files to Amazon EC2 and S3 - needs proper owner/permissions -

i have php project on local machine, following folder structure assets/ |- css/ |- ... |- js/ |- ... dynamic/ |- scripts/ *contains bunch of .php files the plan push assets/ directory amazon s3 (for use cloudfront cdn) using s3cmd , push dynamic/ files amazon ec2 instance (web-server) directly. the base script i'm using below: [push.sh] #!/bin/bash # source our program variables . ./_global.sh # setup build directory echo "======== preparing build directory ==============" node build/r.js -o build/build.js # start rsync push dynamic files echo "==== syncing dynamic files ec2 instance ====" rsync -rvzh --progress --delete --exclude-from "${build_dir}exclude-list.txt" \ -e "ssh -i ${build_dir}mykey.pem" \ $www_built_dir ubuntu@$server_ip:$server_dir # push static assets s3 echo "========== pushing static assets s3 =========" s3cmd sync --delete-removed --exclude-from "${build_dir}exclud...

zend framework - How to check validations between dynamically created form elements in PHP? -

i have application divided 3 phases. planning implementation post-implementation in each of these phases there multiple occurrences same activity under different conditions. instance, in each of these phases there several different meetings. each meeting meant collect different data. if 1 meeting intended collect cash details, other meeting held gather information related progress of project. have decided provide provision dynamically create form & form elements. there section create forms in application form elements defined. user can select required form elements necessary create form , save under name later use. main issue i'm facing such solution validation between dynamically created form fields. ie, consider, there 3 form elements. 1 selectbox , 2 textboxes namely textboxa , textboxb . selectbox refers meeting type. <select> <option value="">-- select --</option> <option value="1">cash collection</...

Nokogiri each node do, Ruby -

i have xml: <kapitel> <nummer v="1"/> <von_icd_code v="a00"/> <bis_icd_code v="b99"/> <bezeichnung v="bestimmte infektiöse und parasitäre krankheiten"/> <gruppen_liste> <gruppe> <von_icd_code v="a00"/> <bis_icd_code v="a09"/> <bezeichnung v="infektiöse darmkrankheiten"/> <diagnosen_liste> <diagnose> <icd_code v="a00.-"/> <bezeichnung v="cholera"/> <abrechenbar v="n"/> <krankheit_in_mitteleuropa_sehr_selten v="j"/> <schlüsselnummer_mit_inhalt_belegt v="j"/> <infektionsschutzgesetz_meldepflicht v="j"/> <infektionsschutzgesetz_abrechnungsbesonderheit v="...

javascript - Making the column height same and remove extra content -

Image
i have question, webpage has many div section , have multiple ul li. 2 column design , need set same height both corresponding div section. example check image, 1 section , want set height shortest div , remove large div content. possible do? i checked on internet getting set both column height unable find how can remove content. the right image want. please :) assuming you're using jquery, try this: var $targets = $('.awesomeclass'), targetheight = $targets.first().height(); $targets.each(function() { var $this = $(this); if( $this.height() < targetheight ) { targetheight = $this.height(); } }); $targets.height( targetheight ); this code set height of matching elements height of shortest member. just make sure target elements have class awesomeclass , or whatever class decide use, , add overflow: hidden; overflowing elements cut off. method remain functional if decide change number of elements etc.

Remove external html tags when copying into an iframe text editor -

i have made custom iframe based text editor scratch. looking implement 2 features now. here iframe : <div id="iframe-container" style="height: 200px; width : 450px ; border:1px solid #1d1d1d;"> <iframe id="wysiwygtextfield" onload = 'return iframevents(); ' frameborder="0" style="height: 100%; width:100%;" scrolling="no" > <html> <head> </head> <body> <br/> </body> </html> </iframe> </div> ...

Regex to match this -

i'm trying capture phpunit output file path , error line condition. i don't want want lines contain whole word exception (can exclude multiple words?). this output , non-working (obviously:) pattern: /path/includes/exception.php:7 /path/things-i-care-about/es/somefile.php:132 /path/things-i-care-about/es/somefile.php:121 /path/things-i-care-about/es/somefile.php:54 /path/things-i-care-about/es/somefile.php:60 /path/things-i-care-about/es/somefile.php:41 /path/things-i-care-about/es/somefile.php:47 /path/things-i-care-about/testfile.php:26 pattern: /((?!exception).*.php):(\d.*)/gs what tried negating line has "exception" in it, regex didn't quite work. what doing wrong? you can try pattern: ^(?:[^e\n]+|\be|\be(?!xception\b))+\.php:\d+$ or pattern, if don't need check specific line format: ^(?>[^e\n]++|\be|\be(?!xception\b))+$ notice: if need select consecutive lines in 1 block, need remove \n character classes.

excel - Calculating pairwise rolling correlations -

please find workbook here the first row contains names of banks , other entries daily returns of each bank. want find rolling correlation (from past 1 year of returns) of pairwise banks beginning 1/1/2008, i'll provide example of want do: starting erste group bank, on date jan 1st 2008, want find correlation between erste group bank , raiffeisen bank intl based on past 1 year worth of returns, formula =correl(b2:b263,c2:c263), on jan 2nd 2008 formula =correl(b3:b264,c3:c264) , on until feb 28th 2013. then want same thing on date jan 1st 2008, find pairwise correlation between erste group bank , dexia, hence formula on jan 1st 2008 =correl(b2:b263,d2:d263) , on until feb 28th 2013. so want find pairwise correlations between erste group bank , every other bank this, 1/1/2008-28/2/2013. then want repeat other banks, eg, take raiffeisen bank intl 'primary' bank , 1/1/2008-28/2/2013, want find pairwise correlation between raiffeisen bank intl , erste group bank, ra...

java - Switch from panel into tabbedPane -

i have tabbedpane contain 2 jpanel. tabbedpane = new jtabbedpane(); tabbedpane.addtab("main", null, mainpanel, "does nothing"); tabbedpane.setmnemonicat(0, keyevent.vk_1); tabbedpane.addtab("report", null, reportpanel, "still nothing"); i'm in first panel , after operation pass second pannel (main -> report). how can it? jtabbedpane#setselectedindex(int index)

c++ - Can't start a Program because Qt5Cored.dll is missing -

i compiled simple qt 5 project successful in qt creator. when run within qt creator works. when transferred executable location produces following error message on cmd console; the program can't start because qt5cored.dll missing computer. try reinstalling program fix program. i tried find qt5cored.dll in qt5 directory not find. strange thing program runs qt creator. please. i'm on windows 7 64 bit using qt5 mingw the file qt5cored.dll exist on system, otherwise not work qt creator either. think it's windows search lets down. open cmd prompt , dir c:\qt5cored.dll /s another note *d.dll debug dll's, means distributing debug version of application. might want build release version distribution instead. (in case you'll need qt5core.dll )

Adding Portugese to HTML/PHP, and small html -

i'm editing website, , have couple of small snags i've hit. in .php file i'm editing, i'm changing language portugese, have typed below english characters, once add special characters Ç or à plugin dies (i mean spinning wheel loading, , never loads). plugin in wordpress. <div id="label_gen_info">' . 'informacao geral' . '</div>'.'<div>' . '<table>' . '<tr>' . '<td>endereco :</td>' . '<td>{1}</td>' . '</tr>' . '<tr>' . ...

c# - How do you modify the matched string using Regex.Replace? -

say want convert these strings: www.myexample.com , http://www.myexample.com into: <a href='http://www.myexample.com'>http://www.myexample.com</a> using regex.replace i've come this: regex.replace(string, pattern, "<a href=\"$&\">$&</a>") my problem don't know how check if matched string $& starts http:// , adds if necessary. any ideas? if don't have consider https or things that, maybe use this: regex.replace(string, @"(?:http://)?(.+)", "<a href=\"http://$1\">http://$1</a>")

android - Handling Back button when keyboard is up -

in application have edittext. when focus element, cursor appears , keyboard shows up. when know press button, keyboard disappears element stays focused , blinking cursor still visible. i tried manage code found on other posts, doesnt work, dont event. public boolean dispatchkeyeventpreime(keyevent event) { if(event.getkeycode() == keyevent.keycode_back) { toast.maketext(this, "keyevent abgefangen", toast.length_long).show(); search.clearfocus(); inputmethodmanager imm = (inputmethodmanager) getsystemservice(context.input_method_service); imm.hidesoftinputfromwindow(search.getwindowtoken(), 0); } return true; } tried calling requestfocus() in element? like example if have textedit or that

permissions - Make directory below working python -

when trying os.makedirs("/home/user/newdir") , while python script located "/home/user/somefolder" gives me oserror: [errno 13] permission denied: '/home/user' how can make newdir the problem used socket.gethostname() user name of pc, should have used getpass.getuser() instead. getpass.gethostname() gave me "chriss", while in kristians@chriss:~$

Why my text got truncated in PDF in rails 3.1.12 -

Image
i have upgraded rails version last month 3.0.6 3.1.12. working on accounting application need send invoices in pdf format, have used prawn, felt issue account description got truncated in pdf format, don't know why? here part of code printing table data in invoice: for in @invoice_line_items data += [["#{i.item_name}","#{i.description}",{:content =>"#{i.quantity}",:align => :right},{:content => "#{i.unit_rate.to_s}", :align => :right},{:content => "#{i.discount_percent}", :align => :right},{:content => "#{i.amount.to_s}", :align => :right}]] end here screen shot : 1) pdf file: 2) view screen : is buddy have idea missing? can see have many lines in view file truncated in pdf format hi friends found solution of problem, after inspecting code found using line hight property, due line has been truncated per size , content truncated , have removed line height , working ...

php - Laravel 4: Stock Auth login won't persist across pages -

from tutorials, i'm supposed able auth user jump other page, , login persisted. however, not work. custom compiled php lamp stack. app storage writable. the difference tutorials i'm using email instead of username. http://laravelbook.com/laravel-user-authentication/ http://codehappy.daylerees.com/authentication sessions work, able store var session , read out on different page. models/user.php (stock) use illuminate\auth\userinterface; use illuminate\auth\reminders\remindableinterface; class user extends eloquent implements userinterface, remindableinterface { /** * database table used model. * * @var string */ protected $table = 'users'; /** * attributes excluded model's json form. * * @var array */ protected $hidden = array('password'); /** * unique identifier user. * * @return mixed */ public function getauthidentifier() { echo $this->getk...

ruby - Symbol literal or a method -

are :"foo" , :'foo' notations quotations symbol literal, or : unary operator on string? : part of literal enter or create through method. although : can take name or "string" create literal, unlike operator not provoke action or modify value. in each case instance of symbol returned. writing : string notation important. if want represent, instance, string containg whitespace symbol need use string notation. > :foo => :foo > :foo bar syntaxerror: (irb):2: syntax error, unexpected tidentifier, expecting end-of-input > :"foo bar" => :"foo bar" furthermore, interesting explore equality operator (==) > :"foo" == :foo => true > :"foo " == :foo => false my advice, not think of passing string or name create symbol, of different ways express same symbol. in end enter interpreted object. can achieved in different ways. > :"foo" => :foo after all, %...

php - How to get part of text, string containing a phrase/word? -

i have database in mysql process php. in database have column long text. people search phrases search tool on website. displays items matching search. now, question how part of text contains phrase search can see if it's looking for? for example: text: "this long text (...) problems jquery , other javascript frameworks (...) check out" and phrase jquery this: about problems jquery , other javascript frameworks ? in mysql, can use combination of locate (or instr ), , substring : select substring(col, locate('jquery', col) - 20, 40) snippet yourtable this select 40 character snippet text, starting 20 characters before first occurrence of 'jquery' . however, tends slow. alternatives worth looking into: using similar method in php using full-text search features mysql (not sure if of them help), or maybe whole separate full-text search engine solr.

jquery - Adding JS Youtube API videos programmatically -

i'd like: // create youtube player var player = new yt.player('player', { height: '390', width: '640', videoid: '0bmhjf0rke8' }); var newvideo = $('<div></div>').html(player); $('body').append(newvideo) how can add youtube video elements programmatically? the yt.player function takes first argument id of element creating player object; hence, in code, since haven't created element yet, can't create iframe or injected player code. if reverse order, though, , give programmatically created id, should work. you'll want put creation of players in onyoutubeiframeapiready() callback function, since automatically called when javascript api loaded (you can put creation of multiple players in 1 function): var tag = document.createelement('script'); tag.src = "https://www.youtube.com/iframe_api"; var firstscripttag = document.getelementsbytagname('script...