Posts

Showing posts from September, 2015

c - CUDA code not processing if block properly -

stuck @ if block right below //step 5, issue code not progress or after given if block. need figure out how particular issue settled before starting task of generating parallel code. if run code see 1 print statement indicates value of "one" , 2 "i" , "j". after if block begins, none of other print statements hit. result quite stuck, aware specific issue, however, cannot seem determine it's cause. any appreciated! in advance! input file sample. >386.fasta.screen.contig1 gagtttgatcctggctcagaatcaacgctggcggcgcgcttaacacatgc aagtcgaacgagaaagtggagcaatccatgagtacagtggcgtacgggtg agtaacacgtgggtaatctacctcttagtggggaataactttgggaaacc gaagctaataccgcataagctcgagagaggaaagcagcaatgcgctgaga gaggagcccgcggccgattagctagttggcagggtaaaagcctaccaagg cagagatcggtagccggcctgagagggcacacggccacactggcactgaa acacgggccagactcctacgggaggcagcagtggggaatcttgcacaatg ggggcaaccctgatgcagcgacgccgcgtgagcgatgaagcccttcgggg tgtaaagctctttcgtcagggaagatagtgacggtacctggagaagcagc tgcggctaactacgt...

Android Capture Image From Camera -

i making application in i'm using camera function of android. i'm opening camera , taking picture.in simple way easy do. but want take picture camera when user touch on anywhere on opened camera screen. (like use focus functionality) thank in advance , sorry bad english.

java - Values Clustering -

in text file data distributed shown below, considering table ease. column1 column2 column3 column4 b 1 2 b 1 5 c 1 3 b c 2 3 c 3 4 b 4 5 i need cluster the same values if column1 , column2 same, a->b repeated 3 times combine this. b 1 2 b 1 5 b 4 5 here's how it. define class record containing 4 fields define class recordkey containing identification of row, i.e. 2 first column values. make sure equals , hashcode defined. create map<recordkey, list<record>> . read records line line. if there list in map current record key, add current record list. otherwise, create new list, add record it, , put list in map.

What is the `file` URI scheme in Puppet? -

the documentation source attribute file resource type says: the available uri schemes puppet , file . puppet uris ... it explains puppet uri scheme, doesn't file uri scheme. it? mean assign "file://foo/bar/baz" source attribute on file resource? the file path absolute. refers file on system runs catalog. agent system, or machine on invoke puppet apply . file { '/etc/motd': source => "file:///media/shared-storage0/motd/${fqdn}.motd"; } for example, above resource make agent sync motd contents , file metadata shared storage. you can omit file:// , use full path source. source => "/media/shared-storage0/motd/${fqdn}.motd";

Define custom list-style-type in CSS -

i want ask, if possible (something font-face). example: @list-style-type { list-style-image: 'mycustomstyle'; src: url('url-to-image'); } ul { list-style-type: mycustomstyle; } is there that? know can classes on element , set custom image, not point. have issue company , nice. in css defined , implemented, cannot. values of list-style-type property set of keywords, different in different specifications , implementations, syntax not allow custom values added. there work in progress define css lists , counters module level 3 , extend syntax , semantics, allow custom values defined in @counter-style rules, using constructs designed part of css counter styles level 3 . planned include possibility of defining named value uses custom image, or construct contains custom image part of it. far, seems there no implementations of in released versions of browsers.

oracle11g - get root domain from url Oracle sql regex_substr -

i have query root domain urls below : select regexp_substr(regexp_replace('https://creditcards.chase.com/credit-cards/bp-credit-card.aspx', '^http[s]?://(www\.)?|^www\.', '', 1), '(\.\w+)+') domain dual; which returns out put : '.chase.com' how can ignore first dot in outoput regex in above query? note : need root domain, i.e, 'chase.com' thanks. select regexp_substr('https://creditcards.token.chase.com/credit-cards/bp-credit-card.aspx', '(^http[s]?://(www\.)?|^www\.)(\w+\.)*(\w+\.\w+)', 1, 1, 'i', 4) domain dual;

amazon web services - The request could not be satisfied in while using <alphaNumeric-string>.cloudFront.net -

here facing same issue. got cname alias aws.phonon.in working perfectly. got scenario have redirect users cloudfront.net url mapped cname. below details: https://aws.phonon.in/c2creports/resource/images/phononlogo.png link works expected. aws.phonon.in mapping record : d1f4zd5av6bosa.cloudfront.net if try hit url: https://d1f4zd5av6bosa.cloudfront.net/c2creports/resource/images/phononlogo.png i 502 bad gateway error. i'm able telnet on both port 80 , 443. can provide more details please me out of this....

