Posts

Showing posts from September, 2013

asp.net mvc - Email edit prevent duplicates -

i'm using built in authentication in app , have set manager role can create new accounts, assigning username , email. have edited registermodel inner class of accountmodels add regex ensure email valid email , works well. however, when comes editing existing users email, run trouble. how validate new email valid email? , user not have email? know how regex go? , add remote call check duplicates again put stuff? seems wrong checking duplicates in controller. thanks time, jay try this: <membership> <providers> <clear/> <add name="aspnetsqlmembershipprovider" type="system.web.security.sqlmembershipprovider" ... requiresuniqueemail="true" ... /> </providers> </membership>

The way of yaml parsing? (yaml-cpp) -

i've made yaml file below. define1: &define1 0: 0 1: 1 define2: <<: *define1 2: 2 and tried in online yaml parser . result below. ( how nodes constructed. ) { "define1": { "0": "zero", "1": "one" }, "define2": { "0": "zero", "1": "one", "2": "two" } } of course expected 'yaml-cpp' parse same way it's somehow different. i guess it's this. (almost sure) { "define1": { "0": "zero", "1": "one" }, "define2": { "define1": { "0": "zero", "1": "one" }, "2": "two" } } what hell! have check node type while looping? is known issue? or 'yaml-cpp' parse way? this code how did. // parsed const yaml::node&

css - Using XSLT/XML to generate styles for HTML tags? (xsl:attribute-set) -

okay, it's been tough hour or so... i'm having difficulties generating table cells different widths. i'm using xml/xslt spit out html, widths stored in xml format: <size> <width1>5</width1> <width2>4</width2> <width3>7</width3> </size> using xslt's attribute-set should have table row , cells 5px, 4px, 7px widths respectively. however, trouble attribute-set needs child of <xsl:stylesheet> work. can't this: (forgive missing px) <tr> <td> <xsl:attribute-set name="style"> <xsl:attribute name="width"><xsl:value-of select="size/width1"/></xsl:attribute> </xsl:attribute-set> </td> <td> <xsl:attribute-set name="style"> <xsl:attribute name="width"><xsl:value-of select="size/width2"/></xsl:attribute> </xsl

java - Options for defining interface mapping code in the 21st century -

currently working on re-writing several interfaces , looking @ options there defining mapping between systems. need things filtering out records, remap 1 2 etc - core of seems assigning new format old format , looking nice clear/easy maintain way this. probably written in java - may try , throw in jruby if makes mappings cleaner... options come mind are: in code, lots of if/else , assignments via generic system, store mapping somewhere (eg db) easy-ish items , process in interface i preferring 1. @ moment - array/map of simple assignments code succinct. , @ least things opaque mapping in code. anticipated interface not change on time... as write this, thinking making mountain out of mole hill... since have gone far - think? what do/have done things this? thanks in advance, chris. swinging towards option 2 - storing simple mappings in config file/db (perhaps in dsl format) ease of access if change needed in future.

jQuery dialog and PHP grid -

i have implemented jquery dialogbox within php grid every time open same dialog box, pulls record box? i declared dialog box , used following: $("a.pop").each(function(i){ $(this).click(function(e){ e.preventdefault(); $("#details").dialog('open'); }); }); any appreciated.... hope appreciated ... lol please note code not tested please let me know in case $("a.pop").click(function(e){ e.preventdefault(); $("#details").load($(this).attr('href')).dialog('open'); });

.net - Debugging WCF service library -

i'm trying debug wcf service part of solution. here exact setup have. solution web site (filesystem web site, located in d:\project\web\ , on) wcf class library (this normal class project exposes service/operationcontract interface). the website hosting application , wanted add web service it, added "webservice.svc" root folder , added appropriate config entries. when run website , navigate http://localhost:5476/web/webservice.svc see wsdl schema message normal. now, in different wpf application add service reference above url, loads fine, no problem. call web service, it's simple echo service, breakpoint had put in wcf class library isn't stopping, although proper results , everything. debug="true" in config set, tried loading symbols in tools/options, didn't help. breakpoint isn't getting hit. what missing? in web site properties web site project, have "always start when debugging" set true?

gridview - EXT Grid hangs on reload -

using ext grid display real-time data. grid refreshed once second. scrolling top on every refresh until overrode scrolltotop function. ext.override(ext.grid.gridview, { scrolltotop: ext.emptyfn }); however, still hangs (prevents scrolling) non-trivial amount of time. how can rid of hang? obviously grid take some non-trivial amount of time render 400 rows of data. can try reduce rendering workload making grid markup light possible (no fancy renderers etc.), best bet may either wait extjs version 4 (which reputedly offers a huge boost grid performance ), or if willing use plugins, have @ ext.ux.livegrid .

auto increment - How is MySQL's AUTO_INCREMENT column reset -

few question resetting mysql's auto_increment column. first without deleting/creating table, or deleting rows via truncate table (see footer code) -- correct way it? alter table [insert_table_name] auto_increment = 1 next, value set 0 or 1 -- , why? bonus, advice. it's set whatever use in alter table query, 1 in case. however, since you're not deleting rows, you've set primary key violation, since next inserted row try use 1 , conflict created row same key.

xml - How to return array with XPath? -

