Posts

regex - Python testing if whitespace(\s) symbol is in string -

i have problem testing if "\s" symbols present in string. example '\sgoogle\s.com' must show there is. # use raw strings ignore escapes: s = r'\sgoogle\s' print s, s.find(r'\s') != -1 # , regex: import re print re.search(r'\\s', s) gives: \sgoogle\s true <_sre.sre_match object @ 0x7f2d696fc850>

sql - Sqlite on Android: select time only from datetime -

i have date , time (saved plain text string) in sqlite in following format: yyyymmddhhmm (hours , minutes in end). can make select based on time - day between 18:00 , 20:00? you can extract parts of datetime stamp substr() , use regular comparison operators < , > or between on it. example: select * tablename substr(timestampcolumn, 9, 4) between '1800' , '2000';

javascript - Drop down menu toggle -

i'm making site that's responsive. when page <=830px of page changes. i need figuring out way toggle sub menus 1 @ time. wordpress generates same .sub-menu class name each submenu. i'm using code toggle menus both go @ same time. need make browser less 830px see i'm talking about. $(".about").click(function() { $(".sub-menu").slidetoggle("fast"); return false; }); //.click $(".projects").click(function() { $(".sub-menu").slidetoggle("fast"); return false; }); //.click thank help. http://www.mackeyshotrods.com/store/?page_id=2 $(document).ready(function () { $("#na ul li").click(function () { $(this).siblings().find('ul').slideup(400); $(this).find('ul').slidetoggle('fast'); }); }); demo: http://jsfiddle.net/7p3df/1/

clojure - Leiningen compilation order? -

i'm learning how lein , , i'd use java source class created deftype in clojure source. wasn't covered in basic tutorial , can't work properly. the problem java source can't import clojure class, since hasn't been compiled yet. , clojure class isn't compiled, since compilation aborted java source. i give minimal example: create new project with: lein new app javafoo add project.clj :aot :all :java-source-paths ["src/java"] put src/javafoo/core.clj : (ns javafoo.core) (deftype ppoint [x y]) put src/java/javafoo.java : package foo.java; import javafoo.core.ppoint; public class javafoo { public static void main(string[] args) { system.out.println("javafoo"); } } try compile lein compile it fails package javafoo.core doesn't exist . have to comment out :java-source-paths compile uncomment :java-source-paths compile it works. there way make work start? add line project.clj : ...

python - How to force genfromtxt read csv as record array? -

i'm trying read csv following line: raw_data = genfromtxt(datafile,delimiter='\t',dtype=none) ok, function reads file record array when meets string data in datafile. far understand, when dtype none, file should read record array too. correct? however, if there no string data , numeric 1 presented, function reads data ndarray. if no, there convenient way force function read file record array? the problem ndarray code built in order process record arrays. upd1 in case try it, here brief solution. possibly 1 not best, @ least works: read file csv ndarray raw_data = genfromtxt(datafile,delimiter='\t',dtype=none) generate default names , datatypes columns: names_=['f'+str(i) in range(raw_data.shape[1])]; names=[(name,raw_data.dtype) name in names_]; and finaly, create record array: raw_data_as_ra = raw_data.ravel().view(names); you use recfromcsv , derived genfromtxt , instead: if file looks like: col1,col2,col3 1.1, 2.4, 3...

Kendo UI dropdown list - different background color to each list item -

how provide different background colors each list item (non-selected) in kendo ui dropdown list rather giving common background color whole dropdown? you should defined template sets appropriate color. example: define datasource as: var colors = [ "red", "green", "pink", "blue", "yellow" ]; and template as: <script id="template" type="text/kendo-script"> <div style="background-color: #= data #">#= data #</div> </script> then dropdownlist definition should as: var template = kendo.template($("#template").html()) $("#dropdownlist").kendodropdownlist({ datasource: colors, template : template }); working example here: http://jsfiddle.net/onabai/mzlrs/

ios7 - iOS 7 Translucent Tab Bar and Nav Bar -

Image
i having issue translucent uinavigationbar , uitabbar in ios 7, whereby if have uinavigationbar translucent works expect to, set uitabbar translucent strange effect happening in 1 out 4 tabs in app. let explain images: this image shows interface nav bar set translucent: with image showing result of user scrolling content , under nav bar: now, how expect look, , when user scrolls content under nav bar looks did before. if set uinavigationbar translucent, , scroll content under nav bar, result different second image: event tab bar doesn't right me. next image shows of nav bar if different before, when content scrolled underneath it: again, don't thing of tab bar correct, next image shows different tab content underneath it, subtle change of tab bar: has else had similar issues this? (this set in storyboard) well, annoying one. added fifth tab had mkmapview in it. on running app , selecting fifth tab, tint colour nav , tab bars removed, d...