Posts

Showing posts from July, 2015

Android Chat room Application -

can suggest me how go forward (howto guide/steps) create android chatroom/chat application? "client-server app" not able start because read jetty webserver couldn understand how start. appreciated. thanks lot help, rohit you should xmpp information. have great servers out there, free use, openfire, , client libraries android asmack.

windows - Manual Cygwin Installation without using Setup.exe -

i having issues finding of necessary files install cygwin correctly when not using premade setup utility. reason behind fact company computer blocks usage of .exe, , won't give me clearance install it, (they isn't needed job) expects me perform tasks cygwin make simpler. so question thus; there somewhere/someone have list of packages need manually install 1 of mirrors make cygwin run correctly? well, this new answer old question, might helpful someone... just run installer -b switch, example: setup-x86_64.exe -b you should install on path have rights.

java - JAXB marshalling failed: "null" error when running an application on websphere. Same application runs fine on Tomcat -

i have web application containing servlet runs fine on apache tomcat. however, when deploy war file on websphere developer edition 8, following error when servlet gets executed. e com.ibm.ws.webcontainer.servlet.servletwrapper service srve0014e: uncaught service() exception root cause dfsdownloadserviceservlet: javax.servlet.servletexception: com.emc.documentum.fs.rt.serviceinvocationruntimeexception: com.emc.documentum.fs.rt.serviceinvocationruntimeexception: jaxb marshalling failed: "null". @ com.company.dfs.download.dfsdownloadserviceservlet.dopost(dfsdownloadserviceservlet.java:158) can give pointers why getting error. thanks did check if there same libraries in different versions in warfile or maybe provided websphere. i had problem well, war file run on tomcat without problems, on websphere didnt run. i searched , found libraries there twice in different versions. looks classloader of tomcat , websphere have different loading orders. maybe s...

ruby regex - how to match everything up till the character - -

given string follow: randomstring1-randomstring2-3df83eeff2 how can use ruby regex or other ruby/rails friendly method find until first dash - in example above be: randomstring1 thanks you can use pattern: ^[^\-]*

c# - Reading a file without preventing other processes from reading it at the same time -

i'm making little app in c#/.net watch creation of file , when created gets content, parse , write in file. everything working fine far. problem : there's process watch file well. process reading file while second 1 reads , deletes it. my application making job when reads file, other process can't read , totally crashes (not made me , don't have sources fix it). my application running fast , other open files little time content , put in variable close file faster , parse content of file in variable. i don't know how i'd able read file , let other read file @ same time without hiccups. possible? still think there problem fact file being deleted after other app done parsing it... any suggestions or ideas? thanks much! kiss: can have file created in location first program isn't looking at, software - , when done processing move current location first program is looking? otherwise: going have contention since it's going race see ...

windows phone 7 - Push Notification Server in Java -

microsoft describes method create push notification service in c#. rather want run java service possible @ all? absolutely. it's matter of making http/https request microsoft. msdn shows headers , payloads sent.

ruby - In Rails, can I set a has_many relation on a model from another model? -

is there way can set both halves of belongs_to/has_many relation in 1 of models? want like: class < activerecord::base end class b < activerecord::base belongs_to :a a.has_many :b end obviously doesn't work (or have used it) hope explains mean... i'm not sure why you'd want to, assuming have great reason... has_many class method defined in activerecord::base calling a.has_many :b should work. you might have issues in development loading order. if load example gave , called a = a.new , class b has never been loaded, a has no idea a has many b . in production, entire class list loaded on start, won't problem. in development can around using require statement, however, coupling 2 files pretty strongly. i haven't tried it, in theory, that's thing can think of preventing setup above working.

validation - jQuery validate while using .submit() or .load() -

i have form loading results div, , jquery validate doesn't recognize need field validated because there no actual "submit" going on, right? how can bypass , still validate field? $('#idsearchform').validate({ rules: { term: { required: true, minlength: 2 }, } }); ..no worky :( $(document).ready(function() { $('#idsearchform').validate({ rules: { term: { required: true, minlength: 4 }, } }); $('.activeview').click(function() { $('.activemask').slidetoggle(250); $('.list-style-arrow').toggleclass('nudge'); }); function showloader(){ $('.search-background').fadein(200); } //hide loading bar function hideloader(){ $('.sub_cont').fadein(1500); $('.search-background').fadeout(200)...

iphone - ModalView slide off screen -

