Posts

Showing posts from January, 2013

c# - Unable to cast object of type -

i want maximum number so did code public int autoincrement() { int no = 0; odbccon.opencon(); sqlcommand cmd = new sqlcommand("select max (customercode) tblm_customer",odbccon.maincon); sqldatareader dr = cmd.executereader(); if (dr.read()) { if (!dr.isdbnull(0)) { no = convert.toint32(dr); } } dr.close(); return no; } but no = convert.toint32(dr); says unable cast object of type 'system.data.sqlclient.sqldatareader' type 'system.iconvertible'. how can solve ? please tell me you need specify index 0 datareader : no = convert.toint32(dr[0]);

unix - Getting file through FTP using shell script -

i trying csv file remote server through ftp using unix script.i facing wired problem here.file not being fetched time. gets file sometime dose not. ftp -v -i -n <<eof > $log_path/ open $ftp_site user $ftp_user $ftp_pass ascii hash passive cd training_uploads mget *.csv pwd quit eof 'ftp' 80s! why don't move foodchain little? wget --user="${ftp_user}" --password="${ftp_pass}" "${ftp_site}/dir/files" wget supports ftp protocol , can continue interrupted downloads, can exclude files, can recursive retrieval , anything.

c# - Should the view model match closer to view or model? -

let's have view has view model data context. binded property called visible. what type should property ? boolean (more model friendly, forces use of converter) ? visibility (more view friendly) ? leave bool value in viewmodel , use booltovisibilityconverter in view. reason: viewmodel should view-agnostic, , ui-framework-agnostic. is, should able copy viewmodel console application , hit f5. make sure leverage markupextension simplify converter usage

concurrency - Wrong process getting killed on other node? -

