Posts

Showing posts from June, 2010

java - Tomcat jdbc connection pool, does not release connections after using -

what may reason tomcat not release connections after using? herem config <resource name="jdbc/datasource" auth="container" type="javax.sql.datasource" username="))" password="))" driverclassname="oracle.jdbc.driver.oracledriver" url="))" factory="org.apache.tomcat.jdbc.pool.datasourcefactory" initialsize="55" maxactive="55" maxidle="55" maxwait="15000" testwhileidle="true" testonborrow="true" testonreturn="false" validationquery="select 1 dual" validationinterval="20000" timebetweenevictionrunsmillis="30000" removeabandoned="true" removeabandonedtimeout="60" /> the probable don't close connections after using them. can happens example if don't manage correctly exceptions.

spring security - Order of Java Config SecurityBuilder's -

i'm developing web application unsing spring security 4.0.0's java config instead of xml config. i'm using objectpostprocessor s customize of spring security's beans, notably session consurrency ones (to achive immediate invalidation of session user logs in again, opposed spring's standard behavior of invalidating @ next request). it's working expected of times, when restart application seems not beans modified want. are securitybuilder s processed in specific order or instead processed ramdom order? edit: my config @enablewebsecurity public class securityconfig extends abstractcaswebsecurityconfigureradapter { public securityconfig() { super(true, false, true); } @autowired private environment env; // need custom sessionregistry there's no way ahold of 1 created configurer. @bean public sessionregistry sessionregistry() { return new sessionregistryimpl(); } // need custom httpsessioncsrf...

python get active user in linux when 2 users are logged in -

i write python script starts desktop user session in ubuntu linux. send requests server on external device signal. if change user in ubuntu (not logout first, login second) - 2 requests server 1 device signal. want determine user in "active" desktop session , send request user only. how can it? p.s. script has minimal gui user, cannot run background service.

angularjs - Unit Test vs. e2e Test vs. REST Test -

i building angularjs application fetches data rest resource. rest server has own e2e tests (http requests make changes in database real sample data) , in front-end using karma run unit tests in code. with front-end unit testing can test controllers, directives, services... , think scenario. back-end doesn't need tested again in front-end tests. templates , such things can unit tested using selectors , checking visibility, availability, or whatever need. so angularjs e2e testing for? necessary if have back-end tested or missing something?

matlab - Unable to implement Impulse MF in Fuzzy Logic Toolbox, -

i'm trying implement impulse mf in fuzzy logic toolbox in matlab shown in fig.1 link : http://s17.postimg.org/bbhkcibbj/fig_1.png but when trying implement in matlab unable so. shown in figure 2 link fig 2. http://s17.postimg.org/cf6a27lcf/fig_2.png how can in matlab.

java - Convert List<T> to Collection<Object[]> for JUnit Parametrized Test -

i perform junit parametrized test data being external. have list of objects , need know how can convert collection of object arrays. see below stack overflow question, want add data file read method. parameterized junit tests non-primitive parameters? working code: this: @runwith(parameterized.class) public class sampletest { private branchmailchildsample branch; public sampletest(branchmailchildsample branch) { this.branch = branch; } @parameters public static collection<object[]> data() { string excel = "c:\\resources\\testdata\\excelsheets\\branchmail\\branchmail_testdata.xlsx"; excelmarshallertool tool = new excelmarshallertool(excel); list<branchmailchildsample> items = tool.unmarshallexcel(branchmailchildsample.class); //right here need help: convert list collection<object[]> //return items collection of object arrays } @test public void test() { system.out.println(branch.tostring()); ...

rewrite the seqneighjoin function in matlab -

i have task rewrite seqneighjoin function in matlab adding frequency of sequences. after searching, understand function returns phylogenetic tree object obtained seqences neighbor joinn method wiki http://en.wikipedia.org/wiki/neighbor_joining now, have following 2 questions. (1): data structure of phytree object obtained function? how express it? example, similar linkage function, returns phylogenetic tree, , data structure clear there, i.e., matrix 3 columns, i-th column indicates nodes combined , corresponding distance when combined. time , attention. (2): based on wiki, how supposed add frequency function seqneighjoin? totally confused. thanks time , attention. appreciate that. edit: following code. function z = seqneighjoin(d_all, freq) n = size (d_all, 2); m=(1+sqrt(8*n+1))/2; z=zeros(m-1,3); q=zeros(m,m); str = zeros (m,m); % initialize distance matrix d d=ones(m,m); d(tril(d,-1)==1)=d_all; d(triu(d,1)==1)=d_all; d(eye(m,m)==1) = 1:m...

Apache Kafka Consumer Connection -

i looking @ docs of apache kafka. the consumer connects kafka using ip address/port of zookeepers. is possible use ip address/port of broker? yes, when using simple consumer api manage consumption directly brokers. see usage example here

svn - Maven release plugin not using configured username -

i using maven-release-plugin:2.5.1. need configure connect svn using public/private key authentication. i'm having problems getting configuration use correct username when attempting ssh connection svn. my deploy-settings.xml <server> config looks like: <server> <id>my.server.org</id>   <username>[xxxx]</username>   <privatekey>/home/[yyyy]/.ssh/id_rsa</privatekey> </server> my pom.xml <scm> config looks like: scm:svn:svn+ssh://my.server.org/data1/svns_zzzz/zzzz/path/to/the/project/trunk my mvn command line looks like: --batch-mode release:clean release:prepare release:perform -s /home/[yyyy]/.m2/deploy-settings.xml -dsettings.security=/home/[yyyy]/.m2/master-settings.xml when tried above configuration failed. not commit modified pom file svn. debug problem, set following environment variable: svn_ssh="ssh -vvv" when did this, saw in debug statements many authentication failure...

dojox.grid.datagrid - Strange error using Dojo Data Grid in Xpages -

Image
my xpage contains header document data @ top , categorized dojo data grid child documents after it. in view set "at runtime, open selected document using" property "xpage associated document's form" , associate correct xpage form. i did on view containing header docs. when document loaded, , when not in edit mode, dojo data grid threw strange error. if go edit mode on doc, dojo data grid works. if change setting above explicitly choose correct xpgage open, work. i don't have problem changing setting explicit, know why works 1 way , not other. here code rest data source: <xe:restservice pathinfo="griddata" id="restservice1"> <xe:this.service> <xe:viewjsonservice viewname="(rstallrsppctasks)" var="rstentry" systemcolumns="4"> <xe:this.columns> ...

windows - Printer installation fails with "Unable to install printer - Some driver files are missing or incorrect" -

Image
attempting install my custom printer driver i'm working on (a unidrv minidriver-based one) fails error (windows 8.1 pro x64): the lettermaster.gpd file can found here: https://github.com/tazetschnitzel/lettermaster-unidrv/blob/f9bcd4756bd095629d6a49115af17ce3bb16169c/lettermaster.gpd (though doubt problem) the inf file known fine. by "install" mean going add printer -> blah -> have disk -> choosing inf file -> clicking next -> filling in name of printer -> next. it'll show uac prompt, seem go alright bit, error above shows up. edit: after using gpdcheck able fix syntactic errors in lettermaster.gpd file didn't know existed. have new error: the lettermaster.gpd content this: https://github.com/tazetschnitzel/lettermaster-unidrv/blob/10c4eed1c0b1592dbdd00466bc7a31a259223dbe/lettermaster.gpd

nlp - use Python to convert files of word counts to sparse matrix -

i have series of files, each 1 containing counts of words. each file have different words. here's example: filea word1,20 word2,10 word3,2 fileb: word1,10 word4,50 word3,5 there 20k files , each have tens of thousands of words. i want build sparse matrix each row represents file's word distribution, you'd out of scikit's countvectorizer . if word1, word2, word3, word4 columns, anf filea , fileb rows expect get: [[20,10,2,0],[10,0,5,50]] how achive that? if possible, i'd able include words appear in @ least n files. you use dictionaries mapping words how appear , file names word counts in files. files = ["file1", "file2"] all_words = collections.defaultdict(int) all_files = collections.defaultdict(dict) filename in files: open(filename) f: line in f: word, count = line.split(",") all_files[filename][word] = int(count) all_words[word] += 1 then can use in ...

android - Gear Fit. Samsung cup SDK doesn't works after reboot -

i'm trying add gear fit support software. basically when known event occurs try create dialog on gear showing data. well works expected when run software after brand new installation,and continues work until phone reboot. after reboot dialog on gear fit doesn't appear anymore. test executed on note2 , note 3 running android 4 , android 5. both same results. when works logcat show like. 04-14 18:25:17.570: i/scupdialog(17663): new dialog (100) 04-14 18:25:17.590: w/contextimpl(17663): implicit intents startservice not safe: intent { act=com.samsung.android.sdk.cup.scupservice } android.content.contextwrapper.bindservice:559 com.samsung.android.sdk.cup.scupservicecommunicator.connect:-1 com.samsung.android.sdk.cup.scupdialog.construction:-1 04-14 18:25:17.600: d/vibratorservice(754): turning vibrator off - immvibe. 04-14 18:25:17.600: v/vibratorservice(754): vibratemagnitude - package: com.villa.android.orari3, ms: 2000, token: null, magnitude: 2000 04-14 18:25:17....

php - laravel eloquent orm view -

my ultimate goal print contents of table in database table in html using laravel's orm. beyond know how configure database file, there other things need configure. from understanding need 3 files. need make controller? if how work? item class route.php views.php here have far item.php <?php namespace app; use illuminate\database\eloquent\model; class item extends model { protected $table = 'items'; protected $primarykey = 'item_id'; public function products() { return $this->belongsto('item_id', 'item_name', 'item_cost'); } } routes.php <?php route::get('product', function() { $products = \app\items::all(); return view('items', $items); }); and have no idea how create view in html. i know i'm off @ point, i've read documentation , still lost when reference things uri , have url in same sentence without defining or linking elsewhere in documen...

c++ - Implement binary search with string array instead of int array -

the program supposed incorporate it. created of code, second part of lab have go , input strings binary search instead. don't how search strings if have remove idnum , results , empid. const int num_names = 20; string names[num_names] = {"collins, bill", "smith, bart", "allen, jim", "griffin, jim", "stamey, marty", "rose, geri", "taylor, terri", "johnson, jill", "allison, jeff", "looney, joe", "wolfe, bill", "james, jean", "weaver, jim", "pore, bob", "rutherford, greg", "javens, renee", "harrison, rose", "setzer, cathy", "pike, gordon", "holland, beth" }; so, b...

curl - Sendgrid PHP Use of undefined constant CURL_SSLVERSION_TLSv1_2 -

i'm using sendgrid api send email message on http via php. code: <?php $url = 'https://api.sendgrid.com/'; $user = 'user'; $pass = 'password'; $params = array( 'api_user' => $user, 'api_key' => $pass, 'to' => 'target', 'subject' => 'kami menanti anda', 'from' => 'noreply@kompetisiindonesia.com', ); $params['html'] = 'html message'; $params['text'] = $params['html']; $request = $url.'api/mail.send.json'; // generate curl request $session = curl_init($request); // tell curl use http post curl_setopt ($session, curlopt_post, true); // tell curl body of post curl_setopt ($session, curlopt_postfields, $params); // tell curl not return headers, return response curl_setopt($session, curlopt_header, false); // tell php not use sslv3 (instead opting tls) curl_setopt($session, curlopt_sslversion, cu...

javascript - What is standard practice for handling user forms and file uploads? -

what standard practice handling data in text fields , file upload fields? the question similar 1 i asked previously , 1 more general. if borrow example of user registering account, includes name , email , , several file upload fields, actions taken after form submission amount to: (1) validate text fields name , email (2) if validation success, create , save user instance db. (3) save images disk (4) update user instance include filepaths of saved images. the files uploaded aren't big, 5mb or less, problems associated uploading large 1gb+ files aren't issue question. from i've read, there 2 ways of handling this. submit together. there several unanswered threads this: https://softwareengineering.stackexchange.com/questions/239170/how-to-parse-multipart-field-file-data-separately node.js busboy parse fields , files seperatly i know text fields should come before file fields when submitting form mscdex's comment in other question. but ther...

c# - loop that checks every char in a string -

i'm making cool thing makes secret letter can send friend, i'm having few problems. i'm trying make loop on every char in string string, can check if letter value , change it. this code : private void button1_click(object sender, eventargs e) { string translatedtex = richtextbox1.text.tostring(); int indexletter = translatedtex.length; (int item = 0; item < indexletter; item++) { char normal_a = 'a'; // if(translatetext[item] = normal_a) // { //do // } if(translatetext[item] = "a") { //do } } } i've tried switch check of value between quotes "" '' or = == , nothing helps. shows error : - property or indexer string.this[int] cannot assigned -- read - cannot implicitly convert type char bool / string i don't know want ...

postgresql - Can't restore a dump backup file for Postgres using pg_restore -

i generated dump backup file postgres 9.3.4 using this: pg_dump table_name -u myusername -h localhost -o > backup.dump now i'm trying backup old database using: pg_restore -u myusername -n public -d table_name backup.dump but keep getting error: pg_restore: [archiver] input file appears text format dump. please use psql. please note file not plain sql file since generated using pg_dump. i used follwoing command: psql perchwell -u myusername -f backup.dump -v on_error_stop=1 and start receiving following error: set set set set set set psql:backup.dump:16: error: schema "propertydir" exists the default output format of pg_dump plaintext sql script. use psql import or redump -fc flag.

How to create a graph in C# using SQL Server database? -

i'm using sql server database , c# form, want create graph in c# form database data. i use msdn sample codes didn't work; no error , no response! thank helping me ;) // access database string filenamestring = "data\\chartdata.mdb"; // initialize connection string string myconnectionstring = "data source=" + filenamestring; // define database query string myselectquery="select name, sales reps ;"; // create database connection object using connection string sqlconnection myconnection = new sqlconnection(myconnectionstring); // create database command on connection using query sqlcommand mycommand = new sqlcommand(myselectquery, myconnection); // open connection mycommand.connection.open(); // create database reader sqldatareader myreader = mycommand.executereader(commandbehavior.closeconnection); chart1.series["default"].points.databindxy(myreader, "name", myreader, "sales"); // close r...

javascript - Angular changes JSON string -

Image
i'm trying show data on screen using angularjs, asp.net , json.net. when i'm calling $.getjson returns normal jsonarray, when i'm putting data in this.variablename inside angular controller, data changes , angular won't display in view. model public class directory { public int id { get; set; } public string name { get; set; } public list<note> notes { get; set; } public int parentid { get; set; } public list<int> directoryids { get; set; } public virtual directory parent { get; set; } public virtual icollection<directory> directories { get; set; } } .net controller action public string getdirectories() { var directories = db.directories.where(d => d.parentid.equals(0)).tolist(); return jsonconvert.serializeobject(new { directorylist = directories }, formatting.indented, new jsonserializersettings { referenceloophandling = referenceloop...

c# - Uniquely identify controls in nested gridview for validation -

i have nested grid. validate dropdown control within child grid when user adds record. in nested grid, control ids not unique. if have 2 parent rows , nested grid under each parent child grid controls have same id. when validate, validation checking of nested grids , not 1 trying add to. this markup: <asp:gridview id="groupgridview" runat="server" autogeneratecolumns="false" caption="group information" captionalign="top" cssclass="grid" showfooter="true" datakeynames="groupid"> <columns> <asp:templatefield> <itemtemplate> <a href="javascript:divexpandcollapse('div<%# eval("groupid")%>');"> <img id="imgdiv<%# eval("groupid")%>" width="25px" border="0" src="ima...

c - Garbage values; strange string strlen value -

i trying write function inserts 1 string string @ specified value. returning few garbage values toward end of new string, presumably because, reason, strlen of new string greater should be; strlen(combo) should equal s1 + s2 not. not sure why returning 13 instead of 9 length. here's code: #include <stdio.h> #include <string.h> void insertstring(char *string1, char *string2, int position) { int i, j = 0, k = 0, s1 = strlen(string1), s2 = strlen(string2); char combo[s1 + s2]; (i = 0; < s1 + s2; i++) { combo[i] = i; } (i = 0; < s1 + s2; i++) { if (i < position) { combo[i] = string1[i]; j++; } else if (i >= position && < position + s2) { combo[i] = string2[k]; k++; } else if (i >= position + s2) { combo[i] = string1[j]; j++; } } (i = 0; < strlen(combo); i++){ printf("%c...

c# - IIS Working Directory -

we using third party dll, looks license file in working directory of application. when code run out of typical c# application, dll able pick license file located in same directory ( \bin\ ). when asp.net application running same code under iis, fails due licensing issues. work around have found has place license file in windows\system32\inetsrv . it seems though dll referencing license file using simple file.open("*.lic*); , , because iis using inetsrv working directory ( https://stackoverflow.com/a/16485227/693671 ), looks there. there way change working directory of iis application?

javascript - JQuery Ajax Success not being triggered -

i'm not sure why ajax success isn't being triggered/called. controller called , code executed fine. i'm not returning anything, method void! need return (actionresult/jsonresult/etc) success trigger? here controller code. public void deleteevent(string eventid) { diaryeventservice.deletediaryevent(eventid); } here ajax call. $.ajax({ url: '/managespaces/deleteevent', datatype: 'json', data: { eventid: eventid, }, success: function() { //var obj = json.parse(doc); var mycalendar = $('#fullcalendar'); mycalendar.fullcalendar(); mycalendar.fullcalendar('removeevents', eventid); $("#eventdetails").collapse('toggle'); } }); yes, need return jsonresult : [httppost] public jsonresult deleteevent(string eventid) { diaryeventservice.deletediaryevent(eventid); return json("{status:"ok"}"); } since changing back-end dat...

Android - contact picker in fragment -

i have viewpager/sliding tabs. want able 4 contacts address book on phone , save them in app later use. have code contact picker activity contact page fragment , have yet work. any ideas or suggestions appreciated! code main activity connected to: import android.os.bundle; import android.support.v4.app.fragment; import android.support.v4.app.fragmentmanager; import android.support.v4.app.fragmentpageradapter; import android.support.v4.app.fragmenttransaction; import android.support.v4.view.viewpager; import android.support.v7.app.actionbar; import android.support.v7.app.actionbaractivity; import android.view.view; import android.widget.button; import android.widget.edittext; import android.widget.textview; public class mainactivity2activity extends actionbaractivity implements actionbar.tablistener, viewpager.onpagechangelistener { private viewpager mviewpager; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); set...

Python inport file with elements as int to list -

i want read int , there pythonic way of doing this? f = open('p059_cipher.txt', 'ru') holder = list((f.read().replace('"', '').split(','))) letters = list() number in holder: letters.append(int(number)) i'm trying guess input, might work: from ast import literal_eval open('p059_cipher.txt') f: data = "[" + f.read() + "]" result = list(map(int, literal_eval(data))) # call list necessary if both # 1. explicitly need list # 2. you're running python3 # if you're in python2 or need iterate, ignore list call this should take input like: "1", "2", "3", "4", "12", "1003981890213" and create result == [1, 2, 3, 4, 12, 1003981890213]

python has multiple versions for different users -

i running python script sudo , throws exception, found python versions different follows, i'm using centos 6: [haifzhan@home]$ sudo python --version python 2.6.6 [haifzhan@home]$ sudo su - [root@home ~]# python --version python 2.7.5 [haifzhan@home]$ python --version python 2.7.5 when login root or username, python version 2.7, when use sudo run, 2.6. can tell me how make them version 2.7, should configure? calling python means call first executable of name in directory pointed $path environment variable. different users have different $path variables set. propose have @ them understand executable called (it /usr/local/bin/python vs. /usr/bin/python or similar). view call, use type python once user , once user root . to call specific python binary can call explicit full path (e. g. /usr/local/bin/python ). call same executable regardless of value of $path variable. alternatively can configure accounts both have same binary first in $path variable...

java - Nested flatmap observable rxJava -

say have blog post api returns list<post> i'd translate else using rxjava. overall i'd break long string paragraphs , words, each word, combine paragraphs , combine blog post. each post can broken multiple paragraphs broken multiple words. logically i'd following , can't find async manner in. create observable list split each observable observable<string> on \n give me paragraphs split paragraphs observable<string> on ' ' segment words do kind of transformation each word (some words have puncuation part of them fine) combine words paragraph putting space between each one combine paragraphs post putting carriage return between each one. i'm having trouble figuring out how multiple levels of splitting , combining on particular term. if needed split pages can flatmap(observable::from).tolist() won't seem work. appreciated. i think should work fine, code pretty self-explanatory. i make nested calls observ...

utf 8 - XML is not read correctly (ISO-8859-1 / UTF-8) -

i have little piece of code, reading easy affiliate xml. url http://pf.tradetracker.net/?aid=193104&encoding=iso-8859-1&type=xml-v2&fid=556821&r=tt-canvasholidays.nl&categorytype=2&additionaltype=2 when try put xml in array , process basic functions, seems special characters being replaced encoded ones. for example word château in original xml replaced château when read xml in php follows: $xml = simplexml_load_file($file); foreach($xml->product $child) { $name = mysql_real_escape_string($child->name); } had programmed escape function replaces of Ãx -things correct characters, " â " string seems not accepted in php code. i have read articles wrong database conversion, i'm reading , interpreting source xml , in simplexml_load_file no encoding specified. o btw, i'm not experienced php programmer, stuck wordpress in combination proven technologies affiliate productfeeds, until french data coming through :) hope can...

sql server 2012 - Procedure Advice -

i'm looking boost performance on 1 of our processes within production database. have 2 sets of sps configuration settings stored within configuration table. an example syntax be: declare @switch bit if @switch = 1 insert dest_table_a select values source_table if @switch = 2 insert dest_table_b select values source_table would better practice in instance move if logic clause create standardized instead of logic having conditional within it? e.g. insert dest_table_a select values source_table @switch = 1 insert dest_table_b select values source_table @switch = 2 i appreciate might opinion piece curious see if else has had experience scenario. the second example might lead parameter sniffing problem . ( longer explanation here ) this issue created query optimizer generates execution plan optimized 1 of values of switch statement (and value send first time when call stored procedure). in case, if call stored procedure @switch = 1 first time, ex...

jsf 2 - f:ajax not rendering h:selectManyListbox -

using f:ajax component h:selectmanylistbox , firing listener method not refreshing rendering list. i have market. when select market needs display sub-markets. initial page load have markets , sub-markets, needs filter when user selects "market". using below code: <ui:fragment id="uda2" rendered="#{udalist.index eq 1}"> <div class=" row form-group" > <label class="col-sm-2" for="sel-service">market:</label> <div class="col-sm-10"> <h:selectmanylistbox style="width:360px;" multiple="" pt:aria-required="true" required="required" pt:data-toggle="chosen" disabled="# {licenseselectionbean.isfieldenabled(formfieldsenum.item_uda2)}" id="#{formfieldsenum.item_uda2.getfieldcode()}" size="1" name="#{formfields...

button - XMonad/Submap: how do I accept both KeyPressEvent (keyboard presses) and ButtonPressEvent (mouse clicks)? -

i wish modify xmonad.actions.submap accepts both keyboard , mouse events (for example, left clicking might set action, or abort submap). figured first step grab , ungrab mouse buttons: -- | given 'data.map.map' key bindings x () actions, return -- action waits user keypress , executes -- corresponding action, or nothing if key not found in -- map. -- -- executes default action def if key not match of keybindings. submapdefault :: x () -> m.map (keymask, keysym) (x ()) -> x () submapdefault def keys = xconf { theroot = root, display = d } <- ask io $ grabkeyboard d root false grabmodeasync grabmodeasync currenttime -- added: grab mouse buttons -- make difference whether it's buttonpressmask or buttonreleasemask? io $ grabbutton dply button1 anymodifier root true buttonpressmask grabmodeasync grabmodeasync none none io $ grabbutton dply button3 anymodifier root true buttonpressmask grabmodeasync grabmodeasync none none (...

mysql - How does a database loop through rows? -

this question has answer here: how database indexing work? 10 answers i'll start explaining scenario: creating mmorpg , want better understanding of efficient way store items in inventory. research, found games have inventory table rows have item_id, item_quantity, user_id, , slot_id. i'm thinking table potentially have millions of rows. so if use simple statement such as: select item_id inventory user_id = 25; then how database "find" result return? have "loop" through every single record until finds match? concern that, if in fact way done, wouldn't select statements take forever? thanks, ian you need follow basic principles of table creation. have id column keep table normalized(check out table normalization online. find lots of stuff). add indexes on column. ex: in inventory table can have index on user_id c...

html5 - Puting <div>s next to each other -

i have been searching way put divs next eachother , found 1 "worked" there issue float: left; it worked! popped them out of parent div , looks silly. background of parent div no longer cares them. how can put 2 divs, side side, while in div? remove float , try : display: inline-block;

python - How to retrieve dicts from a list of dicts using wildcard key value -

i have large list of dictionaries, each dict has key:value normal. want grab dicts match particular wildcard key value name key in example below. for example, if values of name keys below in format a_b_c_d (e.g. john_michael_joseph_smith ), how grab dicts searching name values of format a*d (e.g. john*smith ?) or format a_b* (e.g. john_michael* ) etc? mylist=[{id:value,name:value,parent:value}, {id:value,name:value,parent:value}, {id:value,name:value,parent:value}...] your patterns appear use unix filename patterns; * matching number of characters. can use fnmatch.fnmatch() function produce filter: >>> fnmatch import fnmatch >>> fnmatch('john_michael_joseph_smith', 'john*smith') true >>> fnmatch('john_michael_joseph_smith', 'john_michael*') true you use filter in list comprehension produce new list of matching dictionaries, testing each dictionary['name'] value against pattern...

javascript - JQuery Slider Help - Mouse-Over event solution -

so, seeking simple in context, challenging implement. i want hover function disabled until user clicks play button , pause button. so, mouse-over function of slider void until user clicks un-mute button (play youtube button) , clicks mute button (pause yt button). if go jsfiddle see that, upon load, if mouse hovers on slider , hovers out ... slider moves (after 6 sec). not want slider start until user starts youtube video. var w = $('#image_rotator').width(), n = $('#slider .slide').length, c = 0, s = 0, intv; if (n <= 1) $('#left, #right').hide(); $('#slider').width(w * n); $('#left, #right').click(function () { c = (this.id == 'right' ? ++c : --c) < 0 ? n - 1 : c % n; $('#slider').stop().animate({ left: -c * w }, 300, function () { if (c == 0) { $('#playiunmute').show(); } if (c == 1) { $('#left').show(); } if (c == 1) { $('#right').show()...

python - delete string in a pandas dataframe -

i have df = pandasdataframe data. i have second pandas-dataframe (called df_outlier) keys (that exist in df) , want remove them df. df_outlier i looking following function - might not right approach. key contains alphanumeric values - letters , numbers. not int. clean_df = (df['id'] - df_outlier['id']) any ideas? thanks. to filter df using multiple values df can use isin , return boolean mask rows values exist in passed in list/series. in order filter out these values use negation operator ~ invert mask: clean_df = df[~df['id'].isin(df_outlier['id'])]

c# - How to get Repeater Item data object on ItemCommand event -

i have repeater of linkbuttons , on itemcommand event. need data object created link button. my datasource list on itemcommand need myobject object = ??? are looking this? send id code behind using commandargument can processed. <asp:linkbutton id="linkbutton1" commandargument='<%# eval("id") %>' runat="server" commandname="mycommand">linkbutton</asp:linkbutton> and in code behind: protected void repeater1_itemcommand(object source, repeatercommandeventargs e) { if (e.commandname == "mycommand") { string myid = e.commandargument.tostring(); } } or can use commandargument='<%# container.itemindex %>' . know row number , can access corresponding index in source.

asp.net - Impersonate using Forms Authentication -

i have asp.net site must use forms authentication , not windows authentication access activedirectorymembershipprovider . site must use forms because need designed input form instead of browser authentication popup windows authentication uses. the site needs impersonate user logged in via active directory access user specific files. however, windowsidentity.getcurrent() not same httpcontext.current.user.identity although web.config contains: <authentication mode="forms"> <forms loginurl="login.aspx" timeout="480"/> </authentication> <identity impersonate="true" /> i cannot use loginuser() , windowsidentity.impersonate() because need impersonate ad user specific permissions, , don't know user's password because forms takes care of logging in. is possible maybe login.aspx.cs, take system.web.ui.webcontrols.login.password , save loginuser() token in session variable windowsidentity.impersonate(...

python - Numpy apply function to group in structured array -

starting off structured numpy array has 4 fields, trying return array latest dates, id, containing same 4 fields. found solution using itertools.groupby works here: numpy mean structured array the problem don't understand how adapt when have 4 fields instead of 2. want whole 'row' back, rows latest dates each id. understand kind of thing simpler using pandas, small piece of larger process, , can't add pandas dependency. data = np.array([('2005-02-01', 1, 3, 8), ('2005-02-02', 1, 4, 9), ('2005-02-01', 2, 5, 10), ('2005-02-02', 2, 6, 11), ('2005-02-03', 2, 7, 12)], dtype=[('dt', 'datetime64[d]'), ('id', '<i4'), ('f3', '<i4'), ('f4', '<i4')]) for example array, desired output be: np.array([(datetime.date(2005, 2, 2), 1, 4, 9), (datetime.date(2005, 2, 3), 2, ...

ios - Warning: Method override for designated initializer -

i programmatically create several tables , code has worked fine years. did not generate warnings 2 weeks ago when last ran it. i’ve since updated ios 8.3 , 3 warnings each uitableviewcontroller. method override designated initializer of superclass '-initwithstyle:' not found. method override designated initializer of superclass '-initwithcoder:' not found. method override designated initializer of superclass '-initwithnibname:bundle:' not found. the code initialize table similar of tables: - (instancetype)initinmanagedobjectcontext:(nsmanagedobjectcontext *)context withscorekeeper:(scorekeeper *)scorer withwordlist:(wordlist *)wordlist { self = [super initwithstyle:uitableviewstylegrouped]; if (self) { _mobjcontext = context; _scorekeeper = scorer; _wordlist = wordlist; } return self; } and .h looks this: @interface settingstableviewcontroller : u...