Posts

Showing posts from July, 2013

python - Pylab is not installing on my macbook -

mitx 6.00 pylab not installing on macbook running mountain lion running python 2.7.3. have tried installing multiple times can not work. have posted error message below not sure telling me do. if explain error , how fix great. >>> ================================ restart ================================ >>> import pylab traceback (most recent call last): file "<pyshell#5>", line 1, in <module> import pylab file "/library/python/2.7/site-packages/matplotlib-1.3.x-py2.7-macosx-10.8-intel.egg/pylab.py", line 1, in <module> matplotlib.pylab import * file "/library/python/2.7/site-packages/matplotlib-1.3.x-py2.7-macosx-10.8-intel.egg/matplotlib/__init__.py", line 133, in <module> matplotlib.cbook import matplotlibdeprecationwarning file "/library/python/2.7/site-packages/matplotlib-1.3.x-py2.7-macosx-10.8-intel.egg/matplotlib/cbook.py", line 29, in <module> import numpy np

enums - Any simplier way to 'read' enumerated types in pascal? -

user inputs integer corresponds value of defined enumerated type. need assign value variable t . thought of: type test = (red,green,blue,fish); var t:test; n,i:integer; begin readln(n); t:=red; i:=1 n t:=succ(t); end. am overcomplicating task? possible write simpler alogrithm? you should able cast integer enumerated type, example: t := test(n); if want go other way, use ord : n := ord(t); that should let move numerically item in list. can check bounds with: ord(low(test))) and ord(high(test)) ..where test type.

javascript - Accordion does not make page longer -

Image
i using accordion this: the html looks like: <div id="cal-container"> <div id="cal-side"> <div class="accordion" id="accordion2"> <div class="accordion-group"> <div class="accordion-heading"> <a class="accordion-toggle project-header" data-toggle="collapse" data-parent="#accordion2" href="#project-list">projects </a> </div> <div id="project-list" class="accordion-body collapse"> <div class="accordion-inner"> <div class="event-container project-container"> </div> </div> </div>

javascript - Check checkboxes by value -

i have been using code comma separated list of checkboxes checked. $(".hidfeedsids").val($.map($(':checkbox[name=channel\[\]]:checked'), function (n, i) { return n.value; }).join(',')); now need opposite, have list need check checkboxes values on it. can tell me how done? aside fact code isn't syntactically valid... $('input:checkbox').filter(function() { return valuesarray.indexof(this.value) > -1 }).prop('checked', true);

unit testing - using memoize in groovy -

