Posts

Showing posts from June, 2011

TextView below Image not showing up in Android -

Image
i trying put text below image not showing in android layout. here screenshot: i dont' see text below image. and code: inside relative layout <?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/layout_footer" android:layout_width="match_parent" android:gravity="center" android:layout_height="?android:attr/actionbarsize" android:background="@color/panelcolor" > <imageview android:id="@+id/searchicon" android:layout_width="wrap_content" android:layout_height="match_parent" android:paddingright="60dp" android:src="@drawable/search_white" /> <textview android:id="@+id/searchtext" android:layout_width="wrap_content" android:layout_h...

php - Laravel s3 multiple buckets -

my laravel application needs manipulate files present in multiple buckets simultaneously single session. so, couldn't find way change several times current bucket, since .env file this: s3_key='my-key' s3_secret='mysecret' s3_region='us-east-1' s3_bucket='my-first-used-bucket' i found somewhere this: config::set('filesystems.disks.s3.bucket', 'another-bucket'); but works once. need like: storage::disk('s3')->put('/bucket-name/path/filename.jpg', $file, 'public'); where /bucket-name/ bucket create. can do? lot! you correct in config::set(); works once per request. estimation done intentionally stop kind of thing attempting in code example. in config/filesystems.php can list number of "disks". these locations of file repositories. looks so: disks' => [ 'local' => [ 'driver' => 'local', 'root' => st...

php - Doctrine/Symfony entity generator and generating entity from one table -

i have few entities, new table appeared in database, , i'd generate entity on 1 table. i saw this , have further questions. i have user entity (and db table). now, new table called "report" (no entity right now, want create it) , has foreign key user. there few more foreign keys. if suggested in above answer, is: $ php app/console doctrine:mapping:import --force appbundle xml --filter="report" $ php app/console doctrine:mapping:convert annotation ./src/appbundle/entity --from-database --filter="report" $ php app/console doctrine:generate:entities appbundle:report --no-backup will doctrine generator try modify user entity? or create report entity? btw. understand(?), not, because manytoone relation, let's assume moment manytomany moment. i know try it, last time executed doctrine:mapping:import --force command ended crashing app , spent many hours solve problem, until on stackoverflow told me remove src\appbundle/resources/confi...

java - Elasticsearch : Disable IDF completely for search result scoring -

this sample data in elasticsearch { "_index": "12_index", "_type": "skill_strings", "_id": "avkv-km4axmy3feczw9t", "_source": { "str": "php php php" } }, { "_index": "12_index", "_type": "skill_strings", "_id": "avkv-knfaxmy3feczw9u", "_source": { "str": "javascript php javascript javascript" } } "bool":{ "must":[ // conditions {"match_phrase":{"str":"php"}} ], "should":[ {"match_phrase":{"sentences":"javascript"}} ] } norms disable in result set, php (with 16 occurrences) gets score of 13.65 (rounded off) whereas javascript same number of occurrences in doc gets lower score of 9.58 as per use case irrespective of how rare word or ...

cakephp 3 + can't update database record when using translate behavior and 'contain' -

i using cakephp 3 , trying pretty basic stuff. have 2 tables, articles , tags. articles belongs tags, , made table tags translatable attaching translate behavior. class articlestable extends table { public function initialize(array $config) { $this->addassociations([ 'belongsto' => ['tags'] ]); } } class tagstable extends table { public function initialize(array $config) { $this->addassociations([ 'hasmany' => ['articles'], ]); $this->addbehavior('translate', ['fields' => ['name']]); } } in article controller have edit function: class articlescontroller extends appcontroller { public function edit($id = null) { $article = $this->articles->get($id); if ($this->request->is(['post', 'put'])) { $this-...

javascript - Basic Expressjs query -

the question might sound confusing , stupid. i've started nodejs. anyways, i've form , when user submits want display html element response. so, used body parser , displayed jade view engine. the problem - display result bodyparser, i've create html element variable beforehand p #{url} (it sits empty until response)and need response fadein can't view engine. there way share server side variable javascript file, can use jquery? what's best practice it? what i've tried far - read bunch of question saying ajax wasn't able figure how response server file ajax. res.send res.json , other stuff didn't work. index.jade extends ../public/layouts/default block content #onlydiv #onlydiv-inside p paste url below shorten form#urlform(action='/add', method='post') input#area(type='text' name='url', placeholder = 'www.facebook.com', autocomplete = 'off...

email - Outlook VBA link to moved mail -

i want move mail item different folder , return link moved mail. without moving works as: dim objmail outlook.mailitem dim sfrag string set objmail = application.activeexplorer.selection.item(i_item) sfrag = "<a href='outlook:" + objmail.entryid + "'>" + objmail.subject + "</a>"" here there string sfrag provides on proper hyperlink to valid outlook element. if click on hyperlink containing property element opened in outlook. however if extend to: dim objmail outlook.mailitem dim sfrag string dim oolapp outlook.application dim targetfolder folder set objmail = application.activeexplorer.selection.item(i_item) set oolapp = outlook.application set objnmspc = oolapp.getnamespace("mapi") set targetfolder = objnmspc.pickfolder objmail.move targetfolder sfrag = "<a href='outlook:" + objmail.entryid + "'>" + objmail.subject + "</a>" after link in sfrag f...

java - How many objects are there? -

this question has answer here: what string pool in java? [duplicate] 4 answers string s1=new string("rahul"); s1=new string("rahul"); s1=new string("kumar"); string s2=new string("rahul"); s2=new string("rahul"); s2=new string("kumar"); // how many objects created? every new string(...) creates new object. in example 6 objects created.

jquery - Insert,Update,Delete Events Operations on Fullcalendar POPUP and show Events which is inserted -

hello friends need make web application in have appointment schedule between 2 persons m using fullcalendar open popup have fields description,starttime , endtime. want set each event same fullcalendar selectable demo start:start(variable mycode) end: end not know m in right direction or not please me out if changes of events autoupdate on database need show in calendar updated code : javascript: $(document).ready(function() { var count=0; var livedate=new date(); var dat = new date(); var d = dat.getdate(); var m = dat.getmonth(); var y = dat.getfullyear(); $.getjson("<?php echo base_url(); ?>names",function(data){ var select = $('#agentname'); //combo/select/dropdown list if (select.prop) { var options = select.prop('options'); } else { var options = select.attr('options'); } var calendar = $('#calendar').fullcalendar({...

three.js - How to resize ThreeJS Renderer in Firefox & Edge -

i have simple web app three.js webgl view. page responsive, need resize 3d view window size changes. works fine in chrome, nothing in firefox, , resizes renders black canvas in edge. the code i'm using is: canvaswidth = canvasheight = window.innerwidth < 786 ? window.innerwidth : math.min(window.innerwidth*0.35, 500) renderer.setsize(canvaswidth, canvasheight); camera.aspect = canvaswidth / canvasheight; camera.updateprojectionmatrix(); this code executed on window resize. the app available @ http://bit.ly/1oeckue suggestions? does resize of canvas work in firefox when directly use window.innerwidth , window.innerheight this: camera.aspect = window.innerwidth / window.innerheight; camera.updateprojectionmatrix(); renderer.setsize( window.innerwidth, window.innerheight ); this normal approach three.js examples resize canvas. maybe there problem in way calculate canvaswidth , canvasheight variables...

algorithm - How do we solve the given scenario efficiently? -

we given maze in need visit many rooms possible. specialty of maze once enter room lead rooms higher tag in direction move . b , c decide move in opposite directions trying luck maximize number of rooms search .(they can start room , need not same) we need find out maximum number of rooms can searched. 1. access room higher tag allowed, not adjacent rooms or next room higher tag. 2. tags unique. so given input: 12 11 10 1 2 3 4 13 6 7 8 5 9 answer 12: (1,2,3,4,6,7,8,9) b , (5,10,11,12) c. i thought of solving using longest increasing sub sequence first right , left.and count of unique elements in above 2 sub sequence answer. but logic seems fail,how can done? my program below computes maximum number of rooms searched. has time complexity of o(n^3). modified dp algorithm computing longest increasing sequence available online solve op's problem. addresses op's concerns on arrays {1,4,6,2,5}. rightly max value 5 previous example. so, used idea @beyelers...

Android sqlite backup/restore without overwriting -

question in short form: seems followups should perhaps emphasize , simplify core of question. core this: other backup options android dbs seems leave risk restore overwrite data in database. so, , there way backup/restore without risk? . question in long form: having looked through many of (rather numerous) questions backing up sqlite db on android have 1 question couldn't find answer to. all other backup/restore discussions dealt saving db file sd (or, in how backup/restore sqlite database on android dropbox , cloud), , restoring when required. concern is, wouldn't restore overwrite current db? i'm concerned when user has new install of app they've been using short time (generating new data) , want import data previous backup of app. other backup/restore approaches seems restoring old db file overwrite new data in current db file. want instead backup option that, on restore, add data backup current db make complete without overwriting else in it. do oth...

ruby on rails - How can I test ActionCable channels using RSpec? -

i wondering testing actioncable channels. let's have following chat channel: class chatchannel < applicationcable::channel def subscribed current_user.increment!(:num_of_chats) stream_from "chat_#{params[:chat_id]}" stream_from "chat_stats_#{params[:chat_id]}" end end the subscribed method updates db , defines 2 streams broadcasted across channel, details not important since question more general one: how can set test test logic involved subscribing channel? rspec provides lot of helper methods , various utilities when testing similar interactions controller action, find regarding rspec , actioncable. you want wait* https://github.com/rails/rails/pull/23211 merged. adds actioncable::testcase. once that's merged, expect rspec-rails team part: https://github.com/rspec/rspec-rails/issues/1606 * waiting optional; can not wait , based own work on "work in progress" , find solution works right now. ...

Transaction with Eloquent Laravel 5 -

i using myisam mysql , want use transaction here code: db::transaction(function () { $project = project::find($id); $project->users()->detach(); $project->delete(); }); this code execute succesfuly not sure transaction works... how can test it? there 2 ways of doing this, neither particularly nice, because db:transaction doesn't report errors. put try/catch block inside closure , set external variable in catch block if transaction fails. do manual transaction, using db::begintransaction , rollback / commit, again exception handler, per example: db::begintransaction(); try { $project = project::find($id); $project->users()->detach(); $project->delete(); db::commit(); $success = true; } catch (\exception $e) { $success = false; db::rollback(); } if ($success) { // transaction worked ... }

r - Unlist a list of dataframes -

this possibly simple question. have list of dataframes (df1, df2.... dfn), i.e. each element of list dataframe. basically, list created this: mylist = list(df1, df2,...., dfn) but how do reverse, unlist df1, df2, etc. reside separately in workspace? use list2env specially designed this: from named list x, create environment containing list components objects, or “multi-assign” x pre-existing environment. so here : list2env(mylist ,.globalenv)

c++ - Why can templates only be implemented in the header file? -

quote the c++ standard library: tutorial , handbook : the portable way of using templates @ moment implement them in header files using inline functions. why this? (clarification: header files not only portable solution. convenient portable solution.) it not necessary put implementation in header file, see alternative solution @ end of answer. anyway, reason code failing that, when instantiating template, compiler creates new class given template argument. example: template<typename t> struct foo { t bar; void dosomething(t param) {/* stuff using t */} }; // somewhere in .cpp foo<int> f; when reading line, compiler create new class (let's call fooint ), equivalent following: struct fooint { int bar; void dosomething(int param) {/* stuff using int */} } consequently, compiler needs have access implementation of methods, instantiate them template argument (in case int ). if these implementations not in header, wouldn...

Displaying images retrieved from database using PHP -

i know how display image stored in database inside of particular div using php code? the code used looks that: <form method="post"> <input type="button" name="show" value="show"/><br/> <input type="image" id="image_show" name="img" value="img"/> </post> if(@$_post['show']) { $sql="select imagedata form images order desc"; $result=mysql_query($sql) or die('invalid query'.mysql_error()); //set header header("content-type:image/png"); echo mysql_result($result,0); while( $row = mysql_fetch_row( $result ) ) { echo "<img src='".$row[0]."'/>"; } } but not work. how can solve task? you need specify name of column want retrieve returned array ( imagedata in case) echo '<img src="'.$row[...

excel - Find particular cells to copy to main workbook -

i want find particular cell in opened worksheet , copy data 3 cells right main workbook (not 1 has been opened). the macro below loops through files in txt doc , opens , closes them. in each file cell called ada , want copy cells 3 right, ada not in same place need search it. e.g find cell ada , in e6 in workbook, need copy e6 along h6,i6 , j6 original main workbook running macro from. sub gatherdata() dim objfso object dim objwb workbook dim strfn string dim objtf object set objfso = createobject("scripting.filesystemobject") set objtf = objfso.opentextfile("u:\time series project\doclist.txt") on error resume next while not objtf.atendofstream strfn = objtf.readline() set wb = workbooks.open(strfn) if wb nothing debug.print strfn else wb.close false set wb = nothing end if loop on error goto 0 end sub i thinking of adding like dim c range dim newcell dim tmp dim wrkbk workbook dim sht worksheet set c = ...

android - Dialog with transparent background (with any color) -

Image
i want blue translucent behind custome dialog box. not getting blue color here code of dialog declaration: final dialog dialog = new dialog(bookappointmentactivity.this,r.style.translucentblue ); //dialog dialog = new dialog(bookappointmentactivity.this, android.r.style.theme_translucent_notitlebar_fullscreen ); dialog.setcontentview(r.layout.customedialog); window window = dialog.getwindow(); window.setbackgrounddrawable(new colordrawable(android.graphics.color.transparent)); dialog.show(); here style.xml <color name="transparent_green_color">@color/dialog_back</color> <style name="translucentblue" parent="android:theme.translucent"> <item name="android:windowbackground">@color/transparent_green_color</item> </style> ok got solution first make change in theme. don't make custome theme...

ASP.NET Core 1 RC2 web application entry point -

so changed way they're bootstrapping web applications between asp.net 5 rc1 , rc2. it used be: public static void main(string[] args) => webapplication.run<startup>(args); but in rc2, no longer have reference static class webapplication. ideas? from announcements repo: hosting renaming webapplication webhost public static void main(string[] args) { var host = new webhostbuilder() .usedefaultconfiguration(args) .useiisplatformhandlerurl() .usestartup("musicstore") .build(); host.run(); } the example musicstore

performance - Python : Removing a List from List of List? -

i have set char={'j','a'} and list of list content = [[1,'j', 2], [2, 'k', 3], [2, 'a', 3], [3,'a', 9], [5, 'j', 9]] i trying remove list items in list content , don't have 'j' & 'a' did li = list(char) char1= np.array(li) content=np.array(content) new_content=[] alphabet in content: if alphabet[1] in char1: new_content.append(alphabet) print(new_content) is there efficient way of writing? if char , content has more no of elements, computation takes long time. >>> content = [[1,'j', 2], [2, 'k', 3], [2, 'a', 3], [3,'a', 9], [5, 'j', 9]] >>> char={'j','a'} all lists in content have 'j' , 'a': >>> [x x in content if all(c in x c in char)] [] all lists in content have 'j' or 'a': >>> [x x in content if any(c in x c in char)] [[1, 'j...

python - In SelectKBest, what does length of get_support() represent? -

when reproducing this cross-validation example , 2x4 train matrix (xtrain) len(b.get_support()) of 1 000 000. mean 1 000 000 features have been created in model? or 2, number of features have impact 2. thanks! %matplotlib inline import numpy np import matplotlib.pyplot plt sklearn.feature_selection import selectkbest, f_regression sklearn.cross_validation import cross_val_score, kfold sklearn.linear_model import linearregression ### create data def hidden_model(x): #y linear combination of columns 5 , 10... result = x[:, 5] + x[:, 10] #... little noise result += np.random.normal(0, .005, result.shape) return result def make_x(nobs): return np.random.uniform(0, 3, (nobs, 10 ** 6)) x = make_x(20) y = hidden_model(x) scores = [] clf = linearregression() train, test in kfold(len(y), n_folds=5): xtrain, xtest, ytrain, ytest = x[train], x[test], y[train], y[test] b = selectkbest(f_regression, k=2) b.fit(xtrain,ytrain) xtrain = xtrain[:, b...

c# - Write to Custom Binary File from DataGridView -

first of all, i'm loading large file data grid view (~100mb). file contains dozens of "profiles". user able select profile want view after gets loaded data grid view. want enable user select specific profile , have them save individual file don't have open large file every time. here how file loaded (note it's databound data grid view): private void boardlistview_selectionchanged(object sender, eventargs e) { if (boardlistview.selectedrows.count > 0) { var s = (boardcandidateoffset)boardlistview.selectedrows[0].databounditem; loadfromfile(s); plotmodel.resetallaxes(); plotview.invalidateplot(true); } } and here read file: private void loadfromfile(boardcandidateoffset b) { profiles.clear(); using (var stream = file.openread(currentfilename)) using (var reader = new binaryreader(stream)) { stream.seek(b.fileoffset, se...

javascript - How does one properly use state parameters to scope variables when clicking the back button using the ui router? -

i create tabs dynamically, , each tab gets own state url , state parameters. state parameter used scope variables in tabs. use ui router. works fine i.e. tabs , contents displayed when clicking respective tab headers. however, when using browser's (and forward) button, variables in tabs not scoped anymore when clicking again respective headers scoped again (as expected) respective state parameters. how can 1 scope variables in dynamically created tabs when hitting back/forward button, is, when going , forth between different tabs, how can 1 make sure variables scoped respective state parameter. i grateful --- apologies if trivial new game. here relevant code snippets: main html file tabs.html <ul> <li ng-repeat="item in times">{{item.name}} <button type="button" class="btn btn-primary" ng-click="newtab(item)">show more</button> </li> </ul> ... ...

c# - How to convert datetime string in format MMMdyyyyhhmmtt to datetime object? -

i have tried below: datetime.parseexact("feb520161000pm", "mmmdyyyyhhmmtt", cultureinfo.invariantculture) but it's giving formatexception . interestingly datetime.parseexact(datetime.now.tostring("mmmdyyyyhhmmtt"), "mmmdyyyyhhmmtt", cultureinfo.invariantculture) this giving format exception. alexei's answer quite right, wanna explain little bit deep if let me.. you thinking 5 should match d specifier, right? not how datetime.parseexact works under hood . since the "d" custom format specifier represents number 1 through 31 , specifier map 52 in string, not 5 . that's why code throws formatexception . as can see, string format can't parsed unless string manipulations it. in such case, .net team suggests either using 2 digit forms 05 or insert separators date , time values. you can create custom method parse mmmdyyyyhhmmtt format only parse kind of formatted strings like; p...

javascript - Comparing dates grabbed from an API to todays date -

i'm in process of showing "fixtures" of sports team on website, data grabbed website. i have api gets data including next opponent, date of, kick of time etc. i'm posting each fixture list, , each element different div. e.g. each fixture - <li><div>date of fixture</div> <div>kick off time</div> <div>home team</div> <div>away team</div></li> i have each date in div:first on each list item, , have current date in span. i've tried using date.js structure date given, , todays date, comparable format, , compare them against each other , show latest 1 - cannot seem more 1 list item. i want add "hidden" class each list item before todays date. here's i've got far: <?php $request = "https://www.kimonolabs.com/api/csv/9shgt89o?apikey=-----"; $response = file_get_contents($request); $results = json_decode($response); $currentdate = date("d d m y"); echo ...

jquery - ReCaptcha in Fancybox not working -

i trying google recaptcha load fancybox ajax floated modal have on website cant recaptcha element appear... any ideas how make work? if change fancybox open code use iframe appears, likewise if make inline works - need work in ajax window... html code open fancybox window is: <a class="various fancybox.ajax" href="reply.html"> code in reply.html page have tried basic load , explicit approach per: <script type="text/javascript"> var onloadcallback = function() { grecaptcha.render('recaptchafield1', { 'sitekey' : 'my_site_key' }); }; </script> <script src="https://www.google.com/recaptcha/api.js?onload=onloadcallback&render=explicit" async defer> </script> any ideas?fancybox code is: <script type="text/javascript"> $(document).ready(function() { $(".various").fancybox({ maxwidth : 900...

javascript - Uncaught Error: [$injector:modulerr] Failed to instantiate module app -

i trying run angular app. original error message : unknown provider : currentv <- v after tried add ng-strict-di , started getting below error message: i getting below error. uncaught error: [$injector:modulerr] failed instantiate module app due to: error: [$injector:strictdi] function($provide) not using explicit annotation , cannot invoked in strict mode i new angular. don't understand should start debugging from? point? read couple of posts online , tried debug no help.

Handle submit event with jquery -

i'm trying handle forms submit event jquery, following never triggers: $.validator.setdefaults({ submithandler: function() { alert("hello"); var p = document.createelement("input"); // add new element our form. form.appendchild(p); p.name = "p"; p.type = "hidden"; p.value = hex_sha512(password.value); // make sure plaintext password doesn't sent. password.value = ""; // submit form. $("#registerform").submit(); } }); any ideas why?

android - LeakCanary how to interpret log -

i have been stuck 2 days memory leak problem app, have searched on internet solutions , encountered library called leakcanary. after adding necessary dependencies, launched app again. trying detect leak rotating phone , after couple of rotations app shows log. problem don't know how interpret log. here log leakcanary shows: 02-05 13:45:14.721 4258-4716/com.carlos.capstone d/leakcanary: in com.carlos.capstone:1.0:1. 02-05 13:45:14.721 4258-4716/com.carlos.capstone d/leakcanary: * com.carlos.capstone.mainactivity has leaked: 02-05 13:45:14.721 4258-4716/com.carlos.capstone d/leakcanary: * gc root static android.support.v4.content.localbroadcastmanager.minstance 02-05 13:45:14.721 4258-4716/com.carlos.capstone d/leakcanary: * references android.support.v4.content.localbroadcastmanager.mreceivers 02-05 13:45:14.721 4258-4716/com.carlos.capstone d/leakcanary: * references java.util.hashmap.table 02-05 13:45:14.721 4258-4716/com.carlos.capstone d/leakcanary: * references array ...

angularjs - Common html file should be included in index.html -

i have angularjs web app multiple views , controllers.i have html file named topnav.html included in views except 3.instead of including in views , want include in index.html . in views if that. have exclude 3 specific views. how do that? div class="container p-t-md" > <div ng-include="'views/topnav.html'"></div> <div class="row"> <div ng-include="'views/leftpanel.html'"></div> i include topnav.html in views except 3. instead want include in index.html .but problem i'm getting topnav.html in views including 3 views .but, don't want topnav.html included in 3 of views. know have use ng-if don't know put in it. you use ng-if accomplish excluding reference on specific page. need provide better example of trying do. create variable persists through of pages so: //make universal variable $scope.includejs = true; //put either in js of page want not have reference or ...

android - Session time-out in webservices -

i developing restful webservice using eclipse , android application. user logs in using username , password on android application checked against database @ server side(using web service). now, want maintain session user remain logged in, is, user not have log in again , again whenever re-opens application. how it? searched on net not find accurate solution. kindly appropriate solution. ask if more information required. use shared preferences save session data . there tutorials : http://www.androidhive.info/2012/08/android-session-management-using-shared-preferences/ http://androidexample.com/android_session_management_using_sharedpreferences_-_android_example/index.php?view=article_discription&aid=127

c - Comparing the characters -

i writing code solving arithmetic expression like: 4+3-2*6*(3+4/2) for need compare operators in string precedence like: 1. ( or ) 2. * or / 3. + or - can tell me how compare 2 characters. ascii values not in order want! use lookup table. if using ascii, 256 element table. index char.

css3 - So I have an HTML file with a paragraph and I need to break into three lines BUT i can only modify the CSS. How do I pull this off? (code below) -

<form method="post" id="contactform" action="#"> <fieldset> <legend>newsletter signup</legend> <p>to sign our fabulous campaign of useless information never, ever read, please submit email address here.</p> <label for="email" id="emaillabel">email</label> <input type="text" id="email" /> <input type="button" name="submit" value="submit" id="submitbutton"/> </fieldset> </form> so need paragraph on 3 separate lines has done css. if need in 3 line don't care lines break: p{ width: 300px; } but won't allow specify in sentence line breaks.

javascript - How can we increase slides limit to dynamic currently it set for only 3 slide -

i want create same fadein , fadeout effect shown in given below example: http://www.spicypeanut.net/slideshow/slideshow.html http://www.spicypeanut.net/blog/jquery%20slideshow.html but issue - example created 3 slides , want more 3 slides or need dynamically increased. but how modify script gets maximum amount of slides automatic? if generate slide dynamic within cms example no 1 can maximum number of slides be.. have update *.js everytime hand @ parts :/ if (this.last < 1) { this.last = 3; } if ($$.slideshow.counter > 3) { $$.slideshow.counter = 1; # } would nice if me (and think many others) @ point :) below js used in example: var $$ = $.fn; $$.extend({ splitid : function() { return this.attr('id').split('-').pop(); }, slideshow : { ready : function() { $('div.tmpslideshowcontrol') .hover( function() { $(this).addclass('tmpslideshowcontrolon'); }, ...

c# - Iterate through IEnumerable string array -

i'm reading multiple line text file has comma delimited values this: string[] lines = file.readalllines(path); ienumerable<string[]> resultarray1 = lines.select(x => x.split(',')); in debug mode when @ results this: [0] drill down see [0] "3.22" [1] "4.00 with following loop, can print out values, i'm not sure how without specifying [0] , [1] , i'm not sure how know line i'm on of file. have far: foreach (string line in lines) { foreach (string[] item in resultarray1) { console.writeline(item[0]); console.writeline(item[1]); } } could show me missing? for printing out separate elements in string[] , use for loop: foreach (string[] item in resultarray1) { for(var = 0; < item.length; i++) console.writeline(item[i]); } as keeping track of line of file on, have separate variable keep track of or change foreach for . bel...

javascript - Multiple Modals One Script -

i have around 40 different modals on same page, , rather having scrip line each, trying create way use 1 script run whole thing. started code worked display 1 @ time, tried re work time link clicked updates code , correct modal displayed. js fiddle i found others on here, didn't seem answer why mine wasn't working. new javascript, appreciated. var modal = "", lnk = "", lnknumb = "", modalid = "", lnkid = "", span = document.getelementsbyclassname("close")[0]; $('[class^="lnk"]').on('click', function(e) { e.preventdefault(); lnknumb = this.classname.replace('lnk', ''); lnkid = ('lnk' + lnknumb); lnk = document.getelementbyid(lnkid); modalid = ('modal' + lnknumb); modal = document.getelementbyid(modalid); }); // when user clicks link, open modal lnk.onclick = function() { modal.style.display = "block"; } // when us...

html - PHP exploding url from text, possible? -

i need explode youtube url line: [embed]https://www.youtube.com/watch?v=l3hqmbqawrc[/embed] it possible? need delete [embed] & [/embed]. preg_match need. <?php $str = "[embed]https://www.youtube.com/watch?v=l3hqmbqawrc[/embed]"; preg_match("/\[embed\](.*)\[\/embed\]/", $str, $matches); echo $matches[1]; //https://www.youtube.com/watch?v=l3hqmbqawrc

r - nested for loop to create histograms named according to list -

i'm new r , need create bunch of histograms named according population came from. when try running loop without "names" part, works fine. code below loops through list of names , applies them in order, end 3,364 versions of same exact histogram. if has suggestions, i'd appreciate it. popfiles <- list.files(pattern = "*.txt") # generates list of files i'm working poptables <- lapply(popfiles, read.table, header=true, na.strings="na") popnames <- read.table(file.path("path file containing names", "popnamesr.txt"), header=false,) popnames <- as.matrix(popnames) name <- null table <- c(1:58) (table in poptables){ (name in popnames){ pvals <- table$p hist(pvals, breaks=20, xlab="p-val", main=name)) } } try making distinct iterator, , use that, rather iterating on table list itself. it's easier see what's going on. example: pdf("myhistograms.pdf...

ember.js - EmberCLI - Determining environment from request early in the page lifecycle -

i have embercli app staging , prod both live on same s3 bucket, , in config/environment.js environment variable same. still need able specify different settings 2 "environments". the surefire way tell app running inspecting domain of request, i'm having trouble intercepting enough update settings. i've tried creating initializer inspect domain , update env object accordingly, seems it's late in page lifecycle have effect; page has been rendered, , addons not see proper settings. for 1 addon, had copy of code project , edit index.js file use proper keys based on domain, it's unwieldy. there better way this? trying make architecture work ill-advised? any advice more versed in ember appreciated. there's not great way handle staging environments right (see stefan penner's comment here ). that said think can achieve staging environment on s3 using ember-cli-deploy if add staging environment ember-cli-deploy config . , handle differen...

javascript - How can I access loaded scripts in index.html via ng-included templates? -

i'm angularjs-beginner , i've started using ng-include better structure html blocks. i'm using jquery.scrollto.js add button scroll top. i've noticed if place button inside tpl-footer.html , load via ng-inlcude while having jquery.scrollto loaded in index.html, won't work. either have place button inside index.html or load jquery.scrollto.js inside tpl-footer.html. my question: how can access loaded scripts in index.html via ng-included templates? cheers!

spring batch - getting exception while parsing xml with out root element -

i parsing(reading) xml file(without root tag) has multiple records through spring batch, throwing error. works fine root tag want parse without root tag. below exception: caused by: javax.xml.stream.xmlstreamexception: parseerror @ [row,col]:[640,2] message: markup in document following root element must well-formed. @ com.sun.org.apache.xerces.internal.impl.xmlstreamreaderimpl.next(xmlstreamreaderimpl.java:601) @ com.sun.xml.internal.stream.xmleventreaderimpl.peek(xmleventreaderimpl.java:276) @ org.springframework.batch.item.xml.stax.defaultfragmenteventreader.nextevent(defaultfragmenteventreader.java:114) @ org.springframework.batch.item.xml.stax.defaultfragmenteventreader.markfragmentprocessed(defaultfragmenteventreader.java:184) ... 33 more and fragmentrootelementname rtt <property name="fragmentrootelementname" value="rtt" /> below xml syntax: <rtt> <tranaction> </transaction> <data...

osx - How to run docker on mac offline -

when installed docker on mac, took ip intranet network. there after when switched different network showing me error $ bash --login '/applications/docker/docker quickstart terminal.app/contents/resources/scripts/start.sh' starting "default"... (default) waiting ip... many retries waiting ssh available. last error: maximum number of retries (60) exceeded regenerate tls machine certs? warning: irreversible. (y/n): regenerating tls certificates detecting provisioner... error getting ssh command: went wrong running ssh command! command : cat /etc/os-release err : exit status 255 output : error checking tls connection: went wrong running ssh command! command : ip addr show dev eth1 err : exit status 255 output : ## . ## ## ## == ## ## ## ## ## === /"""""""""""""""""\___/ === ~~~...