Posts

Showing posts from August, 2011

Configuration private network with Vagrant -

i'm configuring 3 virtual machines on desktop vagrant. , wanna build cluster these 3 vms. , wanna configure ip of these 3 machines in private network , access each vm in desktop only . reason of configuration i'll use these 3 vms development only. so answer questions how shall configure ip of vm vagrant purpose? cannot understand how configure ip address of private network. create vagrant file name vagrantfile , add: # -*k mode: ruby -*- # vi: set ft=ruby : vagrant.configure("2") |config| config.vm.provider :libvirt |libvirt| libvirt.driver = "kvm" libvirt.host = 'localhost' libvirt.uri = 'qemu:///system' end # config.vm.define "test1" |vm1| vm1.vm.box = "ubuntu/trusty64" vm1.vm.hostname="vm1.example.com" vm1.vm.provider :libvirt |domain| domain.memory = 1024 domain.cpus = 1 end

java - Monitor variables of a running program? -

i'm working on small multiplayer game has tick method kind of logic things moving, creating , checking game elements. the tick method called every 100 milliseconds. things go wrong due bug. these bugs hard track down because things being called many times second. when add debug log entry @ points log gets overcrowded , not easy understand. is there way monitor variables while game keeps running? i tried jmx time setup jmx monitor variable quite long due complex nature of jmx. in addition when tracking don't know variable monitor, means need switch variable variable quickly. this big problem game design draws called 30/60 times second. i found outputting values on screen helped lot doesn't save previous values can see when things change. you can add breakpoints when value changes range shouldn't be, allowing inspect code further such as 1 if(val>1000){ 2 debugger; 3 }

bash - Edit all the similar files in subdirectories in linux in one shot -

Image
i have directory structure shown in image below. can there script written in linux traverses under sub directories , adds line of text in beginning of file having extension .txt there multiple folders have file having extension .txt find root -type f -name '*.txt' -exec sed -i '1i\ line insert ' {} + the find command recurse root directory, looking filenames match *.txt . execute sed command, inserts line @ beginning of file.

python - ipywidgets: how to update plot with multiple series based on checkbox selection -

i using ipython notebook, pandas library, , bokeh plotting library , have function generates gridplot. trying set checkboxes, each checkbox corresponding 1 of plots , update gridplot plots have corresponding checkboxes selected. there not seem support ipywidgets libray. attempt far; not sure how pass checkboxes created function update gridplot though, appreciated. thanks. attributes = df.columns.tolist() ipywidgets import checkbox, interact ipython.display import display chk = [checkbox(description=attributes[i]) in range(len(attributes))] #this displays checkboxes created correctly display(*chk) #update plot takes in names of columns displayed , returns #a gridplot containing corresponding plots #not sure part below though interact(updateplot,args=chk) this displays checkboxes , calls updateplot function they're changed: from ipywidgets import checkbox, interactive ipython.display import display l = ["dog", "cat", "mouse"] chk = [

javascript - How to get corresponding colors from d3 sunburst parent to final child? -

i need create sunburst chart 4 separate targets. each target has assigned color , of target's children should inherit color. have set children take parent's color , works fine. issue children of child not inherit color of initial parent. sunburst screenshot this code using create visualization: var colors = d3.scale.ordinal() .range(["#62addb", "#7568ba", "#ff8f2b", "#6bc96d"]); var json = getdata(); createvisualization(json); // main function draw , set visualization, once have data. function createvisualization(json) { // basic setup of page elements. initializebreadcrumbtrail(); d3.select("#togglelegend").on("click", togglelegend); // bounding circle underneath sunburst, make easier detect // when mouse leaves parent g. vis.append("svg:circle") .attr("r", radius) .style("opacity", 0); // efficiency, fil

hadoop - HIVE: Empty buckets getting created after partitioning in HDFS -

i trying create partition , buckets using hive. for setting of properties: set hive.enforce.bucketing = true; set hive.exec.dynamic.partition = true; set hive.exec.dynamic.partition.mode = nonstrict; below code creating table: create table transactions_production ( id string, dept string, category string, company string, brand string, date1 string, productsize int, productmeasure string, purchasequantity int, purchaseamount double) partitioned (chain string) clustered by(id) 5 buckets row format delimited fields terminated ',' stored textfile; below code inserting data table: insert overwrite table transactions_production partition (chain) select id, dept, category, company, brand, date1, productsize, productmeasure, purchasequantity, purchaseamount, chain transactions_staging; what went wrong: partitions , buckets getting created in hdfs data present in 1st bucket of partitions; remaining buckets empty. please let me know did wrong , how resolve issue.

