Posts

Showing posts from May, 2011

Can ActiveAdmin serve individual javascript files in development via Rails asset pipeline? -

i've configured activeadmin include own javascript, following these instructions active admin: including javascript . in initializers/active_admin.rb : config.register_javascript 'application.js.coffee' but 1 massive precompiled application.js served me (application.js.coffee require s many small files); in development mode when visit active admin pages. still want individual javascript files served individually easier debugging. there way this? put in development.rb : config.assets.debug = false

x11 - What Mechanism does compiz use when copying from a xclient's frontbuffer to the backbuffer of root window? -

what mechanism compiz use when copying xclient's frontbuffer backbuffer of root window? i can't seem find procedure in compiz source. there function calls whenever xclient's window' frontbuffer updated update root backbuffer? copiz uses x composite extension redirect windows offscreen pixmap. uses glx_ext_texture_from_pixmap extension glx/opengl transfer offscreen pixmaps opengl textures. for composition composite enabled x server provides special composite window layer, placed between root window (and windows of root window parent) , screen saver layer. compiz creates window in composite layer, creates opengl context window , performs composition using opengl drawing commands. there compositors don't use opengl. either use server side composition (which rather useless, except testing composite protocol itself) or use xrender drawing methods. technically x core drawing methods work, too, don't support transformations , scaling; things you

c++ - Whats wrong with the following code -

i have written down code in c++ make words appear in array string input. doesn't works due overflow or something. compiler doesn't show error though. #include <iostream> #include <stdio.h> #include <string.h> using namespace std; int main() { char a[100]; gets(a); char b[100][100]; int i=0; for(int j=0;j<strlen(a);j++) //runs loop words { int k=0; { b[i][k]=a[j]; k++; } while(a[j]!=' '); i++; } cout<<b[0][0]; return 0; } if you're going use c strings, need add null terminator @ end of each string do { b[i][k]=a[j]; k++; } while(j+k<strlen(a) && a[j+k]!=' '); b[i][k] = '\0'; as ppeterka noted, need change loop exit condition avoid infinite loop. note repeated calls strlen here , in code wasteful. should consider calculating once before for loop instead.

javascript - Call variable number of functions in parallel? -

using async.parallel or custom control flow, arr = [1, 2, 3, 4, 5, 3, 2, 3, 4, 5] //arr length get_something = function(num, cb){ async_io(num, function (err, results){ cb() }); } i want run get_something() on each member of array in "parallel". when they're finished i'd callback called results. without async : var n = arr.length, results = new array(n), oneisdone = function(index, result){ results[index] = result; if (--n===0) callback(results); } arr.foreach(function(val i){ get_something(val, function(result){ oneisdone(i, result); }); }); with async : using async supposes asynchronous function accepts callback returning error first argument , result second, final callback : async.parallel(arr, get_something, callback); if functions don't follow norm, you'll have make ugly wrappings.

objective c - NSDate. Creating new date with same time -

i have existing nsdate object represents date , time of event. task make copying function of existing event other date attributes except day , month(but saving of hours , minutes). see nsdate documentation here no direct method this. can add few days standard methods or nsdatecomponents new date set calendar, not adding or substracting quantity days. is right way extract "hh:mm" string previous date, set formatted string , convert new nsdate? converting , string not best way. suggestion make nsdatecomponents date. can set month , day directly, , convert date.

html - Bootstrap 3 Overlap -

i using bootstrap 3 , these 2 grids i'm using in js fiddle demo below stack on top of each other instead of overlapping. <div class="col-xs-12 col-md-8"> overlaps on <div class="col-xs-6 col-md-4"> i need them stack on each other ""nav nav-pills nav-stacked" isn't hidden. js fiddle example demo here html code <div class="container"> <div class="row"> <div class="col-xs-6 col-md-4"> <ul class="nav nav-pills nav-stacked" style="max-width: 300px; background-color: #fff;"> <li class="active"> <a href="#">link1</a> </li> <li> <a href="#">link2</a> </li> <li> <a href="#">link3</a> </li> <li>

ruby - Alternative to "rescue Exception" -

