Posts

Showing posts from March, 2015

Help with iterating through array php -

i want return 'message->text' part of array. can me? having difficulty this. array ( [name] => new exp [created] => array ( [date] => 20110304 [time] => 11:09:27 [version] => 2.02.6 ) [message] => array ( [0] => array ( [@attributes] => array ( [id] => 0 [mbox] => recipe ) [received] => array ( [date] => 20090304 [time] => 13:16:48 ) [from] => array ( [name] => andrew welch [email] => <email address removed> ) [to] => array ( [name] => <email address removed> [email] => <email address removed> ) [messageid] => <email address removed> [subject] => aloo paranthas [text] => take potatoes ... cook....

android - Image in LinearLayout not resizing well -

Image
i have page called 'simpleresultpage'. in page display detail view different kind of items have in app. at start of activity determine kind of items should display , based on hide/show viewstub 's currently try display image in betweent 2 textfields , code: <textview android:id="@+id/simple_result_text_title_1" style="@style/style_simple_result_title"/> <viewstub android:id="@+id/image1_viewstub" android:inflatedid="@+id/image1_inflated_viewstub1" style="@style/style_simple_result_image" android:layout="@layout/simple_list_image"/> <textview android:id="@+id/simple_result_text_text_1" style="@style/style_simple_result_text"/> the style image this: <style na...

java - Difference between SOCKS, DIRECT and HTTP in Sockets programming -

could please advise difference between socks, direct , http type connections in context of sockets programming? specifically referring android socket classes proxy type enum imagine question applies other languages. when write application using socket communicate internet @ large, wish use http, might in 1 of 3 different situations: direction connection internet - can establish tcp/ip connection directly server @ other end. connection via socks proxy - cannot establish direct connection server @ end end. instead need contact local lan security gateway computer using socks protocol , ask open connection server @ end, open socket socks proxy server , have patch through server forwarding traffic between , target server, assuming local security policy allow that. connection via http proxy - either cannot establish direct connect internet or useful use proxy performance (caching) reasons. once again, instead of opening connection server @ other end open connection http ...

c# - Reading specific content from a web page? -

i trying make app (in c#) in have meanings website wiktionary.com or dictionary.com. have never used xml or worked web pages @ all. i managed response webpage (e.g dictionary.com specific word) (which hope xml format). this got word 'hello'.: <!doctype html public "-//w3c//dtd html 4.0 strict//en"> <!--attributes answers reference--> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:fb="http://www.facebook.com/2008/fbml" xmlns:og="http://opengraphprotocol.org/schema/"> <head> <title> hello | define hello @ dictionary.com </title> <meta name="description" content="hello definition, (used express greeting, answer telephone, or attract attention.) see more."/> <meta name="keywords" content="hello, online dictionary, english dictionary, hello definition, define hello, definition of hello, hello pronunciation, hello meaning, hello origin, hello examples...

html - Why use list to do navigation menu instead of buttons? -

i have inspected many navigation menus on internet, , use lists instead of button. reason behind this? why use button? thank you. there (at least) 2 reasons use lists. using lists can give idea of site's structure in terms of seo if people use either custom css or screen readers accessibility reasons. second , related 1 it's rather helpful when comes creating stylesheets. don't need come own way of nesting elements. use lists , go there. can focus on getting stylesheet right providing different styles different hierarchy levels, first, last, odd or list items.

javascript - null pointer expection in IE and not in Firefox, why does this happen? -

i have script loops through array of html tag id's, elements in array empty. have if statement works fine in firefox throws null pointer or not object error in ie if((storedvars.id) != ("")){selenium.browserbot.getcurrentwindow().document.getelementbyid(storedvars.id).type;} why fail in ie , not in firefox , proper syntax ie? in ie might undefined or null rather empty string, try instead: if(storedvars.id && storedvars.id !== "") (also bit more efficient due !== operator comparing 2 strings)

algorithm - Choosing n numbers with fixed sum -

Image
in code want choose n random numbers in [0,1) sum 1 . i choosing numbers independently in [0,1) , normalizing them dividing each 1 total sum: numbers = [random() in range(n)] numbers = [n/sum(numbers) n in numbers] my "problem" is, distribution out quite skew. choosing million numbers not single 1 gets on 1/2 . effort i've calculated pdf, , it's not nice. here weird looking pdf 5 variables: do have idea nice algorithm choose numbers, result in more uniform or simple distribution? you looking partition distance 0 1. choose n - 1 numbers 0 1, sort them , determine distances between each of them. this partition space 0 1, should yield occasional large result aren't getting. even so, large values of n, can expect max value decrease well, not method.

class - C++ list looping -

im quite stuck here. have been trying , googling past 2 days cant figure out. have class called player , called enemy inherits player. have list stores coordinates bullets , loop trough them in player. im trying access , loop trough same list check collision in enemy builds on player, not enter loop. guess somehow empty why? struct structshoot { float x; float y; }; class player { private: blablabla protected: list<structshoot>::iterator it; list<structshoot> shoot_list; structshoot test; public: void render(sdl_surface* dest); }; void player::render(sdl_surface* dest) { //works fine, see other loop down below for(it = shoot_list.begin(); != shoot_list.end();) { shoot.moveset(it->x, it->y); shoot.draw(dest); it->y--; if((it->y) < -25) { = shoot_list.erase(it); } else { it++; } } } class enemy : protected player { public: void render(sdl_surface* dest); }...

c# - Power shell: Import-Module -

i have been trying app fabric caching on win2008 standard server. when execute follwowing command get: import-module distributedcacheadministration import-module : specified module 'distributedcacheadministration' not loaded because no valid module file found in module directory. where directory located , how can use module also, appears have powershell 1. cant seem install powershell 2 modules , commands feature in powershell 2 only, can quite you're running version. guess you're confused because powershell.exe located in "1.0" directory; that's make version 2.0 backwards compatible. you need specify exact location of module load: import-module [-force] path-to-module-file` even better have available via $psmodulepath environment variable. try get-module -listavailable see modules available. since 1 you're trying load not seem listed, try setting $psmodulepath folder above directory holding module file. when you're satis...

php - convert image.jpg to <img src="image.jpg"> -

i have seen facebook, when user paste image link www.blahblah.blah\blah.jpg automatically gets <img src="...."/> how in php ? you're looking bbcode-like replacing system. there's plenty of them on internets. 1 example: http://snipplr.com/view/2296/php--bbcode/

php - MSSQL: Must declare the scalar variable @rownum -

one of queries ranking game. the query below , error sql server management studio shows is: "must declare scalar variable @rownum" what wrong it? thanks lot! $sql1_1 = "set @rownum := 0"; $sql2_2 = "select * ( select @rownum := @rownum + 1 rank, totalpoints, useridfb, game2points theuser order game2points desc ) result useridfb=1234"; mssql_query($sql1_1); $result = mssql_query($sql2_2); $row = mssql_fetch_array($result); $therank = $row['rank']; you using mysql syntax in sql server. use row_number() function reproduce current logic. select * (select row_number() on (order game2points desc) [rank], totalpoints, useridfb, game2points theuser) result useridfb = 1234 or might want investigate rank depending on how want ties treated.

Creating a Like Button for a Facebook Photo -

hey, i'm trying create buttons facebook photos, can't figure out url use. or if it's possible. problem is, want display photos out of facebook photo album on microsite , want offer visitors possibility photos, when they're not visiting facebook. the problem is: want likes (and if possible, comments, too!) on microsite , facebook synchronized. i've tested , work: $('#likebutton').click(function(){ $.ajax({ type: 'post', url: 'https://graph.facebook.com/object_id/likes?method=post&format=json&access_token=token, success: function(res) { // style button } }); }); to unlike change type 'delete' remember need determine if object in question before making call. you give buttons specific name , append object_id class in order make each button unique , have method of getting object_id you need permissions 'publish_actions' , 'publish_stream' work. ...

true type fonts - What is the formula to get x, y coordinates from a truetype b-spline curve? -

what formula draw line in x, y space given b-spline coordinates in truetype font? please note truetype allows bspline curves , straight lines within glyph definition. if need change these commands series of moveto's , lineto's can use following: convert truetype data list of hinted coordinates. os can (following code uses windows apis). walk coordinates , translate curves lines (see code sniplet below): procedure tglyphevaluator.evaluatefrombuffer( action: tglyphevaluatoraction ); var h : ttpolygonheader; c : ttpolycurve; points : array of tpointfx; p, pe : dword; i, j : integer; f : double; pa, pb, pc : tpoint; begin setlength( points, 10 ); p := 0; repeat // eat polygon header move( fbuf...

c# - how to set user login name as menu item in asp.net LoginView -

i trying create menu item within web app sets parent node username of current user logged website. child nodes same incontext. currently have been trying write out user name using <% page.user.identity.name.tostring(); %> have found once user logs site value stays null. below entire code block have been playing with. you'll notice loginname control still in place (for testing) <asp:loginview id="headloginview" runat="server" enableviewstate="false"> <anonymoustemplate></anonymoustemplate> <loggedintemplate> <div class="logindisplay"> welcome&nbsp; <% page.user.identity.name.tostring(); %> <asp:loginname id="headloginname" runat="server" /> &nbsp; | <asp:loginstatus id="headloginstatus" runat="server" logoutaction="redirect" logouttext="log ...

android - problems with my SQLiteOpenHelper -

package com.owen.quartergames.dao; import java.io.inputstream; import java.util.arraylist; import java.util.list; import javax.xml.parsers.documentbuilder; import javax.xml.parsers.documentbuilderfactory; import org.w3c.dom.document; import org.w3c.dom.nodelist; import android.content.contentvalues; import android.content.context; import android.database.cursor; import android.database.sqlite.sqlitedatabase; import android.database.sqlite.sqliteopenhelper; import android.util.log; import android.widget.toast; import com.owen.quartergames.r; import com.owen.quartergames.domain.logentry; public class sqllitefishloggerdao extends sqliteopenhelper implements fishloggerdao { private static final string db_name = "fishinglog"; private static final string table_name = "logentries"; private static final string delete_log_entry_sql = "delete logentries _id = ?;"; private static final string find_log_entry_sql = "select _id...

XSLT Unit testing -

anybody know if there way can write unit tests xslt transformation. have lot xslt files , becoming hard to test them manually. know can have sample xml , compare output of xslt, looking better way test them. thanks... i looking options well. result, came across question, , few other potential candidate solutions. admittedly, haven't tried of them yet, can't speak quality, @ least other avenues potentially worthy of researching. jenni tennison's unit testing package utf-x unit testing framework juxy xtc additionally, found following article informative in terms of general methodology unit testing xslt. unit test xsl transformations

decode - Scrambled PHP code needs some fixing -

i adding modification phpbb3 discussion board , 1 of steps add line of code includes/functions.php so when copied file , opened in wordpad saw looked scrambled. here how looks partly: <?php /** * * @package phpbb3 * @version $id$ * @copyright (c) 2005 phpbb group * @license http://opensource.org/licenses/gpl-license.php gnu public license * */ /** * @ignore */ if (!defined('in_phpbb')) { exit; } // common global functions /** * set_var * * set variable, used {@link request_var request_var function} * * @access private */ function set_var(&$result, $var, $type, $multibyte = false) { settype($var, $type); $result = $var; if ($type == 'string') { $result = trim(htmlspecialchars(str_replace(array("\r\n", "\r", "\0"), array("\n", "\n", ''), $result), ent_compat, 'utf-8')); if (!empty($result)) { // make sure multibyte characters wellformed ...

javascript - Use the browser back button with pages loaded by Ajax? -

$(document).ready(function () { $('#gnav a').click(function (e) { e.preventdefault(); $('#contents').load(this.hash.substr(1) +'.php') }); }); that jquery code loads content div via ajax. how can make use of browser button code? thanks! you use html5 history apis described @ http://diveintohtml5.ep.io/history.html -- gives complete control of back/forward behaviour internal navigation.

Recent Step-by-Step for ActionScript / Flex / AIR with TextMate? -

i apologize if post redundant. i'm searching unsuccessfully recent, step-by-step instructions on how set actionscript 3, flex 4.5 , air 2.6 textmate on mac os x. i've found several posts concerning required bundles, of threads few years old in addition having convoluted, sparse instructions setting up. it seems auto-complete , .swc files supported, great. in addition instructions i'm interested in learning isn't supported , other common pitfalls. i've been familiarizing myself textmate's ui , it's amazing. rather use flash builder / eclipse, or flash professional. one last question - understand it's possible set our own keyboard shortcuts compile mxmlc , write .swf disk. possible have .swf auto open in flash player debugger after compiled. essentially, i'd continue using command+enter shortcut testing movies in flash professional build , launch since have difficult time adjusting new muscle memory. thanks. grab flex 4 sd...

windows phone 7 - How create custom feedback button? -

how create custom button expression blend 4? insert image button , receive feedback thank my guess: create button image inside, click event triggers emailcomposetask send email feedback. there dozens of tutorial how make button in blend. it's prety simple drag button on screen. change content of button image or create new/edit dupicate style/templeate of button. change textblock image. that's ui need logic. job visual studio. (you can create ui in visual studio - prefer way) example of xaml <button> <button.content> <image source="img.png" /> </button.content> </button> then in code behind page create emailcomposetask. emailcomposetask emailcomposetask = new emailcomposetask(); emailcomposetask.to = "foo@bar.com"; emailcomposetask.subject = "windows phone 7 app - feedback"; emailcomposetask.show();

java - BeanPostProcessor not called -

here's config.xml <?xml version="1.0" encoding="utf-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:context="http://www.springframework.org/schema/context" xsi:schemalocation=" http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd"> <context:component-scan base-package="com"> <context:include-filter type="assignable" expression="com.coc.frmwk.cmd.command"/> <context:include-filter type="assignable" expression="com.coc.apps.sample.dao.sampledao"/...

apache rewrite rule with parameters -

i have following url: http://www.domain.com/results.php?state=wa&city=seattle&sub=algebra i appear as: http://www.domain.com/results/wa/seattle/algebra and... http://www.domain.com/results.php?state=wa&city=seattle as http://www.domain.com/results/wa/seattle i figure write first as: rewriterule ^results/(.*)/(.*)/(.*)$ /results.php?state=$1&city=$2&sub=$3 [l] but i'm stuck figuring out how combine both of them... slashes throwing me. suggestions? rewriterule ^results/([^/]+)/([^/]+)/([^/]+)$ /results.php?state=$1&city=$2&sub=$3 [l] rewriterule ^results/([^/]+)/([^/]+)$ /results.php?state=$1&city=$2

iphone - Set 2 actions for UIBarButtonItem -

is possible register 2 actions uibarbuttonitem? specifically, referring "cancel" uibarbuttonitem present in abpersonviewcontroller. button has default action behind it, don't want change, add new action when button pressed. any ideas on how done? thanks! i removed previous answer had misunderstood question. not sure if app needs approved apple b/c not sure can pointer cancel button in "legal" way i'll assume can @ button. when first present person view controller can it's default target , action target , action properties , save them. set them custom target , action . when custom action called, send default action default target , whatever custom behavior is. that's best idea have, hope works!

c# - Query Datatable -

i have datatable looks this: id value 123 4.0 123 5.0 234 1.0 345 2.0 345 3.0 i want end (probably new datatable) contains sum of values grouped id this: id sumofvalue 123 9.0 234 1.0 345 5.0 here code, var query = row in dtable.asenumerable() group row row.field<double>("item_no") grp orderby grp.key select new { item_no = grp.key, sum = grp.sum(r = r.field<double>("item_stock")) }; i getting error r undefined , not able add these values in new datatable. does know how write this? thanks. i believe not specifying operation correctly. try this: var query = row in dtable.asenumerable() group row row.field<double>("item_no") grp orderby grp.key select new { item_no = grp.key, sum = grp.sum(r => r.field<double>("item_stock")) }; the diff...

java - Keeping track of utility classes -

i've been more , more frustrated problem see emerging in projects code-base. i'm working on large scale java project has >1m lines of code. interfaces , class structure designed , engineers writing code proficient. problem in attempt make code cleaner people write utility classes whenever need reuse functionality, result on time , project grows more , more utility methods crop up. however, when next engineer comes across need same functionality has no way of knowing had implemented utility class (or method) somewhere in code , implements copy of functionality in different class. result lot of code duplication , many utility classes overlapping functionality. are there tools or design principles team can implement in order prevent duplication , low visibility of utility classes? example: engineer has 3 places needs transform xml string writes utility class called xmlutil , places static tostring(document) method in it. engineer b has several places serializes doc...

asp.net - WCF, SOAP, Plain Old XML -

i'm confused things in web service world, , hoping explain me. here's want: want httppost xml document https://www.whatever.com/myservice (.???). in service, want xml doc, stuff, respond xml doc ultra simple -- " <xml....><success>true</success> " i can't soap or json or else. must conform exists. there hundreds of different companies sending data in format described, , adding requirement enclose in soap isn't possible. when using wcf web service, appears request me has sent this: <s:envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"><s:body><getdata xmlns="http://tempuri.org/"><value>3</value></getdata></s:body></s:envelope> when using .asmx page, response sent xml document namespace (http://tempuri, or if change it, whatever change to). unneeded , break existing code. when using generic handler (.ashx), can control gets returned back, i've...

c# - Old drag and drop code no longer works in windows 7 -

i have code allows me drag , drop hyperlink webpage onto windows form, , seperates url , title , puts them in 2 different text boxes. this works on windows xp fine, on windows 7 no longer works. i'm not sure difference lies. object data = e.data.getdata("uniformresourcelocator"); data null, when use string[] fmts = e.data.getformats(); one of fmts uniformresourcelocator, along bunch of other ones can never seem data from. if has resources point me or appreciate it, confusing me. thanks. update:added method code used work string hyperlinkurl = null; string hyperlinktext = null; hyperlinkurl = e.data.getdata(typeof(string)) string; // browser deliver url , text // in uniformresourcelocator (firebird) string[] tokens = null; if (hyperlinkurl != null) { tokens = hyperlinkurl.split('\n'); } if (tokens != null && tokens...

cocoa - IPhone SDK - How to serialize ABRecord? -

i'm new in iphone development, can advice me how serialize adressbook records? have read stackoverflow - how serialize simple object in iphone sdk , still have questions: should extend abrecordref? possible? or should implement own class nsobject? (similar question on mac forums , left without answer) thank you! abrecord opaque c type. not object in sense of objective-c. means can not extend it, can not add category on it, can not message it. thing can call functions described in abrecord reference abrecord parameter. you 2 things able keep information referenced abrecord arround: get abrecords id abrecordgetrecordid() . abrecordid defined int32_t can cast nsinteger , store wherever like. can later record abaddressbookgetpersonwithrecordid () or abaddressbookgetgroupwithrecordid() . aware, record changed or deleted user or app meanwhile. copy values inside record standard nsobject subclass , use nscoding or other techniques store it. of cause not benefit...

python - What is a monkey patch? -

i trying understand, monkey patch? is methods/operators overloading or delegating? does have common these things? no, it's not of things. it's dynamic replacement of attributes @ runtime. for instance, consider class has method get_data . method external lookup (on database or web api, example), , various other methods in class call it. however, in unit test, don't want depend on external data source - dynamically replace get_data method stub returns fixed data. because python classes mutable, , methods attributes of class, can as - and, in fact, can replace classes , functions in module in same way.

php - One file, displaying code on one page, but excluding on another? -

can advise how i'd alter template called on every page load display particular section on 1 page? i hope explain enough... index.php includes; require_once('./cache/templates/sidebar.php'); every subsequent page built uses what's defined in index.php file, meaning sidebar.php must. i'm wanting edit sidebar.php contain advert displays solely on index page. at moment, when edit sidebar.php, instance, display letter "b", display on homepage, , every other page so; index page: http://img.photobucket.com/albums/v684/nilsatis/1stack.jpg every other page: http://img.photobucket.com/albums/v684/nilsatis/2stack.jpg how can dictate 1 area of included file display on 1 page exclude showing on others? edit: time. it's appreciated. i inherited/purchased website , i'm finding index.php file temperamental. i'm attempting put code within sidebar (or below it, above footer) amend on index.php breaks it. } if (isset(...

iphone - Sending large data over bonjour -

i have method sends data through bonjour. problem data limited 1000 kb. know if want send larger data need break in packets. but raises question of how prevent packets being lost, , ensure packets received receiver. i not network , ask me change simple method enable larger data transfer. - (bool)senddata:(nsdata *)data error:(nserror **)error { bool successful = no; if(self.outputstreamhasspace) { nsinteger len = [self.outputstream write:[data bytes] maxlength:[data length]]; if(-1 == len) { // error occured *error = [[nserror alloc] initwithdomain:servererrordomain code:kservernospaceonoutputstream userinfo:[[self.outputstream streamerror] userinfo]]; } else if(0 == len) { // stream has reached capacity *error = [[nserror alloc] initwithdomain:servererrordomain code:kserveroutputstream...

scala - Enrich-my-library by extending TraversableLike with own methods -

i tried extend traversablelike own methods, failed. first, see wanna achieve: class richlist[a](steps: list[a]) { def step(f: (a, a) => a): list[a] = { def loop(ret: list[a], steps: list[a]): list[a] = steps match { case _ :: nil => ret.reverse.tail case _ => loop(f(steps.tail.head, steps.head) :: ret, steps.tail) } loop(list(steps.head), steps) } } implicit def listtorichlist[a](l: list[a]) = new richlist(l) val f = (n: int) => n * (2*n - 1) val fs = (1 10) map f fs.tolist step (_ - _) this code works fine , calculates me differences between list elements. wanna have such code works seq , set etc. , not list . i tried this: class richt[a, cc[x] <: traversablelike[x, cc[x]]](steps: cc[a]) { def step(f: (a, a) => a): cc[a] = { def loop(ret: cc[a], steps: cc[a]): cc[a] = if (steps.size > 1) loop(ret ++ f(steps.tail.head, steps.head), steps.tail) else ret.tail loop(cc(steps.head), steps) } } implicit ...

php - randomize mysql output as easily as possible -

i have mysql statement: $mysql=mysql_query("select id,name table1 order id limit 10"); from i'm doing while($row = mysql_fetch_array($mysql)){ echo $row['name'].'<br>'; } now i'm trying shuffle rows got out of mysql without using order rand() thats causing slowdown. whats correct syntax program in rows come out shuffled? if don't need them to "come out shuffled" ...as in "out of database," can shuffle after retrieve of records. since can fetch rows associative array, can shuffle result. give random order of rows returned. in case: $mysql = mysql_query("select id,name table1 order id limit 10"); $results = array(); //this might unnecessary while($row = mysql_fetch_array($mysql)) { array_push($results, $row); } shuffle($results); foreach( $results $row ) { echo $row['name'] . "<br />"; }

c++ - boost regex without possessive quantifiers -

is there similar way write regex without using possessive quantifiers (ie ++ , *+ ? boost::regex testing123("\"value\":\"((?:[^\\\"\\\\]++|\\\\.)*+)\""); i think comparable(?): boost::regex testing123("\"value\":\"(?>(?:(?>[^\\\"\\\\]+)|\\\\.)*)\""); update: it's trying match quoted text--but inside double quotes, there can number of inner, escaped quotes. possessive quantifiers syntactic sugar atomic grouping, i.e. (ab)*+ equivalent (?>(ab)*) . using this, can rewrite whole expression without using possessive quantifiers.

php - Using the JQuery .Ajax() method? -

i creating site user fills out form, has data sent php script , display result in div , have been struggling complete while now. below code have created: the button activates function: function callfunc() { var testvar = "example 01"; $.ajax( { url: "public/includes/usercreate.php", type: "post", data: testvar, success: function(html) { $('#web_content').html(html); } }); }; the php file this: <?php $test = $_post['testvar']; echo $test; ?> for reason though doesnt work. mean doesnt inject value of echo command div, if take out variable data php , have echo simple element, work , injects echo value div, below code run: <?php $test = $_post['testvar']; echo "<h3>user ???? created.</h3>"; ?> i think because not sending data correctly, tell me correct way send...

Rails Exporting to CSV without constructing CSV in memory -

rails 2.3.5, ruby 1.8.7. in prior question , there number of solutions exporting data in csv format, of them seem construct data in memory before sending. wise when exporting large data sets? of solutions in prior question avoid this. or impossible avoid building response without building whole response locally, either in memory or in temp file? i not surprised if latter true, since if there error in csv generation, might want send error message instead, might generating way data want generate data in memory/on disk. you can stream directly csv library (fastercsv in ruby 1.8). render :text => proc { |response, output| csv.generate(output) |csv| csv << ... end } you should use find_in_batches if concerned memory footprint.

c# - How can I have a service run a process under the current user's session? -

i have service, written in c#, monitors set of files. uses growl notify end-user if modified time of 1 of these files on 4 hours old. i've seen situations growl.exe not running under current user's session, did not receive updates. i'd service check make sure growl running (either growl.exe or maybe application id somewhere?) , start if it's not. how can ensure growl running in current user's session on machine service runs on? if service needs run current user, why make service? purpose of service run @ times, when user not logged in. such, it's designed run specific user @ times. why not convert program runs when user logs in?

Eclipse still giving me red squiggly lines after I add the libraries to the classpath -

i got libraries needed recognized javac task, eclipse ide still doesn't "get it" lol. when go preferences menu, need point library folders make red squiggly lines go away? :) thanks, alex how did "link" libraries? project properties (right click on project, "properties", "java build path")...

couchdb - NoSQL Documents for Relational Like Data (Locations) -

i have list of locations, in mysql has hierarchy above continent > country > county/region/state > provence > location. if store these locations in nosql store (like couchdb). store continent top level object , rest child arrays of objects continent. use map/reduce create various views countries, counties etc. recommended structure kind of data? make each continent document big? { name: "europe", type: "continent", countries: [ { name: "england" counties: [...] } ] } this suggestion , speculation on part, think may have idea. (i highly recommend looking geocouch location-type data.) if want proceed yourself, can store each location of levels of detail stored attributes: { "continent": "north america", "country": "united states", "state": "texas", "city": "houston" } i'm us, i'm using use...

sql - vb error: Value of type 'String' cannot be converted to 'System.Data.SqlClient.SqlCommand' -

i'm novice vb programmer , i'm sure solution trivial, however, getting above error when try display results of 1 of stored procs in sql server doesn't need parameters. how can fix this? my code excerpt: dim sqlcmd sqlcommand = new sqlcommand() sqlcmd.commandtext = "exec alltablecount" sqlcmd.commandtype = commandtype.storedprocedure sqlcmd.connection = globalfunctions.globalf.getdevsqlserverstoredprocedure(sqlcmd.commandtype) sqlcmd.executenonquery() msgbox(sqlcmd.executenonquery) where getdevsqlserverstoredprocedure defined in different file as: public shared function getdevsqlserverstoredprocedure(byval sql string) dim dbconn sqlconnection dim dbcommand sqldataadapter dim dspagedata new system.data.dataset dbconn = new sqlconnection(configurationsettings.appsettings("amdmetricsdevconnectionstring")) dbcommand = new sqldataadapter(sql) 'this line errors on' dbcommand.fill(dspagedata, "exceptions...

recover old Twitter consumer key and secret -

is there way put old consumer key , secret after has been reset? return twitter application details key , secret previous version. no. once reset consumer key/secret have deploy new key or application stop working.

c# - different format into one single line Interop.word -

i've been trying figure out how insert 2 different formats same paragraph using interop.word in c# this: hello planet earth here's want do assuming have document defined odoc, following code should desired result: word.paragraph opara = odoc.content.paragraphs.add(ref omissing); opara.range.text = "hello planet earth here's want do"; object ostart = opara.range.start + 13; object oend = opara.range.start + 18; word.range rbold = odoc.range(ref ostart, ref oend); rbold.bold = 1;

spring mvc - Tomcat doesn't seem to be picking up jars in my WEB-INF/lib folder -

i have maven pom builds required libraries web-inf/lib folder, packages war. when try deploy war, tomcat throws many classnotfoundexceptions - latest 1 being "java.lang.classnotfoundexception: javax.xml.bind.annotation.accessororder"; way i've found fix copy required library files web-inf/lib folder , tossing them tomcat/lib, can't correct way of doing it. is there have tomcat make in web-inf/lib folders? there have in source tell tomcat there? stuck having have tomcat/lib folder filled 50+ jars? maybe it's relevant, i'm using cxf , spring-mvc technologies. i'd post source code, don't know file put, i'll post current error: org.springframework.beans.factory.beancreationexception: error creating bean name 'publisher' defined in servletcontext resource [/web-inf/forum-servlet.xml]: instantiation of bean failed; nested exception org.springframework.beans.beaninstantiationexception: not instantiate bean class [publisher.publisher]: ...

gem - Can you add more than one local engine to a Rails 3 app? -

i'm trying break several pieces of reusable application functionality rails engines. have no trouble @ getting 1 engine work, app doesn't seem load data subsequent engines. i'm developing multiple engines simultaneously, i'm requiring them testapp's gemfile :path option. here's (simplified) setup (my understanding of bare minimum setup engine simple model): my_engines/engine1/lib/engine1.rb: module engine1 require 'engine' if defined?(rails) && rails::version::major == 3 end my_engines/engine1/lib/engine.rb: require 'engine1' require 'rails' module engine1 class engine < rails::engine end end my_engines/engine1/app/models/engine1/model1.rb: module engine1 class model1 end end my second engine, engine2 setup identically , in same parent directory (just name engine2 , model model2). i'm using jeweler package , generate gemspecs both engines, , i'm requiring both engines in test applicati...