Posts

Showing posts from March, 2010

jsp - How can I get Site Title in Sakai -

is there way current site title in jsp page?tt i need send information soap webservice. thanks. ok. i've solved code. siteservice si= new siteservice(); si.getsite(sakaiproxy.getcurrentsiteid()).gettitle();

c# - Accessing a html page that is in a tab of a html page using Windows Phone 8 app -

i programming in c# , windows phone 8. trying access html page (lets students subject grades[page 2]). this html page referenced href tag placed within html page (the students home screen after log in [page 1]), have accessed using httpclient object of postasync function. i need know way can programmatically click specific link (from page 1 page 2). i know how access href content using htmlagilitypack, don't know how load "that"(page 2) html page specific , different every individual. thank in advance. if can access href htmlagilitypack can call postasync url being href link.

WP8 C# // Save image from web, in isolate storage -

i know how save image in isolate storage using following : private void addbutton_click(object sender, routedeventargs e) { memorystream stream = new memorystream(); writeablebitmap wb = new writeablebitmap(myimage, null); bitmapimage bi = new bitmapimage(); wb.savejpeg(stream, wb.pixelwidth, wb.pixelheight, 0, 100); stream.seek(0, seekorigin.begin); string data = convert.tobase64string(stream.getbuffer()); appsettings.add("image", data); } i know how load using following : private void loadimage_click(object sender, routedeventargs e) { byte[] imagebytes = convert.frombase64string(appsettings["image"].tostring()); memorystream ms = new memorystream(imagebytes); bitmapimage bitmapimage = new bitmapimage(); bitmapimage.setsource(ms); myimage.source = bitmapimage; } but don't know how load , read url, h...

xcode - SQLite.swift Module file was created by an older version of compiler -

i have been using xcode month. have xcode 6 installed , created project used sqlite.swift project stephencelis github. had been running fine , think must have inadvertently loaded xcode update morning. on xcode version 6.3. when open project , perform build error on line in 1 of units "import sqlite". error message reads: "module file created older version of compiler". prior had 50+ errors in sqlite source files had downloaded latest zip sqlite , opened project , performed build worked no errors. if go , compile project error mentioned in subject. i think don't know how use these libraries github or if specific sqlite. appreciated. short answer: alt/option + product menu > clean (becomes "clean build folder") trying apply this answer had set "defines module" under packaging yes app's build settings in xcode 6.4. then, trying apply this answer opened project again in xcode 7.0 beta. when got error. following @...

javascript - d3: Multi-Foci Force key code component understanding -

