Posts

Showing posts from May, 2012

java - Can't conenct to a url -

i have link i'm providing 2 parameters , php server side script executing query , writing them databae. the problem in specific case, seems can't connect teh url. here button xml file: <button android:layout_width="match_parent" android:layout_height="wrap_content" android:includefontpadding="@+id/btnsubmit" android:text="@string/btnsubmit" android:onclick="submitnewj" /> here click "listener": public void submitnewj(view view){ new submitj().execute(); } and here submitj code: public class submitj extends asynctask<void, integer, void>{ @override protected void doinbackground(void... params) { try{ string encodedname = urlencoder.encode(name,"utf-8"); string encodedbody = urlencoder.encode(body,"utf-8"); url url = new url("http://site123.com/android/j/sj.php?name=...

vimeo api video search call does not work for utf-8 characters -

when use turkish characters ş ç ğ vimeo playground returns response. query İşletim request get /api/rest/v2?format=json&method=vimeo.videos.search&query=%c4%b0%c5%9fletim http/1.1 host: vimeo.com accept: */* response { "generated_in": "0.0121", "stat": "ok", "videos":{ "on_this_page": "0", "page": "1", "perpage": "50", "total": "0", "video":[ ] } } however, know there video has title İşletim

voip - Unable to store voicemail through odbc in asterisk -

i using asterisk 1.8 trying save voicemail details in database cli shows [apr 4 18:11:54] notice[6879][c-00000006]: chan_sip.c:25503 handle_request_invite: call '' (37.59.2.156:5071) extension '9900972597869877' rejected because extension not found in context 'default'. -- <dahdi/i1/9634434640-3> playing 'digits/4.gsm' (language 'yes') -- <dahdi/i1/9634434640-3> playing 'digits/7.gsm' (language 'yes') -- <dahdi/i1/9634434640-3> playing 'digits/5.gsm' (language 'yes') -- <dahdi/i1/9634434640-3> playing 'digits/9.gsm' (language 'yes') -- <dahdi/i1/9634434640-3> playing 'digits/5.gsm' (language 'yes') -- <dahdi/i1/9634434640-3> playing 'digits/0.gsm' (language 'yes') -- <dahdi/i1/9634434640-3> playing 'digits/0.gsm' (language 'yes') -- <dahdi/i1/9634434640-3> play...

bots - JavaScript : detect and create a fake human click -

i'm developing robot click protection. of course, far perfect. layer of security main protection involves server side log analysis. have ideas how use javascript detect fake click fired using javascript? , also, how user simulate perfect, realistic , undetectable human click using javascript?

javascript - One input triggers Chrome validation, but another isn't -

i have 3 inputs across 2 pages, of want chrome validate (i.e. won't allow form submitted if doesn't contain valid email address). the input on this page (input a) validating fine, i'd same inputs on this page : 1 see when click options -> add/remove feeds or options -> edit account (input b) , 1 see when click 'get notified' (input c). this code input a, validating properly: <form role="form" class="form-inline" method="post"> <p>get notified when shopaholic launches</p> <input type="email" name="email" class="form-control input-lg" id="inputemail" placeholder="enter email"> <button type="submit" class="btn btn-primary btn-lg" data-dismiss="modal">notify me</button> </form> this code inputs b , c, aren't validating: <!-- modal containing input b --> <div class="m...

java - Unparsable Date with colon-separated timezone -

i'm trying parse string 2014-04-04t14:28:38+02:00 it should iso 8601 format. can't parse correct date. i've tried following: string example = "2014-04-04t14:28:38+02:00" public final static simpledateformat df = new simpledateformat("yyyy-mm-dd't'hh:mm:ssz") date tempdate = df.parse(example) but message "unparseable date" can not change example because it's value webservice. could there probleme "+02:00" instead of "+0200" ? thanks lot starting java7, handle +02:00, can use following format: "yyyy-mm-dd't'hh:mm:ssxxx" this can seen in simpledateformat documentation

c# - How to get all text from RichTextBox in WPF -

i need text wpf richtextbox. everyone ( how wpf rich textbox string , richtextbox (wpf) not have string property "text" , http://msdn.microsoft.com/en-us/library/ms754041(v=vs.110).aspx , many more) agrees code one: public static string gettext(richtextbox rtb) { textrange textrange = new textrange(rtb.document.contentstart, rtb.document.contentend); string text = textrange.text; return text; } but add trailling "\r\n". in simple case: <richtextbox x:name="mrichtextbox"> <flowdocument> <section> <paragraph> <run text="the dog brown. cat black."/> </paragraph> </section> </flowdocument> </richtextbox> i get: "the dog brown. cat black.\r\n" it can seen minor issue need exact text. do know why? is safe ignore 1 trailing "\r\n"? is code correct? is there other gotcha (i mean differences between real text ,...

java - XML Schema for collection or array containing basic parameters along with other collections or arrays -

i need write xml schema allow production of xml file needs in specific format. hope use , xml schema along jaxb create data object, write data object, , marshal data object correctly formed xml. unfortunately, there not exist schema xml document, being read legacy code in manual way. goal create xml schema allow jaxb marshal in specific way. i having problem named collections or arrays. have few variation on , complicated version below. note have no control on target desired format of xml, need discover how dictate schema produce this. , suggestions very, helpful , promise, xml schema experts, if helps me absolute favorite person of week! here target format this: <betainfo name="beta id" value="1"> <simplebetainfo> <param name="simple beta a" value="beta id 1, param data"/> <param name="simple beta b" value="beta id 1, param b data"/> </simplebetai...

objective c - iOS Crash if the orientation changes while view is changing -

i having bug if orientation of device changes while view changing view lose of subviews , if action taken app crash. i tried turning off listening orientation changes if viewwilldissappear still doesn't solve problem. has else had problem? , how can fix it? edit: exception getting "can't add self subview" here how push new view controller classa.h @class classb; @interface classa : uiviewcontroller { classb *classb; } classa.m -(void)buttonaction:(uibutton*)sender{ classb = [[[classb alloc] initwithnibname:@"mynibname" bundle:nil classa:self] autorelease]; [self.navigationcontroller pushviewcontroller:classb animated:yes]; } classb.m //turn on orientation -(void)viewwillappear:(bool)animated{ [[nsnotificationcenter defaultcenter] addobserver:self selector:@selector(orientationchanged:) name:uideviceorientationdidchangenotification object:nil]; } //turn off orientation -(void)viewdiddisappear:(bool)animated{ [[nsno...

awk - bash script for comparing -

i trying write bash script. i on amazon-s3. have bucket1, contains bucket2, bucket3, bucket4. bucket 2 has b1, b2, b3, b4, b5 - in each of them contain tar files being created nd file name. when s3cmd --recursive ls s3://bucket1/bucket2/ | awk '{print$1}' print date of tar files generated. i want date on computer compare list , print last 1 week of files have been created. format of date on s3 : year/month/date thank you. you can use gnu date +%s option seconds, , compare dates in whatever format, i.e. > (( ( $(date +%s) - $(date -d "2014/03/08" +%s) ) < (7*24*60*60) )) \ && echo "less week ago" \ || echo "more week ago" more week ago > (( ( $(date +%s) - $(date -d "2014/04/03" +%s) ) < (7*24*60*60) )) \ && echo "less week ago" \ || echo "more week ago" less week ago

How do I get the name of the input blob of my Azure WebJob? -

i'm using new azure webjobs feature , have simple trigger when new file comes 1 of blobs: public static void processimportfile([blobinput("importjobsdata/{name}")] textreader input, [bloboutput("importjobslog/log_{name}")] textwriter writer) { writer.writeline("starting import file process..."); var result = inputdata(input, writer); var status = result == 0 ? "success" : "fail"; var message = result == 0 ? "import success." : "import fail. " + result + " records failed import. check logs details."; writer.writeline(message); } what i'd name of file uploaded (ie. {name} property in data annotation) can write information writer (log) diagnostic purposes. however, can't seem find properties of textreader/blobinput give me information. i've done little digging , appears basestream property of textreader micro...

mysql - inner join with 2 primary keys -

ending id meaning primary key do when table 4 uses 2 primary keys? display content2, content3, , content1 in 1 select statement create table table1 (table1id char(4), content1 varchar, create table table2 (table2id char(4), content2 varchar, create table tablet3 (table3id char(4), content3 varchar, table2id char(4), create table tablet4 (table1id char(4), table3id char(4), if understand correctly: select content1 ,content2 ,content3 table1 t1 inner join table4 t4 on t1.table1id = t4.table1id inner join table3 t3 on t4.table3id = t3.table3id inner join table2 t2 on t3.table2id = t2.table2id

Using voice recognization feature in android crashes application -

i new stackoverflow , beginner in android programming. developing app control led via android phone of arduino , bluetooth adapter , working fine. trying add voice recognization feature, app gets crashed every time use feature. below code using receiving voice input. please suggest correction: @override protected void onactivityresult(int requestcode, int resultcode, intent data) { super.onactivityresult(requestcode, resultcode, data); if (requestcode == result_speech && resultcode == result_ok) { string check = data .getstringextra(recognizerintent.extra_results); toastit("what said",check); //just toast messages checkthatvoice(check); } } private void checkthatvoice(string check) { if (check.equals("bulb 1 on")) { senddata("1");//sends 1 function further use, works fine } }

r - LEFT OUTER JOIN in sqldf with WHERE and HAVING clauses -

i have 2 data frames in r , conditionally merge them on id , day . merge right variables merged left variables new/fresh/recent possible, must @ least 3 days old. but, if there isn't match in right id - date pair in left i'd still retain them. study has 2 parts, don't want drop id - day observations because they're not complete. can in 1 sqldf step? current approach requires additional base r merge . left <- data.frame(id=rep(1:5, each=10), day=rep(1:10, times=5), x=rnorm(5*10)) right <- data.frame(id=rep(1:2, each=21), day=rep(-10:10, times=2), y=rnorm(2*21)) combined <- sqldf("select l.id, l.day, l.x, r.y left l left outer join right r on (l.id = r.id) ((l.day - r.day) >= 3) group l.id, l.day having (r.day = max(r.day))") combined combined.2 <-...

how to use submit button with ajax in asp.net -

in asp mvc project want add company database without refreshing page. how can ajax. want submit data , return same page without refresh. part of code @using (html.beginform("create", "company", formmethod.post, new { enctype = "multipart/form-data" })) { @html.validationsummary(true) <fieldset> <div class="editor-label"> @html.labelfor(model => model.nom_company) </div> <div class="editor-field"> @html.editorfor(model => model.nom_company) @html.validationmessagefor(model => model.nom_company) </div> <div class="editor-label"> @html.labelfor(model => model.desc_company) </div> <div class="editor-field"> @html.editorfor(model => model.desc_company) @html.validationmessagefor(model => model.desc_company) </div> <div class="edito...

android - How to use the JLocationClient Interface to set mock locations? -

i'm wanting make location simulator test other application i'm doing. intention load kml file (coordinate points) in list , go through each of these points test application i'm doing. there apps on play it, don't, buggy, decided myself hands-on, able learn, ran problem. there unit called "androidapi.jni.playservices.pas" containing several interfaces. 1 of these interfaces called "jlocationclient" , i've researched there java class named "locationclient" responsible doing want, i.e. use , set mock locations setting coordinates (latitude , longitude). does know how use these interfaces? or know how want without using them? i'm developing simple firemonkey project 1 form. start point.

android - Leaderboard activity on closing pause the game for few seconds -

i did done leaderboard inside game using codes public void openleaderboardsactivity() { runonuithread(new runnable() { @override public void run() { if (!mhelper.issignedin()) { beginuserinitiatedsignin(); } else { string leaderboardid = getresources() .getstring(r.string.leaderboard_id); startactivityforresult(mhelper.getgamesclient() .getleaderboardintent(leaderboardid), 1001); } } }); } public void submitleaderboardsscore() { if (mhelper != null && mhelper.issignedin()) { mhelper.getgamesclient().submitscore( getresources().getstring(r.string.leaderboard_id), gamepreferences.getinstance().gethighscore()); } } but problem when took leaderboard menu , came game paused 4 sec , r...

jasmine - Local path for html files -

i running jasmine tests on karma server. on tests have load image , json file test. they depend on path. default path karma? mean if have image in directory inside .js test files how can reach file? i have tested src="mydir/myimage.jpg" no sucess... if use nodejs web-server run app, can add karma.conf.js : proxies: { '/path/to/img/': 'http://localhost:8000/path/to/img/' }, if don't use or want use server can define local proxy karma doesn't provide access port in use, dynamically, if karma starts on port 9876 (default), still 404 error... proxies = { '/images': 'http://localhost:9876/base/images' }; based on this answer related github issue more info ;) i suggest using requirejs because karma not deal fixtures...

android - VOIP SipDemo Registration Failed (ERROR) -

i making application has voip. i have proven examples have been unsuccessful. 1 - try openfire i working openfire, within configuration -> server -> telephony, have few mappings sip accounts. 2 - try 3cx (free sip server) i have tried access android have no success: this code (android sip demo) http://developer.android.com/guide/topics/connectivity/sip.html user = 11 domain : 192.168.56.101 / 127.0.0.1 password = 11 always registration failed. idea ? public class walkietalkieactivity extends activity implements view.ontouchlistener { public string sipaddress = null; public sipmanager manager = null; public sipprofile me = null; public sipaudiocall call = null; public incomingcallreceiver callreceiver; private static final int call_address = 1; private static final int set_auth_info = 2; private static final int update_settings_dialog = 3; private static final int hang_up = 4; @override public void oncr...

c - Improved Euler Method in Simple Harmonic Oscillator -

i have written c code using improved euler method determine position, velocity , energy of oscillator @ regular time intervals. however, run problem energy of oscillator decreasing, though there no dissipation terms. think particularly related way update position , velocity variables , on matter. code follows: //compilation , run //gcc oscillatorimprovedeuler.c -lm -o oscillatorimprovedeuler && ./oscillatorimprovedeuler #include <stdio.h> #include <math.h> // global constans defined in following way (having constant value througout program #define m 1.0 // kg #define k 1.0 // kg/sec^2 #define h 0.1 // sec time step #define n 201 // number of time steps int main(void) { // avoid using arrays time double x = 0, xint = 0; double v = 5, vint = 0; // previous case double t = 0; double e = (m * v * v + k * x * x) / 2.0; // energy in units of joules file *fp = fopen("oscillatorimprovede...

java - MergeSort - ArrayIndexOutOfBoundsException -

i sorry if has been answered somewhere, have spent on hour searching through many previous questions , none of them able me error. i randomly receive error, 70% of time: --------------------configuration: mergesort - jdk version 1.7.0_45 <default> - <default>- ------------------- random array: 17 14 3 4 1 10 13 9 3 1 6 9 10 2 17 8 10 5 7 8 exception in thread "main" java.lang.arrayindexoutofboundsexception: 20 @ mergesort.merge(mergesort.java:64) @ mergesort.mergesort(mergesort.java:26) @ driver.main(driver.java:18) process completed. line 64 refer to: "scratch[scratch_index] = list[i];" public void merge(int[] list, int first, int middle, int last) { int[] scratch = new int[list.length]; int midpoint = (first+last)/2; int left_index = first; int right_index = middle + 1; int scratch_index = left_index; while((left_index <= midpoint) && (right_index <= last)) { if(list[left_index] ...

ios - Web App worked last week, works fine on Ipad and Android, but now clogs on Iphone? NOTHING changed but SSL layer for push -

i launched iphone app...approved apple store. (marion il official app) if want try and works fine on ipad. client says iphone takes forever load, , doesn't run right. last week's version worked fine. funny thing changed no code (it's web app push notification) did re-compress ipa ssl layer certificate push. any thoughts? i faced similar issue before. 2 possibilities come mind: there memory pile (you storing in array/object), not being cleared time , again. e.g. if getting via gps, not clearing on time. you'd notice on time, takes while build data. -the hosting company (godaddy in case), enabled mobile websites, redirecting calls mobile device mobile site. may not in case said it's working on ipad.

javascript - Understanding r.js optimizer for whole project -

i have directory structure this: assets modules module1 models templates views //contains individual modules app.js build.js require.js text.js and here build profile ({ paths: { jquery: 'assets/js/jquery', underscore: 'assets/js/underscore', backbone: 'assets/js/backbone', bootstrap:'assets/js/bootstrap', flexslider:'assets/js/jquery.flexslider', fullcalendar:'assets/js/fullcalendar' }, shim: { underscore: { exports: "_" }, backbone: { deps: ['underscore', 'jquery'], exports: "backbone" }, flexslider:{ deps:['jquery'], exports:"flexslider" }, fullcalendar:{ deps:['jquery'], exports:"fullcalendar" } }, baseurl : ...

Where is "Choose columns to display" in phpMyAdmin 4? -

i know "choose columns display" can found under relational view of particular table. using phpmyadmin 4.0.4 , feature not visible version under relational view. have 2 tables in small database , both tables have innodb storage engine. where have gone wrong? why cannot see feature? not supported phpmyadmin anymore or wrong side? if possible reasons? try clicking down arrow right of large "t", in top right of browse table. should offer drop-down can select columns want display.

php - 1064 syntax error in mysql -

i confused. don't know error. on execution got message: " have error in sql syntax; check manual corresponds mysql server version right syntax use near 'group(creator,type,name,details,icon)values (6,'information sharing','test','j' @ line 1" my query : insert group (creator, type, name, details, icon) values (6, 'information sharing', 'test', 'just testing', 'my friend/group_uploads/pic00_6_0d46839f6371fb84f6b6c682f5fc2c77.jpeg') this table specification: type varchar(1000) name varchar(1000) details varchar(1000) creator bigint(20) icon varchar(1000) please me correct error . group reserved word in mysql. need surround in backticks. like this.. insert `group`(creator, type, name, details, icon) values ('6','information sharing','test','just testing','my friend/group_uploads/pic00_6_0d46839f6371fb84f6b6...

sails.js - 'Step Over' doesn't work while debugging sails App using Webstorm 8 -

Image
i'm trying debug sails app webstorm(8), "step over" doesn't work. the app stop @ breakpoint, when "step over/into/...", app resume run. have try different breakpoints , different sails version(0.10), still don't work. debug output: /usr/local/bin/node --debug-brk=63616 --nolazy app.js debugger listening on port 63616 error: grunt :: debugger listening on port 63616 info: info: info: sails.js <| info: v0.9.16 |\ info: /|.\ info: / || \ info: ,' |' \ info: .-'.-==|/_--' info: `--'-------' info: __---___--___---___--___---___--___ info: ____---___--___---___--___---___--___-__ info: info: server lifted in `/developer/projects/webstormprojects/sailsapp` info: see app, visit http://localhost:1337 info: shut down sails, press <ctrl> + c @ time. debug: --------------------------------...

asp.net - Search Active directory and return null or "" into a label in c# if property is blank -

i trying search active directory users details it. populate labels details below. works fine if user doesn't have value 'division' bombs out below error message. have tried different things cant work show null or "" in label text help! private void populate_table(string current_user) { string connection = configurationmanager.connectionstrings["adconnection"].tostring(); directorysearcher dssearch = new directorysearcher(connection); dssearch.filter = "(samaccountname=" + current_user + ")"; searchresult sresult = dssearch.findone(); directoryentry dsresult = sresult.getdirectoryentry(); lblfname.text = dsresult.properties["givenname"][0].tostring(); lbllname.text = dsresult.properties["sn"][0].tostring(); lblemail.text = dsresult.properties["mail"][0].tostring(); lbldepartment.text = dsresult.properties["departmen...

javascript - url validation not working -

i using javascript url validation regular expression. not working in cases.i want urls below,it must work .com,.in .us etc http://mysites.com http://www.mysite.com https://mysite.com https://www.mysite.com ftp://mysite.com ftp://www.mysite.com www.mysite.com mysite.com usa.mysite.com i using regular expression , var regex = /(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\s+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/; its not working in case of www.mysite.com , mysite.com etc . any 1 please me. try regex: var regex = /^(ht|f)tps?:\/\/[a-z0-9-\.]+\.[a-z]{2,4}\/?([^\s<>\#%"\,\{\}\\|\\\^\[\]`]+)?$/;

cakephp - Display Image next to HABTM checkboxes -

Image
cane give me ideas on please! i generate multiple checkboxes table related table habtm relationship association. generate multiple checkboxes image along text in label. my 2 tables items , items_characteristics. item hasandbelongtomany characteristics, , itemcharacteristic hasandbelongtomany items. echo $this->form->input('item.itemcharacteristic',array( 'label' =>false, 'type'=>'select', 'multiple'=>'checkbox', 'options' => $itemcharacteristics , 'selected' => $this->html->value('itemcharacteristic.itemcharacteristic') )); this code generate list of checkboxes , works perfect: have: which generated db table items_characteristics. and wanna have: does have idea how can achieve please? i assume in controller did like: $this->request->data = $this->item->find('first', ... ); so $data contains information selected ...

javascript - why pageshow not call in jquery mobile? -

can please tell me why pageshow event not call in jquery mobile? http://jsfiddle.net/g7ave/ $(document).ready(function(){ $("#1").on('pagebeforeshow ', function() { //yourfunctioncall(); alert('1') }); }); jquery( "#1" ).on( "pageshow", function( event ) { alert('1') } ) refrain using .ready() in jquery mobile, use pageinit instead. moreover, page id, don't use plain digits ; id should contain characters. $(document).on("pageinit", "#pageid", function () { $("#pageid").on('pagebeforeshow ', function () { /* run code */ }); }); demo

