Posts

mysql - New table (with derived_data) or SQL query? -

from best-practice point of view, better create new table in database derived_data field other tables, or calculate using sql-query everytime? details: more precicely, have table orders(id_order,date,time,sum) , want track daily profits , preview them everytime administrator selects drop-down menu. shall make sql-query everytime asks it, or new table profits(date,day_profit) with derived_data field takes value other tables? for simple calculations ( a+b ), them in select . for aggregates ( count(sales), sum(revenue) ) results regularly calculate, build "summary table(s)". for example, daily counts, totals, etc, broken down region . otherwise take group by , etc. note can compute weekly or monthly totals daily table, not build more tables. see my summary tables blog . for thousand rows, not important; million or billion vital performance in "data warehousing". keep in mind summary table no-no (to database purists) since holds 'redunda...

go - Parsing S&P 500 Data from Wikipedia in GoLang -

i trying figure out how parse table of s&p 500 stock page: https://en.wikipedia.org/wiki/list_of_s%26p_500_companies . python has nice libraries lxml take care of i'm trying same thing in golang. have looked making requests "net/http" not sure how perform actual parsing. thank you. i'd use lib: https://github.com/puerkitobio/goquery it gives easy use jquery selectors. i made example data: http://play.golang.org/p/kdwuiipxsu

Android can't read iPhone recorded audio files -

i record audio file ios application , send android application through web server. android application gets file when use mediaplayer class try , play it, reports error "unable to create media player" @ line mediaplayer.setdatasource(androidfilepath); mention, ios devices can read files sent app. after research found may encoding issue. tried many recording settings provided here on none has worked. here code use record audio file: avaudiosession *audiosession = [avaudiosession sharedinstance]; [audiosession setcategory:avaudiosessioncategoryrecord error:nil]; nsmutabledictionary *recordsettings = [[nsmutabledictionary alloc] initwithcapacity:10]; [recordsettings nsnumber numberwithint: kaudioformatmpeg4aac] forkey: avformatidkey]; [recordsettings setobject:[nsnumber numberwithfloat:16000.0] forkey: avsampleratekey]; [recordsettings setobject:[nsnumber numberwithint:1] forkey:avnumberofchannelskey]; [recordsettings setobject:[n...

html - Invalid File on file upload PHP -

upload_file.php $allowedexts = array("jpg", "jpeg", "gif", "png", "mp3", "mp4", "wma", "mp4"); $extension = pathinfo($_files['file']['name'], pathinfo_extension); if ((($_files["file"]["type"] == "video/mp4") || ($_files["file"]["type"] == "audio/mp3") || ($_files["file"]["type"] == "audio/wma") || ($_files["file"]["type"] == "image/pjpeg") || ($_files["file"]["type"] == "image/gif") || ($_files["file"]["type"] == "image/jpeg")) && ($_files["file"]["size"] < 20000000) && in_array($extension, $allowedexts)) { if ($_files["file"]["error"] > 0) { echo "return code: " . $_files["file"]["error"] . "...

android - Fragment container with Viewpager, tabs, and drawerlayout doesn't work -

i have drawerlayout, viewpager, , tablayout in activity_main.xml have 2 fragments homefragment , bookingfragment , i'm trying launch bookingfragment activity's on itemclick. have tried multiple solutions creating framelayout id container , put pager inside , user in fragment transaction , tried making empty framelayout same id , put above pager, didn't work. here's code method i'm trying start fragment from public void starttransaction(){ fragment newfragment = new bookingfragment(); fragmenttransaction transaction = getsupportfragmentmanager().begintransaction(); transaction.add(r.id.pager, newfragment); transaction.addtobackstack(null); transaction.commit(); } here's activity_main.xml <android.support.v4.widget.drawerlayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.andr...

square root - How do I the calculate the sqrt of a natural or rational number in coq? -

i'm learning coq , i'm trying make own point , line data types. i'd make function returns length of line, can't seem find sqrt function return calculation. tried used coq.reals.r_sqrt , apparently that's used abstract math, won't run calculation. so tried importing coq.numbers.natural.abstract.nsqrt , coq.numbers.natint.nzsqrt. neither put sqrt function environment. this have far... require import coq.qarith.qarith_base. require import coq.numbers.natint.nzsqrt. require import coq.numbers.natural.abstract.nsqrt. require import coq.zarith.binint. inductive point : type := point : q -> q -> point. inductive line : type := line : point -> point -> line. definition line_fst (l:line) := match l | line x y => x end. definition line_snd (l:line) := match l | line x y => y end. definition point_fst (p:point) := match p | point x y => x end. definition point_snd (p:point) := match p | point x y => y ...

mysql - Stored Procedure - Error #1064 -

getting error during creating stored procedure callable statement: know thing simple going wrong, i'm unable figure out! my query: use demo; 1. create procedure 2. insert_emp_data (in id int, in name varchar(2), in age int, in image blob) 3. begin 4. insert emp_data values(id, name, age, image); 5. end; / sql query: create procedure insert_emp_data (in id int, in name varchar(2), in age int, in image blob) begin insert emp_data values(id, name, age, image); mysql said: documentation #1064 - have error in sql syntax; check manual corresponds mysql server version right syntax use near '' @ line 4 appreciate help! thank time! when write stored procedure in mysql, should use delimiter statement. in addition, should name columns not conflict column names. and, when using insert list columns name. so: delimiter $$ create procedure insert_emp_data ( in in_id int, in in_name varchar(2), in in_age int, in in_image blob ) ...