Posts

Showing posts from May, 2010

java - #Project - WebView goBack() Return -

after searching on stackoverflow , testing codes, return goback(); doesn't work. i webview, - url work - zoom work but need reload last page code added : mainactivity.java package org.sbynight.app; import android.app.activity; import android.app.alertdialog; import android.content.dialoginterface; import android.os.bundle; import android.webkit.webview; import android.webkit.webviewclient; import android.webkit.webchromeclient; import android.view.keyevent; public class mainactivity extends activity { webview view; public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); webview view = (webview) this.findviewbyid(r.id.webview1); //url du website - not change string url = "http://www.mydomaine.com/"; //loads webview zoomed out view.getsetting

types - String to *character arduino -

i want display real time string on nokia 5110 using arduino. found code lcdstring function there takes *character parameter instead of sting. hence when pass string variable it displays error: cannot convert 'string' 'char ' argument '1' 'void lcdstring(char*)'* here code using /* scrolling text example code modified from: http://www.arduino.cc/playground/code/pcd8544 */ string a=""; // pins use on arduino #define pin_sce 7 #define pin_reset 6 #define pin_dc 5 #define pin_sdin 4 #define pin_sclk 3 // configuration lcd #define lcd_c low #define lcd_d high #define lcd_cmd 0 // size of lcd #define lcd_x 84 #define lcd_y 48 int scrollposition = -10; static const byte ascii[][5] = { {0x00, 0x00, 0x00, 0x00, 0x00} // 20 ,{0x00, 0x00, 0x5f, 0x00, 0x00} // 21 ! ,{0x00, 0x07, 0x00, 0x07, 0x00} // 22 " ,{0x14, 0x7f, 0x14, 0x7f, 0x14} // 23 # ,{0x24, 0x2a, 0x7f, 0x2a, 0x12} // 24 $ ,{0x23, 0x13, 0x08, 0x64, 0

c# - What is the format of a date in database ? asp.net -

