Posts

Showing posts from March, 2011

Validation messages are displaying at the bottom of the page JSF - javax faces developmentstage messages -

i stuck displaying error message in jsf. requirement given below: i have user form, user has enter details firstname, lastname, username , emailaddress. these fields mandatory, among these fields, username , emailaddress unique. when user enters fields, , if clicks save @ backend have check whether username , email address exists in db, if exists have show error message on top of page saying "the data entered exists, please reenter again". and validation messages firstname , lastname should display on side of each field. can't use <h:messages> because displays validation messages @ once. so populating hidden field in form message using following code: context.addmessage("addusererrormessage", new facesmessage("the data entered exists, please reenter again")); addusererrormessage id of hidden form field. but when displaying message @ top of page <h:message for="adduserformmessage"> the message being displa

sql - Extendable Database Schema - How to store the extendable attribute values -

we using sql server 2008 , 1 of requirements have extendable user defined attributes on entities defined system. example, might have entity called doctor, want admins of system able define attributes not in system. these attributes needed query criteria linking parent or joiner tables. there tables define attributes (name, description, type) , forth, question on storage of actual data values. im not dba (just programmer pretending one) first thought store them in 1 generic column nvarchar(450) this cover of basic types , still allow index, thought run lots of conversion type issues (converting dates, numbers, etc.) unusual query issues since nvarchar. so, latest thinking create column each data type support: colnvarchardata nvarchar(450) colbitdata bit colintdata int ..and forth when user defined extendable attribute, pick data type , store attribute value in column type. example, if picked int, data value stored colintdata , other 2 columns null in example.

c++ - Boost:regex_search - match string between brackets -

given part of logstring: ... http/1.1" 206 391402 "-" "applecoremedia/1.0.0.8b117 (ipod; u; cpu os 4_1 mac os x; de_de)" i need match last substring inside brackets remote system info string. i'm not regular expressions understanding have escape brackets " \( " , " \) ". now match whole string thought i'd have like: \(\.*\) dot matching , " * " specifying random amount of dots. but does't work. neither (\.*) or (.*) expect. there must problem opening , closing brackets because seg fault when trying match string way. can me please? ok sorry bothering you. did trick: boost::regex f_sourcedir(conf.pstring("filter_sourcefiles")), f_string(conf.pstring("filter_string")), m_first(conf.pstring("field0")), m_second("\\(([^)]+)\\)\"$",boost::regex::perl), m_third(conf.pstring("field2")), m_fo

asp.net - Setting folder default page in aspnet -

my question simple. have web application multiple sub-folders , there's no default.aspx page in of these. how set default page in each of these folders users can type /folder instead of /folder/login.aspx? can done through web.config file? should rename file in each folder default.aspx? thanks! there default document section web.config , , can put web.config in each folder, , inside config have default document set.

mysql - Comparing Dates In Sub Query Returns No Results -

i've got mysql query: select some_fields, (select slug photos date_added > p.date_added order date_added asc ) next, (select slug photos date_added < p.date_added order date_added desc ) prev photos p slug = 'test' to photos table, next , previous images tagging along in same query. if remove 'prev' part of query runs , returns result, 'prev' part no results retruned reason. weirdly, if switch < > in 'prev' part returns (an incorrect) result, there's problem comparing 2 datetimes that. i'm @ wit's end honest, no idea be... i'd prefer join photos table itself, not least because not has "next" photo, want outer join. here's query doesn't work: select some_fields, next.slug, prev.slug photos current left join photos next on (current.date_added < next.date_added) lef

cgi - Perl Mojolicious - How to make it handle multiple connections at once? -

