Posts

Showing posts from July, 2010

fasta - Perl Program error -

i wrote perl program takes excel sheet (coverted text file changing extension .xls .txt) , sequence file input. excel sheet contains start point , end point of area in sequence file (along 70 flanking values on either side of match area) needs cut , extracted third output file. there 300 values. program reads in start point , end point of sequence needs cut each time repeatedly tells me value outside length on input file when isn't. cant seem fixed this program use strict; use warnings; $blast; $i; $idline; $sequence; print "enter blast result file name:\t"; chomp( $blast = <stdin> ); # blast result file name print "\n"; $database; print "enter gene list file name:\t"; chomp( $database = <stdin> ); # sequence file print "\n"; open in, "$blast" or die "can not open file $blast: $!"; @ids = (); @seq_start = (); @seq_end = (); while (<in>) { #spliting result file based on each...

python - Efficient creation of a new time series from two irregular time series with Pandas -

i have 2 time irregular series, , b, want create new one. resulting series should have same index values should based on rolling sum on time window of values in b, in relation indices in a. for example: a 2011-01-27 10:21:43 0 2011-01-27 10:43:29 0 2011-01-27 19:39:39 0 2011-01-27 19:55:55 0 2011-01-27 19:58:25 0 2011-01-28 15:31:58 0 2011-01-28 16:27:13 0 b 2011-01-27 10:20:29 0 2011-01-27 18:31:23 1 2011-01-27 18:45:25 1 2011-01-27 18:57:22 1 2011-01-27 19:15:25 0 desired result using 1 hour window: 2011-01-27 10:21:43 0 2011-01-27 10:43:29 0 2011-01-27 19:39:39 2 2011-01-27 19:56:55 1 2011-01-27 19:58:25 1 2011-01-28 15:31:58 0 2011-01-28 16:27:13 0 currently looping through indices of , performing sum on b using b[t-hour():t].sum(). seems inefficient. suggestions?

ios - Skobbler map not zooming with zoomToRouteWithInsets -

in skobbler map, have calculated route. if drag in map, after in button click want see route. in doumentation given these method ' zooms map current calculated route. '. [[skroutingservice sharedinstance] zoomtoroutewithinsets:uiedgeinsetsmake(100, 100, 0, 0)]; i have given but, when called zoomtoroutewithinsets after drag on map , showing route. there bug zoomtoroutewithinsets fixed in future version. the current workaround call method twice (with same parameters) , job: [[skroutingservice sharedinstance] zoomtoroutewithinsets:uiedgeinsetsmake(100, 100, 0, 0)]; [[skroutingservice sharedinstance] zoomtoroutewithinsets:uiedgeinsetsmake(100, 100, 0, 0)];

javascript - Check what files are present in remote directory with grunt -

i'm looking way check files present in remote directory want access via ssh or similar , write filenames array. so far had no luck. unix rsync has -n flag can print every file present @ destinated location, don't how use rsync-output in grunt. here's how might via sftp ssh2 : var ssh2 = require('ssh2'); var conn = new ssh2(); conn.on('ready', function() { conn.sftp(function(err, sftp) { if (err) throw err; sftp.readdir('/tmp', function(err, list) { if (err) throw err; console.dir(list); conn.end(); }); }); }).connect({ host: '192.168.100.100', port: 22, username: 'frylock', // password: 'foobarbaz', privatekey: require('fs').readfilesync('/here/is/my/key') });

ruby - Openshift rails app open4 (LoadError) -

i getting following error when trying deploy openshift online (small gear): remote: /opt/rh/ruby193/root/usr/share/rubygems/rubygems/custom_require.rb:60:in require': cannot load such file -- open4 (loaderror) remote: /opt/rh/ruby193/root/usr/share/rubygems/rubygems/custom_require.rb:60:in rescue in require' remote: /opt/rh/ruby193/root/usr/share/rubygems/rubygems/custom_require.rb:35:in require' remote: /opt/rh/ruby193/root/usr/share/gems/gems/openshift-origin-node-1.30.5/lib/openshift-origin-node/utils/shell_exec.rb:19:in ' remote: /opt/rh/ruby193/root/usr/share/rubygems/rubygems/custom_require.rb:55:in require' remote: /opt/rh/ruby193/root/usr/share/rubygems/rubygems/custom_require.rb:55:in require' remote: /opt/rh/ruby193/root/usr/share/gems/gems/openshift-origin-node-1.30.5/lib/openshift-origin-node/model/frontend_proxy.rb:18:in <top (required)>' remote: /opt/rh/ruby193/root/usr/share/rubygems/rubygems/custom_requ...