Mouse Position Python Tkinter -

is there way position of mouse , set var? you set callback react <motion> events: import tkinter tk root = tk.tk() def motion(event): x, y = event.x, event.y print('{}, {}'.format(x, y)) root.bind('<motion>', motion) root.mainloop() i'm not sure kind of variable want. above, set local variables x , y mouse coordinates. if make motion class method, set instance attributes self.x , self.y mouse coordinates, accessible other class methods.

d - Offline copy of Phobos documentation -

is there way me have offline (preferably searchable) copy of phobos documentation available here ? d includes copy of documentation, in html , chm format. can find html files under html/d directory in zip file, , d.chm under windows/bin .

Google Drive SDK JavaScript 404 Error -

we getting since yesterday error each time try execute drive method javascript library, such as: gapi.client.drive.files.get({'fileid': rootfolderid}); gapi.client.drive.children.list({'folderid' : folderguid, 'q': 'trashed = ' + trashed}); or other. when execute code code: var rootfolderid = "0bz9ghmojpxadmmlnc1utnmfkb28"; var getfileinfo = gapi.client.drive.files.get({'fileid': rootfolderid}); getfileinfo.execute(function(getfileinforesp){ log("rootfolderid", rootfolderid); log("getfileinforesp", getfileinforesp); }); we following error rootfolderid - 0bz9ghmojpxadmmlnc1utnmfkb28 getfileinforesp- object {code: 404, message: "not found", data: array[1], error: object} code: 404 data: array[1] error: object message: "not found" proto : object two days ago same code working fine. anyone has same problem? have clue? when try execute...