css - Alignment of text in column of table -

i have table in project has alignment issue. text aligned in center of column alignment issue doesn't come when run code in local. appears when deploy code on server. can me issue? which version of jdeveloper using? alignment issue fixed in 11.1.2.4.0 release table having auto-ppr? causing changes in alignment. p.s: posted on answers in comments section because did not have reputation , wanted communicate you.

Python regex: Finding input not matching a specific (variable-defined) length -

i'm writing regular expressions in python, keep getting problem: typeerror: 'int' object not iterable. my regular expression: searchresults = (re.findall("[0-9]{"+re.escape(columns)"}",content)) my variable columns length of first element of set (len(..)) of regular expression. when i'm using normal number works. when try print(columns), see normal number. thanks help! sample of content: 111111111111 100111011101 180101020111 1001010000112 101610170051 150100111001 101100111101 100010000111 100000801111 100081010111 111111111111 sample columns: 12 as result i'm trying line (which not have 12 numbers): 1001010000112 if want filter strings of not matching specific length, following trick: re.findall('(^[0-9]{0,%d}$|[0-9]{%d}[0-9])' % (columns, columns), s)

filepath - In Python: Get path and name of file that is open in LibreOffice and Evince -

in python, determine path , name of (all) file(s), have been opened in libreoffice writer , in evince before. is there mean this, of os? i'm working under ubuntu linux 14.04 64 bit. thanks comments. you can see list of recent files in ~/.config/libreoffice/4/user/registrymodifications.xcu . i'm not 100% /4/user/ part of path absolute; looking on machine. you can add following lines xcu file edit amount of history keep, wont' old files. <prop oor:name="picklistsize" oor:type="xs:int"> <value>20</value> </prop> to keep running list, monitor file , extract opened documents when changes. effective files opened after write program - i'm not sure of way find out ever opened before started watching it, though. there couple of history manager extensions , might provide insight. i'm not sure evince specifically, recent files stored @ ~/.local/share/recently-used.xbel , , take similar approach regularly ...

Combine Sass mixin and CSS class? -

i've created sass mixin , css class have same styling, developers have option either add class html or apply mixin sass. @mixin link-style-1 { background: $red; padding: .75em 45px .75em 5%; } .link-style-1 { background: $red; padding: .75em 45px .75em 5%; } is there way of combing these 2 1? know use variable padding both, code bit longer , harder read. there cleaner solution? you can include mixin in class dryness: @mixin link-style-1 { background: $red; padding: .75em 45px .75em 5%; } .link-style-1 { @include link-style-1; }

javascript - Getting a stack overflow in this array merge -

i've written short recursive function add blank entries every 30 minutes dataset. far can tell, function should tail-recursive, seems cause stack overflow. just looking @ it, can't work out i've done wrong. advice welcome. function mergehelper(memo, merge, latesttime) { var currenttime = moment(latesttime.subtract(30, "minutes")), mergetime = moment(merge[0]), thiselement = [currenttime, 0], actualtime; if (!merge.length) { //base case return memo; } if (mergetime.isafter(currenttime)) { // normal case memo.push(merge.pop); actualtime = mergetime.clone(); } else { // failthrough case memo.push(thiselement); actualtime = currenttime.clone(); } return mergehelper(memo, merge, actualtime); } return mergehelper([], data, initialtime); <script...

android - How do I send a user from a splashscreen to one class when app first loads and to another after this -

