Posts

Showing posts from January, 2010

angularjs - iPad radio button issue within ionic popover -

i using radio buttons in popover create dropdown type filter app. when use ipad radio buttons go haywire! works on every other device. best illustration in video https://www.youtube.com/watch?v=begkz4us8hq here code: <script id="templates/popover.html" type="text/ng-template"> <ion-popover-view> <ion-content> <div class="item bar-header bar-positive"> <h2 class="title">difficulty</h2> </div> <label class="item item-radio"> <input type="radio" ng-model="filter.difficulty" value="" name="group"> <div class="item-content"> </div> <i class="radio-icon ion-checkmark"></i> </label> <label class="item item-radio

matrix - Subsetting by row condition in R -

i'm trying work out way of subsetting matrix purely numeric (i.e. no column/row names). put in form of worked example, drop rows not meet logical condition. set.seed(42) m <- matrix(sample.int(100, 10*10, true), 10, 10) say want make subset keep rows maximum row value 90 or over, drop not meet condition. the way can think of doing through if/else loop ( max(m[i,]) > 90 ) feel there must more elegant way of doing this. any ideas? you can in several steps. first, find maxima of rows using apply on rows: maxima = apply(m, 1, max) # [1] 92 99 99 98 93 96 98 91 98 84 next, greater threshold: above = maxima >= 90 # [1] true true true true true true true true true false now, use subset data: m[above, ] or, in 1 line: m[apply(m, 1, max) >= 90, ] you can expand condition arbitrarily. instance, test whether maximum between 2 values, can this: between = function (x, lower, upper) x >= lower & x <= upper m[between(a

SAP Gateway runtime odata path permissions -

is there standard way change runtime permissions user able call odata resources of sap gateway service, other manually writing code in every service implementation method check if request allowed? for example, based on setting in customizing, odata paths below /foo , /bar user x should forbidden, i.e. http get/post/delete <host>:<port>/foo/test , http get/post/delete <host>:<port>/bar/test should yield http 403 user x , http get/post/delete <host>:<port>/something should ok . is there way can controlled @ single place rather being required implement check in every method implementing odata requests? the proper place authorization check in backend method. authorization error should populate service , yield 403 example. if reason don't want that, write own http handler , insert in sicf called on paths. the standard role setup allows access or no access service, "pattern" access referring missing. can't under

ios - How to define url schemes starting with http ios7 -

i can define custom schemes myapp third applications can redirect links like: myapp://mypage.com app(if user installed it). want third applications open app if user try open links http://mysite/mypage.com too. right can see safari open yourtube when type links like: http://www.youtube.com/watch?v=wzh30t99mam or map application opens if type links like: http://maps.google.com/maps ..... so how can define custom scheme third applications open apps if user type: http://a.myapp.com short answer: can't without server support. apple tricks not available third party apps redirect http urls maps , youtube. the way set web server @ http://a.myapp.com redirected myapp://

java - NoClassDefFoundError on **CacheModel -

