Posts

Showing posts from June, 2010

ruby on rails - How can I use Nokogiri to write a HUGE XML file? -

i have rails application uses delayed_job in reporting feature run large reports. 1 of these generates massive xml file , can take literally days in bad, old way code written. thought that, having seen impressive benchmarks on internet, nokogiri afford nontrivial performance gains. however, examples can find involve using nokogiri builder create xml object, using .to_xml write whole thing. there isn't enough memory in zip code handle file of size. so can use nokogiri stream or write data out file? nokogiri designed build in memory because build dom , converts xml on fly. it's easy use, there trade-offs, , doing in memory 1 of them. you might want using erubis generate xml. rather gather data before processing , keeping logic in controller, we'd rails, save memory can put logic in template , have iterate on data, should resource demands. if need xml in file might need using redirection: erubis options templatefile.erb > xmlfile this simple exampl

Rails 3 manually creating model and persisting not working -

so have model object needs insert packing slips if model saved (the model in question payment). i attempted in after_save hook payment model, never persisted packing slips. moved controller in if @payment.save blah blah block, still not persist models. code below: if @payment.save if @payment.order.has_physical_product? # generate packing slip shipping slip = packingslip.new(:payment_id => @payment.id, :department => "shipping") slip.save! if @payment.order.has_book? slip = packingslip.new(:payment_id => @payment.id, :department => "royalty") slip.save! end end membershipmailer.membership_email(@order) unless !@order.has_membership? note membershipmailer firing know it's in there, packing slips not persist. attempt replicate functionality hand in console , works fine. not sure stopping it. have no validations in packingslip model @ moment. when it's not persisting

android - How to load images from url resources in droid app? -

i want load images uri resource , subdivide image smaller regions, , able place marker or icon on particular region on image. i'm not sure how started on this. can point me documentation, provide sample code or tutorials me started? a quick search revealed link: http://www.androidpeople.com/android-load-image-from-url-example/ and this: http://asantoso.wordpress.com/2008/03/07/download-and-view-image-from-the-web/ edit: overlay part think should help: android: how overlay-a-bitmap/draw-over bitmap?

javascript slide animation without a framework -

how javascript slide type animation without using javascript framework jquery? it have cross browser also. could cherry pick functionality jquery's source? javascript sliding panels using generic animation

canvas - Saving context.getImageData to a sessionStorage with html5? -

i try this, don't succeed. there posibility save object or values , use , e.g. redraw? instead of saving image data array (which uncompressed), suggest using canvas.todataurl base64-encoded png canvas, , saving string. later, can draw data url canvas .

java me - how to code client / server communication in J2ME? -

i developing project exchanges data between client , server. have coded in j2se don't know how make work in j2me? unless you're in need highlevel, use plain sockets. here links started: java midp api: socketconnection network programming j2me wireless devices client server in j2me (socket programming sample) network programming midp 2.0

read dicom file tags in c# -

can tell me how read dicom tag , vr in c#? you have various .net open-source libraries reading dicom files, among others: dicom# mdcm

scripting - Differentiate between 2 and 02 in bash script -

i have bash script takes date, month , year separate arguments. using that, url constructed uses wget fetch content , store in html file (say t.html). now, user may enter 2 digit month/date (as in 02 instead of 2 , vice-versa). how distinguish between above 2 formats , correct within script? the url works follows: date : 2 digit input needed. 7 must supplied 07 url constructed properly. here looking check append 0 date in case less 10 , not have 0 in front. so, 7 should become 07 date field before url constructed. month : 2 digit input needed, here url automatically appends 0 in case month < 10. so, if user enters 2, url forms 02, if user enters 02, url forms 002. here, 0 may need appended or removed. p.s: know method followed url s*c&s, need work it. thanks, sriram it's little unclear you're asking for. if you're looking strip 1 leading zero, do: month=${month#0} this turn 02 2 , , 12 remains 12 . if need remove more 1 0 (above 002

java - JFace ComboViewer with a header entry? -

i'm interested in populating comboviewer list of objects. know jface has nice features support that, if want make first entry in comboviewer <select connection> or other dummy entry doesn't have object associated it? there simple generic solution it? you tablecombo widget nebula project. can create tablecomboviewer input, selection listeners etc. set text of combo independently current selection. tablecomboviewer viewer = ... ... viewer.gettablecombo().settext("..."); i use in current project. tablecombo in alpha state, in application works quite fine.

vb.net - How to prevent publish resetting cookies using ASP.NET? -

i have web site uses cookies using asp.net, everytime publish new site , upload or of new .dlls invalidates existing cookies. cookies used track simple logins, want maintain cookies created before publish still usable afterwards - seems affect webkit based browsers , in testing can replicate issue after each partial or full publish. below code use set cookie: if httpcontext.current.response.cookies(cookie_name) nothing dim _cookie new httpcookie(cookie_name, cookievalue) _cookie.path = cookie_path _cookie.expires = cookie_expires httpcontext.current.response.cookies.add(_cookie) else httpcontext.current.response.cookies(cookie_name) .path = cookie_path .value = value .expires = cookie_expires end end if and here code use read cookie: if httpcontext.current.request.cookies(cookie_name) isnot nothing return httpcontext.current.request.c

