Posts

Showing posts from July, 2013

javascript - Creating popup window with form content and then show output in parent page and send to database -

i have table , in of it's column want user when click on button inside column pop window appear have checkboxes , after user checked checkbox appear output in same column have button post these values of selected checkboxes , user name database (php). i'm beginner , wish me. help.html code : <html> <head> <script language="javascript"> mypopup = ''; function openpopup(url) { mypopup = window.open(url,'popupwindow','width=640,height=480'); if (!mypopup.opener) mypopup.opener = self; } </script> </script> </head> <body> <table border="1"> <tr> <th> user name </th> <th>product selected</th> </tr> <tr> <td> <input type="text"/></td> <td> <button onclick="openpopup('f.html')">select</button></td> </body> </html> and f.html code: <html> <head>

jsf - How do I add an image value to h:commandlink? -

this question has answer here: how put image instead of text in h:commandlink value 1 answer can please tell me how add image value code instead of text value? <h:commandlink action="#{gridhandlerxml.removelinesfromgroups}" render="quote-table, totalpanel, revisiontabs" execute="@this" disabled="#{currentquote.convertinprogress}" onclick="#{rich:component('fcprocessing:processingpopup')}.show()" oncomplete="#{rich:component('fcprocessing:processingpopup')}.hide()" /> quite straightforward: embed an h:graphicimage in command link: <h:commandlink action="#{gridhandlerxml.removelinesfromgroups}"> <h:graphicimage url="resources/path/to/your/image"/> </h:commandlink>

ios - How to deal with default paddings while customise navigation bar with title view? -

Image
i trying customise navigation bar title view. seems setting title view comes own left , right , top paddings.i expecting title view cover whole navigation bar according frames given. is expected behaviour , if yes how deal that? uiview *view = [[uiview alloc] initwithframe:cgrectmake(0, 0, 375, 44)]; view.backgroundcolor = [uicolor greencolor]; //navigation bar self.navigationitem.titleview = view; if want navigation bar green use [self.navigationcontroller.navigationbar setbartintcolor:[uicolor greencolor]]; in ios 7+ or [self.navigationcontroller.navigationbar settintcolor:[uicolor greencolor]]; in ios 6-

html - Basic CSS Not Responsiveness/Mobile Friendly -