i practicing test driven development in groovy using spock. have 1 set of tests 3 different implementations doing same thing: iterative, recursive, , memoized. have created abstract class hold tests, , created 3 different files return concrete class implementation run tests. have iterative , recursive working, having issues memoize() import spock.lang.specification abstract class fibonaccitest extends specification { private calculator abstract def getcalculator() def setup() { calculator = getcalculator() } def "test canary"() { expect: true } // more tests } class recursivefibonaccitest extends fibonaccitest { def getcalculator() { new recursivecalculator() } } class iterativefibonaccitest extends fibonaccitest { def getcalculator() { new iterativecalculator() } } class memoizefibonaccitest extends fibonaccitest { def getcalculator() { new memoizecalculator() } } cl

android - How do I give superuser access to my app on a device I own and control? -

background we build , control hardware devices on app run. (edit)we build custom version of android os well. we're building app expect "always-on." we want app able self-update, independent of market. hence, hosting service client app periodically poll updates, download apk, , install it. therein lies... the problem i want updateservice install downloaded app update without giving user usual permission , update prompts - after all, control hardware , software. that, think need give app superuser permissions (tho, if there other way, question becomes different). can't figure out how that. i have read superuser app can installed - seems user solution users want root own phones. or solution devs want distribute app needs superuser, don't control device on users install it. is there file somewhere in android os lists apps or users should have su? if so, it's no problem; control everything. first download , run uninstall , install ( s

html - HTML5 (& CSS3?) Create a grid of squares in the background -

i had idea background don't know if can done, , if can, best method be. let idea, it's grid of squares background page when mouse on 1 changes color , shifts back(i know how animation portion). grid supposed span entire page, width , height, , overflow hidden. i'd wish re size if page does so i'm wondering if can done. if can, how generate grid? i'm @ complete loss. ideas? i use <canvas> . or maybe fill entire body equally sized div's height , width defined in percentages. lets grid of 10x10 div's. or can create on -the-fly jquery many div want (to fill whole height). can float div's fill entire viewport, , if window resized use media queries arrange them. on hover, can apply animation on every div. of course, can put other elements on div's.

Can I reduce this reoccurring pattern in my Java class? -

i have following interface: public interface gravy { public list<giblet> getgiblets(); public giblet getgiblet(string id); public int getnumgiblets(); public void addgiblet(); public void removegiblet(giblet giblet); public list<carrot> getcarrots(); public carrot getcarrot(string id); public int getnumcarrots(); public void addcarrot(); public void removecarrot(carrot carrot); public list<gravy> getgravies(); public gravy getgravy(string id); public int getnumgravies(); public void addgravy(); public void removegravy(gravy gravy); } as can see, have reoccurring pattern in gravy . gravy object can contain giblets, carrots, , other (smaller) gravies. of can added to, removed from, or queried. two things note: carrot s , giblet s have bit in common each other, both differ vastly gravy s. i may need add more items later on (thus need refactoring)... is possible reduce above c

Multiple security providers in Grails with Spring Security -

in grails spring security, how can run different spring security plugins different domains? for few methods on controller want them secured normal username/password, stored in database. different domain name though, want use method, in case shibboleth. for example: if acceces example.com/abc redirected user/pass page. if access same webapp sub.example.com/abc led through shibboleth login flow. the idea support users create account , authenticating existing 3rd party account. at start can use filterchain.chainmap change out different filters different urls allow switch between providers, i'm not sure dealing subdomains. doc chainmap .

parsing - ANTLR won't parse this easy input for simple calculator grammar -

grammar testcsharpparser; options { language=csharp3; } @parser::namespace { demo.antlr } @lexer::namespace { demo.antlr } parse returns [double value] : exp eof {$value = $exp.value;} ; exp returns [double value] : addexp {$value = $addexp.value;} ; addexp returns [double value] : a=mulexp {$value = $a.value;} ( '+' b=mulexp {$value += $b.value;} | '-' b=mulexp {$value -= $b.value;} )* ; mulexp returns [double value] : a=unaryexp {$value = $a.value;} ( '*' b=unaryexp {$value *= $b.value;} | '/' b=unaryexp {$value /= $b.value;} )* ; unaryexp returns [double value] : '-' atom {$value = -1.0 * $atom.value;} | atom {$value = $atom.value;} ; atom returns [double value] : number {$value = double.parse($number.text, cultureinfo.invariantculture);} | '(' exp ')' {$value = $exp.value;} ; number : ('0'..'9')+ ('.

javascript - Make multiple text passages take up same space? -

i making page bunch of items on differing headings , text. want headings , text line @ same height. headings 2 lines, 1. needs responsive, can't set min-height. screenshot http://iforce.co.nz/i/cw1tl2gq.vhr.jpg is possible h2's , p's same height? hacky way thinking padding out shorter ones javascript, last resort. the html is: <div class="itemcontainer" style="width:25.0%;"> <div class="catitemview groupprimary"> <div class="catitemheader"> <h3 class="catitemtitle"> <a href="/index.php/projects/item/46-wairamarama-onewhero-seal-extension">wairamarama-onewhero seal extension</a> </h3> </div> <div class="catitembody"> <div class="catitemimageblock"> <span class="catitemimage"> <a href="/index.php/projects/item/46-wairamarama-one

Printing Parameter Values returning Unexpected Result, Python -

i have following python script snidbit: inlines = sys.argv[0] arcpy.addmessage(inlines) the input parameter multivalue input whereby user can navigate file locations , choose multiple files input. when print out variable, follwoing: y:\2012_data\infrastructure.gdb\buildings;'z:\data 2009\base.gdb\creeks_utm';'z:\data 2009\base.gdb\lakes_utm' notice on z:drive, returning path single quotes around it, whereas y:drive not. believe caused spaces in z:drive paths. there way force z:drive paths return without quotes? thanks, mike i managed solve issue. python handles parameters differently because of path names. in first parameter, there no spaces in file path. in other 2 parameters, there spaces. python doesn't spaces, forces file path string value. wrote code override this.

mysql - Select from table A which does not exist in table B -

i trying compose select statement mysql select table not exist in table b. example: table a: +------+ | band | +------+ | 1 | | 2 | | 3 | | 4 | | 5 | +------+ table b: +------+ | hate | +------+ | 1 | | 5 | +------+ so if table bands, , table b bands hate, want bands not hate. result of select should be: +------+ | band | +------+ | 2 | | 3 | | 4 | +------+ how write single select this? here last attempt: select * left join b on a.band = b.hate b.hate null; edit: line above has been fixed! see comments below..."= null" versus "is null". i use join select a.* left join b on a.band = b.hate b.hate null; remember: create appropriate indexes table

java - Shuffling Gridview items without repeats tried many approaches -

i may losing live. have been trying write method shuffle images on gridview uses imageadapter. inexperienced @ android. have accessed questions on site relating shuffling arrays no repeats. have tested them in normal java environment. there ones work no repeats. have tried changing array arraylist , used collections.shuffle. still repeats or emulator has crashed. appreciate insight on this- it's simple cannot it. here of methods (using code have found). public integer[] myshuffles(integer []ji){ arraylist<integer> numbers = new arraylist<integer>(); random randomgenerator = new random(); while (numbers.size() < 36) { int random = randomgenerator.nextint(35); if (!numbers.contains(random)) { numbers.add(random); } } (int i=0; i<ji.length;i++) { ji[i] =ji[numbers.get(i)] ; // i++; } return ji; } another static int[] shufflearray(int[] ar) { random rnd = new

Java/Hibernate: How to detect, if field is lazy-loaded proxy and not actual data? -

i'm converting entity dto , want set null dto value fields, lazy-loaded , not initialized (because not want transfer data time). i've tried: if (!(entity.getnationality() instanceof hibernateproxy)) this.setnationalityfromentity(entity.getnationality()); but did not seemed help. suggestions welcome! thank you! they way in our entities have boolean methods check in way not trigger lazy loading. example, if our entity had associated entity called 'associatedsomething', method check if associated entity has been lazy loaded be: public boolean isassociatedsomethingloaded() { if (associatedsomething instanceof hibernateproxy) { if (((hibernateproxy)associatedsomething).gethibernatelazyinitializer().isuninitialized()) { return false; } } return (getassociatedsomething() != null); } note: it's important not use getassociatedsomething() in check, makes sure associated entit

java - Swing autocomplete for large, expensive datasets -

i'm trying implement autocomplete swing jtextfield set of possible autocomplete entries can large (10-100k items) , expensive retrieve, searching set of entries reasonably cheap. can point me solution this, preferably in library form? looked @ swingx autocomplete , it's not designed situation don't have indexed access. update: since apparently it's not clear, problem not searching large set of entries expensive (it's not), it's getting complete set of entries, in particular case, expensive , impractical. i've had luck glazed lists . assuming can load whole data set in memory , keep there. i've done 20k items or so.

webkitaudiocontext - Get audio levels from HTML5 Audio Microphone Stream -

on previous stack overflow question, found code: <script> // store reference input can kill later var livesource; // creates audiocontext , hooks audio input function connectaudiointospeakers(){ var context = new webkitaudiocontext(); navigator.webkitgetusermedia({audio: true}, function(stream) { console.log("connected live audio input"); livesource = context.createmediastreamsource(stream); livesource.connect(context.destination); console.log(livesource); }); } // disconnects audio input function makeitstop(){ console.log("killing audio!"); livesource.disconnect(); } // run when page loads connectaudiointospeakers(); </script> which takes audio user's microphone , plays through speakers. want level (amplitude) of input (eg can display red warning if clipping occuring, or tell user need speak up). in above code, how hold of raw data? for example how can log actual numbers console? i'm guessing it's s

Is it possible in C# to open the registry of another computer as read-only without administrator rights? -

is possible in c# open registry of computer read-only without administrator rights? specifically, i'd read localmachine/software/... no. have member of local administrators group on remote machine, , provide appropriate credentials account when trying access registry. remote machine has configured allow access.

twitter bootstrap - Datepicker calendar doesn't display in modal -

i new coding , having trouble getting bootstrap-datepicker ( https://github.com/nerian/bootstrap-datepicker-rails ) open correctly. while modal works, datepicker not - i'd appreciate if point me in right direction. i'm not sure whether problem caused by: a) javascript in wrong place? have couple of <script> under <head> , datepicker script right before </body> tag. b) missing file in assets/javascripts? i've added bootstrap.js , bootstrap-datepicker.js here already. c) else? here's html in application.html.erb : <head> <%= stylesheet_link_tag "application", media: "all" %> <%= javascript_include_tag "application" %> <script src="http://code.jquery.com/jquery.js"></script> <script src="assets/javascripts/bootstrap.js"></script> <%= csrf_meta_tags %> <%= render 'layouts/shim' %> </head> <body

object 'Cdqrls' not found when building R packages using devtools -

i got error title shows error: object 'cdqrls' not found i use devtools building r packages, , 1 function in current package, used .call(cdqrls, x[, id1, drop=false] * w, w * z, epsilon) and includes lm.c file in src folder, includes: ... sexp cdqrls(sexp x, sexp y, sexp tol) { sexp ans, ansnames; sexp qr, coefficients, residuals, effects, pivot, qraux; int n, ny = 0, p, rank, nprotect = 4, pivoted = 0; double rtol = asreal(tol), *work; ... directly copied r source files. when used load_all() in devtools , compiles shared objects in src/ (i checked works well) new files: lm.o , mypkgname.so . however, wiki of devtools , found that load_all ignores package namespace if working properly, think running functions, able update namespace file contain usedynlib(mypkgname, cdqrls) . correct? think in way error may disappear... suggestions appreciated! update according @mnel , this post, seems using @usedynlib should work. however, funct

scheme - Matrix Operations? -

as scheme beginner, having tough time figuring out how work matrices. i unsure on how following: a) given matrix, return dimensions of said matrix ex:// '(2 3 4) (1 0 6) should return (2.3) 2 rows, 3 columns b) reverse order of rows in given matrix ex:// given '((1 2) (3 5) (9 0)) the reverse should '((9 0)(3 5)(1 2)) c) same part b reverse order of columns instead d) reverse order of columns , rows thanks in advance! mean lot if give @ all! standard r6rs scheme doesn't provide matrices, though implementations may provide them. usual trick when implementing them use vector of vectors, rather list of lists showed above, because don't want access elements of matrix in order, , vectors provide constant-time access each of elements whereas lists provide linear-time access each of elements. i have small library of matrix operations @ my blog ; can find uses of library search function on blog.

iOS: Finding out who is first responder on a dynamically changed UITableView -

i have uitableview have custom cells uitextfield s in them. uitableview defined on mainviewcontroller , while cells defined in customcell class. each time press button, new cell created. having trouble making cell's uitextfield resign first responder, since cells dynamically added , defined in different class main controller. how do that? lot! tell uitableview endediting: .

linux - plus 100 with the last ip address -

i have list of ip address in foo.txt,like this: 192.168.0.10 192.168.0.11 192.168.0.12 ... want ping them this: ping -c 2 192.168.0.110 ping -c 2 192.168.0.111 ... means last number of ip in foo.txt plus 100. how can write shell script automaticly. thank answer. you use awk: awk 'begin { fs = "." }; { system("ping -c 2 " $1 "." $2 "." $3 "." $4+100) }' foo.txt this separates string ".", uses system make system call command , adds 100 last octet.

php - Using session (memory) vs revalidation (CPU) -

i have web page plots data points on visible area of map based on set of fifteen criteria. user can pan or zoom map, trigger ajax call database, via query script, generate new data based on criteria , bounding box of viewable area of map. current implementation such criteria validated once, via validation script, , stored in $_session array loaded onto query script (unless criteria changes). validation script consists of series of preg_match function , conditional if...else statements. another way can implement above save memory having query script validate fifteen criteria every time user moves map. trade-off higher cpu consumption validation in exchange of lower memory usage doing away $_session array. how quantify trade-off between these 2 options decide better approach given there many users connecting server @ 1 time. the way reliable data test both implementations simulating expected peak number of concurrent users. if not feasible, i'd recommend caching

Python Beginner - How to splice a list of objects with the frequency of an object's attribute -

given: from collections import counter class test: age = 'unknown' city = 'unknown' def __init__(self, a, c): self.age = self.city = c def __repr__(self): return "(" + str(self.age) + "," + self.city + ")" l = [test(20, 'la'), test(30, 'ny'), test(30, 'la')] i count frequency of 'city' attribute: desired output: [[20, 'la', 2], [30, 'ny', 1], [30, 'la', 2]] you're on right track if you're thinking using counter - can't splicing want, will frequencies you. since want frequencies based on city, tell counter cities: freq = counter(l.city l in l) then freq['la'] frequency associated 'la' . want list of tuples (age, city, frequency) - objects in l give age , city directly, , have object gives frequency when give city. means can desired result simple list comprehension: [(l.age, l.city, fre

sql - Oracle equivalent of PostgreSQL's sub-select to array? -

is there equivalent in oracle array subselect if there more 1 row in subselect's results there still 1 row in final results? e.g.: select c.name, array(select order_id order o o.customer_id = c.id) customer c; will return 1 row per customer, second value in each returned row array of order_id's. you can use cursor : select c.name, cursor(select order_id order o o.customer_id = c.id) customer c; then database interface have way of getting results out of cursor result.

android - When using a tethered device to debug, which Google Maps API key do I use? -

i know there number of questions using google maps api key, none of them have been answered since v1 went extinct. having trouble loading in map tiles on mapview. using api key derived debug keystore , debugging using nexus 7 tethered via usb. somewhere believe read if using usb debugging, debug key not work - true? how work around if cannot virtual device run on machine? mapview shows fine, getting "server returns 3" error, understand has key not matching. here's view in layout file, manfiest: <com.google.android.maps.mapview android:id="@+id/map" android:layout_width="fill_parent" android:layout_height="100dp" android:clickable="true" android:apikey="aizasydxlqso2xzo4vhlt3gqzafuoyt081cao8m" android:visibility="visible" /> manifest <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" pack

nginx - Wordpress - PHP Fatal Error - functions.php - while trying to get to wp-admin -

i have w3tc, nginx, varnish , php5-fpm installed on ubuntu 12.04 image 768 mb ram. site functioning fine, when try access /wp-admin http 500 internal server error. i have went logs , have looked , found following error: php message: php fatal error: allowed memory size of 67108864 bytes exhausted (tried allocate 5184285 bytes) in /var/www/wp-includes/functions.php on line 251 while reading response header upstream i have seen many posts says make following settings: increase allocated memory in wp-config.php or wherever need it: define('wp_memory_limit', '64m'); in case php running out of memory, can increase modifying php.ini , restarting web server. memory_limit 256m but haven't had luck. have restored image previous backup , issue still exists. no plugins have been modified or updated since previous time able access backend. i turned wp_debug true , saw this: notice: wp_enqueue_script called incorrect

c++ - Initializing a pointer to point to a character in a string using the pointer pointing to the string -

int ispurepalindrome(const char *sentence){ int i; if (sentence="") return 0; char *begin; char *end; i=strlen(sentence);//i length of sentence string *begin= &sentence(0); *end=&sentence[i-1]; i'm using dev c++. im trying initialize pointer "begin" point first character in string "sentence", keeps giving me error "assignment makes integer pointer without cast." "*sentence" points string entered user in main. ispalindrome function im writing. suppose return 0 if sentence entered in main null. there few issues code: if (sentence="") return 0; should be if (strcmp(sentence,"")==0) return 0; char *begin; char *end; should be const char *begin; const char *end; *begin= &sentence(0); should be begin = &sentence[0]; *end=&sentence[i-1]; should be end = &sentence[i-1];

deployment - error when accessing worklight server deployed on tomcat -

i deploy war file , adapter file tomcat,everything fine,but when try access worklight server,the request [http://10.30.3.11:8080/nantian/apps/services/api/attendance/android/query] and logcat appear error [http://10.30.3.11:8080/nantian/apps/services/api/attendance/android/query]failure. state: 500, response: server unable process request application. please try again later.[http://10.30.3.11:8080/nantian/apps/services/api/attendance/android/query]cannot read property 'errors' of undefined and tomcat appear following error: java.lang.runtimeexception: unique constrain: found 2 beans implementing inteface com.worklight.server.report.api.gadgetreportsservice (in 4 spring application contexts). @ com.worklight.server.bundle.api.servicemanager.getserviceconsumer(servicemanager.java:133) @ com.worklight.core.bundle.coreservicemanager.getgadgetsreportservice(coreservicemanager.java:47) @ com.worklight.core.auth.impl.authenticationcontext.

c# - Adding a Vector2 to List -

i have code public list<vector2> alienposition = new list<vector2>(); (int x = 0; x < alienposition.count; x++) { alienposition[x].add(new vector2((x * 20) + 50, 20)); } and gives me error add doesnt take 1 argument. doing wrong? public list<vector2> alienposition = new list<vector2>(); int somecount = 10; (int x = 0; x < somecount; x++) { alienposition.add(new vector2((x * 20) + 50, 20)); } remove [i] indexer , specify end condition loop > 0 the [i] needed simple arrays. list more high level data structure convenience methods add elements directly list. it's part of list api able add new entries without having specify index new entry. add new entries end of list.

hibernate - Any frameworks for dynamically creating schema on-the-fly to support adhoc JSON object map persistence? -

here requirement trying nail down - there incoming json data represents object map (think nested objects, each having 1 or more attributes) need persist in database. problem not know attributes going come-in in json data. need dynamically build tables columns when data comes-in , okay create string type columns start with. if next request has more attributes given object-type, or, less attributes, different set of attributes, corresponding table created earlier should automatically expanded add new columns , allow persistence of incoming json data. nested objects, each object should go separate table , okay if sort of join or mapping table gets created additionally maintain mapping between two. objects have static "id" attribute, may have numeric number. needs treated specially, in sense object having no "id" attribute should considered "new" object, hence row insert should performed, , id should generated object during persistence. if object ha

distinct - MYSQL using distinction but including an exemption/exclusion condition? -

i using count query select non duplicate records table, i'm using following: function check_profile_views3() { global $connection; global $_session; $query = "select count(distinct profile_id) totalcount2 ptb_profile_views viewed_profile_id=".$_session['user_id']." , profile_id!=".$_session['user_id'].""; $check_profile_views_set3 = mysql_query($query, $connection); confirm_query($check_profile_views_set3); return $check_profile_views_set3; } my table looks this: id | profile_id | viewed_profile_id 1 3 6 2 3 6 3 4 6 4 -1 6 5 -1 6 so in example query selects distinct values , doesnt count values duplicates in profile_id field, however want add exception query count '-1' profile id's counting distinct positive numb

c - Make: *** [] Error 1 -

i've made makefile , trying test getting error in make: austins-macbook:work4 staffmember$ make new rm -f main.o heap.o heap gcc -wall -o2 -c -o main.o main.c gcc -wall -o2 -c -o heap.o heap.c heap.c: in function ‘createheap’: heap.c:6: warning: implicit declaration of function ‘malloc’ heap.c:6: warning: incompatible implicit declaration of built-in function ‘malloc’ heap.c:8: warning: implicit declaration of function ‘exit’ heap.c:8: warning: incompatible implicit declaration of built-in function ‘exit’ gcc -wall -o2 -o heap main.o heap.o austins-macbook:work4 staffmember$ make test ./heap make: *** [test] error 1 i thought getting make * error 1 meant 1 of components did not compile properly, there weren't error messages when compiled it. how find out problem is? ./heap returned non-zero exit code, make interpreting error. make sure doing return 0; @ end of main .

vimeo - autoplay video issue -

i have vimeo video embedded in hidden div. when click link, video pops fancybox, , autoplay starts. my problem in chrome, video starts playing directly when entering site, , can here backgroundmusic of video. how fix this? there 2 ways fix this: wait write iframe lightbox until right when user clicks open it. remove autoplay iframe src , use play() function start playback when lightbox opens.

How to assert java exception in web driver which is displaying through jsp in java? -

i want assert exception message in web driver, display exception message through jsp below. <!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <%@ page contenttype="text/html;charset=utf-8" language="java" %> <%@ page iserrorpage="true" import="java.io.printwriter" %> <html> <head> <title>online accounting software</title> <link type="text/css" rel="stylesheet" href="/stylesheets/main.css" /> </head> <body> <div class="wrapper"> <div class="page-container"> <jsp:include page="/header.jsp" /> <jsp:include page="/mainmenuheader.jsp" /> <div class="blocktenant"> <% // unwrap servletexce

Memory allocation in string concatenation in C# -

let, string = “test”; string b = “test 2”; string c = + b the output of c "testtest 2" i know how memory allocated? string = "test"; you create reference called a , pointing "test" object in memory. string b = "test 2"; you create reference called b , pointing “test 2” object in memory. string c = + b; you allocating new memory address a + b (and process uses string.concat method.) because strings immutable in .net. , c reference assing new memory address. here il code of this; il_0000: nop il_0001: ldstr "test" il_0006: stloc.0 il_0007: ldstr "test 2" il_000c: stloc.1 il_000d: ldloc.0 il_000e: ldloc.1 il_000f: call string [mscorlib]system.string::concat(string, string) il_0014: stloc.2 il_0015: ldloc.2 stloc.0 used, stores value on top of evaluation stack local memory slot

wso2esb - How to compare the values of property in wso2 esb? -

how can compare values of property in wso2 esb i.e want filter operation if property2.value== property1.value should furthur processing else should drop. how not getting? please help. in advance. here example of sequence comparing properties , executing 2 filters: <property name="propertya" value="'abc'"/> <log level="custom"> <property name="propertya" expression="get-property('propertya')"/> </log> <property name="propertyb" value="'abc'"/> <log level="custom"> <property name="propertyb" expression="get-property('propertyb')"/> </log> <property name="propertycompare" expression="get-property('propertya') = get-property('propertyb')"/> <log level="custom"> <property name="propertycompare" expression="get-pr

actionscript 3 - Why is this method causing Flash to crash without even being called? -

i have class called oesdatepicker, name suggests it's date picker. there's method in class returns sprite containing week day names: private function drawweekdays():sprite { var temp:sprite = new sprite(); var wds:array = new array(); var format:textformat = new textformat(); format.font = "tahoma"; format.align = textformatalign.center; format.size = 11; format.color = 0xffffff; trace("here"); /*for( var i:int = 0; < 7; i++ ) { trace(i); wds[i] = new tlftextfield(); /*wds[i].width = cell_size; wds[i].defaulttextformat = format; if( "en" == lang ) { wds[i].text = day_names_en[i]; } else { wds[i].text = day_names_fa[i]; } //wds[i].y = 0;*/ //wds[i].x = margin + * cell_size;

What's the best-practice way to find out the platform ruby is running on? -

i using colored gem coloured printing in terminal , ruby logger. need run code on linux , on windows. on windows, must first require 'win32console' or else coloured printing doesn't work (i see ansi escape characters instead). if require win32console on linux breaks, obviously. what's usual way handle situation in ruby? noticed ruby_platform variable, on windows vm tried "i386-mingw32" or strange. using plus conditional seems pretty flakey way go need, hoping problem has better solution. there's always: begin require 'win32console' rescue loaderror end i find easier write , reason trying decide myself os i'm on , whether or not load it. update: thinking win32console built-in rather gem. believe win32api available on windows installs, it's proxy test "is windows?" (rather "what os this, , windows?"). begin require 'win32api' windowsos = true rescue loaderror windowsos

c# - Insert to datagridview when SELECT query has WHERE condition -

hi use code load , insert data table using datagridview in c# windows application. sqlcommand scommand; sqldataadapter sadapter; sqlcommandbuilder sbuilder; dataset sds; datatable stable; private void form1_load(object sender, eventargs e) { string connectionstring = "data source=.\\sqlexpress;attachdbfilename=|datadirectory|\\database1.mdf;integrated security=true;user instance=true"; string sql = "select * mytable"; sqlconnection connection = new sqlconnection(connectionstring); connection.open(); scommand = new sqlcommand(sql, connection); sadapter = new sqldataadapter(scommand); sbuilder = new sqlcommandbuilder(sadapter); sds = new dataset(); sadapter.fill(sds, "mytable"); stable = sds.tables["mytable"];

ruby on rails - RoR naming convention for methods? -

i've noticed actions have same names, better way? there list of these names? for example in controller see: def new end def create end def destroy end etc... do these specific action hold purpose in ruby on rails? thanks those 7 default actions support restful. these one-to-one mapping crud. can add own action method. more info: rails routing

c# - How to set dynamically textbox required -

i created dynamically text boxes. must field user. want add "requiredfieldvalidator". dont know how add dynamically .user can't go next step without filling these dynamically text boxes. how can control this? this code (int = count; < no; i++) { label lb = new label(); lb.id = "lbfname" + numberofcontrols; lb.text = "first name :"; textbox tbx = new textbox(); tbx.id = "fname" + numberofcontrols; adultslistplaceholder.controls.add(lb); adultslistplaceholder.controls.add(tbx); numberofcontrols++; adultslistplaceholder.controls.add(new literalcontrol("<br />")); adultslistplaceholder.controls.add(new literalcontrol("<br />")); } any idea? try this.. requiredfi

git - Creating a Github repository from local terminal -

how can create github repository local terminal? update : we have create repository , upload data 1 application github , out storing data in application system ... possible actually , many users login in application . enter code , check result in preview frame . here user able store code in github . you can use hub . hub create repo

Openbravo ant build fails -

i trying setup openbravo on eclipse environment above url. development stack setup done successfully. (ant, java, postgresql) at openbravo source directory when apply command ant install.source build failure due errors - /home/pos/sourcecode_openbravo/openbravo-3.0mp21/build.xml:480: following error occurred while executing line: 480 <ant dir="${base.src}" target="compile.complete.development" inheritall="true" inheritrefs="true" /> /home/pos/sourcecode_openbravo/openbravo-3.0mp21/src/build.xml:874: following error occurred while executing line: 874 <jvmarg line="${env.catalina_opts}" /> /home/pos/sourcecode_openbravo/openbravo-3.0mp21/src/build.xml:880: directory 880 <jvmarg value="-djava.io.tmpdir=${env.catalina_base}/temp" /> /var/lib/tomcat6/webapps/openbravo/web-inf/lib creation not successful unknown reason any appreciated. thanks. sounds permission prob

javascript - Masked input field in Trinidad -

primefaces has <p:inputmask> component forces input fit in defined mask input being typed. for example: <h:outputtext value="date: " /> <p:inputmask value="#{maskcontroller.date}" mask="99/99/9999"/> is there equivalent in trinidad? i solved problem adding javascript support jquery - masked input plugin : http://digitalbush.com/projects/masked-input-plugin/ thanks

php - how to post data from array to database -

hello coders. have problem inserting data database, can please me controller function? here php form: <form method='post' action='<?php echo site_url('a3_bus_system/output')?>'> <div class="_25"> <strong>route name/number</strong> <br/> <input type="text" name=""></input> </div> <p>&nbsp;<p>&nbsp;</p></p> <p>&nbsp;<p>&nbsp;</p></p> </p> <div id="div"> </div> <p>&nbsp;</p><div class="_25"> <p><input type="button" name="button" class="button red" id="button" value="add" onclick="generaterow() "/></a></p> </div> <input type='button' value='remove button' id=

zend framework2 - How to access database for custom files -

apart controller, forms, models , views, want create file contains classes common functionality. eg common.php so need make other connection file custom file of mine or there other way use zend database files (config/local.php , config/global.php) and under folder should create file. wrong concept. create yournamespace\stdlib -library classes contain common functionality. classes later injected dependencies need. example: getserviceconfig() { return array( 'factories' => array( 'stdlib-dbstuff' => function ($sm) { $dbstuff = new \yournamespace\stdlib\dbstuff(); $dbstuff->setadapter($sm->get('zend\db\adapter\adapter')); return $dbstuff; } )); } see classes below namespace zend\stdlib examples ;) to use stdlib call classes need servicemanager . alternatively skip servicemanager , inject dependencies on controller-level (which sucks, that's not controllers responsi

pdf - Java Print encoding with Sun PDFRenderer -

i'm beginner in java programming , here @ stackoverflow. i'm trying print pdf-files com.sun.pdfview library. works often, documents following error: java.lang.illegalargumentexception: unknown encoding: symbolsetencoding @ com.sun.pdfview.font.pdffontencoding.getbaseencoding(pdffontencoding.java:199) @ com.sun.pdfview.font.pdffontencoding.<init>(pdffontencoding.java:78) @ com.sun.pdfview.font.pdffont.getfont(pdffont.java:133) @ com.sun.pdfview.pdfparser.getfontfrom(pdfparser.java:1166) @ com.sun.pdfview.pdfparser.iterate(pdfparser.java:719) @ com.sun.pdfview.basewatchable.run(basewatchable.java:101) @ java.lang.thread.run(thread.java:722) i should inform you, these documents written in caucasian language (georgian) , typical font sylfaen. the error occurs in following code: pdfrenderer pgs = new pdfrenderer(page, g2, imgbounds, null,null); try { page.waitforfinish(); pgs.ru

Set bubble transparency in Highcharts? -

is there way influence transparency of bubbles in highcharts bubble charts? looking configuration comparable area fillcolor, didn't find one. i tried using rgba colors series, so: series: [{ color: "rgba(255,0,0,0.5)", data: [ but made border semi transparent. edit: tried use marker fillcolor: series: [{ color: "rgba(255,0,0,1)", marker: { fillcolor: "rgba(255,0,0,0.1)" }, but doesn't influence transparency you can use fillopacity parameter, marker: { fillopacity:0.3 } http://jsfiddle.net/g8jcl/116/

jQuery mobile: change font size on pinch-in/pinch-out? -

i'm writing web document reader jqm. don't want users continuously scroll right-left when reading, viewport is: <meta name='viewport' content='width=device-width; initial-scale=1.0; maximum-scale=1.0; minimum-scale=1.0; user-scalable=1;' /> though, i'm aware users preferences font size may change, due different visual skills... so, thought nice shrink font size on multi-touch shrink action ("pinch-in"), , enlarge font size on multi-touch zoom action ("pinch-out")... is possible? need external library, beside jqm? it possible on jquery mobile, need use 3rd party implementation called hammer.js . it supports large number of gestures like: hold tap doubletap drag, dragstart, dragend, dragup, dragdown, dragleft, dragright swipe, swipeup, swipedown, swipeleft, swiperight transform, transformstart, transformend rotate pinch, pinchin, pinchout touch (gesture detection starts) release (gesture detection ends

Auto increment decimal value in Excel -

im trying figure out how auto increment decimal value in excel, , next sheet increase first number one. example below: (first sheet) 1.1 1.2 1.3 ... (second sheet) 2.1 2.2 2.3 ... now if add new sheet numbering continue 3.1. possible in excel 2010? i can't see way achieve without macro support. following might starting point; add thisworkbook module in vba: private sub workbook_newsheet(byval sh object) sh.cells(1, 1) = thisworkbook.worksheets.count + 0.1 end sub the code called when new worksheet created, receiving new sheet parameter. top-left cell supplied value reflecting number of sheets in workbook, plus 0.1 in question. further cells may filled (say) for loop required (it's not clear question how many cells should value or rule we'd know that).

python - Where in the Hg code is the command completion implemented? -

mercurial has nice feature allows 1 type needed unambiguous on command line, such as: hg pus for pushing, or: hg comm for committing. i'd love see functionality in likes of git , maven, made me curious how done. had trawl through code not luck, found bash_completion not windows. where in hg code command completion implemented? the code commands findpossible , findcmd functions in mercurial.cmdutil . search known commands , find ones start typed, hg pus finds push command. for command line options (flags), normal getopt module lets shorten, say, hg log --patch hg log --pat automatically.

php - Strict Standards: Non-static method -

i'm running ubuntu + php 5.4 , got such error: strict standards: non-static method xtemplate::i() should not called statically, assuming $this incompatible context in ... on line 339 and method looks this: interface itemplate { public function i(); } class xtemplate implements itemplate { public function i() { ... } } and code running normal on windows 7 in xampp. have found advices turn off error_reporing, need solve it. need install modules on turn on other settings in php.ini ? you getting error message because calling function statically instead of creating instance of xtemplate class. depending on situation, either make function static: static public function i() { ... } or first create instance of xtemplate: $myxtemplate = new xtemplate(); $myxtemplate->i(); i hope answers question. edit: this page may interesting you.

php - Get only one line from a web page -

hi, have file test1.php , in other file test.php have php code running: <?php $file = "http://inviatapenet.gethost.ro/sop/test1.php"; $line = '0'; if($f = fopen($file, 'r')){ $line = fgets($f); // read until first newline fclose($f); } echo $line; ?> the idea second line of web page test1.php. second line i've tried change $line = '2'; no affect, displays first line. need help. this should work. obviously, change value of $linetofetch : <?php // write here number of line want fetch. $linetofetch = 2; $file = "http://inviatapenet.gethost.ro/sop/test1.php"; $currentline = 1; if($f = fopen($file, 'r')){ while ($currentline <= $linetofetch) { $line = fgets($f); // read until first newline $currentline++; } fclose($f); } echo $line; ?>

SSIS 2008 Upload Excel data to database table -

Image
morning all, i new ssis , need create package uses excel upload data database. i have followed following link import excel unicode data sql intergration services. , , stumbled accross same issues unicode data. solution seems work degree , issue have in reference section named 'using data conversion task'. i have added 'data conversion task' suggested. did draging , dropping toolbox , plonked on 'data flow' area. had remove current link excel source ole db destination add connection excel source data conversion , 1 data conversion ole db destination. i think must missing out or connected incorrectly still have red cross on excel datasource states 'column columnname cannot converted between unicode , non-unicode string datatypes. i under impression data conversion task solve isses 1 had added had mapped colums again? is possibility data conversion isnt connected properly. i have provided screen shot below review. many advance help. b

media player - android mediaplyer seekTo inside onPrepared -

my problem seems happen on android 4.2.2 i go way idle state -> initialized state -> prepareasync() -> , in onprepared seekto called, on android version mediaplayer returns "attempt seek past end of file: request = {int>0}, durationms = 0" and start play beginning, there no point catch this, nor listener, write message log, cannot react on that. what stranger if call mediaplayer.getduration() in onprepared() returns proper value , not 0. do think mediaplayer bug or there better place call seekto ? or maybe way how know seekto failed ? avoid periodically check current position if smaller desired position , try call seek approach has lot of different problems. it smooth streaming video content i'm trying find solution same problem. best i've come far follows. on 4.2 i've noticed following call backs received: 1) onvideosizechanged() - height , width = 0 2) onprepared() 3) onvideosizechanged() - proper heights , widths you

c# - Regular expression for youtube url -

what regular expression url ? in web application want validate url when user enters url in textbox. url like: http://www.youtube.com/embed/owj0fns95xw how this: /^(https?:\/\/)?([\da-z\.-]+)\.([a-z\.]{2,6})([\/\w \.-]*)*\/?$/ http://net.tutsplus.com/tutorials/other/8-regular-expressions-you-should-know/

vba - What is the entry point of an .xlam excel addin -

i doing work on excel addin abc.xlam. addin enabled in excel addins. want launch .exe file whenever open worksheet (new or existing) in excel. want code .exe launch part in .xlam addin @ event when workbook opened. please tell me how can ? you need access newworkbook event of excel appliation, need set reference application object when addin loads. put following example code in thisworkbook module: option explicit '***** use option explicit! private withevents oxl application private sub oxl_newworkbook(byval wb workbook) '***** trapping newworkbook event call msgbox("it's me again. (" & oxl.workbooks.count & ")", vbinformation, "hi. again.") '***** code here! end sub private sub workbook_beforeclose(cancel boolean) '***** remove reference oxl object set oxl = nothing end sub private sub workbook_open() '***** set reference current excel application set oxl = thiswo

c# - Substring for thai language -

i facing interesting problem. following string want take sub string. 1¨Ñ§ËÇÑ´1xxxxxxxx index 0-2 (length 3) province id index 3-35 (length 32) province name in thai. when try take sub string province following string line = "1¨Ñ§ËÇÑ´1xxxxxxxx "; line.substring(3,32).trim(); this shows me error following index , length must refer location within string. keep in mind when debug code line total length shows me 33 should 35. , province sub string shown 30. following code... using (streamreader streamreader = new streamreader("file06.txt")) { console.writeline(".................. content of " + file.name + ".............."); string codeofprovince, nameofprovince, line; while ((line = streamreader.readline()) != null) { codeofprovince = line.substring(0, 3).trim(); nameofprovince = line.substring(3,32).t