tsql - query throwing error in web report writer -

i have query/view created used in report. when run in sms , in ssrs run fine. when connect view tool generates our reports throws following error. incorrect syntax near '.8'. when contact support product has how calculate 8thgradyear . have placed code below. suggestions. select dbo.studemo.suniq, dbo.studemo.ident, dbo.studemo.lastname, dbo.studemo.firstname, dbo.studemo.emailaddr stuemail, dbo.studemo.birthdate, dbo.track.schoolc, dbo.school.schname, dbo.stustat.graden, dbo.stustat.edate, dbo.zstustat.descript status, rtrim(dbo.facdemo.lastname) + ' ' + dbo.facdemo.firstname advisor, dbo.track.schyear, sum(8) - dbo.stustat.graden + dbo.track.schyear [8thgradyear], sf.email, lower(sf.username) [user], lower(right(sum(8) - dbo.stustat.graden + dbo.track.schyear, 2) + left(dbo.studemo.firstname, 1) + replace(replace(replace(dbo.studemo.lastname, '-', ''), ' ', ''), '''', '') + right(dbo...

Trying to use multiprocessing to fill an array in python -

i have code this x = 3; y = 3; z = 10; ar = np.zeros((x,y,z)) multiprocessing import process, pool para = [] process = [] def local_func(section): print "section %s" % str(section) ar[2,2,section] = 255 print "value set %d", ar[2,2,section] pool = pool(1) run_list = range(0,10) list_of_results = pool.map(local_func, run_list) print ar the value in ar not changed multithreading, might wrong? thanks you're using multiple processes here, not multiple threads. because of that, each instance of local_func gets own separate copy of ar . can use custom manager create shared numpy array, can pass each child process , results expect: import numpy np functools import partial multiprocessing import process, pool import multiprocessing.managers x = 3; y = 3; z = 10; class mymanager(multiprocessing.managers.basemanager): pass mymanager.register('np_zeros', np.zeros, multiprocessing.managers.arrayproxy) para = [] proces...

How to download pdf file from url in node.js? -

i creating application download pdf files url , show in dashboard page grid wise. i using node.js express framework. exports.pdf = function(req, response) { var url ="http://www.ieee.org/documents/ieeecopyrightform.pdf"; http.get(url, function(res) { var chunks = []; res.on('data', function(chunk) { console.log('start'); chunks.push(chunk); }); res.on("end", function() { console.log('downloaded'); var jsfile = new buffer.concat(chunks).tostring('base64'); console.log('converted base64'); response.header("access-control-allow-origin", "*"); response.header("access-control-allow-headers", "x-requested-with"); response.header('content-type', 'application/pdf'); response.send(jsfile); }); }).on("error", function() { console.log("error"); }); }; th...

jquery - Sorting objects in an array -

ok got array of objects in array. associative arrays. array of associative arrays. console log outputs this: [array object] [object{...},object{...},object{...}, etc...] each object has name, price , color. want sort them alphabetical order , ascending or descending in price. i've got jquery code put them onto page, need insert bit of code put them in order choose. ideas? you can use javascript array sort method accepts compare function parameter. var = [{name: 'a', price: 1, color: 'red'}, {name: 'b', price: 2, color: 'red'}, {name: 'c', price: 3, color: 'blue'}]; // ascending order a.sort(function (a, b) { return a.price - b.price; }); // descending order a.sort(function (a, b) { return b.price - a.price; }); edit: if need sort first name in ascending order , price in ascending or descending order then: // sort name in ascending order first , price in ascending order a.sort(function (a, b) { re...

html - Approach to building a GUI for a web application -

first, short disclaimer. have next no knowledge web applications. come ios background exclusively wrote native code, if write answers know nothing outside shallow parts, great. i'm interested in learning stack develop web applications, i'm not sure right way build gui is. know web front end consists of html , css create display , javascript bridge between end , gui, don't know best way put together. i know in ios, can use interface builder (part of xcode lets graphically create xml describes display) create gui's without knowledge of how ios translates xml rendering, or written in xml files. there analog web front end? i'm looking list of accepted ways develop gui web application. if have learn html , css, it, i'd know options , tradeoffs between each of them. i can answer shortly stating (technically) can design web pages without coding in html or css, or javascript - although, limited in creative abilities , applications. you can read wysi...

haskell - How to make xmonad workspace name display the number of window? -

good evening, sorry bother basic question. recently, moved xmonad. i'm new haskell , tried learn little little. want make workspace name in xmonad display number of open windows. give example better understanding. i have 3 workspaces, let's "ws1", "ws2", , "ws3". hope can make this. | ws1 (n1) | ws2 (n2) | ws3 (n3) | where ws name of workspace , n number of window in each workspace. when have 3 windows opened in ws1, 2 windows opened in ws2, , 0 window opened in ws3, this. | ws1 (3) | ws2 (2) | ws3 (0) | i don't know how configure in xmonad. people @ xmonad channel told me can display using map (\ws -> (w.tag ws ,length . w.integrate . w.stack $ ws) w.workspaces `fmap` withwindowset but don't know should put code. i'm sorry english. appreciate if knows how it. thank you.

jquery click() function not working -

this question has answer here: event binding on dynamically created elements? 19 answers <ul> <li id="one"></li> <li id="two"></li> <li id="three"></li> <li id="four"></li> <li id="five"></li> <li id="six"></li> <li id="seven"></li> <li id="eight"></li> </ul> script $.getjson("data.php", function(data) { var items = []; $.each(data, function(i, val) { $("#" + i).html("<a href='javascript:void(0);' class='hov'>" + val + "</a>"); }); }); $('.hov').click(function() { alert("handler .click() called."); }); data.php : { "one":...

Playhaven Doesn't Works in iOS -

i doing play haven interstitial in ios app , getting following 2 type of error: request recieved http response: 403 request recieved http response: 200 and have checked dismissed type phpublishernocontenttriggereddismiss . anyone have idea how fix it?

java - how to design the code for catching a certain exception in a API interface util class -

i'm facing problem need add handling exception when calling third part api. serviceutilshelper managers connection issue. getaccesinterface() return instance used call api geta(),getb() . want adding catch exception @ calling geta(), getb() more getc() .and try call again. problem how make code keep clean? thanks! code piece: public list<string> geta(parameter arg) throws xxserviceexception{ return serviceutilshelper.getaccessinterface().geta(arg); } public list<string> getb(parameter arg) throws xxserviceexception { return serviceutilshelper.getaccessinterface().getb(arg); }

android - Menu not refreshing on some devices -

i have problem strange menu behavior on devices. do, showing/hiding menu items according application state. i'm using actionbarsherlock. code is: private menuitem savemi; private menuitem postmi; private menuitem editmi; @override public boolean oncreateoptionsmenu(menu menu) { menuinflater inflater = getsupportmenuinflater(); inflater.inflate(r.menu.menu_main, menu); savemi = menu.finditem(r.id.menu_save); postmi = menu.finditem(r.id.menu_post); editmi = menu.finditem(r.id.menu_edit); if (app != null) { app.setcurrentstate(); } return true; } void setglobalstate(state state, object menuitem, string title) { getsupportactionbar().settitle(title); boolean showsavemenu = true; boolean showpostmenu = true; boolean showeditmenu = true; switch (state) { case editing: showsavemenu = false; showpostmenu = true; showeditmenu = false; break; case viewing: showsavemenu = false; ...

d3.js geo - rendering svg path -

i'd create choropleth map of czech republic. inspired article http://bl.ocks.org/mbostock/4060606 , have created this http://jsfiddle.net/1duds8tz/2/ var width = 960; var height = 500; var svg = d3.select("body").append("svg").attr("width", width).attr("height", height); var offset = [width / 2, height / 2]; var projection = d3.geo.mercator().scale(6000).center([15.474, 49.822]).translate(offset); var path = d3.geo.path().projection(projection); queue().defer(d3.json, "..map.geojson").await(ready); function ready(error, reg) { var group = svg.selectall("g").data(reg.features).enter().append("g"); group.append("path").attr("d", path).attr("fill", "none").attr("stroke", "#222"); } when tried fill svg path color, ended on this http://jsfiddle.net/1duds8tz/3/ group.append("path").attr("d", path).attr(...

sql - First value in a aggregated query -

i have table statistical values process. table has following format: create table data ( process integer not null, time timestamp not null first double precision, last double precision, first_time timestamp, last_time timestamp ) the data in table inserted every minute, , contains aggregate value of last minute. example, process 1, can have following data: +---------------------------------------------------------------------------------+ | process | time | first | last | first_time | last_time | +---------------------------------------------------------------------------------+ | 1 | 2014-09-22 12:00:00 | 100 | 200 | 2014-09-22 12:00:00 | 2014-09-22 12:00:59 | | 1 | 2014-09-22 12:01:00 | 104 | 152 | 2014-09-22 12:01:00 | 2014-09-22 12:01:59 | | 1 | 2014-09-22 12:02:00 | 141 | 155 | 2014-09-22 12:02:10 | 2014-09-22 12:02:59 | | 1 | 2014-09-22 12:03:00 | 122 | 147 | 2014-09-22 12:03:00 | 2014-09-22 12:02:...

c++builder - How to use AnsiString to store binary data? -

i have simple question. i want use ansistring container binary data. load such data tmemorystream or tfilestream , save ansistring after processing. works fine, haven't found problem that. but i've seen using sparcles debates use sysutils::tbytes instead. why? sysutils::tbytes has fewer useful methods can use manipulate data stored inside example ansistring . half-finished container, compared ansistring. is problem should care conversion regular string or there else why should use less-than-adequate tbytes instead? not make conversions of ansistring other string types - quoted possible problem elsewhere. an example of how load data: ansistring data; boost::scoped_ptr<tfilestream> fs(new tfilestream(filename, fmopenread | fmsharedenywrite)); data.setlength(fs->size); fs->read(data.c_str(), fs->size); an example how save data: // fs wants void * have use data.data() instead of data.c_str() here fs->write(data.data(), data.length()); so sh...

javascript - putting client code in the server in order to avoid versioning hell? -

so, i'm using phonegap implement html5 mobile app display fetched server data. my problem such: data structure expected have many changes don't want have json-to-html logic coded @ client side because mobile apps might outdated in way won't understand new data's format. hate having multiple versions of same data old clients. the idea came having json-to-html function serialized same json data is. this break client/server separation of concerns principle given alternatives, sounds justified. think?

c - Passing arguments of getline() from incompatible pointer type -

i know following warnings fault, need bit of working out did wrong. i'm getting: "passing argument 1 of ‘getline’ incompatible pointer type", , same thing argument 2. here call getline(): getline(&line.buf, &maxsz, stdin) here relevant argument declarations: line_t line; int maxsz = 1000; and typedef struct line_t { char buf[1000]; int linelength; int wordcount; int index; } line_t; i believed issue was taking address of meant pointers, upon testing out few different calls getline, yet find solution. think argument 2 fact maxsz not pointer. while (-1 != (line.linelength = getline((char**) &line.buf, &maxsz, stdin))) { printf("buf %s\n",line.buf); why above giving me infinite loop? about problem second argument: &maxsz of getline() passing of type int * function getline() expects second argument of type size_t * . change declaration int maxsz = 1000; to size_t maxsz = 1000; about fi...

angularjs - In angular js want to set init variable -

<body ng-app="d" ng-controller="con" ng-init="jj=''"> <section id="phase1"> <div ng-repeat="obj in arr" > <div ng-if="jj != obj.sentdate" ></div> <span >{{obj.sentdate}}</span> /// how set jj value here date print once. <div >{{obj.msg}}</div> </div> </section> </body> this result sat 14 2014 mookdsbg sat 14 2014 mookdsbg sat 14 2014 mookdsbg but want : sat 14 2014 mookdsbg mookdsbg mookdsbg <section id="phase1"> <div ng-repeat="obj in arr" > <div ng-if="jj != obj.sentdate" ></div> <span ng-show="jj != obj.sentdate" >{{obj.sentdate}}</span> /// use ng-show <div >{{obj...

jsf - Primefaces TabMenu selection is not changing -

i try build primefaces tabmenu web-page. displayed direct page want, won't set activeindex , still looks i'm still on main-page. heres jsf-view (it's component, inserted page): <ui:component> <div id="navigation"> <h:form id="navform"> <p:tabmenu activeindex="#{projectcockpit.pageid}"> <p:menuitem value="home" url="/mainpage.xhtml" actionlistener="#{projectcockpit.setpageid(0)}"> </p:menuitem> <p:menuitem value="projekte" url="/projects.xhtml"> <f:setpropertyactionlistener value="1" target="#{projectcockpit.pageid}" /> </p:menuitem> </p:tabmenu> </h:form> </div> </ui:component> and here bean: @managedbean(name = "projectcockpit") @sessionscoped public clas...

c# - Reproducing UserPreferenceChanged Event to verify freezing issue fixed -

i've been encountering dreaded userpreferencechanged event ui freezing problem , subsequently working way through possible causes, such as: invoking on individual controls rather main application form (see https://stackoverflow.com/a/3832728/868159 ) creating controls on non-ui thread. first initialisation of systemevents static class (see https://stackoverflow.com/a/4078528/868159 ) but biggest issue having reliably reproducing freeze. i've found can similar reproduction running application in rdp session, exiting session without logging off, , re-connecting rdp session (more not, raises onthemechanged event rather userpreferencechanged event). using method managed freeze application consistently. followed of above advice , corrected issues found. seemed fix problem , handed on qa , using above method not freeze either. however, customers still seeing freezing issue. getting process dump files them when occurs , can see systemevents.onuserpreferencechanged e...

CSS ISSUE with HTML -

i have color issue css. when put href in link font color changes grey there no grey color in class in css. code below. html <a class="css_button_addhrs" >add hours</a> when add href in tag changes font color of add hours grey should white. idea? there no other grey in css. css .css_button_addhrs { font-size: 14px; font-family: arial; font-weight: bold; text-decoration: inherit; -webkit-border-radius: 8px 8px 8px 8px; -moz-border-radius: 8px 8px 8px 8px; border-radius: 8px 8px 8px 8px; border: 1px solid #d02718; padding: 9px 18px; text-shadow: 1px 1px 0px #810e05; -webkit-box-shadow: inset 1px 1px 0px 0px #f5978e; -moz-box-shadow: inset 1px 1px 0px 0px #f5978e; box-shadow: inset 1px 1px 0px 0px #f5978e; cursor: pointer; color: #ffffff; display: inline-block; background: -webkit-linear-gradient(90deg, #c62d1f 5%, #f24...

Background thread for email sending in Ruby on Rails -

i need run background thread in ruby on rails application should send emails when date has occurred, depending on values in db (and email body should contain info db). what best way achieve such behavior? i'm using ruby on rails 4.1.4 btw. thanks in advance. you can use whenever gem perform background jobs according requirement. check out github docs here. whenever ryan bates created great railscast whenever: cron jobs intro in rails in config/schedule.rb every 2.hours runner user.send_email_to_users end in user model def self.send_email_to_users //write logic here , call action send mails. usermailer.send_mail_persons(user).deliver //pass other data if required in arguments. end in app/mailers/user_mailer.rb def send_mail_persons(user) @user = user mail :to => @user.email, :subject => "amusement.", :from => mail_address end create html template per requirement, app/views/user_mailer/send_mail_persons.html.erb ...

java - How to send a list of strings in http response? -

i have list of strings in list assetlist. how can send list in http response in java servlet ? new java. call method after converting list string: private void writeresponse(httpservletresponse response, string responsestring) { try { printwriter out = response.getwriter(); out.println(responsestring); out.flush(); response.flushbuffer(); out.close(); } catch (exception e) { e.printstacktrace(); } } to convert list of strings string, see: best way convert arraylist string

json - Meteor `Deps.autorun` vs `Collection.observe` -

what pros/cons between using deps.autorun or collection.observe keep third-party widget in sync reactive meteor.collection . for example, using jstree visually show directory tree have stored in mongodb. i'm using code make reactive: // automatically reload filetree if data changes filetree.find().observechanges({ added: function() { $.jstree.reference('#filetree').refresh(); }, changed: function() { $.jstree.reference('#filetree').refresh(); }, removed: function() { $.jstree.reference('#filetree').refresh(); } }); what pros/cons of using method vs deps.autorun call this: (untested) deps.autorun(function() { jsondata = filetree.find().fetch(); $.jstree.reference('#filetree')({'core': {'data': jsondata} }); }); this example. i'm asking pros/cons in general, not specific use case. deps.autorun, tracker.autorun reactive computation block. whereas observechanges provides callback...

javascript - Remove Scroll event listener used in conjection with throttling function -

please easy....i using throttling function first time scroll. i have function call which opens particular view on page. function dayviewopen(target){ var date = getdate(); .. .. .. document.addeventlistener('scroll',throttle(function(event){ scrolladddata(date); },10)); } similarly have function close particular view function dayviewclose(target){ .. .. } everything till working perfectly. problems start arising when have remove earlier added event listener. i.e have remove event listener when call function dayviewclose(); i need have reference listener remove it, when this. var handler = throttle(function(event){ scrolladddata(); },10); function dayviewopen(target){ var date = getdate(); .. .. .. document.addeventlistener('scroll',handler,false); } function dayviewclose(target){ ...

Additional Long press option (Android) while messaging / typing text -

long press options (android) while messaging / typing text, in addition paste , clipboard options, want have option when touched pastes specific text(s). how can this? please help... you need use onlongclicklistener for example: youedittext.setonlongclicklistener(new onlongclicklistener() { public boolean onlongclick(view v) { //what happens when long click } }); hope helped!

sprite kit - SpriteKit SKNode visual position in parent(s) after parent(s) are rotated? -

i have following hierarchy: scene -> root node -> nodea -> nodeb (anchor node that's rotated) -> nodec how can figure out visual position of nodec in root node coordinate space? i've tried several variants convertpoint:tonode: , convertpoint:fromnode: numbers i'm getting don't match. i've looked @ get visible location of spritekit node after parent rotation , seems close issue, no luck there either. found missing - converttopoint needs called node in final cgpoint value represented in. so, works: // point cgpointzero because center of nodec let point = rootnode.convertpoint(cgpointzero, fromnode: nodec) cgpoint!

ruby on rails - Create Customer w/ simple Stripe Checkout -

my aim to verify users card information , store info in customer object. i run pay-upon delivery service , building hack protect against fake orders (we can charge people via strip dashboard if place false orders or don't show up). a full stripe integration long term goal, need asap. i've read (re-read) the docs having trouble. the simple stripe checkout works great, clueless how create customer there. script: <form action="/charge" method="post"> <script src="https://checkout.stripe.com/checkout.js" class="stripe-button" data-key="test key" data-image="/square-image.png" data-name="food bazooka" data-description="customer verification. no charges :)" data-panel-label="confirm , verify" data-label="confirm"> </script> </form> any feedback or ideas appreciated. t...

delphi - How to get last string in TStringList -

i've been searching days on how this, , nothing need (or don't understand how implement solution). what need parse string, street address, tstringlist, , set strings list variables can pass rest of program. have list working ok: var addresslist : tstringlist; : integer; begin addresslist := tstringlist.create; addresslist.delimiter := ' '; addresslist.delimitedtext := rawaddressstr; //rawaddressstr parsed file , string result '1234 dark souls lane wyoming, mi 48419' := 0 addresslist.count-1 addresslist.strings[i]; //not sure here the issue address isn't same length. address '1234 dark souls 2 lane wyoming...' or '1234 dark lane wyoming...' so need able use tstringlist set zip, state , city variables later use. use tstringlist.find, zip code isn't same. there way last string , go backwards there? (going backwards because once city, state zip can remove rawaddressstr , set rest address string.) thanks. edit, here's ...

Using Python Requests to Create a Token for GitHub Enterprise -

i trying create token script has access private repo on github enterprise account. trying this: username = 'my_username' password = getpass.getpass('github password: ') payload = { 'note': 'info token' } url = 'https://github.my_company_name.com/api/v3/authorizations' r = requests.post(url, auth=(username, password), data=payload) but error: requests.exceptions.connectionerror: ('connected aborted.', error(10061, 'no connection made because target machine actively refused it')) any appreciate, thanks! import requests bs4 import beautifulsoup url="https://github.com/session" # define user agent headers={"user-agent":"mozilla/5.0 (windows nt 6.1) applewebkit/537.36 (khtml, gecko) chrome/37.0.2062.120 safari/537.36"} username="username" password="password" # create session crawl authenticated sessions s=requests.session() #update user agent in session cre...

mongodb - How do I specify a client certificate to moped in mongoid.yml? -

i trying set mongoid connect mongodb server using ssl client certificates authentication. however, cannot find comprehensive reference options in mongoid.yml . for example, found this: how enable ssl/tls in mongoid 3 client? - references ssl: true option (which seems work), mongoid.yml option not appear documented anywhere can find. i able connect using client certificate using mongo shell. if leave out ssl: true option in mongoid.yml, @ server "assertionexception handling request, closing client connection: 17189 server configured allow ssl connections" if use ssl: true option, "error: no ssl certificate provided peer; connection rejected" suggesting ssl: true option working. so, there way provide client cert/key , ca cert mongoid using mongoid.yml? or there way make connection mongod , provide connection mongoid? or not possible use ssl client certificates authentication mongoid? this question posted several years ago, before mongoid gem...

sql - What is the error The data types varchar and datetime2 are incompatible in the add operator -

declare @state varchar(32) =null, @industry varchar(128)= null, @listsource varchar(128) = null, @timezone varchar(30) =null declare @today datetime set @today = getdate() declare @ssql nvarchar(3000) set @state=1 set @industry=1 set @listsource=1 set @timezone=5 set @ssql = 'select top 20 p.id'+ char(10) +'from dbo.prospects p (nolock)'+ char(10) + 'where p.state=isnull('+ char(39)+@state +char(39)+','+'p.state)'+ char(10) + 'and p.industry ='+@industry + char(10) +'and p.listsource='+@listsource+ char(10) +' , p.statusid not in(-1,2,4,5,6,7,8,9,12,13,14)'+ char(10) +' , isnull(p.pushdate,'+char(39)+'1/1/1900'+char(39)+')<='+char(39)+@today+char(39)+ char(10) +'and p.timezone ='+@timezone+ char(10) +' order isnull(p.lastactivitydate,'+char(39)+'1/1/1900'+char(39)+')' this immediate problem: ')<='+char(39)+@t...

sqlexception - JDBC Invalid column index exception -

for sql query select m.txrefno,m.processdate f.processid=? , (m.countrycode in (?) or m.countrycode null) , (m.txrefno=?) i have passed string as stmt.setstring(3, entry.getvalue().tostring()); stmt.setstring(2, entry.getvalue().tostring()); stmt.setstring(1, entry.getvalue().tostring()); but showing invalid column index exception .

javascript - how to integrate TinyMCE and CKEditor in Meteor JS? -

i trying use ckeditor or tinymce editor in project. put tinymce folder in meteor public folder, put <head> <script type="text/javascript" src="<your installation path>/tinymce/tinymce.min.js"></script> <script type="text/javascript"> tinymce.init({ selector: "textarea" }); </script> in template head tag. receiving following error. resource interpreted script transferred mime type text/html: "http://localhost:3000/%3cyour%20installation%20path%3e/tinymce/tinymce.min.js". (index):97 uncaught syntaxerror: unexpected token < tinymce.min.js:1 uncaught referenceerror: tinymce not defined how fix problem? same ckeditor. there other rich editor ,which can use in meteor js? first, need put ckeditor build download in public folder. ckeditor comes sorts of stuff , references based on relative directories. your public folder should have directory named ckeditor should ...

javascript check existence of elements of 1 array inside the other -

for searching elements of 1 array inside other, 1 may use indexof() on target of search , run loop on other array elements , in each step check existence. trivial , knowledge on javascript too. 1 please suggest more efficient way? maybe built-in method of language help? although couldn't hit such method using google. you can use array.filter() internally , implement function on array's prototype returns elements common both. array.prototype.common = function(a) { return this.filter(function(i) { return a.indexof(i) >= 0; }); }; alert([1,2,3,4,5].common([4,5,6])); // "4, 5" again mention in post, logic works taking each element , checking whether exists in other.

apache - Exception java.io.IOException: Failed to set permissions of path: \tmp\hadoop-user\mapred\staging\user1322875957\.staging to 0700 -

14/09/24 14:55:04 error security.usergroupinformation: priviledgedactionexception as:bquser cause:java.io.ioexception: failed set permissions of path: \tmp\hadoop-bquser\mapred\staging\bquser1322875957\.staging 0700 java.io.ioexception: failed set permissions of path: \tmp\hadoop-bquser\mapred\staging\bquser1322875957\.staging 0700 @ org.apache.hadoop.fs.fileutil.checkreturnvalue(fileutil.java:691) @ org.apache.hadoop.fs.fileutil.setpermission(fileutil.java:664) @ org.apache.hadoop.fs.rawlocalfilesystem.setpermission(rawlocalfilesystem.java:514) @ org.apache.hadoop.fs.rawlocalfilesystem.mkdirs(rawlocalfilesystem.java:349) @ org.apache.hadoop.fs.filterfilesystem.mkdirs(filterfilesystem.java:193) @ org.apache.hadoop.mapreduce.jobsubmissionfiles.getstagingdir(jobsubmissionfiles.java:126) @ org.apache.hadoop.mapred.jobclient$2.run(jobclient.java:942) @ org.apache.hadoop.mapred.jobclient$2.run(jobclient.java:936) @ java.security.accesscontroller.dopri...

c# - extending enum property from referenced dll -

this question has answer here: enum “inheritance” 13 answers inside mvc4 have model public class myviewmodel { public someenum myenum { get; set; } public string name { get; set; } } this someenum located in other dll referenced web app. cannot change dll (someenum) further clarity want use enum (someenum) little extension, want add few more enum properties. how can done? it cannot, basically. all can declare new enum, perhaps same name in difference namespace, perhaps different name: namespace my.local { public enum someenum { // originals = the.other.someenum.a, b = the.other.someenum.b, c = the.other.someenum.c, // extras d, e, f } }

xml - convert & to &amp; in xslt -

i have variable containing xml value <xsl:variable name="resp"> <table> <news_id>39</news_id> <news_title>strada &#8211; tso</news_title> <news_content>extending support ifa&#8217;s family in form of income security paying last drawn trail paid ifa before demise.</news_content> <news_type>1</news_type> <doc_url>upload/docs/12345.pdf</doc_url> <doc_size>185859</doc_size> <news_date>2014-09-19 12:54:11.0</news_date> <is_enabled>1</is_enabled> </table> <xsl:variable> how parse values in variable. please help. i have structure, this: <?xml version="1.0" encoding="utf-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/xsl/transform" xmlns:xs="http://www.w3.org/2001/xmlschema" exclude-result-prefixes="xs" version="1.0"> <xsl:output i...

java - How to be avoid duplicates entries at insert to MongoDB -

i want shure when inputting new dbobject db unique , collection doesn't contain key field duplicates . here how looks now: public abstract class abstractmongodao<id, model> implements genericdao<id, model> { protected mongo client; protected class<model> model; protected dbcollection dbcollection; /** * contains model data : unique key name , name of method */ protected keyfield keyfield; @suppresswarnings("unchecked") protected abstractmongodao() { parameterizedtype genericsuperclass = (parameterizedtype) this.getclass().getgenericsuperclass(); model = (class<model>) genericsuperclass.getactualtypearguments()[1]; getkeyfield(); } public void connect() throws unknownhostexception { client = new mongoclient(config.getmongohost(), integer.parseint(config.getmongoport())); db clientdb = client.getdb(config.getmongodb()); clientdb.authenticate(co...

angularjs - Access to all states of angular-ui-router programmatically -

i have $stateprovider configured this: angular.module('example', ['ui.router']) .config(function($stateprovider, $urlrouterprovider) { $urlrouterprovider.otherwise("/steps"); $stateprovider.state('steps', { url: '/steps', templateurl: 'steps.html', controller: function($scope, $state) { $scope.$on('$statechangesuccess', function(event, tostate, toparams, fromstate, fromparams) { $scope.currentstep = tostate.data && tostate.data.stepnumber; }); if ($state.is('steps')) { $state.go('.first'); } } }) .state('steps.first', { url: '/first', template: 'first', data: { stepnumber: 0 }, }) .state('steps.second', { url: '/second', template: 'second'...