i trying add relationship between tables using below code <column name="categories" type="collection" entity="category" mapping-table="shoppingitem_category"/> after have built service using **localserviceutil.getcategoryitems(categoryid) api throwing exception java.lang.noclassdeffounderror: com/htmsd/slayer/model/impl/shoppingitemcachemodel @ com.htmsd.slayer.model.impl.shoppingitemmodelimpl.tocachemodel(shoppingitemmodelimpl.java:618) @ com.liferay.portal.dao.orm.common.entitycacheimpl.putresult(entitycacheimpl.java:241) @ com.liferay.portal.kernel.dao.orm.entitycacheutil.putresult(entitycacheutil.java:67) @ com.htmsd.slayer.service.persistence.shoppingitempersistenceimpl.cacheresult(shoppingitempersistenceimpl.java:1079) @ com.htmsd.slayer.service.persistence.shoppingitempersistenceimpl.fetchbyprimarykey(shoppingitempersistenceimpl.java:1431) @ com.htmsd.slayer.service.persistence.shoppingitempersistenceimpl.findbyprimarykey(s

sql - Select a row, and the rows either side of it -

i'm putting blog posts implement json api. end, when retrieve post database, want include links next , previous posts. database means when retrieve row posts table, i'd retrieve row before , row after it. i'm bit of noob sql (specifically postgres). @ moment have following: select * posts id >= ( select id posts id < ( select id posts slug = 'the-slug' ) , published = true order id desc limit 1 ) , published = true order id asc limit 3; ( posts have serial id primary key, published boolean, , slug varchar) all have access slug of centre post. works, breaks if the-slug represents first published row. seems quite naive. there better way go this? edit: i'm trying avoid question being specific problem answers might of more use many. however, above quite loose. consider table created following: create table posts ( id serial primary key, slug varchar(255) unique not nu

mysql - Storing SSNs in a database -

i'm working on web application users need submit social security numbers. i use asymmetric keys encryption if web server compromised private key still safe. application won't processed on webserver. however app needs ability know if ssn duplicate not allow duplicates , b allow users come application. can done? make sense use 1 way hash similar way passwords stored or compromise data? thanks in advance. -- edit i'm adding question after thinking bit more it. since there aprox. 10 billion ssns. make hashing alg. susceptible brute force attacks. salt here. if salt known isn't still susceptible brute force? possible hide salt since if has access database have access salt? don't encrypt ssns, hash them it sounds should hashing ssns rather encrypting them. difference between 2 hashing one-way while encryption not. don't need verify value of data, integrity, use hashing because hashing more secure encryption hashed ssns can not unhashe

go - Converting a C++ snippet to Golang -

i'm trying covert following c++ snippet golang, i'm not having luck getting syntax correct. here's c++ snippet looks like: v8::string::utf8value reqstringobj(args[1]); const char *reqstring = *reqstringobj; char hex[3] = {reqstring[strlen(reqstring) - 2], reqstring[strlen(reqstring) - 1], '\0'}; unsigned char requestid = (unsigned char)strtoul (hex, 0, 16); printf("requestid is: %d\n", requestid); here's have far via go version: reqstr := "somerandomstringthatihave" hex := []uint8{reqstr[len(reqstr)-2], reqstr[len(reqstr)-1], '\u0027'} requestid := ????? i'm not sure how convert casted strtoul function noted in c++ function make work in same way via go version. ideas? you can accomplish rather using strconv.parseuint : reqstr := "jfd0jifdgfa" if len(reqstr) <= 1 { panic("reqstr not long enough") } requestid, err := strconv.parseuint(reqstr[len(reqstr) - 2:], 16, 64) if err != ni

vim - Tweaking syntax checker shellcheck's highlight colors (with syntastic and pathogen) -

to me, shellcheck 's highlight colors , message zone (where syntax flagged dubious , warnings displayed) both wrong. is possible modify status-line and main window highlight colors used shellcheck ? i looked , since have syntax on in ~/.vimrc . imagine main window's highlight color scheme vim's default, opposed having syntax enable , supposedly allows subsequent definition of highlight color scheme user. digging bit more, found since syntastic 's install, have following status line in ~/.vimrc : " general status line option unchanged (vim window , multiple buffer window) - there before syntastic set statusline=%<\ %n\ %f\ %m%r%h\ %y%h%=\ line:\ \%l/\%l\ (\%p%%)\ column:\ \%c\ " syntastic options (new) " set highlight group 'warningmsg' <= defined where? set statusline+=%#warningmsg# " no clue function syntasticstatuslineflag() evaluate or does... set statusline+=%{syntasticstatuslineflag()} " restore normal highl

java - Is it not necessary to implement get method in class B ? Why compiler not enforcing ? Any concepts I missed? -

interface a{ public void get(); public void set(); } abstract class abstracta implements a{ @override public void get(){ system.out.println("in funciton"); } abstract public void set(); } class b extends abstracta implements a{ @override public void set(){ system.out.println("in set method"); } } is not necessary implement method in class b? is because abstracta implemented same method ? is multiple inheritance ? is not necessary implement method in class b? no, since abstracta implements , b extends abstracta . is because abstracta implemented same method ? yes. , because b extends abstracta . both required work. is multiple inheritance ? no, not. b still inheriting 1 class - abstracta .

c++ - how define derived class in header file and definition in a cpp file with method virtual -

i trying define derived class in header file , definition of in cpp file have errors my project files main.cpp #include <iostream> #include "americanperson.h" int main(int argc, char** argv) { americanperson joe("joe"); return 0; } human.h #ifndef human_h__ #define human_h__ #include "definiciones.h" #include <string> using namespace std; class human { protected: string namec; public: human(const string & name); virtual void talkto(const human & person) const; string name() const; }; #endif human.cpp #include "human.h" human::human(const string & name) : namec(name){} string human::name() const { return namec; } americanperson.h #ifndef americanperson_h__ #define americanperson_h__ #include "human.h" #include <string> using namespace std; class americanperson : public human { public: americanperson(const string

uitableview - Not able to access the variable declared outside the function in UITableviewcontroller swift -

i using simple uitableviewcontroller var testdata = [string]() override func tableview(tableview: uitableview, cellforrowatindexpath indexpath: nsindexpath) -> uitableviewcell { let cell = tableview.dequeuereusablecellwithidentifier("controlcell", forindexpath: indexpath) as! tableviewcell // configure cell... cell.clabel.text = testdata[indexpath.row] return cell } testdata declared outside function. testdata populated method. the issue is: self.testdata shows no data when put breakpoint , check data. using variable correctly in swift ? adding complete code here: import uikit import alamofire class tableviewcontroller: uitableviewcontroller, uitableviewdatasource, uitableviewdelegate { struct listitem { var name:string = "" var number:string = "" var email:string = "" } override func viewdidload() { super.viewdidload() getjsondata() // uncomment following line preser

Reading from file into Python data structure -

i have file has following format: [ ["unique_id1", {"cc":15, "dd":30}], ["unique_id2", {"cc": 184,"dd":10}], ... ] i want directly read file , put data in python data structure. now, i'm processing using regular expressions. there command i'm missing read directly? this file format json you've shown us. you can parse doing import json out = json.load(file_object) either or literal out = eval(file_object.read()) or (preferred) import ast out = ast.literal_eval(file_object.read())

c# - SQL(SQLite) and backwards compatibility -

a beginner in sql/db here- i'm designing universal windows app db might come in handy, i'm reading on sql/sqlite , i'm wondering- how backwards compatibility (classes/tables wise) works? suppose add or remove property class i've been using base table- still able interact old- class data , cast updated class? how 1 go monitoring added/ removed properties while querying db? thank time. edit: scenario- if i've got user 2 properties- 'id', 'name'. public class user { public int id {get; set; } pubic string name {get; set;} } and i've built application 'users' db , i'm using while. then, add property user- class. suppose it's 'age'. can add new property original 'user' class , still able access original users table with- var user = dbconnection.table<user>().where(x => x.id == tid).firstordefault(); obviously, 1 option keep original user , create class userex have original properties + age. grab

smartface.io - Repeatbox row label not visible until clicked -

i using youtube link guide when repeatbox loads, see 3 empty row. when click on row, text of label becomes visible. when click on different row, new label visible. has encountered before? there recommended font size or row height should using? can try following chances, 1. changing background/font color of label? 2. un-check "enable pull-down refresh" & "enable pull-up refresh" options in "palette". - make confirm having issue in repeaterbox rendering rows.

database - Are foreign keys that are part of a composite key automatically indexed in Oracle? -

for instance, if have students table: create table student ( student_id number(8), student_name varchar2(30), constraint pk_student primary key (student_id) ); and subject table: create table subject ( subject_id number(8), subject_name varchar2(30), constraint pk_subject primary key (subject_id) ); and create third table of student's favorites subjects: create table fav_sub ( student_id number(8), subject_it number(8), constraint pk_fav_sub primary key (student_id, subject_id), constraint fk_1_fav_sub foreign key (student_id) references student(student_id), constraint fk_2_fav_sub foreign key (subject_id) references subject(subject_id) ); do need manually create indexes foreign keys in fav_sub table such as: create index in_1_fav_sub on fav_sub(student_id); create index in_2_fav_sub on fav_sub(subject_id); or indexes foreign keys automatically created database, since they're part of composite key? edit: clarify,

Impact of Java 1.7 on Solr 5.2.1 -

when start solr instance following: warning: java version 1.7.0_51 has known bugs lucene , requires -xx:-usesuperword flag. please consider upgrading jvm. i find list of these bugs see if impact system, can't find them online. know live? thanks you can have @ lucene javabugs . there can find corresponding lucene bug , oracle bug "segv or serious index corrumption" bug needs usesuperword property.

Add a new user to existing group chat in Quickblox -

how can add new user existing group chat ? lets have group chat a, b , c . need add user d chat . i using android , js sdks . to achieve this, on groupchat manager need call method updatedialog(qbdialog dialog, qbrequestupdatebuilder requestbuilder), of new array of users' ids transferred. , need inform newly added chat users added, no push notification sent automatically.

Syntax error on print with Python 3 -

this question has answer here: what “syntaxerror: missing parentheses in call 'print'” mean in python? 3 answers why receive syntax error when printing string in python 3? >>> print "hello world" file "<stdin>", line 1 print "hello world" ^ syntaxerror: invalid syntax in python 3, print became function . means need include parenthesis mentioned below: print("hello world")

audio - What setup would you recommend for a serverside Synthesizer? -

briefly put, want create website, outputs audiostream based on input given client in synthesizer-like interterface. accessing site have exact same audiostream , state of interface, want work done server , let client manage input. while not newbie programming, bit overwhelmed amount of possibilities implement that. can recommend practical setup this, libraries (programming language may tied this) use serverside, clientside , technology efficient way communicating between them? know, isnt quickest question answer, appreciate help. ps: project meant educational me , not of commercial use or anything "synthesizer" vague... isn't clear functionality expecting , @ latencies. in case, start node.js , implementation of web audio api. https://github.com/sebpiq/node-web-audio-api unfortunately, package isn't finished, it's along know of. liquidsoap has quite bit of functionality might find useful. depending on needs, different approach have server ap

mysql - Convention for boolean values in databases -

i'm making database first time, exciting, problem comes in form of convention of boolean or binary variables. within database, user makes request server takes few hours resolve (because human on other end has interact it). there few ways label opened or closed request. column called open set true or false or make column called status filled strings "open" or "closed". there convention or being pedantic? you not being pedantic, , design database in advance based on how going used. my recommendation have statuschanges table. each time status changes, have (at least): a unique id status change record the account being affected the new status (and perhaps old status) date/time stamp person making change the ability current status user might important. if so, can store information in user record. alternatively, can complicated query on statuschanges table. or, turn slowing changing dimension having effective , end date each record. th

PHP header() failing in Chrome and Firefox -

the following code works in safari not firefox or chrome header('content-description: file transfer'); header('content-type: application/octet-stream'); header('content-disposition: attachment; filename=' . basename($file)); header('content-transfer-encoding: binary'); header('expires: 0'); header('cache-control: must-revalidate, post-check=0, pre-check=0'); header('pragma: public'); header('content-length: ' . filesize($file)); ob_clean(); flush(); readfile($file); ob_end_flush(); exit; the webpage @ xxxx might temporarily down or may have moved permanently new web address. error code: err_invalid_response $file variable links file outside of public_html directory. i can't seem find fix, ideas? i've had issue filesize() on chrome , firefox in past. fix. <?php function real_filesize($file) { $fmod = filesize($file);

php - Need Assistance with Symfony 2.7 creating first page -

i trying learn symfony framework , struggling it. instructions not helpful or assume know lot more know. trying create single web page proper route , controller. have been googling find answers , made progress no luck yet. right have standard install of symfony default bundles etc. created project called "gtest3" , chose php it... i not sure put new route in (what file) or maybe needs put in more 1 file? i found "routing.yml" file seems need put it... here in there right now: gtest3: resource: "@gtest3bundle/resources/config/routing.php" prefix: / app: resource: "@appbundle/controller/" type: annotation i guessing need add , put location/filename of controller? have tried doing few ways , errors. there "routing.php" file referenced in above code. not sure if "controller" or if additional piece of "route". here code file: use symfony\component\routing\routecollection;

cryptography - PGP encryption algor -

i'm learning in detail how pgp system works there somethings not said everywhere tried ; according diagram : https://upload.wikimedia.org/wikipedia/commons/4/4d/pgp_diagram.svg when encrypting, use data , random key have protected data ( 1 locket ). here's first problem, how these data crypted ? algorithm has been used ? my second problem @ last encryption ; locket data + locket key = encrypted message same thing here, how ? did used ? also, read somewhere, hashing whole data can't change or break everything, when ? thanks in advance ! so questions are: how data , random key encrypted , algorithm used. what algorithm used encrypted message locket data + locket key. the message digest algorithm used in pgp (version 5.0 , later) called sha, stands secure hash algorithm, designed nsa national institute of standards , technology (nist). sha 160-bit hash algorithm. that should answer both questions. checkout pdf sha256 actaully used

c# - SerialPort.GetPortNames() returns incorrect port names -

while c# not primary programming language, i'm maintaining such program couple of years now. program connects device on serial port , works windows xp 8.1. 1 specific "feature" uses .net framework 2.0. with users upgrading windows 10 we've got complains program cannot detect/open com port of device. have confirmed on our own test systems clean win10 installation. it turns out function serialport.getportnames() returns incorrect port names , adds 'strange' characters after port name. example: com3吀 com3䡢 com3゠ etc. when refresh list, every time character (or two) shows after number. test code super straightforward: string[] portnames = system.io.ports.serialport.getportnames(); log("available ports:"); foreach (string portavailable in portnames) { log(portavailable); } where log function mearly adds line standard textbox on form: txtlog.text += msg + environment.newline; this works in every other windows version

vs code typescript compile does nothing -

i installed vs code try out. hit ctrl+shift+b on .ts file. first time, asked me set build task, did. now, build again , nothing. no errors or warnings no .js file either. ideas missed? tasks.json { "version": "0.1.0", // command tsc. assumes tsc has been installed using npm install -g typescript "command": "tsc", // command shell script "isshellcommand": true, // show output window if unrecognized errors occur. "showoutput": "silent", // args program compile. "args": ["app.ts"], // use standard tsc problem matcher find compile problems // in output. "problemmatcher": "$tsc" } tsconfig.json { "compileroptions": { "target" : "ess", "module": "amd", "sourcemap": true } } whenever have problem task in visual studi

scala socket client doesn't get response after sending binary data to python server -

i used scala socket client send binary data python server. found python socket server not able read data scala client. tried adding \r\n on tail of message, no effects. following scala client code please: val s = new socket(inetaddress.getbyname(socket), 5000) s.setsotimeout(120*1000) val inputstream = s.getinputstream() val buffersource = new bufferedsource(inputstream) val out = new printstream(s.getoutputstream()) lazy val in = buffersource.getlines() //send data python server socket thedata:array[byte] = //the data comes sparkstreaming, it's byte array. out.println(thedata) out.flush() if(in.hasnext){ val json1 = in.next() } the following python server code please: class tcphandler(socketserver.streamrequesthandler): def handle(self): while true: cur_thread = threading.current_thread() self.data = self.rfile.read() if not self.data: break output=calculate256(self.data) self.wfil

parse.com - Parse iOS Destroy Button (Password Validation Dependent) Client side -

i'm starting create lot more features users in app. i've run app structure issues. lets have user fooman fooman wants edit account, delete objects(wall posts), update friends list etc. fooman logged in of these. footman isn't 1 using device @ moment. it's fooman son (foobaby). foobaby decides son , delete things erroneously. have option users delete account client side. present them alert view confirm that's choice meant select. after confirm that, view populates 'destroy' (or delete button) delete user, plus relations/pointers/data connected it. before button enabled password validation check required it's not done foobaby. however, parse, has proved problematic client side. don't use cloud functions because, well, put, @ point in time app 1 platform , doesn't need use it. is there workaround has come that's quick/efficient, api friendly validating textfield.text [pfuser currentuser].password whilst maintaining security of cour

java - SpringMVC JSP: Method not called on initial page load -

i want springmvc call method when my-site.com loads adds attributes model other working methods do. used annotation: @requestmapping(value = "/", method = requestmethod.get) the problem is, spring ignores method reason, yet allows else work. work-around have declare this: @requestmapping(value = "/unnecessary-page", method = requestmethod.get) and put link my-site.com/unnecessary-page on main page. strange. how work way intended? edit : web.xml file: <?xml version="1.0" encoding="utf-8"?> <web-app xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xsi:schemalocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" version="3.1"> <!--dispatcher config--> <servlet> <servlet-name>dispatcher</servlet-name> <servle

delphi - How to get a shortcut string from TShortCut in an action? -

i'm using tactionmanager , each action has keyboard shortcut assigned it. display text represents keyboard shortcut user. example, f4 or ctrl+f or ctrl+shift+s . however, tshortcut defined as: type tshortcut = low(word)..high(word); how can obtain user-readable string represents shortcut assigned action? i'm answering own question q/a style. there's built-in function called shortcuttotext() converts given tshortcut readable representation. on other hand, there's texttoshortcut() works other way around, converting string tshortcut , given it's valid shortcut value.

python - Hashed primary key -

i have table library each row represents music track. want make primary key track's audio fingerprint. unfortunately sqlalchemy passes me postgres error when try insert: operationalerror: (psycopg2.operationalerror) index row size 3384 exceeds maximum 2712 index "library_fingerprint_key" hint: values larger 1/3 of buffer page cannot indexed. consider function index of md5 hash of value, or use full text indexing. i want store full fingerprint normal column , create hashed version primary key. i've tried using sqlalchemy's context-sensitive default functions still above error msg. is there way automatically hash primary key based on column (the fingerprint column)? code snippet below def fingerprint_md5(context): return hashlib.md5(context.current_parameters['fingerprint']).hexdigest() class library(base): tablename = 'library' track_hash = column(string, primary_key=true, default=fingerprint_md5) fingerprint

java - Unknown NullPointerException in Slick2D -

i trying understand basics of making game in slick2d. have 4 classes: main , entity , misc (pastebin.com/e5wqf6ma) , fish (pastebin.com/ie0anxxx) whenever run code, console log. mon aug 17 00:15:07 bst 2015 info:slick build #237 mon aug 17 00:15:07 bst 2015 info:lwjgl version: 2.9.3 mon aug 17 00:15:07 bst 2015 info:originaldisplaymode: 1366 x 768 x 32 @60hz mon aug 17 00:15:07 bst 2015 info:targetdisplaymode: 640 x 480 x 0 @0hz mon aug 17 00:15:08 bst 2015 info:starting display 640x480 mon aug 17 00:15:08 bst 2015 info:use java png loader = true mon aug 17 00:15:08 bst 2015 info:controllers not available exception in thread "main" java.lang.nullpointerexception @ com..prototypes.project_blueberry.util.misc.addid(misc.java:24) @ com..prototypes.project_blueberry.util.entity.<init>(entity.java:16) @ com..prototypes.project_blueberry.entity.fish.<init>(fish.java:15) @ com..prototypes.project_blueberry.main.init(main.java:56) @ org.newdawn

ios - Swift: When adding a new file the device is iPhone but I can not change it -

i have no idea why doing , not aware of repercussions. whenever add new file project, enter name , on under drop down device, texted grayed out , iphone selected. want make app universal can not seem change this. any appreciated, , insight on problems may face building app iphone files. if mean universal between iphone , ipad, it's nothing worry about. swift files compile run on both iphone , ipad without problem! long have set deployment info in project target.

FireFox 40.0.2 & Selenium 2.45.0 -

firefox error "the page isn't redirecting firefox has detected server redirecting request address in way never complete. problem can caused disabling or refusing accept cookies." when run cucumber test. i can open firefox , can't error messages. , have tried clear cookie, cache , accept third-party cookie , on. didn't work. is there other ways can tried ? is firefox specific issue? if not check url on other browsers faced issue time , reason being url redirection ex: assume there 2 urls : url , url b apparently there 2 url redirect entries in table: url redirecting url b url b redirecting url a which caused issue. let me know how goes!

kendo ui - Uncaught TypeError: l.renderElement is not a function -

i have shared tooltip graph: $scope.kissachart.setoptions({ renderas: 'canvas', drag: ondrag, dragend: ondragend, zoom: onzoom, tooltip: { visible: true, format: "{0:n2}", shared: true, background: '#add8e6', sharedtemplate: createtemplate } }); here template generator : function createtemplate (val1) { var template = ""; if (val1 && val1.points && val1.points && val1.points.length > 0) { template += "<div>"; // construct date template += "date: "; template += ((val1.points[0].dataitem.date) ? val1.points[0].dataitem.date : ""); template += " " + ((val1.points[0].dataitem.actualtime) ? val1.points[0].data

Git submodules vs. iOS/Mac frameworks -

i developing several libraries plan on utilizing in series of mac , ios apps. want input on best tool share code between projects. 2 options considering frameworks , git submodules. here relevant information: 1. developing of libraries. don't work on team. 2. these libraries provide code relating ui , cloud service integration. 3. once libraries written, don't plan on updating them unless break. it seems git submodules provide better control managing versions of app reference versions of library. however, frameworks might easier integrate xcode project. frameworks useful protect sources. if it's own company, impact limited. can make things more clear etc, doesn't bring advantage on using subproject example. in case use git submodules because it's clean way things.

sql - Add an index to a timestamp with time zone -

i want improve slow query, thinking add index, don't know index type better case. select count(*) ct events dtt @ time zone 'america/santiago' >= date(now() @ time zone 'america/santiago') + interval '1s' query plan: "aggregate (cost=128032.03..128032.04 rows=1 width=0) (actual time=3929.083..3929.083 rows=1 loops=1)" " -> seq scan on events (cost=0.00..125937.68 rows=837742 width=0) (actual time=113.080..3926.972 rows=25849 loops=1)" " filter: (timezone('america/santiago'::text, dtt) >= (date(timezone('america/santiago'::text, now())) + '00:00:01'::interval))" " rows removed filter: 2487386" "planning time: 0.179 ms" "execution time: 3929.136 ms" the query gets count of events of day. dtt timestamp time zone column. i'm using postgresql 9.4. note: erwin advices query run little faster still think isn't fast enough.

Prevent css inherited from parent -

below html code <ul class="tabs"> <li class="rotate"><a href="#tab1" class = "nororate" >one</a></li> <li class="rotate"><a href="#tab2" class = "nororate">two</a></li> </ul> and below css code .rotate { transform: perspective(5px) rotatex(2deg); } i want rotate li tag not rotate a tag, have tried :not , > prevent a tag rotated failed. how can this? you apply this: .rotate { transform: rotate(2deg); } .norotate { transform: rotate(-2deg); } basically should rotate parent element , rotate content in opposite direction return original position.

javascript - Angular $http result sort and bind to view? -

i'm trying render results data pulled successful $http.get, push through 2 or 3 functions sort/concat/filter data few different ways, , store rest of apps duration. i have following service: myapp.service('versionservice', function($http, $log, $q) { var self = this; this.issues = { all: [] }; this.versions = { all: [], byname: [], byid: [] }; var query = {}; query.jql = "fixversion in unreleasedversions() order fixversion asc"; $http({ url: '/search/versions', method: 'post', //cache: true, data: query }) .then(function (response) { //console.log(response.data.issues); for(var = 0; < response.data.issues.length; i++) { self.issues.all.push(response.data.issues[i]); for(var j = 0; j < response.data.issues[i].fields.fixversions.length; j++) { self.v

javascript - Change page background color based on active Bootstrap tab -

i want use jquery change page background color based on bootstrap tab active. this script used bootstrap tabs: $('#mytabs a').click(function (e) { e.preventdefault() $(this).tab('show') }) i need modify body's background-color css property depending on tab active. the fiddle below has bare-bones bootstrap 3 tabs gold background color. need able set seperate hex value each of 4 tabs. jsfiddle you can use contains selector * add click event , check particular id set page background color based on bootstrap tab click : $('[id*="tab-"]').click(function (e) { e.preventdefault() $(this).tab('show') if(this.id=="tab-1"){ $('body').css('background', 'red'); } else if(this.id=="tab-2"){ $('body').css('background', 'green'); } else if(this.id=="tab-3"){ $('body').css('backgrou

node.js - Register callback and return document -

this first experience nodejs and mongo. handling database query handlers in seperate js file, exported module in file, handles user requests. want search (findone) user document collection table, , return callee. cannot figure out how register callback , return document, once query execution completes.. here code, call method: var record = mongodatahandler.getuserrequestobject(credentials.email, ""); how change call, such should like: mongodatahandler.getuserrequestobject(credentials.email, "", function (result){ //handle result response here }); here getuserrequestobject, in js file (mongodatahandler.js): var mongoclient = require('mongodb').mongoclient , format = require('util').format; var assert = require('assert'); var ds = require('../../server/datasources.json'); var dbmongoconnectorurl = ds.mongodbdev.url; module.exports = { getuserrequestobject : function(email, number){ var documentobj = null;

ruby - Something wrong with active_record -

i got error when ran 'rackup' command after using rake database migrations, don't understand means. c:/railsinstaller/ruby2.1.0/lib/ruby/gems/2.1.0/gems/activerecord-4.2.3/lib/active_record/railties/databases.rake:3:in `<top (required)>': undefined method `namespace' main:object (nomethoderror) c:/railsinstaller/ruby2.1.0/lib/ruby/gems/2.1.0/gems/activesupport-4.2.3/lib/active_support/dependencies.rb:268:in `load' c:/railsinstaller/ruby2.1.0/lib/ruby/gems/2.1.0/gems/activesupport-4.2.3/lib/active_support/dependencies.rb:268:in `block in load' c:/railsinstaller/ruby2.1.0/lib/ruby/gems/2.1.0/gems/activesupport-4.2.3/lib/active_support/dependencies.rb:240:in `load_dependency' c:/railsinstaller/ruby2.1.0/lib/ruby/gems/2.1.0/gems/activesupport-4.2.3/lib/active_support/dependencies.rb:268:in `load' c:/railsinstaller/ruby2.1.0/lib/ruby/gems/2.1.0/gems/sinatra-activerecord-2.0.6/lib/sinatra/activerecord/rake.rb:1:in `<top (