Posts

Showing posts from May, 2015

iphone - setContentOffset on UIScrollView the right way -

i'm using code scroll uiscrollview down because i'm adding new uiview on bottom , want scroll down it. this: cgpoint newoffset = cgpointmake(mainscrollview.contentoffset.x, mainscrollview.contentoffset.y + floorf(bottomattachmentview.frame.size.height / bottomattachmentview.multfactor)); [mainscrollview setcontentoffset:newoffset animated:yes]; i add new element's height y of uiscrollview 's contentoffset scrolls out of scrollview contentsize , lower, possible scroll. happens because modify contentsize before calling method above , height of scroll view shrinks. how call setcontentoffset wouldn't make scrollview scroll out of it's own contentsize ? thanks! all had actually, scroll uiscrollview bottom this: cgpoint bottomoffset = cgpointmake(0, [mainscrollview contentsize].height - mainscrollview.frame.size.height); [mainscrollview setcontentoffset:bottomoffset animated:yes];

ruby - Safely assign value to nested hash using Hash#dig or Lonely operator(&.) -

h = { data: { user: { value: "john doe" } } } to assign value nested hash, can use h[:data][:user][:value] = "bob" however if part in middle missing, cause error. something h.dig(:data, :user, :value) = "bob" won't work, since there's no hash#dig= available yet. to safely assign value, can do h.dig(:data, :user)&.[]=(:value, "bob") # or equivalently h.dig(:data, :user)&.store(:value, "bob") but there better way that? it's not without caveats (and doesn't work if you're receiving hash elsewhere), common solution this: hash = hash.new {|h,k| h[k] = h.class.new(&h.default_proc) } hash[:data][:user][:value] = "bob" p hash # => { :data => { :user => { :value => "bob" } } }

javascript - listen for input in a hidden input-field -

is there way, on document ready / page load, 1 can listen more 3 characters being typed in row don't else, while nothing else focused, , if event occurs transfer 3 characters , else typed after input-field of type text / search hidden— either display, visibility, or opacity css properties ? i appreciate in doing this. i have done label , radio-button / check-box hidden. because input click on label. not complex alpha-numeric input. if can me part of achieving above, appreciate it. should straight forward: var keys = []; $(document).on('keypress', function(e) { keys.push( string.fromcharcode(e.which) ); if (keys.length > 2) $('input').fadein(400).val( keys.join('') ); }); fiddle

unit testing - Using Moq to verify in C# -

i'm trying mock database can verify save method called. have project saves database, takes list of objects save, , connection string. this._database.save<constraint>(constraints, "default"); when debug can see test goes project mocked database, , hits save line once. in test project create instance of class calling save method, create , create mock database, , use .setup save method. private mock<idatabase> _mockdatabase; ... _mockdatabase = new mock<idatabase>(); _mockdatabase.setup(d => d.save<types.constraint>(it.isany<types.constraint>(), it.isany<string>())); then in test method, call .verify make sure save called 1 time. _mockdatabase.verify(d => d.save<constraint>(it.isany<constraint>(), it.isany<string>()), times.once); however test fails on verify. know how can fix this? help/ideas! moq.mockexception: expected invocation on mock once, 0 times: d => d.save(it.isany(), it.isany...

c++ - Static libraries. Importing and exporting inline functions -

this question arose while implementing static library. want check guess , gain information on using inline functions in static libs. my guess iplementator of static lib can not export inline function in library due inline statement implemented compiler(it compiler whether make function inline) placing low level commands representing operations in function body code segment operations won't placed in tables of export/import , therefore can't processed linker , therefore can't included librarian code of application static lib attached. logic right? i guess importing function inline allowed wonder how implemented , because compiler`s responsibility on linkage state there librarian, means must undertake actions in order make function inline. yes, inline functions typically placed in header, function body directly visible compiler everywhere function used. lets compiler evaluate whether generate inline code function in particular instance. ...

android - How to use normal Parse functions in ParseFacebookUtils? -

i imported parsefacebookutils in build.gradle file compile 'com.parse:parsefacebookutils-v4-android:1.10.3@aar' the official documentation says includes parse-android:1.12.0, couldn't figure out how use normal parse functions such logging in without facebook , create parse objects. i tried importing both compile 'com.parse:parsefacebookutils-v4-android:1.10.3@aar' compile 'com.parse:parse-android:1.12.0' it compiled successfully, when launched app, returns classnotfoundexception 01-05 15:41:33.560 11530-11530/? e/androidruntime: fatal exception: main process: com.peter.georeminder, pid: 11530 java.lang.noclassdeffounderror: failed resolution of: lcom/facebook/facebooksdk; @ com.parse.facebookcontroller$facebooksdkdelegateimpl.initialize(facebookcontroller.java:187) @ com.parse.facebookcontroller.initialize(facebookcontroller.java:70) @ com.parse.parsefacebookutils.initialize(parsefacebookutils.java:108) @ com...