i wondering if xpath return array of value. i have someting : <cities> <city>paris</city> <city>lyon</city> <city>marseille</city> </cities> and i'd array of form ['paris', 'lyon', 'marseille']. i using xpath unix utility. any idea ? in addition post-processing output of: xpath -q -e '//city/text()' inputfile which is: paris lyon marseille in number of ways, including: xpath -q -e '//city/text()' inputfile | awk 'begin {sq = "\047"; ofs = sq "," sq} {a[$1] = nr} end { printf "[" sq; (i in a) { printf "%s%s", d, i; d = ofs}; print sq "]" }' which gives output: ['lyon','marseille','paris'] you can use modified version of xpath . since it's simple perl script, modified have mor

Deploying custom dll's in SharePoint 2010 -

i'm new sharepoint , trying head around this. have simple web part project. have custom data layer project uses microsoft enterprise library data access. in web part project, adding reference data layer project's assembly. specified in package of web part project want data layer's assembly deployed. can verify works using standard ado.net classes , not custom ms library. if deploy sharepoint server (which have 100% access to) using enterprise library, error message: "could not load file or assembly 'microsoft.practices.enterpriselibrary.data" what steps need take ensure project , future projects on server can gain access enterprise library data access? thanks! you did correct until point: deployment. when deploying external dlls, shall put gac or somewhere else, need package them wsp aswell. has become easy visual studio 2010: open package click on "advanced" (on bottom) add external dll , maybe safecontrols web.confi

tomcat - Amazon Load Balancer sticky sessions configuration for jsessionid in URL -

i trying setup amazon load balancer tomcat workers, faced 1 problem. i'm using sticky sessions , cookie jsessionid available of requests. requests have session information in url, this: http://myserver.com/contextpath/someaction;jsessionid=ba6853c23f795bd5eedaea996e601bb8 and not work (and request forwarded wrong worker). does aws load balancer support jsessionid in url? if no, maybe know workarounds? with apache + mod_proxy_balancer can, example, define this: proxypassmatch /.* balancer://mycluster stickysession=jsessionid|jsessionid aws's elastic load balancer not support url-based session stickiness. be sure check you've set elb's stickiness policy. also, elb's stickiness doesn't @ value of cookie except own called "awselb". when configure cookie-based stickiness policy you're configuring lifetime of stickiness follow lifetime of specified cookie - actual server assignment controlled awselb cookie.

javascript - How to get TabIndex property of currently active control? -

how find tabindex property of control has active focus @ runtime. using ulitmateeditor(text editor) i.e user control , want focus inside body of editor. you should able do: alert(document.activeelement.tabindex); the should active control , tab index.

.net - Data transfer slows over time in sending data to a WCF service from WCF client (NET.TCP binding) -

i have wcf client establishes connection wcf server. when start host app client works fine , receives , responds requests in timely fashion. after minute or , increased load process slows crawl. ive traced problem time takes send response wcf server. sending simple text (not more 2 kb) taking 10-15 seconds , longer that. the wcf server running fine (as far know) are there specific setting can tweak might speed throughput or correct situation ? the services communiate net.tcp binding. here config settings <system.servicemodel> <bindings> <nettcpbinding> <binding name="nettcpbinding_comms" closetimeout="00:01:00" opentimeout="00:01:00" receivetimeout="00:10:00" sendtimeout="00:01:00" transactionflow="false" transfermode="buffered" transactionprotocol="oletransactions" hostnamecomparisonm

Unsigned ints with json_decode() in PHP -

i realize php not support unsigned integers, i'm wondering how solve issue i'm having json_decode(). when decode json contains unsigned ints above 2^31, come out negative, since being treated signed ints. can rectify configuring php.ini file or there json_decode i'm not getting? the development version of php seems have planned option json_decode() problem: json_bigint_as_string (see example #5 in manual) there seems no production fix right now. see this comment in user contributed notes. any chance of outputting strings on encoding end somehow?

c++ - How to style a submenu item in Qt? -

