Posts

Showing posts from April, 2010

c# - web.config best practices when upgrading -

i send out app , let customers make changes connection strings , such in web.config. when upgrade app causes annoyance because don't want overwrite values mine. this bad when versions of .net upgraded. how people typically handle type of situation? for example somehow split web.config out customer data no longer part of it? i've never heard of making web.config accessible , writable customers or other business folk. you're asking trouble. it sounds may want develop small front-end (web) utility allow them submit values in form , save database. have application access database these values, , not web.config. this seems more of content management issue.

c# - ArrayList.IndexOf( wild card? ) -

i'm trying find index of first element of arraylist 'tag' property not equal null. i thought effect of arraylist.indexof(p => p.tag != null); or arraylist.indexof(*.tag != null); but neither of these work. there way use indexof property of object? try array.findindex : searches element matches conditions defined specified predicate, , returns zero-based index of first occurrence within entire array.

regex - Java Regular Expressions -

i trying write this: pattern p = pattern.compile("mar\\w"); matcher m = p.matcher("mary"); string result = m.replaceall("\\w"); the result ideally "y" . ideas? your question not clear, think want use lookahead: pattern p = pattern.compile("mar(?=\\w)"); matcher m = p.matcher("mary"); string result = m.replaceall(""); see online: ideone or use capturing group: pattern p = pattern.compile("mar(\\w)"); matcher m = p.matcher("mary"); string result = m.replaceall("$1"); see online: ideone

Codeigniter Call Controller From Controller -

after last 2 comments, i'll dump out real code , maybe out: here landing controller: <?php if ( ! defined('basepath')) exit('no direct script access allowed'); class businessbuilder extends ci_controller { function __construct() { parent::__construct(); } function index() { $rtr = $globals["rtr"]; // import necessary libraries $this->load->model("site_pages"); $rtr = $globals["rtr"]; // current site $site = current_site(); // requesting url $class = $rtr->uri->rsegments[1]; $function = $rtr->uri->rsegments[2]; // current function , class $current_method = explode("::", __method__); // real class name going called $site_page = $this->site_pages->get(array("display_name"=>$class, "id"=>$site->id)); $site_page = $site_p...

sql server - SQL first of every month -

supposing wanted write table valued function in sql returns table first day of every month between argument dates, simplest way this? for example fnfirstofmonths('10/31/10', '2/17/11') return one-column table 11/1/10, 12/1/10, 1/1/11 , , 2/1/11 elements. my first instinct use while loop , repeatedly insert first days of months until before start date. seems there should more elegant way though. thanks can provide. something work without being inside function: declare @lowerdate date set @lowerdate = getdate() declare @upperlimit date set @upperlimit = '20111231' ;with firsts ( select dateadd(day, -1 * day(@lowerdate) + 1, @lowerdate) 'firstofmonth' union select dateadd(month, 1, f.firstofmonth) 'firstofmonth' firsts f dateadd(month, 1, f.firstofmonth) <= @upperlimit ) select * firsts it uses thing called cte (common table expression) - available in sql se...

video - How important is a filter in ffplay -

just wanted know whether filters used in ffplay important or can disable config_av_filter , use it? also wanted know significance of config_av_filter. filters significant if plan on using them. have @ filters do , decide yourself. if watch videos ffplay it's won't need them. if use ffmpeg things analog digital conversion, re-encoding of videos it's need them.

jquery - CSS: Dynamic Font Size; span entire width of div -

possible duplicate: auto-size dynamic text fill fixed size container. let's have div 600 px high , 400 px wide. want text in middle of this, , span entire width of div. there in css or css3 let me auto based on how text user inputs? so, word foo larger word foobar foobar take more space, dynamically resizing text. just wondering; i'm not sure if it's possible (would acceptable have js solution too..) thank you! one solution can think is: let says max size can have typing word foo in box 200px so create new hidden div set fixed width of 600 not height, loop through create new hidden div set width 600 , leave height loop through javascript reducing font-size until height <= 400

PostgreSQL table describe output, what does it mean? -

so output when table describe on postgresql table. 2, module, varchar, -1, 68, t i'm guessing 2 column number, "module" column name, varchar datatype, 68 length, t nullable. is correct , -1 signify? thanks -1 "typmod" (type modifier). types, -1 means default or unspecified. varchar, specifically, -1 means unlimited length.

C++/Boost: Writing a more powerful sscanf replacement -