i unexpected errors on occasion such timeout errors, 503 errors, etc. there errors don't know may receive. can't account of them doing like: rescue timeout::error => e it's terrible idea rescue exception . what alternative use? want code rescue of them when there error; if there no error, need avoided. want able kill script not skip on syntax errors, etc. you can rescue standarderror , or rescue, same: rescue standarderror => e # or rescue => e you can see in following table exceptions rescued standarderror - note subset exception , , conceitually should errors ok catch. of course can have gems defines exception in wrong place, should not happen in well-developed gems. ruby exceptions http://rubylearning.com/images/exception.jpg i rescue exceptions know how handle, except when add in log/backtrace system consult errors later. if case, rescue standarderror

java - How to read text files without defining the location? -

i'm starting build jframe application work file handling. i'm trying done application that it reads contents of texts files in particular location , merges contents & creates 1 single text file. the main property application should have should not have navigate-to-location feature. suppose if paste application in location c:\users\desktop\application.exe, application must search location text files (i.e. on desktop) & merge them 1 single text file. i've observed in patch tools patch softwares, never ask location software's_launcher.exe, tell paste patch in directory launcher belongs. how it? how can same own application? "./" specify current directory. if use file f1 = new file("./"); then f1 reference of current directory. if application @ c:\users\desktop\application.exe place files & folder @ c:\users\desktop can access "./" string

Using Drupal's node form in a new page -

in custom module want have page defined in hook_menu, shows add form specific content type, modifications form. so far it's working, , saving new node, default values i'm setting in code, i.e. it's not picking user types form. checked , $form_state['input'] contains inputted values, $form_state['values'] doesn't, new node gets saved wrong. here's relevant code: function mymodule_menu() { return array( 'admin/content/myadd/%' => array( 'title' => 'my custom add page', 'page callback' => 'mymodule_node_add', 'page arguments' => array(3), 'access callback' => true, 'type' => menu_callback, ), ); } function mymodule_node_add() { module_load_include('inc', 'node', 'node.pages'); //i'm doing print here instead of returning because i'm calling page //in ajax popup, don't want whol

io - How to get a string from a Reader? -

in strings module, there function func newreader(s string) *reader create reader string. how can get/read string strings.reader ? you can use ioutil.readall : bytes, err := ioutil.readall(r) // err management here s := string(bytes)

iphone - Don't play HTML5 audio when vibrate switch is on -

i've writing little web app target iphone initially. 1 of it's functions play audio file when icon clicked. following code: $('#quicksample').click( function() { $('#thesound').get(0).play(); }); then relevant html is: <audio id="thesound" src="demo.mp3"></audio> <div class="icon"> <a href="" id="quicksample" title="quick sample"> <i class="icon-volume-up icon-2x"></i> </a> </div> the problem i'm having plays audio file when iphone switched silent or vibrate mode. want nice , not play sound when phone in vibrate mode. can test vibrate mode , skip playing if it's on? there better way? expected default behavior.

docusignapi - Filling out documents with DocuSign embeded -

we redirect user our portal sign documents. 1 of documents, skills checklist, needs completed , signed. possible user go through document , complete form fields within docusign ? i.e., same way user might fill out editable pdf. these check boxes , forms can vary in length 30 check boxes several hundred. yes can docusign rest api. docusign helps manage entire document workflow through stick-etabs: http://www.docusign.com/developer-center/explore/features/stick-etabs . you can add checkboxes, text fields, dates, etc. documents , templates , can use rest api programmatically add them when needed, when have lot several hundred have mentioned. add stick-etabs (such check boxes) through api have add them in json or xml formatted request bodies. generically, list each different tab type want add, such as: "tabs": { "signheretabs": [{ }], "checkboxtabs": [{ }], "datesignedtabs": [{ }], ... } however please note ther

android - ActionBarSherlock narrow items in ActionBar are not centered -

i'm using actionbarsherlock library, activity has flag android:uioptions="splitactionbarwhennarrow", actionbar's items in bottom of screen items described in xml file <menu xmlns:android="http://schemas.android.com/apk/res/android"> <item android:id="@+id/menu_0" android:title="@string/action_0" android:showasaction="always"/> <item android:id="@+id/menu_1" android:title="@string/action_1" android:showasaction="always"/> <item android:id="@+id/menu_2" android:title="@string/action_2" android:showasaction="always"/> </menu> i'm inflating menu public boolean oncreateoptionsmenu(menu menu) { menu.clear(); menuinflater supportmenuinflater = getsupportmenuinflater(); supportmenuinflater.inflate(r.menu.inbox_conversation, menu); return super

