Posts

Showing posts from January, 2014

twilio conference call gathering digits feature missing -

i'm working on automated voice call interpreter. know it's not possible gather digits during conference call directly. that's why had come workaround , let twilio dial conference call, can gather participants digits. works great problem it's costing me around 4.2c per minute, of course not ideal @ all. is feature on list , if yes, when going make publicly available? cheers, marcel twilio evangelist here. depending on want technique might better results. leverages hanguponstar attribute of <dial> verb: twilio call transfer in-call hope helps.

sql - SUM MySQL rows of one column and have it group by another -

Image
hey guys i'm trying create query sums 1 column , groups result another. let me show mean showing tables! this tickets table expect result as can see groups column app , issue , sums time per issue. currently have this select app,issue,sum(time) tickets group issues order name asc; however it's not outputting expected result. appreciated. you need group app in addition issues select app,issue,sum(time) tickets group app,issue order name asc;

class - Return.Page Account ID -

how can add return.page syntax account id . code below doesn't work. public class baw3_class { private id accid {get; set;} public baw3_class(apexpages.standardcontroller stdcontroller) { accid = stdcontroller.getrecord().id; } public decimal testvalue { get; set; } public pagereference nextpage () { if(testvalue == null) { apexpages.addmessage(new apexpages.message(apexpages.severity.error, 'required value')); return null; } testvalue += 500; return page.baw3?id=accid; } it possible add id string page.baw3?id=....... thanks, sascha edit 18.03.2015 unfortunately doesn't work. below post whole code again. hope find problem. page value. need information account. visualforce: page show result <apex:page controller="bestandsauswertung3_class" showheader="false" sidebar="false"> {!testvalue} <br/> <apex:datatable value="{!acclist}...

I don't own Python 2.7.3 but somehow python --version in shell says Python 2.7.3? -

i've searched computer high , low , don't have python 2.7.3 anywhere on it, , in path environment variable have added "c:\python34\python.exe". yet reason when run python in cmd runs python version 2.7.3. haven't clue happening, because i'm never installed python 2.7.3 on computer. going on?

css - How do I get the same looking font in mobile as in pc browser? -

Image
i'm using font-family: "proxima nova alt", "helvetica neue", helvetica, arial, sans-serif; looks terrible on mobile comparing pc browser. how same looking result mobile ? @ingridly right. guess fonts appearing on desktop because they're installed on desktop's os. have 2 ways this: 1) need find them in google fonts, typekit, or other third-party cloud-based font solution. provide ways reference them through css, html, , js. 2) distribute fonts , put font file in /font directory (can called whatever...but /font works), , reference file using @font-face they're defaulting helvetica or arial on mobile because they're not installed on device. hope helps!

angularjs - angular form validation and pristine forms -

i'm making 'add new user' /'edit existing user' form. if page loads , there's data in formdata i'm editing existing user , populate fields appropriate. if page loads no data in formdata new user. if it's new user, fields should empty but should not showing error feedback . i thought $pristine for. in example looks attempt populate fields triggering $pristine = false. how can accommodate both scenarios? my plunker bit basic. in app, launch form page lists users (click user edit) , has 'add user ' button. means can load page or without formdata populated as-needed. http://plnkr.co/edit/wh9vqmlevqm2elbreiyu?p=preview i wonder if has using two-way binding model? ng-model="formdata.username" value="{{formdata.username || ''}}" they show error feedback because in css style defined input.ng-invalid, true no matter if pristine or not. following should solve problem: input.ng-invalid.ng-dirt...

IOS App suggest twitter friends to users? -

hi have been searching while want implement feature if user login app through twitter sees follows on twitter joined app , gives opportunity follow them on app meerkat example.im using rails backend if healps. pointing me right direction appreciated. (ps: linkedin email im interested twitter). well after more researching found out meerkat uses https://get.fabric.io/ best of knowledge. im going try it.

html5 - iOS <video> preview in Chrome -

on iphone, videos i'm loading through element appear immovable ios play button overlay. when viewing site in chrome browser, i'm able see first frame of each video behind play button. in safari ios, see play button , blank video player behind it. i users see video preview in both browsers way can when using chrome. how can achieve in ios safari?

