Posts

Showing posts from May, 2014

database - Still getting stuck with Mysql 2013 error after changing read time out -

i'm relatively new database programming , i'm hoping can me error since i'm out of ideas. i keep getting "mysql error code 2013: lost connection mysql server during query". wrote not-short , not-simple query select statements embedded 2 or 3 levels deep in "from" clause. though can't imagine in grand scheme of queries particularly complex. when copy , paste inner queries separate tab , run them, run in under 2 seconds. when joined 1 query i'm getting 2013 error. under "duration/fetch time" field says somewhere between 50-60 seconds each time try make work. i've read other threads , #1 recommendation increase "dbms connection read time out (in seconds):" in mysql workbench. did that. , i'm still getting problem. i've tried in 2 different locations highly doubt there's connection issue. any ideas? try changing max_allowed_packet higher value. try show global variables 'max_allowed_pack

How to get exit node ip in PHP app running on tor/lighttpd -

i'm having trouble getting ip address of exit node hits hidden service (php). no matter try, comes local (127.0.0.1), if it's going through proxy. i have tor configured this: hiddenserviceport 80 127.0.0.1:9028 and lighty this: server.port = 9028 which means hit against hidden service should arrive through tor on virtual port 80 , directed 9028 on lightly, , served end user. i have privoxy installed don't believe has tor hidden services (i've confirmed thru privoxy debug logs). i've tried code this: if (!empty($_server['http_client_ip'])) { return $_server['http_client_ip']; } else if (!empty($_server['http_x_forwarded_for'])) { return $_server['http_x_forwarded_for']; } return $_server['remote_addr']; but headers don't include forwarding ip information. what missing? why can't lightly see exit node ip address? there way configure proxy in there somewhere alter headers , inject

javascript - Why printing multiple times on calling a function - AngularJS -

i calling function controller scope, in console values printed 3 times. why happening? source <!doctype html> <html ng-app="mymodule" > <head> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular.min.js"></script> </head> <body ng-init="pricelist='promo03,promo04'"> <div ng-controller="pricingcontroller" > {{splitarray()}} </div> <script> var mymodule = angular.module('mymodule',[]); mymodule.controller('pricingcontroller',['$scope', function($scope){ $scope.pricestring = $scope.pricelist; $scope.array = []; $scope.splitarray= function(){ console.log($scope.pricestring); $scope.array = $scope.pricestring.split(","); console.log($scope.array[0]); console.log($scope.array[1]); }; }]); </script> </body> </html> console output promo03,promo04 pr

ipython - Ambiguity on Python Installation -

so new python , installed using guidelines various websites, want try basic examples before moving on advanced python concepts. below understanding , installation tasks performed. 1) installed python 2.7 form website. 2) installed anaconda read has pre installed libraries. 3) downloaded pip file , ran on python interpreter , done successfully, when try using pip install ipython , throws error saying pip not defined. 4)now downloaded pycharm ide, done successfully. 5) programs run perfectly, see many instances of ipthon on every related website , not able understand if need it. ipython used web guess don't understand how integrate everything. please guide me. thanks in advance. if using windows, pip error related environmental variables not being set. see answer details on pip adding python path on windows 7 response comment ipython not necessary, make life easier. use command prompt , not familiar installing packages pycharm or anaconda. i

Superuser Role Specific to certain Databases in PostgreSQL -

i have created user role superuser privilege. have around 30 databases on server. want assign role only db. current role lets user access dbs super user. how can restrict him accessing other dbs super user. this have assigning superuser: create role fc login superuser inherit nocreatedb nocreaterole noreplication; can me this? as @craig explained, can't (and if could, pointless). the usual way of implementing restricted superuser permissions connect existing superuser role, , create security definer functions containing limited set of approved commands. these functions executed privileges of creator rather caller. but need very careful not open injection vulnerabilities, because within function run superuser. e.g. caller write custom = operator grants them superuser rights, , put in search path, need absolutely sure you're using = in pg_catalog schema. at least, should: create of these functions clause security definer set search_path pg_cat

jquery - Add Caption and Thead using javascript -