i wrote simple program ("controller") run computation on separate node ("worker"). reason being if worker node runs out of memory, controller still works: -module(controller). -compile(export_all). p(msg,args) -> io:format("~p " ++ msg, [time() | args]). progress_monitor(p,n) -> timer:sleep(5*60*1000), p("killing worker using strategy #~p~n", [n]), exit(p, took_to_long). start() -> start(1). start(strat) -> p = spawn('worker@localhost', worker, start, [strat,self(),60000000000]), p("starting worker using strategy #~p~n", [strat]), spawn(controller,progress_monitor,[p,strat]), monitor(process, p), receive {'down', _, _, p, info} -> p("worker using strategy #~p died. reason: ~p~n", [strat, info]); x -> p("got result: ~p~n", [x]) end, case strat of 4 -> p("out of strategies. givi

python - Run multiple Flask apps on the same domain -

i want run several flask apps such that... mydomain.com running 1 app in 1 directory. mydomain.com/app1 running app in directory. mydomain.com/app2 running third app in third directory. i want avoid having have url structure app1.mydomain.com is possible under apache?

java - Creating formula for distance and damage -

public double getdamage(double distance){ int damage1 = 30; // (0 - 38.1) int damage2 = 20; // (50.8 - *) double range1 = 38.1; double range2 = 50.8; double damage = 0; // formula return damage; } i try create formula calculate amount of damage has been effected distance. (variable distance =) 0 till 38.1 metre return 30 damage. 50.8 till inifite return 20 damage. 38.1 till 50.8 decrease linear 30 -> 20. how can make method work? in advance. sounds this: double x = (distance - range1) / (range2 - range1); if (x < 0) x = 0; if (x > 1) x = 1; return damage1 + x * (damage2 - damage1); basically follow linear rule , adjust stay in linear interval.

c# - Type Data From InvalidCastException -

the question pretty simple: there way problematic system.type s invalidcastexception ? want able display information failed type casting in format such "expected {to-type}; found {from-type}", cannot find way access types involved. edit: reason need able access types involved because have information shorter names times. example, instead of type rfsmallint , want type smallint . instead of error message unable cast object of type 'refactor.rfsmallint' type 'refactor.rfbigint'. i want display expected bigint; recieved smallint. one solution implement cast function gives information if cast doesn't succeed: static void main(string[] args) { try { string = cast<string>(1); } catch (invalidcastexceptionex ex) { console.writeline("failed convert {0} {1}.", ex.fromtype, ex.totype); } } public class invalidcastexceptionex : invalidcastexception { public type fromtype { get; pri

asp.net - Pass front-end input value to code behind / google federated login -

i tried use google federated login function retrieve user info in order implement one-click registration functionality website. i have retrieved information on client side. used several hidden input fields store values parameters name,email, etc. however, when accessed these fields code behind, i got empty values . here steps took inspect problem: 1. have made sure each input field has [runat="server"] tag , have made sure values correctly returned google. 2. have made sure input fields inside form i wondering if because did not submit form once clicked google+ login button, button following: <div id="signin-button" class="slidingdiv"> <div class="g-signin" data-callback="loginfinishedcallback" data-approvalprompt="force" data-clientid="....." data-scope=" https://www.googleapis.com/auth/userinfo.email https://www.googleapis.com/auth/plus.me " data-height="short&

ASP.NET get cell from DataRow in a datatable? -

i wondering how access cells in datatable? thought like foreach (datarow siterow in sites.rows) { string sitename = siterow.cells[1].text; } but doesn't seem work gridview. should do? use indexer : foreach (datarow siterow in sites.rows) { string sitename = siterow[1].tostring(); // second column // or via name: sitename = siterow["sitename"].tostring; // if column name sitename // or better via field method typed // , supports nullable types: sitename = siterow.field<string>(1); // works via name }

gwt highcharts - Can you group multiple candlestick series next to each other in a highstock chart? -

is possible have multiple candlestick series on same axis , have them grouped next each other columns? right now,they render on top of each other if y values similar. have tried series options related this( point padding, grouping ) , not work. yes, can add option "datagrouping" series way: serie = { type: 'candlestick', name: 'test', data: seriesdata, datagrouping: { enabled: true } } for further information, check this: http://api.highcharts.com/highstock#plotoptions.series.datagrouping

css - Selecting items with children but not grandchildren using jQuery selectors -

i trying select list items have children, not list items grandchildren. consider following structure: <ul id="parent"> <li> <a href="#"></a> <ul> <!-- add open class --> <li><a href="#"></a></li> <li> <a href="#"></a> <ul> <!-- not add class --> <li><a href="#"></a></li> </ul> </li> </ul> <li> </ul> i hide children lists so: #parent li > ul {display:none} when hover on top-level list item, add class child <ul> not grandchild <ul> . in tree above wrote <ul> needs class added. the following selects list items children: $("#parent li:has(ul)").hoverintent( showsubnav, hidesubnav ); i need select top level list items have children not want function

c# - Losing variable value when changing forms -

i have simple program, figure out how use multiple forms in c#. have form1( form1 ), , form2( form2 ). on form1 have button, label, , serial port. on form2 have button, , label. program does, when click button closes form opens other, changes text in label, , changes baudrate. here code form1: public partial class form1 : form { //making refernce of form2 called 'form2'. form2 form2 = new form2(); public form1() { initializecomponent(); } public void button1_click(object sender, eventargs e) { //able reference form2 in style replicated vb.net form2.show(); this.hide(); form2.label2.text = ("hello2"); } public void form1_load(object sender, eventargs e) { label1.text = ("start!"); applicationport.baudrate = 200; } here code form2: public partial class form2 : form { public form2() { initializecomponent(); } public void button

Any multi player capability for sphero api for android -

i've read it's not possible ios, possible control more 1 ball @ time android. nothing using 2 or more balls 2 or more devices in same area. we'd love use 3-5 of them in same area 3-5 android devices controlling 1 ball apiece. i take it, if had 3 different versions of app, 1 on each device, conflict 1 another? doubt see character on each of other balls aren't controlling. if they'd still work in same space might still go it. look though sdk , you'll come across: https://github.com/orbotix/sphero-android-sdk/tree/master/samples/twophonesoneball

c++ - OpenGL 3.3 texture mapping triangle -

i have had little luck texturing triangle in opengl 3.3 (core) on last few days. can render vertices , colors, texturing seems problematic. current task/goal vertices , texture coordinates (no colors). since create test texture hand, should show 16x16 white/red checkered triangle. strange behavior: if use gl_clamp_to_edge, it's white. if use gl_repeat, comes out pink (white + red)... vertex shader: #version 330 layout (location = 0) in vec3 vertpos; layout (location = 1) in vec2 texcoord; out vec2 tex; uniform mat4 viewmatrix, projmatrix; void main() { gl_position = projmatrix * viewmatrix * vec4(vertpos,1.0); tex = texcoord; }; fragment shader: #version 330 out vec4 color; in vec2 tex; uniform sampler2d texsampler; void main() { color = texture(texsampler, tex); }; state initialization code (these in order shown): glpixelstorei(gl_unpack_alignment,1); //glpixelstorei(gl_pack_alignment,1); glfrontface(gl_cw); // clockwise oriented polys front faces

java - Display output after input -

i've made program asks user number , checks if equal, less or greater random number. siple guessing game. works display output on same line input can't figure out how this. ok, i've picked number between 1 , 100. first guess? guess 1: 36 < guess 2: 50 > guess 3: 46 correct. hidden number 46. this how want like: guess 1: 36 < guess 2: 50 > guess 3: 46 correct. hidden number 46. how do this? cursor moving down after input when use scanner.nextint(); this current code: while (!iscorrect) { system.out.print("guess " + guesscount + ": "); currentguess = input.nextint(); if (currentguess == randomnumber) { iscorrect = true; system.out.println("that correct. hidden number " + randomnumber); } else if (currentguess > randomnumber) { system.out.println(" >"); ++guesscount; } else if (currentguess < rand

collections - Can we implement a C++ style list in Java? -

an arraylist in java "holds" references objects , not actual object data. i wondering if can implement arraylist in java can contain object data directly instead of references. can java unsafe class used implementation? if yes, performance of list in comparison existing java arraylist? briefly, no. java works references objects. you're describing relies on low-level control on memory allocation/usage permitting allocate block of memory 'n' entries. java doesn't work - never have control of memory , jvm @ liberty move objects within memory. ever deal references. note objects containing references refer further distinct memory blocks, , concept of object being contained within 1 contiguous memory block doesn't exist here. if want byte array backed memory, directbytebuffer may of use. it's java.nio class built using sun.misc.unsafe class. perhaps serialise/deserialise objects (calculating size in order determine indexing properly)

c++ - 2D Ambient lighting in OpenGL -

Image
im making 2d side scroller game , implementing lights. lights light gradient texture rendered on top of terrain multiplied make brighten area. however, dont know how nor understand how ambient lighting. following picture sums have , bottom part want. i open answers regarding shaders know how use them. i ended creating fbo texture size of screen, clearing color of ambience , drawing in nearby lights. then, passed through shader made takes in 2 textures uniforms. texture draw , light fbo itself. shader multiplies textures being drawn fbo , came out nicely. ambience.frag uniform sampler2d texture1; uniform sampler2d texture2; varying vec2 texcoord; void main( void ) { vec4 color1 = vec4(texture2d(texture1, gl_texcoord[0].st)); vec4 color2 = vec4(texture2d(texture2, texcoord)); gl_fragcolor = color1*vec4(color2.r,color2.g,color2.b,1.0); } ambience.vs varying vec2 texcoord; uniform vec2 screen; uniform vec2 camera; void main(){ gl_position = ftrans

apache - Securing Update and Delete queries in Solr -

i have website displays product information using solr, , managed via url. curious how go preventing regular users updating or deleting apache solr documents via url. want admins can submit these queries. i assume there way have username , password verify arbitrary user admin, allowing url request modify data. useful, problem don't want users website ui have opportunity see log-in message in event enters query url. does know of solution / done similar? 1) 1 solution run solr on different port (say 8081) , have os firewall block requests port 8081 excluding public ip of machine using manage admin, allowing local machine access 8081. this firewall configuration i'm using in iptables on centos machine -a input -p tcp --dport 8081 -s 111.222.333.444 -j accept -a input -p tcp -m tcp --dport 8081 -j drop and secure admin further added following security-constraint web.xml digest auth-method <security-constraint> <web-resource-collection>

jquery - How do I add a variable to the end of an object's key? -

i'm trying pass array filled objects: var steps = [ { bla: blu, bla: blu, bla: blu }, { // etc.. 3 more times same format } ]; to codeigniter controller using jquery's $.ajax() function. i tried way: $.ajax({ url: base_url + 'index.php/worldmap/ajax/start_travelling', type: 'post', data: { steps: steps }, success: function(response){ console.log(response); } }); but got typeerror , found out data object passed controller must in key => value format. read take single object. so figured if passed number of steps , each individuel step i'll put them in array again in codeigniter controller. so ended with: var datatosend = { num_steps: steps.length }; var = 1; $.each( steps, function( index, value ) ){ datatosend.step+i = value; // want key step_1, step_2 etc.. += 1; }; $.ajax({ url: base_url + 'index.php/worldmap/ajax/start_trave

c++ Multiples of 5 in sieve of atkin implemenation -

i'm solving problem on @ project euler requires me find sum of primes under 2 million. tried implement sieve of atkin , strangely sets numbers 65,85 primes. looked @ code , algorithm on a day can't find wrong. i'm sure must silly can't find it. in advance i'm using visual studio express 2012. here's code: #include "stdafx.h" #include <iostream> #include <math.h> #include <vector> #include <fstream> #include <conio.h> int main(){ long long int limit,n; std::cout<<"enter number...."<<std::endl; std::cin>>limit; std::vector<bool> prime; for(long long int k=0;k<limit;k++){ //sets entries in vector 'prime' false prime.push_back(false); } long long int root_limit= ceil(sqrt(limit)); //sive of atkin implementation for(long long int x=1;x<=root_limit;x++){ for(long long int y=1;y<=root_limit;y++){ n

javascript - Facebook SDK takes over "$" from jQuery - how to stop that? -

i'm using both facebook sdk , jquery... reason, facebook sdk loading, $ no longer works jquery object. jquery calls still work have use jquery instead of $ ... see below example. have other code in footer jquery stuff , $ doesn't work there either. everything functions hate , want able use $ shortcut jquery! how can $ back? <script type='text/javascript' src='http://x.com/wp-includes/js/jquery/jquery.js?ver=1.10.2'></script> <script> window.fbasyncinit = function () { fb.init({ // (this code straight fb developer docs) appid: '1234123412341234', channelurl: '//mysite.com/channel.html', status: true, cookie: true, xfbml: true }); function checkloginstatus(response) { if(response && response.status == 'connected') { jquery('#login-btn').hide(); jquery('#logout-btn').show(); console.log('

scanf - Why can't my C program complete the code after inputing a number? -

i started learning c have no idea why happening. #include <stdio.h> int square(int x); int main(int argc, const char * argv[]) { printf("enter number"); int usernum; scanf("%d", &usernum); int result = square(usernum); printf("the result %d", result); } int square(int x){ int result = x*x; return result; } it ask number nothing happen after input. if take scanf out , put square(10) or something, code run , finish. it compiles , runs expected me using both gcc , clang ... make more clear (as maybe other text getting in way of seeing answer) add new lines outputting stdout : int main( void ) { printf("enter number: "); int usernum; scanf("%d", &usernum); int result = square(usernum); printf("\nthe result is: %d\n", result); return 0; } if testing in terminal (and not piping input) recall scanf (with %d placeholder) read integer un

C# crashing with Form.show() command, ObjectDisposedException - Deeper look / explanation please -

i'm working on project, , have 2 forms - 1 main form, other console-akin form made of split panel , listbox (in panel 1) i call method ( writetoconsole(string texttowrite) ) - name suggests - adds line of text list box in consolewindow form the issue i'm having that, show form, use button calls show command. however, if close said form "x" button in top right corner, , click show console button again, this: objectdisposedexception "cannot access disposed object. object name: 'consoleoutput'." now, sort of understand issue - had month or 2 ago, , understand because when press x closes form, meaning has reinitialized / reloaded before can show - hence error ( in basic nutshell) "i can't show doesn't exist / in limbo" (again, thats whole "sort of on face of thats means, no deeper that" view - understand deeper that) my question this: can please explain me going on / wrong, , best way sort of thing? i under

jquery - .click .animate .toggle combining two things into one button -

i'd appreciate advice. i'd combine 2 functions on 1 button. i've written makes button move or down when clicked. i'd use button toggle text appear. have javascript both done don't know how combine black circle 1 button. i put code on jsbin please take look! http://jsbin.com/avuruz/235/edit also don't know why black circle goes crazy @ start. circle should go first down , forth. first 2 clicks goes up, up. $(function(){ var c=0; $(".click").click(function(){ $(this).stop().animate({top: ++c%2*100 }, 'fast'); }); }); thanks simply bind both function .click http://jsbin.com/avuruz/240/edit

python - Averaging unevenly sampled data -

i have data consist of radial distance ground, sampled evenly every d_theta . gaussian smoothing on it, make size of smoothing window constant in x, rather constant number of points. way this? i made function it, slow , haven't put in parts calculate edges yet. if helps faster, guess can assume floor flat , use calculate how many points sample, rather using actual x-values. here have attempted far: bs = [gaussian(2*n-1,n/2) n in range (1,500)] #bring computation of bs = [b/b.sum() b in bs] #gaussian outside speed def uneven_gauss_smoothing(xvals,yvals,sigma): newy = [] i, xval in enumerate (xvals): #find how big window should have chosen sigma #(or .5*sigma, whatever): wheres = np.where(xvals> xval + sigma )[0] iright = wheres[0] -i if len(wheres) else 100 if - iright < 0 : newy.append(0) #not implemented yet continue if + iright >= len(xvals):

actionscript 3 - what's the agal tex syntax? -

here syntax i've read tex t b - samples texture in b (which should 1 of fs registers) @ coordinates in a, putting resulting colour in t. but in opensource project code found wrote tex this: tex ft0.xyzw vi0.xyzw fs0 <flinear,mlinear,clamp,2d,rgba,b:45>//what's bias:45? and this tex ft3, v3, fs0<2d, linear, miplinear,dxt1>//what dxt1, there this? which confusing me stuff can put in <> seems no order requirement thanks hints i can guess meanings of other flags - aren't in of documentation i've seen, , aren't in stock version of agalminiassembler. gut feeling they're used extended version of agalminiassembler created use specific flash package (like starling or away3d). i'd stick well-documented texture flags - see pdf linked @ end of post. as order, correct - order not matter when passing tags tex function, assuming using basic version of agalminiassembler provided adobe. the reason relatively simple: every

mvvmcross - cross-platform SignalR -windows store / windows phone -

i saw in ndc 2013 talk stuart lodge gave shows little jabbr written windows store. i looking try use signalr on both windowsphone , windowsstore, can't find portable signalr library use. does know how signalr can used in pcl? thank sergio the jabbr sample shown in demo port of @redth's jabbrismobile repo - https://github.com/redth/jabbrismobile because original author hadn't used portable code, winrt port used file linking rather pcls. however, portable signalr planned - i've talked couple of team , said subset of signalr client available pcl @ point.

ruby on rails - Getting started with delayed jobs -

i using ror , mongodb. application deployed on heroku. want run few delayed jobs on amazon ec2. came across commands git pull on repo. chmod 600 xyz.pem ssh -i xyz.pem ubuntu@ec2-234-33-37-14.compute-1.amazonaws.com i have worked heroku not ec2 , if can point me resources or explain getting started setup of dealyed_job in amazon ec2. things know: 1) how implement delayed jobs in code. things don't know , have doubts: 1) how setup new machine on amazon ec2 have rails repo? 2)how run delayed_jobs connecting app mongo database in heroku.? 1) how setup new machine have rails repo? you can automatically configure new machine in number of ways. popular ways puppet/chef/saltstack. for simple setup, might want run script. aws allows supply script (via userdata) when launching machine. https://help.ubuntu.com/community/cloudinit here example of userdata script might supply aws: #!/bin/sh set -e -x apt-get --yes --quiet update apt-get --yes --quiet install

Inserting same data to cassandra databse -

i have question if try insert same data cassandra databse . here same mean set of 100 rows present in cassandra database in test column family .again if try insert same 100 rows cassandra database i.e. rows same rowkey , inserted again ? . any suggestions on above of . it not duplicated, overwritten unless place data in different column family or keyspace, can duplicate it. docs : first column value in values list row key value insert. list column values in same order column names listed in insert list. if row or column not exist, inserted. if exist, updated.

java - How to turn off Preferences > Compiles > User External Build? -

i got problem android studio every thing in red , says "cannot resolve symbol "xxxxx" "..... i have searched on google , found answer in forum. answer said: turn off preferences > compiler > user external build .... hell ?? can't find anywhere!! i've searched on settings windwos compiler section, , "use externale build!!" please guys me, option edited new: in link: android studio: error output window? , tutorial (with photos) hwo uncheck use external build. , went through tutorial user external build option wasn't on window! here infos android studio: android studio (i/o) preview 0.2.3 build #ai-130.762670, built on 1 august 2013 jre: 1.7.0_25 vm: java hotspot(tm) server vm oracle corporation this option has been removed since android-studio 0.2.1. i.e. cannot deactivate external build anymore. here related release notes: http://tools.android.com/recent/androidstudio021released

c# - Convert List of object into another List of object -

i have list as class vachel { int id{get;set;} int vachelid {get;set;} string title {get;set;} } list of vachel as id vachelid title 1 2 bus 1 3 truck 2 4 cycle 2 5 bike 2 5 bick and want convert list<vachel> list<result> class result { int id{get;set;} string vachelid {get;set;} string title {get;set;} } and result must as id vachelid title 1 2,3 bus,truck 2 4,5 cycle,bike,bick i tried as list<vachel> v = getlist(); list<result> r = null; r = v.groupby(x=> new{x.vachelid}) .select ( x=> new result { id =x.key.id, vachelid =x.firstordefault().vachelid, title =x.firstordefault().title } ).tolist(); here know want put instead of .firstordefault().vachelid , .firstordefault().title don't know do. r = v.groupby(x => x.id) .select(g => new result(){

python - How to click a button by twill? -

i want go site , click on button or link logging in. login not use form. i think login procedure use javascript. input username: <input tabindex="1" class="dxeeditarea_office2003blue dxeeditareasys" onkeydown="aspxekeydown('ctl00_wuclogin1_txtuid', event)" name="ctl00$wuclogin1$txtuid" onkeyup="aspxekeyup('ctl00_wuclogin1_txtuid', event)" type="text" id="ctl00_wuclogin1_txtuid_i" onblur="aspxelostfocus('ctl00_wuclogin1_txtuid')" onfocus="aspxegotfocus('ctl00_wuclogin1_txtuid')" onkeypress="aspxekeypress('ctl00_wuclogin1_txtuid', event)" style="height:15px;"> the link login : <a id="ctl00_wuclogin1_btnlogin" class="search_button" href="javascript:__dopostback('ctl00$wuclogin1$btnlogin','')" style="...">login </a>

c# - Empty path name is not legal Error -

i'm trying save 2 images database keep on getting above error, have tried lot cant solve it. string filename = ""; string filename2 = ""; private void savereq() { try { byte[] img = null; byte[] img2 = null; filestream fs = new filestream(filename, filemode.open, fileaccess.read); filestream fs2 = new filestream(filename2, filemode.open, fileaccess.read); binaryreader br = new binaryreader(fs); binaryreader br2 = new binaryreader(fs2); img = br.readbytes((int)fs.length); img2 = br2.readbytes((int)fs2.length); sqlconnection cn = new sqlconnection(mysql.con.connectionstring); string query = "insert build_lic (id,kroky,kroky_3am) values('" + txtid.text + "',@kroky,@kroky_3am)"; cn.open(); mysql.command = new sqlcommand(query, cn); mysql.comman

android - What is the best way to stop running tasks in threadpoolexecutor? -

i implementing java threadpoolexecutor in android. required stop , remove running tasks pool. i have implemented using submit(runnable) , future.cancel() methods. the code submitting tasks below: public future<?> submittask(runnable runnabletask) throws customexception { if (runnabletask == null) { throw new customexception("null runnabletask."); } future<?> future = threadpoolexecutor.submit(runnabletask); return future; } the future returned submit() passed method below. code cancelling tasks below: public void cancelrunningtask(future<?> future) throws customexception { if (future == null) { throw new customexception("null future<?>."); } if (!(future.isdone() || future.iscancelled())) { if (future.cancel(true)) mylogger.d(this, "running task cancelled."); else mylogger.d(this, "running task cannot cancelled."); } } p

android - Trying to create a json class in my application -

i try build json class application , dont know why isn't working: http://pastebin.com/a9wr9v0m i need help! thanks! are trying use class on ui thread? if reason not working because cannot network actions on main ui thread need done in either async class or separate thread

linux - Binary file Pemission denied -

i work asterisk 11.2.1 , try use command "asterisk" have following error [root@ss sbin]# ls -l | grep asterisk -rw-r--r--. 1 root root 23642286 aug 13 08:37 asterisk -rw-r--r--. 1 root root 23642286 aug 13 08:37 rasterisk [root@ss sbin]# asterisk -bash: /usr/sbin/asterisk: permission denied [root@redsky sbin]# why permission denied? can me? note these binaries have no execution mode: [root@ss sbin]# ls -l | grep asterisk -rw-r--r--. 1 root root 23642286 aug 13 08:37 asterisk -rw-r--r--. 1 root root 23642286 aug 13 08:37 rasterisk ^ missing "x" chmod +x askterisk should solve execution problem.

How to format numbers in Google API Linechart? -

Image
i need format numbers in axis , numbers appear when hover mouse on line chart. there 2 steps involved. first step find out pattern should use; second step put pattern in proper place in code. make post more beautiful, show step 2 , step 1. step 2: putting pattern in code here's code: var options = { haxis: {format:'###,###'} vaxis: {title: 'time', format:'0.0e00'}, }; var formatter1 = new google.visualization.numberformat({pattern:'###,###'}); formatter1.format(datatable, 0); var formatter2 = new google.visualization.numberformat({pattern:'0.0e00'}); formatter2.format(datatable, 1); var fchartvar = new google.visualization.linechart(document.getelementbyid('fchart')); fchartvar.draw(datatable, options); vaxis: {title: 'time', format:'0.0e00'} formats labels on vertical axis. this formats numbers see when hover on points on line chart: var formatter1

testing - Selenium doesn't wait until website has loaded, where to put the codes of your answers? -

in test case website needs many seconds until loaded, selenium doesn't wait it, although set on slowest option. i know give me java codes or something, don't know have write down these codes works? i newbie, sorry thank you set implicit or explicit wait as, after browser instance insert following line - driver.manage().timeouts().implicitlywait(10, timeunit.seconds); or before element take time load place explicit wait - webdriverwait.until(condition-that-finds-the-element) for more info click here

jquery - bootstrap-wysihtml5 can't get it work:no iframe, no html -

i can't run bootstrap-wysihtml5 editor on page,this html tag: <h3 class='sectname'>message</h3> <div class='row-fluid'> <div class='span12'> <textarea name='message' id='message' rows="5" placeholder='your message'> </textarea> </div> </div> i have included css , js: <link rel="stylesheet" type="text/css" href="<?php echo $siteurl.'/min/?g=css_m&amp;5259487' ?>"/> <script type="text/javascript" src="<?php echo $siteurl.'/min/?g=js_i&amp;5259487' ?>"></script> <script type="text/javascript" src="<?php echo $siteurl.'/min/?g=js_m&amp;5259487' ?>"></script> i'm using minify, these files: 'css_m' => array('//css/bootstrap-wysihtml5.css'), 'js_i' =

jquery - Enable button until select fields will chosen -

i try make button enabled/disabled status until user choose 4 select boxes. based on solution: link here link in case can't make working. here fiddle: http://jsfiddle.net/ http://jsfiddle.net/marekandrzejak/nycz6/ , wrong? html: <form action="classes/script.php" method="post" name="pricelist" style="float:left;"> <div class="price_list option"> <label for="choose_currency">wybierz walutÄ™</label> <select id="choose_currency" name="choose_currency"> <option value="" selected="selected">wybierz...</option> <option value="1">pln</option> <option value="<? echo $obj->getgbprate() ?>">gbp</option> <option value="<? echo $obj->geteurrate() ?>">eur</option> <option value="<? echo $obj->getusdrat

java - getResource will always return null -

this driving me crazy. have simple eclipse project src folder , class in it. can't seem getresource find it. doing wrong? import java.net.url; public class contexttest { public static void main(string[] args) { url url = contexttest.class.getresource("/src/contexttest.java"); system.out.println(url); } } if right-click on class name, path /testsproject/src/contexttest.java , default classpath according classpath tab in run configurations testproject . it doesn't work /bin/contexttest.java , /contexttest.java , contexttest.java either. when load resources using contexttest.class.getresource("/....") leading / translated absolute path. here absolute means root package (i.e. default package). in eclipse root package considered 1 under src folder. compiled classes placed under bin folder , if create jar see root package not src or bin folders whatever folders inside it. (for example com ). so correct w

How to create this type of panels in Android? -

i've seen type of panels (white ones shadow border @ bottom) , use them in apps. https://lh6.ggpht.com/i_ruuvi7g2um1ebn5hacjqvqk_k1thmiw7ynac4hwwud1_j1g03mkmbafu0n5ja2ya=h900-rw what kind of panels , how can create them? thanks in advance /drawable/panel_bg.xml <?xml version="1.0" encoding="utf-8"?> <layer-list xmlns:android="http://schemas.android.com/apk/res/android"> <!-- bottom 3dp shadow --> <item> <shape android:shape="rectangle"> <solid android:color="#c7c6c5" /> <corners android:radius="4dp" /> </shape> </item> <!-- white top color --> <item android:bottom="4px"> <shape android:shape="rectangle"> <solid android:color="@color/white" /> <corners android:radius="4dp" /> </shape>

php - How to use preg_replace to remove part of url address? -

i have html code this: <a href="http://mysite.com/documentos/servicios/sucre/sucdoc19.pdf&amp;sa=u&amp;ei=sf0jurmjic3nswb154cgdq&amp;ved=0cckqfjaa&amp;usg=afqjcngfxg_9x83u3pyr6jfkjcwuxv8x0q"> i need clean code <a href="http://mysite.com/documentos/servicios/sucre/sucdoc19.pdf"> using preg_replace . my code following: $serp = preg_replace('&amp;sa=(.*)" ', '" ', $serp); and doesn't work. btw need restrict search preg_replace until first entrance, i.e. need replace html &amp;sa= first " , search &amp;sa= last " ... you missed delimiter. code looks like: $serp = preg_replace('/&amp;sa=(.*)" /', '" ', $serp); okay, if want delete till first quote can try following instead of regex: $temp = substr($serp,strpos($serp,'&amp;sa='),strpos($serp,'"',strpos($serp,'&amp;sa='))); $serp = str_repla

java - how to insert data type date(yyyy-MM-dd) in sqlite database and retrive data between two dates in android -

i have sqlite3 database table contains name,address,date of birth details.i want display 1990-01-01 1995-01-01 details. but sqlite3 database stores following data types. text numeric integer real none any 1 have hint store , retrieve date format data..? use code convert date millisecond format , store database integer types string somedate = "1995-01-01"; simpledateformat sdf = new simpledateformat("yyyy-mm-dd"); date date = sdf.parse(somedate); system.out.println(date.gettime()); date.gettime()-give millisecond format at same way convert input (i.e 1990-01-01 , date 1995-01-01) simpledateformat sdf = new simpledateformat("yyyy-mm-dd"); date date1 = sdf.parse(1990-01-01); value1=date.gettime(); date date2 = sdf.parse(1995-01-01); value2=date.gettime(); retrieve database using following query db.rawquery("select * table_name column_name between "+value1+" , "+value2+"",null); or db

jQuery Mobile trigger('create') finished on listview -

i'm rendering listview want call function, hideuncheckedlistitems() , once trigger('create') has finished manipulate listview. there event can listen when it's finished? or other way of triggering function once listview has been created? i've tried following, seems trigger early: this.content.trigger('create').trigger('listrendered'); this in context of phonegap app uses backbone.

php - How to Convert Array into String in HTML Form? [Notice: Array to string conversion?] -

i trying take files in array html form, , store them in database. have written following code , giving me many error messages. looks main problem is not converting array string. kindly guide me. line 27 : $image_name= $_files["files"]["name"]; line 29: $random_name= rand().$_files["files"]["name"]; $_files output array ( [files] => array ( [name] => array ( [0] => bracelet_gold.jpg [1] => necklaces_silver.png [2] => brooches_gold.png ) [type] => array ( [0] => image/jpeg [1] => image/png [2] => image/png ) [tmp_name] => array ( [0] => f:\xampp\tmp\php599c.tmp [1] => f:\xampp\tmp\php599d.tmp [2] => f:\xampp\tmp\php599e.tmp ) [error] => array ( [0] => 0 [1] => 0 [2] => 0 ) [size] => array ( [0] => 7150 [1] => 37867 [2] => 314296 ) ) ) <body> <form action="" method="post" enctype="multipart/form-data"

httpclient - set timeout in httprequest android -

i using following code data server http request. httpclient client = new defaulthttpclient(); string url = urlgenerator(); stringbuilder url = new stringbuilder(url); httpget = new httpget(url.tostring()); httpresponse response = client.execute(get); int status = response.getstatusline().getstatuscode(); if(status == 200){ ... } its working fine.but in case if phone connected wifi or gprs 3g internet not working or internet connection not there, want use timeout feature in above code. say after 3 sec want show timeout please try again.. how do that. in case of time out want show text in textviw connection timeout .. how do please help you can follows: try{ httpget httpget = new httpget(url); httpparams httpparameters = new basichttpparams(); // set timeout in milliseconds until connection established. // default value zero, means timeout not used. int timeoutconnection = 4000; httpco

php - I want to run my sh file continuously even if I close my Putty connection -

i have file called example.sh want run on server, file opens tcp port connection tracking unit can connect it. i use following command run file in putty bash ./example.sh , executes file , runs php file perfectly. but problem when close putty connection, script dies. have made cronjob run example.sh file , seems work, when want start script manually, i'm stuck. can tell me linux command use run file , able close putty connection? bash ./example.sh & & in end send process in background. , should able close putty.

sorting - MySQL: Sort by single values in different columns -

my table looks (simplified): name result1 result2 result3 15 17 24 b 30 31 21 c 27 19 39 now want sort results in columns result1, result2 , result3 ranking sorted lowest highest values in these columns. the results should this name result 15 17 c 19 b 21 24 c 27 b 30 b 31 c 39 i don't have idea how sort values in different columns paying attention every single value , not max or min. can me? thanks in advance. try this select name,result ( select name, result1 result yourtable union select name, result2 result yourtable union select name, result3 result yourtable ) t order result