i want write function in c++ replace c's sscanf assigns matches iterator. basically, want like: string s = "0.5 6 hello"; std::vector<boost::any> any_vector; sscanv(s, "%f %i %s", any_vector); cout << "float: " << any_cast<float>(any_vector[0]); cout << "integer: " << any_cast<integer(any_vector[1]); cout << "string: " << any_cast<string>(any_vector[2]); the exact details may vary, idea. ideas implementation? options far along problems far: std::istringstream : there's no manipulator matching constant expressions boost.regex : not sure if work , seems more complicated necessary this boost.spirit : don't think work dynamically generated format strings , seems more complicated necessary sscanf : work, non-standard, etc, , using require lot of overhead since number of arguments determined @ compile time what's that? void sscanf(std::stri...

Maven exec plugin execution conundrum -

sample maven build file: <project xmlns="http://maven.apache.org/pom/4.0.0" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://maven.apache.org/pom/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelversion>4.0.0</modelversion> <groupid>test</groupid> <artifactid>test</artifactid> <version>1.0.0</version> <build> <plugins> <plugin> <groupid>org.codehaus.mojo</groupid> <artifactid>exec-maven-plugin</artifactid> <executions> <execution> <id>my-validation-one</id> <phase>validate</phase> <goals> <goal>exec</goal> </goals> </execution> ...

Detect from the Application.Current.RootVisual Silverlight ChildWindow opening -

how can know silverlight main usercontrol (rootvisual) childwindow displaying? not sure if there's way more specific setting wiring yourself. 1) want make public singleton class (ie. childwindowmanager) contains event called onchildwindowshowing. root visual subscribe event. 2) in order make event fire @ proper times, need set wiring on childwindow instances. can on case case basis, or can make class inherits childwindow , has custom constructor. need set events on childwindow cause onchildwindowshowing event on singleton class created before fire. so conceptually like: childwindow.onshow() <--> childwindowmanager.onchildwindowshowing <--> rootvisual

asp.net - Cannot get pickup directory IIS 7.5 -

i'm getting "cannot pickup directory" under iis 7.5. i've granted privileges mail folder iis_iusrs group. recall iis 6 had use make changes metabase using acl tool. does iis 7.5 use metabase? need iis 6 when installing pickup directory? thanks help/instructions this sounds answer. forward other solutions, explanations.. https://serverfault.com/questions/77766/where-are-the-smtp-settings-saved-in-iis7-win2008 it sounds getting directory problem. tried adding directory directly code: c:\inetpub\mailroot\pickup\ but, i'm still getting error. i'm sure granting proper privileges in metabase fix rather not have bother if not required.

sql - I need to create a SQLite table -

i need able enter duplicate entries in table b, different foreign keys (table b references table a's key). this: table a: record key of 11 record key of 22 table b: record referring table record 11, field marked unique: value 101 record referring table record 22, field marked unique: value 101 <--- violates unique key this have tried, didn't work: create table readings ( site_id text references sitedata , loop_nbr text , loop_closed binary , seq integer , sta text unique , bs text , fs text , hi text , desc text ) insert readings (site_id, seq) values (' + databasekey + ', 0) anybody know how this? create table readings ( site_id text unique references sitedata , loop_nbr text , loop_closed binary , seq integer , sta text unique , bs text , fs text , hi text , desc text ) adding unique foreign key refuse rows same site_id , sta

flash - Someone know the name of that animation? -

Image
i dont know name should google it, tried genie effect, it`s not genie effect! if has link how in flex,flash, pixel bender, lot well, or name of animation too. not sure if has different name when it's animated, show in "before" picture pincushion distortion .

reporting services - SSRS Charting - Display Legend and Percent -

Image
i'd display day (percentage) eg fri (22%) on chart can each individually: series label properties, label data: #percent{p0} or: =fields!dayofweek.value problem: how display both? here goes expression: =fields!dayofweek.value+"(#percent{p0})"

c# - Checks for webserver response -

i'm making folder scanner on website, after 2 successful urls crash , got no idea why. if (file.exists(filepath)) { streamreader file = null; file = new streamreader(filepath); while ((line = file.readline()) != null) { var url = new uri(txturl.text + line); try { var request = (httpwebrequest)webrequest.create(url); request.allowautoredirect = true; request.useragent = "mozilla/4.0 (compatible; msie 6.0; win32)"; var response = (httpwebresponse)request.getresponse(); //directory.listview.items.add(url.tostring()); messagebox.show(url.tostring() + "success"); } catch (exception err) { messagebox.show(url.tostring() + " fail: " + err.message); } } if (file != null) file.close(); messagebox.show("done;"); } you need close httpwebresponse object, res...

c# - How to draw Graph stucted Data via Silverlight -

i have draw graph user can add,delete ,colorate nodes , arcs after apply algorithmes , last have represented via graph image . i'd work silverlight, i've found usueful projects on codeplex , graph# , quick graph . these projects vague , compliacated , implimented using wpf technologie .

sql - Database design and query -

i have requirement have number of sub-topics per main topic. , every sub-topic needs able have n number of comments. i need have database tables represent structure , query list of sub-topics, , every subtopic comments belong it. have have way know when reached end of comments every subitopic. could please advise on best design/query this? i use mysql. thank much! - alex i think database design might work: topic id name topic_has_topic id parentid childid comments id comment topicid

Android update SQLite DB schema? -

what best practice updating db schema? send text file sql commands. app check text file , execute commands needed. guessing have flag indicate update has been done. havent found way delete file in asset folder app, best thing after db updated. any thoughts on this? you want override onupdate(sqlitedatabase db,int old version,int newverison) the following tutorial can walk through process: http://www.codeproject.com/kb/android/androidsqlite.aspx

how to get the distance betwween two points from google maps url api -

i use google maps api v2 , , know method distancefrom can distance , but want distance , store database , it has easy way : http://ditu.google.cn/maps/geo?q=39.88509,116.336355&output=xml&sensor=true_or_false&key=abcdefg i visit url , response using django , , store mysql , now want distance , google has url api , thanks i'd recommend using standard latitude/longitude calculations: http://mathforum.org/library/drmath/sets/select/dm_lat_long.html store latitude , longitude in database.

linux - Auto detect hosts using Nagios -

is possible configure nagios auto detect hosts belong network , auto configure .cfg files? thanks. the front-end centreon can ( http://www.centreon.com/ ) can take around observium ( http://www.observium.org/wiki/main_page )

html - center align three divs side by side with CSS -

i've got 3 div s side side in container sets width of user's window. i want them stay nested next each other, , centered unit in dynamic container. i'd without putting them div (mostly because have lot of them in page is). html: <div id="content"> <div id="nav_one"> <h3>collections</h3> <p style="text-align:justify">blahblah</p> </div> <div id="nav_three"> <h3>collections</h3> <p style="text-align:justify">blahblah</p> </div> <div id="nav_two"> <h3>collections</h3> <p style="text-align:justify">blahblah</p> </div> </div> css: #nav_one { width: 208px; float: left; padding: 20px 10px 20px 10px; text-align: center; } #nav_two { width: 208px; margin: 0 auto; padding: 20px 10p...

php - Find string in REQUEST_URI -

i need searching content of request_uri . if $_server['request_uri'] contains rmb_twi something. this beyond simple. read manual entry strpos() if (false !== strpos($_server['request_uri'], 'rmb_twi')) { // }

c# - Best practice for saving related constants? -

in game have enum (about 200 entrys long) different gameentitytype s. when game saved, array of gameentitytype written savefile. to reconstruct gameworld, , display various information gameentitytypes need have list of quite few more details (constant values). means each gameentitytype has other values associated it. these values accessed every frame. goal have simple way information out of gameentitytypeid (the enum). example, when read 0x1 out of savefile, can access name , other information implied number/enum array this: "constants.texturelist[ gameentitytype ]", return string "stone_texture.dds" example additional/associated information of first enum entry: types: string , string, flag-enum: "visual-classification" , bool , bool values: "stoneblock" , "stone_texture.dds" , 0x0102 , false , true my first approach create static gameentitytypeinfo class had member following every additional info type: public stati...

C++ globally overloaded operator= -

possible duplicate: what “operator = must non-static member” mean? (c++) hi, i have following code... // header file struct datarecord{ size_t id; char name[gcnamelength]; }; void operator=(datarecord &adr, const datarecord &bdr); how ever gcc gives me following error when compiling. error: ‘void operator=(datarecord&, const datarecord&)’ must nonstatic member function thanks help. you need overload = operation on struct datarecord itself. something like: struct datarecord{ size_t id; char name[gcnamelength]; datarecord& operator= (const datarecord&) { // write overload code here } };

android - How do I get the position of a togglebutton that is clicked in a gridview? -

how position of android togglebutton clicked in gridview? if use following example code dont toast message of position. public class hellogridview extends activity { /** called when activity first created. */ @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.main); gridview gridview = (gridview) findviewbyid(r.id.gridview); gridview.setadapter(new togglebuttonadapter(this)); gridview.setonitemclicklistener(new onitemclicklistener() { @override public void onitemclick(adapterview<?> parent, view v, int position, long id) { toast.maketext(hellogridview.this, "" + position, toast.length_short).show(); } }); } } and toggle adapter: public class togglebuttonadapter extends baseadapter { private context mcontext; public togglebuttonadapter(context c) { mcontext = c; } @override public int getcount() { ret...

c# - How to check a particular user has log on as service right programmatically -

for application check whether particular user has log on service right? how programmatically? checked in internet , not find out resource thanks upul do have token account? if can call gettokeninformation tokeninformationclass == tokenprivileges . return list of privileges associated token , whether or not have been activated. if account isn't logged in , can't token, becomes harder. can't query privileges allowed account let alone privileges of account's groups bring token. need logon account retrieve token , follow previous advice.

OOP design - validation when validation means hitting the database to check -

let's pretend we're talking html complaint form, 1 field of product list company catalog. i gather validation (always?) goes in own class. i gather it's practice have gateway classes can handle database queries internally, when save complaint complaint form don't have worry database details. but validation requires accessing database - example checking product product have (and not tampering form). can done finding match in database... database abstracted behind gateway. do add validation logic gateway? create validator gateway classes? empower validator database logic? edit - attempt clarify... customer clicks link complaint form html complaint form built <select><item></item></select> dropdown x products our fictional company catalog customer completes form , submits // wiseguy alters html product "schweddy balls" , submits form class validates simple things date, required fields have data, email address, etc. ...

ios4 - Can iPhone apps sell other apps within them? -

there lot of useful apps available in app store , don't want reinvent them because think they'd useful part of app. i'm wondering whether possible sell them within app, whereby user can purchase them without leaving comfy confines of app. idea this? or user have head on app store hands on them? on side note, nice if commission selling them within app (can't imagine apple allow though). no not possible. best can redirect user app store app within app app user wants more info on.

How To Show Same Images In Different For Sizes In Iphone And Ipad -

i want show image in webview problem want show same image in ipad , iphone in different sizes. in project getting image database getting url.how should vary iphone , ipad .please used code in css written sizes , attached tag in run time not replacre string why not replacing string dont know.if 1 knows plaese me in context . if ([devicetype isequaltostring:@"ipad simulator"]) { //contentstring =[contentstring stringbyreplacingoccurrencesofstring:@"/>" withstring:@"width:\"30%\" height:\"30%\"/>"]; contentstring =[contentstring stringbyreplacingoccurrencesofstring:@"/>" withstring:@"class=\"img_ipad\"/>"]; } else { contentstring =[contentstring stringbyreplacingoccurrencesofstring:@"/>" withstring:@"width:\"70%\" height:\"70%\"/>"]; } you should use construction: #if __iphone_os_version...

Passing values between three forms in C# .NET -

i have windows application has 3 forms : form1,2,3. --form 1, has 2 buttons , openform2, openform3. --form2 has textbox form2_textbox,and button form2_button --form3 has textbox form3_textbox now, on clicking button openform2 on form1, form2 opens, string entered in textbox form2_textbox of form2, when bu tton form2_button of form clicked, want form1 receives string value & stores in string receivefromform2, , displays string value on form3_textbox of form3. please guide me how task? there couple of ways this. using .net events 1 requires pretty coupled wiring. what suggest (and how this) use own bus (observer pattern). let's call messagebus. forms use same instance of bus , when interesting happens publish message. keep typed sake of simplicity let's this: public class message<t> { public string name { get; set; } public t data { get; set; } } you have subscribers on bus respond messages interested in. public class messagebus ...

Calling Ajax repeatedly after specific time using jquery -

searched on jquery timer functions need solution call below ajax function every 5 minutes using jquery.. $.ajax({ type: 'post', url: '<?php echo base_url().'index.php/score-refresh/scorecard';?>', success: function(html){ $('.score_news').append(html); } }); you can using setinterval call this var timer, delay = 300000; //5 minutes counted in milliseconds. timer = setinterval(function(){ $.ajax({ type: 'post', url: '<?php echo base_url().'index.php/score-refresh/scorecard';?>', success: function(html){ $('.score_news').append(html); } }); }, delay); if need stop @ point call clearinterval(timer);

java - Android test class fails to compile in eclipse with "bound mismatch" error -

i'm writing testcases android app extending activityinstrumentationtestcase2 . test class looks this: public class solutionentryactivitytest extends activityinstrumentationtestcase2<solutionentryactivity> { public solutionentryactivitytest() { super(solutionentryactivity.class); } } in eclipse, code fails compile error: bound mismatch: type solutionentryactivity not valid substitute bounded parameter <t extends activity> of type activityinstrumentationtestcase2<t> but solutionentryactivity android.app.activity , type hierarchy this: activity ormlitebaseactivity<h> (abstract) kabowieactivity practiceactivity (abstract) solutionentryactivity i found 2 eclipse bugs 2004 , 2005 seem deal similar problem these should long fixed. i'm using eclipse helios android 2.2 , sun java 1.6. any idea what's going on? the problem when create test project android eclipse project, re...

jquery - List Hover Problem -

i've asked question, think din't explain problem enough. here go again: http://i54.tinypic.com/1zp4kev.png i've got list. default background color shown in picture above. want make item 4 background change color #ededed when hovered upon. item 4. item 3, item 2 should remain original background color. how do that? problem has been when hover on item 4, parent items background color changed #ededed also. jquery or css solution appreciated. here's code list above: <ul> <li class='comment'> <div class='comment-body'> item 2 </div><abbr class='timestamp' title='2011-02-18 11:39:32'>2011-02-18 11:39:32</abbr> <div class='aut'> anonymous </div><a href='#comment_form' class='reply' id='2' name="2">reply</a> <ul id='comments-ul'> <li class='comm...

iphone - Sometimes moviefile (.mov) sticks on 3.2 ipad -

i using mpmovieplayercontroller playing movie in ipad. times movie gets stuck. happening in 3.2 ipad. defects appears randomly. i don't think related api - have issue on ipad playing videos lot. randomly seem stop, , have press play have them resume. it's not buffering issue, because happens local videos too. i think it's general ios bug.

c - returning address form a function -

i have returned address form function search(keys), return ptr->keys[pos] where ptr->keys[pos].value used access member function of keys. above return statement correct? return address after returns have done struct classifier keys,temp,*temp_ptr; temp = search(key); temp_ptr = &temp; and accessing member function value of keys as temp->value from you've said, if pos 0 or 1 it's valid index in keys , return statement is ostensibly correct. please post realistic code though: question's "struct classifier keys,..." not reconcilable "struct classifier keys[2]" mentioned in comment above. following code not correct: temp = search(key); tries copy pointer structure. might mean temp = *search(key) , copy struct classifier's content out. can use temp.value or temp_ptr->value not temp->value asked.

php - Difference between var_dump,var_export & print_r -

what difference between var_dump , var_export , print_r ? var_dump debugging purposes. var_dump prints result. // var_dump(array('', false, 42, array('42'))); array(4) { [0]=> string(0) "" [1]=> bool(false) [2]=> int(42) [3]=> array(1) {[0]=>string(2) "42")} } print_r debugging purposes, too, not include member's type. it's idea use if know types of elements in array, can misleading otherwise. print_r default prints result, allows returning string instead using optional $return parameter. array ( [0] => [1] => [2] => 42 [3] => array ([0] => 42) ) var_export prints valid php code. useful if calculated values , want results constant in script. note var_export can not handle reference cycles/recursive arrays, whereas var_dump , print_r check these. var_export default prints result, allows returning string instead using optional $return parameter. array ( ...

java - How to make a any node as parent node in JTree so that children can be added to it? -

how make current node in jtree parent node add children it. complete data fetched database. somewhat below : root-- parent1 - children |- parent2 - children i need dynamically generate tree thanks in advance :) if nodes mutabletreenode e.g. defaultmutabletreenode use public void insert(mutabletreenode newchild, int childindex) method add children current node

c - ether_addr_octet in host order byte -

i convert struct ether_addr (ether_addr_octet) integer host byte order representation. ideas? ntohl(eth->ether_addr_octet) not working, because ether_addr_octet char array. regards i'm not sure semantics of going be. ether 48bit, , largest ntoh* 32bit values. suppose can create 64bit value parsing char array, , calling ntohl() twice...

Zend framework routing params -

i have several routes defined in application. when route matched , assemble url using route b without resetting, not include current request parameters. is there easy way include request parameters when assembling url via different route current route? did have @ zend_controller_router_rewrite->userequestparametersasglobal, (obviously) include request parameters when reset = true you try following. $oldparams = $this->_getallparamas(); unset($oldparams['module']); unset($oldparams['controller']); unset($oldparams['action']); pass array_merge(array('new'=>'param'),$oldparams) to url view helper.

groovy - ConcurrentException/NullPointerException in GParsPool runForkJoin -

for little context, i'm trying solve project euler problem 31 using excellent gparspool fork/join support . for that, i've written foolowing code : import groovyx.gpars.* import groovy.util.groovycollections @grab(group="org.codehaus.gpars", module="gpars", version="0.11") def getmatchingcombos(target) { combos = [200, 100 /*, 50, 20, 10, 5, 2, 1*/] gparspool.withpool(1) { pool -> combos = combos.collectparallel { n -> ((0..(target/n)).step(1) treeset).collect { p -> p*n } } return gparspool.runforkjoin(combos, 0, 0, target) { usablecombos, comboindex, sum, targetsum -> def offset = "\t"*comboindex def results = 0 if(sum<=targetsum) { if(comboindex<combos.size()) { usablecombos[comboindex].each { n -> println offset+"now trying $comboindex element value $n (curent...

sql - Aggregating quantities across multiple columns without a cursor or temporary table -

if have table 2 columns, , b, , count how many times item shows in both columns, there way without using cursor or temp table? ex: column column b bmw ford jaguar bmw mercedes lexus chevrolet jaguar bmw ford i result be: bmw 3 jaguar 2 mercedes 1 chevrolet 1 ford 2 lexus 1 select columna, count(*) times ( select columna atable union select columnb atable) joined group columna most dbms require alias derived table

windows - Python socket doesn't close connection properly -

i new socket programming , ran puzzling problem: i have windows program cannot alter (proprietary software) tries connect specific ip , port tcp socket. on linux box wrote little python script serve socket win prog. works fine until kill prog on linux. initial server socket doesn't close specified , cannot restart program until socket garbage collected. if try same linux socket (in seperate python script) have no problems. here minimal code example: import socket server = socket.socket() server.bind(('192.168.0.111', 50001)) server.listen(1) conn, addr = server.accept() print 'connection established' running = true while running: try: data = conn.recv(4096) except keyboardinterrupt: conn.close() running = false else: if data: print data else: conn.close() running = false server.close() if kill ctrl-c exits normally. upon restarting script socket.error stating ad...

c# - What is the best way to retrieve a WindowsIdentity from a ClaimsIdentity -

so far found out 2 solutions windowsidentity object claimsidentity. first extract user principal name (upn). claimsidentity ci = (claimsidentity) thread.currentprincipal.identity; string upn = null; foreach (claim c in ci.claims) { if (c.claimtype == claimtypes.upn) { upn = c.value; break; } } just call constructor of windowsidentity upn: windowsidentity winid = new windowsidentity(upn); use claims windows token service (c2wts): windowsidentity winid = s4uclient.upnlogon(upn); solution 1 seems me simpler , easier solution, don't understand purpose of c2wts? any suggestions? tnx! windowsidentity winid = s4uclient.upnlogon(upn); used excel services , performancepoint services. its cached once used. has other checks against well.

Write a paragraph using textview on Android -

i want write paragraph part of mobile application. how go it? use \n break line. example: textview t = findviewbyid(r.id.text); t.settext("this first line\nthis second line\nthird line...");

Is 20 MB generally enough for a blog database in SQL Server or MySQL? -

i want deploy blog on appharbor . free size of database 20 mb. not yet ready pay $10/month 10gb database. question is: sufficient simple blog 1 post week? i not going use blogging engine. write own engine posts in database. plan use disqus comments. that's basic math, really. one post week of 10kb per post, make last 200 weeks. mutatis mutandis: d bytes per database --------------------------------------- = weeks per database (n posts per week) x (s bytes per post)

JSON memory leaks iphone sdk -

iphone app getting slow while testing in performance tool,but works fine while build , run on device.i getting following leaks: [nscfstring copywithzone]; [nscfstringappendstring]; json parser : [sbjsonparser scanrestofdictionary]; basically.what leaks coming while using json parser because data load server in json format.2

assets - Retrieve data from sqlite database and display in assest folder's HTML page in android -

i want make dynamic webpage can display sqlite database's element in tabular format. how can create dynamic webpage in android? make static html page , put in assest folder. works want dynamic webpage. please help: package com.htmlview; import java.io.ioexception; import java.io.inputstream; import android.app.activity; import android.os.bundle; import android.webkit.webview; public class htmlview extends activity { /** called when activity first created. */ @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); //setcontentview(r.layout.main); webview webview = new webview(this); setcontentview(webview); try { inputstream fin = getassets().open("index3.html"); byte[] buffer = new byte[fin.available()]; fin.read(buffer); fin.close(); webview.loaddata(new string(buffer), "text/html", "...

KRL gem and msvcrt-ruby*.dll -

when run krl command line tool krl gem on windows complains don't have right msvcrt-ruby dll. when i'm set run ruby 187 complains can't find ruby191 dll. when i'm set ruby 191 complains missing ruby 187 dll. when put both .dll files in path fails unexpected termination. still works 1 dll in path, have dismiss annoying dialog every time run krl tool. the gem working fine under ruby 187, did 'gem update' , started failing. is ruby installation misconfigured or problem krl gem? the krl gem depends on kynetx_am_api gem, @ same time depends on json gem. json binaries windows broken between versions of ruby. has been reported gem author still binaries available. please read this post instructions. need devkit installed , configured , proceed command line remove existing json gem , replace compiled one. hope makes sense.

javascript - clientHeight in FireFox -

i have table in html code. i need height of table using javascript, so alert(document.getelementbyid('mytable').clientheight); returns correct value in ie, returns 0 in ff. how can height of table in firefox? thanks! mdc says: clientheight non-standard, html-specific property introduced in internet explorer object model. in firefox, offsetheight property contains current pixel height of element, can use like: var theheight = element.clientheight || element.offsetheight;

c# - Dependency injection in domain object extension methods -

i'm creating node based web cms system in asp.net mvc. having read books on dependency injection i've split solution multiple projects , using abstractions (abstract classes , interfaces). i can't figure out how solve following type of code in web project: mydomainobjectnode.getchildnodes<somesubnodeclass>(); i accomplish if domain object had reference inoderepository mean have carry dependency around in domain objects hassle, when having create new instances. having dependencies (mainly repositories) in domain object bad thing? my other idea achieve using extension methods. however, extension methods static on static class cannot constructed using ioc. solve using singleton inoderepository , having set ioc. this doesn't feel elegant solution... have other ideas or input? thank you! i typically avoid giving domain object access repositories , hide persistence concerns as possible. when create mydomainobjectnode fill collection of child...

Why does tfs prompt me to overwrite every file? -

why tfs prompt me overwrite every file? to work under tfs source control, need following: your solution must in source control! your source control provider must set tfs. tools > options > source control , make sure it's default sc provider. you must have workspace mapping on local drive tells tfs solution should located on hard drive. open source control , there drop-down list @ top of window shows selected workspace. drop combo-box down , gives option edit workspace, can tell tfs specific folders in hierarchy located on hard drive. you need bind solution source control tell tfs want work in source controlled way on solution. (from memory) go file > source control > change source control , clicking "bind" button enough. you may need synchronise pc server. open source control window, right click on parent folder of solution, , "get specific version". set "latest" , tick checkbox files source control system thinks have....

vb.net - Property is reset on COM+ object if ContextUtil.SetComplete() is called -

i've got 2 classes deployed com+ components, let's classa , classb. classa has public properties. classb sets values properties , calls method of classa. method not modify value of property. after call values of properties reset default values corresponding types. happens if called method includes statement contextutil.setcomplete(). once comment out statetment values of properties remain same before method call, expect. do overllok basic concept of com+ objects , contexts? expect property value remain same in case. here's simplified listing code: option strict off option explicit on imports system.enterpriseservices <transaction(transactionoption.required)> _ public class classa inherits servicedcomponent private _propertya string public property propertya() string return me._propertya end set(byval value string) me._propertya = value end set end property public sub methoda(...

image processing - best Segmentation algorithm -

Image
i'm trying develop system, recognizes various objects present in image based on primitive features texture, shape & color. the first stage of process extract out individual objects image , later on doing image processing on each 1 one. however, segmentation algorithm i've studied far not near perfect or called ideal image segmentation algorithm. segmentation accuracy decide how better system responds given query. segmentation should fast accurate. can 1 suggest me segmentation algorithm developed or implemented far, won't complicated implement fair enough complete project.. any appreicated.. a late answer, might searching in google, since question popped first result "best segmentation algorithm". fully convolutional networks seem task you're asking for. check paper in arxiv , , implementation in matconvnet . the following image illustrates segmentation example these cnns (the paper linked proposes 3 different architectures, fc...

c# - I need help with XSL & ASP.NET questions -

i have page calls webservice data. screen wires correctly , able display data expect. need write inner loop inside for-each in xsl need pass parameter sort parent dataset , subset display in child view. here block of code far: here xml <xs:element name="exchangewanteditemsmetoodusers"> <xs:complextype> - <xs:sequence> <xs:element name="exchangewantedid" type="xs:int" minoccurs="0" /> <xs:element name="exchangewantedname" type="xs:string" minoccurs="0" /> <xs:element name="metooer" type="xs:string" minoccurs="0" /> <xs:element name="metooerbankname" type="xs:string" minoccurs="0" /> <xs:element name="datefulfilled" type="xs:string" minoccurs="0" /> <xs:element name="datefulfilledunformated" type="xs:datetime" minoccurs="0" ...

html - An element with more text pushes down other inline-block elements. Why? -

this super simple , i'm baffled behavior. want search results display in nice grid of blocks of 2 in row. instead shows crooked div more text pushes others down it's content. how can fix this? here's simplified example shows problem in ff , chrome: <html> <body> <style> .search_result { border: thin solid; width: 250px; height:200px; display: inline-block; } </style> <div style='width:508px'> <div class='search_result'> meerkats demonstrate altruistic behavior within colonies; 1 or more meerkats stand sentry while others foraging or playing, warn them of approaching dangers ... </div> <div class='search_result'> 1 or more meerkats stand sentry </div> <div class='search_result'> meerkats </div> </div> </body> </...

junit4 - Unable to force newer version of surefire-plugin in Maven -

i have maven project , using surefire-plugin run tests. previously, didn't force version , maven picked 2.4.3 me (why ??). i want use 2.7.2 instead, has better support junit4 (especially parametrized tests). hence, have modified root parent pom : <pluginmanagement> <plugins> <plugin> <groupid>org.apache.maven.plugins</groupid> <artifactid>maven-surefire-plugin</artifactid> <version>2.7.2</version> <dependencies> <dependency> <groupid>org.apache.maven.surefire</groupid> <artifactid>surefire-junit47</artifactid> <version>2.7.2</version> </dependency> </dependencies> <configuration> <skiptests>true</skiptests> ...

java - JAXB - Ignore element -

is there way ignore element jaxb parsing? have large xml file, , if ignore 1 of large, complex elements, parse lot quicker. it better if not validate element contents @ , parse rest of document if element not correct. ex:this should generate foo.element1 , foo.element2 <foo> <element1>i want this</element1> <element2>and this</element2> <bar> <a>all of bar should ignored</a> <b>this should ignored</b> <c> <x>a lot of c take time process</x> </c> <c> <x>a lot of c take time process</x> </c> <c> <x>a lot of c take time process</x> </c> <c> <x>a lot of c take time process</x> </c> </bar> </foo> assuming jaxb model looks this: @xmlrootelement(name="foo") public class foo ...

ruby on rails - Cannot sign in using form with Mechanize -

i trying submit form mechanize. nothing happens on submit. login page again. the form: http://affilate.mikkelsenmedia.dk/partnersystem/mylogins.php require 'mechanize' agent = www::mechanize.new agent.get("http://affilate.mikkelsenmedia.dk/partnersystem/mylogins.php") form = agent.page.forms.first form.username = 'username' form.password = 'password' form.submit live http log when login in browser: http://affilate.mikkelsenmedia.dk/partnersystem/mylogins.php post /partnersystem/mylogins.php http/1.1 host: affilate.mikkelsenmedia.dk user-agent: mozilla/5.0 (windows; u; windows nt 6.1; da; rv:1.9.2.13) gecko/20101203 firefox/3.6.13 accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 accept-language: da,en-us;q=0.7,en;q=0.3 accept-encoding: gzip,deflate accept-charset: iso-8859-1,utf-8;q=0.7,*;q=0.7 keep-alive: 115 connection: keep-alive referer: http://affilate.mikkelsenmedia.dk/partnersystem/mylogins.php cookie: xxx c...

cocoa - What do lockFocus and unlockFocus actually do? -

warning: i'm cocoa newbie. i'm reading "cocoa programming mac os x" hillegass. on p.301 it's written: to make drawing appear on image instead of on screen, must first lock focus on image. when drawing complete, must unlock focus. the code have, inside -(void)mousedragged:(nsevent *)theevent of nsview follows: [resizedimage lockfocus]; [sourceimage drawinrect: nsmakerect(0, 0, resizewidth, resizeheight) fromrect: nsmakerect(0, 0, originalsize.width, originalsize.height) operation: nscompositesourceover fraction: 1.0]; [resizedimage unlockfocus]; without lock/unlock, not work, still don't understand going on. i see 2nd line of code has no mention of resizedimage mean when use lockfocus makes sure 'drawing' happens takes place there? explain better? drawing requires 'graphics context'. you'll notice that, unlike core graphics, none of appkit drawing methods take parameter specifies drawing ends up. instead, d...

monitoring - Best way to deal with monitor alert overload and desensitization? -

we're in process of adding monitoring various servers , processes on our network, , currently, various monitors email development group if seems amiss - no customer payments on website in x minutes, web services support process unresponsive, daily automated ftp vendor failed, etc. while of these informational , need addressed (tomorrow or monday fine, example), critical , result of actual customer outages, need restored possible. the problem there many emails people getting desensitized them , beginning ignore critical ones. though have point person changes each week, still find critical alerts sit there, unclaimed , unresponded, hours sometimes. what other people doing better address these types of monitor , alert situations? should have dashboard or summary email gives day? critical things - group email still best way go? i'm curious see others doing see things addressed quickly, ensure developers aren't overwhelmed inaction. in rhq ( http://rhq-project.o...