i setup quick mojolicious server this: use mojolicious::lite; '/' => sub { $self = shift; sleep 5; #sleep here, i'm testing multiple connections @ once $self->render_text('hello world!'); }; app->start; i start with: perl mojolicious.pl daemon --listen=https://127.0.0.1:3000 problem is, if run command concurrently: time curl https://127.0.0.1:3000/ -k it seems use 1 thread requests, because if make multiple requests @ once, can take longer 5 seconds. it's if queued up. am missing here? i'm wanting use mojolicous, if can handle more 1 client @ time. mojo daemon standalone http server meant development use, not production, , runs single thread. production want either use fastcgi option , fastcgi-supporting webserver, or install nice psgi -compatible server starman or starlet or plack::handler::fcgi or fastpass , do plackup -s starman --port 3000 mojolicious.pl

django - Maintaining URL parameters across page views -

i writing django application , provide optional filters , sort options results displayed. represent these optional filters , sort options using restful urls such as / /tags/tag1/ /tags/tag1/page2 /tags/tag1/by/newest-desc/ /tags/tag1/by/newest-desc/page2 etc. how should maintain existing url filters or sort options across page views? have tried using {% url 'list-view' tags=tags sort=sort-option %} in templates these cause problems when viewing pages without both tags , sort-option parameters set. this problem similar using both sort & filter on queryset looking restful url solution, not parameter or session state variable solution. any suggestions appreciated. niall sort order should get parameter should page number. they'll easier handle way. think way: /tags/tag1 indicate viewing. other 2 indicate display options.

How to access string from flipside view in main view in an xcode utility app? -

i want able write in text field on flipside view have displayed in label on main view, have no idea how go this. example code on accessing variables across view great. thanks ok first google tutorial how change text field nsstring. should easy. follow tutorial take string view sharing nsstring between 2 views then follow tutorial string display label nsuserdefault nsstring not getting displayed in label hope helps!

Invoking .Net webservices from Java -

i have web service created in .net , interested in invoking web service in java application. what set of libraries best suited this? i've looked glassfish, have been unable find examples of being used invoke .net web service, creating java side web service. i have experience using wsif, appears rather outdated , use more current if possible. check out links: your question webservices in java , tutorial uses jax-ws 2.0 a simpler approach want

ajax - Why php doesn't see the $_SESSION[] array anywhere? -

i'm writing php code processing lot of data, interactively. in starting php page call function session_start() before sending other data browser. then, put data $_session[] array, this: $_session['something'] = $variable; after, there form, sent via , xmlhttprequest. getrequest.open("get", "data_processing.php?var="+onevalue+"&another_var="+twovalue, true) getrequest.send(null) another php script recieves user data get, , there i'd use data stored in $_session well. $_session seems empty. i've never used sessions, correct way make available variables consequent php scripts? are sure called session_start first? see: http://php.net/manual/en/function.session-start.php

silverlight - Where Can I Find Current Documentation About .NET RIA Services Authentication -

i creating silverlight application our company intranet uses windows authentication. use authentication domain service class. can find current documentation explaining how authenticated user name etc.? a start msdn library. take @ this authentication, roles , profiles explained , tutorials provided.

java - Callable code won't use more than one CPU with ThreadPoolExecutor -

i have quad core processor , threadpoolexecutor set 4 core threads, when submit callables (hundred or so) threadpoolexecutor, java never uses more 25% cpu. why not use of them? code in question: static class sum implements callable{ private double bigarray[]; public sum(double [] bigarray){ this.bigarray = bigarray; } @override public double call(){ double sum = 0; (int = 0; < bigarray.length; i++){ sum += bigarray[i]; } return sum; } } in general, there no interface in java control cores , processors affinity code (and threads) scheduled os finds right. might not it. said running multiple threads on multiple cpu cores? in general not job jvm; os allocates core thread, jvm program. if you're running on ms windows machine can try set 'affinity' jvm, i.e. tell scheduler (task manager) cpus (cores) jvm allowed use. but not think way go. see answer stack overflow q

css - Active navigation "jumping" in IE7 -

Image
the site working on can found here . in ie7 only: the active navigation tab "jumps" whenever user hovers on inactive tab. screenshot: can explain how fix this? all can see there problem "active" class in /css/app.min.css file, or there javascript going on somewhere behaving incorrectly. might saying, "duh!" i can't tell tools have on hand. on other hand, able see no "jumping" occur when removed "active" class link in question. however, link appeared liked rest of items in navigation, , want look...uh...active. if issue somewhere in scripts, , don't know is, perhaps change name of class , find logic sets link being active reflect name of new active class. i start commenting-out existing styling associated "active" class , gradually build how want appear reintroducing of prior styling , refreshing page on each small change until find problem. i believe these of problematic styles need chan

java - Why is BlockingQueue.take() not releasing the thread? -

in simple short program, notice program hangs forever because take() not release thread. according understanding, take() causes thread released though task blocked on take(). edited: this works (thanks fixing autoboxing): import java.util.arraylist; import java.util.collection; import java.util.concurrent.callable; import java.util.concurrent.executionexception; import java.util.concurrent.executorservice; import java.util.concurrent.executors; import java.util.concurrent.future; import java.util.concurrent.linkedblockingqueue; public class producersconsumers { private static int thread_count = 5; public static void main(string[] args) throws executionexception, interruptedexception { final executorservice executorpool = executors.newfixedthreadpool(thread_count); final linkedblockingqueue<long> queue = new linkedblockingqueue<long>(); collection<future<long>> collection = new arraylist<future<long>>();

java - Listiterator in Android Game -

i have 2 arraylist's using, 1 enemy sprites , other bullets. when run app crashes on emulator , within few levels crashes on device upon collision. log keeps telling me have simple listiterator error. wanted know how implement listiterator. have not been using listiterator, searched around find information , examples bit confused on how it. add() function called in ontouch method of view class , collision takes place inside of thread class in own collision methods. log: 07-20 19:57:46.604: error/androidruntime(234): uncaught handler: thread thread-9 exiting due uncaught exception 07-20 19:57:46.613: error/androidruntime(234): java.util.concurrentmodificationexception 07-20 19:57:46.613: error/androidruntime(234): @ java.util.abstractlist$simplelistiterator.next(abstractlist.java:64) 07-20 19:57:46.613: error/androidruntime(234): @ com.android.hitmanassault.hitmanview$hitmanthread.startgame(hitmanview.java:333) 07-20 19:57:46.613: error/androidruntime(234): @ com

Problem accessing text file in a class in PHP -

i have code: <?php class compare { private $questions; private $q_scores = array(); private $q_path = "data/questions.txt"; function __construct( ) { ini_set('auto_detect_line_endings', true); $this->questions = fopen($this->q_path, 'r'); } public function checkstringforproximity($string) { while ($line = fgets($questions)) { echo $line; } } } ?> this relates prev. question: accessing fopen class in php the problem $line never prints , don't know why. i use class using: $compare = new compare(); $compare->checkstringforproximity("string"); any appreciated. in line while ($line = fgets($questions)) $questions not exist. should replaced $this->questions

Save an array of models in rails -

i have array keeps instances of model (supplierphone) this: supplier_phone = supplierphone.where(:supplier_id => 1) supplier_phone = [#<supplierphone id: 1, supplier_id: 1, phone: "22423434234", created_at: "2011-07-21 00:56:26", updated_at: "2011-07-21 00:56:26">, #<supplierphone id: 2, supplier_id: 1, phone: "98776234423", created_at: "2011-07-21 00:56:27", updated_at: "2011-07-21 00:56:27">] i want save each element of array supplier_phone in new instance of supplierphone, can tell me how can this? thanks in advance! supplier_phone.each{ |sp| suplierphone.create(sp.attributes) }

HTML5 offline cache works differently in different browsers, but always fails -

i trying grasp on how html5 offline cache works. i've read various tutorials , have tiny variations on manifest file must like. set page cache manifest this: cache manifest index.html icon.jpg a .htaccess file this addtype text/cache-manifest .manifest and index.html page this: <!doctype html> <html manifest="cache.manifest"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <meta name="viewport" content="user-scalable=no, width=device-width, initial-scale=1.0, maximum-scale=1.0"/> <meta name="apple-mobile-web-app-capable" content="yes" /> <meta name="apple-mobile-web-app-status-bar-style" content="black" /> <link rel="apple-touch-icon" href="icon.jpg"/> <script> cache = window.applicationcache; cache.onchecking = function() { statbar.innerhtml="status: checking"; }

ios - Issue with frame size of UIView -

i'm working on ipad project, it's on landscape view. , tried doing: self.view.frame.size.height why returning 960? while in landscape height dimension of view should 768 right? what trying allocinitwithframe uitoolbar located @ bottom. uitoolbar has height of 50, here's did failed: self.bottom_bar = [[uitoolbar alloc] initwithframe:cgrectmake(0, self.frame.size.height-50, self.view.frame.size.width, 50)]; why , how do this? two postings ( one , two ) referenced similar problem. both suggest using self.view.bounds instead of self.view.frame.size.width because bounds change along interface orientation.

layout - qt get scrollview position -

i have qgraphicsview inside horizontal layout. qgraphicsscene contained in qgraphics scene pretty large (thousands of pixels), scroll bars show default allow me scroll through view. every time update scene inside graphics scene, delete old scene, make new one, populate objects, , call view->setscene(scene). when this, however, scroll bars default top left corner of qgraphicsview, instead of staying at. i tried saving qgraphicsscene::scenerect before destroying scene, doing setscenerect() afterwards restore it, doesn't work since affects scene itself, not qgraphicsview that's displaying it. tried view->verticalscrollbar()->setvalue(), doesn't appear affect scroll bars @ all. how can access scroll bars created me default, , set them value stored earlier? fixed not deleting previous scene until after new 1 set. e.g. qgraphicsscene *previousscene = scene; scene = new qgraphicsscene(0, 0, levelplist.value("level_width").toint(), level

android - How to deal with more than one SD card slot -

in app, store user's app data using mysqlite databases, , allow user backup app data sd card within folder create on sd card (let's call myappfolder). on android devices have single sd card slot, works fine (e.g. droid). however, on devices such galaxy s have more 1 sd card, things don't work. unfortunately, don't have 1 of these devices, can't debug anything, can go user reports. did searching , found known issue. however, did not find solutions didn't involve hardcoding other paths used, i'm looking that. in app, check , see if myappfolder exists. if not, create folder. folder created successfully, although created on "internal" memory slot returned getexternalstoragedirectory() when there 2 slots present. however, files not created , copied there. don't understand why folder created, files not created. can tell me how can modify code work devices 2 card slots 1 card slot? i'd prefer not hard-code locations check, if that's

javascript - Is there a way to call just a certain part of a website into an iframe? -

i want use iframe target specific part of webpage, , show part of webpage (not whole page). issue is, can use html, javascript, , css. there anyways might able this? what i'm trying shoutbox: http://tech-revolution.com/forum/vbshout.php?do=detach&instanceid=1 display in iframe on page, want shoutbox, not rest of page. if dont mind calling whole page can manipulate div make happening. following code worked me: <div style="overflow:hidden; width:608px; height:270px;"> <iframe scrolling="no" frameborder="0" src="http://tech-revolution.com/forum/vbshout.php?do=detach&instanceid=1#dbtech_shoutbox1" style="width:728px; height:270px; border:none; margin-left:-60px;"/> </div> but perhaps should check component's authors see if there's way render way want on server , you'll need frame different url.

c# - Generic class definition with both generic type constraint and inherited type? -

i wondering if possible have both generic type constraint , inherited type? i not figure syntax out myself or think of possible example at. code example: public class test<t> t : itest, new() : ibasetest { } is possible achieve class definition this? public class test<t> : ibasetest t : itest, new() { } your class implement interface ibasetest , , generic parameter t constrained types implementing interface itest , having default (parameterless) constructor. is meant?

java - Can't receive data remotely from one computer -

so wrote jar interacts database , serves server. problem can interact jar when i'm on lan or run jar different computer. system problem running windows xp firewall disabled , yes correctly set router can launch web server , view remotely. have no clue problem firewall disabled , jar works on other computers on same network. note: noticing exception "java.net.socketexception: address family not supported protocol family" earlier 1.open network connections 2.right-click local area connection, , click properties. 3.click install. 4.in select network component type dialog box, click protocol, , click add. 5.in select network protocol dialog box, click microsoft tcp/ip version 6, , click ok 6.click close save changes network connection. lastly restart application

ruby on rails - Does minimizing json document size increase performance on elastic search? -

i considering using elastic search primary database. thing holding me understanding whether or not json document size slows down elastic search. example, if index json documents 100 fields rather 3 fields need search (and querying sql db other data), elastic search slower? is concern reason not use elastic search primary data storage? keep backup in traditional database can rebuild index plan query elastic search. sound idea? indexing fields in json doc won't slow down elasticsearch, make indexes bigger. if disk space or ram limited, perhaps want index 3 relevant fields. you can still store whole doc in elasticsearch (and set _source field compressed) disable indexing of irrelevant fields setting them "index": "no". however if capacity isn't problem, why not let elasticsearch thing? you'll find there other relevant fields hadn't considered, , quite you'll end using es queries db handle because (a) it's damn fast , (b) comes

json - How do you assert a String in Capybara? -

i testing api call server using cucumber + capybara selenium webdriver. managed response obj, how assert response body contains string? example if response body contains "hello world" want assert response body (which string) contains pattern "world" ex. like: response = http.request(request) response.body.should have_text("world") alternatively there way "application/json" response , assert contents using capybara? thanks! i think looking have_content . response.body.should have_content("world") for more info, check out readme: check out documentation: https://github.com/jnicklas/capybara

objective c - Read two tables from database in sqlite in one grouped table view -

i have equations list in app , want have grouped table view load 1 table sqlite database first section of table view , load table sqlite second section of table view. ok know how create , read database app delegate , sqlite tables 2 arrays hold content. know how load 1 table sqlite table view in xcode, still have few questions. how set rows in database sections of table view? possible load multiple tables databse 1 grouped table view? i new iphone development, upto knowledge can not have multiple tables in 1 grouped table view. you can use if conditions or switch cases application decide sections , rows. as m giving example of if condition request type integer. - (nsinteger)numberofsectionsintableview:(uitableview *)tableview { // return number of sections. if(requesttype == 2) { return [arraycitynames count]; }else { return 1; } return 1; } (nsinteger)tableview:(uitableview *)tableview numberofrowsinsection:(nsinteger)section { // return numbe

java - While constructing the default constructor can not handle exception : type Exception thrown by implicit super constructor -

the code works fine until try make code constructable class. when attempt construct object error "default constructor cannot handle exception type ioexception thrown implicit super constructor. must define explicit constructor" this when having throw exceptions filereader , bufferedreader . thanks edit: filereader textfilethree = new filereader (xfile); bufferedreader bufferedtextthree = new bufferedreader (textfilethree) ; string linethree = bufferedtextthree.readline(); the xfile gotten construction. note within construction exceptions thrown. default constructor implicitly invokes super constructor assumed throwing exception need handle in sub class's constructor . detailed answer post code class base{ public base() throw someexception{ //some code } } class child extends base{ public child(){ //here implicitly invokes `base()`, handle here } }

Test Facebook App from Localhost -

can use localhost test facebook app. have tried following, comes no result. i have tried changing windows host file under(path : c:/windows/system32/drivers/etc/), , changing httpd-vhosts.conf find(path : xampp/apache/conf/extra/). i have changed localhost local.sitename i.e http://local.sitename/ using above. secondly, tried use following code $ch = curl_init(); curl_setopt($ch, curlopt_ssl_verifypeer, false); curl_setopt($ch, curlopt_ssl_verifyhost, 2); to stop ssl verification. thirdly, tried put http://localhost:9000/ call url in facebook app. but getting same error: ssl certificate problem. verify ca cert ok. details: error:14090086:ssl routines:ssl3_get_server_certificate:certificate verify failed can please help, think localhost problem testing facebook app, , note working in cloud environment. could please me testing facebook app on localhost! thanks in advance. if check facebook graph api register app, show kind of url (domain) accep

winapi - Is there any way to hook whole drawing functions for a process under windows? -

i want capture window displays. on other hand, nice if window doesn't display nothing on screen. how? process call drawing functions, function hook , draw somewhere else (for example bitmap file) , return without drawing on screen. what know is, in windows nt architecture, every thread has system call table , can change system call table of single thread (or set in beginning) functions. changing drawing api (gdi?) (i not sure how survive if application uses directx rendering maybe there way) feel can it. can i? should if application uses directx rendering? thanks in advance, ali veli i ended hooking createdc-like functions, made creating memory device context , letting other functions draw on memory dc.

asp.net mvc 3 - mvc3 labelfor subobject -

i have 2 classes : public class foo{ [display(name="here bar")] public bar mybar; [display(name="here name")] public string myname; } public class bar{ ... } i have view "choosebar.cshtml" typed of foo. if put @html.labelfor(model => model.myname) -> see "here name" in label. but, if put @html.labelfor(model => model.mybar) -> see "mybar", not expected "here bar" how can use labelfor subobject ?(i.e displaying "here bar" instead of "mybar" in label) thanks answer. you decorate bar 's property want render attribute: public class bar { [display(name="here bar")] public string barname { get; set; } } and use custom editor template: bar.cshtml @html.labelfor(model => model.barname) choosebar.cshtml @html.editorfor(model => model.bar) could way, use editor/display templates when want render sub-model.

gwt - java.sql.SQLException: URL is not in the correct format -

i using tomcat, java gwt. when try connect db applcation spews following error. same driver information running on stand alone application. java.sql.sqlexception: url not in correct format: jdbc:timesten:client:dsn=xxxx_cachedb_devc;uid=xxxx;pwd=xxxxx @ com.google.cloud.sql.jdbc.internal.exceptions.driverurlnotincorrectformat(exceptions.java:103) @ com.google.cloud.sql.jdbc.driver.connect(driver.java:47) @ com.google.cloud.sql.jdbc.driver.connect(driver.java:24) @ java.sql.drivermanager.getconnection(drivermanager.java:582) @ java.sql.drivermanager.getconnection(drivermanager.java:207) may know how can on come problem. looks either trying deploy app engine or somehow how appengine jars in runtime classpath. if not planning deploy application @ google app engine, remove app engine sdk jars project. on other hand, if want deploy app engine, know gae not yet support connecting external databases. can use in

c++ - Specialization of templated member function in templated class -

i have templated class templated member function template<class t> class { public: template<class ct> ct function(); }; now want specialize templated member function in 2 ways. first having same type class: template<class t> template<> // line gcc gives error for, see below t a<t>::function<t>() { return (t)0.0; } second type bool: template<class t> template<> bool a<t>::function<bool>() { return false; } here how trying test it: int main() { a<double> a; bool b = a.function<bool>(); double d = a.function<double>(); } now gcc gives me line marked above: error: invalid explicit specialization before ‘>’ token error: enclosing class templates not explicitly specialize so gcc telling me, have specialize a, if want specialize function, right? not want that, want type of outer class open ... is final answer: not possible? or there way? yes, problem

how to get files count in a directory using ruby -

using ruby how number of files in given directory,the file count should include count recursive directories. eg: folder1(2 files) -----> folder2(4 files) , folder2 inside folder1. total count above case should 6 files. is there function in ruby fetch me count. the fastest way should (not including directories in count): dir.glob(file.join(your_directory_as_variable_or_string, '**', '*')).select { |file| file.file?(file) }.count and shorter: dir = '~/documents' dir[file.join(dir, '**', '*')].count { |file| file.file?(file) }

java - Checking the type of a web proxy -

how determine whether web proxy ip of type http or socks4/5 java? thank you. as mentioned in comments other answer, if know ip address of proxy server , want detect type is, try each proxy type in java until 1 works. import java.io.ioexception; import java.net.inetsocketaddress; import java.net.proxy; import java.net.socketexception; import java.net.url; import java.net.urlconnection; import java.util.arrays; import java.util.list; public class proxytest { public static void main(string... args) throws ioexception { inetsocketaddress proxyaddress = new inetsocketaddress("myproxyaddress", 1234); proxy.type proxytype = detectproxytype(proxyaddress); system.out.println(proxyaddress + " " + proxytype + " proxy."); } public static proxy.type detectproxytype(inetsocketaddress proxyaddress) throws ioexception { url url = new url("http://www.google.com"); list<proxy

html - How to make TD behaving like TR(row) with CSS? -

i have component create dynamically html table. according need, need show td tags line line block element not column. how using css ? thanks in advance, you can applying display: block td s: http://jsfiddle.net/wya9k/ that works in modern browsers except ie9.. using float: left; width: 100% instead makes work in ie8/9: http://jsfiddle.net/gvpzh/ nothing make work in ie7.

Android 3d layout rotation animation -

i need have 3d rotating animation when start new activity. should me looks this here use 2 image views. need have animation between 2 layouts. thanks in advance ! refer this https://github.com/deesaster/dsdroid

ios - Possible causes of callback function when using audio queue not getting called. edit: NVM figured it out -

really i'm @ lost here. i have setting correctly knowledge - if messed of values there callback should still invoked. my calling code if cares - called button action: [self audiodataformatsetup:&anaqdata]; nslog(@"buffer size %lu, packets %lu", anaqdata.bufferbytesize, anaqdata.mnumpacketstoread); anaqdata.misrunning = true; audioqueuenewoutput ( &anaqdata.mdataformat, handleoutputbuffer, &anaqdata, cfrunloopgetcurrent(), kcfrunloopcommonmodes, 0, &anaqdata.mqueue ); //buffers here anaqdata.mcurrentpacket = 0; (int = 0; < knumberbuffers; ++i) { audioqueueallocatebuffer (

php - Way to show user's news feed? -

i'm having idea of mixing lot of social networks one. user log social networks they're in throught api , see every new every network. is possible take data user's new feeds can build same news feeds on external page? i'm asking facebook right now you can use graph api user's news feed. need get access token , request of: https://graph.facebook.com/me/home?access_token=your_access_token you'll json response of user's news feed. check out fast, go graph api documentation , search page first occurrence of "news feed" , click link see own news feed delivered via graph api. might find graph explorer tool handy you're getting started.

spring security - How to restrict the method to be accessed to a specific role? -

a qestion spring security, there way can define names of methods , restrict accessing method depending on role of user. far know, can using pointcut or annotation secure method users have example specifc role question how can instesd restrict roles access method, restrict methods accessed specific role. hope clear

RabbitMQ with Websocket and Gevent -

i'm looking forward develop realtime api web application using websocket. i'm using rabbitmq broker , backend based on python (gevent + websocket),and pika/puka rabbitmq client. the problem i'm facing here that, how can use websocket connect rabbitmq. after initial websocket connection establishment, socket object wait new messages client, , in case of rabbitmq, need setup consumer it, process message when receive one. can take in way, clients established connection server via full-duplex websocket. all clients should act rabbitmq's consumer after initial websocket handshake, updates when client gets message. when new message arrives @ websocket, client send rabbitmq, @ time client act publisher. the problem websocket wait new message, , rabbitmq consumer wait new message on channel, i'm failed link these 2 cases. i'm not sure whether wrong method ... i'm unable find method implement scenario.if i'm going wrong way or there alternate m

javascript - Event fire in firefox -

i using piece of code in javascript as: if (td_sel.addeventlistener) { //alert('event listener'); td_sel.addeventlistener("click" , function() { deleterow(selected_val) }, false); } where td_sel td element created dynamically. this not working in firefox. suggestions? everything looks fine. thing maybe deleterow function in other scope posted code.

c# - Compare two XML Files and show differences b/w them and Update file -

i want compare 2 xml files , show difference between them , update file. kindly suggest me tricks or tutorial. i found javascript library compare @ client side jsdifflib

c# - Create a report from word or pdf documents -

my goal create report in wpf using dev express. want add word or pdf documents report. for word documents, opening word document richeditcontrol, saving memory stream rtf document , using xrrichtext control, adding rtf document report. public void createreport() { richeditcontrol richedit = new richeditcontrol(); memorystream stream = new memorystream(); xrrichtext rtfdoc = new xrrichtext(); richedit.loaddocument(@"word document path", documentformat.openxml); richedit.savedocument(stream, devexpress.xtrarichedit.documentformat.rtf); rtfdoc.loadfile(stream, xrrichtextstreamtype.rtftext); rtfdoc.widthf = 550f; this.detail.controls.add(rtfdoc); this.requestparameters = false; this.createdocument(); } is recommended way add word document rtf? , also, instead of word document, how can add pdf document report? thank you! check xtrarichedit - document server (available in v2011, volume 1) blog post, may helpful.

Jquery disable droppable but keep draggable enabled -

as activity students, have set of draggables need matched set of droppables. code below works fine (for example allows student change selection) allows student put 2 draggables on 1 droppable. $('.drags').draggable({containment:'#container', revert:function (event, ui) { $(this).data("draggable").originalposition = {top: 0,left: 0 }; return !event;}}); $('.drops').droppable({accept:'.drags', drop:function(event, ui){ ui.draggable.position( { of: $(this), my: 'left top', at: 'left top'} );},}); if disable droppable, including following code in 'drop' function $(this).droppable({ disabled: true }); then draggable disabled not w

Relational databases/SQL: What are typical use cases for one-to-one parent-child (non-inheritance, tree-like to self/super table) relationships? -

possible duplicate: when need use 1-to-1 relationship in database design? relational databases/sql: typical use cases one-to-one parent-child (non-inheritance, tree-like self/super table) relationships? of course, implement/become parent-child list instead of tree (assuming regular one-to-many). think sports leagues, see http://en.wikipedia.org/wiki/english_football_league_system : english premier league (soccer) of same type league (single) child, football league championship . @ lower point can see children "split" conference north , conference south . can modeled many-to-one relationship league league , resulting in regular tree. if changed described many-to-one parent-child relationship one-to-one, list instead of tree, top part of english soccer leagues. i'm asking for. consequence children of node become child or next element (because of fact list now). i wonder when regularly need list structure in relational databases, given are t

c# - Selecting only a few columns from a table -

i had problems using c#, nhibernate , link. in example bellow, select in brandtable, need "name" , "id" columns. select columns of table. using entityframework, same code bellow generates select 2 columns. how in nhibernate? using (isession session = myconnection.getcurrentsession()) { var brands = b in session.queryover<brandtable>().list() orderby b.name select new brand {id = b.id, name = b.name}; return brands.tolist(); } you can't use query comprehensions queryover, because not linq provider. in example you're selecting records, , using linq objects. add nhibernate.linq namespace file , rewrite query from b in session.query<brandtable>() orderby b.name select new brand {id = b.id, name = b.name};

assembly - What is faster: JMP or string of NOPs? -

i'm implementing binary translation , have deal sequences of nops (0x90) length 16 opcodes. better performance place jmp (to end) @ start of such sequences? the intel architecture software developer's guide, volume 2b (instructions n-z) contains following table (pg 4-12) nop : table 4-9. recommended multi-byte sequence of nop instruction length assembly byte sequence ================================================================================= 2 bytes 66 nop 66 90h 3 bytes nop dword ptr [eax] 0f 1f 00h 4 bytes nop dword ptr [eax + 00h] 0f 1f 40 00h 5 bytes nop dword ptr [eax + eax*1 + 00h] 0f 1f 44 00 00h 6 bytes 66 nop dword ptr [eax + eax*1 + 00h] 66 0f 1f 44 00 00h 7 bytes nop dword ptr [eax + 00000000h] 0f 1f 80 00 00 00 00h 8 bytes nop dword ptr [eax + eax*1 + 00000000h] 0f 1f 84 00 00 00 00 00h 9

c# - Regarding OOPS & Private class -

if class private , constructor public happen. can create instance of class or other class can extend? need know why , when people create private class public ctor? the code like private class lazyresource { somebigresource _heavyobject = null; public somebigresource lazyload { { if (_heavyobject == null) _heavyobject = new somebigresource(); return _heavyobject; } } } plzz guide me thanks you can't create non-nested private class in c#. this nested class, in case containing type can instantiate instance of it. , if lazyresource had private constructor nothing able instantiate (except static member of lazyresource itself).

html - CSS Stacked divs -

i have divs floating left, if see attached jsfiddle see im trying do, in fiddle there yellow box, need flush bottom of green box im not sure if possible? is it? , if how may this? in advance! http://jsfiddle.net/k5zjc/ try this jsfiddle . techincally, float .box items right instead of left , getting self-filling columns in accordance content. so, in css add: .box:nth-child(odd) {clear: left} .box:nth-child(even) {float: right; clear: right} update apparently solution doesn't work nice if have more these specific blocks. so, probably, jquery masonry way result.

What is the order of execution of code in Javascript? -

how code in javascript executed? mean in order? there difference in order of execution if declared function this: function render() { // code here } instead of this: var render = new function(){ // same code here } does javascript execute functions defined in scripting file regardless of whether they're called event handler? (e.g. onload=function() ). and if function defined in function, when parent function called, lower function called too? e.g. function a(){ function b(){ // code } function c(){ //code } } i'm trying concrete understanding of order of execution in javascript. var render = new function(){ // same code here } the new keyword doesn't create new function. creates new object running function. run body of method , return object instead. if asking when functions parsed , added scope that's implementation specific, functions hoisted top of scope , parsed before code executed.

objective c - Dot syntax & synthesize -

i wondering if synthesize has sort of support dot syntax. goal here learn more - realize can achieve goal defining getter myself. have been looking info on topic without success far. example of want do: @synthesize name = self.someobject.name; which, getter, along lines of: -(nsstring*)name { return self.someobject.name; } no, can't this. value after = in @synthesize must reference ivar of current class. you're free implement above getter you've noted, @synthesize won't it.

objective c - UITextfield Exit -

i've problem textfield in custom cell. created editingdidend function open new view tableview different possiblities choose textfield. par example: write mister in field view shows names mister... then click on user wish, view closing. problem now, textfield stay in edit mode. how can exit edit mode? , if click on done on keyboard, procedure restarts.... thank answers. i believe looking [textfield resignfirstresponder] . end text field editing, , dismiss keyboard.

scala - Extracting element names and property values from XML -

Image
i’m relatively new working scala having come java background. i’m seeking advice on creating efficient s means of reading xml file , extracting element names , properties contained within data enclosed between parentheses. for example < name >{property}< name/ > so key there data contained within {} i want populate hash map actual element names , property values contained between {} . i’m sure not overly complex given limited scala expertise @ time i’d bounce question off expertise within forum. many taking time answer. [updated] realized you've asked braces in text, not xml-related syntax braces. possible answer is: scala> val xml = <a> <prop>{{key1}}</prop> <prop>{{key2}}</prop> <prop>notkey</prop> </a> xml: scala.xml.elem = <a><prop>{key1}</prop><prop>{key2}</prop><prop>notkey<