jquery - Kentico V8 custom slider web part -

Image
i don't have strong dotnet background, i'm primary js/css guy. i want use slick.js slider plugin, i'm lost 1 how. i'm wondering if i'm on right track here. ideally, editor able create new page based on slider template create each. each page new slide. these pages in specific folder in site tree. my web part pull these pages in , render correctly formatted code , include needed js. am on right tract here? , if how start. you're absolutely on right track. i've used slick on couple of sites , followed pattern: setup repeater webpart set repeater's html envelope slider's wrapper set repeater's transformation repeat content of documents want repeat slides setup slider script in javascript webpart or (my preferred method) on page template's markup here's example implementation in kentico uses slick's documentation. i'm using version 7, things little bit different , in different places, shouldn't hard ...

c# - How to retrieve an image from an OData Service? -

i have odata service (its system center orchestrator's web service if must know ) returns bmp image if query http://localhost.com/orchestrator2012/orchestrator.svc/runbookdiagrams(guid '882f767d-63bd-437c-b0c7-4051aac56176')/$value so saying, give me runbookdiagram id 882f767d-63bd-437c-b0c7-4051aac56176 it renders correctly in ie. when query fom c# i'm not able image data, other data fields. now documentation of webservice says need use $value return query. how use $value in following odata query c# runbookdiagram rbkdiag=orch.runbookdiagrams.where( m => m.runbookid ==runbookid ).singleordefault(); maybe service returning images media link entries? can check viewing xml returned server , m:hasstream="true" if case use getreadstream on context. check this astoriateam blog post details.

Why is this "can't break line" warning from grep of gcc man page? -

i trying find line ending -s following command got warnings: $ man gcc | grep '\-s$' <standard input>:4808: warning [p 54, 13.2i]: can't break line $ man gcc | egrep '\-s$' <standard input>:4808: warning [p 54, 13.2i]: can't break line below development environment: $ uname -a linux localhost 3.16.0-4-amd64 #1 smp debian 3.16.7-ckt20-1+deb8u1 (2015-12-14) x86_64 gnu/linux $ gcc --version gcc (debian 4.9.2-10) 4.9.2 copyright (c) 2014 free software foundation, inc. free software; see source copying conditions. there no warranty; not merchantability or fitness particular purpose.

CMake: Linking to an imported library with dependencies fails -

i have subdirectory cmakelists.txt should compile library using make , export result imported library parent directory: set(static_lib ${cmake_current_binary_dir}/lib/mylib.a) add_custom_command( working_directory ${cmake_current_source_dir} output ${static_lib} command make command make install prefix=${cmake_current_binary_dir} ) add_custom_target(compile_mylib depends ${static_lib}) add_library(mylib static imported) set_property(target mylib property imported_location ${static_lib}) add_dependencies(mylib compile_mylib) the cmakelists.txt in parent directory looks this: add_subdirectory(deps/mylib) add_executable(mybin source.c) target_link_libraries(mybin mylib) on osx works fine - if compile same on ubuntu seems ignore subdirectory's cmakelists , complains: /usr/bin/ld.bfd.real: cannot find -lmylib i'm using clang compilation. the solution add global add_library call visible parent cmakelists.txt

arduino - How do I remove the null pointer exception from this code in processing -

i trying project found in instructbles. http://www.instructables.com/id/touche-for-arduino-advanced-touch-sensing/?allsteps there arduino code , processing code needs run implement project. codes can found here. https://github.com/illutron/advancedtouchsensing the arduino code runs fine. 1 in processing gives nullpointerexception error , output plain white window instead of desired graphs. complete error message follows: stable library ========================================= native lib version = rxtx-2.1-7 java lib version = rxtx-2.1-7 [0] "com1" [1] "com12" error, disabling serialevent() //./com12 java.lang.reflect.invocationtargetexception @ sun.reflect.nativemethodaccessorimpl.invoke0(native method) @ sun.reflect.nativemethodaccessorimpl.invoke(nativemethodaccessorimpl.java:39) @ sun.reflect.delegatingmethodaccessorimpl.invoke(delegatingmethodaccessorimpl.java:25) @ java.lang.reflect.method.invoke(method.java:597) @ processing.serial...

python 3.x - Can't avoid stop words in tokens list -

i'm normalizing text wiki , 1 if task delete stopwords(item) text tokens. can't it, more exact, can't avoid of items. code: # coding: utf8 import os nltk import corpus, word_tokenize, freqdist, conditionalfreqdist import win_unicode_console win_unicode_console.enable() stop_words_plus = ['il', 'la'] text_tags = ['doc', 'https', 'br', 'clear', 'all'] it_sw = corpus.stopwords.words('italian') + text_tags + stop_words_plus it_path = os.listdir('c:\\users\\1\\projects\\i') lom_path = 'c:\\users\\1\\projects\\l' it_corpora = [] lom_corpora = [] def normalize(raw_text): tokens = word_tokenize(raw_text) norm_tokens = [] token in tokens: if token not in it_sw , token.isalpha() , len(token) > 1: token = token.lower() norm_tokens.append(token) return norm_tokens folder_name in it_path: path_to_files = 'c:\\users\\1\\projects\\i\\%s...

asp.net mvc - MVC 5 EditorTemplate for Model renders with same id and name -

i have parent model "receipt" , has dictonary of objects property called customcontroldictionary of class customcontrolmodel . in view loop throuh each object in customcontroldictionary property , call editortemplate. in template add label , textbox customcontrolmodel object. when code renders html controls have same id , name attributes : id="key_value" name="key.value" . did try using regualr arrays or lists instead of dictionary ,but same result. looking forward advise. model: public class receiptmodel { public receiptmodel(){} public int receiptid { get; set; } public string receiptnumber { get; set; } public dictionary<string, customcontrolmodel> customcontroldictionary{get; set; } // public list<customcontrolmodel> customcontrollist { get; set; } } public class customcontrolmodel { public customcontrolmodel(){} public int customcontrolid{ get; set; } public string customcontrolname{ ge...

Use PHP to track links -

i have various links in website point specific form. whenever fills out form, want able know link led them form. i want without having create individual line of php code every link create in the. instead, want have php code picks link, , maybe inserts hidden text box gets value or text tag in link. for example: user clicks link. that link directs them form. the link carries identification activates php code when recieve form, know link clicked form. i want work links in emails send out well. based on information in post, sounds want send token/ id. <a href="form.php?token=xxx">goto form</a> now on form can grab token: $token = $_get['token']; // use proper testing first then use switch or if statements run whichever code need. <input type="hidden" value="<?php echo $token; ?>"> additional: as //use proper testing first comment indicates, should make sure token being passed valid ,...

c++ - Filter input received by getline -

#include <iostream> #include <string> #include <cstring> #include <fstream> using namespace std; int main() { string firstfile, secondfile, temp; ifstream infile; ofstream outfile; cout << "enter name of input file" << endl; cin >> firstfile; cout << "enter name of output file" << endl; cin >> secondfile; infile.open(firstfile.c_str()); outfile.open(secondfile.c_str()); while(infile.good()) { getline(infile, temp, ' '); if ( temp.substr(0,4) != "-----" && temp.substr(0,5) != "header" && temp.substr(0,5) != "subid#" && temp.substr(0,5) != "report" && temp.substr(0,3) != "date" && temp != "" && temp != "") { outfile << temp; } ...

orbeon - Can I add custom CSS that will not affect the style of generated PDFs? -

the orbeon doc here shows how add custom css so: <property as="xs:string" name="oxf.fr.css.custom.uri.*.*" value="/config/acme.css"/> this css affects display in form runner generated pdf versions of forms. there way add custom css not affect pdf? i ask because using custom css hides sections default , custom javascript simulate navigation between sections via show/hide. since sections hidden default, end pdf empty except title. if there no easy way this, can work around it. running form runner within proxy portlet in liferay can add custom css liferay theme. if there way orbeon nice. per suggestion @avernet able resolve issue enclosing custom css in @media screen { ... } .

matrix multiplication - Armadillo vs Eigen3 Timing Difference -

my hope discussion might else having issues armadillo , eigen3. i've written wrapper class, mat, wraps either arma::mat armadillo library or eigen::matrix eigen3 library. controlled flag @ compile time. additionally, i've written tensor class uses mat storage. primary feature of class use of voigt notation condense higher order tensors stored in matrix. finally, i've written test multiplies 2nd order tensor (i.e. matrix) , 1st order tensor (i.e. vector) multiple times , records time takes complete operators. mat class , tensor class. because tensor wraps mat, expect time larger. case armadillo, close 20% on average. however, when using eigen, using tensor faster, makes absolutely no sense me. does stick out anyone? edit: providing more details. i've first wrapped arma::mat myown::armamat , eigen::matrix myown::eigenmat. both of these wrap armadillo , eigen's api common framework. finally, based on compiler flag, myown::mat wraps armamat or eigenmat...

c++ - Bunch of errors while overloading the output operator -

i have been writing code , wanted overload << operator. declared operator friend function has access private variables should stay private! it's giving me lot of errors back. gives me problems not allow me access private data need. if comment out operator programm compiles fine. , sorry because language in code german. header: #pragma once class fahrzeug { private: int hg; double tank; double fst; double dsv; double ks; public: fahrzeug(); fahrzeug(const fahrzeug& brm); friend ostream& operator<<(ostream& os, const fahrzeug& obj); // <------ ~fahrzeug(); }; cpp: #include "fahrzeug.h" #include <iostream> using namespace std; fahrzeug::fahrzeug() { hg = 180; tank = 50; fst = 45; dsv = 9; ks = 50000; } fahrzeug::fahrzeug(const fahrzeug& brm) { hg = brm.hg; tank = brm.tank; fst = brm.fst; dsv = brm.dsv; ks = brm.ks; } ostream& operator<...

r markdown - Run Rmarkdown.rmd outside R editor -

Image
i still pretty new r, couldn't seem find solution question. it's quite simple: i have .rmd file written , ready run, instead of openning r or rstudio, there way can knit automatically without opening file? please kindly guide me how should this, screenshot appreciated!! thanks in advance!! added: took nrussell's advice , tried run on windows command line, seeing "the filename, directory name, or volumn label syntax incorrect" . thoughts? thank comments! did cd rmd's path , used @nrussell's code. , worked. somehow, couldn't use specified rmd file path such c:\xxx\xxxx.rmd, if cd there first, worked.

svytable and svychisq not recognizing homemade function variables, running RStudio Version 0.99.467 running R 3.2.3 Windows 64 bit -

i trying build function in r allow me generate weighted tables of named variables within in data frame using r survey package thomas lumley. think running errors because svytable , svychisq functions in survey package not recognizing arguments in homemade function names of desired variables data frame want analyzed. i had tried utilize example given here develop solution: lapply anonymous function call svytable results in object 'x' not found i took @ post when trying troubleshoot svychisq: error using dynamic variable specification in r survey function svychisq() none of suggestions these posts have worked me date. appreciate if people through code , give feedback try generate function prints 1. weighted table of totals 2. results of running chi square analysis on weighted table. here data/code date: #data make code reproducible independent <- c(2,1,1,1,1,1,2,2,1,1,2,2,2,2,1,1,1,2,2,2,2,2,2,1,1,1,2,1,2,1,1,1,2,2,1,1,2,1,1,2,1,2,1,1,1,1,1,1,1,2,1,2,1,2...

python - Adding View_Group Perm to groups table using Django Rest Framework and Guardian -

i writing application using django 1.9, guardian , django rest framework. i trying add new perm (view_group) groups. new perm control groups logged-in user can see when calling backend. using djangoobjectpermissions. apparently seems daunting add view_group permission django.contrib.auth.models.group class. wondering if has managed it. if please let me see solution. this models from django.contrib.auth.models import group realgroup django.db import models guardian import shortcuts users.models import user if not hasattr(realgroup, 'parent'): field = models.foreignkey(realgroup, blank=true, null=true, related_name='children') field.contribute_to_class(realgroup, 'parent') class group(realgroup): """ custom group. """ class meta: proxy = true permissions = (("view_group", "can view group"), ) i getting exception content type matching query not exist . although trying hack , ad...

postgresql - postgres index with date in where clause -

i have large table several million rows in postgresql 9.1. 1 of columns timestamp time zone. frequently used query looking data using clause 'column > (now()::date - 11)' last ten days. i want build index work last months data, limit scan. partial index. so far have not figured out how use actual last month, started hardcoding '2015-12-01' start date index. create index q on test (i) > '2015-01-01'; this worked fine, index created. unfortunately, not used, treats '2015-01-01' ::timestamp , while query ::date . index not used , square one. next tried modify index compare column date, match. here hit immutable wall. as to_date or cast date mutable functions, dependent on local timezone, index creation fails. if have test table this: create table test (i timestamptz); and try create index create index q on test (i) > to_date('2015-01-01','yyyy-dd-mm'); then fails error: functions in index predicate ...

How to change response header (cache) in CouchDB? -

do know how change response header in couchdb? has cache-control: must-revalidate; , want change no-cache . i not see way configure couchdb's cache header behavior in configuration documentation general (built-in) api calls. since not typical need, lack of configuration not surprise me. likewise, last tried show , list functions (which give custom developer-provided functions control on headers) not leave cache headers under developer control either. however, if hosting couchdb instance behind reverse proxy nginx, override headers @ level. option add usual "cache busting" hack of adding random query parameter in code accessing server. necessary in case of broken client cache implementations not typical. but taking step back: why want make responses no-cache instead of must-revalidate ? see perhaps wanting override in other direction, letting clients cache documents little while without having to revalidate. not letting clients cache @ seems little...

matlab - Programming Finite Element Method -

i trying teach myself how finite element methods. all of code adapted following link pages 16-20 http://homepages.cae.wisc.edu/~suresh/me964website/m964notes/notes/introfem.pdf i programming along in matlab perform finite element analysis on single 8 node cube element. have defined xi,eta,zeta local axes (we can think x, y, z now), following shape functions: %%shape functions zeta = 0:.01:1; eta = 0:.01:1; xi = 0:.01:1; n1 = 1/8*(1-xi).*(1-eta).*(1-zeta); n2 = 1/8*(1+xi).*(1-eta).*(1-zeta); n3 = 1/8*(1+xi).*(1+eta).*(1-zeta); n4 = 1/8*(1-xi).*(1+eta).*(1-zeta); n5 = 1/8*(1-xi).*(1-eta).*(1+zeta); n6 = 1/8*(1+xi).*(1-eta).*(1+zeta); n7 = 1/8*(1+xi).*(1+eta).*(1+zeta); n8 = 1/8*(1-xi).*(1+eta).*(1+zeta); the [n] matrix arranged according text reading: %n matrix n= [n1 0 0 n2 0 0 n3 0 0 n4 0 0 n5 0 0 n6 0 0 n7 0 0 n8 0 0; 0 n1 0 0 n2 0 0 n3 0 0 n4 0 0 n5 0 0 n6 0 0 n7 0 0 n8 0; 0 0 n1 0 0 n2 0 0 n3 0 0 n4 0 0 n5 0 0 n6 0 0 n7 0 0 n8]; to find [b] matrix have us...

java - Passing parameters between jsp and xsl -

i have problem between jsp page , xsl, want pass parameter between jsp , xsl never set in xsl. jsp page ; <%@ page language="java" contenttype="text/html; charset=iso-8859-1" pageencoding="iso-8859-1"%> <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> <%@ taglib uri="http://java.sun.com/jsp/jstl/xml" prefix="x"%> <%! private string getval(string param, httpservletrequest request) { return request.getparameter("fname"); } %> <% string num = getval("value", request); %> <div id="section" class="col-xs-10 col-sm-10 col-md-8"> <c:import url="/monxml.xml" var="inputdoc" /> <c:import url="/viewannonce.xsl" var="stylesheet" /> <x:transform xml="${inputdoc}" xslt="${stylesheet}" > ...

How can I create a canvas, then set its color, and then append it to a div using Javascript/ Jquery? -

i trying build basic game , somehow got hung on first few steps. trying create canvas, the color of canvas, , append div element. every time load either error, or nothing. if 2 console.logs load properly. please help! html: <!doctype html> <html> <head> <meta charset="utf-8"> <title>dodge</title> <script src="//code.jquery.com/jquery.js"></script> <link href="https://maxcdn.bootstrapcdn.com/bootswatch/3.3.6/journal/bootstrap.min.css" rel="stylesheet" integrity="sha256-fhwoqb8bpkjlic7auv6qy/lt0hrzfwm0ciyau7haf5w= sha512-3t2geicrnekhznuaumyggilkzzb/vphvfw3y1rt2fcwkuralvroctpaviysz4xqm52mbo7m93naxbm/9doa2og==" crossorigin="anonymous"> <script src="../../../game.js"> </script> </head> <body> <center> <h1 id="h1">dodge enemy pressing left , right arrow keys!</h1> <button ...

TypeScript npm typings feature changes import semantics -

when importing typings ( .d.ts ) file using import x = require('...') pattern semantics change when package.json typings entry used. for example, following declaration file imports when no package.json typings entry used generates error ts2656 ( exported external package typings file not module ) when used typings entry: declare module 'mymodule' { export function myfunc(source: string): string; } whereas same file minus declare module {} imports when used package.json typings entry generates error ts2307 ( cannot find module ) when used without typings entry. export function myfunc(source: string): string; why change in semantics? it looks if use new npm typings feature have maintain both npm , non-npm versions of typings files. i hit while trying use projects typings file within project (typescript not in current project's package.json typings entries, seems confine it's search to ./node_modules ). tested typescript 1.7.5. ...

c# - UCMA 4.0 How to get user name from PresenceNotificationRecieved Handler -

i using ucma 4.0 presence status of user. have defined event handler so _remotepresenceview.presencenotificationreceived += new eventhandler< remotepresentitiesnotificationeventargs>(remotepresence_presencenotificationreceived); its implementation follows: // event handler process remote target's presence notifications private void remotepresence_presencenotificationreceived(object sender, remotepresentitiesnotificationeventargs e) { console.writeline(string.format("presence notifications received target {0}", <<how username here>> )); // notifications contain notifications 1 user. foreach (remotepresentitynotification notification in e.notifications) { if (notification.aggregatedpresencestate != null) { console.writeline("aggregate state = " + notification.aggregatedpresencestate.availability); } } console.writeline("press enter d...

ruby on rails - Keeping rspec convention with --format doc -

betterspecs suggests using like: subject { assigns('message') } { should match /it born in billville/ } as practice. in case want run rspec in doc format ( rspec -f doc ) i'm receiving: when call matcher in example without string, this: specify { object.should matcher } or this: { should matcher } rspec expects matcher have #description method. should either add string example matcher being used in, or give description method. won't have suffer lengthy warning again. so this it "some desc" should match /it born in billville/ end won't raise annoying message seems ugly. any ideas on how keep rspec conventions , code clean, , still have pretty output(like -f doc )? rspec v.2.13.0 as rspec maintainer, there many things listed on betterspecs.org disagree. i've commented such on github issues project many months ago, sadly, don't think of concerns have been addressed :(. anyhow, think one-liner sy...

ios - Use Xcode Auto Layout for different image sizes on iPhone -

with auto layout iphones in portrait, don't want exact same size uiimageviews game characters on iphone 6+ in iphone 4s. 4s characters need smaller or else they'll big. using auto layout how change image sizes between iphones because seem change same sizes regardless of constraints. i sure smaller because when add images, add 3 sizes of image: @1x, @2x, , @3x. these images make image universal apple devices. try them out in simulator.

loops - Get last n quarters in JavaScript -

apparently, this kind of question asked before , it's c# answer can't translate javascript. here's original code, fails first quarter: var amount = 6; var = new date(); var thisyear = now.getfullyear(); var quarterstart = math.ceil((now.getmonth() + 1) / 3); //quarterstart return number between 1 , 4 (var = 0; < amount; i++) { //here's line needs changed var thisquarter = quarterstart - (i % 4); //if thisquarter last one, go 1 year if (thisquarter == 4 && > 0) { thisyear--; }; console.log('q' + thisquarter + ' ' + thisyear); }; //console should return following //'q1 2016' //'q4 2015' //'q3 2015' //'q2 2015' //'q1 2015' //'q4 2014' edit: setup loop can changed, long output shown. i've made changes code, should work now. var amount = 6; var = new date(); var thisyear = now.getfullyear(); var quarterstart = math.ceil((now.getmonth() +...

Creating a PHP array for display in an HTML table -

i have database records ip address , session id of users hit web-site. want display html table of top ten occuring ip addresses , number of distinct sessions associated each ip address. so start query: $sql="select ip, country, city, count(*) count hits group ip order count desc limit 10"; and then, each of resulting 10 rows use while loop query same database extract number of distinct session id's associated each address thus: $sql="select distinct session hits ip='$ipaddress'" my challenge build, go through while loop, array (with same structure mysqli query result) on can subsequently use foreach loop output html table. here's full code: $con = mysqli_connect("localhost","user","password","dbase"); $sql="select ip, country, city, count(*) count hits group ip order count desc limit 10"; $result = mysqli_query($con,$sql); $data = array(); while ($row = mysqli_fetch_assoc($result)) {...

mysql - Hide database from user while allowing user to query it -

i hoping me mysql / phpmyadmin problem. (i don't know if possible...) here problem: have 2 databases: db1 , db2 have user db1user. user has full access db1 , has select access specific tables in db2. hoping there way hide db2 user. i.e. when user types in 'show databases;', user see db1. however, when user types in 'select * db2.table1;', should see results of query. is possible? doable? thanks help! these 2 queries restrict user single database, user can see, update, , delete tables single database: replace user mysql username replace userdatabase single mysql database wish user have access to. revoke privileges,grant option user; grant on userdatabase.* 'user';

Firebase Redundancy/Failover - How does it work -

i'm curious how redundant firebase is? when write database firebase automatically replicated multiple data centers/servers? i noticed if go http://status.firebase.com/ , there list of servers (?) called s-dal5-nss-xx. not sure these mean or how find out 1 of these application resides on. more information great! thank you! how find out 1 of these application resides on from discussion on firebase mailing list : you can monitor https://.firebaseio.com/.settings/owner.json find out server currently handling requests firebase app. note whilst method of getting current hostname firebase under, firebase apps not guaranteed stay on same server - configurations can (and do) change add or remove servers rotation or load balance necessary.

css - Transforming image "vibrating" horribly in Firefox. Why? -

Image
this related question asked didn't find source of problem until now. what want circle expands rectangle. scales .9 1. what have http://codepen.io/stuffiestephie/full/zrzweq/ i've slowed down animation "vibration" clearer. #seasonone .test { padding:0; background-color: #fff; background: #fff url('http://i296.photobucket.com/albums/mm174/stuffiestephie/s1chibipreview2_zpsswyamase.png') 50% 50% no-repeat; width: 200px; height: 200px; border-radius: 50%; display: block; margin: 0 auto; -webkit-transition: 2s; -moz-transition: 2s; transition: 2s; -webkit-transform: scale(.9); -ms-transform: scale(.9); -moz-transform: scale(.9); transform: scale(.9); font-size: 0; -webkit-transform-origin: 50% 50%; -moz-transform-origin: 50% 50%; -ms-transform-origin: 50% 50%; transform-origin: 50% 50%; } #seasonone:hover .test { -webkit-tran...

Anybody know a good way to do offline reverse geocoding? -

i need offline reverse geocoding, meant run cron-jobs. reverse coder should give city, state millions of 'records'. what services exist ( paid or free ) can 'it'? i've looked @ http://www.geonames.org/ , that's not need. get table coordinates of cities (and state city in). coordinate, pick closest city. efficient use, encode table r-tree. for links on r-tree etc, see reverse geocoding without web access get cities table geonames, see given lat/long coordinates, how can find out city/country?

jquery - Simultaneously toggling 2 divs in 1 container + 2 in another container -

i'm not sure how search this: on gallery page want able toggle image between original size , 2x clicking on but also clicking zoom button in container changes state (indicating can either zoom in or out in concordance image div current state) i got far toggling image clicking or button don't know how toggle button. thanks. you can use jquery toggleclass() . example http://jsbin.com/uhiguv/1/edit and using hasclass can target elements specifically. example: http://jsbin.com/uhiguv/2/edit <!doctype html> <html> <head> <script src="http://code.jquery.com/jquery-1.9.1.min.js"></script> <meta charset=utf-8 /> <title>js bin</title> <style> .image.active{width:64;height:64;} .active{border:2px solid black;} </style> </head> <body> click image or button<br><br> <img class="ctrl image" src="http://www.gravatar.com/avatar/f9dc5de7822b16...

android - Different screen sizes? -

Image
i have had trouble in past optimizing app different layouts. told me normal directory override large-land directory, , oddly enough true, deleted normal directory. will other layouts override each other? have put every layout each of these folders, , edited appropriately (took me week of many hours!), every directory see in picture, has multiple xml resource folders within. need else optimize app layouts? have added following in manifest: <supports-screens android:anydensity="true" android:largescreens="true" android:normalscreens="true" android:smallscreens="true" android:xlargescreens="true" /> i don't recommend delete normal directory, because it's used default one. the utility of normal directory , when system can't find xml file in directory matches device, take default xml (the 1 in normal directory ). this useful if forget add 1 (or more) screen...

content management system - Is a CMS portal a web server? -

i know it's dumb question colleague of mine schooled me saying cms web server, , i'm confused. what guys think? no cms not web server. a cms system has inside web server if meant perform.

javascript - How to display gridview data in popup in .net? -

now have been created display gridview data in new tab on click event. but need display in popup. here code: protected void loginfo_click(object sender, eventargs e) { button btn = (button)(sender); response.write("<script>"); response.write("window.open('loginfo.aspx?id=" + btn.commandargument + "','_blank')"); response.write("</script>"); } aspx: <asp:gridview id="gridview1" runat="server" autogeneratecolumns="false" datakeynames="bookid" enablepersistedselection="true" backcolor="white" height="240px" width="755px" bordercolor="red" borderwidth="2px"> <columns> <asp:boundfield datafield="id" headertext="id" insertvisible="false" readonly=...

laravel - Is it possible to put multiple relation constraints in a single method in Eloquent? -

i have query looks this: post::wherehas('comments', function ($query) { $query->where('content', 'like', 'foo%'); })->wherehas('comments', function ($query) { $query->where('content', 'like', 'bar%'); })->get() like need posts, have 1 comment text 'foo' , 1 comment text 'bar'. can somehow mix 2 requests in single one? yes, it's possible chain multiple clauses can use :: once (after model name), others should -> how added ->get() . so end with: post::wherehas('comments', function ($query) { $query->where('content', 'like', 'foo%'); })->wherehas('comments', function ($query) { $query->where('content', 'like', 'bar%'); })->get()

video - What is wrong part in my Android code with ffmpeg? -

i want mixed video.(image + video) total duration of original video 180 sec. want put image front of video. so, made code in android studio. can not toast. wrong ? how check end of process? ... path = "libray folder"; ... private class processvideo extends asynctask<void, integer, void> { @override protected void doinbackground(void... params) { process ffmpegprocess = null; try { // initialize command process video // library video process library. string[] command ={path,"-i", input, "-r", "1", "-q:v", "2", "-f", "image", input}; ffmpegprocess = new processbuilder(ffmpegcommand).redirecterrorstream(true).start(); outputstream ffmpegoutstream = ffmpegprocess.getoutputstream(); bufferedreader reader = new bufferedreader...

php - Laravel Session not persisting when redirecting after adding data to the session -

i trying save key => values in session before redirect twitter oauth page . session not persisting data. i have tested in centos , ubuntu both running php5.6 php 5.6.16 (cli) (built: nov 26 2015 08:01:30) copyright (c) 1997-2015 php group apache version server version: apache/2.4.18 (centos) server built: dec 14 2015 18:39:31 i no errors, storage folder writable , not errors @ all. can please me issues. it turns out no file being written ("storage/framework/sessions"). the value 'driver' => env('session_driver', 'file') , coming through, doesn't work either if change 'driver' => 'file' , thanks in order session working, routes supposed declared within following definition in routes.php route::group(['middleware' => ['web']], function () { }); thanks

ios - Linking errors when trying to install Google signin -

i trying integrate google sign in ios apps while doing getting below error. is there solution remove below errors? undefined symbols architecture armv7: "_inflate", referenced from: l002 in googlesignin(gtmnsdata+zlib.o) "_deflate", referenced from: l001 in googlesignin(gtmnsdata+zlib.o) "_inflateend", referenced from: l002 in googlesignin(gtmnsdata+zlib.o) " deflateinit2 ", referenced from: l001 in googlesignin(gtmnsdata+zlib.o) " inflateinit2 ", referenced from: l002 in googlesignin(gtmnsdata+zlib.o) "_deflateend", referenced from: l001 in googlesignin(gtmnsdata+zlib.o) ld: symbol(s) not found architecture armv7 clang: error: linker command failed exit code 1 (use -v see invocation) you can fallow below steps go build settings / linking / other linker flags , add "-objc" without quotes. assume using "header file" map...

c# - Sorting XDocument elements based on InnerXML -

i have xml document similar this: <document> <post> <author>bill smith</author> <subject>test article</subject> <dates> <uploaded>some date</uploaded> <published>some date</published> </dates> <price> <provider>amazon</provider> <cost>1540</cost> </price> <price> <provider>wh smith</provider> <cost>2640</cost> </price> </post> <post> <author>bill smith</author> <subject>test article</subject> <dates> <uploaded>some date</uploaded> <published>some date</published> </dates> <price> <provider>amazon</provider> <cost>1540</cost> </price> ...

jsf - Can not assign variable from another Beans with composite component in MyFaces -

version : myfaces 2.2.8 issues : have composite component assign value variable passed composite. works in mojara 2.2.12 (before im migrating myfaces 2.2.8). this composite code : info.xhtml <composite:interface> <composite:attribute name="id" /> <composite:attribute name="methodtogetrecordfrominfo" method-signature="java.util.list action(id.co.sg.core.dto)" required="true" /> </composite:interface> <p:datatable id="tblinfocodecomponent" var="codecomponent" value="#{infobean.grid}" <p:columngroup type="header"> <p:row> <p:column headertext="codecomponent"/> </p:row> </p:columngroup> <p:column> <p:commandlink value="#{codecomponent.map['componentcode']}" process="@this" icon="ui-icon-sear...