this code establish_connection con = new establish_connection(); string fname = txtfirstname.text; string lname = txtlastname.text; string email = txtemailsingup.text; string password = txtpasswordsignup.text; string dobday = ddlday.selectedvalue; string dobmonth = ddlmonth.selectedvalue; string dobyear = ddlyear.selectedvalue; string dob= dobyear +"/"+ dobmonth +"/"+ dobday; string gender = lblgender.selectedvalue; string username = txtusername.text; string connstr = configurationmanager.connectionstrings["database"].connectionstring; sqlconnection conn = new sqlconnection(connstr); conn.open(); try { string constr = "insert users (username,fname,lname,dob,gender,email,password) values (@username,@fname,@lname,@dob,@gender,@email,@password);"; sqlcommand cmd = new sqlc

ruby on rails - What join/model arrangement would be appropriate here? -

i've been reading on various types of relationships possible under activerecord, , i'm in position think understand details in abstract haven't clicked me. appreciate little advice on issue. in practice application, dealing 4 concrete things: viewers, tv shows, discs of shows, , episodes. there's 1 abstract thing, viewer<->show or 'subscription'/'who watches what' relationship, run trouble. summary each owner watches several show s. each show has many episode s. an episode belongs 1 show . an owner owns many disc s. a disc belongs show, has many episode s on it. the same disc can owned many owner s, there needs way see if owner owns specific disc -- fact watch show disc belongs isn't enough, there has boolean 'owned?' somewhere. i need pull data out neatly answer questions like: what shows user x watch? who watches show y ? how many discs user x own? what episodes on disc z ? what episodes not on d

css - Assign two different classes/ID's to attribute:hover -

i'm working on tumblr theme individual posts display link permalink page on hover , post beneath blurs. .entry:hover #permalink , .entry:hover img {-webkitfilter:blur} work both individually, not together. maybe i'm doing css wrong when try assign .entry:hover 2 different attributes. or problem of z-index , position ? can use jquery make "if entry hover shows permalink -> blur entry img" ? jsfiddle demo css: body{ position:absolute; } .entry { float:left; width:100%; } .entry #permalink { position:absolute; width:100%; opacity:0.0; } .entry:hover #permalink { opacity: 1; text-align:center; } .entry img { -webkit-filter: blur(0px); } .entry:hover img { -webkit-filter: blur(5px); } html: <div class="entry"> <div id="permalink"><a href="#">post number x</a></div> <img src="#" alt="#" width="500px"/> </div> just add z-

php - How preserve my inputs values each time that I refresh my page? -

i want enter name , mark. mark entered less or equal 100, names , marks entered stored in associative array when click submit button , should request me enter name , marks. if enter mark greater 100 discarding name entered, when click submit button, php script should display me names , marks entered. here have done not getting desired results. please help. code: <?php if(isset($_post['lname']) && isset($_post['marks'])){ $name = $_post['lname']; $marks = $_post['marks']; $lists = array($name => $marks); foreach($lists $name => $marks){ echo $name . '<br>'; echo $marks; } } ?> <form action = "<?php echo $_server['php_self'];?>" method = "post"> name:<br> <input type = "text" name = "lname"><br><br> marks:<br> <input type = "text" name = "marks"><br><br> <input t

R-Stats: Add two arrays using factors -

starting 2 files follows: test1.r crop, value coconut, 12300 amaranthus, 123 cowpea, 100 brinjal, 210 coconut, 500 brinjal, 10 coconut, 1000 cowpea, 105 test2.r crop, value rubber, 10 cardamom, 22 amaranthus, 12 garcinia, 10 brinjal, 10 coconut, 1000 brinjal, 25 > d1 = read.csv("test1.r") > d2 = read.csv("test2.r") > sum1 = tapply(d1$value,d1$crop,sum) > sum2 = tapply(d2$value,d2$crop,sum) > sum1 amaranthus brinjal coconut cowpea 123 220 13800 205 > sum2 amaranthus brinjal cardamom coconut garcinia rubber 12 35 22 1000 10 10 i merge sum1 , sum2 single array applying operators such 'sum' value, if respective values if factor exists in both files (such amaranthus, brinjal , coconut), or inserting name-value pair if exists in 1 file. in short, output should follows (transposed convenience, , assuming 'sum' operator):

c++ - Program must decide positive, negative, or zero -

i need desigen program must display positive, negative or 0 when user enter number function name called numtest. when enter number 0 still appears as, number negative. can me on this. thank you. #include <iostream> using namespace std; float numtest(float a, float b, float c) { if(a>1) return a; if(b<1) return b; if(c=0) return c; } int main() { float num; cout<<"please enter number"; cin>>num; if(num>1) cout<<"number positive"; if(num<1) cout<<"number negative"; if(num=0) cout<<"number zero"; return 0; } first of all, when checking equality must use == instead of = .the = sign assigns r.h.s. l.h.s. eg. c=0 changes value in c 0 , instead should if(c==0) . now, if want check positive numbers, condition should if(num>0) , , negative numbers, should if(num<0) . lastly, try use else if , else instead o

Joomla 3 component MVC model, adding article directly to the database -

i beginner both when comes using mvc , creating joomla components. need create component reads uploaded csv-file contains article data, , add them directly database. so far i've created barebone component uses example of adding article directly database found here , , i've tried implement using mvc structure, i'm not sure if i'm doing correctly. the component based on com_helloworld component tutorial on how create basic component, explain structure, , can tell me whether i'm doing seems reasonable or not. so when open component adminstrator panel in joomla, goes default view in com_helloworld/admin/views/helloworld view.html.php loads nothing corresponding model, , opens default.php in com_helloworld/admin/views/helloworld/tmpl default.php contains: <?php?> <a href="index.php?option=com_helloworld&view=jimport">add article</a> so clicking link opens view jimport, has following view.html.php: <?php defined(

java - Limit the key of a HashMap to a specified length of characters -

i limit size of key hashmap specific size limit. i tried this: @valid private map<key, string> views; public class key { @notblank @size(max = 100) private string key; the problem @valid not valid key value of hashmap. what best way limit key specific size of characters? you can validate number of characters in key field (private string key;) in setter method, if greater maxlimit, throw exception.

Create an 'inverse' selection from a mysql query -

i have long , complex mysql query on table lot of 'where fieldx '%abc%'' , few 'where fieldx not '%efg%'. without doing bunch of search , replace change not , vice-versa, there simple query can select records not meet large query parameters vs ones designed do? simple example: i have tablea field called letter 26 records, 1 each letter of alphabet. i have query says: select * tablea `letter` = 'a' or `letter` = 'b' or `letter` = 'c' or or `letter` = 'd' or `letter` = 'e' or `letter` = 'f' or `letter` not 'g' or `letter` not 'h' now instead of doing search , replace reverse/negate of 'where' conditions: select * tablea `letter` != 'a' or `letter` != 'b' or `letter` != 'c' or or `letter` != 'd' or `letter` != 'e' or `letter` != 'f' or `letter` 'g' or `letter` 'h' i want use existing query , same result. t

In what kind of data structure implemented TCL's array? -

working on manipulation of big dates in tcl wondering how fast searching in arrays. unfortunately fill process in arrays not performs in other famous scripting languages. the data structure tcl calls “array” associative map string values variables (and it's considered variable-like, in has name , can advanced things attaching trace it). under hood, it's hash table (and in fact it's 1 of fastest hash table implementations of all) scales pretty number of elements increases. but it's not same arrays you'd find in language c, java, c#, python, … thing in tcl closely matches list , value (i.e., nameless, automatically serializable) holds compact map “small” integers (i.e., indices) values. it's lighter weight tcl array (indeed, it's implemented using c array). they don't support same set of operations. indeed, there's third data structure in tcl aware of: dictionary . that's value associative map strings values. it's implemented

c - What does "ERROR interpreting JPEG image file( invalid JPEG file structure :SOS before SOF)" mean? -

i trying recover jpg's .raw file, when try , open ".jpg's" out put of program, gives error, or says weird hexadecimal , says unsupported marker type jpeg (but says jpg!). doing wrong? * * recovers jpegs forensic image. */ //0xff 0xd8 0xff 0xe0 //0xff 0xd8 0xff 0xe1 #define block 512 #define start1end 0xe0 #define start2end 0xe1 #include <stdio.h> #include <cs50.h> #include <stdlib.h> #include <stdint.h> //sets begins or jpgs uint8_t checkjpg1[4] = {0xff, 0xd8, 0xff, 0xe0}; uint8_t checkjpg2[4] = {0xff, 0xd8, 0xff, 0xe1}; //making variables int found = 0; char title[block]; file* img; int ifopen = 1; int main(int argc, char* argv[]) { //opening file file* inptr = fopen("card.raw", "r"); //checking if file opening failed if (inptr == null) { return 2; } //making buffer unsigned char buffer[block]; //going through file while(fread(&buffer,sizeof(char)

Folder organization -

so taking web development class , in of classes they’ve been teaching keep our files separate. instance, have public folder , includes folder. in includes folder have database information , functions. here issue is: trying post site in godaddy , when try set tech support told me should place files in public folder. true? thought need place includes(private) folder in place; if so, should storing it? godaddy may not best source of advice. when ssh account (or use file manager) should see login dir iirc have www or html dir (and both, 1 symlinked other). public webroot/docroot locations. make dirtree of own sibling www/html dir , use include tree. when need absolute path directory tree in order know grab includes, can godaddy admin interface - https://support.godaddy.com/help/article/58/finding-your-hosting-accounts-absolute-path

apache - .htaccess: How can I keep the redirection and remove the subdirectory path from the urls please? -

i trying direct traffic subdirectory using .htaccess subdirectory is: /release2/code. the following redirecting not hiding /release2/code urls rewriteengine on rewritecond %{http_host} ^(www\.)?mysite\.com$ rewritecond %{request_uri} !^/release2/code rewriterule ^(.*)$ /release2/code/$1 [l]

Teradata- insert records from UPI table to NUPI table -

how data distributed among amps if records inserted nupi table upi table? data copied , retained in same amp of original one? in teradata rows distributed hash of primary index columns, there's no difference if pi unique or non-unique. to check on amp value stored can use built-in hash functions: select hashamp(hashbucket(hashrow('any value(s)/column(s)')));

javascript - jQuery Problems with removing event handler with .off() -

i have tried remove event handler .off() , not work. i want remove event handlers 1 input: <input type="file" id="file_upload" name="file_upload" size="50" /> here have tried: $('#form').on('keyup change', ':input', function() { registerchange(); }); $('#form input[name=file_upload]').off(); $('#file_upload').off(); you can use not selector file upload button $('#form').on('keyup change', 'input:not([name=file_upload])', function() { registerchange($(this).val()); }); function registerchange(value) { // notice typing upload textbox not log console console.log(value); } $('#form').on('click', 'input[name=file_upload]', function () { alert('in click event handler, removing myself'); // here how can remove event handler $('#form').off('click', 'input[name=file_upload]'

d3.js - d3JS Histogram with ordinal scale -

i trying d3js histogram working ordinal scale (in case, student grade symbols (a+, a, b ... f). here minimum working example: <!doctype html> <meta charset="utf-8"> <body> <script src="http://d3js.org/d3.v3.min.js"></script> <script> var studentsymbols = ["f", "e", "d", "c", "c", "c", "c", "b", "b", "a", "a+"]; var x = d3.scale.ordinal() .domain(["f", "e", "d", "c", "b", "a", "a+"]) .rangeroundbands([0, width]); // generate histogram using twenty uniformly-spaced bins. var myhistogram = d3.layout.histogram() (studentsymbols); console.log(myhistogram) </script> </body> when above run, console outputs array of 5 arrays, dx , x fields equal nan. how should correct code? i think

clojure - How can I get the var of a multimethod? -

i'm trying use dire add hooks multimethods. author says might not work. here example normal function: (ns mydire.prehook (:require [dire.core :refer [with-pre-hook!]])) (defn times [a b] (* b)) (with-pre-hook! #'times "an optional docstring." (fn [a b] (println "logging interesting."))) (times 21 2) ; => "logging interesting." as can see, with-pre-hook! passed (var times) (which same #'times ). the problem when calling var multimethod i'm getting exception: clojure.lang.persistentlist cannot cast clojure.lang.symbol is there way make work? below code sample: (defmulti get-url identity) (defmethod get-url :stackoverflow [site] "http://stackoverflow.com") (with-pre-hook! (var (get-method get-url :stackoverflow)) (fn [x] (println "getting url stackoverflow."))) var macro, not evaluate argument. if give list, not evaluate list, reject it, because it's list , not symbol.

python - Scrape alexa and show results in table in django -

i want create simple (one page) web application using django, , see top 20 websites alexa.com/topsites/global. page should render table 21 rows (1 header , 20 websites) , 3 columns (rank, website , description). my knowledge using django limitted , need if possible. i've used template create table using bootstrap don't have idea on how parse: rank / website name / , description. could lead me in right direction usefull websites / code snippets ? i know have use htmlparser , implement like: from htmlparser import htmlparser # create subclass , override handler methods class myhtmlparser(htmlparser): def handle_starttag(self, tag, attrs): print "encountered start tag:", tag def handle_endtag(self, tag): print "encountered end tag :", tag def handle_data(self, data): print "encountered data :", data # instantiate parser , fed html parser = myhtmlparser() parser.feed('<html><head><

angularjs - locaforage getItem() is not executing -

$localforage.getitem('brandchainnames', function(err, data) { // same code, using es6 promises. console.log('_storedvalue: '+ data); }); there no key far (verified in tools-> storage perspective). console output not print (in firefox). tell me problem. console output before , after it, prints fine. edit: modified code like: var hallabolo = $localforage.getitem('brandchainnames', function(err, data) { // same code, using es6 promises. console.log('_storedvalue: '+ data); }); angular.tojson(hallabolo) prints {} tried with: 1. json.stringify(hallabolo)=='{}' // returns false 2. object.keys(hallabolo).length // returns 1 3. jquery.isemptyobject(hallabolo) // returns false 4. angular.isobject(hallabolo) // returns true not mention type of 'undefined' , null etc not work hallabolo object $localforage.getitem('brandchainnames', function(err, data) { // same code, using es6 promises.

vim - set complete+=k[file] not working for whole line completion? -

i have ~/.bash_history contains lines such sudo apt-get install , aplay foo.wav , etc. thought convenient if use these lines completing whole lines while writing shell scripts. :h compl-whole-line says: ctrl-x ctrl-l search backwards line starts same characters in current line before cursor. indent ignored. matching line inserted in front of cursor. ** 'complete' option used decide buffers searched match. both loaded , unloaded buffers used.** note asterisks inserted. :h 'complete' says: k k{dict} scan file {dict}. several "k" flags can given, patterns valid too. example: > :set cpt=k/usr/dict/*,k~/spanish so thought :set complete+=k~/.bash_history job. didn't. start vim with $ vim -u none -n then :set complete+=k~/.bash_history :set complete? " complete=.,w,b,u,t,i,k~/.bash_history , enter insert mode ( i ), , when

php - Comparing a value inside database with input value -

Image
my if statement doesn't recognize textbox name ("ans") . should change? , should put it? want know if if statement correct; want compare value inside database input value ("ans") . in advance. <?php $con = mysql_connect("localhost", "root", "avtt123"); mysql_select_db("arvintarrega",$con); $sql = "select * identification"; $mydata = mysql_query($sql,$con); echo '<form method = "post">'; while($iden = mysql_fetch_array($mydata)) { echo '<center>' . $iden['question_number'] . '. ' . $iden['statement'] . ' <input type = "text" name = "ans"></input></center></br>'; if($iden['correct_answer'] == $_request['ans']) { echo "correct"; } else { echo "wrong"; } } echo '

objective c - iOS hidesBarsOnSwipe status bar background color -

Image
when swipe , hide navigation bar hidesbarsonswipe property status bar has clear background. how can set background of status bar same color navigation bar? here few pictures showing problem, contained in uitableviewcontroller . separate separate picture, looks 1 big one. i've come across same issue, , able solve it. i'm new ios dev, , don't imagine solution foolproof. couldn't find answers elsewhere, here's how overcame it: i converted uitableviewcontroller on uiviewcontroller nested uitableview. note, double check delegate child tableview set uiviewcontroller. i added view height of 20px , background colour want set "background" status bar. set constraints on view follows: on table view, set constrains full screen. 1 important note here, top constraint "top layout guide.top" , not "top layout guide.bottom". default believe constraint ties bottom. double clicking on constraint allows adjust top. without

javascript - How to avoid jquery ui tooltip to occur in child div? -

i tying include tooltip in parent div not in child div. here jquery ui tooltip: $(function () { $("#parent_div").tooltip(); }); here html: <div id="parent_div" title="hello tooltip"> parent div contents <div id="child_div" onmouseover="show_list();" onmouseout="hide_list();" title=""> child div contents </div> parent div contents </div> title="" (giving blank title property) in child_div creating problem. after hover on child_div disables tooltip parent_div also. you can see , test problem here . please give me solution keeping in view onmouseover , onmouseout events should not disable because using them in child_div other purpose. thank in advance. you try disable tooltip when mouseover child, enable when mouseleave child. $("#child_div").mouseover(function(){ $("#parent_div").tooltip('disable')

How to calculate differences scores with R? -

so have 2 sets of data, each comparing specific category, so: category : solution 1 : solution 2 1: 5 : 6 2: 7 : 6 3: 4 : 4 4: 8 : 9 how calculate difference scores using r specifically? somehow need load data them calculate solution1 - solution2 believe. we 'read' dataset using read.table/read.csv appropriate delimiter. based on example showed, : . after 'data.frame' object created ('df1'), can use transform or within create 'diff' column (i.e. difference of "solution" columns df1 <- read.table('file.txt', sep=':', strip.white=true, header=true) transform(df1, diff= solution.1-solution.2) # category solution.1 solution.2 diff #1 1 5 6 -1 #2 2 7 6 1 #3 3 4 4 0 #4 4 8 9 -1 or df1$diff <- with(df1, solution.1-solution.2)

c - Condition variables and mutex_unlock -

code: void *inc_func(void *arg) { pthread_mutex_lock(&mutex); pthread_cond_signal(&count_threshold_cv); sleep(1); pthread_mutex_unlock(&mutex); } void *watch(void *arg) { pthread_mutex_lock(&mutex); pthread_cond_wait(&count_threshold_cv,&mutex); sleep(1); pthread_mutex_unlock(&mutex); } int main() { pthread_t id[2]; pthread_create(&id[0],null,watch,null); pthread_create(&id[1],null,inc_func,null); int i; for(i=0;i<2;i++) pthread_join(id[i],null); } now have 1 mutex_unlock function executed in each thread. , 1 locked mutex. why doesn't lead undefined behaviour . since both threads try unlock same mutex leads 1 trying unlock unlocked mutex. edit: pthread_cond_wait releases mutex second thread use. consider second thread executes pthread_cond_signal leads first thread reacquire mutex . have 2 threads having same mutex lock,because both didn't execute mutex_unlock beca

node.js - Using Node js in Multiplayer turn based game in ios -

hope u guys doing great. want make realtime turn based game in ios . know can achieved using game centre in ios , have play between browser , ios app. web team using node js making game on web browser , suggested me use node js in ios game well. have has idea how use node js kind of purpose. thanking all! :) you can have websocket server written in node js , connect ios app using websocket library (hope exists). sockets connected browser , app can realtime exchange information.

electron - How to unregister events in atom-shell? -

i making application using atom-shell needs load several html pages. each time load different page, need execute custom script. using mainwindow.webcontents.on('did-finish-load', ...) . since need have custom function each file, unregister did-finish-load event. example: mainwindow.webcontents.on('did-finish-load',function() { console.log('loaded page1'); mainwindow.webcontents.unregister('did-finish-load') // <= exist? }); mainwindow.loadurl('file://.../page1.html'); browserwindow extends eventemitter , remove listener same way typically in node.js: var handler = function () { // ... }; mainwindow.webcontents.on('did-finish-load', handler); // later: mainwindow.webcontents.removelistener('did-finish-load', handler);

android - when button is clicked map doesn't work getting (NullPointerException) -

i have created button in class lead map in class when clicked button crashes , error(nullpointerexception), want display map when button clicked , code package com.example.gmapsapp; import java.util.stack; import android.os.bundle; import android.support.v4.app.fragmentactivity; import android.util.log; import android.widget.toast; import com.google.android.gms.maps.cameraupdatefactory; import com.google.android.gms.maps.googlemap; import com.google.android.gms.maps.mapfragment; import com.google.android.gms.maps.supportmapfragment; import com.google.android.gms.maps.model.latlng; import com.google.android.gms.maps.model.markeroptions; import com.google.android.gms.maps.model.polylineoptions; public class airports extends fragmentactivity { googlemap googlemap; @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.airports); createmapview(); tspnearestneighbour ts

Displaying variable on a label Tkinter python 2.7 -

i read similiar questions here couldn't fix code, ask. i'm working on little program gui, press button, adds 1 variable, press second button, subtract, press third button, prints current value of variable. want print variable on gui, on label, i've read how , thought got it, when went run code label not working. runs though, no error message. from tkinter import * class experiment: def __init__(self, master): global students frame = frame(master) frame.pack() self.addbutton = button(frame, text="add student", command=self.addstudent, bg="black", fg="white") self.addbutton.grid(row=0, column=1, sticky = e) self.subbutton = button(frame,text="subtract student", command=self.subtractstudent, bg="black", fg="white") self.subbutton.grid(row=0, column=2, sticky = e) self.checkbutton = button(frame,text="check record", command=self

javascript - Show input field only if a specific option is selected -

i'm trying make form checks if option selected "select" tag. here current html: <select onchange="yesnocheck()"> <option id="nocheck" value="">valitse automerkkisi</option> <option id="nocheck" value="lada">lada</option> <option id="nocheck" value="mosse">mosse</option> <option id="nocheck" value="volga">volga</option> <option id="nocheck" value="vartburg">vartburg</option> <option id="yescheck" value="other">muu</option> </select> this div element should become visible after "muu" selected: <div id="ifyes" style="display: none;"> <label for="car">muu, mikä?</label> <input type="text" id="car" name="car" /><br /> </div>

javascript - Get attr from each parent and set for each child -

i have datepicker jquery-ui , need set id each day (a class .ui-state-default) in format: year-month-day. this solution, want make working every day. this: id="2015-2-1234567891011121314151617181920212223242526272829303112345678910111213141516171819202122232425262728293012345678910111213141516171819202122232425262728293031" var year = $(".ui-state-default").parent('td').data('year'); var month = $(".ui-state-default").parent('td').data('month'); var day = $(".ui-state-default").parent('td').children().text(); $(".ui-state-default").attr("id", "" + year + '-' + month + '-' + day + ""); and sample part of datepicker code. <tr> <td class=" " data-handler="selectday" data-event="click" data-month="2" data-year="2015"> <a cl

osx - mpd not using lame or vorbis encoders -

i trying run httpd stream via mpd. config have straight forward: # -------- audio stream --------------------- audio_output { type "httpd" name "my http stream" encoder "lame" # optional, vorbis or lame port "8000" # quality "5.0" # not define if bitrate defined bitrate "128" # not define if quality defined # format "44100:16:1" # max_clients "0" # optional 0=no limit } however when run mpd following error: mar 28 15:40 : fatal_error: line 337: no such encoder: lame the same occurs when try using vorbis. checked version of mpd , output: $ mpd --version music player daemon 0.19.8 ... encoder plugins: null wave ... so stands doesn't seem have lame/vorbis encoder plugin installed. i'm using os x i've installed mpd through homebrew. ideas how fix this?

math - How to approximate a number to a n number of decimal places? -

i have started using maxima few weeks ago (actually have used few times) wxmaxima interface os x. i have tried find solution around web, maybe because blind or maybe because not have experience in searching in official documentation of maxima, have not find concrete solution yet. how approximate number n number of decimal places? example, if use float(22/7) , gives me huge number 3.142857142857143 , want example approximate 3rd decimal place 3.143 . fpprec controls actual number of significant digits in maxima bigfloat. applies bigfloats , not ordinary (fixed precision, ieee 754) floats. see fpprintprec controls how many digits printed, applies bigfloats , ordinary floats alike. solution is: (%i1) fpprintprec : 4 $ (%i2) float (22/7); (%o2) 3.143

sockets - is there a working vmci example? -

i need working vmci socket example udp does, without networking. there many code fragments in vmci_sockets.h code, not full working template expand on. i believe server should follows: #include "vmci_sockets.h" #define bufsize 2048 int main() { int afvmci = vmcisock_getafvalue(); if ((sockfd_dgram = socket(afvmci, sock_dgram, 0)) == -1) { perror("socket"); goto exit; } struct sockaddr_vm my_addr = {0}; my_addr.svm_family = afvmci; my_addr.svm_cid = vmaddr_cid_any; my_addr.svm_port = vmaddr_port_any; if (bind(sockfd, (struct sockaddr *) &my_addr, sizeof my_addr) == -1) { perror("bind"); goto close; } if (getsockname(sockfd, (struct sockaddr *) &my_addr, &svm_size) == -1) { perror("getsockname"); goto close; } if ((numbytes = recvfrom(sockfd, buf, sizeof buf, 0, (struct sockaddr *) &their_addr, &svm_size)) == -1) { perror("recvfrom"); g

math - How to find the square root using the Newton-Raphson Method in fortran 90 -

i need write program find square root using newton-raphson method using guess estimate. equation newton-raphson method is: xn+1 = xn-xn**2 − a/2*xn whereby n number of iterations. the assignment tells me loop should performed between 1 , total number of specified iterations. , each step of loop, current value of ‘solution’ should used calculate next value of solution, in form specified equation. hint: remember, assignment of value variable evaluates right side of equals before performing assignment itself. means 1 variable x needed calculate each new value; don’t need ‘old_x’ , ‘new_x’ or similar. this have far: program assign_10_2 implicit none real :: a, b, x integer :: c, i, j write(*,*) 'please enter value determine square root of' read(*,*) write(*,*) 'please enter value use initial guess solution' read(*,*) b write(*,*) 'please enter value how many iterations should perform calculate value' read(*,*) c write(*,*) a, b , c i= 1, c, 1

vb.net - ASP Writing Values from Textbox to Textfile -

i have textarea (id= output2 ) has list of numbers in it. have asp code writes data text file , works if specify text. code write text file: <% function writetofile(filename, contents, append) on error resume next if append = true imode = 8 else imode = 2 end if set ofs = server.createobject("scripting.filesystemobject") set otextfile = ofs.opentextfile(filename, imode, true) otextfile.write contents otextfile.close set otextfile = nothing set ofs = nothing end function %> then code overwrites file , inserts data , works: <% writetofile "c:\install\test1.txt", "why difficult??", false %> but yet if leave first code alone , try dynamic data such textarea field fails no error. doesn't touch text file. tried many many ways... here 5 failed: 1: <% writetofile "c:\install\test1.txt", document.getelementbyid("output2"), false %> 2: <% dim texttoinsert texttoinsert = document.getelementb

html5 - How to avoid continuous scroll on native datapicker in free jqgrid -

clicking in spinner in chrome datapicker causes continuous scroll in chrome. to reproduce, open latest demo http://www.ok-soft-gmbh.com/jqgrid/ok/dateinput_48_bootstrap.htm from answer how use native date picker in both form , row editing in free jqgrid in chrome , click in date edit. click in or down spinner , keep cursor in spinner. date scrolls indefinitely. how fix single click increments or decrement value +1 or -1 ? i think 1 have use use ::-webkit-inner-spin-button allows customize input spinners in css3 (see here ). problem it's difficult find documentation of css properties can used in case. well-known setting is input[type=date]::-webkit-inner-spin-button { display: none; } which remove spinner. no spinner - no problem. it's exist better way customize spinner, didn't found it.

c# - opencv_traincascade error message -

i tried create own haar cascade detect licence plate recognition used 99 positives images 140*45 , 2645 negatives images , launch training with: c:\emgu\emgucv-windows-x86_2.4.0.1717\bin\x86\opencv_traincascade.exe -data classifier -vec samples1.vec -bg negative.txt -numstages 3 -minhitrate 0.999 -maxfalsealarmrate 0.5 -numpos 50 -numneg 100 -w 60 -h 40 -precalcvalbuffsize 256 -precalcdxbufsize 256 and got error ** opencv error : assertion failed <_img.rows * _img.cols ==vecsize> in unknown function file e:\work\emgucv_32bit_vc\opencv\apps\traincascade\imagestorage.cpp, line 151 ** please help `

c# - POST to REST API from winform returns empty -

i have project uses hockeystreams.com api . having trouble using api login winform. gives me blank response, whether give bad username/password combination or correct one. code follows: public static bool login(string username, string password) { string url = string.format("{0}&username={1}&password={2}", global.login_api, username, password); httpwebrequest webrequest = (httpwebrequest)httpwebrequest.create(url); webrequest.contenttype = "application/json; charset=utf-8"; webrequest.accept = "application/json, text/javascript, */*"; webrequest.method = "post"; try { webresponse response = webrequest.getresponse(); stream stream = response.getresponsestream(); string json = ""; using (streamreader reader = new streamreader(stream)) { while (!reader.endofstream) {

android - google maps and amazon appstore -

i created android app displays coordinates on google maps after got map key google developer console , app worked fine. so, uploaded app amazon appstore make available others use it. therefore, when downloaded mobile mazon appsore reported map shows empty screen tried store , showed no map on screen when install workspace works well!!! any ideas!? amazon devices not support google maps api, should use amazon maps redirection checking checkbox @ binary file(s) page ( http://prntscr.com/6ml76e )