Posts

Showing posts from September, 2012

ms access - mysqlimport - issue with spaces in table name -

dealing incompetent database design here. moving app ms access mysql , moment important preserve table names. access db creator has spaces in table names... i tried doing import soft quotes, hard quotes, backticks, , no quotes give "check manual corresponds mysql server version right syntax use near 'citation table' @ line 1, when using table: chain citation table" i saw can escape spaces in commands eg rm chain\ citation\ table.txt same error that. here example: mysqlimport --host=mysql.myhost.com --user=dbuser -p \ --local --delete \ --fields-optionally-enclosed-by='|' \ --fields-terminated-by=';' \ --lines-terminated-by='\n' \ dbname "chain citation table.txt" what right way handle messed situation? have make holding table named somethingwithoutspaces , import , copy across? thanks advice. you try using access mysql converter , has worked me in past.

c# - listview: getting subitem text -

i have listview following columns id, surname, firstname. want surname when row selected how do using visual c# 2008? subscribing selectedindexchanged listview1: listview1.selecteditems[0].subitems[1].text you have tons of microsoft documentation it.. http://msdn.microsoft.com/en-us/library/system.windows.forms.listviewitem.listviewsubitem.aspx

sql server - If one table (A) relates to another (B), which relates to another (C), can I write a query to get table out of A from a join between B and C? -

Image
i have 3-table schema. 2 of tables (trade/portfolio) have 1:1 relationship, fk on 1 of these tables has unique constraint. the table, explained above, fk (which portfolio) relates third table. third table (price) displaying historical information portfolio (there can many prices portfolio on time-period), there's bog-standard 1:m relationship. however, need various prices portfolio. that's easy query works on portfolio id. however, feasible way price of single trade? there limitation in design prevent this? apologies long title, not find better way explain issue! thanks by description guess data model. fk tradeid unique in portfolio. and wonder if possible rows price related trade. here query give rows price tradeid 1. select price.* portfolio inner join price on portfolio.portfolioid = price.portfolioid portfolio.tradeid = 1 i see nothing in design prevent fetching rows price given tradeid.

For-loop Local Variables in C -

why following code output same memory location everytime? int x; (x = 0; x < 10; x++) { int y = 10; printf("%p\n", &y); } i thought memory location should change each time for-loop run, variable new. yes, absolutely right memory location could change. doesn't have :). in each iteration old variable "destroyed" , new 1 "created" @ same place. although decent compiler optimize unnecessary "actions" away

c# - Extension method for generic interface does not show on subclasses -