i have made html table java script not understanding how add caption , thead. var arr =[ ["period ends", "payroll due", "payday"], ["06/13/15", "06/19/15", "06/26/15"], ]; var body, tab, th, tr, td, tn, row, col; body = document.getelementsbytagname('body')[0]; tab = document.createelement('table'); (row=0; row < arr.length; row++){ tr = document.createelement('tr'); (col=0; col < arr[row].length; col++){ td = document.createelement('td'); tn = document.createtextnode(arr[row][col]); td.appendchild(tn); tr.appendchild(td); } tab.appendchild(tr); } body.appendchild(tab); this approach use var arr =[ ["period ends", "payroll due", "payday"], ["06/13/15", "06/19/15", "06/26/15"], ]; var body = document.getelementsbytagname('body')[0]

java - Error with creating a game launcher -

i'm making simple java game , trying implement launcher @ beginning of game. for example, jframe button in starts application when it's pressed. what i'm trying have main method call separate class opens jframe , , actionlistener jbutton calls new cliker(); when it's called. however, when new cliker(); called outside of main method, opens game jframe , not jpanel . why error happening, , how fix it? relatively new programming apologize in advance unclear points question or program. i appreciate help. if need more classes answer question, ask, or if have other questions feel free let me know. package com.cliker; import java.awt.color; import java.awt.dimension; import java.awt.font; import java.awt.graphics; import java.awt.event.mouseevent; import java.awt.event.mouselistener; import javax.swing.imageicon; import javax.swing.jbutton; import javax.swing.jframe; import javax.swing.joptionpane; import javax.swing.jpanel; import com.cliker.accessori

Digital Signature in java / android (RSA keys) -

i generate digital signature in java/android project private key(rsa) stored in db. my 2 keys generated below code ( project in production , cannot change it ): // keys pair (rsa) keypair rsakyepair = createkeypair(); // private/ public keys , store them in db string pri = getprivatekeybase64str(rsakyepair); string pub = getpublickeybase64str(rsakyepair)); public static keypair createkeypair() { keypair keypair = null; try { keypairgenerator keygen = keypairgenerator.getinstance("rsa"); keygen.initialize(key_length); keypair = keygen.generatekeypair(); } catch (nosuchalgorithmexception e) { e.printstacktrace(); return null; } return keypair; } public static string getprivatekeybase64str(keypair keypair){ if (keypair == null) return null; return getbase64strfrombyte(keypair.getprivate().getencoded()); } public static string getpublickeybase64str(keypair keypair){ if (keypair == null) return n

python - regex search left to right? -

>>> test1 = "123 main street, slc, utah county, utah 84115" # test string >>> address_end_pattern3 = re.compile(r"\b((ut(ah)?)\,?[\s\n](84\d{3}(\-\d{4})?)|(84\d{3}(\-\d{4})?)|(ut(ah)?))\b", re.ignorecase) # 3 patterns concatenated | in order found >>> address_end_pattern2 = re.compile(r"\b((ut(ah)?)\,?[\s\n](84\d{3}(\-\d{4})?)|(84\d{3}(\-\d{4})?))\b", re.ignorecase) # 2 patterns omitting state pattern >>> address_end_pattern1 = re.compile(r"\b(ut(ah)?)\,?[\s\n](84\d{3}(\-\d{4})?)\b", re.ignorecase) # first pattern (state , zip) alone >>> address_end_pattern1.search(test1).group() 'utah 84115' # finds first pattern correctly when pattern >>> address_end_pattern3.search(test1).group() # not when state pattern there 'utah' >>> address_end_pattern2.search(test1).group() 'utah 84115' # finds first pattern when combined zip alone after previous question c

extjs - Liferay cleans the session thus cleans the message that i add into SessionErrors.add in an EXT plugin in Liferay 6.1 -