How can i merge my local changes with the repository changes in github? -

i new github user. working on repository. got repository command by git clone sshpath git fetch origin now have made changes in local code , wish check in changes. however, same files have changed during time period , have been pushed repository other user. how can merge changes repository changes , check in code? can tell me commands? highly appreciated. regards aparna the normal workflow fetch commits done remote local repository first. can perform necessary merging locally without affecting remote repo. once finished, push origin. so it's git pull origin master pull remote changes local repo. conflicts need resolved here. git prompt when necessary (but rather smart resolve many conflicts on own). after that, git push origin master upload merged changesets.

algorithm - Performance of select method in Ruby -

the select method in ruby simple , straight forward. select elements in array matching specific criteria. for example, >> x = [4,5,7,89,4,5,3,6,8,9,4,45,56,23,2,7,3,5,4,224,234,565,546,345,23,234,234,234,23466,25,54] x = [4,5,7,89,4,5,3,6,8,9,4,45,56,23,2,7,3,5,4,224,234,565,546,345,23,234,234,234,23466,25,54] => [4, 5, 7, 89, 4, 5, 3, 6, 8, 9, 4, 45, 56, 23, 2, 7, 3, 5, 4, 224, 234, 565, 546, 345, 23, 234, 234, 234, 23466, 25, 54] >> y = x.select{|m| m>20 && m<200} y = x.select{|m| m>20 && m<200} => [89, 45, 56, 23, 23, 25, 54] one problem time penalty. select has go through values in array , sequential check result run in o(n) time. there better alternative select in lesser time. space not issue me. i talking on cases same select being used repetitively. if going use same select conditions 1000 times in loop array of size n, have operation 1000 * n times. whereas if optimized space, doing 1000 * 1 times. thanks. i&#

Disabling Android home button for industry application -

i'm writing industry application used traffic wardens register offences through program using forms. the app using webview container external webpage. don't want our users exit application have disable buttons. succeeded in disabling them except home button. i read threads topic, don't have solutions yet. idea able make app default home app if user presses home button launches app , not exit. how can accomplish that? if must able tamper android (when install app), if there solution through configuration appreciated. the idea able make app default home app if user presses home button launches app , not exit. how can accomplish that? there sample home application in android sdk. mirror manifest entry, notably putting home category in activity's <intent-filter> . the first time the, er, traffic warden taps home after installing app, chooser appear home app run. checking checkbox , tapping app mean home button run app forevermore. beyond cr

flash - Secretly adding (extra) HTTP GET Variables to a swf file through PHP -

i'm trying build workaround embedding (downloaded) flash videoplayer. (it's jwplayer...) at moment, when wants embed videoplayer have include swf added flashvars (ex: www.site.be/core/swf/player.swf?streamer=url&file=file.mp4&image=file.jpg&plugin=analytics...). that's messy, , feels bit risky... people know doing can remove plugin , other added data, resolving in me not being able track pageviews etc. my workaround this: $data = file_get_contents('url'); header("content-type: application/x-shockwave-flash"); echo $data; turns out that, when use file_get_contents on regular test file, info.php, responds through $_get['var'], above stated code works, when use on flashplayer, doesn't... as in: flash file not seem accepting (or responding to) added header variables... can tell me why is? 'flash' related problem or 'php' related problem? or there suggestions on how handle "flash-embed-with-to-much-

F# Quotations - traversing into function calls represented by a Value -

i've spent few hours trying grips f# quotations, i've come across bit of road block. requirement take simple functions (just integers,+,-,/,*) out of discriminated union type , generate expression tree used generate c code. know possible using quotations 'direct' functions. my problem expression tree seems terminate "value", , can't figure out how traverse value. my questions whether possible in situation? or there other approaches worth considering. type functype = | of (int -> int -> int) | b | c [<reflecteddefinition>] let add x y = x + y let myfunc1 = (fun x y -> x + y ) let myfunc2 = add let thefunc expr = match expr | a(x) -> <@ x @> | _ -> failwith "fail" printfn "%a" (thefunc myfunc1) // prints "value (<fun:myfunc1@14>)" printfn "%a" (thefunc myfunc2) // prints "value (<fun:myfunc2@15>)" printfn "%a" <

java - Browser get current url or response header -