so far, have class directs user particular class upon completion of splash screen. what i'd is, splash screen class direct users 1 class upon primary page load. if user revisits splash screen, i'd direct user used class (other splash screen class) how this? the purpose of this, if user moves application background,then when application brought foreground user returned opened class after again seeing splash screen, rather again sent primary class public class mainsplashscreen extends activity { @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.main_splash_screen); new handler().postdelayed(new runnable() { // using handler postdelayed called runnable run method @override public void run() { intent = new intent(mainsplashscreen.this, firstscreen.class); startactivity(i); //...

java - Stack of Boxes assignment -

Image
we have unlimited number of boxes stacked above eachother. p=size of first stack each stack "k" bigger stack before that. for example: p=3 k=2 1,2,3 4,5,6,7,8 9,10,11,12,13,14,15 now assignment move 1 box user defines , count how many boxes has move above in order move particular box. user keep on inserting numbers of boxes many days defined in variable d. so input go this: p=3 k=2 d=3(3 days aka 3 boxes move) 5 (box 5) 3 12 and output be: 6 ....why? because has move 3 boxes box 5, 0 boxes box 3 , 3 boxes box 12. hopefully, understood concept had been struggling correctly put of code. had succeeded in aspects of assignments doesn't seem working properly. it correctly gives me series of boxes ...but doesn't calculate correctly when input number....where number ( in stack) , top number stack program substrack , num of boxes had move. hopefully me on iam doing wrong , should do. here code tried doesnt seem working: import java.util.scanner; pu...

unicode - Dropbox java api - can't use hebrew string -

i try to create dbxentry object path include hebrew character , it's doesn't work. it's gives me "nullpointerexception", here example of code try run main function: public static void example(string s) throws ioexception, dbxexception{ auth(); dbxentry = client.getmetadata(s); system.out.println(a.name); } public static void main(string [] args) throws ioexception, dbxexception{ system.out.println("first example: "); example("/public"); system.out.println("working.."); system.out.println("second example: "); example("/לשום"); } the output is: first example: linked account: itay velner public working.. second example: linked account: itay velner exception in thread "main" java.lang.nullpointerexception @ node.main.example(main.java:137) @ node.main.main(main.java:145) i tried in web , doesn't find yet. if convert hebrew string unicode it's sti...

ios - Using two view controllers, second one won't display views -

for reason i'm having trouble displaying view secondary view controller in application. main view controller calls view controller that's responsible loading pdf view. the code in mainviewcontroller looks this: - (int)openpdf { [self loadsettingswithdefaults]; rdpdfviewcontroller *m_pdf; if( m_pdf == nil ) { m_pdf = [[rdpdfviewcontroller alloc] initwithnibname:@"rdpdfviewcontroller"bundle:nil]; } int result = [m_pdf pdfopen:@"/users/steve/test.pdf" withpassword:@""]; if(result == 1) { m_pdf.hidesbottombarwhenpushed = yes; [self.navigationcontroller pushviewcontroller:m_pdf animated:yes]; } return result; } this code located in second view. method referred above in mainviewcontroller. - (int)pdfopen:(nsstring *)path withpassword:(nsstring *)pwd { [self pdfclose]; pdf_err err = 0; m_doc = [[pdfdoc alloc] init]; err = [m_doc open:path :pwd]; switch( err ) { ...

Print on Linux and Windows in Qt/C++ -

i have pdf files , want print them on paper (i because 'print' refers pass content generated pdf file). on linux, use system calls cups passing name of file argument, on windows, not possible. began read printing on windows c++, have use proprietary libraries, , don't want use (only last resource). i read qprinter , other classes, how can use class or other related print pdf files? thing print pdf files exist? if aim able print on commandline in linux, can install cygwin lpr , ghostscript , allow print pdf files. windows has built-in lpr can install. isn't cups should allow command-line printing. if want in c++ (which require recompiling each system), can use qt poppler. can make qt app runs on commandline, uses poppler load specified pdf qwidget, make qprinter print contents of widget. have used invisible widgets before printing know that's doable. i'd make sure i've exhausted other options before getting hands dirty making new tool. ...

local variables - Does javascript implement lexical scoping? -

this question has answer here: what scope of variables in javascript? 23 answers what's difference between using “let” , “var” declare variable? 22 answers why return 2 instead of 1? seems second "var" silently ignored. function foo() { var local = 1; { var local = 2; } return local; } foo() /* 2 */ in javascript there function level scope , global scope. cannot create block scope , adds no special meaning , not create scope. and how code ends up function foo() { var local = 1; local = 2; return local; } foo(); in es6 can create block level scopes of let . es6 not supported yet. more on here

c# - Loading another form on top -

is possible load form on top of 1 form. user should not able interact first form. if user minimize first form stacked form should minimized. doable? for example, user loads form a, click controls , form b appears. until form b closed, user should not able in form a. for example, user loads form a, click controls , form b appears. until form b closed, user should not able in form a. this sounds need show formb using showdialog forma parent. formb formb = new formb(); formb.showdialog(this);//where forma

How to fire TouchUpInside of UIButton Programmatically in xamarin ios C# -

i trying fire touchupinside event of uibutton programmatically. how can ? code tried uses performselector error "error mt4117: registrar found signature mismatch in method 'vcpackage2.activityviewcontroller.touchupinsideevent' - selector 'touchupinsideevent:' indicates method takes 1 parameters, while managed method has 2 parameters. " i want achieve uibutton.fireevent("touchupinsideevent") - fire touchupinsideevent uibutton.performselector(new monotouch.objcruntime.selector ("touchupinsideevent:"), null, 2000f); here's code private void loadfn() { uibutton btnsubmit = new uibutton(new rectanglef(0,0,view.frame.width,40)); btnsubmit.touchupinside+=touchupinsideevent; } [export("touchupinsideevent:")] private void touchupinsideevent(object sender,eventargs e){ float yy = appconstants.zeroval; if (feedbacksubmittedreturnflag == true) { yy = childscrollview2.subviews[1].frame.height+c...

java - How to merge two rows in android table layout -

i want know how merge 2 rows in android table layout. know android:layout_span used merge columns , whats attribute used merging 2 rows? there no rowspan attribute in tablelayout . better use linearlayout or relativelayout . it's simpler. or use gridlayout api level > 13 if depend on tablelayout can achieve rowspan follows: <tablelayout ...> <tablerow..> <!-- column 1 : rowspan 2 --> <textview .../> <!-- column 2 : 2 rows --> <tablelayout ...> <tablerow..> <textview .../> </tablerow> <tablerow..> <textview .../> </tablerow> </tablelayout> </tablerow> </tablelayout> solution linearlayouts (cheap & simple): <linearlayout ... android:orientation="horizontal...

excel - Do While Not IsEmpty(Range("A1")) condition evaluation failure -

i have problem code, made "load" data in create graph, 3 associated columns this: data1 x1 y1 data2 x2 y2 data3 x3 y3 its intended behavior simple, select active cell, , enters loop: select first graph of sheet, evaluate if active cell not empty, if is, should go outside loop , end macro, if isn't, adds new series it, puts y abscissa value , puts x ordinate value, increments tracking value allows increase number of next series in graph (it initialized outside loop 1), changes row of active cell 1 below. the problem never go outside of loop (and crashes because can't add more 256 series graph, improved code in version if condition make better, works; still adds empty series; tedious delete , may mess things if left there). it seems condition: while not isempty(range("a1")) fails evaluate correctly. tried use while not isempty(range("a1").value) instead, or while isempty(range("a1")); while not isempty(selection) (which send err...

javascript - TinyMCE4 - could not set toolbar at the bottom of the editor -

in tinymce 3, set toolbar @ bottom of editor with: theme_advanced_toolbar_location : "bottom" . i can't find how tinymce 4. the advanced theme removed in tinymce 4. if want set toolbar in bottom part of editor must create own skin or stick tinymce 3.x . http://www.tinymce.com/wiki.php/tutorial:migration_guide_from_3.x under removed themes

How to create a `IN` clause in CakePHP query? -

how make in clause in new cakephp? i'm trying: $restaurants->find()->where(['id' => $r_ids])->all(); where $r_ids array of ids need in query, doesn't work expected. with cakephp 3.x it's necessary either indicate data type, array of values need have [] appended type: $query = $articles ->find() ->where(['id' => $ids], ['id' => 'integer[]']); or explicitly make use of in keyword: $query = $articles ->find() ->where(['id in' => $ids]); see also cookbook > database access & orm > query builder > automatically creating in clauses

How to place a custom label on a data point on a chart in vb.net? -

i know simple one, maybe having trouble asking question(searching same question.) simple line of code: chart1.series("drawing").points.addxy((xcoord(ya, yb)), ((ycoord(ya, yb)))) how add custom label point on chart such "1" or "point 1."? first, must know target point. -either : dim targetpoint int32 = 5 chart1.series("drawing").points.item(targetpoint)...... ' targetpoint valid n-th index of point. -or : dim targetpoint int32 targetpoint = chart1.series("drawing").points.addxy(....) then, use targetpoint edit label : chart1.series("drawing").points.item(targetpoint).label = "lalalilala"

java - Find bounding points 2D with an "H" shape -

Image
i've got set of points represent form this: as drawn on picture, able detect points bounding "h" shape. there algorithm solve problem? i know there graham scan use, graham scan take points outside cloud of points. there alpha shape algorithm build non-convex hulls. if point cloud formed (vertical sticks of h divided , on...), may try build alpha shape, correct rectilinear figure.

lazylist - Removing duplicates from lazy list Ocaml -

i need remove duplicates lazy list. here piece of code managed write have no clue on how fix work properly. i know how using regular list, lazy list still new me, happy help. here piece of code tried write: let rec removeduplicate = function lnil -> lnil |lcons(x,xf) -> x::(removeduplicate (list.filter (fun -> a<>x) xf));; thanks in advance help. the first problem, see in code, instead of building lazy list in second clause, you're building ocaml's built-in list , :: consing operator. also, can't use list.filter on tail part, since operates on values of type 'a list , not yours list.

Sourcemap source files are empty using gulp-uglifyjs -

Image
looks source map files blank. my code follows. gulp.src(sources) .pipe(uglifyjs('app.min.js', { outsourcemap: true })) .pipe(gulp.dest('public/js')) .pipe(notify({message: 'scripts task complete'})); in browser image looks notice how source files blank. not sure doing wrong here. can please help. i add source files using module pattern i.e. (function () { "use strict"; //my code in here }()) per gulp-uglifyjs documentation : outsourcemap (default false) give string name of source map. set true , [...] note: if source map point relative paths instead of absolute paths (which if hosted on server), set basepath option base of content served. [...] sourceroot sets root location source files should found with above in mind, need add 2 options gulp-uglifyjs call in gulpfile: sourceroot, value url of server want able access source maps (e.g. http://localhos...

javascript - Using Instafeed and SimplyScroll Together -

attempting use simplyscroll scroll instagram images, can't determine proper html markup 2 scripts function together. i'm super novice web designer, , i've done days of research in trying work out correct javascript html these 2 scripts working together, no avail. assistance, or direction resources appreciated! best can understand, correct method create target id instafeed html , simplyscroll calls source images. closest i've gotten far below. <script type="text/javascript"> var feed = new instafeed({ get: 'user', target: 'instagram_list', userid: xxxxxxxxxxx, limit: 15, accesstoken: 'xxxxxxxxxxxxxxxxxxxxxx, resolution: 'thumbnail', after: function() { $("#instagram_list").simplyscroll({ speed: 1, framerate: 20, orientation: 'horizontal', direction: 'forwards', customclass: 'instagram_scroller' }); } }); (jquery); feed.run(); </script> <div id="instagram_li...

c# - Failing to retrieve the third td nodes in an html list -

i trying text "very country views" , "good" using htmlagilitypack. <div class="property-details-section"> <h5><span id="content_lblfurtherdetails">further details</span></h5> <ul id="features"> <li style="display:block;"> <table border="0" cellpadding="0" cellspacing="0" width="500"> <tr> <td style="width: 15px;"> <img src="../images/bullet.png" alt="bullet" /> </td> <td style="width: 185px;">views</td> <td style="width: 300px;">very country views</td> </tr> </table> </li> </ul> <li style=...

Calling Linux functions from R -

i have been using system function within r part of workflow call linux commands. 1 item puzzling me functions seem work , others not. for example, if call system("ps") within r , gives me list of process ids, time, , cmd. but if invoke system("top") , following error: term environment variable not set. anyone know how fix this? workflow consists of running rstudio server browser sits on windows box. conveinient me not have open putty in order keep tabs on r processes. if run top in 'batch' mode can use in system call. system("top -n 1 -b") the -n 1 option runs single iteration the -b option runs in batch mode instead of interactive

c - Passing multidimensional static array to a function -

i need little advice. 3 ways of passing static, multidimensional array (here have 3-dimensional, guess 4 dimensions analogical) function correct? here's code: #include <stdio.h> void fun1(int ***tab, int n, int m, int p) { int i,j,k; for(i=0; i<n; i++) { for(j=0; j<m; j++) { for(k=0; k<p; k++) { printf("tab[%d][%d][%d] = %d\n", i, j, k, tab[i][j][k]); } printf("\n"); } printf("\n"); } } void fun2(int tab[2][3][2]) { int i,j,k; for(i=0; i<2; i++) { for(j=0; j<3; j++) { for(k=0; k<2; k++) { printf("tab[%d][%d][%d] = %d\n", i, j, k, tab[i][j][k]); } printf("\n"); } printf("\n"); } } void fun3(int tab[][3][2]) { int i,j,k; for(i=0; i<2; i++) { for(j=0; j<3; j++) { for(k=0; k...

geometry - SQL server display two different spatial columns at once -

Image
i have 2 tables geometry column each, 1 different districts , 1 bank agencies. im trying display both spatial columns @ once can see in district each of bank agencies are. possible geometry type? right now, can see them in spatial results tab 2 distinct columns, im trying overlap them. im using sql server 2008 btw. query example: select a.geometria, a.nombre, d.geometriad dbo.agenciabancaria join dbo.distrito d on a.iddistrito = d.id d.nombre = 'carmen' afaik, sql server management studio's spatial results tab can display 1 spatial column @ time. if want overlap geometries 2 columns, might have create union or intersection in query, , display that; example: select a.geometria.stintersection(d.geometriad) intersection dbo.agenciabancaria join dbo.distrito d on a.iddistrito = d.id d.nombre = 'carmen' -- above query demonstration purposes; possibly need -- optimization run faster, such fast intersection test in clause. or graphical example ...

assembly - In NASM labels next to each other in memory are causing printing issues -

i having issue while programming in nasm. learning how develop os purely in assembly , have started creating boot loader. my goal print "hello, world!" , "goodbye!" using the bios interrupt 0x10. the issue seem having occurs while printing values on screen. 2 labels appear next each other in memory causing printing 1 string print contents of other string. why isn't hlen stopping loop @ end of first string? [org 0x7c00] mov ah, 0x0e mov bx, hello_msg mov cx, hlen call print_string mov bx, goodbye_msg mov cx, glen call print_string jmp $ %include "print_string.asm" hello_msg db 'hello, world!',0 goodb...

c# - Read RTF of RichTextBox in Another Application -

i'm having difficulties in getting rtf of richtextbox application. for now, lets work wordpad. i can handle text area in wordpad fine. , can plain text text area using sendmessage , wm_gettext. good. however, need rtf other application. in docs, see em_streamout should used editstream structure. here code have far. private const uint wm_user = 0x0400; private const uint em_streamout = wm_user + 74; private const uint sf_rtf = 2; [dllimport("user32.dll", entrypoint="getforegroundwindow")] private static extern intptr getforegroundwindow(); [dllimport("user32.dll", entrypoint="getwindowthreadprocessid", setlasterror=true)] private static extern intptr getwindowthreadprocessid(intptr hwnd, out intptr lpdwprocessid); [dllimport("user32.dll", entrypoint="getguithreadinfo", setlasterror=true)] private static extern bool getguithreadinfo(intptr hthreadid, ref guithreadinfo lpgui); [dllimport("user32.dll...

health kit - HealthKit and accessories with no companion iOS apps -

if understand correctly, healthkit can automatically connect bluetooth accessories of following types - heart rate monitor, glucose sensor, blood pressure monitor, health thermometer. there no need have companion apps them can write data directly (and of course wirelessly) healthkit. i curious if true , if these accessories work seamlessly healthkit. no configuration needed. has tried it. further there accessories (such ihealth blood pressure monitor) measurement once measurement initiated companion app. how tie-in. as of ios 8, system can import data btle heart rate monitor directly healthkit no companion app. can configured in bluetooth settings pane of ios. there wwdc video goes more detail available here . also, if have idea healthkit accessory not supported currently, should contact apple form .

java - Spring Boot + Spring Data with multi tenancy -

is possible configure spring boot use multitenantconnectionprovider each client of system connects own private database? specifically looking use built-in hibernate support multi-tenancy: http://docs.jboss.org/hibernate/orm/4.1/devguide/en-us/html_single/#d5e4561 and example of sort of config after, can't figure out how use in spring boot setup: manage connection pooling in multi-tenant web app spring, hibernate , c3p0 i've tried adding these properties application.properties : spring.jpa.hibernate.multitenancy=database spring.jpa.hibernate.tenant_identifier_resolver=com.mystuff.mycurrenttenantidentifierresolver spring.jpa.hibernate.multi_tenant_connection_provider=com.mystuff.mymultitenantconnectionproviderimplx i've tried coding own currenttenantidentifierresolver , multitenantconnectionprovider , tried serving these main @configuration bean: @bean public currenttenantidentifierresolver currenttenantidentifierresolver() { return new currentte...

javascript - style not recognized when placed in the head tag -

the following code works if remove style h1 head tag , use inline style shown in commented line, not work listed below. <!doctype html> <html> <head> <style> h1 { text-align: center; color: black; } </style> <script> function changecolor() { var dom = document.getelementbyid("head1"); var clr = dom.style.color; switch(clr) { case 'black': dom.style.color = "red"; break; case 'red': dom.style.color = "black"; break; } } </script> </head> <body onclick="changecolor()"> <!-- <h1 id="head1" style="te...

d3.js - How to automatically get the scale for a d3.geo.mercator projection with the topojson's bbox? -

Image
i have topojson file created --bbox flag, figured out how center (where b bbox): var center = [(b[0] + b[2]) / 2, (b[1] + b[3]) / 2] then calculated scale, problem calculated equirectangular projection (because it's easy enough): var wscale = width / (math.abs(b[0] - b[2]) / 360) / 2 / math.pi var hscale = height / (math.abs(b[1] - b[3]) / 360) / 2 / math.pi var scale = math.min(wscale, hscale) i can't find way calculate mercator projection. i've seen this answer , tried use projection scale , directly set new scale: projection = d3.geo.mercator() .translate([width / 2, height / 2]) .center(center) .scale(1) [b0, b1] = projection([b[0], b[1]]) [b2, b3] = projection([b[2], b[3]]) scale = 1 / math.max(math.abs(b2 - b0) / width, math.abs(b3 - b1) / height) projection.scale(s) but result isn't perfect (poor tasmania): edit: should have post in https://gis.stackexchange.com/ or here fine ?

SQL Left Join Omit Rows Found -

Image
i have 2 tables 1 list transactions , 1 list cancelled. how show transactions not cancelled , omit cancelled ones? i want show transactions not cancelled, in case transaction transaction_id = 1. select * transaction_table transaction_id not in ( select transaction_id canceled_table); however, looking @ example suggest add field "canceled" transaction_table instead of using seperate table.

How to use collect call in Java 8? -

lets have boring piece of code had use: arraylist<long> ids = new arraylist<long>(); (myobj obj : mylist){ ids.add(obj.getid()); } after switching java 8, ide telling me can replace code collect call , , auto-generates: arraylist<long> ids = mylist.stream().map(myobj::getid).collect(collectors.tolist()); however giving me error: collect(java.util.stream.collector<? super java.lang.long,a,r>) in steam cannot applied to: (java.util.stream.collector<t>, capture<?>, java.util.list<t>>) i tried casting parameter giving me undefined a , r , , ide isn't giving more suggestions. i'm curious how can use collect call in scenario, , couldn't find information guide me properly. can shed light? the issue collectors.tolist , not surprisingly, returns list<t> . not arraylist . list<long> ids = remove.stream() .map(myobj::getid) .collect(collectors.tolist()); program interface . ...

Magento & Varnish / Turpentine, Zero-hit rate -

we have strange problems (nginx), magento(1.9.0.1), turpentine , varnish(3.0.2), running on ubuntu 12.04lts. we aren't 2 experienced varnish/turpentine, might basic thing. we got turpentine vcl applied running varnish instance , , checked result varnishadm vcl.list . enabled debug info in turpentine. strange thing: if activate both turpentine caching methods in magento backend->cache, fpc, got following response server nginx transfer-encoding chunked via 1.1 varnish x-frame-options sameorigin x-powered-by php/5.3.10-1ubuntu3.15 x-turpentine-cache 0 x-turpentine-esi 1 x-varnish 293774805 x-varnish-hits 0 and real bad response time of 3.5sec cause page never seems cached can see in x-turpentine-cache , x-varnish-hits. there's no age set in header. but if deactivate turpentine fpc, while letting vcl untouched age 29 server nginx via 1.1 varnish x-frame-options sameorigin x-powered-by php/5.3.10-1ubuntu3.15 x-varnish 293775151 293775096 x-va...

javascript - How do I make a link using keybindins, and selected text -

Image
i looking way ctrl - l , popups box to insert link, on selected text. stackexchange editor, i'm using right now! the links preferably valid html , , if can choose both markdown , valid html , awesome! i not find anywhere on so, or interwebs. what have done before: $("#mark").click(function () { var range = window.getselection().getrangeat(0); var newnode = document.createelement('mark'); range.surroundcontents(newnode); return false; }); button: <a href="javascript:void(0)" id="mark">mark</a> when clicking mark button apply html mark tag <mark>selected text</mark> i want same feaute stackexchange editor: ctrl - l get box: edit my new code : while playing promptbox using javascript [1] , managed way want it. <button onclick="link()">link</button> <p id="demo"></p> <script> function link() { var link = prompt(...

ios - stringWithFormat cuts off after %@ -

i'm new this, have created stringwithformat , tried put 2 variables it, string cuts off after first %@ . here's code... cell.authorview.text = [[nsstring stringwithformat:@"by %@ | %@", [item author], [item category]]uppercasestring]; i've tried taking out second variable, add after first %@ , variable or not, cuts off. doing wrong? the problem in label, displays text. 1) text can contain \n , label linescount can set 1 (in case first line visible). 2) text can long, , label cuts string. so problem in label, can check string ok, via nslog(@"%@", [[nsstring stringwithformat:@"by %@ | %@", [item author], [item category]]uppercasestring]);

c# - Keep Mouse Events bubbling from WindowsFormsHost on -

Image
i have winforms control within wpf windowsformshost. winforms control passive , must not handle mouse event. mouse events should raised usual inner wpf control in wpf visual tree, windowsformshost (or next one). no event triggered @ all. how should configure windowsformshost, winforms control, in order achieve this? remark: keydown , keyup behave expected. mouse events don't, illustrated following snoop screenshot: indeed winforms control keeps mouse event himself , doesn't forward event host. solution subscribe winforms mousedown event , generate programmatically routed event. i overrided windowsformshost following , rocks: (remark: behavior may more flexible) public class extendedwindowsformshost : windowsformshost { public extendedwindowsformshost() { childchanged += onchildchanged; } private void onchildchanged(object sender, childchangedeventargs childchangedeventargs) { var previouschild = childchangedeventargs...

sql server - How to get a "New Record Id" after inserting a record using ExecuteStoreCommand("INSERT -

i using mvc3, asp.net4.5, c#, ef5, sql server 2008 r2. i want understand best approach "new record id" once record has been inserted, given the pk int32 identity column . my current code is: db.executestorecommand("insert table1(col1,col2 ) select col1,col2 table1 id = {0}", myoldrecordid); command = @"select ident_current({0}) current_identity;"; mynewrecordid = (int)db.executestorequery<decimal>(command, "table1").first(); while above works, concern else insert record same table @ same time, retrieved newrecordid = correct value + 1. what best way retrieve new newrecordid, once "insert" has been issued via executestorecommand? btw, need use raw dml, number of reasons, rather pocos via ef. thanks in advance. edit the code change per understanding of advice given: using(transactionscope tran = new transactionscope()) { db.executestorecommand("insert table1(col1,col2 ) select col1,col2 table1 id =...

node.js - Express 4.x closes connections after 2 minutes -

i have simple node application handles get /foo . request takes time compute , return file. each time request lasts more 2 minutes, connection closed. i'm using express 4.10.2 , node 0.10.32. i read http module has default timeout of 2 minutes: http://contourline.wordpress.com/2011/03/30/preventing-server-timeout-in-node-js/ i tried use: server.on('connection', function(socket) { socket.settimeout(5*60*1000); //5 minutes }); but if connection not closed after 2 minutes, when server tried send file back, got: { [error: request aborted] code: 'econnabort' } edit: server.settimeout(5*60*1000); works fine! @mscdex server.settimeout() method sets http connection timeout connections.

Three.js place an object in rotating camera's fov -

i have fixed-position, perspective camera rotates around 3 axes via keyboard input. @ random intervals, independent of user input, need place objects within camera's field of view no matter direction camera looking. objects need offset specific x , y distances center of camera's fov , offset specific z distance camera's position. cannot use camera.addchild because once object added need move object via tweening independent of camera's movements. how can done? you want transform point camera space world space. in camera's coordinate system, camera located @ origin, , looking down negative z-axis. place object in front of camera (in camera's coordinate system). object.position.set( x, y, - z ); // z distance in front of camera, , positive now, transform object's position camera space world space: object.position.applymatrix4( camera.matrixworld ); three.js r.69

What is the best way to store product description/details in a database table. PHP mysql -

let's have product these descriptions (displayed so, 1 per line): description 1 description 2 description 3 description 4 . . description n what best way store these product descriptions in database table can displayed in "description" tab of dynamic product page. i avoid creating n different table columns, 1 each description. thank suggestions create relation table. product table: id name serial .... description table: id product_id description order / 1,2,3,n/ and can: $sql = "select * descriptions" . " product_id = " . $productid . "" . " order `order`"; read more it: http://en.wikipedia.org/wiki/database_normalization edit i've added on order column, because i'ev assume, want display description in correct order. if not use order field, can't sure, when selecting descriptions 1 product, order them. id | product_id | description | order 1 1 ...