i style menu item has submenu differently, make submenu standout. style being applied menu items in submenu rather styling submenu item alone. menu1 menu2 -> menu21 menu22 menu23 menu3 i wanted style menu2, qt styling menu21, menu22 , menu23. tried these: submenu->setstylesheet("qmenu{ font: bold }"); submenu->setstylesheet("qmenu::item{ font: bold }"); submenu->setstylesheet("qmenu::item#submenu{ font : bold }"); dynamic properties did not help, setting style on action associated submenu crashing qt! :( thanks time, gowtham see documentation: qt style sheets reference - qmenu qt style sheets examples - customizing qmenu i haven't tested this, in theory, may able use qmenu::item either property selector or id selector (see qt style sheet syntax - selectors ). example: qmenu::item[text="menu2 text"] or qmenu::item#menu2id though may difficult or set id. of course, may

text search in mysql jdbc -

i need search throw text field in mysql java application. should use search engine lucene? ideally should support sql syntax. need search through text field (eg. select * mytable textfield '%searchfor%' limit 100;) secondly, if need wildcard search through rows in database, using search engine faster performing like? should use? a search engine on top of db faster since uses own index text search.

windows - How to get working directory hash acknowledging all uncommitted changes? -

part of software build process includes getting hash of working directory parent c++ string inclusion in "version" output. done using hg identify -i global revision id, , copying output .h file inclusion. in windows batch file: setlocal enabledelayedexpansion /f "tokens=1 delims=;=" %%a in ('hg identify -i') ( echo const std::string revision^(_t^("%%a"^)^); > rev.h ) which output file: const std::string revision(_t("3b746fd492c6")); if working directory has uncommitted changes, hash has + appended, making string "3b746fd492c6+" . allows me check whether version of software have built controlled or not - if string includes + software not reproducible repository. however, hg identify adds + denote uncommitted changes, not recognised untracked files. if commit changes forget add all-important "do stuff" class, hg identify not indicate this. so question is: how can required functionality? how ca

c++ - How do I get outputs in Ruby using SWIG over a C function taking pointers to output arguments? -

how outputs (declared using int pointers) function wrote in c++, using swig, in ruby? in transcript below, i'm declaring 'a' , 'b' them initialized integers, they're supposed outputs. irb(main):001:0> require 'vetms.rb' => true irb(main):002:0> a=3 => 3 irb(main):003:0> b=4 => 4 irb(main):004:0> $v.button a, b argumenterror: wrong arguments overloaded method 'baseinterface.button'. possible c/c++ prototypes are: bool baseinterface.button(int *id, int *event) bool baseinterface.button(int *id) bool baseinterface.button() (irb):4:in `button' (irb):4 :0 (edit) swig code isn't remarkable--i use %include 'pointers.i' i'm not sure that. 'vetms.rb' requires generated library , creates $v object. main problem here c++ function, ruby can't bind 'a' , 'b' objects to: bool baseinterface.button(int *id, int *event) my problem is, if doing in straight c, pass addres

regex - Python Regular Expression with optional but greedy groups -

i'm trying write regular expression match string may or may not contain 2 tags. need expression return me 5 elements of string, depending on whether exist, when make tags optional, wildcard bits seem gobble them up: inputs be: text{a}more{b}words {a}text{b}test text text{b}text text{b} text{a}text et cetera. thing guaranteed <a> before <b> , provided exist. my expression looks follows: ^(.*?)(\{a\})?(.*?)(\{b\})?(.*?)$ unfortunately, ends throwing text last group, regardless of whether or not tags present. there way make them greedy, yet keep them optional? re.findall doesn't seem either unfortunately. any appreciated! :) try following regex: ^(.*(?={a})|.*?)({a})?(.*(?={b})|.*)({b})?(.*?)$ import re inputs = ['{a}text{b}test', 'text', 'text{b}text', 'text{b}', 'text{a}text'] p = re.compile(r"^(.*(?={a})|.*?)({a})?(.*(?={b})|.*)({b})?(.*?)$") input in inputs: print p.mat

wpf - How do you bind a ContentTemplate directly to a Grid? -

in following xaml, trying bind various datatemplates directly grid contentpresenter. have put button inside grid prove myself contenttemplate binding , datatriggers working correctly - (note don't want type of control @ point). if replace <button > <contentpresenter > nothing shows up. i'm missing simple here. <datatemplate x:key="mytemplate"> <grid style="{staticresource gridallocatedstyle}"> <ellipse stroke="#ff5a71fb" strokethickness="0.5" style="{staticresource ellipsefinanciallyallocatedstyle}" /> <textblock style="{staticresource textblockinsideellipsestyle}" text="a" tooltip="allocated" /> </grid> </datatemplate> <datatemplate x:key="allocationtemplate"> <grid>

Method to do a "join" when using LINQ in db4o? -

whats correct linq navigate end leaf node of following data structure? root ----symbol (apple) | |------day 1: date: 2010-10-18, string "apples on thursday" | |------day 2: date: 2010-10-19, string "apples on friday" | | |-----symbol (pear) |------day 1: date: 2010-10-18, string "pears on thursday" |------day 2: date: 2010-10-19, string "pears on friday" in other words, if select "apple", "2010-10-19", should return "apples on friday". the following not work (it selects cartesian product every single combination) of symbol , date): var daysforsymbols1 = symbol s in db4o.db date t in db4o.db (s.symbolglobal == "apple" && t.date == new datetime(2010, 10, 18)) select new

In Java, how do I create a temp file only in memory to parse xml? -

i'd read in xml response , make temp file in memory out of xml. then, i'd read in file see if elements exist. after done, i'd rid of temp file. familiar making , reading files to/from file system, possible not write, , read, file in memory only? why bother creating "file" in memory? keep xml representation (whether that's using jdom, w3c dom api or whatever). it lot simpler examine in that format "file" in memory. after all, if had serialized form of it, appear on disk, in order query you'd have parse again anyway!

Hyperlinking to Facebook iframe application without knowing page name -

i have facebook iframe app runs on various facebook pages. can create link directly app following hyperlink: http://www.facebook.com/pages/page-name/page-id?sk=app_app-id page-name , page-id , , app-id populated corresponding variables. is there way link app if don't know page-name , , know page-id , app-id ? i can link page without knowing page-name using following hyperlink: www.facebook.com/profile.php?id= page-id however can't seem find way link app's iframe on page. i've tried these 2 links don't work either: www.facebook.com/profile.php?id= page-id &sk=app_ app-id www.facebook.com/profile.php?id= page-id &v=app_ app-id http://graph.facebook.com/ page_id json_decode that, link field. append your ?sk=app_ app-id

Rails 3 app doesn't redirect after AJAX form submission -

i have authlogic login form :remote => true little inline validation rjs template if user/password isn't valid. works fine, when credentials are valid, doesn't redirect elsewhere. here's controller responds form input: class usersessionscontroller < applicationcontroller respond_to :html, :js before_filter :require_no_user, :only => [:new, :create] before_filter :require_user, :only => :destroy def new @user_session = usersession.new end def create @user_session = usersession.new(params[:user_session]) respond_to |format| if @user_session.save flash[:notice] = "login successful!" format.html { redirect_to account_url } else format.js end end end def destroy current_user_session.destroy flash[:notice] = "logout successful!" redirect_to root_path end end the format.js part works if user/password ( format.html ), nothing happens. howev

html - How to cache specific parts of page in PHP intelligently? -

problem: i've website has 50k+ pages , of them updated once on creation time, building caching these pages not need frequent changes on content. i'm confuse few things. if cache whole page, how preserve user login/logout status in sidebar how cache meta tags page main caching done in middle of page expensive part far processing concerned. take @ cache_lite pear module .

c# - How do you get text in a Word table to vertical align? -

i creating word document on fly c# vs 2010 office word project client wants able generate document allow appropriate number of signatory locations particular deal going down. there table need generated sufficient rows , later in doc have produce prefab blocks personal info per signatory. i working on table part , have want it, text in of cells vertically top aligned. have visited every site in entire internet in past few days up-to-date information on word automation current .net 4, vs 2010 , office 2010. have syntax compiles w/o error fails bottom align desire. have stabbed intellisense see if find solution. this code focuses on single row: tbl.range.rows[1].cells.verticalalignment = word.wdcellverticalalignment.wdcellalignverticalbottom; runs text stays helium-filled. any word automation wizards out there? the text centered vertically, incudes paragraph spacing other "0." so, word viewing line additional text needs included in vertical centering. to

Get the array of RadioButtons in a RadioGroup in Android -

is there way of getting array (or collection) of radiobutton s in android radiogroup ? add individual listeners radio buttons don't see obvious way of iterating on them. this should trick: int count = radiogroup.getchildcount(); arraylist<radiobutton> listofradiobuttons = new arraylist<radiobutton>(); (int i=0;i<count;i++) { view o = radiogroup.getchildat(i); if (o instanceof radiobutton) { listofradiobuttons.add((radiobutton)o); } } log.d(tag,"you have "+listofradiobuttons.size()+" radio buttons");

vb.net - Entity Framework and Repository Pattern -

i trying use repository pattern ef4 , not sure how make lazy loading work it. if return object, customer, , want able @ it's orders, maybe, not sure, how should go this? how long should let context live for? should go , collection of orders? any examples appreciated!! thanks! edit so if have repository (assuming have poco classes category , subcategory): public class categoryrepository implements icategoryrepository public function getcategories() list(of category) using db new dbcontext <-- entity framework context return db.categories.tolist() end using end function end class and consume in controller: public function index() actionresult dim m new categoryviewmodel m.categories = _repository.getcategories() return view(m) end function if try in view say: category.subcategories.count it blows saying objectcontext disposed. if you're following concept repositories exist once per aggreg

How do I perform an action when an Android Notification is complete? -

i have service starts broadcastreceiver listen sms. if specific sms received sets notification volume maximum , fires notification. how can return volume previous setting after notification has completed? you can't directly, , workaround can try current notification sound's length, wait specific period, , change volume. don't think it's reliable though ...

c# - unregister client script from Asp.Net -

i register jquery ui datepicker in asp.net page using .net scriptmanager class. private void registerdatepicker(textbox tb) { if (tb != null) { scriptmanager.registerstartupscript(this, typeof(page), "registerdatepicker" + tb.id, "registerdatepicker('" + tb.clientid + "');", true); } } so once registered, want unregistered script page. how can ? thanks after @stackoverflowexception answer, the reason want unregister script is, have few textbox controls created dynamically , hooked date picker. not datepicker registered,a dialog , validator scripts registered. script becoming bigger , bigger in page. once used control, if no longer use control want remove associated registered script. note controls created , added in table thanks again. jquery makes simple (and compactly) shouldn't on server-side (if understand you're doing). just add class (like date-picker ) text boxes should use d

asp.net - Strategies for localizing large amounts of text in .NET applications -

i'm working on large asp application localized. i'm using standard named resx approach in satellite assemblies, fallbacks (that is, es-mx , es-cl , fallback common es , on). not there hundreds (if not thousand or more!) of different strings; in places amount of text needs stored resource can long, tune of few paragraphs. i'm guessing royal pain manage these strings in visual studio editor, not mention fact people of translations won't have access vs in first place. how folks work on localized apps manage type of thing? advice , pointers appreciated. if decide go db, check out article: creating data driven asp.net localization resource provider , editor rick strahl , download free if decide still using resx, can use zeta resource editor mitigate pain.

rest - Spring @ExceptionHandler does not work with @ResponseBody -

i try configure spring exception handler rest controller able render map both xml , json based on incoming accept header. throws 500 servlet exception right now. this works, picks home.jsp: @exceptionhandler(illegalargumentexception.class) public string handleexception(final exception e, final httpservletrequest request, writer writer) { return "home"; } this not work: @exceptionhandler(illegalargumentexception.class) public @responsebody map<string, object> handleexception(final exception e, final httpservletrequest request, writer writer) { final map<string, object> map = new hashmap<string, object>(); map.put("errorcode", 1234); map.put("errormessage", "some error message"); return map; } in same controller mapping response xml or json via respective converter works: @requestmapping(method = requestmethod.get, value = "/book/{id}", headers = "accept=application/json,applicati

Allow Drupal Organic Group Admins delete and edit access to all group nodes -

we have drupal site uses organic groups represent companies. i'm looking module allow give edit , delete access group admins posts associated group. is there module exposes type of relationship? http://drupal.org/project/og_user_roles this module lets attach edit/delete permissions roles in group context. build "group admin" role , set default role group managers. there options regular group members. users appear have role when they're looking @ group or posts within group. don't have role in traditional sense can confusing.

ruby - word boundaries in irb -

i'm using terminal on snow leopard. at command line, if i've typed foo.bar.baz.bang.quuz.quux , when tap option-b, moves cursor backward word word -- stopping @ every period, because considers period word boundary. likewise, option-f moves forward word word. in irb (0.9.5, ruby 1.8.7), option-b , -f have behavior, period no longer treated word boundary, makes these keyboard shortcuts less useful. how can change this? edit: curiouser , curiouser: on ec2 instance has same irb , ruby versions, period is treated word boundary. could of relevance here? http://jorgebernal.info/2009/11/18/fixing-snow-leopard-ruby-readline/ in case make sure option-b/f bound forward , backward-word in inputrc files, john pointed out. also word boundaries determined locale (see "locale" command), , more lc_ctype (character classification). don't think that's problem here, might want check out , compare locale settings in case.

Website backups on Amazon s3 -

edit: have changed question. i want use amazon s3 backups , looking debian lenny software (or php script) allow me achieve need. flash games website: upload files , subdirectories specified directories, uploading files added/changed (overwrites old files on s3). perform database dump , upload s3, keeping 7 previous dumps. lightweight , easy use it has possible run cron job should work on debian lenny anything matches these specifications? the php script website 2 backup want : backup amazon s3 incremental backup of files, new , modified files backuped, deleted files listed. backup of database, auto clean of old archives clean , easy setup ajax administration it runs cron job and more, data encrypted on serveur, data recovery few clicks....

Stored Proc works in VS 2010 development Server and not in IIS -

dear all, have tremendous problem. developing asp.net web site coursework in university. have completed site , used procs each , every interaction db (ms sql server 2008). having finished site, tried deploy site in iis 7 web server of university because need create web services , create silvelight projects … thing procs not retrieve data after deployment in iis. in vs2010 project works perfectly. conn string ok. can retrieve data (having deployed iis). if use comm.commandtype = system.data.commandtype.text; , provide command string. not if use stored procs. e.g. sqlcommand comm = new sqlcommand("ai932.proc_retrievedocs", conn); comm.commandtype = system.data.commandtype.storedprocedure; sqldataadapter adapter = new sqldataadapter(comm); adapter.fill(dtable); alter procedure [ai932].[proc_retrievedocs] begin set nocount on; select * ai932.doctor; end i cannot understand problem? please !!! what user iis app pool service run as? network service? netw

C# resize an array of unknown type -

possible duplicate: c#: there way resize array of unknown type using reflection? hi, is there way resize array of unknown type? please see sample code below. object readarray() { type classtype = type.gettype(arrayitemname, true); object arr = array.createinstance(classtype, 0); // unknown length // read length stream resizearray(ref arr, length) // populate array items stream // read length2 stream2 resizearray(ref arr, length+length2) // populate array items stream2 return arr; } resizearray(ref object array, int n) { array arr = array array; array.resize(ref arr, n); // compile error! type can't inferred array = arr; } use generic list. not have problem resizing.

java - Error in declaring string array -

i getting error when use string array java.lang.nullpointerexception the code used follows.. string[] list = null; string sql = "select * pos_products"; resultset rs = mysql_query.execute_mysql(variables.con.conn, sql); while (rs.next()) { system.out.println(rs.getstring("product_name")); list[i] = rs.getstring("product_name"); i++; } i have add 1 more thing after seeign replies.. first thank guys response.. problem using jlist , have add content it.. if use list cant add directly. can user either vector or string array. thoughts on ?? your list null , null[i] throws nullpointerexception you should consider either initialize chrisj describes or use list list<string> list = new arraylist<string>(); .... list.add( rs.getstring("product_name")); .... edit this solves 2 parts, nullpointerexception , dynamic fetch of data. you mention need put in jlist, in case, can sti

streaming - MonoTouch: Capture Audio Stream From Microphone -

i know avaudiorecorder class, wondering how (using monotouch) capture mic input can stream remote server. avaudiorecorder class lets save stream local file. there way pass url or byte data before it's sent local file? you can use lower-level apis in monotouch.audiotoolbox assemble kind of audio pipeline need. there sample decoding , playing streaming audio in: https://github.com/xamarin/monotouch-samples/tree/master/streamingaudio this useful merely give idea of how process samples. idea similar, using other side of api extract , upload data. this apple's guide capture audio audiotoolbox: http://developer.apple.com/library/ios/#documentation/musicaudio/conceptual/audioqueueprogrammingguide/aqrecord/recordingaudio.html#//apple_ref/doc/uid/tp40005343-ch4-sw1 that documents c api, have provided high-level binding in monotouch for.

How do I call this method? (Objective C) -

i have method report score game center: - (void)reportscore: (int64_t) forcategory: (nsstring*) category { gkscore *scorereporter = [[[gkscore alloc] initwithcategory:category] autorelease]; scorereporter.value = passedint; [scorereporter reportscorewithcompletionhandler:^(nserror *error) { if (error != nil) { // handle reporting error } }]; } now have ibaction try call method not able figure out.. - (ibaction)uploadscore { passedint = [[nsuserdefaults standarduserdefaults] integerforkey:@"scoreoneplayer"]; nslog(@"%i", passedint); [self reportscore:(passedint)forcategory :(nsstring *) category]; } passedint int want upload game center. if can help, appreciated! :) this should it: [self reportscore: passedint forcategory: @"put category here"]; you shouldn't need provide types in method call.

MySQL Voting Table, Find most recent vote by each user on an entry, and count based on value -

working database structure didn't create , hoping on simple mysql query. have voting table votes these fields: vote_id = unique vote identifier item_id = id of entry voted on voter_id = id of member entered vote vote_date = date of vote vote = type of vote (1 or 2) each user can vote multiple times on site entry specified item_id . can place vote of 1 "like" vote, or vote of 2 "unlike" vote. each time vote, new record created. able find recent vote value each user on particular item_id , able sum or count vote column if vote value "like" (value of 1) for example vote_id item_id voter_id vote_date vote 60 9 27 1273770151 1 153 9 45 1274896188 1 163 9 3 1274918584 1 164 9 3 1275021495 2 1051 9 181 1290839090 1 i want newest vote values each user, , count of how many votes of 1 there are. in

ruby on rails - Schemaless DBs: Indexing dynamically-typed things by their properties? -

in rdbms can declare types (tables) , subtypes (subtype tables supertype fks). in rails class table inheritance. example, have person table , friend subtype table more personal details person (e.g. birthday/anniversary). when leap nosql world , use document db mongodb implementing subtypes easier since collections schema-less. ideal creating cms. can dynamically type anything. in fact, thing can multi-typed having properties of types. not tricky either. but here's tricky part. want index dynamically typed things (e.g. "things" collection). want search event things start_date. want search people things name. want search friend things birthdate. when you're not dynamically typing things each of these types have own collection. indexing events, people, friends dynamically-typed things tough. indexing events, people, friends types (tables or collections) not tough. it seems me mongodb (and other schema-less databases) made dynamic typing. @ least,

c# - Are WPF Binding paths normalized under the hood? -

i wonder if makes difference, if repeat subpath property in each binding or if bind datacontext , state relative paths in bindings. examples: absolute paths: <usercontrol x:name="uc"/> <stackpanel> <textbox text="{binding viewmodel.prop1, elementname=uc}" /> <textbox text="{binding viewmodel.prop2, elementname=uc}" /> </stackpanel> </usercontrol/> relative paths: <usercontrol x:name="uc"/> <stackpanel datacontext="{binding viewmodel, elementname=uc}"> <textbox text="{binding prop1}" /> <textbox text="{binding prop2}" /> </stackpanel> </usercontrol/> i know both bind same properties, i'm interested in what's happening behind scenes, because maybe can influence performance in situations there more 2 bindings. variant absolute paths result in more "event traffic", because each of text-binding

ruby - Will array.each work properly if the array is updated during each iteration? -

will method process each element of array if array being updated within code block of each loop? for example: arr.each |x| if (x != 2) arr.push(x+4) end end will loop still iterate on every element within array, though being lengthened? maybe yes , if talking mri , , question is: " will iterator traverse new elements? ". if talking ruby language, " maybe ". there no specification mri serves reference implementation. but having said that, seems implementation-specific, partly because requiring specific behavior impose constraint on implementations no clear benefit, performance trade-offs. it's quite imperative , it's perhaps not "the ruby way", leans more functional styles . here how think ruby program should write sort of loop. expression return old array unless changes, in case creates new array in functional style there never doubt result be... >> = [1, 2, 3] => [1, 2, 3] >> a.inject(a)

UIwebview loader on iphone -

this code works fine , show activityindicator loading , hide after loading lets if on loading stage , go apps quit , how avoid this if go withiut site loaded quits ( think activityindicator culprit) ** - (void)webviewdidstartload:(uiwebview *)webview { [activityindicator startanimating]; // mylabel.hidden = false; } - (void)webviewdidfinishload:(uiwebview *)webview { [activityindicator stopanimating]; activityindicator.hideswhenstopped=true; //mylabel.hidden = true; } // implement viewdidload additional setup after loading view, typically nib. - (void)viewdidload { self.title=@"kkh website"; [super viewdidload]; nsurl *requesturl = [nsurl urlwithstring:@"http://www./index.html"]; nsurlrequest *requestobj = [nsurlrequest requestwithurl:requesturl]; [aww loadrequest:requestobj]; } ** updates if link uiwebview delegate fileowner creating isuee , need delegate since want show loading i forgot release

Accessing an SQL Server stored procedure (containing no SELECT statement) from Excel VBA, ideally without using Excel Data Connections? -

i'm trying build vba form runs sql server stored procedure cache data before else. ideally i'd prefer not use excel data connection because can't export new workbook minimum of fuss - it'd nice contain of information in form's file. the main way know connect vba database using code along these lines: dim cnn new adodb.connection dim rst new adodb.recordset cnn.open connectionstring rst.open querytext, cnn, adopendynamic /*whatever you're doing data goes here*/ rst.close cnn.close the problem i'm running caching proc doesn't return dataset (not blank one), , type of connection seems throw tizzy if there no data returned. , i'd prefer not modify proc if don't have to. is there feasible solution, within these constraints? or being whiny , should suck , use excel data connection or something? i think looking adodb.command. try this: dim cnn new adodb.connection dim cmd adodb.command cnn.open connectionstring set cmd = new

language design - Why does Java allow for labeled breaks on arbitrary statements? -

i learned today following java code legal: myblock: { /* ... code ... */ if (doneexecutingthisblock()) break myblock; /* ... more code ... */ } note myblock isn't loop - it's block of code i've delimited curly braces. this seems rather strange feature have. means can use named break break out of if statement or anonymous block, though can't use break statement in these contexts. my question this: is there reason design decision? is, why make can break out of enclosing statements using labeled break s not regular break s? , why allow behavior @ all? given how (comparatively) well-designed java language assume there's reason this, can't think of one. it plausible done simplicity. if labeled break can break loop statements, should clear language designer restriction isn't necessary, semantics work same statements. economics of language spec, , simpler implementation of compilers, or out of habit towards genera

cocoa touch - UISlider or UISwitch with a stationary mask? -

Image
i've found gorgeous switch i'd implement in ios. artist (@jasonlong) has kindly shared psd of components @ 365psd.com , along crafty little javascript demo. now, here's trouble... custom uislider , uiswitch examples i've found seem rely on track that's stationary movable knob/toggle. in switch below, require knob/track animate behind mask passes through touch events. i've never been of interface coder, cute little bugger awesome leave alone. can point me in right direction? i suggest having background stationary, , fade between them? sliding track not going work well, can still see green/white around edge of knob.

validation - Could someone explain these javascript codes for me? -

all codes form validation. don't understand general idea of javascript codes. explain general idea behind javascript code , explain function validform() , function validbasedonclass(thisclass) ? thank much. this html page contains form fields required filled out user before form can submitted. <!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>password check</title> <link type="text/css" rel="stylesheet" href="script03.css" /> <script type="text/javascript" src="script03.js"></script> </head> <body> <form action="#"> <p><label for="username">your name: <input type="text" size="30" id="username" class="reqd"

c++11 - C++ metafunction to determine whether a type is callable -

is possible write c++(0x) metafunction determines whether type callable? by callable type mean function type, function pointer type, function reference type (these detected boost::function_types::is_callable_builtin ), lambda types, , class overloaded operator() (and maybe class implicit conversion operator 1 of these, that's not absolutely necessary). edit : metafunction should detect presence of operator() signature, including templated operator() . believe difficult part. edit : here use case: template <typename predicate1, typename predicate2> struct and_predicate { template <typename argt> bool operator()(const argt& arg) { return predicate1(arg) && predicate2(arg); } predicate1 predicate1; predicate2 predicate2; }; template <typename predicate1, typename predicate2> enable_if<ice_and<is_callable<predicate1>::value, is_callable<predicate2>::value>::value,

sql - Locking rows in a table for SELECT and UPDATE -

i writing script needs book seats in cinema. user asks 2 seats if there 2 seats available, system offers them client client can either accept them or request 2 seats. when accepts, seats marked "sold" since there can multiple users using system simultaneously, need way "lock" rows offered current client until time passes, or requests seats. currently marking offered seats "locked" client id, , use select return them client (this mysql, target database postgres) update seats set status = "locked", lock_time = now(), lock_id = "lock1" limit 2 select * seats lock_id = "lock1" , lock_time > date_sub(now(), interval 2 minute) there problem that: if there's 1 seat available, still marked "locked" , have release lock right away. i pretty sure there smarter way of doing that. correct way of dealing task that? race condition - think better insert rather update. 2 updates can run @ same t

algorithm - external sorting -

in web page: http://web.eecs.utk.edu/~huangj/cs302s04/notes/external-sorting2.html merge resulting runs successively bigger runs, until file sorted. as quoted, how can merge resulting runs together??? don't hava memory. imagine have numbers 1 - 9 9 7 2 6 3 4 8 5 1 and let's suppose 3 fit in memory @ time. so you'd break them chunks of 3 , sort each, storing each result in separate file: 279 346 158 now you'd open each of 3 files streams , read first value each: 2 3 1 output lowest value 1 , , next value stream, have: 2 3 5 output next lowest value 2 , , continue onwards until you've outputted entire sorted list.

Please explain this Javascript tutorial -

i'm total newbie , i'm confused tutorial. know (at least think know) functions getdate , month , getfullyear pre-set functions determined javascript. why preset functions necessary tutorial if new date (2000,0,1) being submitted argument formatdate? getdate clash somehow numbers submitted argument? in function pad, understand "number" checks see whether number less 10 and, if so, adds zero, argument submitted function pad? how numbers check? can please take me through (using plain language) tutorial step step...thank in advance function formatdate(date) { function pad(number) { if (number < 10) return "0" + number; else return number; } return pad(date.getdate()) + "/" + pad(date.getmonth() + 1) + "/" + date.getfullyear(); } print(formatdate(new date(2000, 0, 1))); this function formats , prints date. the pad function add "0" (not add 10 noted) in front of number l

rails read the file and store the database -

saved .rb file in app/component/text.rb. want read , store database. in file has 5 rows , table have 5 rows.i want save line line.you can understand question.i use mysql database. please me.... thanks, kingston.s i missed rails- , ruby-version, operating system use , clear problem description...anyway assuming meant database have 5 fields , want read , write record file: assuming file contain record model "apple "with fields id, title , description. read new apple file: indexes = [:id, :title, :desc].reverse # careful data saved reverse because pop takes last element first record_params = {} handle = file.open("apple.record","r") handle.lines.each |line| record_params[indexes.pop]=line.chomp #use chomp rid of trailing \n end handle.close apple.create!(record_params) write apple id 7 file indexes = [:id, :title, :desc] record = apple.find(7) to_save = indexes.map{|i| record.send i} handle = file.open("appl

c# - MailMessage ASP.NET Wrong from email? -

i have event button, emails me whatever user entered. message fine....subject....message. email part showing myself (same 1 going to) how have show whatever email address entered? i'm using gmail smtp gmail account have set up. mailmessage has 4 parameters (from, to, subject, body) txtemail.text hold email address correctly. protected void wizard1_finishbuttonclick(object sender, wizardnavigationeventargs e) { this.toemail = "myemail@gmail.com"; this.subject = txtsubject.text; this.fromemail = txtemail.text; this.comment = txtcomment.text; message = new mailmessage(fromemail, toemail, subject, comment); smtp.send(message); message.dispose(); } i tried suggestion below this... , still showing myself. message = new mailmessage(replytolist[0].tostring(), toemail, subject, comment); i tried doing way , still shows myself. stepped through code make sure, holding different email addresses , is. protected void wizard1_finishbutto

java - List items ordering problem -

i have list of items , set of users. users can re-order list items. each user has own view list, can arrange items in own way. 1 item can placed in different locations in list different users. i've track item location users in list item. please give suggestion implement this. size of list not constant. i'm using java. intension have show list every user in ordering format. please masters give me suggestion. you can keep ordered list of, well, order retrieve items master list: list<foo> items = new arraylist<foo>(); // add stuff items (say, 6 things) map<string,list<integer>> userorders = new hashmap<string,list<integer>>(); userorders.put("a", arrays.aslist(0,1,2,3,4,5)); // add user a's order userorders.put("b", arrays.aslist(5,4,3,2,1,0)); // add user b's order // display usera: for(integer : userorders.get("a")){ show(items.get(i)); // show usera's i-th item } here i'm us

find - How to properly clean in a Makefile? -

for small c/c++ projects used write clean target follow: clean: $(rm) *.o *~ for bigger projects, when sources dispatched in subdirectories, src1 , src2 , write clean: $(rm) src1/*.o src1/*~ src2/*.o src2/*~ with more subdirectories, becomes messy… realized use find command this: clean: find . -name "*.o" -exec $(rm) {} \; find . -name "*~" -exec $(rm) {} \; however saw people use find in conjunction xargs instead of using -exec , wonder why since seems work fine… what use , why? i know big projects, or better compatibility, should use cmake or autotools simplicity of makefile small projects. because exec creates 1 sub-process per file being deleted. xargs , on other hand, batches them up. it's difference between: rm src1/a.o rm src1/b.o rm src2/c.o and: rm src1/a.o src1/b.o src2/c.o it's not going matter unless have lot of files it's worth knowing use case. but don't use either of met

C++ Homework: Parallel Arrays from text file -

i have load 3 arrays text file homework , can't figure out why isn't working. text file like: jean rousseau 1001 15.50 steve woolston 1002 1423.20 michele rousseau 1005 52.75 pete mcbride 1007 500.32 it's name on 1 line, id number , balance due on next line separated space. this function import data: void inputfromfile(string filename, int sizes, string namesar[], int idsar[], float balancesar[]) { // variables int indexcount; ifstream infile; // initialize indexcount = 0; infile.open(filename.c_str()); while(infile && indexcount < sizes) { getline(infile, namesar[indexcount]); infile >> idsar[indexcount]; infile.ignore(1000, '\n'); infile >> balancesar[indexcount]; infile.ignore(1000, '\n'); indexcount++; } infile.close(); } this gets added array when output items... jean rousseau 1001 0 -1 3.76467e-039 36 3.76457e-039 0 6.57115e-039 7736952 8.40779e-045 7736952 0

php - Where can I find information/code for a match making site? (Not necessarily dating) -

can point me in direction of site, blog post, etc... gives clear , concise examples/information creating match making site. should state 1 point before bite head off: this not dating website. it's site attempt match potential visitors our site other minded visitors , pros on our site. it's more match making, , potentially social networking, not exactly. examples/information algorithms used or code samples. language of choice php i'm not averse ruby on rails either. thanks can contribute. you map preferences onto multi-dimensional space , use euclidean distance between 2 subjects cartesian coordinates determine how "matched up" are. need find subjects shortest distances , these suitable matches.