how can response header or current url of browser( redirects page) swt browser object or other browser in java? also see more here import java.io.ioexception; import java.net.malformedurlexception; import java.net.url; import java.net.urlconnection; import java.util.iterator; import java.util.list; import java.util.map; public class httpresponseheaderdemo { public static void main(string[] args) { try { url url = new url("http://www.domain.com/index.html"); urlconnection connection = url.openconnection(); map responsemap = connection.getheaderfields(); (iterator iterator = responsemap.keyset().iterator(); iterator.hasnext();) { string key = (string) iterator.next(); system.out.print(key + " = "); list values = (list) responsemap.get(key); (int = 0; < values.size(); i++) { object o = values.get(i);

perl - better way for converting multidimensional array to one dimensional array -

currently, using following code convert irregular multidimensional array 1 dimensional array. my $array = [0, [1], 2, [3, 4, 5], [6, [7, 8, 9 ], ], [10], 11, ]; @mylist; getlist($array); print dumper (\@mylist); sub getlist { $array = shift; return if (!defined $array); if (ref $array eq "array") { foreach $i (@$array) { getlist($i); } } else { print "pushing $array\n"; push (@mylist, $array); } } this based on recursion checking each element. if element reference array calling recursively new array. is there better way solve kind of problem? first of function should never return data modifying global variable. return list instead. as efficiency, perl has surprisingly large function call overhead. therefo

c# - Monotouch access private API with return type -

i trying port following code mirror app's display external display via vga adapter. https://github.com/robterrell/tvoutmanager/blob/master/tvoutmanager.m this code optionally accesses uigetscreenimage(); returns cgimageref object. how can call private api monotouch? want use method internal build of app trade shows. i have seen several solutions, none talks how call selector return type. cgimageref's monotouch wrapper, cgimage , has static property screenimage . can screenshot property, haven't used though. details on binding objective-c objects (including returning selector values) can found here: http://monotouch.net/index.php?title=documentation/binding_new_objective-c_types/binding_details&highlight=bind

c# - Need advice in implementing ASP.NET custom output cache -

my website similar blog page content not change frequently. decided to use page output cache. but when turned on output cache every page , set cache duration 1 hour, web-hosting provided suspended site using extensive system memory. after re-set duration 2 mins, times i'm getting database connection timeout errors. for better performance, anyway need caching, not cache in memory. came following idea. please advice whether best approach or have better solutions this? i want write http module intercept requests. if cache version specific request not there, writes page response (using filters write) disk file, otherwise sends file response. target framework 2.0 if you're in asp.net 4.0, don't need write httpmodule - output caching provider-based, can write new provider , plug in. gunnar peipman has great blog here on writing file-based output cache provider.

php - LightOpenID authentication using POST method -

is there way authenticate using lightopenid library using post method? exact, after authenticating, google (for example) returns specified url data sent me using method, ends in ugly , long url. my code is: define('base_url', 'http://someurl.com'); try { $openid = new lightopenid(); if (!isset($_get['openid_mode'])) { // no openid mode set, authenticate user $openid->identity = 'https://www.google.com/accounts/o8/id'; $openid->realm = base_url; $openid->required = array('contact/email'); header('location: '.$openid->authurl()); } else if ($_get['openid_mode'] == 'cancel') { // user canceled login, redirect them header('location: '.base_url); } else { // authentication completed, perform license check if ($openid->validate()) { $openid->getattributes(); } } } catch (errorexc

How can I navigate any JSON tree in c#? -

i need navigate json structure navigate xml using xmldocument . the structure not known, , need iterate on nodes parse data. is possible? know can use javascriptserializer deserialize known type, not case can receive valid json. i'm using .net 3.5 (sp1) , cannot upgrade 4.0 @ moment. upgraded .net 4.0 use dynamic types (which awesomeness made code) read article: http://www.drowningintechnicaldebt.com/shawnweisfeld/archive/2010/08/22/using-c-4.0-and-dynamic-to-parse-json.aspx it explains way of parsing json dynamic object has dictionary inside. so, iterating dictionary nice linq, wouldn't be? --- or if you're in .net 3.5... --- ;) why don't implement extension method "todictionary"? you can receive json text, later parse regular expression , split properties , values dictionary, done suggested extension method. a sample of how work that: idictionary<string, object> deserializedjson = jsontext.todictionary(); fits

Android: Home, Menu, Back, and Search Button don't work -

using gingerbread source, compiled code , loaded rom onto nexus one, after starting phone, home, menu, back, , search buttons don't work anymore. know how resolve error? apparently building wrong version phone. building , loading generic version instead of htc passion version.

java - Using polymorphic JAX-WS webservice parameters -

i have simple jax-ws webservice: @webservice public class animalfeedingservice { @webmethod public void feed(@webparam(name = "animal") animal animal) { // whatever } } @xmlseealso({ dog.class, cat.class }) public abstract class animal { private double weight; private string name; // getters , setters } public class dog extends animal {} public class cat extends animal {} i create client , call feed instance of dog . animal mydog = new dog(); mydog .setname("rambo"); mydog .setweight(15); feedingserviceport.feed(mydog); the animal in body of soap call looks this: <animal> <name>rambo</name> <weight>15</weight> </animal> and unmarshallexception because animal abstract. is there way have rambo unmarshalled instance of class dog ? alternatives? as might have guessed, xml parser not able determine exact subtype of animal used when requesting because sees generic

wpf - Is it possible to add more characters after a binding in xaml? -

i wondering something, , couldn't find relevant topics. have following binding : content="{x:static resx:resource.form_otheroption_description}" this place string in label. asking myself if can add ":" after binding, not in code, in xaml. label represent "name :". adding ":" part of binding not option. edit i'm working in 3.5 version any suggestions. thanks in advance. you accomplish like: <textblock text="{binding source={x:static resx:resource.form_otheroption_description}, stringformat={}{0}:}" /> edit: <label> s content property not respect stringformat property of binding apparently. i've found has been moved contentstringformat property on <label> . <label content="{x:static resx:resource.form_otheroption_description}" contentstringformat="{}{0}:" />

tfs - Resetting My Local Workspace -

i have large tfs project local copy's mappings have been screwed beyond repair. best way rid of local copy , new 1 not make server copy explode or make me have redo mapping manually? if open source control explorer , open 'edit workspaces' dialog, allow delete existing workspace , create new one. when create new one, can explictly choose server paths want mapped each local path. should have mapping directories need.

assembly - Is operating system an abstraction? -

how matter if assemble, link , load assembly language code or c code in dos environment or windows environment? shouldn't result same? after execution done microprocessor, not operating system. learning assembly language old book of ms-dos era. setback? isn't assembly language , code execution, o/s independent? or matter code written in other languages? isn't assembly language , code execution, o/s independent? or matter code written in other languages? yes , no. yes. machine's language independent of os. doesn't matter if wrote or c compiler wrote you. no. have use os run software. if want useful , you'll need call os api's. entirely os dependent.

Is there any way to run actionscript 1 code in a flash project running under 3? -

i've got legacy code don't have time rewrite. there way mark code block flash player reads actionscript 1? thank you actionscript 1/2 , actionscript 3 run under different vms, therefore it's impossible run as1 in as3 project.

subsonic3 - Where are the Subsonic T4 templates when installed through NuGet? -

this might dumb question, integrated subsonic asp.net 4.0 webforms project , while dll reference added, don't see t4 templates anywhere. i think t4 templates not required if you're using simplerepository approach, don't see sense in making subsonic nuget package if you're not getting t4 templates it. i'd think it'd rather more logical if subsonic nuget package installed t4 templates , user removes them if doesn't need them, rather having download t4 templates separately though installed subsonic through nuget. does know this? i wanted add them in problem (according david ebbo) reference drops right /bin folder. t4s, however, need go root somewhere because need add code project. i know it's inconvenience - there no manifesting system (not sure if there 1 now) use "push root". if changes, i'll update package :).

c++ - How do I parse a txt file which erases all the lines except what I need? -

i want parse text file want , create txt file in c++. have text file looks this. user : group : comment1 : comment2 : *** label *** id : nick pass : sky123 number id : 9402 *** end of label *** ###################################### and goes on. want create new txt file leaves lines contains colon(:) , erase rest such " * label * ", , save result in new txt file. answer txt file be user : group : comment1 : comment2 : id : nick pass : sky123 number id : 9402 how do in simple way? thank much. i have not tested this, idea. void foo(ifstream& ifs, ofstream& ofs) { while ( !ifs.eof() ) { string line; getline(ifs, line); if (line.find(":") != string::npos) ofs << line; } }

iphone - Metallic sparkle effect in OpenGL ES? -

i'm working on android , iphone app. i'm rendering lots of smallish (about 32 pixels) billboards screen particle system , want give glitter-like sparkle each billboard e.g. particles falling, random ones briefly light , sparkle catch light. there simple way achieve effect? limitation, cannot use pixel/vertex shaders. i thinking along lines of giving each billboard metal-like lighting effect (although i'm not sure how part) coupled giving each billboard random , rotating normal flat shading each billboard randomly light up. i'm having trouble making nice. disclaimer: don't know opengl, , did't try write below. you can have another, 'brightly lit', texture , substitute when normal @ 'shine' position. take piece of metal , rotate it. once normal close 'full shine' position, metal shines bit brighter, , muted reflex travels through it, bright flash in middle, dull again. if can, apply second bright texture of narrow '

iphone - Several Buttons using the same UIActionSheetDelegate methods -

i have view contains 5 buttons. when each button tapped uiactionsheetdelegate method called: -(void)actionsheet:(uiactionsheet *)actionsheet clickedbuttonatindex:(nsinteger)buttonindex i have each buttons tag property set 0-4. i'm having hard time delegate method finding out button.tag sent. sender.tag information passed along action sheets delegate methods? for delegate method use case statement find out button pressed on action sheet , guess i'll use if statement determine sender.tag == 0 etc. i'm little confused @ point , need little assistance if @ possible. as in advance! t you use buttonindex passed actionsheet:clickedbuttonatindex: determine button pressed. buttons indexed starting @ 0.

php - dynamic xsrf with javascript -

i'm wondering if it's possible xsrf-attack this: <form ...> <input type="hidden" name="token" value="xsrf-generated-token" /> ... fields+submit button ... </form> using javascript - like: attacker gets me site then calls javascript /admin/users/test/edit he parses xsrf token (using regexes - dom wouldn't work because of same-origin-policy) and send signed edit... shouldn't /admin/users/test/edit signed token well? the reason normal ajax requests (using xhr) limited the same origin policy . means in order work, you'd first need exploit xss vulnerability before execute csrf vulnerability. now, may appear jsonp might way around that. it's not. since jsonp uses script tags, result of request fed right in. , since result html , not js, syntax error should thrown. so there should no way ever token without first compromising site itself. 2 things should noted depends upon: all brow

HTTP client library in Groovy -

i interested in querying rest api using groovy. found httpurlclient seems should want, groovy console complains "unable resolve class httpurlclient" found link has sample code httpurlclient: http://groovy.codehaus.org/modules/http-builder/doc/httpurlclient.html but copy-pasting code gives same error. i looked using httpbuilder seems might work, gave similar errors well. any idea need these work? thanks have installed library? http://groovy.codehaus.org/modules/http-builder/download.html edit if want use snapshot release, can add resolver in annotation, rather editing xml file; @grabresolver( name='codehaus.snapshot', root='http://snapshots.repository.codehaus.org', m2compatible='true' ) @grab( 'org.codehaus.groovy.modules.http-builder:http-builder:0.5.2-snapshot' ) import groovyx.net.http.* at top of script should it

android - Scroll webView with volume keys -

how scroll webview w/ volume hard keys? ...and can done easing? if so, how? i'm noob android - coming on actionscript , appreciated. my r.id.webpg001 webview id. this i'm @ now: @override public boolean dispatchkeyevent(keyevent event) { int action = event.getaction(); int keycode = event.getkeycode(); scrollview scrollview; scrollview = (scrollview) findviewbyid(r.id.webpg001); switch (keycode) { case keyevent.keycode_volume_up: if (action == keyevent.action_up) { scrollview.pagescroll(scrollview.focus_up); scrollview.computescroll(); } return true; case keyevent.keycode_volume_down: if (action == keyevent.action_up) { scrollview.pagescroll(scrollview.focus_down); scrollview.computescroll(); } return true; default: return super.dis

c - Wrong gem being required with require 'serialport' -

i've moved original question bottom no longer relavent problem. i unable locate serialport.so able require this: $ rvmree@global $ irb > require 'serialport.so' => true (gem list returns emtpy) update: require 'serialport' when executed in irb session, both requires return true when uninstall gem. so, appears gem being required via "require 'serialport'". i've searched system other versions of gem without result. how can ensure correct gem being required? update: [removed list of gems] when uninstall gems in rvm global namespace, can still require 'serialport' , true. now output of gem list empty , require 'serialport' still returns true within irb. i'm using rvm, i've emptied global gems, , gems in gemset i'm using. there no system gems name containing 'serialport', i've searched files included in gem directory such serialport.o, serialport.so , didn't find anything.

Question about java concurrenthashmap replace method -

i have following code public class test{ private static final string key = "key"; public static void main(string[] a){ concurrenthashmap<string,string > map = new concurrenthashmap<string,string>(); system.out.println(map.replace(key,"1")); system.out.println(map.replace(key,"2")); } } the output null both times. isn't supposed 1 second time? the doc says: replace entry key if mapped value. acts as if ((map.containskey(key)) return map.put(key, value); else return null; hence no, first replace doesn't put.

c++ - WM_SOCKET in Qt -

i plan on using qt tcp/ip , udp assignment getting error states wm_socket not declared in scope wm_socket used in wsaasyncselect(socket, this->winid(), wm_socket, fd_accept|fd_close); i have included qmainwindow , winsock2.h , , ws2tcpip . added mingw library. am missing include file or else? there no wm_socket message defined winapi. supposed define yourself. #define wm_socket (wm_user + 1)

mysql - Query to count how many times an ip is used with different accounts -

i single query count how many different customer accounts use same ip log in. +---------+-------------+------+-----+---------+----------------+ | field | type | null | key | default | | +---------+-------------+------+-----+---------+----------------+ | info_id | int(11) | no | pri | null | auto_increment | | afid | int(11) | no | | 0 | | | access | date | no | | null | | | ip | varchar(15) | no | | | | +---------+-------------+------+-----+---------+----------------+ afid customer id. every time log in row inserted table. have been trying nested selects without luck, , can think of. i'm on thinking :) thanks in advance! try this: select count(distinct afid) afid_count yourtable ip = '....' to list of used ips: select ip, count(distinct afid) afid_count yourtable group ip having afid_count > 1 order afid_count des

c++ - should I erase by myself the pointer of an boost::ptr_vector? -

i wondering if code leak : int main() { boost::ptr_vector <char > v; v.push_back(new char[10]); v.clear() } will ptr_vector destructor or clear() function delete pointers contains or have myself? from vector documentation (http://www.cplusplus.com/reference/stl/vector/~vector/): vector destructor destructs container object. calls each of contained element's destructors, , deallocates storage capacity allocated vector. delete[] won't called, it'll leak. , other commenters pointed out, there more stl ways it.

windows - How to pass string between applications using SendMessage in C++ -

is possible pass char* between 2 applications using custom message in sendmessage? know possible using wm_copydata, want know if can send using custom message(wm_user + ..) thank you! wm_copydata has been invented because ask not feasible directly. because different applications live in different address spaces, pointer passed application has no meaning in one. wm_copydata deals problem using ipc mechanism under hood, when want share data application; viable options usual ones: pipes, shared memory & co, have here see windows provides.

svn - What's a good way to version control a website development project that includes MediaWiki and WordPress installation? -

i trying figure out version control procedures website includes mediawiki , wordpress installations. started thinking these , asking , vague questions. say website root is ~/public_html there various static html pages ~/public_html/page1.html ~/public_html/dir/page2.html ... and there installations of mediawiki ~/public_html/wiki/ and wordpress ~/public_html/blog/ and possible other webapp have database backend. there few questions not clear me if use subversion, what's first step? have /public_html running on web server machine, need download complete /public_html local development computer first , commit svn server (separate) project? have other software projects version controlled using subversion. if use subversion , when deploy, check out, i.e. website that's used server working copy of repository? mediawiki , wordpress versioned? .svn directories? won't exposed? besides version control files in /public_html how backup databases in way that

html - Can't get a simple javascript prompt working -

<html> <title>adsfasdf</title> <head> <link rel="stylesheet" type="text/css" href="style.css" > <script type="text/javascript"> function editdates() { var dates = prompt("fill in date(s) of absence", "example: travel 1/7 - 2/10"); } </script> </head> <body bgcolor="#000088"> <table cellspacing="0" border="1" cellpadding="1" width="100%" height="100%"> <tr> <td>name</td><td> <form class="r1c1" method="link" action="index.html" onclick="editdates();"> <input type="button" name="submit" value="edit"/></form> </td> </tr> </table>

c# - Where can I find a good Silverlight 4 WCF duplex tutorial? -

i'm interested in seeing example of duplex service silverlight 4 application connects to, there 1 out there? i'm willing book if it's located in it. i went though msdn 1 located here , didn't follow well, or working. 2 best examples i've found: http://www.42spikes.com/post/using-silverlight-4-and-nettcp-duplex-callbacks.aspx http://tomasz.janczuk.org/2009/11/pubsub-sample-with-wcf-nettcp-protocol.html some info -- http://tomasz.janczuk.org/2009/11/wcf-nettcp-protocol-in-silverlight-4.html hope helps -- chad

events - Sencha Touch fireEvent -

i have main panel comprised of sub panels , fire event in main panel , listen on sub panel. i can fire event within subpanel , works can't seem fire event main panel. my namespace sub panel "test.testcard" , i've tried fire event on no success. here example of how this: ext.setup({ onready: function() { var mainpanel = new ext.panel({ fullscreen: true, layout: 'fit', renderto: ext.getbody(), listeners: { 'mycustomevent': function() { alert('event fired!'); } }, items: [ { items: [ { html: 'my inner panel' }, { xtype: 'button', text: 'click me!', handl

mysql - SQL update that seems to require GROUP BY -

i have update i'd make table, like update mytable left join worker on first=worker_first_name && last=worker_last_name group concat(first, '%%', last) set taint = count(pkey) > 1; but of course table_reference in update not allow group bys. how can set column? it's checking if first/last name combination occurs @ once in other table. update mytable inner join ( select first, last, count(pkey) > 1 result mytable left join worker on first=worker_first_name , last=worker_last_name group first, last) other on other.first = mytable.first , other.last = mytable.last set taint = other.result;

Activity in android -

i need data web , display in ui.currently, did functionality in activity oncreate() method.is right? or else can use other life cycle method onresume(),onpause().please guide me. long lasting operations, such download web, should newer invoked ui thread (in oncreate, onresume, onpause). should use background tasks this, or anr crash. 1 of possible ways use asynctask, explained here .

javascript - Add class to child that fits url -

i've made 1 page layout website, menu doesn't show active/current link, when users come google or bookmarked it. i've made script works fine, see.... horribly. how can smart?? //set .active current page link if (location.href.indexof("#2") != -1) { $("#menu li:nth-child(1) ").addclass("active"); } if (location.href.indexof("#3") != -1) { $("#menu li:nth-child(2) ").addclass("active"); } if (location.href.indexof("#4") != -1) { $("#menu li:nth-child(3) ").addclass("active"); } if (location.href.indexof("#5") != -1) { $("#menu li:nth-child(4) ").addclass("active"); } if (location.href.indexof("#6") != -1) { $("#menu li:nth-child(5) ").addclass("active"); } thank in advance... how like: $("#menu li:nth-child(" + ( locati

oracle - Hibernate Composite Table and Key Issues -

i trying hibernate work composite table. there users table, roles table, , composite table called userroles connects both. query getting user roles eagerly outputs below. keep getting stackoverflow errors, or null exception. question why columns product 2 userid , roleid outputs in oracle? select this_.id id0_1_, this_.datecreated datecrea2_0_1_, this_.email email0_1_, this_.enabled enabled0_1_, this_.firstname firstname0_1_, this_.lastname lastname0_1_, this_.password password0_1_, this_.salt salt0_1_, this_.username username0_1_, userroles2_.userid userid3_, userroles2_.roleid roleid3_, userroles2_.roleid roleid3_0_, userroles2_.userid userid3_0_ cisco.users this_ inner join cisco.userroles userroles2_ on this_.id=userroles2_.userid this_.username='mike' my classes below. user.java @entity @table(name = "users", schema = "cisco") @suppresswarnings("serial&qu

javascript - Applying json data to format style via jQuery -

i have odd problem following: function loadtextbox(jsonurl,divid){ $.getjson(jsonurl, function(json) { $('#' + divid).html('<h2>'+json.heading+'</h2>'); alert(json.config.headingconfig); $('#' + divid).children().css(json.config.headingconfig); }) } the alert above returns: {color: 'white', fontfamily:'arial, times, serif'} however, format of text not change. now here odd part: if this: function loadtextbox(jsonurl,divid){ $.getjson(jsonurl, function(json) { $('#' + divid).html('<h2>'+json.heading+'</h2>'); alert(json.config.headingconfig); $('#' + divid).children().css({color: 'white', fontfamily:'arial, times, serif'}); }) } it works fine... text format arial font , white. baffled... means there simple answer, ideas? it looks json.config.headingconfig cont

jquery tab error problem -

hello im trying jquery , im trying make simple tab menu, cant hide content, can see have made here http://jsfiddle.net/yyj7v/ hope can tell me im doing wrong this how i'd it: $(function() { var tabcontainers = $('div.tabs > div'); tabcontainers.hide(); $('.tabsnavigation a').click( function(){ var = $(this).parent().index(); $(tabcontainers).eq(which).show().siblings().filter('div').hide(); return false; }); }) js fiddle demo . notes: as implied in comment question: using mootools, rather jquery in demo. won't work. or might, rarely, due syntax/use-differences filter() misspelled, , couldn't work. i couldn't see, in demo, click-handling effect action, added in.

.net - C# NET HTTP.SYS web server -

i need create extremely basic web server allow me go http://1.2.3.4:8080 , browse list of files in c:\web or something. i found http://mikehadlow.blogspot.com/2006/07/playing-with-httpsys.html looks perfect ran couple of questions. 1) when replace ip * or + documentation says, access denied errors in system.dll. when use localhost or local ip works fine. why this? potentially able bind specific ip address on machines have more one. 2) missing something, how specify core directory files serving code? re 1: because dont have permissions register url. use "http add urlacl2 register permissions user (as admin) make binding. example: http add urlacl url=http://+:8080/ user=domain\username re 2: dont. pretty code. http.sys not read file system - driver. application must read files , answer request.

c# - Unit of work, repository, context -

if take at question have question on next step. imagine have 2 repositories generating items , subitems. have unitofwork acts context changes (in simple case) 2 different items. there seem few ways of generating unitofwork, injected repository, can generated factory (and either injected or retrieved factory. my question how unitofwork notify repositories changes committed? i guess can have repository subscribe events on unitofwork commit/rollback. second question, idea of unit of work is, if have right, co-ordinate updates may conflict. using example of item , subitem (an item has number of subitems) unitofwork coordinates item written first allowing subitem written? seem need unit of work know repositories seems wrong. thanks. the way structured repository have unitofwork "token", spawned beginunitofwork() method on repo, had passed pretty other method on repo made db calls. thing has know how do, conceptually, disposed, when happens causes nhiberna

ios4 - How do I create a multiline table cell in iOS? -

Image
how can second cell expand fit text rather scaling text? there built in way of doing in ios or have come home-cooked solution? if in ios contacts application, there's box address. can't find how implement though. for looking achieve in future, here's code solution: header file: #define font_size 22.0f #define cell_content_width 320.0f #define cell_content_margin 5.0f implementation file: - (cgfloat)tableview:(uitableview *)tableview heightforrowatindexpath:(nsindexpath *)indexpath { if (indexpath.section == 0 && indexpath.row == 1) { nsstring *text = [atmannotation address]; cgsize constraint = cgsizemake(cell_content_width - (cell_content_margin * 2), 20000.0f); cgsize size = [text sizewithfont:[uifont systemfontofsize:font_size] constrainedtosize:constraint linebreakmode:uilinebreakmodewordwrap]; nslog(@"size address height:%f width:%f",size.height,size.width); cgfloat height = max(s

Adding SharePoint screen to legacy c# application -

we have enterprise application written in c# customers. server runs in our data center , customers connect via windows application written in c#. pretty standard. management dashboard added our application. told using sharepoint somehow add sharepoint dashboard main screen of our client application (winforms). is possible? client application have somehow show web page sharepoint server guess no problem using html componenent. i'm more worried getting sharepoint work our existing data (sql server 2008). i suggested writing dashboard ourselves , avoiding sharepoint. management add more 'business intelligence' our application. know way of future i'm worried complexity of integration sharepoint. there various options integrating sharepoint windows forms application. simplest embedding web browser control , point page dashboard set up. alternatively use sharepoint client object model (2) (make calls sharepoint server) , retrieve data (and potent

android - Scroll webView with volume keys Part II -

related thread: scroll webview volume keys how can implement class (or short-hand way) can used webviews w/o having rewrite on , on again each webview? nxt webview id's "webpg02", "webpg03", , on... nested within veiwflipper id "ac4313". i'm sure basic once again helping android noob! implement onkeydown() in activity , apply button presses current webview .

iphone - Why is there a delay when presenting this modal view? -

i have app starts tableview (from xib) loads multiple navigation controllers. want present modal view on startup if long init sequence underway. tried presenting modal view in app delegate, view doesn't appear until after underlying code complete. mainwindow.xib loads tableviewcontroller, put call presentmodalview in view appear same result. have numerous nslog calls can watch happening can't figure out why view doesn't appear until after both app delegate , tableview controller's viewwillappear finish. moved call viewdidappear same result. here code snippet: app delegate: - (void)applicationdidfinishlaunching:(uiapplication *)application { // add tab bar controller's current view subview of window [window addsubview:tabbarcontroller.view]; [window makekeyandvisible]; [[uiapplication sharedapplication] setstatusbarhidden:no]; // if new version being installed init stuff if ( <needs update code here>) { uncompre

amazon s3 - Is it advisable to use FFMpeg on my local server for video conversion? -

we starting video sharing website users able upload videos in native formats. however, since video streaming on web in flv format, need convert videos flv. also, site hosted on amazon ec2 , storage using s3. can run ffmpeg on amazon ec2 ? best way go ? there other alternatives video encoding rather doing conversion on our own server ? came across www.transloadit.com seems same charging bomb. there cheaper , more intelligent alternatives ? we planning make website 1 of top 10 biggest niche video streaming websites on internet. ec2 instances virtual machines can whatever on them, including running ffmpeg. only can work out costs/benefits of doing conversion on ec2, server or encoding service encoding.com (a google search turn more services). some thoughts: ec2 pay hour , can add new servers (although need design process support multiple servers) fast (and free) transfer between ec2 , s3 your own servers you pay hardware upfront not easy scale if needed

java - Using getGeneratedKeys with batch inserts in MySQL with Connector/J -

using connector/j, batch insert master table followed batch insert details table ( preparedstatement.executebatch() both). haven't found information online, i'm looking feedback people have experience this. can use statement.getgeneratedkeys() ids of newly inserted rows in master table can use them foreign keys in detail inserts? what if not every query resulted in insert (e.g. there insert ignore or insert ... on duplicate key update query)? row in statement.getgeneratedkeys() every statement, or new ones? what statement.getgeneratedkeys() return there error 1 of inserted master records, , continuebatchonerror set true in connection string? are there differences in related behavior between connector/j versions 5.0.x vs 5.5.x? mysql 5.0 vs 5.1? any there other issues or gotchas should aware of? is there better way this? well, ran tests. connector/j 5.1 , mysql 5.1.42, observe following: statement.getgeneratedkeys() works expected inserts if ro

php - How to invoke $customer->save() on a given event -

so i've been tasked creating module login/register customer in magento based on existing authentication data system. thought create widget can placed admin links. part i've figured out how do. the next part may need assistance. i've read enough articles understand how create custom url structure in order fire module's actions, assume can link directly action, invoke login or registration request , send user referral page (or profile page, haven't spec'd project details tbd). here's need help. i've found methods capture post request login , registration pages -- should extend mage_customer_accountcontroller class , create required methods loosely similar calls used in loginpostaction() , createpostaction() methods? for reference, started initial project dev on fresh install of newly-released 1.5.0.0 file i'm referring /magento/app/code/core/mage/customer/controllers/accountcontroller.php all event-based behavior in magento sho

Custom html/javascript in Sproutcore? -

is possible have custom html/javascript in sproutcore? i have use code cloud service provider. yes, rather easy. in view can define render() method: app.myview = sc.view.extend({ render: function(context, firsttime) { var somevalue = `getvalue` context.push( "<span class='myspan'>", somevalue, "</span>", "any other html/javascript want, can go here." ); } }) you can use firsttime property know if rendering first time (put out everything), or updating existing code. you can find out more: http://guides.sproutcore.com/views.html#the-render-and-update-methods http://frozencanuck.wordpress.com/2009/08/14/creating-a-simple-custom-view-in-sproutcore-part1/

jquery - scrolling down box with most recent feeds -

i've taken @ these 3 websites: www.foursquare.com www.untappd.com www.getglue.com as can see main page has scrolling down recent activity box. how create this? is jquery or what? its done javascript, can use jquery make easier on yourself. heres quick example http://jsfiddle.net/tpmqj/ $(function(){ setinterval(function(){ $("#wrapper").prepend($("<li>a new item</li>").hide().fadein()); }, 4000); }); you use timeout, or interval, coupled ajax request, polls database , returns new results etc. basic concept appending new items dom tree.

emacs - How to write eshell script? -

there. i'm new eshell,and come problem how can script it. i've tried (rm ~/somefile) , worked.so every command this?how should write conditional code , loop?and should customize make system execute script using eshell other others ,like bash,by default? i'm not @ english,and hope can understand mean.i'll appreciate correction english expression? you can call elisp command/function/operator eshell; suppose means can script using elisp (see gnu emacs lisp reference manual ). example: welcome emacs shell ~ $ (defun foo (n) (if (= 0 (mod n 2)) "even." "odd!")) foo ~ $ foo 2 even. ~ $ foo 3 odd! ~ $