this question can considered extension of how show error message in liferay portal? working on ext plugin in liferay 6.1 , customizing updatelookandfeelaction, putting error message sessionmessages.add(request,"custom-error-msg"); seems portlet lifecycle cleans session in portalrequestprocessor.java (line 186) deleting session message well. normal your settings saved successfull rendered how can stop further execution in custom updatelookandfeelaction , render error message on /html/portlet/portlet_css/view.jsp i have added <liferay-ui:error key="custom-error-msg" message="custom.error.msg" /> in view.jsp i think read somewhere have create hook , customize end.jsp . right approach? suggestions , directions appreciated. i had override look_and_feel.js following: var savehandler = function(event, id, obj) { var ajaxresponsemsg = instance._portletmsgresponse; var ajaxresponsehtml = '&

python - cx_Oracle does not recognize location of Oracle software installation for installation on Linux -

i have been able install cx_oracle use python 3.4 on windows 8 laptop, , trying same setup (cx_oracle python 3.4) onto linux machine. when running setup.py file cx_oracle-5.1.3.tar.gz, end error: sudo python3 setup.py install traceback (most recent call last): file "setup.py", line 135, in <module> raise distutilssetuperror("cannot locate oracle software " \ distutils.errors.distutilssetuperror: cannot locate oracle software installation following other answers looked @ ( easy_install cx_oracle (python package) on windows , https://gist.github.com/jarshwah/3863378 ) have installed these 3 instant client rpms: rpm -ivh oracle-instantclient12.1-basic-12.1.0.2.0-1.i386.rpm rpm -ivh oracle-instantclient12.1-devel-12.1.0.2.0-1.i386.rpm rpm -ivh oracle-instantclient12.1-sqlplus-12.1.0.2.0-1.i386.rpm and set oracle_home folder installed to, supposed python identify location of oracle files can installation properly. i stil

c - Pointer declaration -

what pointer declaration char *(*a)[20]; mean? difference char **a[20]; ? are both declarations equivalent? , if not, distinction? that pointer array of pointers. char a[20]; array of characters. char* a[20]; array of pointers characters char (*a)[20]; pointer array of characters char* (*a)[20]; pointer array of pointers characters. note char** a[20] array of pointers pointers characters. brackets have higher precedence asterisk, need parentheses declare pointer array.

javascript - How to trap the back button and refresh the page using ajax -

i have web page updates progressivly therefore need windows "back" button call function refresh data , not go page. have first part working trap "back" button with window.onbeforeunload = confirmexit(); and confirmexit() function confirmexit() { switch (page) { case 2: countries(); break; case 3: counties(page3id) break; case 4: cities(page4id) break; } } which works after the page refreshed button default action kicks in , loads previous page. have tried returning true , false. appreciate help, thank you. you need add virtual sites browsers history. way button not lead website. use history.pushstate() add virtual sites. suppose http://mozilla.org/foo.html executes following javascript: var stateobj = { foo: "bar" }; history.pushstate(stateobj, "page 2", "bar.html"); this cause url bar displa

python - Inserting tweets into MySQL DB using Tweepy -

i trying use following python code insert parsed out tweets mysql database: #-*- coding: utf-8 -*- __author__ = 'sagars' import pymysql import tweepy import time import json tweepy import stream tweepy import oauthhandler tweepy.streaming import streamlistener class listener(streamlistener): def on_data(self, data): all_data = json.loads(data) tweet = all_data["text"] username = all_data["user"]["screen_name"] c.execute("insert tweets (tweet_time, username, tweet) values (%s,%s,%s)" (time.time(), username, tweet)) print (username, tweet) return true def on_error(self, status): print (status) auth = oauthhandler(ckey, csecret) auth.set_access_token(atoken, asecret) twitterstream = stream(auth, listener()) twitterstream.filter(track = ["lebron james"]) but running following error: traceback (most recent cal

javascript - Can't get / delete / update Facebook posts -

i using fb's graph api. i kept running useless error message hour, until tested giving myself permissions got work request. { error: { message: 'unsupported request. please read graph api documentation @ https://developers.facebook.com/docs/graph-api', type: 'graphmethodexception', code: 100 } } now, @ least using graph explorer, can using post_id per documentation. however, when post id, receive error { "error": { "message": "(#100) invalid post id", "type": "oauthexception", "code": 100 } } and when run delete request id, receive: { "success": true } however, post never deleted. i tried report bug facebook, bug reporting kept crashing , couldn't bug through. i want create feature post bunch of different groups verify have permission, delete post after. at pace, never in lifetime make happen. have insights why receiving litany of erro

android - Custom Button Image width and height in XML -

i have following implementation, , please see following image, , in first button ( id:button3 ) not fit button, or button size big custom image. wonder how fix issue. <linearlayout android:layout_width="wrap_content" android:layout_height="44dp" android:id="@+id/view3" android:background="#000000" android:layout_alignparentright="true"> <button android:layout_width="48dip" android:layout_height="39dip" android:id="@+id/button3" android:drawableright="@drawable/undo_button" /> <button android:text="button" android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/button2" /> <button android:text="button" android:

ruby - Rails Carrierwave url is nil unless queried again -

i having issue carrierwave/active-record in rails application. problem following code resolves of images null <% ad.all.limit(30).each |ad| %> <img src="<%= ad.carrier_image.url %>" > <% end %> where following renders images fine <% ad.all.limit(30).each |ad| %> <img src="<%= ad.find(ad.id).carrier_image.url %>" > <% end %> the urls there, on initial loop carrier_image not seem preloaded active record objects think issue understanding of rails eager loading, having trouble figuring out how 1 avoid issue what happens when use rails image_tag helper? you're missing brackets off url call per carrierwave documentation, don't think that's what's causing drama. <%= image_tag ad.carrier_image_url() %> as side note, should move "ad.all.limit(30)" out of view if wish keep "railsy".

angularjs - Share $Scope data between States -

i trying access parent state child. tried doesn't work. angular.module('myapp').controller('comparectrl', ['$scope', function($scope) { $scope.test=$scope.$parent.services; app.coffee angular .module('myapp', ['nganimate', 'ngcookies', 'ngresource' , 'ui.router', 'ngsanitize', 'ngtouch']) .config ($stateprovider) -> $stateprovider.state('home', url: "/" templateurl: "home.html" ).state('services', url: "/services" templateurl: "services/list.html" ).state('services.detail', url: "/detail/" templateurl: "detail.html" ).state('services.compare', url: "/compare/" templateurl: "compare.html" ) ui-router supports data (model) sharing among state families. detailed explanation found h

iis - Why does a GET request for an mp4 file in Safari fail? -

i'm trying load mp4 file using javascript jwplayer api, when in safari request retrieve video file fails. looking @ request generated think can see why: mime type listed request "undefined" whereas type should "video/mp4". after quite bit of research can't seem find/comprehend way resolve issue. i have mp4 file extension associated video/mp4 mime type on server. i'm using iis. this problem not occur when try load video in chrome or ie. it's issue safari. this not issue before today. if have suggestions happy try them out. i'm @ point i'm grasping @ straws!

How to fix "Headers already sent" error in PHP -

Image
when running script, getting several errors this: warning: cannot modify header information - headers sent ( output started @ /some/file.php:12 ) in /some/file.php on line 23 the lines mentioned in error messages contain header() , setcookie() calls. what reason this? , how fix it? no output before sending headers! functions send/modify http headers must invoked before output made . summary ⇊ otherwise call fails: warning: cannot modify header information - headers sent (output started @ script:line ) some functions modifying http header are: header / header_remove session_start / session_regenerate_id setcookie / setrawcookie output can be: unintentional: whitespace before <?php or after ?> the utf-8 byte order mark specifically previous error messages or notices intentional: print , echo , other functions producing output raw <html> sections prior <?php code. why happen? to understand why hea

python - How to get fields displaying in a custom plone dexterity form? -

i'm trying avoid writing out few hundred fields in custom addform plone dexterity object. i've created loop called customvisitformtemplate.pt def otherfields2(self): #print "this gets called3" customs="" fields = field.fields(isitevisit) #print dir(fields) r in fields: #print dir(r) #print r.title() if r.startswith("current") or r.startswith("landcover") or r.startswith("surrounding"): pass else: print 'in others', r customs=customs+"""<tal:field tal:replace='structure view/widgets/%s/@@ploneform-render-widget'/>""" % (r) print customs return customs in custom template call this: <fieldset> <legend>general info</legend> <span tal:define="otherfields view/otherfields2"> <div tal:content="struct

django - Serializer inheriting from ModelForm and field type/form type -

i have serializer (django rest framework) return model objects on request: class mymodelserializer(serializers.modelserializer): class meta: model = mymodel after instantiating serializer in view, use serializer.data return key/value of fields: class mymodelapiview(apiview): def get(self, request, **kwargs): obj_pk = kwargs.get('pk') obj = mymodel.objects.get(pk=obj_pk) serializer = serializers.mymodelserializer(obj) return response(serializer.data) this example of returned in json: {"firstname": "john", "lastname": "doe", "active": true} however, i'm using javascript generate form out of (dynamically generated form), , know type of field each key/pair value is, can generate form accordingly. i'm trying subclass modelserializer json returned this: {"firstname": {"value": "john", "type": "textfield"}, &

linux - Java app Tray Icon not displaying properly on CentOS -

i've written java app can used on both windows , linux. app uses trayicon. on windows, works perfectly, on linux (centos) trayicon has 2 problems: 1) i've lost transparency in png image) , 2) image looks shifted (more on later). i take account the different environments getting tray icon size , scaling accordingly. here code: dimension trayiconsize = tray.gettrayiconsize(); image originalimage = toolkit.getimage("tray_icon.png"); image scaledimage = originalimage.getscaledinstance(trayiconsize.width, trayiconsize.height, image.scale_smooth); trayicon = new trayicon(scaledimage, "some text"); on centos, returned dimension .gettrayiconsize() 24x24, after testing, it's fits 24x32 (wxh) image, accounts image appearing shifted when set 24x24. is there way maintain background transparency? also, suggestions on getting sized icon dynamically? size although documentation states systemtray.gettrayiconsize() "returns size, in pixels, o

java - Why does this method call fail? (Generics & wildcards) -

i getting below error: 'call(containsmonitor)' cannot invoke 'call(? extends webscout.monitor)' in 'webscoutcallable' monitor.java webscoutcallable<? extends monitor> handler; public setcallable(webscoutcallable<? extends monitor> callable) { this.handler = callable; } webscoutcallable.java public interface webscoutcallable<t extends monitor> { public void call(t caller); } containsmonitor.java public class containsmonitor extends monitor { public void handledocument() { handler.call(this); } } i'll freely admit i'm new generics , still quite new java itself. find error message confusing looks should work (method declaration expects monitor or subclass, i'm passing in subclass). (+explanation) appreciated! thanks! you have wildcard in type parameter of handler variable. compiler doesn't know exact type of type parameter is, it's either monitor or subclass. th

javascript - Error while including jsp with angular inside non angular jsp -

i included jsp angular directives (a.jsp) inside non-angular jsp(b.jsp). if access a.jsp directly models "{{x}} {{y}}" resolving correctly xvalue yvalue but if access a.jsp through b.jsp seeing unresolved ng-model s. {{x}} {{y}} what reason? my code: inside b.jsp <div id="bcontent" style="display:block;"> <jsp:include page="/jsp/superqueue/a.jsp"/> </div> a.jsp <!doctype html> <meta http-equiv="x-ua-compatible" content="ie=9"> <%@ page contenttype="text/html;charset=utf-8" language="java" %> <html> <head> <meta http-equiv="content-type" content="text/html; charset=iso-8859-1"> <script type="text/javascript" src="<%=webroot%>/js/angular.min.js"> </script> <script type="text/javascript" src="<%=webroot%>/js/angular-sanitize.js"

android - Retrofit parse empy array [] -

i need parse list of object, whith can emply. {"data":[]} use tamplated callback callback<t> called with public static datalist { public list<data> data }; api.getdata(new callback<datalist>() {...}); it crashed error: java.lang.classcastexception: com.google.gson.internal.linkedtreemap cannot cast com...datalist please help your model should work fine. perhaps server isn't returning think does, or maybe not application/json it's returning? here's quick demo: doing on url http://www.mocky.io/v2/5583c7fe2dda051e04bc699a return following json: { data: [ ] } if run following class, you'll see works fine: public class retrofitdemo { interface api { @get("/5583c7fe2dda051e04bc699a") void getdatalist(callback<datalist> cb); } static class datalist { list<data> data; } static class data { } public static void main(string[] args) { api api = new restadap

ios - Deleting a row from a tableView with multiple rows in section -

when try , delete row section multiple rows, when slide left reveal delete button , press it, deletes once tableview refreshed, visually nothing. if press again, deletes both rows in section. if dont press again , press , come viewcontroller, delete has worked animation never happened. deleting cell in section there 1 cell works perfectly. when there 2 cells or more in section, delegate functions never called commiteditingstyle does. let me know if need more code. thanks. here nsfetchedresultscontrollerdelegate methods override func tableview(tableview: uitableview, commiteditingstyle editingstyle: uitableviewcelleditingstyle, forrowatindexpath indexpath: nsindexpath) { let object = self.fetchedresultscontroller.objectatindexpath(indexpath) nsmanagedobject self.context.deleteobject(object) try! context.save() } func controllerwillchangecontent(controller: nsfetchedresultscontroller) { } func controllerdidchangecontent(controller: nsfetchedresultscon

email - SPF record for relay server? -

i'm relatively new spf, have read quite bit , i'm still confused. have 2 mail relays mx servers domain. these servers receive mail domain forward on internal exchange server. exchange server server strictly sends mail domain not reject or bounce or otherwise undeliverable messages. relay servers still need spf records in case, or exchange server since 1 sending mail "from:" domain? so spf records defined on domain, not server, think question 'do relay servers need directives in spf record domain?'. assuming relay servers never make outbound smtp connections receiver email servers, answer no. in case need include exchange server. spf defining rule set list of ip addresses allowed connect receiving mail server , deliver email via smtp. evaluated perspective of receiving server, ip addresses connect directly receiving server need included in spf rule.

xcode - Swift error thread 1: EXC_BAD_INSTRUCTION cell definition -

i having trouble defining cell table. allows user search city code giving me trouble. entire code view controller. goal allow user search city in list of them. import uikit import foundation import coredata class searchbar: uiviewcontroller, uitableviewdatasource, uitableviewdelegate, uisearchbardelegate{ var searchactive : bool = false var data: [string] = ["san francisco","new york","san jose","chicago","los angeles","austin","seattle"] var filtered: [string] = [] @iboutlet weak var tableview: uitableview! @iboutlet weak var checkavailability: uibarbuttonitem! @iboutlet weak var searchbar: uisearchbar! @iboutlet weak var addselected: uibarbuttonitem! override func viewdidload() { super.viewdidload() /* setup delegates */ tableview.delegate = self tableview.datasource = self searchbar.delegate = self } func searchbartextdidbeginediting(searchbar: uisearchbar) { sea

android - Nexus 5 Usb Drivers Stopped Working after Automatic Update -

my nexus 5 screen broke , trying retrieve stuff using tool found allows screencast phone on pc: http://forum.xda-developers.com/showthread.php?t=2786395 the tool working fine until 1 moment when nexus 5 drivers automatically reinstalled (windows update). im trying reinstall them manually through device manager , nothing seems working.. nexus 5 appears under portable devices when plug , there no way manually reinstall drivers \usb_driver either "windows has determined driver software device date" (mpt usb device) or "the folder doesn't contain compatible software driver device" when chose "have disk" option. i tried disabling automatic driver updates windows still installs drivers whenever plug nexus in... nexus not appear under device list. any suggestions appreciated. in advance.

ruby - recursively finding friends of friends etc -

i trying find names of of friends, names of of friends, out 4 degrees. need track degree friend me (eg direct friend=degree 1) have code, dont understand how solve problem. advice great. def getfriendnames(name) ret=array.new #lots of code here, doesnt change problem return ret #returns unique list of friends names end arr=array.new friends=getfriendnames("me") arr.push(friends) #element1 of array arr friends of me. element 2 should friends of friends of me friends.each{|x| getfriendname(x) #this returns array of friends } this may not efficient solution, simple , direct 1 came mind. friends = hash.new to_process = ["me"] (0..4).each { |distance| processing = to_process to_process = [] processing.each { |person| if !friends.has_key?(person) friends[person] = distance to_process.concat(getfriendnames(person)) end } } if want keep track of "source" friend ins

java - simple android calculator returning too many zeros and wrong decimal point -

so output "h" in gives me long of number decimal point in wrong spot, otherwise whole number correct. example: 333433.33333 gets displayed 333.43 should displayed i suspect culprint `h = (double) math.round(h * 100000) / 100000;` but when change h = (double) math.round(h * 1000) / 1000; doesn't seem help. public class dofcalculator extends fragment { edittext txtf; spinner aspinner, cspinner; @override public view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate) { view rootview = inflater.inflate(r.layout.calculators_fragment_dof, container, false); button button = (button) rootview.findviewbyid(r.id.btn_cal); aspinner = (spinner) rootview.findviewbyid(r.id.aspinner); txtf = (edittext) rootview.findviewbyid(r.id.focal_length); cspinner = (spinner) rootview.findviewbyid(r.id.coc); final textview txtanswer = (textview) rootview.findviewbyid(r.id.txt_h); but

Complex rails SQL query -

first of all, user has many age_demographics. agedemographic object looks this: #<agedemographic id: 4384, user_id: 799, range: "35 - 49", percentage: 3.2, created_at: "2015-05-22 04:17:10", updated_at: "2015-05-22 04:17:10"> i'm building user search tool select multiple age ranges want target ( "12 - 17" , "18 - 24" example). need select users have collection of age demographic objects total percentage greater 50% . this i've started with: user.joins(:age_demographics).where("age_demographics.range in (?)", ["12 - 17", "18 - 24", "25 - 34"]) but can't figure out how tie in sum of percentages of age_demographics clause. let me know if makes absolutely no sense. you can use having , group methods this: user.joins(:age_demographics) .where("age_demographics.range in (?)", ["12 - 17", "18 - 24", "25 - 34"])

oracle - Static in clause sql -

i'm trying put more 1 static in clause in sql (oracle) , not working, 1 has idea or work around it. below i'm trying do select * table ('1', '2') in ('1', '2', '3') i know can done using or clause don't want use there many arguments. i'm guess query intended flexible handle bunch of input options , dynamically adjust output in way. perhaps approach work. these bi systems going still want syntactically valid query unfortunately can't build whole query dynamically. with list(val) ( select val master_list_of_values val in (? /* bi_parameter */) ) select * table in (select id list) or b in (select id list) update: based on edit, work although don't know if generate great plans: with security_test(passed) ( select count(*) passed security_groups group_id in (? /* bi_parameter */) , group_id in (/* hard-coded list */) ) select * table (select passed security_test > 0) you

html - Inline svg to greyscale -

i've got inline svg. how can convert grey scale. while googling came across answers none of them worked. here's fiddle .ab.desaturate{ -webkit-filter: grayscale(1); -webkit-filter: grayscale(100%); filter: gray; filter: grayscale(100%); filter: url(desaturate.svg#d3); } your code targeting class .desaturate . either add class or remove css, works fine: https://jsfiddle.net/lkfyy23e/2/

Math operations within HTML -

is possible perform math operations within html, <div width="50/2"> ? or can done using javascript or css? no, html , css can not perform math operations. can in javascript. if have choice should not perform complex math operations javascript unless know javascript well. because javascript has weird behaviour example: document.write(.1 + .2) // 0.3000000000000004 (instead of 0.3) document.write(.3 + .6) // 0.8999999999999999 (instead of 0.9) but long dealing integer values should fine. or if want deal decimals in javascript convert them integer (by multiplying 100 , convert result decimal divinding 100.) you can use other languages along html , css on server side: php python java ruby javascrript (both server , client side) which can math , more. but if computing layout features example making calculation width , height add in css guess should use javascript. read little unexpected behavior decimals. don't wrong result.

Chrome Version 43.0.2357.124m will not play any video utilizing HTML5 -

the videos endlessly "load". i've uninstalled , reinstalled chrome. have latest version. i've cleared cache/history "beginning of time". videos utilizing flash play fine in chrome. html5 videos plays in ie or in firefox. on win 7 pro desktop.

android - Action Bar No Resource Found. -

i trying run following code android studio guide: <menu xmlns:android="http://schemas.android.com/apk/res/android" > <!-- search, should appear action button --> <item android:id="@+id/action_search" android:icon="@drawable/ic_action_search" android:title="@string/action_search" android:showasaction="ifroom" /> <!-- settings, should in overflow --> <item android:id="@+id/action_settings" android:title="@string/action_settings" android:showasaction="never" /> however, following code: android:icon="@drawable/ic_action_search" android:title="@string/action_search" it says: cannot resolve symbol '@string/action_search' less... (ctrl+f1) validates resource references inside android xml files and no resource matches given name. i not sure how make of it. have googled extensively , these possible solutions? downlo

node.js - sending multiple files down the pipe -

we're using express 4 , right have this: var express = require('express'), router = express.router(); router.get('/local_modules/*', function (req, res, next) { var modulename = req.url.match(/local_modules\/(.*?)\//).pop(1) res.sendfile(filepath + '.js'); } and wanna more like: router.get('/local_modules/*', function (req, res, next) { var moduledir = req.url.match(/local_modules\/(.*?)\//).pop(1) fs.readdir(moduledir, function(err, files) { files.foreach(function(f) { res.sendfile(path.join(moduledir, f)); }) } } but doesn't work. how can serve multiple files express? note: not files in directory (like in example) - can done app.use; express.static , specific set of files (e.g. may need list of files bower.json) there no way send multiple files in single response, unless use own special formatting (standard multipart or otherwise) , parse on client side (e.g. via xhr). probably e