php - Getting Bootstrap dropdown value to save to database and display in table -

i'm having trouble getting bootstrap ul li list store values database on click, , display them. have index page fields , dropdowns. user puts text fields , selects dropdown, when click button page refreshed , data displayed in table. i don't want use because want style dropdown consistently. when tested saved data, no luck unordered list. i've searched solution , read documentation can't find information might match setup , i'm not fluent in php. here snippets. if more needed i'll provide. reading. form: <form action="parts/insert.php" method="post" role="form"> <select name="prep" id="prep"> <option value="">preparation</option> <option value="0 - 10 mins" >0 - 10 minutes</option> <option value="11 - 30 mins">11 - 30 minutes</option> <option value="one hour +">one hour

How to manage session in Oracle JET application -

how can manage session in oracle jet application. i've been working on small pilot application need check if user logged in on every request. i didn't find resource on same framework published oracle. jet uses web sessions if configure web application. authentication managed web server. frank

python - Debugging Apache/Django/WSGI Bad Request (400) Error then aliasing sub-path -

i have django projet running on domain example.com juste fine. want alias 1 particular app example2.com but, when disable django debug, keep getting bad request (400) error. i use django 1.7.7 python 2.7.9 on debian jessie. example.com , example2.com both served apache 2.4.10 wsgi module 4.3.0. in apache global scope configuration have : wsgidaemonprocess tracking user=www-data group=www-data processes=2 threads=15 python-path=/path/to/projects/tracking/ display-name=wsgi-django-tracking in example.com vhost have: wsgiscriptalias / /path/to/projects/tracking/tracking/wsgi.py wsgiprocessgroup tracking <directory /path/to/projects/tracking/tracking/> <files wsgi.py> require granted </files> </directory> in example2.com vhost have (note /myapp on @ end of both paramater of wsgiscriptalias instruction): wsgiscriptalias /myapp /path/to/projects/tracking/tracking/wsgi.py/myapp wsgiprocessgroup tracking <directory /pat

c# - DataContractJsonSerializer human-readable json -

this question has answer here: how formatted json in .net using c#? 6 answers basically dupe of this question 1 notable difference - have use datacontractjsonserializer . a simple using (var stream = new memorystream()) { var serializer = new datacontractjsonserializer(typeof(person)); serializer.writeobject(stream, obj); ... return stream.toarray(); } produced single line json, e.g. (when saved in file) ...{"blah":"v", "blah2":"v2"}... what options make it ... { "blah":"v", "blah2":"v2" } ... i can think of post-processing... there easier option? e.g. similar formatting xml produced datacontractserializer ? using (var stream = new memorystream()) { var serializer = new datacontractjsonserializer(typeof(t)); // "beautify" us

ios - How to println by swift in terminal? -

i'm trying run ./swift -emit-executable shape.swift terminal shape.swift class shape { let name:string = "" init(name:string) { self.name = name } let anyshape = shape.init(name:"jaum") println("name, \(anyshape.name).") } i'm getting error: shape.swift:11:5: error: expected declaration println("name, \(anyshape.name).") ^ what doing wrong? you can't have declarations @ root level of class, move them outside. don't use .init create class instance. use print instead of println (it has changed in swift 2 ). and don't give value of "" immutable name if want use initializer, declare type. class shape { let name:string init(name:string) { self.name = name } } let anyshape = shape(name:"jaum") print("name, \(anyshape.name).") last note, it's not swift swiftc able create executable: swiftc -e

java - How to add compile time dependency in eclipse -