Mahout error: Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.2.1 -

i mahout newbie. i trying implement recommender discussed in following post: https://code.google.com/p/unresyst/wiki/createmahoutrecommender i trying using netbean ide, , receive following error: failed execute goal org.codehaus.mojo:exec-maven-plugin:1.2.1:exec (default-cli) on project mahoutrec: command execution failed. process exited error: 1 (exit value: 1) -> [help 1] see full stack trace of errors, re-run maven -e switch. re-run maven using -x switch enable full debug logging. following java code: package com.mahout; import java.io.file; import java.io.filenotfoundexception; import java.util.list; import java.io.ioexception; import org.apache.commons.cli2.optionexception; import org.apache.mahout.cf.taste.common.tasteexception; import org.apache.mahout.cf.taste.impl.model.file.filedatamodel; import org.apache.mahout.cf.taste.impl.recommender.cachingrecommender; import org.apache.mahout.cf.taste.impl.recommender.slopeone.slopeonerecommender; import org.apach

Hudson : Directory not found -

using hudson , try run job tests. job run .bat file in have command line subset v: "c:\a_directory\" when line executed in console of hudson error the directory "c:\a_directory\" not found . directory exists , can access manually. what might problem? must specify relative path workspace of hudson? the command in question tries create virtual disk. used syntax wrong. here correct 1 : subset v: "c:\a_directory"

java - Groups break hierarchical layout in JGraphX -