i'm trying figure out how make basic css mobile friendly/responsive browser window changes. currently, code displays fine @ sizes except horizontal tablets. pictures , code drop down separate rows, reason being displayed on 1 line , extending past page borders. i've tried max/min-width , padding position and overflow , yet can't 1 work. here's important code, rest of text formatting , effects. html basic , calling .view .view { margin-left: auto; margin-right: auto; width: 300px; height: 300px; float: center; overflow: hidden; position: relative; text-align: center; box-shadow: 1px 1px 2px #e6e6e6; cursor: default; background: #fff } .view .mask, .view .content { width: 300px; height: 300px; position: absolute; overflow: hidden; top: 0; } .view img { display: block; position: relative; } this done through squarespace, , assure me it's code causing issues , not template code. what i

Python - Outlook Response (Accept, Reject, etc.) Date/Time -

i working on project involves pulling lot of appointment/meeting data outlook multiple people. 1 piece of information trying find response each attendee and, if possible, date , time response happened. example, if person x sends me meeting request on 4/21/2015 12:31:00 pm , accepted meeting request @ 4/21/2015 1:30:00 pm, how latter of 2 times? have been browsing microsoft docs ( link ) have had no luck far. here quick summary in python: import win32com.client outlook = win32com.client.dispatch('outlook.application') namespace = outlook.getnamespace('mapi') recipient = namespace.createrecipient('other person') resolved = recipient.resolve() sharedcalendar = namespace.getshareddefaultfolder(recipient, 9) appointments = sharedcalendar.items in range(0,1): print appointments[i] print appointments[i].start print appointments[i].end print appointments[i].organizer print appointments[i].location print appointments[i].duration

Converting code from c to c++ -

this question has answer here: what c++ equivalent c's designated initializers? 4 answers i'm trying convert code c c++ project using raspberry pi camera module , i'd analyse pictures it. but on piece of code (somebody else created) error 231:8: error: expected primary-expression before ‘.’ token which line: .max_stills_w = state->width, i tried find keeps giving me other errors video_port = camera->output[mmal_camera_video_port]; still_port = camera->output[mmal_camera_capture_port]; // set camera configuration { mmal_parameter_camera_config_t cam_config = { { mmal_parameter_camera_config, sizeof(cam_config) }, .max_stills_w = state->width, .max_stills_h = state->height, .stills_yuv422 = 0, .one_shot_stills = 0, .max_preview_video_w = st

linux - How to append new column using output from print command in awk? -

i'm trying add result of print statement new column in file t1.dat: awk '/time in seconds/ {print $5}' bt.b.1.log > t1.dat awk '/total processes/ {print $4; exit}' bt.b.1.log >> t1.dat contents of bt.b.1.log: time in seconds = 260.37 total processes = 1 output: (t1.dat) 260.37 1 desired output: 260.37 1 but, now, awk appending new line in t1.dat. how append new column in existing file (in case, t1.dat), without using intermediate files? awk 'begin{ors=" "} {if(nr==1) {print $5} else {print $4}}' bt.b.1.log ors abbreviation output records separator . perhaps ed morton has easier way of doing it. alternatively: awk '{if(nr==1) {printf $5} else {printf " "$4"\n"}}' bt.b.1.log do want line break @ end or not?

sql - Creating object like entries with levelup DB, relating keys -

i'm no aficionado of databases , i'm new level i've dealt sql. question seems simple, while can put , key value pairs in level, how create record more attributes? so have key="president" , value="nixon", how can give value attributes? ie: "nixon":[{"approvalrating": 10, "suitcolor":"blue", "firstname":"richard"}] how can interact level results this? thanks the value can object instead of "nixon" pass in { lastname: 'nixon', firstname:'richard' approvalrating: 10, suitcolor:'blue' }

ios6 - Is it possible to create a UITextField in iOS 6 with only a bottom border? -

i want customize uitextfield in ios 6 transparent text field bottom border.i have found 1 image in stackoverflow earlier,but don't have 10 reputation can't post image,but posting link below. text field bottom border in ios6 there multiple ways accomplish this: create seperatorview , add subview uitextfield y axis height of textfield. uitextfield *namefield = [[uitextfield alloc] initwithframe:cgrectmake(20,40,70,40) ]; uiview *seperator=[uiview new]; seperator.backgroundcolor = [uicolor graycolor]; seperator.frame =cgrectmake(namefield.frame.origin.x, namefield frame.origin.y+namefield.frame.size.height-1, namefield.frame.size.width,1); [namefield addsubview:seperator]; by using coreanimation class calayer *bottomborder = [calayer layer]; cgfloat borderwidth = 1; bottomborder.bordercolor = [uicolor graycolor].cgcolor; bottomborder.frame = cgrectmake(0, textfield.frame.size.height - borderwidth, textfield.frame.size.width, textfield.frame.size.heigh

matrix - What is the linguistic way to program matrices on Haskell? -

as simple should be, whenever need use matrices on haskell, struggle. strategy chose concrete type (repa, vector, list, intmap, etc) , program it. example, used repa solve euler's problem 11 , , use on marathons. unfortunately, repa isn't particularly friendly api - requires complicate type annotations, thinking representation , tracking it, converting around... also, indices reversed. means spend amount of time looking @ docs , trying align types correctly, deadly when in marathon. i use vectors/lists, is, too, awkward, since need use toindex :: [int] → int; fromindex int → [int] functions every time index vector. i tried creating wrapper data.vector such data matrix = matrix { shape :: [a], buffer :: vector } , noticed had create wrapper every single vector function, , different types match mutable vectors , on, , mess. in end, need simple way deal matrices - like: matrix = matrix.fromlist [3,3] [1,2,3,4,5,6,7,8,9] main = matrix' <- set matrix [1,1] 0

ios - Using MPMoviePlayerController as texture in SceneKit -

i created cube in scenekit , tried use instance of mpmovieplayercontroller material. kind-ish works not well: video seems jumpy, jumping between video frames (basically replaying frames beginning till last point played). sound ok. i made short screencapture of what's happening, guess obvious video: youtube vid this code handles mapping cube , creation of player: var movieplayer: mpmovieplayercontroller? func startplayingvideo(){ let mainbundle = nsbundle.mainbundle() let url = mainbundle.urlforresource("sample", withextension: "m4v") movieplayer = mpmovieplayercontroller(contenturl: url) if let player = movieplayer{ /* listen notification movie player sends whenever finishes playing */ nsnotificationcenter.defaultcenter().addobserver(self, selector: "videohasfinishedplaying:", name: mpmovieplayerplaybackdidfinishnotification, object: nil) println("successfully instantiated movie player")

rspec2 - Rspec parameters to shared context -

i want test if user logged in, in each of controller actions. what's best practice dry out can repeat actions, i.e. get,show, new, edit. it require passing in :index, :new, etc. , passing in parameter show , edit. here's non-dry version 1 action: rspec.shared_context 'when user not logged in' before sign_out :user end 'get#index redirects sign in page' :index expect(response).to redirect_to new_user_session_path end i want each of controller actions without having copy/paste code. i hope clear! in advance! i'm not sure exactly, think should work: rspec.shared_examples 'when user not logged in' |actions| before { sign_out :user } actions.each |action| "get##{action} redirects sign in page" action expect(response).to redirect_to new_user_session_path end end end it_should_behave_like 'when user not logged in', %i(new index)

ruby - Making a class instance variable unwritable from outside world -

class event @event_list = {} attr_reader :name, :value def initialize(name, value) @name = name @value = value end def to_s "#{@value}" end class << self def event_list @event_list end def event_list=(value); end def register_event(name, value) @event_list[name] = event.new(name, value) end def registered_events event_list end end end in above code snippet can access @event_list using event.event_list, interesting thing able modify variable outside event.event_list[:name] = "hello" event.event_list # => { :name => 'hello' } how can avoid ?, don't want modify @event_list outside. as far know, can't stop outside code modifying instance variables in ruby. if don't use attr_reader , attr_writer can still accessed using object#instance_variable_set . ruby doesn't have private variable

Address standarization using C# dictionary data or table sql server data? -

i'm developing application address standardization in c# using form (desktop application) , sql server 2005. work follow: my model in sql: ---------------------| table correctaddress | ---------------------| correctaddressid pk | correctaddress | ---------------------| -------------------| table wrongaddress | -------------------| wrongaddressid pk | wrongaddress | correctaddressid fk| -------------------| -------------------------| table standardizeaddress | -------------------------| standardizeaddressid pk | streetname | -------------------------| correctaddress: 70.000 records wrongaddress: 900.000 records standardizeaddress: maybe 1 or 1.000.000 records. and query , change "streetname" "correctaddress" is: select s.standardizeaddressid, s.streetname, c.correctaddress correctaddress c inner join wrongaddress w on c.correctaddressid = w.correctaddressid inner join standar

windows - Why can't Git Bash run my executable? -

i on git-for-windows git bash. can't run executable on command line: pedr@abc-07 mingw64 /c/dev $ ls sqlite3.exe sqlite3.exe* pedr@abc-07 mingw64 /c/dev $ sqlite3 bash: sqlite3: command not found why so? to run program in current directory in bash, put ./ in front of it. in case: $ ./sqlite3.exe when run sqlite3 , bash program name in directories of path environment variable, default includes standard locations executables /usr/local/bin not current directory. see here more info on that.

Google API Client Library for C++ vs libcurl for sending HTTP request? -

after installing google-api-client library c++ on fedora 20 machine, find out has external dependencies on libcurl (for example, setting http proxy). planning use google-api-client sending http request, mainly, http multipart post request. however, libcurl provide support multipart http post request also. could let me know advantages of using google api client library c++ on libcurl in order send http request? any suggestions/recommendations highly appreciated. thanks the google api client library c++ wrapper around libcurl pure c library. use casablanca rest sdk written in modern c++11, has no external dependencies , cross platform.

matlab - How to separate rows from a matrix? -

i have large matrix of size 16384 x 16. need obtain 512 x 512 matrix it. matrix should joined follows, l matrix of size 16384 x 16.by default l arranged below l = [l1 l2 l3 . . l32]. i need obtain l such that,g(ie;the new 512x512 matrix) g = [l1l2...l32] here each l 512x16 matrix. tried 32x32 matrix , obtained results correctly not able larger matrix. should do? following code had used w1 = 32; ans1 = l(1:w1,:); ans2 = l(w1+1:end,:); g = [ans1,ans2]; thanks. one approach permute & reshape - cutlen = 512; %// "cut" after every cutlen rows g = reshape(permute(reshape(l,cutlen,[],size(l,2)),[1 3 2]),cutlen,[]);

subseting dataframe conditions on factor(binary) column(vector in r language) -

i have sequence of 1/0's indicating if patient in remission or not, assume records of remission or not taken @ discrete times, how can check markov property each patient, summarize findings, assumption probability of remission patient @ time depends if patient had remission last time/not remission last time(same thing saying probability of remission patient @ time depends if patient had remission in previous row, if not first observation) p(r=1 @ t=t+1|r=1 @ t)=p(r=1 @ t+1|r=1 @ t, r=0 @ t=t-1, r=1 @ t=t-2, r=1 @ t=t-3) easy understand if understand markov property this exercept of df patientid remission ju67 1 ju67 0 ju67 0 ju88 1 ju88 1 ju23 1 ju23 0 any ideas? subsetting dataframe required condtions computing probabilities using 'msm' package or (probably better way) viewing state transitions table work how do this, subsets of dataframe need example include patients 3 consecutive 0's in remission(

javascript - find google map places with name from coordinates that is points in map -

i create google map coordinates comming database. in table have coordinates points google pointer in asp.net page. wants search name of city have coordinate of search name in db , highlight color in google map have following code fetch db coordinates: <script type="text/javascript"> var markers = [ <asp:repeater id="rptmarkers" runat="server"> <itemtemplate> { <%--''<%# getimagefrombyte(databinder.eval(container.dataitem, "image")) %>' '--%> "title":"survey", <%-- "title": '<%# eval("name") %>',--%> "lat": '<%# eval("lat") %>', "lng": '<%# eval("long") %>', "description": "<div> &l

sql - Using wildcard characters while trying to convert from one datatype to another -

i'm trying run sql query involving converting 1 datatype another. select convert(char(12),name) name people convert(char(12),place) = 'chicago' this works. however, i'm not sure how alter query use wildcard characters. imagine following (which not work in current state) - select convert(char(12),name) name people convert(char(12),place) = '%chicago%' please help. if want use wildcard characters, need use like: select convert(char(12),name) name people convert(char(12),place) '%chicago%'

android - Clear back stack when application object gets killed by the system -

i have application lot of activities. among them there initialactivity loads core data. it's launcher activity , none of next activities can live without loaded data. so launch app, initialactivity loading data, navigates mainactivity , i'm browsing farawayactivity . i'm switching other apps (some of them heavy games) , application getting killed on background. i've inserted log call in application.oncreate() , can see it's called again, when switch application. i'm sure app killed on background. android brings last farawayactivity top , crashes because loaded data nulls. so question is: how can tell application start on initialactivity when (and when) it's getting killed , restored? "forget stack", presumably automatically, in manifest. i've read , tried activity tag docs , nothing matches expectations. closest thing android:cleartaskonlaunch="true" , clears other activities on stack when relaunching app desktop (and

java - Timer implement error -

i have error timer, , don't know error situated in code. error: exception in thread "main" java.lang.error: unresolved compilation problems: constructor timer(int, player) undefined method start() undefined type timer at player.(player.java:12) at game.main(game.java:11) import java.awt.graphics; import java.awt.graphics2d; import java.awt.event.actionevent; import java.awt.event.actionlistener; import java.awt.geom.ellipse2d; import java.util.timer; import javax.swing.*; public class player extends jpanel implements actionlistener{ timer t = new timer(5, this); // error (line 12) double x = 0; double velx = 2; double y = 0; double vely = 2; public void paintcomponent(graphics g){ super.paintcomponent(g); graphics2d g2 = (graphics2d) g; ellipse2d circle = new ellipse2d.double(x,y,40,40); g2.fill(circle); t.start(); // error } public void actionperformed(actionevent e){ x += velx; y += vely; repain

html - Simple javascript print -

now i'm facing other issue. how make function skaic take obects properties, "min" "a", "sms" "b", "inter" "c", , d,e,f user input? var omni1 = { min:100, sms:300, inter:500 }; var omni2 = { min:300, sms:350, inter:1000 }; var omni3 = { min:60, sms:100, inter:3000 }; var bite1 = { min: 1000, sms: 1000, inter: 1000 }; var bite2 = { min: 1000, sms: 50, inter: 100 }; var bite3 = { min: 50, sms: 1000, inter: 50 }; var tele1 = { min: 450, sms: 250, inter: 300 }; var tele2 = { min: 250, sms: 500, inter: 650 }; var tele3 = { min: 4000, sms: 3000, inter: 4000 }; function skaic(a, b, c, d, e, f) { return math.sqrt(((a - d)

php - User friendly URLs without htaccess -

i want create friendly urls website script using php, right im using query style (ex: index.php?location=register) , convert them this: https://www.sitename.com/index.php/register right im using $_get based function parse , include php script based on $_get value. $includedir = ".".directory_separator."assets/controllers".directory_separator; $includedefault = $includedir."home.php"; if(isset($_get['ajaxpage']) && !empty($_get['ajaxpage'])){ $_get['ajaxpage'] = str_replace("\0", '', $_get['ajaxpage']); $includefile = basename(realpath($includedir.$_get['ajaxpage'].".php")); $includepath = $includedir.$includefile; if(!empty($includefile) && file_exists($includepath)) { include($includepath); } else{ include($includedefault); } exit(); } if(isset($_get['locat

c++ - MFC import Dialog from DLL -

i have 2 projects: 1 mfc .exe , mfc .dll. have mfc dialog defined in dll. has resource associated , has class ctoolboxdiag derived cdialog . the dialog has simple button shows message dialog when clicked. void ctoolboxdiag::onbnclickedbutton() { messagebox(_t("test"), _t("t")); } i can export resource dll code, , create standard cdialog correct appearance using following code: cdialog *diag = new cdialog; hinstance hclientresources = afxgetresourcehandle(); //tell client use .dll's resources afxsetresourcehandle(dll); // resource_id resource_id in dll diag->create(resource_id, null); //restore client application resource handle afxsetresourcehandle(hclientresources); but results in dialog showing controls (i.e. button) performs no action when clicked, doesn't have linkage ctoolboxdiag definition in .exe. i wanted export dialog (with button code) without having export class definition .exe. in other words, want export functional

Trouble Using Swift NSDate "timeIntervalSinceNow" -

this question has answer here: “cgfloat not convertible int” when trying calculate expression 1 answer i've searched around , flummoxed riddle. in swift, xcode 6.2, these lines work: let day_seconds = 86400 let one_day_from_now = nsdate(timeintervalsincenow:86400) but following returns error: let day_seconds = 86400 let one_day_from_now = nsdate(timeintervalsincenow:day_seconds) console output: "playground execution failed: /var/folders/4n/88gryr0j2pn318sw_g_mgkgh0000gn/t/lldb/10688/playground625.swift:24:30: error: argument 'timeintervalsincenow' in call let one_day_from_now = nsdate(timeintervalsincenow:day_seconds)" what's going on here? why nsdate trickiness? it's because timeintervalsincenow expect nstimeinterval double . if do: let day_seconds = 86400 day_second int type not method expect. when

Oozie EL function: An exception occured trying to convert String to type "java.lang.Double" -

i trying run oozie workflow calls el function replaceall(). action that's using replaceall() this <action name="createsuccess"> <fs> <configuration> <property> <name>rundate</name> <value>${replaceall(hdfsdir, namenode + '/(.+)/' + region + '/([0-9\\-]+)/?', '$2')}</value> </property> </configuration> <mkdir path="${namenode}/path/run/${region}/${rundate}"/> <touchz path="${namenode}/path/run/${region}/${rundate}/success.txt"/> </fs> <ok to="end"/> <error to="sendemailkill"/> </action> hdfsdir hdfs://namenode:8020/some/path/region/2015-04-22 , need grab date @ end property , use it. but when run above action, got exception: javax.servlet.jsp.el.elexception: exception occured trying con

Including a Java .class file in IntelliJ project -

preface: realize there lot of other threads ask similar question using .class files library project, i'm still stuck after going through 10 different ways. the project: teacher gave .class files (not jar) have methods need use in program we write. 1 of files book object, , other has static method called loadbooks() allows user enter info book , stores in array. the issue: when made array of book objects, idea assumed trying use java library exists, , made import statement @ top .print.book; . learned wrong , deleted statement, leaving book array marked incorrect, , loadbooks() method call incorrect well. my attempts: read on adding dependencies modules , whatnot... i've tried many different ways , nothing working. made new project in idea , copied on my program start over. downloaded fresh copy of teacher's .class files , left them in unzipped folder came in. went project structure > modules > my_project , added unzipped file java library. checked box ap

python - Not saving all matplotlib graphs from script output? -

i have script run in ipython, , takes input .csv file of gene_names , pushes them loop, where with open('c:\users\work\desktop\book1.csv', 'ru') f: reader = csv.reader(f) pdfpages('poopyheadjoe04.pdf') pdf: row in reader: gene_name = row probe_exclusion_keyword = [] print gene_name the gene_name values list(in .csv file) fed line, if inference_method == "approximate_random" : (in scripts.py) with open('c:\users\work\desktop\book1.csv', 'ru') f: reader = csv.reader(f) pdfpages('poopyheadjoe04.pdf') pdf: row in reader: gene_name = row probe_exclusion_keyword = [] print gene_name print "fetching probe ids gene %s" % gene_name probes_dict = get_probes_from_genes(gene_name) print "found %s probes: %s" % (len(probes_dict), ", ".join(probes_dict.values())) if probe_ex

javascript - Print a distant page in JS, JQ, or Angular -

i have pages have print, when launch printing, preview ugly , can't select , modify elements want (there's few elements want print, , others hide printing). i don't succeed less (with @media print ), made template , inject inside elements want show printing (with angularjs). problem original page http://example.com/id/page-name/?tab=media . put in script listener catch print event , redirect user on http://example.com/id/page-name/?tab=media&print=true . then timeout launches printing script ( window.print() ), , when user leave printing page, script redirects him http://example.com/id/page-name/?tab=media . the problem makes lot of closing/opening windows, , may uncomfortable user. think solution weird , awkward, found nothing else it... so have solution print distant page, not make lot of closing/opening frames? for example, when ctrl+p on http://example.com/id/page-name/?tab=media , prints http://example.com/id/page-name/?tab=media&print=true page

Is it possible to embed LLVM IR directly ito C++ source when using clang? -

in clang, there way embed llvm ir directly c++? example, can gnu-style asm statement contain llvm ir instead of machine code? more specifically, i'm adding experimental intrinsics llvm, , generate calls them c++. have modify clang this, or there shortcut?

jboss7.x - steps to deploy the BIRT reports in jboss AS7 -

for reports= birt server =jboss 7.1.1 front end =richfaces i have created reports using birt.but when calling reports through webpage showing error. how deploy reports in jboss , how call reports? see eclipse's birt viewer setup documentation here . from 'deploying jboss' section of referenced link: download zip file birt report engine runtime. file named birt-runtime-version#.zip. unzip file in staging area. look under birt-runtime- directory , locate "webviewerexample" directory. copy "webviewerexample" directory jboss installation, under deploy directory configuration. (eg) c:\dev\jboss-as-7.1.1.final\standalone\deployments. rename webviewerexample directory birt.war, deploy in place. start jboss , enter url birt (ie http://localhost:8080/birt ) , run test report.

functional programming - F# - Can I return a discriminated union from a function -

i have following types: type goodresource = { id:int; field1:string } type errorresource = { statuscode:int; description:string } i have following discriminated union: type processingresult = | of goodresource | error of errorresource then want have function have return type of discriminated union processingresult: let sampleprocessingfunction value = match value | "goodscenario" -> { id = 123; field1 = "field1data" } | _ -> { statuscode = 456; description = "desc" } is trying possible. compiler giving out stating expects goodresource return type. missing or going wrong way? as stands, sampleprocessingfunction returns 2 different types each branch. to return same type, need create du (which did) specify case of du explicitly, this: let sampleprocessingfunction value = match value | "goodscenario" -> { id = 123; field1 = "field1data" } | _ -> e

image - RaspberryPi camera stream processing with Python 2.7 -

i found following code here catching video stream raspberrypi camera. now want process video stream (e.g. finding blob or display video). for purpose need catch content of video array, e.g. name frame in example: cv2.imshow('stream', frame) i tried converting array like frame = self.stream.array but not getting work. the output tells me cannot create array stream: file "raspberry.py", line 35, in run frame = self.stream.array #creating array stream attributeerror: '_io.bytesio' object has no attribute 'array' any ideas how solve it? code: import io import time import threading import picamera # create pool of image processors done = false lock = threading.lock() pool = [] class imageprocessor(threading.thread): def __init__(self): super(imageprocessor, self).__init__() self.stream = io.bytesio() self.event = threading.event() self.terminated = false self.start() def ru

java - How can I customise javafx.scene.chart.NumberAxis to change the hard-coded upper limit of 20 major tick marks -

i'm using javafx numberaxis component in application, , 99% of want. i'm dealing varying data sets, auto-range function hugely useful. the auto-range algorithm tries come major tick units result in less 20 major tick marks along axis. , value of "20" hard-coded source. need less 20 in cases, ideally 10. so ... how can modify numberaxis want? the class final, , code makes autoranging work depends on other code further hierachy , within same package (numberaxis extends valueaxis, extends axis). i resorted creating parallel class hierachy within source tree, , creating custom version of numberaxis class. within source tree have jaxafx.scene.chart.customnumberaxis and copied original source code numberaxis , modified auto-range method. unfortunately raises illegalaccessexceptions. i'm guessing because runtime noticed code trying call package-protected methods sitting in jfxtr.jar. is there way round this, or have copy autorange algorithm code out

css - Responsive table with repeating column groups -

i have simple 3 column table (second code sample below). of time displayed on wide-screen hd tv, structure first code sample below, , yet depending on width of screen, if it's viewed on smaller screens instead of having 4 repeating columns groups, change 3, 2 1 phones. how can css/media queries? <table> <tr> <th>time</th> <th>hole</th> <th>player</th> <th>time</th> <th>hole</th> <th>player</th> <th>time</th> <th>hole</th> <th>player</th> <th>time</th> <th>hole</th> <th>player</th> </tr> <tr> <td>12:06 pm</td> <td>2</td> <td>ackerman</td> <td>11:53 am</td> <td>3</td> <td>alexander</td> <td>12:04 pm</td> <td>3&l

javascript - canvas.toDataURL results in solid black image? -

i have canvas element doodling in it. i using following convert canvas jpeg: var data = canvas.todataurl( "image/jpeg", 0.5 ); var img = new image(); img.src = data; $( "body" ).append( img ); however instead of doodle, solid black jpeg. can tell me i'm doing wrong? thanks! thats happening because jpeg not support transparent background.. if want supported use png (the default extension) else can set non transparent fill color canvas using . fillstyle , . fillrect

javascript - Math.log10 is undefined/available in PhantomJS -

typeerror: undefined not function (evaluating 'math.log10(10)') how solve problem if can't change source code of project? i can change code of phantomjs script. this question can anwsered in part this question . difference how proper way of injecting solution code. if page needs function, can add it. use example polyfill provided mdn . the polyfill must applied possible. done registering page.oninitialized event handler: page.oninitialized = function(){ page.evaluate(function(){ math.log10 = math.log10 || function(x) { return math.log(x) / math.ln10; }; }); }; this works in phantomjs versions.

read Image from Text Column in VB.Net Client from MSSQL Server -

Image
it's similar problem how load image sql server picture box? but in case image column in db type of "text" , doesn't allow me convert byte array: byte[] data = new byte[0]; data = (byte[])(dataset.tables[0].rows[0]["pic"]); i have table mamedia images stored in column ma_bild : now need read image column ma_bild using vb.net - have far: in vb.net can't convert value of text column byte() array dim byteblobdata1() byte = directcast(fototable.rows(0).item("ma_bild"), byte()) -> error message: "system.string" can't converted type "system.byte[]" the fototable datatable holds following values (only 1 row): mabild_id: 9a8d4fa7-57cd-4720-a397-158e2336d0ec ma_id: 3b686451-c9d3-4bcd-acf5-2fa407325837 ma_bild: ÿØÿମ2†hç­iûeþÝš÷Ũn–¹¸¸ºÛÁ7˜hÿ... (goes on ~50000 characters) ma_bild_textptr: system.byte[] = value of ptrval any ideas how read image information vb.net client? last optio

Node: Cannot find module "mongoose" / Cannot install mongoose correctly -

wenn try start javascript-file test connection mongodb error message mongoose module cannot find. have installed mongoose "npm install mongoose" in node.js directory. when install mongoose following messages, thin not installed correctly: > kerberos@0.0.10 install c:\zimmermann\nodejs\node_modules\mongoose\node_module s\mongodb\node_modules\mongodb-core\node_modules\kerberos > (node-gyp rebuild 2> builderror.log) || (exit 0) c:\zimmermann\nodejs\node_modules\mongoose\node_modules\mongodb\node_modules\mon godb-core\node_modules\kerberos>if not defined npm_config_node_gyp (node "c:\zim mermann\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bi n\node-gyp.js" rebuild ) else (rebuild) > bson@0.2.21 install c:\zimmermann\nodejs\node_modules\mongoose\node_modules\mo ngodb\node_modules\mongodb-core\node_modules\bson > (node-gyp rebuild 2> builderror.log) || (exit 0) c:\zimmermann\nodejs\node_modules\mongoose\node_module

how to set chromedriver work for centos 6.6 to run selenium test cases in python -

i have download , tried version of chromedriver in centos 6.6 version run selenium. i have followed this: http://selftechy.com/2011/08/17/running-selenium-tests-with-chromedriver-on-linux i getting error below: ./chromedriver: /usr/lib64/libstdc++.so.6: version `glibcxx_3.4.15' not found (required ./chromedriver) i trying run python test script: driver = webdriver.chrome('/home/intel/downloads/chromedriver') driver.get('http://www.google.com/xhtml') time.sleep(5) # let user see something! search_box = driver.find_element_by_name('q') search_box.send_keys('chromedriver') search_box.submit() time.sleep(5) # let user see something! driver.quit() what worked me downloaded prebuilt chromedriver rpm centos 6 @ http://downloads.onrooby.com/chromium/rpms/ placed executable @ /opt/chromium-browser/chromedriver

java - Connecting to database using hibernate - connection url -

i trying connect database using hibernate, have read documentation , user guild still cannot connect database. steps took: adding relevant hibernate jars , sqljdbc41.jar (sql server jdbc driver) project. added xml following sqljdbc_auth.dll (x64) environment path. created xml name hibernate.cfg.xml following connection , dialect: <!-- database connection settings --> <property name="hibernate.connection.driver_class">com.microsoft.sqlserver.jdbc.sqlserverdriver</property> <property name="hibernate.connection.url">"jdbc:sqlserver://localhost;databasename=forumsystem;integratedsecurity=true;"</property> <!-- sql dialect --> <property name="hibernate.dialect">org.hibernate.dialect.sqlserverdialect</property> as can see server local , using windows authentication, did not change defualt instance , port. i try connection databse using following code: configuration configuration

Android: How to Zoom, Pan(Scroll) Tic Tac Toe Board View -

so, have custom boardview class extends view. implemented drawing board, lines , drawing "o" drawable when user press on cell. but, not implement following problems correctly: 1. zoom boardview when user doing pinch(multi touch). 2. scroll boardview left, right, top, bottom if boardview bigger boardview initial width or height. 3. find right cell coordinate when user pressed on cell after zooming or scrolling. this first game project, please me if know how solve problem. i tried did not work properly. boardview width equal width screen width , boardview height equal boardview width. square board view. i give 200 bounty implementing problem. here project, can download , edit: https://drive.google.com/file/d/0bxniutd_m1x8cuq2ngpsmdbuvve/view?usp=sharing github: https://github.com/boyfox/gametictactoe boardview code: http://pastie.org/10109253 or http://pastebin.com/tru8ybds i found solution self, need improving code, can answer question solution!

api key - Use API keys using AJAX -

i'm trying user's api key database perform uri calls. at moment i'm doing in unsecure way running following ajax request: $.ajax({ type: 'get', async: false, url: 'http://localhost:8080/giftregistryapi/api/v1/key/apikey/' + paramhostid, success: function(result) { var key = result.key; returnapikey(key); } }); the api key stored in global variable used methods require it. need is securely user's (host) api key use api key methods require it? how do this? you can make php script store api key. call script ajax call. script call api url directly , return data requested. or can pass key ajax, in case should bind api key specific domains, entitled receive data.

xterm -e not terminating when script finishes execution -

i'm running 2 levels of xterms. in first level run "xterm -e bsub -ip master.tcl". master.tcl script invokes yet xterm "xterm -e bsub -ip slave.tcl". from reason, when slave.tcl finishes executing, second xterm not closing. however, second xterm display following message once slave script finishes: << jobexitinfo: job <128309> done successfully. >> also, when looking @ lsf system, job not appear, if finished. xterm window stays open, instead of closing. any idea why? thanks. it unlikely xterm stay open unless there still running there. i'd check (using ps -ef instance) see processes still running in remaining xterm. xterm still open if there running, e.g., waiting input. using ps -ef (assuming not bsd system), see listing heading this: uid pid ppid c stime tty time cmd and later in listing, relevant information, e.g., tom 3647 20185 0 06:17 pts/2 00:00:00 sh -c xterm -e vile tom

java - Gradle + rhino execute scripts -

it second gradle using and, have little question of how execute js scripts in gradle. i tried commandline , works fine task optimizescript(type: exec) { commandline 'java', '-classpath', 'path/to/rhino/js.jar:path/to/closure/compiler.jar', 'org.mozilla.javascript.tools.shell.main', 'r.js', 'main.js' } but think there better way of using gradle. maybe can execute script without commandline? think first can dependencies mvn, , next write script like dependencies { compile rhino compile otherstuff } task optimizescript() { org.mozilla.javascript.tools.shell.main('r.js main.js') } (of course script doesn't work) it can done in following way: build.gradle apply plugin: 'java' repositories { mavencentral() } dependencies { compile 'rhino:js:1.7r2' } task runjs(type: javaexec) { classpath configurations.compile main 'org.mozilla.javascript.tools.shell.main

Subclass UIScrollView in Swift for touches Began & touches Moved -

Image
i'm using swift 1.2 i'm trying use uiscrollview touchesbegan,touchesmoved,touchesended actions , link in 2nd comment of accepted answer. i'm using storyboard auto layout, set custom class uiscrollview in custom class. i'm not receiving either of these touch events in uiviewcontroller contains custom uiscrollview edit: updated code how use @victor sigler 's answer. custom scrollview code: import uikit protocol passtouchesscrollviewdelegate { func scrolltouchbegan(touches: set<nsobject>, withevent event: uievent) func scrolltouchmoved(touches: set<nsobject>, withevent event: uievent) } class passtouchesscrollview: uiscrollview { var delegatepass : passtouchesscrollviewdelegate? override init(frame: cgrect) { super.init(frame: frame) } required init(coder adecoder: nscoder) { super.init(coder: adecoder) } override func touchesbegan(touches: set<nsobject>, withevent event: uievent) { self.delegatepass?.scrolltouchbe