i creating user registration functionality in application , needed direction in how implement it. currently, main screen has sign button. when user clicks sign button, modalview slides bottom , presents user required textfields registration. user fills out form , clicks submit button on top right of nav bar ( added nav bar modalview). when user clicks submit button, modalview "disappear" , display activity indicator while validation takes place. if user registers, activity indicator should disappear , new screen slide in right. if submission failed reason, modal view should "re-appear" information user entered. right problem hiding modalview during validation , sliding in new screen on successful registration. approaches this? thanks in advance! here method creates modalview: - (void)getsignupview:(id)sender { signupviewcontroller *signupviewcontroller = [[signupviewcontroller alloc] initwithstyle:ui...

Installing Pygame for Python 3.1.2 in Ubuntu -

i'm reading book introduction computer science using python , pygame paul craven (note: legally available free online). in book, uses combination of python 3.1.3 , pygame 1.9.1 . in linux ubuntu machine, have python 3.1.2 after sudo apt-get installed python-pygame (version 1.9.1), python 3.1.2 can't import pygame. python 3.1.2 (r312:79147, sep 27 2010, 09:45:41) [gcc 4.4.3] on linux2 type "help", "copyright", "credits" or "license" more information. >>> import pygame traceback (most recent call last): file "<stdin>", line 1, in <module> importerror: no module named pygame python 2.6.5 imports without fuss, however, python 2.6.5 (r265:79063, apr 16 2010, 13:09:56) [gcc 4.4.3] on linux2 type "help", "copyright", "credits" or "license" more information. >>> import pygame >>> are aware of issues linux/ubuntu's python 3.1.2 (prof. cra...

jquery - Why does json.dumps() throw a 500 internal server error when using variables? -

i've tested out thoroughly , have no idea why it's doing this, wondering if explain... json.dumps() throwing 500 internal server error when try use variable instead of string. for example: error = 'login failed: username or password incorrect.' test = json.dumps({'form': error}) will return 500 internal server error when attempting return through jquery.ajax however, test = json.dumps({'form': 'login failed: username or password incorrect.'}) will not throw 500 internal server error. i've tested out thoroughly single quotes, double quotes, different formatting, etc , points json.dumps() for reason, occurring when calling view through jquery.ajax if don't return json.dump() , return normal json object still throws 500 error, why i've concluded it's json.dumps() , not .ajax call ** here's snippet of code i'm using this: unknown reasons.. throw error while calling particular page through jquery.a...

android - Problems redirecting to an Activity with intents -

the problem: lets have 3 activities: mainmenu, levelselection , game. have button run intent in mainmenu redirect player levelselection. in levelselection button redirect player game. when activity game ends run intent redirect player mainmenu activity. however, when tested, redirection done levelselection instead of mainmenu. mainmenu => levelselection code this.finish(); intent intent = new intent(this, levelselection.class); this.startactivity(intent); levelselection => game code this.finish(); intent intent = new intent(this, game.class); this.startactivity(intent); game => meainmenu code this.finish(); intent intent = new intent(this, mainmenu.class); this.startactivity(intent); thanks in advance. in manifest, set no history true activities. prevent user going previous activity when current 1 closes (or when user presses "back"). might helpful since you're trying have strict control on activity user goes to. i remove this.fi...

javascript - Change href parameter using jQuery -

how rewrite href parameter, using jquery? i have links default city <a href="/search/?what=parks&city=paris">parks</a> <a href="/search/?what=malls&city=paris">malls</a> if user enters value #city textbox want replace paris user-entered value. so far have var newcity = $("#city").val(); given have unique href values ( ?what=parks , , ?what=malls ) suggest not writing path $.attr() method; have have 1 call $.attr() each unique href , , grow redundant, - not mention difficult manage. below i'm making 1 call $.attr() , using function replace &city= portion new city. thing method these 5 lines of code can update hundreds of links without destroying rest of href values on each link. $("#city").change(function(o){ $("a.malls").attr('href', function(i,a){ return a.replace( /(city=)[a-z]+/ig, '$1'+o.target.value ); }); }); one thing may want watc...

sql - Azure number of instance and bandwidth usage -

i know how find badwith usage , number of instance azure. these features available in azure api ? bandwidth usage no. tracked in billing , has no open api. can track bandwidth usage if funnel every request thru programmable api can capture size of data they're pushing out. (incoming data free). number of instances, yes. 2 ways this: 1) if done "outside" of deployment, can use service management api navigate specific deployment , call method: http://msdn.microsoft.com/en-us/library/ee460804.aspx 2) if done inside role, can use roleenvironment.roles["role-name"].instances.count

xml - java sample for encoding/decoding EXI? -

i'm looking java sample program encoding/decoding exi (efficient xml interchange) streams, using either exificient or openexi . could help? can't seem find sample app. edit: alternatively, if point me towards documentation allow me use exificient or openexi, helpful. found javadoc have no idea classes use. or, @staxman points out, there particular mention/discussion of appropriate top-level classes use 1 of standard xml apis? using exificient , i've managed encode & decode sample xml exi using snippet "help" page , their "demo" , i've managed following working using maven dependency <dependency> <groupid>com.siemens.ct.exi</groupid> <artifactid>exificient</artifactid> <version>0.9.4</version> </dependency> with code import com.siemens.ct.exi.exifactory; import com.siemens.ct.exi.grammarfactory; import com.siemens.ct.exi.api.sax.exiresult; import com.siemen...

python - Help parsing between <pre> tags using BeautifulSoup -

i attempint parse out information website using beautifulsoup , python. html looks following. wanting parsed data like: id definition lysine.biosynthesis - burkholderia psuedomallei 17 ... rest of data in similar place (within "pre" tags , outside "a" tags. how can this? <pre>id definition ---------------------------------------------------------------------------------------------------- <a href="/kegg-bin/show_pathway?bpm00300">bpm00300</a> lysine biosynthesis - burkholderia pseudomallei 17 <a href="/kegg-bin/show_pathway?bpm00330">bpm00330</a> arginine , proline metabolism - burkholderia pse <a href="/kegg-bin/show_pathway?bpm01100">bpm01100</a> metabolic pathways - burkholderia pseudomallei 171 <a href="/kegg-bin/show_pathway?bpm01110">bpm01110</a> biosynthesis of secondary metabolites...

flash - Captivate 5: Can you call a nested swf inside a swf? -

i'm using captivate 5 create elearning project, due captivates limited animation abilities created menu bar in flash , imported captivate swf. menu bar has glossary listing whne clicked calls upon swf glossary. the problem glossary swf doesnt pop when glossary listing clicked inside of captivate. menu bar works outside of captivate. glossary made in as3. question can call nested swf within captivate? yes can nest swf's captivate 5 file. have tested importing swf file created in as3. have not tested importing swf files created in as2. first test glossary swf in flash project calls glossary swf (new flash project imports glossary swf file). after debugging or testing glossary swf, can insert captivate 5. please note if want imported swf file interactive captivate 5, need create widget. please refer captivate online documentation on how create widget using as3 in flash or flex.

c# - Open an HTML Document with xml.Load -

i'd open html document (as string retrieved streamreader, web), creating xmldocument way: xmldocument doc = new xmldocument doc.load(string containing retrieved document). but since html doc contains head: <!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd" > it tells me document invalid... way workaround this? normal html, if valid html, not valid xml. there library called htmlagilitypack popular 3rd party open source library can use solve problem: http://www.google.co.uk/search?q=htmlagilitypack how use html agility pack

jquery - How can I target a div based on the image src container within? -

i new jquery, , wondering if it's possible select div based on image's source contained within? , remove entire div if finds instance? so in example how through div's class of thumbnail image src="http://demo.com/wp-content/themes/thestyle/timthumb.php?src=&h=180&w=222&zc=1&q=90" and delete divs? <div class="thumbnail"> <a href="http://www.demo.com"> <img src="http://demo.com/wp-content/themes/thestyle/timthumb.php?src=&amp;h=180&amp;w=222&amp;zc=1&amp;q=90"> </a> <div class="date"> january 1st </div> </div> use :contains selector. $('div.thumbnail:contains(img[src="http://example.com/foo/bar"])').remove(); or select <img> , use .closest() : $('img[src="http://example.com/foo/bar"]').closest('div.thumbnail').remove(); learn dig through...

How to OAuth Twitter with httplib2 and Python 3.x? -

i know there lot of python twitter api , oauth wrappers out there, don't want use them. want use nothing more httplib2 , python 3.x standard library. please demonstrate simple code examples on how achieve that? in advance. you can @ python-oauth2 . the main implementation code readable. since there lot of thorny issues here precisely how encode forms tricky right. recommend using oauth2 library, i've done integrate twitter (httplib2 + oauth2 + twitter's rest/streaming apis).

android - Converting sections of byte arrays to integer values -

i making android application accepts bluetooth measurement device. way data packaged in 4 bytes. need 2 values out of these bytes. first value made of: 6bit , 7bit of first byte , bit 0 bit 6 of byte 2 second values simpler , consists of full 3rd byte. what way access these bit values, combine them , convert them integer values? right i'm trying convert byte array bitset, , access individual bits create new bytes converted integer. thanks, , please ask if not being clear enough. im not sure if understood format correctly. bitmask correspond first value? 0xc07f0000 that bits 16-22,30,31 (zero based indexing used here, i.e. bit 31 last bit). another thing, value expected signed or unsigned? anyway, if way assume can convert bitmasks: unsigned int val = 0xdeadbeef; unsigned int mask1 = 0xc0000000; unsigned int mask2 = 0x007f0000; unsigned int yourvalue = (val&mask1)>>23 | (val&mask2)>>16; do in same way other values. define bitmas...

alias - Custom Google profile URL -

now when google have changed profiles in last couple of days cannot find way of setting profile url. have done in past had create account today , feature found. instructions found in @ google describing old profiles. well seems google have launched deal this. http://glpl.us/ this service lets create own custom profile url shortened format. take ours example - have http://glpl.us/binalogue google!

c# - Adding objects via DbContext duplicates related objects -

i have object, call thing, has many-to-one relationship object, call person. how can add thing using dbcontext without duplicating associated person. thing has foreign key person called personid. public class thing { public long id { get; set; } public long personid { get; set; } } public class person { public long id { get; set; } } i tried this: context.things.add(newthing); context.savechanges(); i tried this: person person = new person() { id = newthing.personid }; context.persons.attach(person); context.things.add(newthing); context.savechanges(); not sure if understand question correctly try: context.entry(person).state = system.data.entitystate.unchanged; this tells ef entity unchanged , hence not attempt save it.

thread safety - Is callFromThread threadsafe -

i looked @ code callfromthread. it's appending callables threadcallqueue list. if multiple threads call callfromthread, how can callfromthread thread-safe? in other words, without lock on threadcallqueue, how can callfromthread threadsafe? missing basic? multiple threads can add items list (these producers) , it's done through append() call (so, @ end of list): self.threadcallqueue.append((f, args, kw)) only main thread ever reads items , removes them list (this 1 consumer) , reads @ beginning of list: # keep track of how many calls make, we're # making them, in case call added queue # while we're in loop. count = 0 total = len(self.threadcallqueue) (f, a, kw) in self.threadcallqueue: try: f(*a, **kw) except: log.err() count += 1 if count == total: break del self.threadcallqueue[:count] so, since 1 thread reads beginning of list , others write @ end, thread-safe as long python lists are . noted in function...

ruby on rails - How to setup admin approval a model's edits -

i need system regular user can edit model edits don't happen until approved administrator. found gem called paper_trail had model versioning doesn't support want do. i'm wondering how other people have handled problem. should add there associations able user edit @ same time. aren't complicated, example 1 aliases. the more complicated part maybe case multiple users edit same model , trying sort of merge. one approach versioning version approval. every edit creates new version of model object , associations. @ 1 time there 1 "current" version of model object (and it's representation in database). if 2 users submit 2 separate edits, these create 2 "pending" versions. an admin approve edits moving current version new "pending" version. merges accomplished well, domain specific, , result in conflicts, keeping separate versions smart anyways. there few ways accomplish this, , best depend on dynamics of situation. ...

php - Mimic CRYPT_BLOWFISH with MCRYPT_BLOWFISH -

my question how same result mcrypt crypt, respect blowfish? i wanting use the phpass framework password hashing , verifying. works long has have php 5.3 because blowfish included crypt() . host running php 5.2.x mcrypt library. going through docs , googling blowfish crypt, appears result '$a2$' , 2 character iteration value, '$' , salt ( padded or cut 22 characters ), 32 base64 string representing hash. my problem can't find explanations of mcrypt_mode_modenames make sense me. , how feed mcrypt() number of iterations want? or 2 functions using different forms of blowfish dont cross translate? mcrypt, , crypt() 2 totally different functions. mcrypt two-way encryption, whereas crypt one-way encryption. far aware crypt() inside of php 5.2. also, if i'd reference crypt() itself. , i'd use bcrypt it. $hashed_password=crypt($password_to_be_hashed,'$2a$04$saltstringhere'); finally, change 2 digit cost factor inside of 2 digits aft...

javascript - How to fade to a different image on mouse over? -

i have 2 images. configure them when mouseover default image, fades second image. how 1 go this? thanks! i've assumed want fade in when mouseout, here's getting started with. // markup <div id="imgs"> <img src="..." id="i1"> <!-- mouseover image --> <img src="..." id="i2"> <!-- default image --> </div> // css img { display:block; position:absolute; top: 0; left: 0; } // jquery $(function() { $('#imgs') .mouseenter(function() { $('#i2').fadeout('slow'); }) .mouseleave(function() { $('#i2').fadein('slow'); }); });

iphone - what difference between active(debug) and debug in xcode configuration -

i want know difference between active(debug) , debug configuration when show build tab of project info, , can tell me difference between project info , target info, thank much! the active tab denote active configuration. in case of active (debug) noting active configuration debug one. you can demonstrate changing current configuration release , revisiting debug tab. display active (release). target info lets edit configurations specific targets project info lets change setting whole project , apply no matter target is. hope helps.

Resharper (or Visual Studio) shortcut to cascade changes to a constructor -

here common refactoring don't believe have seen shortcut for: imagine have base class number of inheriting subclasses. base classes uses constructor injection accept number of services: class foobase { private imyservice _myservice; private imyotherservice _myotherservice; public foobase(imyservice myservice, imyotherservice _myotherservice) { _myservice = myservice; _myotherservice = myotherservice; } } class fooconcrete : foobase { public fooconcrete(imyservice myservice, imyotherservice _myotherservice) base(myservice, myotherservice) { } } notice how fooconcrete has call constructor of base class, foobase. now, happens if want add service foobase? can initialize new private field foobase's constructor. still have go around , manually update every subclass inherits foobase. can hassle if there lots of inheriting classes. is there shortcut, or perhaps trick can use, update subclasses' constructors w...

url - Querystring manipulation of email Address in PHP -

i using third party application (email2http) send me emailid, body , message. unable retrieve email id due name appended on , enclosed < , >. here querystring getting. test.php?from=ajay+reddy &subject=cx&body=somebody when print variable in php returns name , not email id. $from = $_get['from']; echo $from; //output ajay reddy please suggest me how can emailid also. i dont want use post method due testing , debugging. it's working fine. forgot use htmlentities() in debugging.

python - NameError -- not definied -

main program # import statements import random import winning # set constants win = 0 lose = 0 tie = 0 rock = 1 paper = 2 scissor = 3 # main program rock paper scissor game. def main(): # set variable loop control again = 'y' while again == 'y': # display menu display_menu() # prompt user input userselection = input('which play (1, 2, 3)?: ') computerselection = random.randint(1, 3) # call winner module decide winner! print(winning.winner(userselection, computerselection)) # ask play again , make selection again = input('would play again (y/n)?') def display_menu(): print('please make selection: ') print(' 1) play rock') print(' 2) play paper') print(' 3) play scissor') # call main main() second file: winning.py: # module decide on won based on input main def winner(userinput, computerinput): if u...

c - Finding dependencies of a compiled library on Unix -

is there way find names of libraries given library depends on? basically have ".so" file load dynamically, , know other .so files it's going try load update 07/07 : found /proc//maps pretty useful, gives locations of loaded dynamic libraries given process type readelf -a <path-to-library> | grep 'needed' in terminal. note: readelf part of binutils .

networking - how to log the wow network latency in to a file -

i want log wow network latency in file ,like c:/wowlatency.txt now ,i can use lua stript log wow's chat log file.but want log own log file .can ? if have infrastructure in place monitor latency (ie. calling getnetstats every 30 seconds), can use lua's built in file i/o facilities open desired log file: local latencylog = io.open("c:/wowlatency.txt","w") -- enter whatever loop may have latencylog:write(message_string_about_latency) -- don't forget write \n if it's not in string -- repeat -- after finishing log latencylog:close()

objective c - NSTableView with Dropdown Menu and having Image inside Menu -

yes, possible have: a table having 2 column ( should easy) one of cell should have image , should selectable drop - down menu googling came know has of type nspopupbuttoncell type, want image inside it, no text, how can ? the column editable, user should able type in that. it great if can reference code implement same. i did following way, in coloumn 1 select datacell , assign of type nspopupbuttoncell, default wouldn't come, need select explicitly. in code add following lines of code... nstablecolumn *option = [ptablecolumns objectatindex:[ptableview columnwithidentifier:option_column_name]]; nstablecolumn *shortcutitem = [ptablecolumns objectatindex:[ptableview columnwithidentifier:shortcut_column_name]]; // want first cell have image & menu //data type column drop down nspopupbuttoncell *datatypedropdowncell = [option datacell];//[[nspopupbuttoncell alloc] inittextcell:@"" pullsdown:yes]; [datatypedropdowncell setbordered:no]; [da...

internet explorer 8 - Struts application - unable to download file through https on IE -

i have struts application @ point offers possibility download files. found out download fails through https on ie 8. firefox 4 working fine. the error in ie is: internet explorer cannot download someaction.do localhost. internet explorer not able open internet site. requested site either unavailable or cannot found. please try again later. any idea ? everyone used file downloads on https have hit problem internet explorer. if user tries download file on https connection, response headers prevent caching cause file download process fail in internet explorer . there lots of references kind of issue on microsoft support site (e.g. internet explorer file downloads on ssl not work cache control headers )

Using Scala from Java: passing functions as parameters -

consider following scala code: package scala_java object myscala { def setfunc(func: int => string) { func(10) } } now in java, have liked use myscala as: package scala_java; public class myjava { public static void main(string [] args) { myscala.setfunc(myfunc); // line gives error } public static string myfunc(int someint) { return string.valueof(someint); } } however, above not work (as expected since java not allow functional programming). easiest workaround pass function in java? generic solution works functions having arbitrary number of parameters. you have manually instantiate function1 in java. like: final function1<integer, string> f = new function1<integer, string>() { public int $tag() { return function1$class.$tag(this); } public <a> function1<a, string> compose(function1<a, integer> f) { return function1$class.compose(this, f); } public ...

c# - Record video within WPF application -

i want create application can record video within application (not webcam inside application), user can see happened program. there library or api can that? best regards, c.porawat ok, found answer question in post record video of screen using .net technologies regards, diogo

git - how to specify directory paths in gitignore -

part of gitignore file looks this: phoenix/config/projectconfiguration.class.php statsfile.txt phoenix/statsfile.txt phoenix/config/* phoenix/config/propel.ini phoenix/data/* phoenix/lib/filter/* phoenix/lib/form/* phoenix/lib/model/* so full path of ex. data directory be: /home/helloises/github_mira/rainbow_code/phoenix/data my gitignore in directory: /home/helloises/github_mira/rainbow_code it not ignoring have in excerpt above??? misunderstanding how .gitignore works? how must specify paths?? thanks is possible gitignore file has typo? it should .gitignore leading . in front.

php - API - is the connection secure? -

how check if connection rest api secure? 1) i'm building api , want make sure connection running ssl before response generated , returned client.. username , password passed in every request 2) , how can make fsockopen connection ssl? $this->url = 'api.domain.com'; $this->path = '/v1/json/account/user/pass/?id=123'; if($this->fp = fsockopen($this->url, $this->port, $errno, $errstr, $this->timeout)){ $write = "$this->method $this->path http/1.1\r\n"; $write .= "host: $this->url\r\n"; $write .= "content-type: $this->content_type\r\n"; $write .= "connection: close\r\n\r\n"; fwrite($this->fp, $write); while($line = fgets($this->fp)){ if($line !== false) $this->response .= $line; } fclose($this->fp); } just check $_server['https'] . the php manual @ http://php.net/manual/en/reserved.variables.server.php says: ...

ffmpeg - Splitting .flv file in Java OR php -

possible duplicate: how split flv file size using ffmpeg or mencoder or smth else? i have big .flv of 10 hours want split in 10 mins. can in java or php using ffmpeg, if yes can please direct me specific documentation can achieve this. public class splitflv { public static void main(string[] args) { try { system.out.println("splitting started"); process p = runtime.getruntime().exec("ffmpeg –i 1000.flv -acodec libfaac -ss 00:00:00 -t 00:10:00 -ar 22050 -ab 32 -f flv 1010.flv"); system.out.println("splitting ended"); bufferedreader in = new bufferedreader( new inputstreamreader(p.getinputstream())); string line = null; while ((line = in.readline()) != null) { system.out.println(line); } } catch (ioexception e) { ...

php - Credit Point Web application -

i have started working on e-commerce website. website run php , mysql , requires have credit system users; able pay credit, top vouchers or regular payment, withdraw. now have experience credit cards processing apis, paying money in , out shouldn't problem; problem how securely store credit information. storing single numeric field not ideal , potentially exposed easily. thinking keep transactions , credit history of each user in separate table, , every time log in recalculate should credit be. same apply before transaction attempt do. hear thoughts how should implemented. edit: clarify; question not on how process credit cards , won't storing credit card information. use known , secure api process payments (e.g. via paypal). based on credit card payments, need attribute appropriate user points in form of credit. these points representation of funds on website (whilst money retained on company account, until user tried make payment/withdrawl) , used make payments , wit...

can i post some data to a jsp web form using javascript code? -

i have me javascript code able authenticate users windows live authentication. after logon, simple message displayed user. what want message displayed user 10 seconds, , after email id of user plus flag indicates successful login, posted jsp page opened in same browser window... can done using javascript or other way? if not possible pass these values jsp form, alternatively can these values stored in jsp session variables (so other jsps able use these values)? thanks, arvind. you can using location.replace("resultpage.jsp?emailid="+emailid+"success=true"); now can access these values using: request.getparameter("emailid"); request.getparameter("success");

iphone - Animate UITableViewCell with genie effect -

i'm stuck. have tableview messages. upon selection these deleted , moved trash. genie effect real easy using in controller:didchangecontent [...] case nsfetchedresultschangedelete animaties behind other cells. want on top of other cells. doing wrong? here animation code: [uiview beginanimations:@"suck" context:null]; [uiview setanimationtransition:103 forview:mycell cache:yes]; [uiview setanimationduration:0.5]; [uiview setanimationposition:cgpointmake(50, 710)]; [tableview deleterowsatindexpaths:[nsarray arraywithobject:indexpath] withrowanimation:uitableviewrowanimationfade]; [uiview commitanimations]; got idea here . you try bringing cell front doing this: [mycell.superview bringsubviewtofront:mycell]

mysql - java Connection Pooling from Oracle -

i'm trying make connection pool following link: http://192.9.162.55/developer/onlinetraining/programming/jdcbook/conpool.html i don't understand something: somewhere in class jdcconnectiondriver implements driver can find method: public static final string url_prefix = "jdbc:jdc:"; public connection connect(string url, properties props) throws sqlexception { if(!url.startswith(url_prefix) { return null; } return pool.getconnection(); } so, if use mysql (for example), url start jdbc ... method connect never return connection... why that? also ask best connection pooling framework... so, if use mysql (for example), url start jdbc... method connect never return connection... why that? this driver written connect jdc connection. that's why. it's looking url starting jdbc:jdc: , not jdbc: . also ask best connection pooling framework... the known connection poo...

python - On keystroke insert line of code in (mac)vim, for pdb -

i'm looking way insert line of code keystroke leader p in macvim i want insert following line of code: import pdb; pdb.set_trace() probably not unheard of line of code in python land this might not best vimscript every wat want! :-) place in .vimrc , can call leader p. map <leader>p :call insertline()<cr> function! insertline() let trace = expand("import pdb; pdb.set_trace()") execute "normal o".trace endfunction

android - How to control AlertDialog -

i have created app include popup of popup of different dialog. code have written is: if (ldifffromtoday >= 0 && ldifffromtoday <= declarevariable.cycle_max_length) { alertdialog.builder alrtstartmonitoring = new alertdialog.builder(this); alrtstartmonitoring.settitle(" start monitoring"); alrtstartmonitoring.setmessage("set start date of cycle as"+" "+sdformatter.format(dtseldate)); alrtstartmonitoring.setpositivebutton("yes", this); alertdialog alert = alrtstartmonitoring.create(); alert.show(); } else if (dtseldate.gettime()> dtstartdate.gettime() && dtseldate.gettime() <= currentdate.gettime() && !bcyclestopped) { long ldifffromstart =dtseldate.gettime()-dtstartdate.gettime(); ldifffromstart=ldifffromstart/(1000 * 60 * 60 * 24); ...

iphone - NSData memory leak...pointing to NSConcreteData! -

i having memory leak, , can't figure out. basically, doing here pulling in images mutable dictionary , returning dictionary. - (nsmutabledictionary *)loadimagedatagroup:(nsuinteger)index { int lim = 5; int sta = 0; if (index > lim) { sta = index-lim; } int fin = (((lim*2)+1)+sta); if (fin > [self imagecount]) { sta = ([self imagecount]-((lim*2)-1)); fin = [self imagecount]; } bool firsttime = no; if ([imagesloaded count] == 0) { firsttime = yes; } nsmutabledictionary *tempdict = [[[nsmutabledictionary alloc] init] autorelease]; (int = sta; < fin; i++) { nsstring *imagename = [self imagenameatindex:i]; if ([imagesloaded valueforkey:imagename] == nil) { // memory leak...at least leaks pointing me. nsdata *imagedata = [nsdata datawithcontentsofurl:[nsurl urlwithstring:imagename]]; [tempdict setobject:imagedata forkey:imagename]; } else { [tempdict setobject:[imagesloaded valueforkey:imagename] forkey:...

.net - Is it possible to change Enterprise Library logging listener setting programmatically? -

i'm using ent lib 5, , need able update databaseinstancename property of microsoft.practices.enterpriselibrary.logging.database.formatteddatabasetracelistener listener. the databaseinstancename defined in app.config, need set dynamically. i've looked using fluent configuration, didn't see way edit listener. is there way change listener's configuration @ run time? thanks! just write configuration file programatically, file monitored el , should notice change , start logging the new location automatically.

java - JAXB Generation nillable=true -

using jaxb 2.2.4 generating java code following binding file: <bindings xmlns="http://java.sun.com/xml/ns/jaxb" version="2.0" xmlns:xs="http://www.w3.org/2001/xmlschema"> <globalbindings generateelementproperty="false"> </globalbindings> unfortunately, generated code has nillable = true annotation. see following example: @xmlelement(name = "artid", nillable = true) protected stebeitrag artid; this definition of stebeitrag: <xsd:complextype name="ct_beitrag"> <xsd:complexcontent> <xsd:extension base="allgemein:ct_objekt"> <xsd:sequence> <xsd:element name="artid" type="daten:ste_beitrag" minoccurs="0" maxoccurs="1" nillable="true"/></xsd:element> </xsd:sequence> </xsd:extension> </xsd:complexcontent> </xsd:complext...

vba: userform functions -

i have sub activated button on userform. basic procedure click 1) run sub based off of user inputs 2) select results sheet 3) display results 4) unload userform i've run problem because want try , put bounds on user input value , if user inputs out of range message box pop notifying them of range. i've been able accomplish simple task through use of if/then loop. after user exits out of message box want keep userform displayed along original user inputs , allow user change input. after user clicks 'ok' on message box, click sub continues procedure , unloads userform , selects results worksheets. there simple 1 line code can put after msgbox state preserve userform instead of making user re-enter values? edit - general gist of code follows: private sub commandbutton1_click() propertysearch.search activesheet.name = "searchresult" cells(1, 1).select unload ilsearch end sub sub search() if (textbox1 , textbox2 <= 8)...

Advice for build multiusers big website (1. scala lift/spring roo 2. database mongoDB/Postgre ORM/MySql ORM 3. Web-server environment Tomcat etc..) -

i need advice build multi-users big/huge website - programmer , owner of website, doing in free time + money (meanwhile). (i have few years of experience web programmer(lamp,ubuntu, zend, mysql doctrine orm, jquery) - want give try jvm static type langs java spring roo/scala know java + jsp+ servlets + beans not spring roo/spring mvc or scala. ) my questions(please answer according 1. stability of solution 2. price 3.time program 4. time study technologies 5. etc..): which lang/framework choose scala lift/spring roo - important more which database mongodb/postgre orm/mysql orm hosting (i thinking take amazon ubuntu package) web-server environment run website (i know lamp, java dont know servers (tomcat run java?,apache http - please give me option not cost me lot money, prefer free , stable)) - saw cloud foundry - cool, beta version. thanks in advance here couple of presentations on why foursquare chose lift: https://docs.google.com/present/view?id=dcbpz3...

javascript - How can I execute recursion regardless of the function name? -

possible duplicate: can name of running function in javascript? i need recursion. i'd able change function name without checking , changing every instance function calls itself. (for example php has "magic constants" __function__ etc.. - similar in javascript?) if goal recursion , don't need function name string if can reference function itself . note you'll still have check , change every instance function called others, , that's larger task updating recursive calls (if no other reason it's not localized function body). passing function argument function foo(self, i) { if (i === 0 ) return; console.log(i--); self(self, i); } foo(foo, 3); using arguments.callee (as raynos points out, brittle in strict mode) function foo(i) { if (i === 0 ) return; console.log(i--); arguments.callee(i); } foo(3); output of either option 3 2 1

data binding - Silverlight childwindow combobox lookup -

i trying hardest silverlight keep getting caught @ hurdles simple tasks. have main datagrid on main form lists addresses. have child window allows user edit these addresses combobox country up. have adreessdomaindatasource , countrydomaindatasource. have combo box in child window code follows: <riacontrols:domaindatasource autoload="true" d:designdata="{d:designinstance my:country, createlist=true}" height="0" name="countrydomaindatasource" queryname="getcountriesquery" width="0"> <riacontrols:domaindatasource.domaincontext> <my:countriescontext /> </riacontrols:domaindatasource.domaincontext> </riacontrols:domaindatasource> <riacontrols:domaindatasource autoload="false" d:designdata="{d:designinstance my:address, createlist=true}" height="0" name="addressdomaindatasource" queryname="getaddressq...

JSON Creation from Java -

hi new json , have create below json java. {{ "testmain" : { "test1" : { "384" : "250", "96" : "450" }, "test2" :{ "384" : "5", "96" : "10" }, "test3" : "256", "test4" : "t" } i have created each object using jsonobject.put. how combine 4 test objects text testmain. idea? the json library awfully verbose, should need: final jsonobject wrapper = new jsonobject(); final jsonobject inner = new jsonobject(); final jsonobject innersub1 = new jsonobject(); innersub1.put("384", "250"); innersub1.put("96", "450"); final jsonobject innersub2 = new jsonobject(); innersub2.put("384", "5"); innersub2.put("96", "10"); inner.put("test1", innersub1); inner.put("test2", innersub2); inner.put("test3...

c++ - boost thread_group with callback -

i write boost::thread_group. assuming understood correctly callback in thread apply in program. i found following example: ( thread_group out callback ) boost::thread_group group; (int = 0; < 15; ++i) group.create_thread(afunctiontoexecute); group.join_all(); if change callback, adding & before afunctiontoexecute ? i thought using callback following case: assuming have 2 cores , for-loop 0 99 (100 elements). instead of open 100 threads , open 2 thread (the number of cores in example) , after each thread finish computation correct variable, send done , wait order run again until 100 elements computed. does know example or few example combine creating this? since have not experience in threading, know way of applying group_threads "right" way? reagrds

jQuery tablesorter with row numbers -

i using jquery tablesorter 2.0 plugin provide basic table sorting functionality. on table, have column row number. trouble is, tablesorter plugin sorts column else. have tried setting "headers" attribute first column, removes sorting capability. not prevent column being reordered when sort different column. is having list of row numbers possible plugin? can think of way around problem? it sounds need renumber rows every time table sorted. try (use after have initialized tablesorter on table): var table = $("#mytable"); table.bind("sortend",function() { var = 1; table.find("tr:gt(0)").each(function(){ $(this).find("td:eq(0)").text(i); i++; }); });

c# - Is there a dynamic-creation-friendly LinkLabel Alternative? -

i'm trying dynamically create link windows form our website when conditions met (it's warning message further information in our online manual). currently i'm finding linklabel quite unwieldy use in situation: having set linkclicked handlers on fly straightforward hyperlink seems inelegant. is there wrapper or alternative fulfills following requirements?: inherits system.windows.forms.control (so can use in tablelayoutpanel) has reasonably low setup (no strange linkclicked function pre-visit checking, example) isn't bound specific browser what problem linkclicked event handler? have same control in order useful. anyway, trivial implement - create class inherits linklabel, add string url property (you may need attribute make show in designer properties panel if want set way) , provide event handler opens browser url. then can add control in designer (or @ runtime), set url property , work without having set event handlers.

data binding - Silverlight 4 Add New Item To DomainDataSource -

i have simple datagrid listing addresses , child window user can edit/add new. on main form datagrid have button "insert new address" should load child window empty address object. not let me add record. doing wrong? current code follows: dim address new address dim frmaddressobj new frmaddress if frmaddressobj.addressdomaindatasource.dataview.canadd = false frmaddressobj.addressdomaindatasource.load() end if frmaddressobj.addressdomaindatasource.dataview.add(address) address address object. frmaddress child window form. addressdomaindatasource same datasource use in datagrid use in child. canadd false , got told try loading before adding not appear have helped. when reaches add method returns exception of 'add' not supported icollectionview. appreciated. thanks the dataview field should thought of read-only collection. simplest general usage of domaindatasource datagrid goes this: (mydatasource.domaincontext m...

operating system - vfork:Understanding Issue: -

i have confusion around functionality of vfork() . read in case of vfork() , parent , child process used share pages between them. doesn't support copy on write functionality. means, if during timeslice child process makes changes, these changes visible parent process when return. mentioned, vfork() syscall been useful when child process executes exec system call after creation. let say, child process executes exec system call ls . now, according exec calls, ls program loaded on address space of child process. now, when parent process' timeslice start, might have different intruction execute on pc, might cause process behave differently. can please make scenario clear me, how vfork() call helpful in such situations? the point of vfork() not allocate new address space child going throw away again. such, vfork() omits part of fork() creates new address space (page tables , allocations) child, , instead sets flag execve() interprets meaning should alloc...

Access Violation in Telerik WinForms on Application Close -

i'm getting error 2 out of 3 times when closing application running on xp sp3. have not been able repro on win 7. insight on may cause such error appreciated. it not same control every time, 1 of telerik controls. i'm using latest 2011 q1 release. framework version: v4.0.30319 description: process terminated due unhandled exception. exception info: system.accessviolationexception stack: @ telerik.wincontrols.ui.radgridviewelement.disposemanagedresources() @ telerik.wincontrols.disposableobject.performdispose(boolean) @ telerik.wincontrols.radelement.performdispose(boolean) @ telerik.wincontrols.disposableobject.dispose(boolean) @ telerik.wincontrols.radelement.disposechildren() @ telerik.wincontrols.radelement.performdispose(boolean) @ telerik.wincontrols.disposableobject.dispose(boolean) @ telerik.wincontrols.componentthemableelementtree.dispose(boolean) @ telerik.wincontrols.radcontrol.dispose(boolean) @ telerik.wincontrols.u...

haskell - Examples of monadic effects inside a rewrite function in Hoopl? -

the type of (forward) rewriting functions in hoopl given mkfrewrite function: mkfrewrite :: (fuelmonad m) => (forall e x. n e x -> f -> m (maybe (hoopl-3.8.6.1:compiler.hoopl.dataflow.graph n e x))) -> fwdrewrite m n f the m type implies can use monadic effects while rewriting. paper "hoopl: modular, reusable library dataflow analysis , transformation" says same in section 4.3, "the rewrite function , client's monad." can give me example of rewrite function has non-hoopl monadic effects embedded inside it? example, rewriter uses state monad or io. this should pretty simple, chase types. you want value of fwdrewrite m n f custom value of m , can pass following function: analyzeandrewritefwd :: forall m n f e x entries. (checkpointmonad m, nonlocal n, labelsptr entries) => fwdpass m n f -> maybec e entries -> graph n e x -> fact e f -> m (graph n e x, factba...

Rails 3 rendering iframe with raw() -

so storing whole embed code youtube database , outputting this. <%= raw(people.video) %> which outputs general iframe tag copied youtube: <iframe src="foo" width=400 height=380></iframe> the problem displays tag instead of embedding video page itself. can around storing src in database.... part of mini cms system , site admins find easier copy , past embed code youtube. there someway can specify iframe render instead of spitting out html on page? you can use raw method render html of string, storing way? can try redcloth gem - able working so: <%= raw redcloth.new(@page_content.content).to_html %> which allowed custom cms use textile markup http://en.wikipedia.org/wiki/textile_%28markup_language%29 i'm not 100% on you're seeing, since raw should render html, might try include embed tag using javascript.write, since there issues related flash objects embedded in html vs javascript. let me know if doesn't work,...

algorithm - Way to judge if two Arrays are identical? -

by identical mean 2 arrays contain same elements, order of elements in arrays not matter here. the solution came this( which turns out wrong approach pointed out in comments ): if size of 2 arrays equal see true, find elements of array in array b found, find elements of array b in array found, conclusion 2 arrays identical however, there better algorithm in term of time complexity? let's have user[] array 1 , user[] array 2. can lop through array 1 , add them dictionary<user, int> dictionary key user , value count. loop through second array , each user in array 2 decrement count in dictionary (if count greater 1) or remove element (if count 1). if user isn't in dictionary, can stop, arrays don't match. if end , had checked length of arrays same, arrays match. if hadn't checked length earlier (which of course still should have), can verify dictionary empty after looping through array 2. i don't know performance of is, faster s...

ruby - using each and map to modify a range of an array indices -

the following code: a = [1,2,3,4,5] b = a.each.map {|i| = 0} # or b = a.map {|i| = 0} same thing makes b = [0, 0, 0, 0, 0] expected is there equally succinct way change range of a? (ex: set a[2..4] 0) i have messed around in irb, code returns elements modified a = [1,2,3,4,5] b = a[2..4].each.map {|i| = 0} makes b = [0, 0, 0], trying make b = [1, 2, 0, 0, 0] i'm not sure trying here. first: why turning array enumerator , map enumerator instead of mapping array directly? i.e. why have b = a.each.map {|i| = 0 } instead of b = a.map {|i| = 0 } also, why assigning block local variable i never using variable? i.e. why don't b = a.map {|i| 0 } of course, aren't using i at all ... b = a.map { 0 } however, since values of b have absolutely no relationship @ values of a , might b = [0] * a.size the same questions apply second code example. again, ignore elements of a , using map makes no sense whatsoever. can (b = a.dup...

c++ - Matching strings using Boost Spirit -

i learning boost spirit , modified example given in documentation match strings instead of doubles. code doesn't compile , errors unable debug. below code , printed errors. can please me debug problem ? ps: guessing problem lies in using phoenix::ref vector string, not sure how , why. #include <boost/spirit/include/qi.hpp> #include <boost/spirit/include/phoenix_core.hpp> #include <boost/spirit/include/phoenix_operator.hpp> #include <boost/spirit/include/phoenix_stl.hpp> #include <boost/config/warning_disable.hpp> #include <iostream> #include <string> #include <vector> namespace client { namespace qi = boost::spirit::qi; namespace ascii = boost::spirit::ascii; namespace phoenix = boost::phoenix; template <typename iterator> bool parse_data(iterator first, iterator last, std::vector<std::string>& v) { using qi::double_; using qi::char_; using qi::phrase_parse; ...

internet explorer - IE TEXTAREA displays whitespace at end of line -

to bug, create textarea css text-align:right. then, enter line of text , create newline. ie put white space @ end of line, not in chrome or other browser. is there solution bug css or javascript? thanks! <textarea style="white-space:pre"></textarea>

c++ - Boost Spirit 2.4.2: Cannot extract a string -

following resolved question boost spirit: error c2664, cannot convert 'const boost::phoenix::actor<eval>' 'char' , have question: why using code below js_key , js_string, cannot capture print strings in format "str" or 'str'. return blank! for example: input: {"a":"aa", b:'c'} actual output: { str: str: str: b str: parsed input json! expected output: { str: str: aa str: b str: c parsed input json! please kindly advise. thank you! #include <map> #include <string> #include <vector> #include <iostream> #include <boost/config/warning_disable.hpp> #include <boost/spirit/include/qi.hpp> #include <boost/spirit/include/phoenix_core.hpp> #include <boost/spirit/include/phoenix_operator.hpp> #include <boost/spirit/include/phoenix_stl.hpp> #include <boost/spirit/include/phoenix_object.hpp> #include <boost/spirit/include/phoenix_container.hpp> ...