the real magic multi-foci force done here; function tick(e) { var k = .1 * e.alpha; // push nodes toward designated focus. nodes.foreach(function(o, i) { o.y += (foci[o.id].y - o.y) * k; o.x += (foci[o.id].x - o.x) * k; }); node.attr("transform", function(d) { return "translate(" + d.x + "," + d.y + ")"; }); } but i'd appreciate clarification what's going on. alpha, believe, force method controls rate @ force comes rest, accepting values in range [0, 1] - higher values cause force slow halt slower, lower values faster. we iterate through original array , increment x , y locations (which don't exist initially, these assigned first time on first iteration of foreach loop) k * x , y components of focus point. ultimately they'll moving towards designated x , y positions, how guarantee them there based on k value based on alpha? extent nodes move along x , y axes controlled .1 cons...

java - Converting language names to ISO 639 language codes -

i need convert language names 'hungarian', 'english' iso 639 codes. iso 639-6 best iso 639-2 enough. what's best way achieve this? i should convert english locale , language getlanguage()? if thats way how can convert string 'english' java locale? my goal store book language info using iso 639 codes. you can list of iso 639-2 codes passing regular expression of language names languagealpha3code.findbyname(string) (in nv-i18n library). the following example code command-line tool converts given language names corresponding iso 639-2 codes. import java.util.list; import com.neovisionaries.i18n.languagealpha3code; public class to639_2 { public static void main(string[] args) { // each language name given on command line. (string languagename : args) { // list of iso 639-2 codes (alpha-3 codes) // language name matches given pattern. list<languagealpha3code> list ...

mongodb - How to check if a portion of an _id from one collection appears in another -

i have collection _id of form [message_code]-[language_code] , _id [message_code] . i'd find documents first collection message_code portion of _id not appear in second collection. example: > db.cola.find({}) { "_id" : "trm1-en" } { "_id" : "trm1-es" } { "_id" : "trm2-en" } { "_id" : "trm2-es" } > db.colb.find({}) { "_id" : "trm1" } i want query return trm2-en , trm-es cola. of course in live data, there thousands of records in each collection. according this question trying similar, have save results query against colb , use in $in condition in query against cola. in case, need strip -[language_code] portion before doing comparison, can't find way so. if else fails, i'll create new field in cola contains message code, there better way it? edit: based on michael's answer, able come solution: var arr = db.colb.distinct("_id") var re...

Python: Why are sufficiently large floating point values infinite? -

>>> 1e100000000 inf >>> 1000000 ... [400 zeroes snipped] ... 000000 1000000 ... [400 zeroes snipped] ... 000000 >>> 1000000 ... [400 zeroes snipped] ... 000000.0 inf why python decide large floats infinite? if representation can't represent value, expect give error, does: >>> 10.0 ** 1000000000000000000000000000000000000000000000000000000 overflowerror: (34, 'numerical result out of range') why first case silent if second case complains? because tried create floating point number larger largest value representable in floating point value. see sys.float_info named tuple ; sys.float_info.max largest value representable in such values. python floats, unlike python integers, have upper limit determined os , hardware platform, integers limited available memory. on mac, maximum value is: >>> import sys >>> sys.float_info.max 1.7976931348623157e+308 so 1 308 zeros representable, 2 many zeros not: ...

Meteor CLI + Heroku -- Deploying with a Flag in the CLI -

i'm testing older package , won't run unless boot meteor with: meteor --allow-incompatible-update it's intention deploy application heroku. i'm using buildpack accomplish this: https://github.com/jordansissel/heroku-buildpack-meteor how 1 deploy app heroku while passing in flag/setting on cli? you need fork buildpack , edit line: https://github.com/jordansissel/heroku-buildpack-meteor/blob/master/bin/compile_meteor#l64 meteor build ../build --allow-incompatible-update --directory 2>&1 | indent you can use fork buildpack.

csv - Powershell using where-object -

i using powershell , having trouble where-object cmdlet. select * , want output when field equal alabama . field under column, not one. this have: select * | {$_.state_name -eq 'alabama'} . this works state_name, cant columns without doing them individually. i've tried where{$_ -eq....} doesn't work. kind of hack, but: select * | {($_ | convertto-csv -notypeinformation)[1] -like '*"alabama"*'}

enthought - Python equivalent to radical() in Sage? -

i'm working on code generate number of triples satisfying abc conjecture less given quality , within specified integer range. wrote code in sage, has radical() function built in. i need figure out way perform same task in python, have of yet been unable do. any advice or resource recommendations on building radical function, i.e. given integer output largest squarefree divisor of integer?

sql server - SQL: Return multiple oldest records only -

i'm attempting return string using complicated bit of sql, cant return based on same phonenumber newest d.createdatetime, instance source calldata phonenum fk_ref d.createdatetime source 1 609 ^mr richard smith^01234567891^ 01234567891 27657 16/06/2014 source2 1 609 ^mr richard smith^01234567891^ 01234567891 27657 21/07/2014 source3 1 609 ^mr richard smith^01234567891^ 01234567891 27657 03/10/2014 expected result source calldata phonenum fk_ref d.createdatetime source3 1 609 ^mr richard smith^01234567891^ 01234567891 27657 03/10/2014 however can't seem find way effectively, attempts using sql server: select rows max(date) , t-sql select rows oldest date , unique category does not work, or rather can't find place insert said data query. if can understand (somewhat complicated) sql query enough help, beyond amazing. thank you code below --create table ...

xml - Rotating SVG CSS Animation in Firefox Not Working, and Need SVG Fallbacks -

i'm trying animate these gears, , works intended in chrome. however, in firefox rotation origin different, , can't figure out how fix this. i've tried playing width, height, viewbox, , x & y attributes, nothing seems work perfectly. based on svg rotate path example . and finally, best practice providing proper fallbacks svg paths in other/older browsers not support graphic/animation? the rest of code here: jsfiddle here (html + svg code long paste) css: #gear-head { position: fixed; background: #172235; width: auto; height: 100%; } #gear-head .gear { -webkit-animation: rotation 6s infinite linear; -moz-animation: rotation 6s infinite linear; -o-animation: rotation 6s infinite linear; animation: rotation 6s infinite linear; transform-origin: 50% 50%; -webkit-transform-origin: 50% 50%; -moz-transform-origin: 50% 50%; } @-webkit-keyframes rotation { { -webkit-transform: rotate(0deg); } { -webkit-transform: rotate(359deg)...

Jmeter Reset Beanshell -

so jmeter's beanshell sampler has option "reset before each call." in jmeter's documentation, mentions "this may necessary long running scripts." there reason wouldn't want this? it's set false, assume there be, haven't found on this. from beanshell scripting overview: each beanshell test element has own copy of interpreter (for each thread). if test element repeatedly called, e.g. within loop, interpreter retained between invocations unless "reset bsh.interpreter before each call" option selected some long-running tests may cause interpreter use lots of memory; if case try using reset option. so in general: if beanshell script doing "light" - shouldn't need worry resetting interpreter if script "heavy" operations, calculations or being used primary load generator recommend reconsider sampler choice , start using jsr223 sampler , groovy language instead. given proper configuration...

c++ - Boost python extract module name during compilation -

what best way extract name of boost module i'm compiling makefile? i'm afraid might have practically write crude c compiler in order extract pattern matching. the basic hard-coded version have (i haven't tested it. i'm using example): sources=test.cpp boost_features.cpp util.cpp objects=$(sources:.cpp=.o) # extract module name here \/\/\/ lib=$(patsubst ') {',,$(patsubst 'boost_python_module(',,$($(shell grep 'boost_python_module(*) {' $(sources))))) cflags=-fpic -wall .phony: clean $(lib): $(objects) g++ -shared -o $@ $(objects) -i/usr/include/python2.6 -lboost_python -lpython2.6 $(cflags) @echo done compiling! boost_features.o: util.h $(objects): %.o : %.cpp g++ -c $< -o $@ -i/usr/include/python2.6 -lboost_python -lpython2.6 $(cflags) clean: rm -rf $(objects) $(lib)

php - cakePHP 3.0 HABTM relations save data -

i want make tutorial http://miftyisbored.com/complete-tutorial-habtm-relationships-cakephp/ in cakephp 3.0 i have 3 tables: recipes, ingredients , ingredients_recipes. when making recipe, want select ingredients. want store recipe_id , ingredient_id in ingredients_recipes table, fail so. think there's wrong in recipescontroller. can me or point me in right direction? problem: $ingredients = $this->recipes->ingredients->find('list', ['limit' => 200]); // => gives me message "the recipe not saved. please, try again." $ingredients = $this->ingredients->find('list', ['limit' => 200]); // => gives me error "call member function find() on boolean" when var dump (when using $this->recipes->ingredients->find) this: array(3) { ["recipe_name"]=> string(4) "test" ["recipe_description"]=> string(4) "test" ["recipe"]=> a...

multidimensional array - How do I retrieve data csv just a few lines with php -

i have csv file results of scanning. want read first column , read lines , including line 6. this have tried: <html> <body> <h1>mac address have been verified</h1> <table width="50%" border="1"> <tr> <th>no</th> <th>mac address</th> </tr> <?php if (($handle = fopen("data.csv", "r")) !== false) { $row = 1; while (($data = fgetcsv($handle, 1000, ",")) !== false) { echo "<tr>"; echo "<td><center>".$row++."</center></td>"; echo "<td>".$data[0]."</td>"; echo "</tr>"; } //end while fclose($handle); } //end if ?> </table> </body>enter code here </html> the important line below if ( $row > 6 ) break; <?php $row = 1; if (($handle = fopen("test.csv", "r...

cmake: how to define target without linking (compilation only) -

is there simple way create target object files aren't linked? need additional target tests if compiles arm. don't want create executable (it not link anyway), because project part of bigger, has own old stable make-based build system. so need compile sources. tests done other, pc target compiled gcc. you can use object library . add_library(dummy object <source files>)

git - Very slow download from GitHub -

when cloning repository github download rate between 50-100 kib/sec (staying stable) while of time have 10 mib/sec. when cloning same repository different machine (= different global ip) full speed. does github impose rate limit on repository cloning? repository in question quite big (~100 mib) , clone twice day. do have massive binaries committed in repos? might it. otherwise, @ optimizing ci's behavior. instead of: git submodule update [--recursive] you want: git submodule update [--recursive] --depth 1 ci doesn't need whole repo history, target state. more details here: git shallow submodules

apache - WebDAV configuration, getting error related to require valid-user using lazy sessions -

i'm trying configure webdav environment. however, keep getting error: htaccess: require valid-user not given valid session, using lazy sessions? looking @ fiddler, see http code 500. all google searches seem include references shibboleth, have installed, not calling in path structure. <directory "/path/to/webdav"> options indexes multiviews followsymlinks allowoverride none order allow,deny allow </directory> <virtualhost *:443> servername my.domain.com documentroot "/path/to/root" ... alias /aaa/bbb /path/to/webdav/aaa/bbb <location /aaa/bbb> options indexes dav on authtype basic authname "webdav" authuserfile /path/to/webdav.pwd require valid-user </location> </virtualhost> solution below... essentially, there's blanket requirement shibboleth session in last lines of host configu...

google reader - creating blogroll by inoreader, feedly or similar ones -

Image
in google reader(r.i.p) select interesting links special tag , make public them , show links on our blogs or websites. is there way create google reader alternatives inoreader or feedly or digg reader or aol reader or etc? please. i should start saying i'm bdfl of inoreader, feel obliged answer you. if thinks answer inappropriate or can achieved 1 of other mentioned options, feel free bash me in comments :) yes, can in inoreader . since familiar google reader, shouldn't have difficulties starting it, if have, here's quick guide started. depending on need achieve option want accessible via right-click on folder or tag: then in dialog pops up, see export option. click , 3 links - rss feed, html page (what need) , public opml file (for folders only): a few notes on folders , tags: folders used group sources (rss, social , other feeds) , content inside them automatically populated feeds. tags on other hand mostly manually populated you...

sql - Collate hint on QueryDSL- JPA -

there way execute querydsl? ( bold part ): select * venue name '%cafe%' collate latin1_general_ci_ai i using jpa hibernate. you can use addflag(queryflag.position position, string flag) method, documented here . something similar following should want: query.addflag(queryflag.position.end, "collate latin1_general_ci_ai"); in response question, if require solution supports more 1 predicate, use booleantemplate 's create(string template, object one) method, documented here . something similar following should want: booleantemplate.create("{0} collate latin1_general_ci_ai", venue.name.like("%cafe%")); your query should like: query .from(venue) .where(booleantemplate.create("{0} collate latin1_general_ci_ai", venue.name.like("%cafe%")) .and(booleantemplate.create("{0} collate latin1_general_ci_ai", venue.name2.like("%milk%")))) .list(venue.name, venue.name2);

ios - Arbitrary SQL with NSArray as Statement Argument -

i use sqlite.swift , want create sql statement this: "select * user id in({userdtoids})" i did let arr:[string] = // nsarray of strings let stmt:statement = db.prepare("select * \(tablename) id in(?)") but stmt.run() not allow [string] argument. how can use nsarray argument sql statement in sqlite.swift ? if you're using type-safe layer, can use contains() : table.filter(contains(ids, id)) // above assumes boilerplate precedes it: let table = db["tablename"] let id = expression<int64>("id") let ids: [int64] = [1, 2, 3, 4, 5] // e.g. if you're using raw sqlite3 api, not support arrays, you'll need format yourself: let template = join(", ", [string](count: count(ids), repeatedvalue: "?")) let stmt = db.prepare( "select * \(tablename) id in (\(template))", ids )

Tkinter Toplevel widgets not displaying - python -

i working toplevel window in python tkinter , cannot seem embedded widgets show until other code has completed. frame shows up, loops through other code properly, text/progressbar widget show if somehow interrupt loop. frame destroyed @ end. see below. here toplevel code: class progresstrack: def __init__(self, master, variable, steps, application): self.progress_frame = toplevel(master) self.progress_frame.geometry("500x140+30+30") self.progress_frame.wm_title("please wait...") self.progress_frame.wm_iconbitmap(bitmap="r:\\chpcomm\\sls\\pssr\\bin\\installation_files\\icon\\psidiarylite.ico") progress_text = canvas(self.progress_frame) progress_text.place(x=20,y=20,width=480,height=60) progress_text.create_text(10, 30, anchor=w, width=460, font=("arial", 12), text="please not use " + application + " during execution. doing so, interrupt execution.") ...

ios - Get to specific tabView object from App Delegate -

trying launch specific tabview object app delegate when receive notification, app crashes on launch. here code: uistoryboard *storyboard = [uistoryboard storyboardwithname:@"main" bundle:nil]; uiviewcontroller *viewcontroller; customtabviewcontroller * tabbar = [[customtabviewcontroller alloc] init]; nsdictionary *notificationpayload = launchoptions[uiapplicationlaunchoptionsremotenotificationkey]; nsstring *type = [notificationpayload objectforkey:@"type"]; if([type isequaltostring:@"friend"]){ tabbar.selectedviewcontroller = [tabbar.viewcontrollers objectatindex:2]; self.window.rootviewcontroller = tabbar; [self.window makekeyandvisible]; } if([type isequaltostring:@"message"]){ tabbar.selectedviewcontroller = [tabbar.viewcontrollers objectatindex:0]; self.window.rootviewcontroller = tabbar; [self.window makekeyandvisible]; } any ideas?

asp.net mvc - Store update, insert, or delete statement affected an unexpected number of rows (0).Refresh ObjectStateManager -

this issue driving me crazy last 1 week. please help. store update, insert, or delete statement affected unexpected number of rows (0). entities may have been modified or deleted since entities loaded. refresh objectstatemanager entries. public actionresult add(user userdetails) { _userservice.insert(userdetails); _unitofworkasync.savechanges(); // lines gives above error } using maptosp technique inserting data db using ef code first approach. this.maptostoredprocedures(e => e.insert(v => v.hasname("uspinsertuser")));

bash - Sensu check for MySQL long running Queries. -

i need build test / checker ( ruby, python, bash , personal pref) check long running queries every few minutes. incorporate sensu, , alarm if threshold met. sensu able alarm ( or can set custom slack notifications ) honestly not sure start. looking how guys approach issue. great! i can provide sample of used test other things on db if help. you execute following queries in context of checker activate slow query log , read name of file logs slow query contents: activate slow query log file: set global log_slow_queries = 'on'; get path slow query file: show global variables '%slow_query_log_file%' you can monitor file slow queries.

php - Simple way to change mysql_query() to MySQLi or PDO or more secure method? -

this question has answer here: how can prevent sql injection in php? 28 answers i'm pretty new php , trying learn more in area of making forms secure db more difficult mess via sql injection , such. current web programmer/php guy @ our company quit short notice boss has placed me in php programmers position temporarily single week of training under previous programmer (i lots of html , css work, no php prior), until can find real replacement. anyways, read using mysql_query() depreciated function , should avoided because method vulnerable. see 2 options use pdo or mysqli. being new php, i'm having trouble figuring out need convert code using (which sends info request quote form on site , stores in database incase of email troubles) more secure method of sending data database via pdo or mysqli. the current line of code i'm using is: $query = mys...

sparql - Jena ARQ returns non-empty result for AVG() if there is no matching triple pattern -

i have query uses avg() operator: select (avg(?z) ?avg) { ?x <http://ex.com/value> ?z } let's imagine triple store doesn't have triples matching given triple pattern, expect (at least do) query should return empty result. , virtuoso returns empty result, can use dbpedia's sparql endpoint check ( execute ). but fuseki , jena arq return non-empty result: 0 . can check on sparql.org ( execute ). is possible configure jena arq return empty result given query? if so, how? we expect (at least do) query should return empty result. , virtuoso returns empty result, can use dbpedia's sparql endpoint check. but fuseki , jena arq return non-empty result: 0. can check on sparql.org. i don't know whether can change behavior of avg , shouldn't , because jena doing right thing here, , virtuoso (the endpoint dbpedia) doing wrong. sparql 1.1 standard defines avg return when group empty: 18.5.1.4 avg the avg set function ...

ios - Should I call setMinimumBackgroundFetchInterval every time the app restarts? -

i developed app uses background fetch. set minimum interval between updates minimum: [[uiapplication sharedapplication] setminimumbackgroundfetchinterval:uiapplicationbackgroundfetchintervalminimum]; i thought value saved system, don't have set again when/if app restarts. however, i've noticed last background fetch on 1 of devices 2 weeks ago. know, interval between updates can vary, don't think 2 weeks normal. considering fact worked several months, calling background update every 20-30 minutes. unfortunately, couldn't find way minimumbackgroundfetchinterval check theory (does know how way?). checked application.backgroundrefreshstatus , , equal uibackgroundrefreshstatusavailable , think (i'm not sure) means user allows app use background updates. well, turned out no, don't need call setminimumbackgroundfetchinterval every time app restarts . i had experiment: set uiapplicationbackgroundfetchintervalminimum (turned background fetch on), ...

javascript - Make an html5 video buffer less before playing -

when clicks watch video on site (mp4 in html5 video tag) - browser buffers lot of before showing it. not needed - video less half minute long, , has shown half of time whole video has been downloaded. is there way tell browsers not buffer much? there's been lot of discussion in comments regarding whether can done, i'll provide media source-specific answer here. media source extensions , or mse, new (and not yet widely-supported) set of tools control buffering , streaming html5 videos. w3c abstract: this specification extends htmlmediaelement allow javascript generate media streams playback. allowing javascript generate streams facilitates variety of use cases adaptive streaming , time shifting live streams. i'll refer sourcebuffer object , has information on how audio & video track buffering handled. support mse varies browser , format ( source ): chrome desktop 34+ (mp4, webm) chrome android 34+ (mp4, webm) ie 11+ on windows 8.1 (mp4) i...

How Can I disable streaming for the Mule SFTP connector -

how can disabled mule sftp connector streaming functionality, don't find property this not quite sure why disable streaming. if unable handle , process stream in application , want transform stream object processing, can consider transforming stream data object using byte array object transformer.

android - Getting the value of each Spinner from multiple Listview rows? -

i have custom list view. displaying product image spinner (product size dropdown) , price on each row. the user pick size products press button sumbiting selected products proper sizes. in activity opens next show order total number, price , size of selectes products. how loop trough , value each row of listview can calculate , show total price , selected spinner entries (there no database, values added user)? thanks! you can values different spinners string text = spinner.getselecteditem().tostring(); similarly others values total number,pice , size etc. , can pass these values via intent other activity , these values in activity via getintent()

javascript - Adobe Livecycle - Creating an object -

i want create object in livecycle. let want create object person hold name , address , age , profession . javascript example, simple. function person(name, address, age, profession) { this.name = name this.address = address this.age = age this.profession = profession } but how can in livecycle ? !

Join two data sets by year in Tableau -

Image
i have 2 datasets looks like: # 2013_data.tsv year state age 2013 ca 22,5 2013 oh 19,3 2013 il 45,5 2013 tx 33 # 2012_data.tsv year state age 2012 ca 23 2012 oh 21,5 2012 ca 44,3 2012 tx 34,4 i want use year pager on tableau map. how can join separate data sources? you blend on year, if year different in each data source blend not match on , no results. i guessing each data source (tsv file) has same format (same number of columns , column names). in case can extract each data source tableau desktop , add data each source master extract. (you appending data extracts): and data in 1 extract: from here simple combine years in 1 visualization. also, since so, point out can programatically extract api (see https://www.tableau.com/learn/tutorials/on-demand/extract-api-introduction ).

c# - Efficiently requesting multiple entities -

i need request lists of different entities without relation (in order create relation). example: var attributegroups = db.attribute_group.where(g => attributegroupids.contains(g.id)); var attributes = db.attribute.where(g => attributeids.contains(g.id)); when iterate results later, make multiple database calls? there way make 1? your option calling stored procedure return multiple resultsets. see http://romiller.com/2012/08/15/code-first-stored-procedures-with-multiple-results/

asp.net - Duplicate Page Content for SEO -

my seo tool telling me https://example.com has duplicate content pages. url(s) duplicate page titles https://example.com/employment/default.aspx https://example.com/employment/default.aspx https://example.com/employment/default.aspx i have iis6 , used rewrite lowercase rule solve this, problem solved on browser , urls lowercase still have duplicate pages , seo tool still showing duplicates want write rule on iis rid of duplicates ps: https://example.com same page https://example.com/employment/default.aspx assuming content on pages same , is, in fact, same page (with different urls), rel=canonical best bet. tell googlebot (and bing, etc) default.aspx same default.aspx, , attribute search relevancy receive default.aspx default.aspx. on proper canonical tags here: https://support.google.com/webmasters/answer/139066?hl=en alternatively (and perhaps used in conjunction with), there 301 permanent redirects. this accomplishes same canonical, permanently redire...

spring data mongodb "id" field mapping -

i have document array field with "chapters": [ { "id" : "14031871223912313", ...} ... ] i query return id's spring data's mongotemplate using following: class chapter { private string id; public string getid() { return id; } } this way id not populated. have tried using different mapping options @field described here http://docs.spring.io/spring-data/mongodb/docs/current/reference/html/#mapping.conventions.id-field what doing wrong? know can mongo java driver, thought should work. thanks in advance help. found solution. populated via: @field("id") private string chaperid

graphics - Java: draw a rectangular spiral with drawLine -

Image
i'm working on java programming exercise i'm supposed draw rectangular spiral drawline method. here's have far, spiral comes looking incomplete. import java.awt.graphics; import javax.swing.jpanel; import javax.swing.jframe; public class rectspiral extends jpanel { public void paintcomponent(graphics g) { int width = getsize().width; int height = getsize().height; int widthcenter = width / 2; int heightcenter = height / 2; (int = 0; < 4 ; i++) { g.drawline(widthcenter + (20 * i), heightcenter + (20 * i), widthcenter + (20 * i), heightcenter + 20 + (20 * i)); g.drawline(widthcenter + (20 * i), heightcenter + 20 + (20 * i), widthcenter - 20 - (20 * i), heightcenter + 20 + (20 * i)); g.drawline(widthcenter - 20 - (20 * i), heightcenter + 20 + (20 * i), widthcenter - 20 - (20 * i), heightcenter - 20 - (20 * i)); g.drawline(widthcenter - 20 - (20 * i), heightcente...

c++ - Variable Domain Reduction in Halide -

right i'm trying write halide code subsamples image. want every 2 2 square of image reduced 1 pixel contains maximum. simple example transforming 1 2 3 4 5 6 7 8 9 0 1 2 4 3 5 6 into 6 8 9 6 right i'm trying along lines of (i'm aware give sum instead of maximum, it's toy example of same process): halide::image<uint8_t> input = load<uint8_t>("test.png"); halide::image<uint8_t> output(input.width() / 2, input.height() / 2, input.channels()); halide::func subsample; halide::var c; (int = 0; < input.height(); += 2) { (int j = 0; j < input.width(); j += 2) { halide::rdom r = halide::rdom(i, 2, j, 2); subsample(i, j, c) += input(r.x, r.y, c); } } subsample.realize(output); save(output, "test.png"); however, code runs infinitely. (i'm not sure why). know can use halide::rdom represent reduce operation on range. however, in no example find can pass variable random domain...

php - Google Calendar Events -

i having trouble adding events google calendar. can list events when try add event getting 403 forbidden error. able add events primary, when try one, in case 1 i've mnetion, run 403 forbidden error. here code have: require_once 'vendor/autoload.php'; define('application_name', 'calendar'); define('credentials_path', 'credentials/calendar.json'); define('secret_path', 'secret.json'); define('scopes', implode(' ', array(google_service_calendar::calendar))); function getclient() { $client = new google_client(); $client->setapplicationname(application_name); $client->setscopes(scopes); $client->setauthconfigfile(secret_path); $client->setaccesstype('offline'); $credentials_path = credentials_path; if (file_exists($credentials_path)) { $access_token = file_get_contents($credentials_path); } else { // $auth_url = $client->createauthurl()...

java - Domain Objects to map -

we building micro-service rest api in groovy part of more complex application. service simple crud operations. we using groovy , on need pull record database ( mongodb ), , return object after changing format of fields ( backward compatibility ), on these lines: def object = collection.findone(query) object.field3 = object.field2.collect { [..]} return object i not experienced in groovy or java ( worked more extensively on ruby/python/clojure ), have domain object: class foo { string _id string field1 array field2 map tomap() { [field1: field1, field3: field2.collect {}, field2: field2] } } and go foo = new foo(objectmapfromdb) foo.tomap() and of benefits see using approach can @ domain object , have idea of structure of object in database is, can type safety if want more importantly ( , that's drove decision ) code converting map encapsulated in function , can re used in other part of project a more senior developer questioned approach mentio...

sql server - use client side database to show results in webpage -

there used software in industry deploys , uses local ms sql database. (it runs on windows os's) i have vbs script / .net application / php page search specific local variables registry, ie computer name. using default read username , password, , detail acquired registry, script can run sql queries against such database, , give user real time reports own data. financial data (ie debtors listings), demographic data, or line-of-business data. i'd add web page website users of industry software click on link on website queries sql database using default read username , password, , shows them reports on own data. is possible? (from security perspective hope not, pretty cool if can achieved, if user had manually enter server name, or local windows username , password authenticate - work me)

regex - Sublime Text dirty search? Need some keywords to do research on -

Image
if have used sublime text, know if open command palette ctrl | command + shift + p , start typing he , it'll bring of entries have h , e same order not adjacent. like: i'm looking keywords how implemented word think had heard of before dirty up doesn't take me anywhere. term, keyword or resource on called and/or how it's implemented appreciated. i think there mechanism that: splits letters provided looks upper case first highlight in words have largest amount of these characters if above not found, highlight first occurrence

javascript - How do I add lines in between paragraphs from inputted textarea text? -

i creating small webpage act teleprompter. users arrive @ page, copy , paste text text area, , text displayed in teleprompter fashion. text copied google drive or office. my question how add blank lines in between paragraphs (like when enter has been pressed) when take text text area < p > tag using java script? thanks in advance! you need take new lines ( \n ) text area , convert them <br /> . fiddle: https://jsfiddle.net/62bfv61d/1/ should work you.

Google Analytics Events for li items -

i'm trying add google analytics click tracking events li list items (active thumbnails) used in responsive grid application, , can't working. i've researched here , in google developer forums without success. i'm sure there simple i'm doing wrong. have latest ga script code installed (page view analytics working fine). here code sample: <ul> <li data-type="link" data-url="http://www.dianagabaldon.com/books/outlander-series/" data-target="_self" > <a href="#" onclick="_gaq.push(['_trackevent', 'gridlinks', 'click', 'outlander clicks 1']);"></a></li> <li data-thumbnail-path="outlander_files/thumbnails/outlanderbookseries1.png" ></li> <li data-thumbnail-text > <p class="largelabel" >diana gabaldon - outlander series</p></li> </ul> hope can help. feel free sugge...

Matlab understanding ode solver -

i have system of linked differential equations solving ode23 solver. when threshold reached 1 of parameters changes reverses slope of function. i followed behavior of ode debugging function , noticed starts jump in "time" around point. generates more data points.however, these not represented in final solution vector. can explain behavior, why not calculated values find way solution vector? //edit: clarify, behavior starts when v changes 0 other value. (when write every value of v vector has more 1000 components while ode solver solution has ~300). find code of equations below: %chemostat model, based on: %dcc=-v0*cc/v + umax*cs*cc/(ks+cs)-rd %dcs=(v0/v)*(cs0-cs) - cc*(ys*umax*cs/(ks+cs)-m) function dydt=systemequationsribose(t,y,funv0ribose,v,umax,ks,rd,cs0,ys,m) v=funv0ribose(t,y); %funv0ribose determines v dependent on y(1) if y(2)<0 y(2)=0 end dydt=[-(v/v)*y(1)+(umax*y(1)*y(2))/(ks+y(2))-rd; (v/v)*(cs0-y(2))-((1/ys)*(umax*y(2)*...

sed - Add few line with in the middle of a file -

i want add few in file. possible use sed? original file test1 test2 test3 expected output after adding new line test1 # testing123 # test3 if don't mind using "while/read" instead of "sed", 1 solution: [~]$ cat original.txt test1 test2 test3 [~]$ cat new_content.txt # testing123 # then, process both files following script: script.sh #!/bin/bash while ifs= read -r line if [[ $line =~ ^test2.*$ ]] cat new_content.txt else echo "$line" fi done < original.txt

bash - How can I create a cover-page style text file via Linux script? -

i'd firstly point out i'm total noob when comes linux scripting, i'm trying create cover page via script , totally lost when comes formatting. so far, have #!/bin/bash studentname = "jeremy" studentnum = "0281190" coursesection = "702" read -p "please enter course name: " coursename read -p "please enter course number: " coursenum read -p "please enter instructor name: " instrutornam read -p "please enter submission date: " subdate read -p "please enter submission title: " subname read -p "submission subject: " subsubject touch coverpage.txt echo $subname $subdate >> coverpage.txt what i'm trying have user enter main information contained in cover page, best output i've ended far cluttered top corner. apologies in advance lack of clarity, not sure start. this bash function center text on screen: ctr() { s="$*"; width=$(( ($col...

Inject Javascript in Firefox -

is possible autorun script, example scratchpad in firefox? want add 1 button website without making extension, because don't need use xul , rtf. maybe can make add-up, containing js file? you might want take @ greasemonkey . allows add javascript file page.

database - Fastest way to move data from one table to another in Postgres -

background info on postgres server have few tables accessed business intelligence applications ideally should stay available of time. tables flushed , reloaded our etl pipeline on nightly basis (i know... due legacy setup can't use incremental updates here). loading process takes pretty long , not bullet-proof stable yet. to increase availability of tables, decided use staging tables load downstream data our etl pipeline first, , if loaded successfully, copy data on actual production tables. here copy function created purpose: create or replace function guarded_copy(src text, dest text) returns void $$ declare c1 integer; c2 integer; begin execute format('select count(*) %i', src) c1; execute format('select count(*) %i', dest) c2; if c1>=c2 execute format('truncate table %i cascade;', dest); execute format('insert %i select * %i;', dest, src); end if; ...

css - DIV overflow:auto percentage width using content and not parent to set width -

i have div , such below, , following classes applied them. want wrapper div scroll when necessary , fit 100% of screen width. problem i'm seeing wrapper div , when set width: 100% using width of contents , not parent. the wrapper div in question #pagecontent_headingswrapper . on smartphone's small viewport, width: 100% expanding outside of screen , making page large. don't know why. any ideas? also, want horizontal row of boxes in pagecontent_headings. in order inline-block elements in single horizontal line, have set width of pagecontent_headings 800 pixels, makes pagecontent_headingswrapper become same width, instead of parent. <div id="pagecontentwrapper" class="default"> <div id="pagecontentwrappercell"> <div id="pagecontent_headingswrapper"> <div id="pagecontent_headings"></div> </div> <div id="pagecontent_content">...

Cordova plugin for network information always return connection.type=UNKNOWN on iOS simulator -

i trying check internet connection on app. when launch app on ios emulator, doesn't work! have use code: https://gist.github.com/welcomattic/c6415563d6607fbedf3e i have 2 problems: 1) when debug, see $ionicplatform.ready (line 16 of code on github) never fired. i've tried know understand why didn't find solution. 2) have tried make code work without $ionicplatform.ready. connection.type= unknown. have changed code several times, 'unknown'. so wonder, 1) simulator doesn't support plugin? 2) there problem code or missing something? thank answers! well, have found solution (it small things drives crazy). here answer: i using command: $cordova emulate ios emulate app using ionic platform: "$ionic emulate ios" what can bring confusion app launch "$cordova" , work functionalities won't. confuses me. anyway... if had same issue, sure remove ios platform obtained using "$cordova platform add ios" , ...

How can I simplify boolean Algebra Expressions without using outside Java addons? -

i trying take boolean algebra expression generated part of project , simplify before output it. boolean expression include or statements due nature of rest of program. an example starting expression ac + bc + bc + ab + ac + ac + ab , ending + c. lower case letters indicate not e.g. means not a. i have struggled hours trying figure out, every time solve 1 case ruin another. imagine there recursive function problem struggled find elsewhere. edit: clear, understand how simplify expression on paper, unable simplify using java. thanks in advance. public static void mutate (arraylist<string> final, arraylist<string> factored, string a){ int multiples = 0; string holder = ""; (int = 0; < final.size(); i++){ if (final.get(i).contains(a)){ multiples++; if (multiples == 1) holder = final.get(i); if (multiples >=2) factored.add(final.get(i)); } } if (multiples > 1) factored.add(holder); } public static void simpl...