i trying implement extension method initialize moq repositories mvc3 application. have repository interface: public interface irepository<tentity> : idisposable tentity : class { //methods } i have several classes such userrepository implement interface: public interface iuserrepository : irepository<user> { //specific methods user repository } public class userrepository : efrepositorybase<user>, iuserrepository { } efrepositorybase repository base class providing general methods repository. in unit tests create extension method each type of repository retrieve mock repository. tried adding extension method this: public static class repositoryhelpers { public static mock<irepository<t>> getmockrepository<t>(this irepository<t> repository, params t[] items) t : class { mock<irepository<t>> mock = new mock<irepository<t>>(); mock.setup(m => m.getall()).returns(items.asquery...

asp.net - HTTP Modules - Safe to remove Remove -

i have following http module define inside web.config file of asp.net application. <httpmodules> <add name="urlrewriter" type="intelligencia.urlrewriter.rewriterhttpmodule, intelligencia.urlrewriter"/> <remove name="windowsauthentication"/> <remove name="passportauthentication"/> <remove name="anonymousidentification"/> <remove name="urlauthorization"/> <remove name="fileauthorization"/> </httpmodules> which of these httpmodules safe remove , of them not safe remove?

objective c - How do you convert an NSUInteger into an NSString? -

how convert nsuinteger nsstring ? i've tried nsstring returned 0 time. nsuinteger namescategoriesnsarraycount = [self.namescategoriesnsarray count]; nslog(@"--- %d", namescategoriesnsarraycount); [namescategoriesnsarraycountstring settext:[nsstring stringwithformat:@"%d", namescategoriesnsarraycount]]; nslog(@"=== %d", namescategoriesnsarraycountstring); when compiling support arm64 , won't generate warning: [nsstring stringwithformat:@"%lu", (unsigned long)mynsuinteger];

red5 - Solution for handling Spring security session Id in different wed apps -

i have 2 web application on different wed servers: core (spring 3.0.5, spring security 3.0.5, postgresql) , red5 i need develop next workflow: user logins in core system returns web page simple html , flex app user streams audio on red5 flex app red5 uses core check if user logged in red5 sends file core core identifies file come appropriate user core stores file in related user's folder i have configured spring security @ core, flex client streams audio red5, servlet on red5 stores audio in flv file , have access file. my idea is: in case of successful login core returns sessionid at end of recording flex app sends sessionid red5 server red5: makes http request sessionid core core returns "true" in case of user logged in red5: makes http post request 2 parameters: file , sessionid core identifies user , stores file in user's folder please provide mechanism how sessionid, how check if user logged in , how user sessionid or better approac...

wpf - how to add effect for text box to style -

i'm trying add effect style in order reuse it, reason doesnt work... <style x:key="numerictextboxstyle" targettype="{x:type textbox}"> <style.resources> <textbox.effect x:key="effectstyle"> <dropshadoweffect blurradius="56" direction="392" color="#ff872e2e" renderingbias="quality"/> </textbox.effect> </style.resources> <setter property="height" value="25"/> <setter property="width" value="120"/> <setter property="horizontalalignment" value="right"/> <setter property="verticalalignment" value="top"/> <setter property="textalignment" value="center"/> </style> but how add style part ? (also ho...

javascript - Call a function on DOM ready from outside <head>? -

in jquery can wrap code in $(function() { ... }); , have fire when dom ready, if want put in middle of page somewhere? isn't possible dom ready event fire before processes chunk of code , it'll missed? there way guarantee it'll fired? you can place <script>..</script> block anywhere in code: if use .ready() (or equivalent syntax ) execute code when dom loaded, executed when whole page loaded, no matter placed ready() handler. if put code within <script> tags, executed whenever parser reaches point of code.

python - How to check the performance of a django application? -

i have created django app. want test application's performance 5000 data. there method ? there method randomly enter data db , run application ? believe there should method rather typing 5000 data manually db. database use mysql. quite new python , django, please me solve . in advance. pycheesecake.org provides source of testing tools python. you might want checkout django-autofixture , nice tool inserting randomly generated data database, , django-mockups , fork django-autofixture. here sample usage of django-autofixture: django-admin.py loadtestdata [options] app.model:# [app.model:# ...] you supply app name, model , number of objects want create.

Is there a shortcut to 'Close Project' in eclipse? -

Image
if frequent ritual, becomes ordeal right click on project/s , select close project everytime. there nothing defined default can define own binding from window > preferences > general > keys

android - phone to phone...unlimited SMS? -

i have idea app requires lot of data exchange between users of app. sms seems simple way done, safe assume smart phone users have unlimited sms? otherwise app won't popular due expensive rates sms. if bad assumption, can tell me other means should consider accomplish phone phone communication? had hoped alternative used data service instead of sms. have read many (so many) forum posts sort of thing , have read nothing conclusive. a bit app's requirements: users build network of 'friends' coordinating among them. when 1 user creates event on device, users in network should notified. user's can instant message other users on network so, need mechanism getting of done. after reading bunch of tutorials, can see how using sms, not sure if that's idea. people have said sort of job require central server, i'm not quite sure how work. not opposed solution involves server, need me started in right direction. thanks in advance. number of sms...

LINQ to XML: Getting child values of elements -

well, 1 xml file <?xml version="1.0" encoding="utf-8"?> <config> <setup> <test>10</test> <copy> <descr>aa</descr> <descr>bb</descr> </copy> </setup> </config> and 1 linq query :( dim query = q in xelement.load("\myxml.xml").elements("setup") _ q.element("test").value = "somevalue" _ select new {.test = q.element("test").value, _ .copydescr = q.element("copy/descr").value} unfortunately, one, produces following straight-forward error. the '/' character, hexadecimal value 0x2f, cannot included in name. so question is, how can child values contained in <description> too, without getting error? see love load values contained in copydescr list of(string) later usage... thanks in advance! you can use xpath: q....

asp.net - How to set up Firefox and Internet explorer when I use them to debug my html pages on local host? -

i'm creating web pages using asp.net mvc (vs ide, c# language). when want see real design of page displayed user run using asp.net development server on localhost , display page in ie , firefox. both ie , firefox driving crazy... have swiched off caching on both of them still keep displaying old versions of web page. suspect not cache html stil cache css file. got old versions , i'm trying find bug in code not there. what can make them display current page ? without caching anything? stop asp.net web development server system tray , again start debugging application

rest - ClassNotFound Exception when configuring RestEasy -

i'm having trouble while configuring resteasy jboss 5.1ga. have done installation manual says do, downloaded resteasy zip, copied jars inside lib folder war , configured web.xml this: <listener> <listener-class> org.jboss.resteasy.plugins.server.servlet.resteasybootstrap </listener-class> </listener> <servlet> <servlet-name>resteasy</servlet-name> <servlet-class> org.jboss.resteasy.plugins.server.servlet.httpservletdispatcher </servlet-class> <init-param> <param-name>javax.ws.rs.application</param-name> <param-value>com.base.baseapplication</param-value> </init-param> my application class looks this: public class baseapplication { private set<object> singletons = new hashset(); private set<class<?>> empty = new hashset(); public baseapplication() { // add restful resources here singletons.add(new quoteresource()); } public set<class<?>> ge...

asp.net - Google Panda search algorithm -

what google panda search algorithm , how implement in asp.net site? i search on google lots there no such kind of information found. can give me example related this... the panda search algorithm google efforts weed low quality content out of index (or @ least devalue not rank well). google's response sites ehow.com throw large volume of low quality content in effort game search engines , make ad revenue traffic get. so, can see, isn't can integrate site. should use existence reason why should publish high quality content.

tcp - Android: Is it possible to connect to a server without configuring router's NAT? -

i'm trying find way establish tcp connection (socket) between android device , server without having setup server's router nat. android device -> internet -> router (with fixed external ip address) -> server (with fixed lan ip address) something like: " connect 200.111.222.333 (with local address 192.168.1.1) on port 5000 ". you have use turn or stun or other intermediate connectivity solution, in general isn't possible declaratively specify internal target behind nat device generic tcp connection on platform (not android).

python - Why is an instance of webapp.WSGIApplication always defined as a global variable in google app engine code? -

i'm starting learn use google app engine and, in of code i've come across, declare instance of webapp.wsgiapplication global variable. doesn't seem necessary, code works fine when locally declared in main function. advised global variables should avoided. there good, or not good, reason it's done way? example: class guestbook(webapp.requesthandler): def post(self): greeting = greeting() if users.get_current_user(): greeting.author = users.get_current_user() greeting.content = self.request.get('content') greeting.put() self.redirect('/') application = webapp.wsgiapplication([ ('/', mainpage), ('/sign', guestbook)], debug=true) def main(): wsgiref.handlers.cgihandler().run(application) why not following, works: class guestbook(webapp.requesthandler): def post(self): greeting = greeting() if users.get_current_user(): greeting.author = users.get_current_user() greeting.co...

java - What are some good Statistic Visualization frameworks/libraries for user data? -

we've been collecting user data on our site while , we'd present data in accessible way. we have database full of data, we're looking framework can dump our data , able visualize it. some requirements: must able sort & filter multiple dimensions (eg: user, action type, date, meta data) must able export views of data csv/xml files must presented through web interface (no desktop applications) should usable either scala, java, python or ruby we've looked @ using vaadin, , enjoy amount of control can have, i'd explore other potential solutions. are there suggestions frameworks might display our statistics? i'm having lot of joy working google visualisations , java library google provides. wrote adaptor - in scala - work luciddb, db adaptor supplied default mysql only. the motion chart in particular thing of great beauty. update lucid great way deal masses of data, happily working sizes in excess of 1tb. it's column-oriented...

c++ - Make g++ warn on uninitialized POD member variable -

is there way print warning if forget declare in ctor initialization list member pod? i'm looking through docs , can't find anything. g++-4.4 here. you can enable -weffc++ heap of ridiculous warnings, including every single non-ctor-initialized member. to check actual ub, use valgrind.

java - Transferring files from Client to Server using TCP -

hello i'm doing school project , need make tcp server/client transfer files client server using tcp protocol. i know how make tcp server , client sending messages , objects. what need is: the user selects file predefined directory then can type send-file.ext send file server server needs to get file client save file in predefined directory how go this? if fetch file users hard drive, how make file bytes , send server. how server know file , save file original name? thanx the first thing need define protocol. example... each connection server should represent single file. after connection occurs, client should pass file name first line. the client should pass size of file (in bytes) second line. the client should send contents of file. finally, connection should shut down. now, have coding client. can read contents of file using fileinputstream . then, send meta data plus contents on socket using outputbuffer on socket. finall...

c# - Castle Windsor - Register all interfaces with factory method -

i have number of interfaces: ifirstprovider isecondprovider ithirdprovider etc.. i'm trying register these interfaces use factory method instance: container.register ( alltypes .fromthisassembly() .where(t => t.isinterface && t.name.endswith("provider")) .configure(c => c.usingfactorymethod(f => f.resolve<dictionaryadapterfactory>().getadapter<object>(c.servicetype, session)) ); but doesn't seem work. instead, have use for loop register these interfaces: list<type> providers = new list<type> ( assembly .getexecutingassembly() .gettypes() .where(x => x.isinterface && x.name.endswith("provider")) ); foreach (type provider in providers) { type temp = provider; container.register ( component .for(temp) .usingfactorymethod(f =...

javascript - Is there a way to bind a handler to browser history back button? -

this question has answer here: detect button click in browser [duplicate] 6 answers for example user came page example.com/home.html page example.com/checkout.html . wonder if there way assign history example.com/new_offers.html ? so, when clicking browser button, instead of going home.html user redirected new_offers.html i know may sound awkward, it's example , thing need bit different. also, need using javascript (nothing server-side). upd: figured out it'd clearer ask whether it's possible bind handler browser button (jquery): $(browser.backbutton).click(function(e){ ... }) instead of going checkout page home page, can go new_offers , checks variable checked_out . if checked_out false, redirect user checkout passing along form information. if checked_out true, display new_offers page. checked_out set true @ checkout page. i...

java - Android HTC Hero not reporting back correct FeatureInfo -

i'm having strange problem htc hero 2.1 model=hero200 manufacturer=htc apilevel=7 it not reporting has hardware microphone . here code check features. public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.main); context context = this; packagemanager pm = context.getpackagemanager(); featureinfo[] foo = pm.getsystemavailablefeatures(); (featureinfo bar : foo) { if (bar.name != null) { system.out.println(bar.tostring()); if (bar.name.equalsignorecase("android.hardware.microphone")) system.out.println("booyah!"); } } } it report these features: android.hardware.camera android.hardware.wifi android.hardware.location.network android.hardware.bluetooth android.hardware.sensor.light android.hardware.location android.hardware.location.gps android.hardware.camera.autofocus android.hardware.touchscreen.multitouc...

java - How to set "SQL_NO_CACHE" default in a pooled mysql JDBC connection -

our mysql server has "sql_no_cache" off default, , wish off application. can rewrite sql statements sound stupid. according mysql docs per connection default can configure following command. set session query_cache_type = off; i wish statement issues each new connect created datasource. however, don't find configurable properties in connector/j jdbc driver. dbcp's connectioninitsqls seem 1 of option, using 1.2.2 reason. , may want remove dependency of dbcp (less more).

automatically select option if only one in selectbox list - JQuery -

i using this way filter select box. want extend if there 1 option left automatically selected. can me this? if ($j('#selectlist option:visible').length == 1) { $j('#selectlist option:visible').attr('selected', true); }

javascript - Dynamically create js function -

i want dynamically (in loop) bind function .click() event of several divs. click function should hide clicked div. way trying it, lost reference div, , "this." not working me too. here function want bind: function do_hide() { is_anim = true; $(this).animate({ opacity: 0.25, height: 'toggle', width: 'toggle' }, 5000, function() { is_anim = false; this.hide(); }); } thx help. edit: solution of ghayes do_hide() called here: for (var = 0; < n; i++) { p[i] = $("#btn"+(i+1)); p[i].click(function() { do_hide.call(this); }); } you can bind scope 'do_hide' when call it. suggest pattern following: (working jsfiddle ) $('.stackoverflow').click(function() { do_hide.call(this); }); var do_hide = function() { is_anim = true; $(this).animate({ opacity: 0.25, height: 'toggle', width: 'toggle' }, ...

javascript - jQuery clone() problem -

i using jquery clone form input field when user click on add button goes fine, have problem if write in form input field , click add button, jquery copy text new cloned input element also. you can try demo: http://jsbin.com/ikebil/2/edit steps: open link , click render type in input field click on add button create new input field copy text written in previous one. original code: http://charlie.griefer.com/blog/2009/09/17/jquery-dynamically-adding-form-elements/ so need remove text comes if written in previous element. the best solution make copy of element before it's being populated data, , use "safe" copy , clone it. it's faster , safer => see working example

python - 2D mutable iterator/generator -

i have nxn matrix want split non-overlap kxk block. each block, want assign new values elements. since looks place generator, implemented: def extracted_patches(im, top_left, patch_size, grid_size): '''extract patches in row-major order following specific configuration parameters ---------- im : input image (2d numpy array) top_left : (y,x) coordinate of top left point (e.g. (3,5)) grid_size : (cy, cx) how many patches in y-direction , in x-direction patch_size : (h, w) how many pixels size of each patch returns ------- generator goes through each patch (a numpy array view) in row-major order ''' in xrange(grid_size[0]): j in xrange(grid_size[1]): yield im[top_left[0] + patch_size[0]*i : top_left[0] + patch_size[0]*(i+1) ,top_left[1] + patch_size[1]*j : top_left[1] + patch_size[1]*(j+1)] then when try change value of each patch, assignment change variable value in...

Display PHP multidimensional array in html table with each subarray in a column -

i'm sure there's easy way this. have following data in array: array ( [activitydiaryentry] => array ( [date] => 2011-03-03 [type] => walking [minutes] => 60 ) ) array ( [activitydiaryentry] => array ( [date] => 2011-03-02 [type] => walking [minutes] => 22 ) ) array ( [activitydiaryentry] => array ( [date] => 2011-03-01 [type] => biking [minutes] => 45 ) ) i'm not skilled @ php, know how display data row display <tr><td>[date]</td><td>[type]</td><td>[minutes]</td></tr> . i'd have data display in columns this: 2011-03-01 | 2011-03-02 | 2011-03-03 ------------------------------------ biking | walking | walking ------------------------------------ 45 | 22 | 60 a little ugly works :...

osx - Compile a C program with libpng on Mac OS X -

i have little utility wrote in c uses libpng. under linux, install libpng-dev , "gcc myapp.c /usr/lib/libpng.so -o myapp". in mac os x, have xcode tools installed, believe includes libpng. link against, , need specify include path png.h? try /usr/x11/include/png.h - you'll find libs in ../lib ( or /usr/x11/lib ) well. edit mavericks doesn't appear have anymore. may need use homebrew or macports install libpng.

Rails 3 is changing session ID on POST from AIR -

i have rest api in rails 3 being accessed air application , browser. i think rails 3 problem might flex/air problem. the rails app uses omniauth authentication, cancan authorization, , active_record_store. use session model store identity of user. (there reason i'm not using cookie sessions, having air android, oauth, , stagewebview.) i'm using charles monitor http traffic. most requests work fine. browser (or air client) sends session id server using cookie http header, this: _session_id=950dee7eca6732aa62b5f91876f66d15 and rails finds session, figures out user is, , thing. but under circumstances, rails generates new session before sending response. adds session sessions table, , returns set-cookie header client new session id. this: _session_id=e1489a6b610c0a1d13cec1454228ae47; path=/; httponly the circumstances under happens are: the request comes air client the request post this problem, because on subsequent requests, rails can't fin...

c++ - question on variable type "double" -

i have written program , works 3d coordinates (i.e. x,y,z). input data program like 50903.85 21274.97 15.03 50903.57 21274.96 15.08 50903.33 21274.95 15.17 and got output more columns. so, got same x,y,z output file. 50903.85 21274.97 15.03 50903.57 21274.96 15.08 50903.33 21274.95 15.17 so, program works properly, guess. then, used data set, having more digits previous data, 512330.98 5403752.71 330.39 512331.01 5403754.18 329.44 512331.06 5403755.59 329.56 and output like; 512331 5.40375e+006 330.39 512331 5.40375e+006 329.44 512331 5.40376e+006 329.56 here, not able real values. , x values rounded. cant think should reason? in program, used "double" assigning variables x,y,z values. so, know maximum numerical value can refereed double? if need work long values, should relevant variable? numbers aren't changing, seeing different notation change there. perhaps using other %f format doubles? see printf format parameters . ...

c# - What .net data technology is best enabling user def fields via XML in this project -

i new asp.net / .net, have designed screens , database structure side project webapp , ready start coding it. needed user defined fields , after deliberation on pros , cons of options decided implement them xml blob. im looking @ 3 options data access: 1) entity framework: havnt found in on how id go ef 2) dynamic data: create custom field template produces label / textbox pairs, under 1 column header if viewed in (eg gridview) 3) coding dal / bll myself, using sql connections. objectdatasources give enough flexibility in ui hopefully. (i split fields in bll here take it?) i want stick ms tech, rather nhibernate or such, learning mcts cert (also why im not using mvc need know both it). also, perhaps wrongly, think in using solution no. 3 gaining least relevant experience in terms of employers want. guys think solution newbie skill level here? edit once got implementation decided against using xml blobs, opting instead spare fields , meta table. if goal gain ...

Best way to log a Python exception -

i'm printing exceptions log file with: try: # coode in here except exception, e: logging.error(e) could printing more information exception , code generated exception string? things line numbers or stack traces great. logger.exception that. for example: import logging try: 1/0 except exception e: logging.exception("message") output: error:root:message traceback (most recent call last): file "<stdin>", line 2, in <module> zerodivisionerror: integer division or modulo 0 @paulo cheque notes, "be aware in python 3 must call logging.exception method inside except part. if call method in arbitrary place may bizarre exception. docs alert that."

iphone - Can i redefine the (0,0) point in a UIScrollView? -

i have scrollview many items on . scroll down point , save point new (0,0) point (i.e. other items attached scroll view see point (0,0) point . can ? use contentinset (see what's uiscrollview contentinset property for? ). additionally, might want move view contains other items within uiscrollview new 0 point (by setting frame), don't think that's you're looking for. the contentoffset relevant, too, if need scroll point programmatically.

Clojure refs and add-watch -

say have ref state gets updated every 30 seconds , fn want attach may take longer complete. @ time 0 ref updated , fn called @ time 30 ref again updated fn still running. 2 copies of same function running or skip , execute @ time 60 assuming fn returns then? edit: trying change state of ref. updated somewhere else trying use trigger control calculations. if use ref 2 functions run in parallel , compete right produce next state of ref loser having run again. this 1 of differences between refs , agents. agents run sequentially because have queue of functions waiting run on them.

javascript - URL fragments and the BASE tag -

i'm using <base> tag in application simplify development. i'm aware of " feature " occurs when anchor url fragment, in routes <base> url + fragment. what can circumvent that? i've never fudged window.location or in javascript, , rather hack around awhile @ it, assume knows of quick-and-dirty, or example. can circumvented? if so, please advise. ( i hate asking questions suggest no attempt has been made, i've been searching/reading little avail ) ( also; using jquery, examples take advantage of vanilla javascript or jquery welcome ) jquery solution hacked together , not sure if viable permanent solution though, thoughts? $('a').each(function(index){ if($(this).attr('href').indexof('#') == 0){ $(this).attr('href', (window.location.href).replace(/#.*$/, '') + $(this).attr('href')); } }); ok, so, think understand question now. this has been test...

libcurl - Getting BAD Request with CURL in PHP POSTING XML DATA -

i using php curl post xml data server using ip, fullfilled requirements making work, still getting error of "bad request". have on code below. $var2 ="<doc><item>some content.</item></doc>"; $url = "server ip"; $header = "post http/1.1 \r\n"; $header .= "content-type: text/xml \r\n"; $header .= "content-length: ".strlen($var2)." \r\n"; $header .= "content-transfer-encoding: text \r\n"; $header .= "connection: close \r\n\r\n"; $header .= $var2; $ch = curl_init(); curl_setopt($ch, curlopt_ssl_verifypeer, false); curl_setopt($ch, curlopt_ssl_verifyhost, false); curl_setopt($ch, curlopt_url,$url); curl_setopt($ch, curlopt_returntransfer, 1); curl_setopt($ch, curlopt_timeout, 4); curl_setopt($ch, curlopt_postfields, $var2); curl_setopt($ch, curlopt_customrequest, $header); // response $data = cur...

mysql - I'm using mybb, how can I find the top 5 threads that has the most readers currently? -

i'm using mybb , want show on website homepage threads has readers currently . i'm assuming have query session table i'm not sure how should it the mysql result need, should like: ------------------------- |title | count | ------------------------- |thread title | 1234 | |thread b title | 913 | |thread c title | 678 | |another title | 593 | |different title| 550 | ------------------------- thank :) i've tested on board, think need: select count(*) count, subject title `mybb_sessions`,`mybb_threads` location1 = tid group `location1` order count(*) desc limit 10

c# - Best way to handle multiple WCF EndPoints in a Windows App -

i have need install "agent" (i'm thinking run windows service) on many servers in network. agent host wcf service several operations perform specific tasks on server. can handle. the second part build control center, can browse servers available (the agent "register" central database). of servers running recent version of service, i'm sure there servers fail update , may run out dated version time (if right, service contract wont change much, shouldn't big deal). most of wcf development has been many clients single wcf service, i'm doing reverse. how should manage of these endpoints in control center app? in past, i've had single endpoint mapped in app.config. code builds wcf endpoint on fly, based on set of string ip; int port; variables read database? this article has code examples on how create end point on fly: http://en.csharp-online.net/wcf_essentials%e2%80%94programmatic_endpoint_configuration

What's the relationship between Castle, LinFu and Spring with NHibernate? -

i newbie nhibernate , bit confused castle, linfu , spring. i understand nhibernate helps in ddd , 1 can map entities database using xml or fluent nhibernate. wondering how castle, linfu , spring associated nhibernate. can please shed light or can point web link? personally have used castle , linfu. tended use castle if using other castle components well, such windsor. in fact castle have nhibernate facility can helpful. used linfu when didn't use other castle components. this blog post old has useful information on it: http://nhforge.org/blogs/nhibernate/archive/2008/11/09/nh2-1-0-bytecode-providers.aspx check out answer these questions: what differences between linfu.dynamicproxy , castle.dynamicproxy? nhibernate proxy class, should choose? nhibernate 2.1 proxy factory options - differences , choose?

Adsense code not showing -

my adsense code won't show. code in there, , in there weeks...still not showing.. http://www.ecompanies.nl/pilot/diensten/seo/breda.html i think should jquery or google maps javascript interfering or something. don't see javascript errors.. any highly appreciated! for encountering same problem...it looks adsense problem. seems ads show after google adsense bot spidered page. on new pages on sites, takes 1 or 2 days ads show up. strange..

c# - Get Name of ScatterviewItem in a Scatterview with binding -

i started program microsoft surface , have problem. i'm using scatterview <s:scatterview name="mainscatterview" contactleave="mainscatterview_contactleave" contactenter="mainscatterview_contactenter"> <s:scatterview.itemtemplate> <datatemplate> <image name="picture" source="{binding}"/> </datatemplate> </s:scatterview.itemtemplate> </s:scatterview> protected override void oninitialized(eventargs e) { base.oninitialized(e); try { mainscatterview.itemssource = system.io.directory.getfiles(@"c:\surface_app_dam\img\", "*.png"); } catch (system.io.directorynotfoundexception) { // handle exception needed. } } i name of item i've moved "contactleave="mainscatterview_contactleave", don...

nhibernate - Many to many with implied and explicit relationships -

i have standard many-to-many relationship in database between person , widget. person in administrative role has access widgets. in application, want see widgets person has access to. i have 2 high level options: explicitly manage relationships. when person becomes administrator, relate person existing widgets. when widget created, relate widget existing administrators. at run-time, if person administrator, assume have access widgets , bypass relationship table when loading widgets. is 1 option better other? there name scenario? i have been trying apply option 2 using nhibernate , can't seem figure out how bypass relationship table when loading widgets entity (and if could, unnecessarily load alot of information unless load widgets separately person entity , apply paging). i map means of roles. roles : person = 1 : many so when create person, create new role, unless administrator in case use existing admin role. then problem easy: need widgetrole ...

How to develop a simple ASP.NET MVC project without Visual Studio -

i have been able develop simple asp.net project without vs. can me doing same asp.net mvc 3. starting getting asp.net mvc 3 framework. seems can't download anymore assemblies. possible have project compiled on fly ( mean without compiling web application letting iis doing , possible achieve regular asp.net assume possible mvc framework) thx dave sure, it's pretty easy, couple of steps after install asp.net mvc 3. fire notepad.exe , create homecontroller.cs file (of course if don't want use notepad using copy con homecontroller.cs command on command prompt, way closer metal): namespace myapplication { using system.web.mvc; public class homecontroller : controller { public actionresult index() { return view(); } } } compile on command prompt (adjust folders match yours) c:\windows\microsoft.net\framework64\v4.0.30319\csc.exe /t:library /out:myapplication.dll /r:"c:\program files (x86)\microsof...

css - OSX Style dock in Ajax -

i building new site client , want , osx style dock @ foot of page. any ideas or examples of how started this. i guess ajax best option. freja. this seems looking for: http://www.addthis.com/gallery/share-dock there a clear html code example , accompanying css / js.

sql server - How to put the sum of all rows in each row -

this query: select clientes.nombre [nombrecliente], venta.usuario [nombrevendedor], sum((listaventa.precio) ) [finaltotal], venta.id [idventa], venta.fecha [fecha], idproducto [clave], producto.descripcion , listaventa.precio [preciounitario], listaventa.cantidad, listaventa.total [preciottoal] venta join clientes on venta.idcliente = clientes.id join listaventa on listaventa.idventa=venta.id join producto on listaventa .idproducto =producto.id venta.id ='36' group clientes.nombre, venta.usuario, venta.id, venta.fecha, listaventa.idproducto, producto.descripcion, listaventa.precio, listaventa.cantidad, listaventa.total problem is, don't sum, query checking id id, never return sum(listaventa.precio) returns same cantidad*preciou (of every product never sum it). else if try select clientes.nombre [nombrecliente], venta.usuario [nombrevendedor], sum((listaventa....

algorithm - How to find optimal overlap of noisy bivalent matricies -

Image
i'm dealing image processing problem i've simplified follows. have 3 10x10 matrices, each values 1 or -1 in each cell. each matrix has irregular object located somewhere , , there noise in matrix. i'd figure out how find optimal alignment of matrices let me line objects can average. with 1/-1 coding, know product of 2 matrices (using element-wise multiplication, not matrix multiplication) yield 1 if there match between 2 multiplied cells , -1 if there mismatch, sum of products yields measure of overlap. this, know can try out possible alignments of 2 matrices find yields optimal overlap, i'm not sure how 3 matrices (or more - have 20+ in actual data set). to clarify problem, here code, written in r, sets sort of matricies i'm dealing with: #set 3 matricies m1 = c(-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,1,-1,-1,-1,-1,-1,-1,-1,1,...

css - Add rounded corner mask to icon using $linkImg variable -

not savvy on i'd be, forgive me if question not phrased correctly. need apply 4 rounded corners 119 x 119 app store icon png auto pulled via custom wordpress plugin using variable $linkimg. $strhtml = " <div style='border: solid 1px #00b7f3; background-color: #f8f8f8; width: 656px; height: 186px; padding: 0px; float: left; margin-top: 4px;'> <div style='float: left; width: 175px; margin: 0px; text-align: center; padding-left: 10px; padding-top: 15px;'> <img src='$linkimg' width='119' height='119' style='margin: 0px; padding: 15px;'/> </div> </div> "; any ideas? (btw, first post) edit 2 - seems nothing, missing obvious? $strhtml = " <div style='border: solid 1px #00b7f3; background-color: #f8f8f8; width: 656px; height: 186px; padding: 0px; float: left; margin-top: 4px; border-top-left-radius: 50px 50px;'> <div style='float: left; width: 175px; ...

asp.net - How to deploy and configure aspnetdb on a production server? -

i developing mvc 2 application uses aspnetdb on sql server 2008 detabase forms authentication. on development machine can configure users, roles , permissions using website administration tool (wat). question how deploy database production server , how configure users, roles , permissions? in framework folder can find scripts generate necessary tables , procedures aspnet membership, after creating db, need enter records generating insert scripts dev db.

manage uitableview with more than 1000 rows with images iphone -

i have table view more 1000 rows. , every cell have image of large size approx 2-3 mb. receive low memory warning. can 1 suggest how manage table view. loading images web server , saving locally. please suggest approach should follow. code of cell row @ index path: savedfile = [nsstring stringwithformat:@"%@/%@", appdeligate.thumbnailpath, filename]; if ([clsglobal isfileexist:savedfile]) { objcellrecent.imgview.image =[uiimage imagewithcontentsoffile:savedfile]; } thanks you cannot load 1000 images of 2-3 mb each on device. can maintain stack of 50 rows @ time , overwrite images within stack. stack shall of rows present on screen , rows around them showing 10 rows @ time maintain ten , 40 around ten instance 20 , 20 down. let me know if works out cause have not tried myself.

scala - How to clone an iterator? -

suppose have iterator: val = list("a","b","c").iterator i want copy of it; code is: val it2 = it.tolist.iterator it's correct, seems not good. there other api it? warning: of scala 2.9.0, @ least, leaves original iterator empty. can val ls = it.tolist; val it1 = ls.iterator; val it2 = ls.iterator to 2 copies. or use duplicate (which works non-lists also). rex's answer book, in fact original solution far efficient scala.collection.immutable.list's. list iterators can duplicated using mechanism no overhead. can confirmed quick review of implementation of iterator() in scala.collection.immutable.linearseq, esp. definition of tolist method, returns _.tolist of backing seq which, if it's list (as in case) identity. i wasn't aware of property of list iterators before investigating question, , i'm grateful information ... amongst other things means many "list pebbling" algorithms can implemented eff...

osx - How do you get php working on Mac OS X? -

i have updated lion , enabled web sharing in system preferences unable php working. i added info file web root directory , outputs file text. info.php content <?php phpinfo(); ?> (edit: method appears work fine 10.9 (mavericks), 10.10 (yosemite) , 10.11 (el capitan), figured i'd mention new influx of frustrated os x updaters :d ) edit /etc/apache2/httpd.conf , make sure line: loadmodule php5_module libexec/apache2/libphp5.so ...exists. think it's commented out default in standard os x config, remember, need uncomment it, re-start apache: sudo apachectl restart and should go.

c# - Alternatives to Search and Replace to use for telling to an application where to put content in a Word document -

i write application document management. in delphi question may apply c# too. got useful reply to question asked made ma search&replace work easier. one requirement have automatically insert data in document according db data every time user opens document. (and includes subject of question mentioned above) doing once: "create document template" = substitute once , work done. search & replace works this, easy users. now requirement continuously, every time open document, same document should contain "placeholder" , "real data" (once open it). a simple example this: in header of word docuement user wants insert kind of placeholder 3 fields: company_logo (an image), revision numner (an integer), revision date (a datetime). currently techniques aware of are: 1) search & replace - use doing other things 2) placeholders - never used guess doable (there several posts here this one ) with search & replace this: a) ask user p...

java - faced with date parsing problem in jexcel api -

i have created file named tablenew.xls has date following code: dateformat formatter = new simpledateformat("yyyy-mm-dd"); date date = (date)formatter.parse(st[length]); datecell=new datetime(tokennumber,linenumber,date); sheet.addcell(datecell); i getting output in file "04-03-11" "dd-mm-yy". when same date written file named tabletemp.xls same code , output -689881.5. dilemma program however, seems understand negative value date. should modify code? if so, should do? in advance problem solved. anyways. always, date "04-03-11" displayed "dd-mm-yy" , treated excel "mm/dd/yy" . jexcel should problem. date parsing big pain.

javascript - jQuery-1.4.2 invalid argument line 4618 value=NaNpx in IE8 -

many people seem have run exception in jquery.extend: message: invalid argument. line: 4618 char: 4 code: 0 uri: https://windev/scripts/jquery-1.4.2.js my issue within our dev team running ie8 machine has js error. same code running on machines. if error showed on of machines apply 1 of solutions has been posted. since on 1 machine in group, wondering whether has found ie setting or add in may cause exception , explain why not happening consistently across team. this can happen if not browsers configured same way, more in advanced tab in internet options. there section in advanced tab lets toggle on/off notifications errors in scripts, possible these have been unchecked , why 1 of machines getting error. look @ method 1 in kb article: http://support.microsoft.com/kb/308260

iphone - UITableView delegate methods not called for uiSplitView's master view -

i have view button. when press button, uisplitview should show. problem tableview (splitview's left=master view). detail view (right) displayed correctly. left 1 empty because cellforrowatindexpath not called. .h file extends uisplitviewcontroller, , in .m file's viewdidload this: left *l = [[left alloc] initwithnibname:@"left" bundle:nil]; right *d = [[right alloc] initwithnibname:@"right" bundle:nil]; // update split view controller's view controllers array. nsarray *viewcontrollers = [[nsarray alloc] initwithobjects:l, d, nil]; self.viewcontrollers = viewcontrollers; [viewcontrollers release]; my left.h: @interface left : uiviewcontroller <uitableviewdatasource, uitableviewdelegate> { nsmutablearray *tabledata; uitableview *table; } @property (nonatomic, retain) nsmutablearray *tabledata; @property (nonatomic, retain) iboutlet uitableview *table; my left.m: #import "left.h" @implementation left @synthesiz...