php - Find the differences in multi-dimensional array -

i want find different below arrays. first array: array ( [0] => array ( [month] => 1 [year] => 2014 [total_days] => 2 ) [1] => array ( [month] => 2 [year] => 2014 [total_days] => 2 ) [2] => array ( [month] => 3 [year] => 2014 [total_days] => 2 ) [3] => array ( [month] => 4 [year] => 2014 [total_days] => 2 ) [4] => array ( [month] => 6 [year] => 2014 [total_days] => 1 ) [5] => array ( [month] => 1 [year] => 2015 [total_days] => 1 )) second array: array ( [0] => array ( [month] => 1 [year] => 2014 [total] => 4 ) [1] => array ( [month] => 2 [year] => 2014 [total] => 6 ) [2] => array ( [month] => 3 [...

spring mvc get mapping controller method from interceptor -

now have controller this @requestmapping("/content/delete.json") @security(auth = authtype.required) public modelandview deleteindex(user user, @requestparam("id") long id) { } now trying controller mapping method interceptor , getting annotation of method. method method = restrequesturlutil.getinvokedmethod(handler, request); security security = method.getannotation(security.class); if(security.getauth() == authtype.required) { validate here } are there classes restrequesturlutil in spring? thanks in advance :) edit: web.xml <servlet> <servlet-name>rest</servlet-name> <servlet-class>org.springframework.web.servlet.dispatcherservlet</servlet-class> <init-param> <param-name>contextconfiglocation</param-name> <param-value> /web-inf/rest-servlet.xml, /web-inf/interceptor-servlet.xml </param-value> ...

ruby on rails - Gem::LoadError for mysql2 gem, but it's already in Gemfile -

gem::loaderror specified 'mysql2' database adapter, gem not loaded. add `gem 'mysql2'` gemfile this error occurred while loading following files: active_record/base this error on running rails server. the mysql2 gem has been added gemfile well. i've done bundle install , , tried restarting server still error. if have error when upgrading rails 4.2.4 (also rails 4.1.5) try using version of mysql2: gem 'mysql2', '~> 0.3.18' apparently mysql2 isn't still compatible newer version of rails because rails 4.2.4 pretty new time of answering question me 8 september 2015 use above line in gem file , run: bundle install you should go

shell - Ksh arithmetic anomaly -

i have following lines in script: nr_of_requests_in_progress=$(db2 -x "select count(*) my_table date='$my_date' , status = 'expected_status' , id in ($current_id, $other_id)" | awk '{print $1}') while [[ $nr_of_requests_in_progress -gt 0 ]]; [...] done now works in env, yet when colleague of mine tests it, gets arithmetic syntax error line. how come? what colleague's screen show if add set -vx before assignment nr_of_req.. s. ? the problem call db2 not returning numeric value. just remember, set -vx friend (even if rather unwieldy when dealing large and/or nested while/for/if-then-else-fi blocks of code :-) ) ihth

datastax enterprise - apache cassandra node not joining cluster ring -

i've 4 node apache cassandra community 1.2 cluster in single datacenter seed. configurations similar in cassandra.yaml file. following issues faced, please help. 1] though fourth node isn't listed in nodetool ring or status command, system.log displayed node isn't communicating via gossip protoccol other nodes. both jmx & telnet port enabled proper listen/seed address configured. 2] though opscenter able recognize 4 nodes, agents not getting installed opscenter. same jvm version installed java_home set in 4 nodes. further observed problematic node has ubuntu 64-bit & other nodes ubuntu 32-bit, can reason? what version of cassandra using. had reported similar kind of bug in cassandra 1.2.4 , told move subsequent versions. are using gossiping property file snitch? if that's case, problem should have been solved having updated cassandra-topology.properties files upto date. if these fine, check tcp level connection via netstat , tcp dump.if co...

dagger - No injectable members on android.app.Application. Do you want to add an injectable constructor? required by provideOkHttpClient -

i trying merge u2020 , dagger's example android-activity-graphs in following repo . however, getting compile time error: error:(32, 8) error: no injectable members on android.app.application. want add injectable constructor? required provideokhttpclient(android.app.application) org.kamol.nefete.activitymodule you haven't bound application , have bound context , somewhere else in graph, have type depends on application . downstream dependencies need application attempt implicitly bind because dagger cannot know object requires application can satisfied @forapplication context . since application not have @inject constructor nor @inject fields, dagger fail. you can fix example adding @provides @singleton application provideapplicationcontext() { return application; } in org.kamol.nefete.androidmodule as aside, recommend against binding context abstract supertype , easy confuse activity context s, if binding @qualifier annotation, such @forapp...

php - Escape Spaces in this script? -

i'm using php create config file make executable , works fine when file name doesn't have spaces when file have spaces doesn't work. the file name inside $readyfile variable. what can fix ? $content = ";!@install@!utf-8! title=\"auto-extract\" executefile=\"runner.exe\" executeparameters=\"--exe 2999.exe --file $readyfile\" ;!@installend@!"; $fp = fopen("config.txt","wb"); fwrite($fp,$content); fclose($fp); thanks you can strip using regex. $content=preg_replace('/\s+/', '', $content);

java - ADT 22.6.2 timed-out threads - org.osgi.framework.BundleException: State change in progress for bundle - -

adt-bundle (eclipse-based distribution google) after updating latest 22.6.2 fails start or freezes in error log view see lot of "while loading class ... thread ... timed out", this eclipse.buildid=v22.3.0-887826 java.version=1.7.0_11 java.vendor=oracle corporation bootloader constants: os=win32, arch=x86_64, ws=win32, nl=zh_cn framework arguments: -product com.android.ide.eclipse.adt.package.product command-line arguments: -os win32 -ws win32 -arch x86_64 -product com.android.ide.eclipse.adt.package.product continuation of log file d:\workspaces\adt-bundle\.metadata\.bak_0.log created time: 2014-04-09 09:36:22.882 warning wed apr 09 09:38:18 cst 2014 while loading class "com.android.ide.eclipse.adt.internal.utils.fingerprintutils", thread "thread[main,6,main]" timed out waiting (4609ms) thread "thread[worker-0,5,main]" finish starting bundle "com.android.ide.eclipse.adt_22.6.2.v201403212031-1085508 [567]". avoid deadlock, th...

I can't get my html to link to css files on the server -

Image
i started setting first live personal site, hosting through ipage. despite fact worked great on local environment, cannot html link css files on server. have inlcuded picture shows directory structure , relevant code. file working calculator.html. {edit} uploaded picture small see, here link http://i.imgur.com/03x5ffa.png i tried uploading stylesheet same directory calculator.html , changing href of link element "buttonstyle1.css" did not work either. additionally, can't figure out in directory structure supposed put index.html such www.abc.com(obviously not real domain) call index file. index file in it's current position have type www.abc.com/index.html. ignore home.html, file provided , haven't deleted yet. have type www.abc.com/home.html reach it. typing www.abc.com results in nothing, default isp search result page. what works me on ipage putting / before link. tell server needs start root path.

ruby - Github API responding with 'Content is not valid Base64' -

i getting 'content not valid base64' error when posting certain, simple, piece of content github using api. content unit = $("<li class='s clearfix'></li>"); i using base64.urlsafe_encode64 encode content. content = 'unit = $("<li class=\'s clearfix\'></li>")'; url = "https://api.github.com/repos/#{github_user}/#{github_repo}/contents/#{path}" restclient.put(url, { message: "my message", content: base64.urlsafe_encode64(content), encoding:"base64" }.to_json, { params:{access_token:access_token },accept:'json'}){ |response, request, result| puts response.code puts response } i getting reponse: 422 {"message":"content not valid base64", "documentation_url":"https://...

jquery - Calling a user defined function as callback parameter in fadeOut() -

a basic question: $(element).fadeout("slow",myfunction()); this doesn't work. correct way it? try $(element).fadeout("slow", myfunction); your code, i.e. adding () run code rather defining callback. just quick console playing: function test() {} typeof test // "function" typeof test() // "undefined" so argument needs function , not function returns (except function, too).

javascript - jQuery: Get inner HTML from a HTML code within a variable -

i have variable contains html element: alert(adata[3]); gives me: bla bla bla <div style="display: none"> <table>....</table> </div> i'm trying figure out how contents within div-tag variable adata[3] via jquery. tried various things: elem = $(adata[3]).find("div"); alert(elem.html()); // or elem = $(adata[3]).find("div"); alert(elem[0].html()); // or elem = $(adata[3]).find("div"); alert($(elem[0]).html()); // or elem = $(adata[3], 'div'); alert(elem.html()); can't of work. how correct version? :( lot find looks descendants of elements in jquery object, div highest level element in html (it isn't descendant of anything). just don't use find . elem = $(adata[3]); alert(elem.html());

osx - detecting altKey on MacOS in zoomchart -

i'm implementing functionality create link between 2 nodes on shift+alt+click. this function graphselectionchange(event){ var selection = event.selection; if (selection.length === 2 && event.altkey){ var fromitem=selection[0]; var toitem=selection[1]; chart.adddata({ links:[{ "id":"ll"+nextid, from:fromitem.id, to:toitem.id, "style":{"label":"newlink"} }] }); nextid += 1; } } the altkey seems not detected. according http://jsfiddle.net/rw4km/ alt/option button on keyboard. clue? use click event (it has selection attribute). selection event not have altkey property. there other selection changes, selected nodes disappearing, not have associated mouse clicks not want link added in such case.

jquery - load a google map url inside a div -

i have customized map google maps engine , have corresponding url. want load url inside div using simple load() method. unfortunatelly, p3p error message. jquery('#map-canvas').load( "https://mapsengine.google.com/map/edit?whatever", function() { alert( "load performed." ); }); the error i'm getting: not p3p policy! see http://www.google.com/support/accounts/bin/answer.py?hl=en&answer=151657 more info. info in link not usefull expected. hints? how can accomplish p3p policy , load map? $(function() {$("#map").googlemap({zoom: 10, // initial zoom level (optional)coords: [48.895651, 2.290569], // map center (optional)type: "roadmap" // map type (optional)});})

batch file - Difference between running a command from cmd.exe or Windows Run -

i'm trying run application user , while works nicely in cmd.exe prompt, doesn't work if go windows run prompt (it depends on application i'm trying run). for example, works fine both cmd.exe or w-run prompt (using either windows xp or windows 7): runas /user:me regedit.exe while works in cmd.exe prompt (it ask password in both cases nothing after if launched w-run on either winxp or w7): runas /user:me services.msc it's kind of inconsistent, cmd works windows run, it's unreliable , random. any ideas there such difference? around problem, i'm using batch files launch applications user , type batch file full path in windows run prompt. ensure reliability still know if i'm doing wrong. cmd /k "runas /user:me ""regedit.exe"" && exit" the "problem" runas it needs command 1 argument, if running arguments have enclose command in quotes, , if command includes own quotes, need escaped. it ...

Identifying a pattern -

while designing android application i've created classes related between them. i sure kind of pattern/relationship popular , know more naming classes , learn more pattern (to improve design) i have class, book , basic attributes: title , author , synopses . the books stored in files, 1 file per book, , there class manage file operations load/save/delete. i've called class bookmanager . the mainactivity has bookmanager operations ask available books, retrieve book, save modified book, etc... what name of kind of relationship between objects? your bookmanager seems data mapper , which, martin fowler wrote it, is: the data mapper layer of software separates in-memory objects database. responsibility transfer data between 2 , isolate them each other. data mapper in-memory objects needn't know there's database present; need no sql interface code, , no knowledge of database schema. (the database schema ignorant of objects use it.) since it's...