Image
i find if introduce groups in simple graph laid out hierarchical layout, group incorrectly positioned. for example, here simple graph: public class hierarchicallayoutwithgrouping extends jframe { public hierarchicallayoutwithgrouping() { super("hierarchical layout grouping test"); mxgraph graph = new mxgraph(); object parent = graph.getdefaultparent(); graph.getmodel().beginupdate(); try { object transfer1 = graph.insertvertex(parent, null, "transfer data1.csv", 0, 0, 100, 40); object transfer2 = graph.insertvertex(parent, null, "transfer data2.csv", 0, 0, 100, 40); object load1 = graph.insertvertex(parent, null, "load data1.csv", 0, 0, 100, 40); object load2 = graph.insertvertex(parent, null, "load data1.csv", 0, 0, 100, 40); graph.insertedge(parent, null, null, transfer1, load1); graph.insertedge(parent, null,

MySQL where clause that should not work but returns all table contents -

this query returning table contents. me not valid clause. have idea why works? select * tablename 1 in mysql, true costant value = 1, while false = 0, query eqivalent to: select * tablename true also, conditions converted either 0 or 1: select 'a' = 'a' will return 1, while select 'a' = 'b' will return 0 example following queries equivalent: select * tablename true select * tablename 'a' = 'a' select * tablename 1 but every value <> 0 considered true well, return rows: select * tablename 2 but if value <> considered true, 1 expect following query work: select * tablename 2 = true but won't return anything, because 2 = 1. yes, mysql little weird.

android - Creating an array of button sprites with andengine NullpointerException -

i've been racking brain trying figure out day. had enough trouble getting database work (which now). problem i'm having null pointer exception. here important part of file (its way big post whole thing. db = new mydatabase(activity); attackcursor = db.getplayerattackweapons(); attackbuttons = new buttonsprite[attackcursor.getcolumncount()]; if (attackcursor != null) { attackcursor.movetofirst(); while (attackcursor.isafterlast() == false) { attackbuttons[attackbuttonscounter] = new buttonsprite(0, 0, playermenu.getplayermenuattacktr(), engine.getvertexbufferobjectmanager()) { @override public boolean onareatouched(touchevent pscenetouchevent, float ptoucharealocalx, float ptoucharealocaly) { if (pscenetouchevent.isactiondown()) { beep.play(); attacktype = attackcursor.getint(0);

audio - Android Soundpool no longer working -

so i've had issue can't quite head around. i've been using static class hold hold soundpool. e.g. public class sound { private static soundpool sounds; private static int charged; public static void loadsound(context context) { sounds = new soundpool(5, audiomanager.stream_music, 0); charged = sounds.load(context, r.raw.charged, 1); } public static void playcharged() { sounds.play(charged, 1, 1, 1, 0, 1); } then in oncreate method of main activity ( extends basegameactivity ) following: setvolumecontrolstream(audiomanager.stream_music); sound.loadsound(this); so play sound go sound.playcharged() game object attribute of main activity. before, worked great. i'm not sure when stopped working but, can assume once started making major changes. supported google play services put game object in activity. none of sounds play. however, found sounds play if call method play them within constructor gam

Replacement by dictionary possible with AWK or Sed? -

you have dictionary, dictionary.txt, , input file, infile.txt. dictionary tells possible translations. solution similar problem in unix shell: replace dictionary seems hardcode things here cannot understand. can come better replacement technique dictionary awk/sed script should able read in multiple files, in simplest case 1 dictionary file , 1 infile. how replace elegantly dictionary awk or sed? example dictionary.txt 1 1 2 two 3 three 4 fyra 5 fem infile.txt one 1 hello hallo 2 3 hallo 5 five output command, after command awk/sed {} dictionary.txt infile.txt one 1 hello hallo 2 3 hallo fem fem awk example selected replacements one-one replacements not working. awk 'begin { lvl[1] = "one" lvl[2] = "two" lvl[3] = "three" # todo: not work # lvl[four] = "fyra" # lvl[five] = "fem" # lvl[one] = "one" # lvl["hello"] = "hello" # lvl[hallo] = "hallo&qu

Perl glob strange behaviour -

i have piece of perl code: if (glob("$data_dir/*$archivefrom*")) { $command1 = "zip -r -t -m $backup_dir/$archivefrom.zip $data_dir/*$archivefrom*"; $err_cmd1 =system("$command1"); if ($err_cmd1 != 0){print "error $command1\n";exit 1;} } sometimes if returns true zip not match anything, why happen? there no concurrent processes remove files in meantime, it's glob returning different zip archive match files, returns non-empty result though should empty. the glob function in scalar context becomes iterator, not test file existence! can demonstrated following code: use feature 'say'; @patterns = ('{1,2,3}', 'a', 'b', 'c'); $pattern (@patterns) { $item = glob $pattern; $item // "<undef>"; } output: 1 2 3 <undef> that is, glob remembers first pattern given, iterates on matches, not use new patterns given until iterator exhausted. therefore in

regex - Regular Expression up to but do not include character -

this has been done before , have tried customize regex based on other entries in stack exchange having hard time grasping it... what need match query string parameter in rewritecond , take parameter value of cond , insert in new string. my cond is: wt.mc_id=(\s+&|\s+$) this gives me close need. not want & in %1 value rewriterule. so when gives me wt.mc_id=foo&bar=whatever want foo , not foo& . don't want empty string can check in code. use regex instead: (^|&)wt\.mc_id=([^&]*)

PHP, HTML: Submit form automatically -

i have php page html form on it. if variables set in url automatically submit form on page. ie: if (isset($_get['var'])) { // submit form } else { // leave page alone } edit: here have using answer provided below, it's still not working. form submit if condition met. <?php if ($r == 1) { echo " <br> <form action=\"bookroom.php\" method=\"post\" id=\"dateform\"> <input name=\"from\" type=\"hidden\" value=\"$fday/$fmonth/$fyear\"> <input name=\"to\" type=\"hidden\" value=\"$tday/$tmonth/$tyear\"> <input type=\"submit\"> </form> <script type=\"text/javascript\"> $('#dateform').submit(); </script> "; } ?> using pure javascript instead of jquery : <?php if (isset($_get['var'])) {?> <script type="text/javasc

java - Link to shared library from Android library project with ndk-build -

i have android library project 'a', contains native c++ sources in 'a/jni' folder nicely build 'a/libs/armeabi-v7a/liba.so' , related other platforms. i want make android project 'b' consists of java stuff more native c++ sources in 'b/jni' folder. these sources use code c++ library of project 'a'. have managed compile these fine setting local_c_includes := (path_to_a/jni) (i.e. picks header files project 'a'). the question: how link 'a/lib/armeabi-v7a/liba.so' in clean way? i have read import_module documentation, seems geared towards situation in want link pure-ndk module, not library sits inside android library project. first create module compile liba.so library prebuilt shared library in project b. include $(clear_vars) local_module := liba local_src_files := path/to/liba.so include $(prebuilt_shared_library) then, add module main module of project by: local_shared_libraries := liba

Excel headers/footers won't change via VBA unless blank -

disclaimer: it's been few years since worked (a lot) vba, might issue caused confusing myself different language deal with. so; i've got workbook (excel 2010) multiple sheets (20+), of whom multi-page. make things easier when printing everything, want add sheet-specific headers amongst others name of sheet, number of pages , on. i've written tiny function should (in theory) me iterating on sheets setting header. however, reason works if header empty; if has value refuses overwrite unknown reason. dim sheetindex, numsheets integer sheetindex = 1 numsheets = sheets.count ' loop through each sheet, don't set of them active while sheetindex <= numsheets dim sheetname, role, labeltext string sheetname = sheets(sheetindex).name role = getrole(mode) labeltext = "some text - " & sheetname & " - " & role sheets(sheetindex).pagesetup .leftheader = labeltext .centerheader = ""

html - How to style widget with post count different than without post count -

i have border below li elements in wordpress widget types appropriate. element inside set block gives them nice easy click full width. the problem, when choose option "show post count" when adding widget such categories or archives displays post count plain text after tag , because tag block pushes post number text line below. whether choose show post count or not show post count still gives exact same element identifyer example "widget_categories". how style post count not on next line still keep links non post count list items full width? here's example on sidebar www.bbmthemes.com/themes/modular/blog-standard/ in order solve problem need remove display:block; for ul.widgets ul a , add in it's place line-height: 33px; what going achieve have same visual effect. what going lose doing links going work on text , not on "box". the other way out of find post count coming , make changes this. example change text count i

ruby - Is it possible to have an rspec double with a default response? -

i want mock object might receive number of messages don't care about. i'd object have default answer, such 'true', ability add specific methods , answers matter. possible in rspec? i'd this: obj = default_double(default: true, widget_count: 5) obj.foobar.should == true obj.widget_count.should == 5 it'd nice if pass in lambda or proc return value , have default_double return evaluation of lambda. extra-nice if proc or lambda evaluated in context of test, access variables available in example. so if features above added, might have like: @widgets = widgetcontainer.new @widgets.widget_count = 5 obj = default_double(default: true, widget_count: lambda { @widgets.widget_count }) obj.foobar.should == true obj.widget_count.should == 5 if motivation feature interesting reader, let's assume either don't want dig , find out possible messages receive, or set of possible messages extremely large or unknown. is built in rspec? ok, i'l

ios - Restoring non-autorenewing purchases -

does app have offer restore non-autorenewing subscription purchases (the way required 1 time purchases) or should implemented through "infrastructure" apple requires build sharing purchases among different devices? i ask because in testing mode, when try restore type of transactions, empty list apple. thanks in advance! sam per response on apple developer's forum, non-renewing subscriptions not restorable.

mysql - Pass a dynamic variable through URL php -

Image
i'm not sure title, tried best. have table displayed information database using file display.php <?php mysql_connect("localhost", "root", "root") or die(mysql_error()); mysql_select_db("tournaments") or die(mysql_error()); $result = mysql_query("select * tournies") or die(mysql_error()); echo '<table id="bets" class="tablesorter" cellspacing="0" summary="datapass"> <thead> <tr> <th>tournament <br> name</th> <th>pot</th> <th>maximum <br> players</th> <th>minimum <br> players</th> <th>host</th> <th></th> <th></th> </tr> </thead> <tbody>'; while($row = mysql_fetch_array( $result )) { $i=0; if( $i % 2 == 0 ) { $class = &quo

php - How to pass an array of parameters to the bind_param? -

i'm getting folowing error: warning: wrong parameter count mysqli_stmt::bind_param() i believe it's because i'm assigning parameters bind_param method wrong way. question how pass array of parameters bind_param? this function: function read($sql, $params) { $parameters = array(); $results = array(); // connect $mysql = new mysqli('localhost', 'root', 'root', 'db') or die('there problem connecting database. please try again later.'); // prepare $stmt = $mysql->prepare($sql) or die('error preparing query'); // bind param ???????????? call_user_func_array(array($stmt, 'bind_param'), $params); // execute $stmt->execute(); // bind result $meta = $stmt->result_metadata(); while ( $field = $meta->fetch_field() ) { $parameters[] = &$row[$field->name]; } call_user_func_array(array($stmt, 'bind_result'), $parameters); // fetch

Linq data structuring -

i have 2 issues i'm struggling linq. appreciate if advise. have 2 lists rawstates (storing rows of entity-downtime-uptime-eventtype ) , rawdata list storing products' in , out times entity. i want select elements rawstates occurred when still waiting entity processed foreach(var t in rawdata) var s = rawstates //i not sure if single logic clause in enough; .where(o => o.entity == t.entity && o.downdate > t.intime && o.update < t.outtime) .tolist(); if group rawdata productid (there multiple rows same productid ), how can revert "s" these groups productid can group eventtype , , summarise durations productid ?

javascript - Uncaught Error: Syntax error, unrecognized expression -

getting above error when running jquery function. i whole html document passed me finding wrong bit hard , not 100% sure might causing it. changing html content within location when button clicked. (loading more articles , removing rest) function attachmorearticlesaction() { $('.more-posts div a').click(function(e) { e.preventdefault(); e.stoppropagation(); var url = $(this).attr('href'); $.get(url, function(html){ var body = $(html).find('.member').html(); $('.member').append(body); attachmorearticlesaction(); }); return false; }); } thats function using. tell me why getting error. thanks heaps. remove line feeds $(html.replace(/\n/g,""))...

android - Trouble with Code Executing After startActivity() -

i creating quiz app. in code below, want code after startactivity(intent); execute once activity has finished. app in current state display question text , answer buttons. once user makes choice, next question , corresponding answer buttons displayed split second before new activity launched. want app go straight new activity upon answer selection, , once new activity has finished, display next question. my code: intent intent = new intent(getapplicationcontext(), newactivity.class); startactivity(intent); // helper variable keep track of current question questioncounter++; if(questioncounter < numgamequestions) { // displays next question playgame(randquestionsarr[questioncounter]); } 1 add definition public static final int request_code = 100; 2 replace startactivity() startactivityforresult(); startactivityforresult(intent, request_code ); 3 before finishing activity in child activity,call setresult method; setresult(result_ok); 4 add things

javascript - How does Pinterest keep their image height proportionate -

i want load in bunch of random images (of varying widths , heights) column. column have fixed width, , height have cropped off proportionally keep image in it's original height width ratio. (similar how pinterest structures boards.) anyone know how accomplished javascript or jquery? you can use css: img.autosize { width: 500px; /*specify width here*/ height: auto; } this keep images in site fixed width (use max-width in case don't want of them exact same width) , height adjust accordingly maintain aspect ratio. of course, if want use javascript or jquery, can set css properties in script. hassle-free way it.

java - Unable to locate tools.jar -

i building project in java. i have error: unable locate tools.jar. expected find in c:\program files\java\jre6\lib\tools.jar i have installed jdk , folder: c:\program files\java\jre6\lib in system file tools.jar not there. yes, you've downloaded , installed java runtime environment (jre) instead of java development kit (jdk). latter has tools.jar, java.exe, javac.exe, etc.

How can scrolling banner work on Android tablet HTML veiwer? -

i using dreamweaver plug-in "flevpersistentdivs.mxp" produce flash banner , down page scroll pulled flash banner slide , down along. flash banner format swf. works on computer when test banner disappear when test on android tablet html viewer.how can works on tablet? you have install android version of adobe flash, since adobe no longer supports android platform, i'd suggest replace swf else, either html5 + javascript or java code in android app.

ubuntu - How to configure git to clone repo from github behind a proxy server -

all, encountered problem git on github on ubuntu. have configured proxy setting git config --global http.proxy proxyserver:port when type git clone git@github.com:myusername/example.git , got following error: ssh: connect host github.com port 22: connection timed out fatal: remote end hung unexpectedly should do? steven i follow steps below access git respositories behind corporate proxy. method works git repositories using git urls "git://something.git"; for git repositories using http urls " http://something.git " use accepted answer link instead. this version uses corkscrew , sets username , password required proxy. install corkscrew (ubuntu) sudo apt-get install corkscrew create credentials file containing proxy username , password echo "username:password" > ~/.corkscrew-auth in case credentials domain\username:password secure auth file chmod 600 ~/.corkscrew-auth cr

spring - Geronimo.out increase too fast -

i have built grails project on geronimo. made own log4j write error everyday, has small size. my problem geronimo.out file increase fast. goes 1gb in few days. tried disable console appender still write geronimo.out file. how can disable that? here server-log4j.properties: ## ## licensed apache software foundation (asf) under 1 or more ## contributor license agreements. see notice file distributed ## work additional information regarding copyright ownership. ## asf licenses file under apache license, version 2.0 ## (the "license"); may not use file except in compliance ## license. may obtain copy of license @ ## ## http://www.apache.org/licenses/license-2.0 ## ## unless required applicable law or agreed in writing, software ## distributed under license distributed on "as is" basis, ## without warranties or conditions of kind, either express or implied. ## see license specific language governing permissions , ## limitations under license. ## ## $rev:

c# - Asynchronous File IO stops after a few megabytes sent -

i trying create asynchronous tpl file server using sockets , networkstream. when testing it, browser small html file (1.9 kb) sends fine, , javascript or css files links send to, won't download more html page, including flash, images, etc. receive no errors, including no connection errors. can download 96k image that's limit. set connection: keep-alive in response headers. does know why output streaming seems stalling? async task<> writetostream(networkstream _networkstream, string filepath, int startingpoint = 0) { using (filestream sourcestream = new filestream(filepath, filemode.open, fileaccess.read, fileshare.read, buffersize: 4096, useasync: true)) { byte[] buffer = new byte[4096]; int numread; while ((numread = await sourcestream.readasync(buffer, 0, buffer.length)) != 0) { _networkstream.write(buffer, 0, numread); } } } i tried replacing this: _networ

java - sqlite query returns column name and string -

i have arraylist in textview prints out names of list sqlite. printing values {salenotes=apples} {salenotes=oranges} etc in textview. want textview instead. apples oranges here database info public arraylist<hashmap<string, string>> getallsalesnames1() { arraylist<hashmap<string, string>> wordlist2; wordlist2 = new arraylist<hashmap<string, string>>(); string selectquery2 = "select distinct salesnotes quick"; sqlitedatabase database = this.getwritabledatabase(); cursor cursor2 = database.rawquery(selectquery2, null); if (cursor2.movetofirst()) { { hashmap<string, string> map2 = new hashmap<string, string>(); map2.put("salesnotes", cursor2.getstring(0)); wordlist2.add(map2); } while (cursor2.movetonext()); } database.close(); return wordlist2 ; } and here in activity

c# - WebDriver reporting child div as "Not Visible" after parent div has been moved too far up, on scrolling SPA -

the webpage in question spa, describe single large div several div "boards" inside it, scroll view applying webkit transform on parent div. unfortunately, once scrolled far, elements returned webdriver "disabled" - webelement property "displayed" false, text property blank, , can't execute clicks/actions on element. visible on page @ time , functional. while investigating problem, created small test webpage see under conditions occurs. link jsfiddle sample page show functionality nb note not using iframes in website, jsfiddle demonstrate functionality. <html><head> <script type="text/javascript" src="jquery-1.8.3.js"></script> <style type="text/css"> .board-nav { font-size: 12px; color: #1b1a1a; margin-right: 10px; vertical-align: middle; } .scroller{ -webkit-transition: -webkit-transform 0ms; transition: -webkit-transform 0ms

multithreading - Why does exiting a Ruby thread kill my whole program? -

i have piece of code: puts "start" loop thread.start puts "hello thread" exit end text = gets puts "#{text}" end puts "done" what expect seeing "start" followed "hello thread" , enter input echoed me. instead "start" , "hello thread" , program exits. from documentation on exit : terminates thr , schedules thread run. if thread marked killed, exit returns thread. if main thread, or last thread, exits process. but thought spawned new thread? why exiting main process? you're looking @ thread#exit documentation. kill kernel#exit terminates ruby script. puts "start" loop thread.start puts "hello thread" thread.exit end text = gets puts "#{text}" end puts "done"

Android Facebook sdk 3.5 share dialog -

hi implementing facebook share dialog android sdk 3.5 not getting success im following guides.. facebookdialog sharedialog = new facebookdialog.sharedialogbuilder(myclass.this) .setapplicationname("app name") .setname("name") .setlink("mylink") .build(); i put inside on touch method there no errors appearing whenever click button.. nothing appears also~ is myclass.this wrong? reply~ this facebook recommends. i've copied code examples this link explained how handle uihelper instance. if don't care results of dialog might ok not use uihelper. using static method check whether dialog can presented prudent because initializes builder , creates dialog if possible present it. if (facebookdialog.canpresentsharedialog(getapplicationcontext(), facebookdialog.sharedialogfeature.share_dialog)) { // publish post using s

Finding the last filled row in Excel sheet in c# -

i have requirement fine how many rows in excel sheet filled data i.e rows not empty. need using c#. currently using following code : excel.application excelapp = new excel.application(); string workbookpath = "c:\\scripttest\\bin\\debug\\sdownloadscripts\\excelresult.xlsx"; excel.workbook excelworkbook = excelapp.workbooks.open(workbookpath, 0, false, 5, "", "", false, excel.xlplatform.xlwindows, "", true, false, 0, true, false, false); excel.sheets excelsheets = excelworkbook.worksheets; string currentsheet = "sheet1"; excel.worksheet excelworksheet = (excel.worksheet)excelsheets.get_item(currentsheet); //long = excelworksheet.usedrange.rows.count; int lastusedrow = excelworksheet.cells.specialcells(excel.xlcelltype.xlcelltypelastcell, type.missing).row; return lastusedrow; } my sheet has 4 rows filled gett

javascript - Background color change on page load -

this markup structure: <div class="authentication"> <div class="form-inputs"></div> </div> i wanted on page load color of authentication slides down top-bottom. color white , blue should slide down top. (like header color fills body). i tried : <script> jquery(document).ready(function($) { $('.authentication').animate({backgroundcolor: '#4bc5da'}, 3000); }); </script> but has fade in effect :( after color change need "form-inputs" should fade in ... know need chain actions im not getting it. you can use dynamic overlay slidedown() animation , fade form when animation completes using callback argument: $blue = $('<div>').css({ background: 'blue', position: 'absolute', width: '100%', height: '100%', top: '0', display: 'none' }).appendto('.authentication').slidedown('slow

c# 4.0 - Access Channels in ANTLR 4 and Parse them separately -

i have included comments in separate channel in antlr 4. in case channel 2. this lexer grammar. comment: '/*' .*? '*/' -> channel(2) ; i want access channel 2 , parse on channel accumulate comments. included in parsing grammar below comment :comment ; in program string s = " paring string" antlrinputstream input = new antlrinputstream(s); csslexer lexer = new csslexer(input); commontokenstream tokens = new commontokenstream(lexer,2); then want parsing on tokens var xr = parser.comment().getrulecontexts<commentcontext>(); because want information commentcontext object such start.column etc. edit: this improved question to more specific, want tokens in channel 2 , parse them using comment grammar comments list( ireadonly<commentcontext> ) can iterate through each of these , access information such as, start line, start column, end line end column, , token text. commontokenstr

c# - Saving custom section to config file -

i have small issue, achieve following result in config file: <customsection> <settings> <setting key="" value="" /> <setting key="" value=""/> ... </settings> </customsection> i've created following code, on first run cannot have created structure values pass! here code initializes configuration code , builds default structure values: configurationsectionmanager config = new configurationsectionmanager("customsection"); config.createdefaultconfigurationsection("customsection"); log("get value = " + (config.getsection() configurationsectionmanager).settings[1].value); //instead of [1] key should set ... now code configuration section manager: public class configurationsectionmanager: configurationsection { private const string defaultsectionname = "default"; private string sectionname; public string sectionname { {

javascript - css responsive dropdown menu - more levels -

Image
i have responsive dropdown menu. i want open submenu on hover/toogle. work 2nd submenu. but when hover 2nd submenu all other submenus open. how prevent menu work correctly? question: how open menu on hover/toggle in deeper sub-menus ? (prevent open submenus) jsfiddle: jsfiddle example html: <a class="togglemenu" href="#">menu</a> <ul class="menu"> <li class="first activeselected"><a href="#">menu 0</a></li> <li><a href="#">menu 0</a></li> <li><a href="#">menu 0</a> <ul class="level1"> <li class="first"><a href="#">menu 1</a></li> <li><a href="#">menu 1</a></li> <li class="last"><a href="#">