jquery - unable to get property of 'sku' undefined or null reference -

i have following jquery code in google tag manager for(item in cartobject){ ga(ec:addproduct,{"id":cartobject[item][sku],"name":cartobject[item][name],"category":cartobject[item][categories],"brand":cartobject[item][_0xad1e[5]],"price":cartobject[item][_0xad1e[16]],"quantity":cartobject[item][_0xad1e[30]]})}; ga(_0xad1e[6],_0xad1e[38],{"step":_0xc357x7}); ga(_0xad1e[8],_0xad1e[9],_0xad1e[10],_0xad1e[11],_0xad1e[39]+_0xc357x7,{"noninteraction":1}); } that suppose variables success.html page of website orderobject['0'] = { 'sku': '161', 'name': 'trappist ale discovery (12 bottles) plus free chalice glass', 'price': '38.5', 'qty': '1.0000', 'categories':'discovery cases,belgian beers,browse our be...

Apache Storm Bolt -

class mybolt(storm.basicbolt): def process(self, tup): data = tup.values[0].split(',') i new apache storm , see above program not quite understand. wonder data=tup.values[0] do. help! tuple defintion ordered list of objects. tup.values[0] retrieves object tuple by position . returns first object in tuple.

python - Where attribute does not exist, create an attribute and give it a default value -

i learning python out of book , have written myself long quiz/type game prints summary @ end. however, summary looks attributes not exist depending on choices have been made user. i have abstracted basic example show trying do. essentially, want run attribute error check, every variable not have attribute, create attribute default value of n/a. in below example, want print: forename: joe surname: bloggs smith test: n/a test 4: n/a i created class called codecleaner going use set n/a values, got stuck! class questionset(object): next_set = 'first_set' class claimengine(questionset): def current_set(self): last_set = "blank" while_count = int(0) quizset = sets.subsets parentset = questionset() while parentset.next_set != last_set , int(while_count)<50: quizset[parentset.next_set].questioning() while_count = while_count+1 class firstset(questionset): def questioning(self): ...

jquery - transparent css border as a place-holder -

please take @ following 2 fiddle files see problem struggling with: i want border on hover effect highlighting, not satisfied 2 following codes have: http://jsfiddle.net/hnxan9ck/7/ this 1 not satisfactory because table wobbles mouse-over rows, tried following http://jsfiddle.net/gyb314/hnxan9ck/4/ this not work either, because border overlapped other borders of unselected rows. .ui-datepicker-inline.ui-datepicker.ui-widget.ui-widget-content.ui-helper-clearfix.ui-corner-all table.ui-datepicker-calendar tbody tr { border-style: none; border-color: rgba(255, 0, 0, 0); border-width: 4px; } .ui-datepicker-inline.ui-datepicker.ui-widget.ui-widget-content.ui-helper-clearfix.ui-corner-all table.ui-datepicker-calendar tbody tr:hover { border-style: dotted; border-color:red; border-width: 4px; } so rows not hovered mouse, if set border none, wobbles, if set border solid transparent, still blocks border of hovered rows. is there way have invisible pla...

c - Fibonacci Computation Time -

is there noticeable computation time difference between recursion-style fibonacci vs. loop-style fibonacci? keep running fibonacci 40 places using recursion , using loop directly afterwards. seems though computation time difference academic . written in c recursive solution: int main(int argc, const char * argv[]) { int n, = 0, c; printf("please enter integer:\n"); scanf("%d", &n); ( c = 1 ; c <= n ; c++ ) { printf("%lu ", fibonacci(i)); i++; } return 0; } long fibonacci(long n) { if ( n == 0 ) return 0; else if ( n == 1 ) return 1; else return ( fibonacci(n-1) + fibonacci(n-2) ); }; for-loop solution: int main(int argc, const char * argv[]) { int n, first = 0, second = 1, next, c; printf("please enter integer:\n"); scanf("%d", &n); ( c = 0 ; c < n ; c++ ) { if ( c <= 1 ) next = c; ...

javascript - Regex match certain kind of paragraph -

i have string 1 example 2 example 3 example where each line separated new line. trying find way match there has more 1 line, , each line must contain number followed string. there has @ least 2 lines. this have far not working. (\d* \w*(\n|$)){2,} something work you: string.match(/\d+ \w+[\n\r]+\d+ \w+/m); note 'm' specifies it's okay match across multiple lines. edit looks expression fine, missing "m".

java - JSON No Value For Exception Also how to retrieve values if column names are entered by user -

i have started develop @ android platform , working on prototype. what doing m retrieving data online database through json column names provided user i.e. information of column should data retrieved provided user eg in database 3 columns - optiona,optionb,optionc present , name of column data retreived provided user . this json code sending url- public jsonarray retreivedata(string option,string vendorname,string company,string style,string chimcompany,string shape,string size,string type,string category) { // url getting customers try { url = "http://piyushsharma.byethost16.com/retreivedata.php?option="+option+"&vendorname="+vendorname+"&company="+urlencoder.encode(company,"utf-8")+"&style="+style+"&chimcompany="+chimcompany+"&shape="+shape+"&size="+size+"&type="+type+"&category="+urlencoder.encode(category,"utf-8...

C++ multiple definition errors in 3-way header include -

i have 3 header files defining objects: point3d.h #ifndef point3d_h #define point3d_h class ray3d; class vector3d; #include "ray3d.h" #include "vector3d.h" class point3d { ... }; #endif vector3d.h #ifndef vector3d_h #define vector3d_h class point3d; class ray3d; #include "ray3d.h" #include "point3d.h" class vector3d { ... }; #endif and ray3d.h #ifndef ray3d_h #define ray3d_h class point3d; class vector3d; #include "point3d.h" #include "vector3d.h" class ray3d { ... }; #endif i won't include .cpp files, functions defined there. and have class: transform.h #ifndef transform_h #define transform_h #include <eigen/dense> #include "../../geometry/ray3d.cpp" #include "../../geometry/point3d.cpp" #include "../../geometry/vector3d.cpp" using eigen::matrixxd; class transform { ... }; #endif and have subclass: translation.h #ifndef tr...

mysql - Writing a SQL query that gets information from 3 different tables -

i cant seem figure out how write these 2 queries on tables have created. 2 queries trying write find users have reviewed both shops , restaurants. find users reviewed businesses, not shops or restaurants. the tables using reviews; +-------------+---------+------+-----+---------+-------+ | field | type | null | key | default | | +-------------+---------+------+-----+---------+-------+ | business_id | int(11) | no | pri | null | | | user_id | int(11) | no | pri | null | | | review_id | int(11) | no | pri | null | | | review_date | date | yes | | null | | | star_rating | int(1) | yes | | 1 | businesses +--------------+--------------+------+-----+---------+-------+ | field | type | null | key | default | | +--------------+--------------+------+-----+---------+-------+ | business_id | int(11) | no | pri | null | | | name | varchar(50) | yes | | null ...

python - Plotting time series with seaborn -

i have 2 lists. 1 represents time , looks like time=[datetime.datetime(2015, 1, 2, 0, 1, 2),datetime.datetime(2015, 1, 2, 0, 5, 2),datetime.datetime(2015, 1, 3, 0, 1, 53),datetime.datetime(2015, 1, 3, 0, 1, 56),datetime.datetime(2015, 1, 5, 0, 1, 2),datetime.datetime(2015, 1, 5, 0, 1, 40),datetime.datetime(2015, 1, 7, 0, 1, 2),datetime.datetime(2015, 1, 7, 0, 1, 30),datetime.datetime(2015, 1, 9, 0, 1, 2),datetime.datetime(2015, 1, 9, 0, 1, 20)] and other represents corresponding data points: data=[51.024,3.2179,105.18,31.176,1.1123,1.7861,109.65,0.0,123.890,523.897] plotting matplotlib easy, rest of statistics done seaborn , keep visuals , use seaborn whole set of results. when use seaborn.tsplot following error index contains duplicate entries, cannot reshape seaborn . data list contain duplicates, @ different time points , cannot removed. doing wrong? edit: if create pandas dataframe, can plot y value using sns.tsplot(y) , want able use values x-axis, not generated val...

php - xss filtering not removing single quotes in codeigniter -

i have been using codeigniter time found possibility of sql - injection in script when user enter <script>alert('hi') </script> in input field $this->security->xss_clean($field) remove scipts not take care of single quotes of string. because of getting query error as error number: 37000 [microsoft][odbc sql server driver][sql server]incorrect syntax near 'hi'. select * account field1 = '[removed]alert('hi') [removed]' , field2 = 'asdasd' filename: d:\htdocs\system\database\db_driver.php line number: 331 this typical xss string when user add 1' or '1'='1 no error being generated , query runs . i know can solved str_replace("'","",$field); . how can solve using codeigniter? is there global filter problem ( $config['global_xss_filtering'] = true; )so don't have add str_replace @ input functions. is there way generate log ev...

c++ - How do I convert an armadillo matrix to a vector of vectors? -

i created armadillo c++ matrix follows: arma::mat a; a.zeros(3,4); i want convert vector of vectors defined std::vector< std::vector<double> > b(3, std::vector<double>(4) ); how set b equal a? if there not easy way vector of vectors, array of arrays, i.e., if defined b double b[3][4]; in such cases should use arma::conv_to totally superb feature of arma. note method require source object able interpreted vector. why need iteratively every row. here conversion method: #include <armadillo> typedef std::vector<double> stdvec; typedef std::vector< std::vector<double> > stdvecvec; stdvecvec mat_to_std_vec(arma::mat &a) { stdvecvec v(a.n_rows); (size_t = 0; < a.n_rows; ++i) { v[i] = arma::conv_to< stdvec >::from(a.row(i)); }; return v; } and here exemplary usage: #include <iomanip> #include <iostream> int main(int argc, char **argv) { arma::mat = arma::randu...

java while and for loops dilemma -

i m working on example , cannot seem figure doing wrong. public class nestedloop { public static void main(string[] args) { int usernum = 0; int = 0; int j = 0; while (j <= usernum) { system.out.println(j); ++j; (i = j; <= usernum; ++i) { system.out.print(" "); } } return; } } the result below. can see result backward , not sure doing wrong. have tried change variables around , not getting where. appreciate. expected output: 0 1 2 3 output: 0 1 2 3 thanks you using usernum increment wrong , increment j++ after spaces return. can remove return statement. corrected code: public class nestedloop { public static void main(string[] args) { int usernum = 3; int = 0; int j = 0; while (j <= usernum) { system.out.println(j); (i = 0 ; <= j; ++i) { ...

javascript - Make URL start select dropdown -

i have 2 select box (dropdown) , need create url starting these dropdowns. example: <form name="states_cities"> <select name="states"> <option value="ac">acre</option> <option value="rj">rio de janeiro</option> <option value="sp">são paulo</option> <option value="to">tocantis</option> </select> <!-- cities of "rio de janeiro" --> <select name="cities"> <option value="queimados">queimados</option> <option value="volta-redonda">volta redonda</option> <option value="nova-iguacu">nova iguaçú</option> </select> <button type="submit" value="go"> </form> and need make url example: http://valuestate.valuecity.domain.com or http://rj.queimados.domain.com when user clicks go! what better way this? to selected op...

c# - Cannot implicitly convert type 'string' to 'int' -

i'm doing athlete program , want make int salarycounter = athletesalary.tostring when user enters salary of hired professional can subtract salary of athlete , print out how athlete have left when try program tells me "cannot implicitly convert type 'string' 'int' ". can me? { console.writeline("please enter first name of athlete"); string athletestring = console.readline(); console.writeline("please enter second name of athlete"); string athletestring2 = console.readline(); console.writeline("did type {0} {1}? press y yess n no.", athletestring.tostring(), athletestring2.tostring()); consolekeyinfo keyinfo = console.readkey(); if (keyinfo.keychar == 'y') { console.writeline("enter salary of {0} {1}", athletestring.tostring(), athletestring2.tostring()); string athletesalary = console.readline(); console.writeline("{0} right?", athletesa...

regex - Perl: Remove non-letter, non-number characters from string -

new perl, have problem i'm hoping can me out with. i have perl string allowed contain letters z (capital , lowercase), numbers 0 9, , "-" , "_" characters. want remove non-matching characters string, leaving rest untouched. "hell@_world" become "hell_world". know there's simple, easy way of doing i'm new perl , don't know how approach this. appreciated. you use substitution ^ (not) regular expression. while perl offers shortcuts, can see parts more this: $string =~ s/[^[:alnum:]_-]//g; where [:alnum:] character class alphabetic , numeric characters. " - " last in brackets avoid confusing part of range of characters.

Spring Social, Create connection for existing local users on signin -

i trying allow existing local users signin using spring social, google, , automatically create new userconnection if email matches local account. i have found examples implicit signup (requires/creates new account), new user signup (default action if springsocial fails find userconnection) , connect option while current user logged in. how can extend springsocial let me check existing social user / local user email match, create user connection existing local user , sign them both local , social? you can use implicit sign find account instead of creating new one. modifying code found implicit sign up , can similar following: public class accountconnectionsignup implements connectionsignup { private final accountrepository accountrepository; public accountconnectionsignup(accountrepository accountrepository) { this.accountrepository = accountrepository; } public string execute(connection<?> connection) { userprofile profile = c...

c# - Forms Authentication: How to handle unauthorized authenticated user -

i trying setup basic forms authentication example. it correctly redirecting unauthenticated users login page , on submit verifying credentials , if correct calling: formsauthentication.redirectfromloginpage(username.text, false); if user 1 named in authorization section page. if not bounces them login page no error. how can redirect correctly authenticated unauthorized users specific error page or detect authorization error display error message on login page bounce back? here web.config <authentication mode="forms"> <forms name=".aspxauth" loginurl="/forms/login" /> </authentication> <authorization> <deny users="?" /> <allow users="username1, username2" /> <deny users="*" /> </authorization> update: based on answers / comments / research i've got 2 working solutions. put following in page_load method of login for...

javascript - $index inside ng-click not print a number -

i create ng-click inside ng-repeat , want change variable currentpage $index value. not work properly, $index print string not return number. code: <li ng-repeat="i in getnumber(pagenumber) track $index"> <a href="#" ng-click="currentpage=$index">{{$index+1}}</a> </li> update: want write ng-click statement inline in html, not call function in controller. use function setcurrentpage : <li ng-repeat="i in getnumber(pagenumber) track $index"> <a href="#" ng-click="setcurrentpage($index)">{{$index+1}}</a> </li> in controller : $scope.setcurrentpage = function (index) { $scope.currentpage = index; } note: index number, no need conversion.

postgresql - Query Only Specific Days of Month -

i'm not sure begin on solving problem. need update record every 3rd monday of month. in postgres can query every 2nd or 3rd monday, or little more abstract every nth day of nth week? i'm looking elegant answer postgresql. right have crude this: select d generate_series(date_trunc('week',timestamp '2015-02-01' + interval '13 days'), timestamp '2015-02-01' + interval '1 month -1 day', interval '14 days') d; i use calendar table queries one. to select third monday of every month in 2015, can query calendar table this. select cal_date calendar year_of_date = 2015 , day_of_week = 'mon' , day_of_week_ordinal = 3 order cal_date; cal_date -- 2015-01-19 2015-02-16 2015-03-16 2015-04-20 2015-05-18 2015-06-15 2015-07-20 2015-08-17 2015-09-21 2015-10-19 2015-11-16 2015-12-21 code create calendar table. (this how pgadminiii presents through create script menu selection.) create table calendar ( cal_d...

Add element to rails has_many relation "dynamically" -

having following models: class card < activerecord:base # ...whatever belongs_to :model end class model < activerecord:base # attribute: rank has_many :cards end considering following code: mod = model.new card = card.first an_attribute = "rank" another_attribute = "cards" mod.send("#{an_attribute}=", 1) # works fine, ok mod.cards << card # works fine well, ok mod.send("#{another_attribute}<<", card) # not work, hence question the last line of code returns error undefined method 'cards<<' so question is: how can append card element mod.cards while accessing cards has_many relation via variable, i.e. storing name of association in variable ? mod.send("#{another_attribute}").push(card)

vb.net - Simple Quiz in VB -

i taking vb general education class totally non related major. struggling here 1 of our assignments. assignment create simple quiz consisting of 3 questions, , program supposed calculate score , percentage of participant. have written following code far, doesn't execute right. can me please? thing can't figure out how make 1 of textboxs' case insensitive. great! private sub btnsubmit_click(sender object, e eventargs) handles btnsubmit.click dim firstanswer integer = 2 dim secondanswer string = "barak obama" dim thirdanswer string = "florida" dim correctanswer double = 0 dim num1 double = cdbl(lblcorrectanswer.text) dim percent double percent = num1 / 3 * 100 if txtsum.text = firstanswer , txtpresident.text = secondanswer , txtimpoertantques.text = thirdanswer lblcorrectanswer.text = correctanswer + 3 txtsum.backcolor = color.green txtsum.forecolor = color.white txtpresident.backcolor ...

r - plotmath: how to use a function definition in a label? -

i display definition of lambda in x axis label. of course adjust hand, e.g., this: lambda <- function(t) 1/t plot(0~0, xlab=expression(lambda(t)==1/t)) but there way can let plotmath display function definition of lambda (so not having manually adjust xlab )? you can use solution: lambda <- function(t) 1/t sb <- as.character(as.expression(body('lambda'))) plot(0~0, xlab=bquote(lambda(t)==.(sb)))

java - Retrieve deployable artifacts from maven hosted repository via a tool -

i'm trying automate of our processes @ work. give operations file listed war files needed deployed, have script download war files our maven repository. script deploy them "act" of downloading them i'd piggy off of. i realize have script transpose names/groupid/artifactid/versions wget or http downloads, have maven download them pom file, or use groovy grape. however, imagine getting maven artifacts outside of maven lifecycle done , has written this. i want them downloaded central folder wrapping script can call jboss-cli can deploy them. this: deployfile.eachline{ **wantedtool**.download(it) /opt/jboss/bin/jboss-cli --connect deploy /opt/lib/... } i'd prefer use tool in case rather invent need maintain. thanks

c++11 - C++ Cannot find Include -

in main.cpp keep getting errors saying print not defined (and other errors of sort. i have print() defined under header file called "misc" misc.h #include <iostream> #include <cstdlib> #include <fstream> #define misc_h #ifndef misc_h void print(string str) { cout << str << endl; } string userin(string prompt = "option:") { //for collecting user responses string response; print(prompt); cin.clear(); cin.sync(); getline(cin, response); if (!cin) { response = "wtf"; } else if (response == "512") { //secret termination code print("program terminated"); exit(0); } print(""); return response; } #endif then in main.cpp #include headers/misc.h" (the header file located in separate folder) is there i'm doing wrong here? what's visible me, without knowing compile commands using, ' include guard ' incorrect. the first command #d...

c# - How can I get all subsets of a set that respect the order -

i'm looking c# example give me subsets of set while respecting order. for example have a,b , like: a b ab ba please note purpose ab != ba . the solution should generic input type: list<list<t>> getsubsets<t>(list<t> originalset) i've come across great solutions using bitwise manipulation ab == ba (e.g generate combinations list of strings ) far have failed find solve described above. any tips/pointers appreciated! getpermutations() ref. https://stackoverflow.com/a/10630026/1287352 public static list<list<t>> permutationof<t>(hashset<t> set) { var result = new list<list<t>>(); (var length = 1; length <= set.count; length++) { result.addrange(getpermutations<t>(set, length).select(i => i.tolist())); } return result; } private static ienumerable<ienumerable<t>> getpermutations<t>(ienumerable<t> list, int length) { if (length ...

javascript - A timer that is pausable in NodeJS? -

how go creating timer pause using nodejs? i thinking of using setinterval/settimeout unsure if work want to? (since there's no "pause") basically want re-occuring timer every 5 minutes (for example) if action, want pause, , on action, unpause. you don't pause timer in node.js. instead, start , stop timer. if want start again same amount of time remaining have had left if kept running, have keep track of amount of time. here's idea little object lets start , stop timer: var timer = function(t, fn, go) { var timer, tremaining, tstarted; if (!t || !fn) { throw new error("must specify time , callback function"); } tremaining = t; if (go) { this.start(); } this.start = function() { if (!timer) { tstarted = new date().gettime(); timer = settimeout(fn, tremaining); } }; this.pause = function() { if (timer) { cleartimeout(t...

php - Codeigniter causing mysql syntax error -

i check whether r.is_show_map = 1, if true, return r.lat, otherwise, return null here code $this->db->select('r.*, if(r.is_show_map = 1, r.lat, null) r.lat', false); the problem caused syntax error error number: 1064 have error in sql syntax; check manual corresponds mysql server version right syntax use near '.lat (`request` r) `r`.`adv_type` != 0 , `r`.`is_delete` = 0 an' @ line 1 select r.*, if(r.is_show_map = 1, r.lat, null) r.lat (`request` r) `r`.`adv_type` != 0 , `r`.`is_delete` = 0 , now() <= date_add(r.create_date, interval 15 day) how fix it? thanks try this: $this->db->select('r.*, if(r.is_show_map = 1, r.lat, null) lat', false);

css - android webview goes more than full width for responsive sites -

i have simple webview: <webview xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/webview" android:layout_width="fill_parent" android:layout_height="fill_parent" /> which called this: protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); webview mywebview = (webview) findviewbyid(r.id.webview); mywebview.loadurl("http://example.com"); } the problem site trying render doesn't go responsive mode. width goes beyond screen causing me scroll. i have tried widths including: fill_parent, match_parent, , wrap_content , none of them work. what can make webpage render responsive, staying in confines of screen without scrolling horizontally? you missing couple of setup calls make webview render more mobile browser: mywebview.getsettings().setusewideviewport(...

jquery - insert into tag style css to file .css -

can give me example how insert tags css .css file using jquery i have tried several times still can not able add css style tags head you don't need & can't jquery - can manipulate css of elements directly - jquery parse , add style attribute target element\s. for more general approaches has crossbrowser support in case trying use several different stylesheets read answer alternate style-sheets you can use plain js push rules or create new stylesheets using document.stylesheets object. more reading , examples: add rules stylesheets javascript w3c, dynamic style - manipulating css javascript

json - JavaScript Closures, Really simple example with jsFiddle -

i'm pulling hair out trying understand javascript closures. i'm looking closely @ this example. actual code in node.js don't think that's major issue (except error codes..) here's slimmed down code: var jsonsymbols = { "id5": "wfc", "id4": "amzn", "id3": "baba", "id2": "yhoo", "id1": "goog", "id0": "aapl" }; // assume unknown number of stock symbols.. var count = 0; var outputprices = {}; (key in jsonsymbols) { outputprices['newid' + count]['price'] = get_price(jsonsymbols[key], count, function() { console.log(" dummy function"); // callback function used when looking 1 stock. }); count++; } console.log("\ncount = " + count); console.log("\noutput = " + json.stringify(outputprices)); function get_price(symbol, countindex...

javascript - How to submit a form using Ajax from a mobile application -

i need submit form below (components/com_users/views/login/tmpl/default_login.php. ) using ajax. <form action="<?php echo jroute::_('index.php?option=com_users&task=user.login'); ?>" method="post"> <fieldset> <?php foreach ($this->form->getfieldset('credentials') $field): ?> <?php if (!$field->hidden): ?> <div class="login-fields"><?php echo $field->label; ?> <?php echo $field->input; ?></div> <?php endif; ?> <?php endforeach; ?> ...... </form> my ajax request come external mobile app (on click, run javascript ajax submit form). is possible? if yes, parameters should pass ajax request (based on example here : " form submit ajax passing form data php without page refresh " need pass url, data , success). if possible, i'm able pass...

changing uploaded file in JSP through JavaScript -

can 1 give me proper example changing uploaded file in jsp? this jsp page code. <div class="action"> <input type="file" name="files[0]" id="file0" style="float: left" required> <input type="button" id="btnzoomin" value="+" style="float: left"> <input type="button" id="btnzoomout" value="-" style="float: left"> <input type="button" id="btncrop" value="crop" style="float: left"> <input type="submit" value="upload file" style="float: right" /> </div> <div class="cropped"> </div> using js , css cropping uploaded image ... js document.queryselector('#btncrop').addeventlistener('click', function() { var img = cropper.getdataurl(); ...

java - How can I add a value to a column? -

i want add value existing column, don't want have select first. right have like // run hql in named query employee id = :id // after running above e.setbonus(e.getbonus() + 100); // add 100 e's bonus // commit database hibernateutil.saveorupdate(e); but want that's one-and-done - like update employee e set e.bonus = e.bonus + 100 is can in hibernate? if so, how. if not, what's suggested best practice such update? you create hql query update query updatebonus = createquery("update employee set bonus = bonus+100 id = :id" ); updatebonus.setinteger("id", employee.getid()); updatebonus.executeupdate();

java - An internal error occurred during: "Validating GWT components". GC overhead limit exceeded -

Image
eclipse crashing when trying debug gwt module in hosted/dev mode. i think things going out of memory. how resolve this? resolved issue increasing memory of eclipse itself. added following in eclipse.ini file. -vmargs -dosgi.requiredjavaversion=1.5 -dhelp.lucene.tokenizer=standard -xx:maxpermsize=512m -xms512m -xmx1024m

Common encryption for java, android and objectivec -

i want use encryption , decryption algorithms common java, android , objective-c. tried aes in java , android, both returns different output. there common algorithm java, android , objective-c. here java code import java.security.*; import java.security.spec.invalidkeyspecexception; import javax.crypto.*; import javax.crypto.spec.secretkeyspec; import sun.misc.*; public class aesencrp { private static final string algo = "aes"; private static final byte[] keyvalue = new byte[] { 'w', 'e', 'l', 'c', 'o', 'm', 'e','t', 'o', 'e', 'n','c', 'r', 'y', 'p', 't' }; public static string encrypt(string data) throws exception { key key = generatekey(); cipher c = cipher.getinstance(algo); c.init(cipher.encrypt_mode, key); byte[] encval = c.dofinal(data.getbytes()); string encryptedvalue = n...

angularjs - How to do nested translation in Angular? -

i trying nested translation in angular conditional involved well. the setup: <p translate-values="{partnername: (enterpin.partnername) ? enterpin.partnername : {{'yourprovider'}}}" translate> {{'enterpincodemessage'}} </p> here translation file: { "enterpincodemessage": "enter 13 digit pin code received {{partnername}}. if not have pin code, please contact {{partnername}} assistance.", "yourprovider": "your provider" } if enterpin.partnername has value want {{partnername}} use that, if not want {{partnername}} use translation of {{'yourprovider'}} with setup, result: <p translate-values="{partnername: (enterpin.partnername) ? enterpin.partnername : yourprovider}" translate="" class="ng-scope ng-binding">enter 13 digit pin code received . if not have pin code, please contact assistance.</p> which rendered as enter 13 digi...

java - How to load same FXML into different controller objects? -

i have tabpane i'm loading 2 (or more) files in 2 different tabs. these 2 files loading same controller class. now, if make change in 1 file , save, contents of other file in tab changing (however original file remains unaltered). want create 2 separate controller objects these 2 files. there anyway that? please help.

.net - skip directories don't have required permission c# -

private int getfilecount(directoryinfo directory) { int retval = directory.getfiles().length; try { array.foreach(directory.getdirectories(), dir => { retval += getfilecount(dir); }); } catch (unauthorizedaccessexception ex) { //here stops execution } return retval; } i have above code written when scan through disk drive...giving me access denied exception.. handle exception written catch block stop further iteration..how should continue further iteration inside catch block please check if retval null , if yes use continue keyword , increment counter value. here sample: private int getfilecount( ) { string[] subdirectories = directory.getdirectories(@"c:\"); string[] result = null; i...

php - Error In Login In Codeigniter -

hi trying make login code in codeigniter gives following error unable access error message corresponding field name username. unable access error message corresponding field name password. class verifylogin extends ci_controller { function __construct() { parent::__construct(); $this->load->model('user','',true); } function index() { $this->load->library('form_validation'); $this->form_validation->set_rules('username', 'username', 'trim|required|xss_clean'); $this->form_validation->set_rules('password', 'password', 'trim|required|xss_clean|callback_check_database'); if($this->form_validation->run()== false) { //field validation failed. user redirected login page $this->load->view('login_view'); } else { //go private area redirect('home', ...