in developer.android.com site saw below information under android 6.0 changes. apache http client removal android 6.0 release removes support apache http client. if app using client , targets android 2.3 (api level 9) or higher, use httpurlconnection class instead. api more efficient because reduces network use through transparent compression , response caching, , minimizes power consumption. continue using apache http apis, must first declare following compile-time dependency in build.gradle file: android { uselibrary 'org.apache.http.legacy } problem: i using eclipse , have used http client. use new httpurlconnection how can add dependency in eclipse ide? or have use android studio use new feature? thanks looking , giving solution problem. @senthilkumar s should use android studio . uselibrary adds library classpath while compiling not bundle library application. courtesy @laalto sir . please upgrade gradle tools version in build.gradle f

javascript - How to change the legend data highcharts -

Image
is there way have alternate data in legend of pie chart using highcharts? instead of point data, want displays small snippet of info pertaining graph. i added labelformatter changes values each data point. need appear once. legend: { layout: 'vertical', floating: true, verticlalalign: 'bottom', align: 'left', usehtml: true, enabled: true, bordercolor: '#909090', title: { text:'output (mw)', style: { fontweight: 'bold', fontsize: '12px', textalign: 'center' }, } } i suggest iterate on legend items. can done using label formatter function of legends below : labelformatter: function () { if (this._i%2 === 0) {return null; } else {return this.name; }

ios - Swift Optional Type not Unwrapped -

i've been having problem due new updated version of swift. problem line of code keeps producing error saying that: "value of optional type '()?' not unwrapped; did mean use '!' or '?'? cell?.hypeimageview?.image = uiimage(data: imagedata) this entire function: override func tableview(tableview: uitableview, cellforrowatindexpath indexpath: nsindexpath, object: pfobject?) -> pftableviewcell? { var cell:hypetableviewcell? = tableview.dequeuereusablecellwithidentifier(cellidentifier) as? hypetableviewcell if(cell == nil) { cell = nsbundle.mainbundle().loadnibnamed("hypetableviewcell", owner: self, options: nil)[0] as? hypetableviewcell } if let pfobject = object { cell?.hypenamelabel?.text = pfobject["name"] as? string var votes:int? = pfobject["votes"] as? int if votes == nil { votes = 0 } cell?.hypevoteslabel?.text = "\

c# - How to check an item already exist in mongo db and linq -

var database = connection.testdb; bool isexists = false; var collection = database.getcollection<technolgy>("technology"); var query1 = collection.findall().setfields(fields<technolgy>.include( x => x.name)); var companycount = (from c in query1 select c).tolist(); foreach (var item in companycount) { isuserexists = (from t in companycount t.name.equals(name) select t).singleordefault() == null ? false : true; if (isexists == true) { return isexists; } } return isexists; i know question asked can't find proper answer.my problem case sensitive search. ex. in database there field called technology in ,say audio , video saved.if query term audio , video query return true(isexists).but if query term audio , video returns false.how make quer

how to grab the not equal row from joined table in mysql? -

Image
i have 2 tables following user_job_applied company_viewed_user i want take rows not in company_viewed_user table relevant job_id in user_job_applied table. wrote following query it's not grabbed select `user_job_applied`.user_id `user_job_applied` left join `company_viewed_user` on `company_viewed_user`.user_id on `company_viewed_user`.user_id = `user_job_applied`.user_id `company_viewed_user`.user_id null , `company_viewed_user`.emp_id in (select user_id company_user company_id='1') , `user_job_applied`.job_id = '1'; the output should following want move emp_id condition left join statement in clause select `user_job_applied`.user_id `user_job_applied` left join `company_viewed_user` on `company_viewed_user`.user_id = `user_job_applied`.user_id ,

php - Ajax dynamic datatable -

i trying populate table mysql data base on user id. when use few user id option, works. if use , enter user id, displays table data few second , close out. <html> <script src="http://code.jquery.com/jquery-1.10.2.js" type="text/javascript"></script> <head> <script> function showuser(str) { if (str == "") { document.getelementbyid("txthint").innerhtml = ""; return; } else { if (window.xmlhttprequest) { // code ie7+, firefox, chrome, opera, safari xmlhttp = new xmlhttprequest(); } else { // code ie6, ie5 xmlhttp = new activexobject("microsoft.xmlhttp"); } xmlhttp.onreadystatechange = function() { if (xmlhttp.readystate == 4 && xmlhttp.status == 200) { document.getelementbyid("txthint").innerhtml = xmlhttp.responsetext; } } xmlhttp.open("get","../action/subs/getcalls

active directory - PHP ldap_connect to multiple hosts in case of one beeing not reachable -

a co-worker suggested use multiple hosts website authentication based on ldap in case 1 host down. know can $ldap_servers = "10.101.01.1 10.100.10.2"; $ldap = ldap_connect($ldap_servers); but i'm using config file: return [ 'domain_controller' => ['10.101.01.1', '10.100.10.2'], 'base_dn' => 'ou=foo,dc=example,dc=local', 'ssl' => false, ... ]; whereas connection done via $protocol = $this->ssl ? $this::protocol_ssl : $this::protocol; $port = $this->ssl ? $this::port_ssl : $this::port; return $this->connection = ldap_connect($protocol . $hostname, $port); as co-worker suggested might possible our ldap hosts run via ssl in future, how can make multiple hosts work this? above it's working hostname only, that's because it's non-ssl based. given ssl need ldaps:// protocol , portnumber, right? therefore not work hostname , i'm not sure

javascript - Disable caching for ExtJs app -

we have extjs 5.01 app built sencha cmd 5.0.1.231. the issue facing browsers seem cache old version of our application. on looking @ network traffic on chrome when our application served, can see app.js, app.css files have ?_dc={timestamp} appended them. now, tells me every time new version of app released (which updates timestamp), browsers should new version. seems still old version served. is there else need bust cache? thanks i don't why "sometimes" browser caching files, when caching disabled default. force framework use cache whenever possible, putting peace of code in app.js : ext.loader.setconfig({ enabled: true, disablecaching: false }); while developing open devtools , set disable cache (while devtools open) . not allow chrome cache files. but in app.json forcing "caching" local storage setting "update" or "appcache" . check localstorage , app.json verify.

axapta - Connector for Microsoft Dynamics: Location of Object Configuration Files -

i following connector microsoft dynamics installation guide setup connection between dynamics crm , ax. asked open object configuration file . where these object configuration files located? there 1 generated .config file per entity in crm have selected integration. these object configuration files can found in: %programfiles(x86)%\microsoft dynamics\microsoft dynamics adapter\adapters\microsoft.dynamics.integration.adapters.crm2011\objectconfig\ your organization name

javascript - HTML Input element (field.validate) is always undefined -

i'm having 2 text boxes defined onblur event. on pressing tab, whenever onblur event called field.validate undefined . at same time, when i'm trying print field.name or field.getattribute("validate") return proper value. <input width="100%" type="text" name="nv_active" id="nv_active" value="5" onblur="return dovalidate(this);" validate=" return validatevaluefield(document.getelementbyid('nv_active'), 'active' );"> <input width="100%" type="text" name="nv_throttled" id="nv_throttled" value="15" onblur="return dovalidate(this);" validate=" return validatevaluefield(document.getelementbyid('nv_throttled'), 'throttled' );"> function dovalidate(field) { console.log("field.validate- " + field.validate); //always printing undefined console.log("getattr- &

linux - How to pipe output from grep to cp? -

i have working grep command selects files meeting condition. how can take selected files grep command , pipe cp command? the following attempts have failed on cp end: grep -r "twl" --exclude=*.csv* | cp ~/data/lidar/tmp-ajp2/ cp: missing destination file operand after ‘/home/ubuntu/data/lidar/tmp-ajp2/’ try 'cp --help' more information. cp `grep -r "twl" --exclude=*.csv*` ~/data/lidar/tmp-ajp2/ cp: invalid option -- '7' grep -l -r "twl" --exclude=*.csv* | xargs cp -t ~/data/lidar/tmp-ajp2/ explanation: grep -l option output file names only xargs convert file list standard input command line arguments cp -t option specify target directory (and avoid using placeholders)

c# - How to add logger in the Azure Worker role? -

the below code used bulk insert data azure database. not work when hosted in azure instance. try { sqlcommand truncate = new sqlcommand("truncate table dbo.dispatch", connection); truncate.transaction = transaction; truncate.executenonquery(); using (var bulkcopy = new sqlbulkcopy(connection, sqlbulkcopyoptions.default, transaction)) { bulkcopy.batchsize = 100; bulkcopy.destinationtablename = "dbo.dispatch"; bulkcopy.writetoserver(dispatch.asdatatable()); } sqlcommand updatehaulercode = new sqlcommand("exec [sp_updatedispatchhaulercodes]", connection); updatehaulercode.transaction = transaction; updatehaulercode.executenonquery(); transaction.commit(); } catch (exception) { transaction.rollback(); } i want add logging in catch statement.

Java Regex To Match List Of KeyWords- Non Greedy -

i have working java regex except, given logic, greedy. the intention match 4 words including keyword , not spaces or words or characters before or after. sample text: chief complaint · "lorem ipsum dolor sit amet.." · "lorem ipsum dolor sit amet.." history of present illness lorem ipsum dummy text of printing , typesetting review of systems donec luctus metus: lorem ipsum dummy text of printing , typesetting industry. donec luctus metus: lorem ipsum dummy text of printing , typesetting industry. past medical history · contrary popular belief, lorem ipsum not random text · contrary popular belief, lorem ipsum not random text social history · "lorem ipsum dolor sit amet.." · "lorem ipsum dolor sit amet.." surgical history · "lorem ipsum dolor sit amet.." family history · "lorem ipsum dolor sit amet.." current meds Â

c - Cannot figure issue of "Undefined symbols for architecture x86_64" on Xcode -

i trying compile following code on xcode (it has been working fine on linux , trying generate mac os executables no success): #ifndef _win32_winnt #define _win32_winnt 0x0501 #endif #include <stdio.h> #ifdef win32 #include <tchar.h> #endif #include <math.h> #include <malloc/malloc.h> #include "imgdec.h" #include "imgmacro.h" #include "tiffutils.h" #ifndef win32 #include "internal.h" #endif #define m_pi 3.14159265358979323846 #define pi m_pi int image_border = 10; int usage(prog) char *prog; { static char *helpmsg[] = { "function: canny edge detection (undebugged)\n", "options:\n", " -s (float): standard deviation gaussian kernel [default: 1.0] \ -t threshold [0 255]\n", null }; char **p=helpmsg; fprintf(stderr,"usage: %s {options first} infile outfile\n",prog); while (*p) (void) fputs(*p++,stderr); re

c - read a file line by line into structure -

code :- #include <stdio.h> #include <string.h> int main () { file *fp; const char s[3] = " "; /* trying make 2 spaces delimiter */ char *token; char line[256]; fp = fopen ("input.txt","r"); fgets(line, sizeof(line), fp); token = strtok(line, s); /* walk through other tokens */ while( token != null ) { printf( " %s\n", token ); token = strtok(null, s); } return 0; } input.txt below : 01 sun oct 25 16:03:04 2015 john nice meeting you! 02 sun oct 26 12:05:00 2015 sam how you? 03 sun oct 26 11:08:04 2015 pam ? 04 sun oct 27 13:03:04 2015 mike morning. 05 sun oct 29 15:03:07 2015 harry come here. i want read file line line , store in variables like int no = 01 char message_date[40] = sun oct 27 13:03:04 2015 char friend[20] = mike char message[120] = morning. how achieve ? possible store file line line structure struct { int no.; char date[40]; char frined[

css - Target iPhones, ipads and Android devices separately -

is there way target iphones, ipads , android devices separately using css media queries? you can query screen sizes, not separate oss this: @media screen , (max-width: 1200px) {...} // e.g. tablets @media screen , (max-width: 950px) {...} // e.g. phablets @media screen , (max-width: 750px) {...} // e.g. phones if need detection of browsers or operating systems, consider using javascript library platform.js

cakephp - Form data is hashed in CakeRequest after upgrade to cakephp2.x -

i performed upgrade cakephp 1.3 2.06. when attempt access form data in controller, data hashed so: 2015-10-15 08:43:57 error: cakerequest object ( [params] => array ( [plugin] => [controller] => custom_users [action] => ajax_login [named] => array ( ) [pass] => array ( ) [isajax] => 1 ) [data] => e1fe8b4c1724c30148e306708f27b30909f23d45 i checked form correctly formed on front end. documentation indicates should able access data way, reason behaviour happening in stead. ideas? i've added trace when try , submit form: notice: array string conversion in /var/www/html/academy/lib/cake/utility/security.php on line 92 notice: undefined offset: 1 in /var/www/html/academy/lib/cake/network/cakeresponse.php on line 456 warning: illegal string offset 'customuser' in /var/www/html/academy/app/controller/customuserscontroller.php on line 569

java - Return two string in toString function -

@entity public class person { private integer id = null; private string name = null; private string price = null; private date created = null; // string representation: @override public string tostring() { return name; // want return name , price } i want return name , price in tostring function ? right return more 1 string in tostring function. if make relation in other's entity manytomany ? please suggest me if doing right or wrong want show these fields in other entity make relations. thanks! usually tostring() method returns string-representation of object , not object's members themself. if need representation of name , price do return "name: " + name + ", price: " + price; if want receive members name , price should generate getters , use them in caller. another possibility "wrap" 2 strings in sort of data class.

javascript - formData object sent with jQuery ajax to server returns empty array on success -

the title says all. i collecting data , appending formdata object in order post php file , handle rest there. my ajax function: save.addeventlistener("click", function(e){ e.preventdefault(); getallcontents(); console.log(updateobj); updateobj = json.stringify(updateobj); console.log(updateobj); $.ajax({ url: "test.php", type: "post", data: updateobj, success: function(response){ console.log("success: ", response); }, error: function(response){ console.log("error: ", response); } }); }); the updateobj contains appended formdata object. console log of variable returns everything. problem must right in ajax post. update content of console.log(updateobj) : [{"row_id":1,"status":"anmeldung","ma_name":"aa","datum":"/","fa1":"testname

Python Multiprocessing - Explanation for increase in time as the number of tasks increases -

i have simple function task. pass multiple arguments it. def call_process(processes): pool = pool() results_1=pool.map(change_route_thread,processes) pool.close() pool.join() if there 20,40,60 tasks in processes array , takes 0.1 seconds per task on average. but if there 80 or 100 tasks in process array, takes 0.2 seconds per task on average. why happen? want bring down time 80 or 100 tasks 0.1 seconds well. i tried this:- def call_process(processes): pool = pool() results_1=pool.map(change_route_thread,processes[0:60]) pool.close() pool.join() pool = pool() results_1=pool.map(change_route_thread,processes[60:]) pool.close() pool.join() it gave me similar results. limitation on os? exact statistics:- tasks avg. time per task 10 0.107878417969 20 0.107998579025 40 0.11048762989 60 0.154217456818 80 0.234604523659 100 0.237693323135

Python: Monte Carlo Rabin-Karp search -

i trying implement monte carlo rabin-karp search in python. have far (random_prime function returns prime number less limit arguement given): def search(pattern, text): m = len(pattern) n = len(text) q = random_prime(m*n*n) r = (2^(m - 1)) % q f = [] x in range (0, n + 1): f.append(0) pfinger = 0 j in range(0, m): f[0] = (2 * f[0]) + (int(text[j]) % q) pfinger = (2 * pfinger) + (int(pattern[j]) % q) = 0 while (i + m) < n: if (f[i] == pfinger): print "match @ position " + str(i) f[i + 1] = (2 * (f[i] - (r * int(text[i])))) + (int(text[i + m]) % q) += 1 the problem is, seems match first character or characters. e.g. if call search('01', '101110001010101'), no match. or if call search('1', '111110110100101') match. or if call search('0', '0000001110001010101') matches position 5. is there wrong code causing match incorrectly? i'm no genius think found root of issue.

Angularjs - get data from oracle database -

i'm new angularjs. wondering how can oracle database data using angularjs. appreciated. thanks, sukesh angularjs client side framework based on javascript. there nothing retrieving data oracle. server side's duty. you should implement on server side technologies such .net or php, , give services client side through web api, rest api etc.

Joomla PHP command line script fails -

i have command line test script runs locally ok, when try run on host (bluehost) through ssl (using putty) fails, doesn't throw error. i've checked error logs , there nothing there indicate failure , have turned on e_all errors there. on local wamp server runs fine , outputs prompts: 1. environment imported 2. execute! 3. got instance 4. success 5. finished executing! when run on putty @ host outputs first 2 lines. 1. environment imported 2. execute! this script (joomla 3.4.5): <?php // initialize joomla framework const _jexec = 1; error_reporting(e_all); // load system defines if (file_exists(dirname(__dir__) . '/defines.php')) { require_once dirname(__dir__) . '/defines.php'; } if (!defined('_jdefines')) { define('jpath_base', dirname(__dir__)); require_once jpath_base . '/includes/defines.php'; } // framework. require_once jpath_libraries . '/import.legacy.php'; // bootstrap cms libraries. requir

html - What's wrong with my javascript mousewheel animation code? -

i tried make website this: http://www.nominet.uk/ i found code in jsfiddle seems perfect me: http://jsfiddle.net/mark_s/6ssra/1/ but if make code own , create html file this: <!doctype html> <html> <head> <meta charset="utf-8"> <meta http-equiv="x-ua-compatible" content="ie=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <style> * {margin:0; padding:0;} body { overflow:hidden;} </style> <script src="http://code.jquery.com/jquery-1.7.1.min.js"></script> <script type="text/javascript"> var winh = $(window).height(), $root = $('body, html'); $('#slider > div').height(winh) $(document).ready(function(){ $(window).on('mousewheel dommousescroll',

media player - How get list of all songs played in android phone -

i want list of songs played in android phone how can it? other media player store played data in android phone ? media data base. read topic: http://developer.android.com/reference/android/provider/mediastore.html

go install third part package, unrecognized import path -

detail: c:\>go -u github.com/hidu/proxy-manager package code.google.com/p/go.net/proxy: http://www.google.com/hangouts/: stopped after 10 redirects package golang.org/x/crypto/blowfish: unrecognized import path "golang.org/x/crypto/blowfish" package golang.org/x/crypto/cast5: unrecognized import path "golang.org/x/crypto/cast5" package golang.org/x/crypto/salsa20/salsa: unrecognized import path "golang.org/x/crypto/salsa20/salsa" i think maybe because google forbidden in china? how solve error? i opened issue here , solved of repo owner. the package try install using godep , go vendor . go vendor need go 1.5 +, , important thing : export go15vendorexperiment=1 this command make install successful.

python - How do I make my script interpret a user-provided string expression? -

i'm trying develop python script can pass xmldict argument command line , have return value. i know still need add argv code, right i'm trying python read print statement variable. no luck far. print statement prints vv string. i'm using 2.7.2 can use python 3 if it's easier. #!/usr/bin/python import xmltodict document_file = open("file.xml", "r") original_doc = document_file.read() document = xmltodict.parse(original_doc) day = document['weather']['dayf']['day'] vv='day[2][\'hi\']' print "{0} ".format(vv) print "{0} ".format(day[2]['hi'])

java - How does Calendar class calculate months? -

i got annoying problem calendar class. have 2 jtextfields enter period of date (txtstart & txtend). if start date begins @ first day of month (01.), set end date "last day of month". now user can change change period clicking plus or minus button, want increase or decrease month of start & end date. calendar tempstart = calendar.getinstance(); calendar tempend = calendar.getinstance(); if (txtstart.gettext().trim().startswith("01.")) { system.out.println("get dates typed user, , set \"last day of month\" txtend"); tempstart = convstringtodate(txtstart.gettext().trim(), false); system.out.println(tempstart.gettime() + " #+#+###++ "); tempend = getlastdayofmonth(txtstart.gettext().trim()); system.out.println(tempend.gettime() + " #+#+###++ "); system.out.println(" "); system.out.println("multi either +1 or -1, increasing or decreasing month !&qu

I want to get the data from the access database to a text file in c#, i have written the following code but i am not getting any output -

private void button3_click(object sender, eventargs e) { try { connection.open(); oledbcommand command = new oledbcommand(); command.connection = connection; command.commandtext = "select action rvrait"; oledbdatareader reader = command.executereader(); richtextbox1.text = (reader["action"].tostring()); connection.close(); } catch(system.data.oledb.oledbexception) { } your problem missing reader.read() call. after creating oledbdatareader cannot start taking content of column in interested. reader not positioned on first record returned query (if any). private void button3_click(object sender, eventargs e) { connection.open(); oledbcommand command = new oledbcommand(); command.connection = connection; command.commandtext = "select action rvrait"; oledbdatareader reader = command.executereader(); if(reader.read()) richtextbox1.text =

mysql - Issue passing form data to php variable. Variable seems empty -

i'm noob @ php/mysql. i've been looking around lot can't figure out what's going wrong. purpose of script: update value of item 1 , item 2 in database of user userid entered in txtuser. i script working when use "fixed" value near userid in query. however, when try use variable ($player), doesn't work. seems variable empty... html: <body> <form id="form1" action="http://www.something.com/testscript1.php" method="post" enctype="application/x-www-form-urlencoded"> <div> <button type="submit" id="submit" value="submit" title="save">save</button> </div> <div> <input id="txtuser" name="txtuser" type="text" /> <input id="txtitem1" name="txtitem1" type="text" /> <input id="txtitem2" name="txtitem2&qu