Posts

Showing posts from August, 2012

c# - Is there a fully managed (.NET) Lua interpreter? -

c# - Is there a fully managed (.NET) Lua interpreter? - does know if there managed (.net) lua interpreter? regular source can compiled managed extensions desktop .net, can't embedded in silverlight application. there project called lua.net check aluminum lua, written in c#. c# silverlight lua aluminumlua

objective c - In iOS Development, using Core Graphics and/or Quartz 2D, how can I draw a circle filled with a gradient in such a manner that it looks like a sphere? -

objective c - In iOS Development, using Core Graphics and/or Quartz 2D, how can I draw a circle filled with a gradient in such a manner that it looks like a sphere? - so far have looked @ using cgcontextdrawlineargradient() , cgcontextdrawradialgradient(), however, former can't figure out how create gradient sphere, , latter, can't figure out how create gradient shape of sphere, because every time try, turns out in shape of total cylinder instead of sphere. the code using current draw 2d circle shown below. utilize gradient or other method possible using core graphics and/or quartz 2d fill circle in manner makes sphere. current code drawing circle: cgcontextref ctx = uigraphicsgetcurrentcontext(); float x = 20.0; float y = 20.0; float radius = 12.5; cgcontextfillellipseinrect(ctx, cgrectmake(x, y, radius, radius); p.s. - above code works supposed to, in case there errors, they're errors while typing question, not while typing code actual file. i be...

asp.net - How to use a radio button to select a list item in MVC3 -

asp.net - How to use a radio button to select a list item in MVC3 - i need nowadays user list of bundle options, select one. don't want utilize radio button list, need complex templating each list item. forgive me, can't seem figure out how link column of radio buttons selection property in view model. my view model has selectedpackageid (int), , list of memberpackagelistitem view models represent individual packages. memberpackagelistitem has packageid (int), need couple packageid of selected item selectedpackageid of root view model. it hard me post code, inheritance etc. obscures much of want see, i'm hoping outline of mutual scenario, , general guidelines on using radio buttons in scenario suffice help me continue. i suggest using htmlhelper render radio button list, follows: [suppressmessage("microsoft.design", "ca1006:donotnestgenerictypesinmembersignatures", justification = "this appropriate nesting of gene...

php - Smarty 3: if, mixed conditions & operators -

php - Smarty 3: if, mixed conditions & operators - well... can tell me why works: {if !$conta|contains:"word1" && ($product->id_category_default < 388 || $product->id_category_default > 475)} and not: {if (!$conta|contains:"word1" || !$conta|contains:"word2") && ($product->id_category_default < 388 || $product->id_category_default > 475)} where syntax error? try instead: {if !($conta|contains:"word1" || $conta|contains:"word2") && ($product->id_category_default < 388 || $product->id_category_default > 475)} php if-statement operators smarty condition

javascript - jQuery: Binding same event to window and another element -

javascript - jQuery: Binding same event to window and another element - how bind same event window , on element @ 1 go. tried this, not work me: $('window, #someid').bind('click', dosomething); $('#someid').add(window).bind('click', dosomething); should it. javascript jquery bind

sql - How to split up a massive data query into multiple queries -

sql - How to split up a massive data query into multiple queries - i have select rows table millions of rows (to preload coherence datagrid.) how split query multiple queries can concurrently executed multiple threads? i first thought of getting count of records , doing: select ... rownum between (packetno * packetsize) , ((packetno + 1) * packetsize) but didn't work. i'm stuck. any help appreciated. if have enterprise edition license, easiest way of achieving objective parallel query. for one-off or advertisement hoc queries utilize parallel hint: select /*+ parallel(your_table, 4) */ * your_table / the number in hint number of slave queries want execute; in case database run 4 threads. if want every query issued on table parallelizable permanently alter table definition: alter table your_table parallel (degree 4) / note database won't utilize parallel query; optimizer decide whether it's appropriate. parallel query wor...

javascript - A function is calling itself, without any recursive calls implemented in it -

javascript - A function is calling itself, without any recursive calls implemented in it - i have function shops mongodb db. exports.find_shops = function(selector, fields, limit, skip, cb){ if(typeof fields == 'function'){ limit = 0 cb = fields fields = {} skip = 0 } if(typeof limit == 'function'){ cb = limit limit = 0 skip = 0 } if(typeof skip == 'function'){ cb = skip skip = 0 } if(typeof selector == 'string'){ limit = 1 selector = {_id: new db.bson_serializer.objectid(selector)} } console.log('a') shop.find(selector, fields).limit(limit).toarray(function(err, shops){ console.log('b') if(err){ throw new error(err) } else { if(limit == 1){ cb(shops[0]) } else { cb(shops) } } }) } the ou...

How can I create SVN-compatible patches from Mercurial? -

How can I create SVN-compatible patches from Mercurial? - i new mercurial , using hgsubversion. have erred in using hg merge - know not next time need changes svn. how create patches mercurial compatible svn? it looks 1 time have hgsubversion installed, can utilize similar command: hg diff --svn -r default see more info here. svn mercurial

javascript - Need help to improve this largest common substring implementation -

javascript - Need help to improve this largest common substring implementation - i have scanned web largest substring implementations utilize in xmlhttp request, found 1 has worked, in other cases responsetext hasn't been treated string no matter have written: txt = txt + ""; // or txt = new string(txt);) this function works, terrible slow. wondering if code gurus out there help me improve algorithm. the site i'm calling xmlhttprequest looking this <!doctype html public "-//w3c//dtd html 3.2 final//en"> <html> <head> <title>index of /</title> </head> <body> <h1>index of /</h1> <ul><li><a href="/"> parent directory</a></li> <li><a href="random"> random/</a></li> <li><a href="random_2/"> random_1/</a></li> <li><a href="radnfdom"> random/</a></li...

jquery: how to change the size of a div from center -

jquery: how to change the size of a div from center - when utilize jquery animate() function alter size of div, begins left-top point. how can create zoom center instead corner. example, code: <div id="div1"></div> <style> #div1{ position: absolute; width: 50px; height: 50px; background-color: red; opacity: 0.4; top: 40%; left: 40%; border-radius: 1000px; margin: auto; } </style> <script src="jquery.js"></script> <script src="jquery.easing.1.3.js"></script> <script> $(document).ready(function(){ $("#div1").mouseover(function(){ $(this).animate( {width: 100, height: 100, opacity: 1}, {duration: 500, easing: "easeoutbounce"} ); }); $("#div1").mouseout(function(){ $(this).animate( {width: 50, height: 50, opacity: 0.4}, {duration: 500, easing: "easeoutbounce"} ); }); }); </script> this alter left-top po...

php - Data Mapper Pattern: Complexe query from Service Layer -

php - Data Mapper Pattern: Complexe query from Service Layer - i'm sing info mapper pattern in zend framework. works far, got point need help/opinion. let's start code: we got table several persons: create table `persons` ( `id` int(11) not null auto_increment, `name` varchar(50) not null, `age` int(3) not null, `haircolor` varchar(20) default null, primary key (`id``), ); now seek select people, have brownish hair. utilize next method in servicelayer public function getpeoplebyhaircolor($hair) { homecoming $this->getmapper()->fetch('haircolor = ?', $hair); } the method in mapper looks this: public function fetch($condition, $value) { $resultset = $this->gettable()->fetchall($this->gettable()->select()->where($cond, $value)); $entries = array(); foreach($resultset $row) { $entry = new default_model_person(); $entry->id = $row->id; $entry->name = $row->name; [...] } ho...

ms access - C# - Using OleDbParameter on table name -

ms access - C# - Using OleDbParameter on table name - i want protect app sql injection. want utilize oledbparameter in sql query table name ({1}). the problem doesn't work (error in or that). can pass oledbparameter in {3} thought. example: idbcommand cmd = m_oconnection.createcommand(); cmd.commandtype = commandtype.text; cmd.commandtext = string.format("select {0} {1} {2}={3}", "parentid", "?", swhere, "?" ); cmd.parameters.add(new oledbparameter("@stable", stable)); cmd.parameters.add(new oledbparameter("@id", id)); what can do? forced write function escapes sql characters hand? if yes, can find perfect function? thanks so know can't parameterize table names this cmd.commandtext = string.format("select {0} [{1}] {2}={3}", "parentid", stable, swhere, ...

Using Qt Resource for icons in a dll -

Using Qt Resource for icons in a dll - i need build c++ dll 1 qt dialog have icons. added these icons in qt creator/qt designer. created resource file , added these images it. these icons appear in qt designer, @ run time not show up. there no .pro file. can not add together resources += myres.qrc suggested on similar topics. q_init_resource(myres); can not invoked. any ideas here? solved.. i using visual studio 2010 code dll , dialog created in qt creator. resource file created using qt creator well. solution add together qrc file (generated using qt creator) dll project in visual studio. no other modifications needed done. no .pro file , no q_init_resource(myres) needed created/invoked. thanks help :) qt dll icons

css - Rails 3.1 Asset Pipeline Fingerprinting -

css - Rails 3.1 Asset Pipeline Fingerprinting - simple question: i've got rails 3.1 app running in staging, rails_env=production . problem this: stylesheet_link_tag produces different fingerprint css files fingerprint produced rake assets:precompile . so when request page, link stylesheet looking file like: /assets/front-1e3a4454e0d5434eccac1a053ca4c7fd.css but in reality file sitting in public/assets front-60b624d69d97b3ac5f288c54245a5ed5.css and browser returns 404 not found. here linlk stylesheet_link_tag :front . can explain me why happens? i've been having same exact issue. best can tell, occurs when precompile task runs during capistrano deploy. i've had remove precompile deployment , run rake assets:precompile rails_env=production release directory after app has been deployed. it's pain if you're pushing code frequently. css ruby-on-rails ruby-on-rails-3.1 asset-pipeline fingerprinting

Google Chrome Plugin development - Monitor network requests? -

Google Chrome Plugin development - Monitor network requests? - is possible monitor network traffic google chrome plugin local page? example, want monitor every time web page requests specific file (based on regex match), , if user clicks plugin, opens new tab file. the "proper" way utilize webrequest api, still experimental: //background.html chrome.experimental.webrequest.oncompleted.addlistener(function(details) { console.log("resource", details.url); }); meanwhile can grab resources loading next code: document.addeventlistener("beforeload", function(event) { console.log("resource", event.url); }, true); this needs go content script runs "run_at": "document_start" . google-chrome-extension

char - short short int in c? -

char - short short int in c? - i'm trying squeeze much out of memory possible. have matrix of 4.9999995e13 ints need true or false - need 1 bit of storage each of these ints. i understand there no single bit types in c (maybe can explain why, me), , know if short short int existed 1 byte, same char. of logical operations in c homecoming ints (as few other functions). so questions are: is there way of making short short int exist? if utilize char instead, have performance decrease because of casting int have done? is there way i'm missing? just in-case it's relevant, compiling gcc c99. edit i've seen on this wikipedia page there _bool type, standard? the __bool type standard in recent version of c, that's still not want, because __bool still takes @ to the lowest degree 1 byte (as char , definition). no, if want many boolean bits need pack them bitfield or bit array. there no standard datatype bitfields in c, you're going have ...

javascript - audacity plugin web version -

javascript - audacity plugin web version - is there web version plugin or similar http://www.audiorecording.me/change-pitch-music-key-signature-normalize-audio-wave-in-audacity.html javascript jquery html flash audacity

.net - WF4 Sequence vs Flowchart -

.net - WF4 Sequence vs Flowchart - from initial experimentation wf4, appears flowchart can represent workflow as sequence flow, although reverse not true. if right (and forgive me if i've missed something), there advantage @ ever using sequence workflow? from can tell, preferable start flowchart model offers more flexibility future remodelling if required. if start sequence, you're never going add together flowchart-style branching/decisioning. does sound sensible approach take? no doesn't. for 1 flowchart flexible doesn't straight back upwards lots of capabilities pick or parallel structure. , flexibility comes price, more work create simple sequence if steps. , quite mutual appearance. basically saying c# produces msil can in c# can done in msil not can in msil can done in c# should programme in msil only. in fact wf4 model makes real easy combine different styles. can start sequence, embed flowchart, embed sequence , state machine in th...

javascript - Add border around specific rows in a Table -

javascript - Add border around specific rows in a Table - col1 col2 col3 col4 col5 col6 row11 row12 row13 row14 row15 row16 row21 row22 row23 row24 row25 row26 row31 row32 row33 row34 row35 row36 i wish add together border around entire row or specific row, column combination (col4) first column values equal. example, if row11 equal row21, either there should border around 2 rows or around row14, row24. highly appreciate if can provide recommendations around same. it not hard iterate on first cell of each row determine if cell content "equal" content of first cell in next row, have function homecoming array of matching rows, e.g. // homecoming array of arrays of row indexes // first cell content equal function getmatchingrows(table) { var rows = table.rows; var allmatches = []; var currentmatches, currentvalue, previousvalue; (var i=0, ilen=rows.length; i<ilen; i++) { currentvalue = gettext(rows[i].cells[0]); if (curre...

WCF 4 REST Template and base64 strings - HTTP 400 -

WCF 4 REST Template and base64 strings - HTTP 400 - i trying submit long (approx. 155000 characters) base64 string wcf rest service using wcf 4 rest template made available microsoft. whenever seek submitting the xml through post method either client application or fiddler http status code 400 in response request. have appropriate web.config settings, pieced various blog posts , other stackoverflow posts. <bindings> <webhttpbinding> <binding name="httpbinding" maxbufferpoolsize="2147483647" maxreceivedmessagesize="2147483647" transfermode="streamed" opentimeout="00:25:00" closetimeout="00:25:00" sendtimeout="00:25:00" receivetimeout="00:25:00"> <readerquotas maxdepth="64" maxstringcontentlength="2147483647" maxarraylength="2147483647" maxbytesperread="2147483647...

c# - Adding a conditional join in entity framework 4.0 -

c# - Adding a conditional join in entity framework 4.0 - i trying inner bring together in ef4, if status met. have function like: list<articles> search(int? postsiteid) { var myquery = articles in context.articles articles.isdeleted = 0; if(postsiteid != null) { // add together inner bring together on posts table , check posts.siteid = postsiteid --- } } i unsure how add together bring together , status within of if statement, outside of main query. ive found nil searching few hours. im not sure if bring together neccessary though. if add together condition: query = query.where(article => article.posts.any(p => p.siteid == postsiteid.value)) , know bring together there? or subselect? the easiest thing try , @ generated sql... suspect utilize nested subselect, query optimizer work out join-like construct, i'd expect. you can bring together yourself, making su...

unit testing - JUnit for JSF2.0 composite components -

unit testing - JUnit for JSF2.0 composite components - we starting build infrastructure components in jsf2.0. what best approach unit testing them? i tried jsfunit in past wasn't satisfied it. there easier way implement it? this may more integration testing unit testing, if want see how components work in actual browser, selenium project has nice features, , can through unit tests. can on here: http://seleniumhq.org/docs/03_webdriver.html. i've found between regular unit tests, unit tests using jmockit or like, , selenium, can cover pretty much when testing components. cheers, bill unit-testing jsf jsf-2

XML Flash player -

XML Flash player - id set flash image gallery reads xml , displays relevant images on website, id able programatically @ slideshow in xml using id. example, xml has x number of slideshows(i've copied , pasted slideshows , changed id). illustration id @ slideshow elements id 2. if using xpath in xslt "location/image_gallery/slideshow[@id = 2]". <location> <image_gallary> <slideshow id="1" width="230" height="145" speed="2"> <image url="graphics/chesterfield.jpg" title="market walk" href="htle.co.uk/" /> <image url="graphics/cranley.jpg" title="history" href="http://www.google.co.uk/" /> </slideshow> <slideshow id="3" width="230" height="145" speed="4"> <image url="graphics/chesterfield.jpg" title="rket walk" href="http://...

javascript - DIV Element Not Scrolling -

javascript - DIV Element Not Scrolling - take @ this. sign in random username , start spamming chat till bottom of div. notice how doesn't scroll? need figure out why. javascript code used scrolling: // note: chatbox_id = "#chat" minte.ui.addchatentry = function(html) { // add together chat entry... var entry = '<div>' + this.formatstring(html) + '</div>'; $(chatbox_id).html($(chatbox_id).html() + entry); // .. scroll downwards bottom var chatcontentheight = 0; var chatheight = $(chatbox_id).height(); $(chatbox_id + " > div").each(function() { chatcontentheight += $(this).outerheight(); }); if (chatcontentheight > chatheight) { var scroll = chatcontentheight - chatheight; $(chatbox_id).scrolltop(scroll); } }; *and here css #chat: * chat { position: absolute; left: 0%; top: 0%; width: 65%; ...

php - Combine total count for entries in 2 SQL tables -

php - Combine total count for entries in 2 SQL tables - i can't seem find right way hoping give me direction? the sql database structured (i've removed irrelevant stuff): requests r_id r_fulfilledby 1 bob 2 craig 3 bob sims sm_id sm_fulfilledby 1 bob 2 craig 3 bob i'm hoping end output: fulfilled requests bob 4 craig 2 here's php/html: <div id="table"> <?php //connect mysql database $connection = mysql_connect($runnerdbserver, $runnerdbuser, $runnerdbpass); mysql_select_db($runnerdbname, $connection) or die("mysql error"); $query = "select r_fulfilledby, count(r_id) requests grouping r_fulfilledby order count(r_id) desc"; $result = mysql_query($query) or die(mysql_error()); ?> <!-- number of runners (counts total number of rec...

c++ - Can I run binary compiled with C++11 on the platform which doesn't support it? -

c++ - Can I run binary compiled with C++11 on the platform which doesn't support it? - i have 2 similar (say linux) platforms , b. supports c++03 , c++11; b supports c++03 compiler. i compile code (with c++03) on platform , able run binary on b without problem. case true c++11 ? (it may work in platform, want know in broader sense). in other words, c++11 limited till compilation or it's framework enhancement (added back upwards new libraries , threads)? in general, yes, there should c++0x runtime libraries nowadays on target machine, or should have runtime statically linked executable. c++ cross-platform c++11

iphone - how to prevent usage of other init methods other than my custom method in objective-c -

iphone - how to prevent usage of other init methods other than my custom method in objective-c - background - in iphone app have custom uitableviewcontroller - going pass required config extending existing "(id)initwithstyle:(uitableviewstyle)style" method extended custom one. question - what's best way ensure user of custom controller class can phone call custom init method, , not initwithstyle or other init methods? you can override init methods don't want used, , raise exception there. you can override them , create them initialize designated initializer. also, should specify on documentation. iphone objective-c ios init initwithstyle

properties - How to update the JSF2.0 (Primefaces) tooltips dynamically without server restart -

properties - How to update the JSF2.0 (Primefaces) tooltips dynamically without server restart - i need update jsf2.0 (primefaces) tooltips dynamically without server restart. meaning need find way tooltips (atm properties file) of running application can changed without requiring server restart. we running websphere , deploying non exploded ear (can convince deploy exploded war) any ideas or tips please. you the value attribute of p:tooltip component must el look or literal text. usually, 1 reference resource bundle declared using var attribute of f:loadbundle tag, in el look tooltip. the underlying resource bundle declared using basename attribute backed property file (in case need place property file in appropriate directory on classpath), or matter custom resourcebundle implementation read properties file (located outside container), or database or store matter. you hence alter existing el look existing 1 defined as: <f:loadbundle var="msg...

xcode - iPhone Project Dependency Management -

xcode - iPhone Project Dependency Management - has had success in finding reliable, generalised solution managing dependencies iphone projects? i'm looking split iphone applications reusable components , pull them projects require them. guess i'm looking maven-esque workflow xcode/iphone projects. i've tried number of things far such as: i've created maven plugin iphone applications automates building , signing of applications sense i'm fighting against maven work , altogether pretty messy. i'd rather not utilize unless there no other options. i have tried using static libraries bundle code re utilize problem i'd include reusable xibs , images in projects , these cannot included in static library redistribution. great code i'd have 1 scheme rather different dependency management systems different types of dependency. at moment i've settled on using version command scheme dependencies me. in case i'm using svn externals load depen...

objective c - What type of code correct: addSubview or direct controller assignment in AppDelegate? -

objective c - What type of code correct: addSubview or direct controller assignment in AppDelegate? - what type of code right , how works each of them (what difference between first , sec if result same): in application:didfinishlaunchingwithoptions: create first controller's view visible can utilize such method: [self.window addsubview:mycontroller.view]; [self.window makekeyandvisible]; or self.window.rootviewcontroller = self.mycontroller; [self.window makekeyandvisible]; what diffs ?? , right , more safely ? regards, alex. window inherited uiview rootviewcontroller property of window not uiview. the root view controller provides content view of window. assigning view controller property (either programmatically or using interface builder) installs view controller’s view content view of window. if window has existing view hierarchy, old views removed before new ones installed. the default value of property nil. addsubview method inherits ...

android - NEW_OUTGOING_CALL not being called on Samsung Galaxy S -

android - NEW_OUTGOING_CALL not being called on Samsung Galaxy S - trying intercept outgoing calls, , have solution working on nexus 1 stock android 2.2 htc want 2.2 moto defy 2.1 but not on samsung galaxy s running 2.1, seen this? <receiver android:name="com.mypackge.outgoingcalldetection" android:exported="true"> <intent-filter> <action android:name="android.intent.action.new_outgoing_call" android:priority="0" /> </intent-filter> </receiver> <uses-permission android:name="android.permission.process_outgoing_calls" /> update: process_outgoing_calls added. the receiver: public class outgoingcalldetection extends broadcastreceiver { private static final string tag = "outgoingcalldetection"; @override public void onreceive(context context, intent intent) { string action = intent.getaction(); log.d(tag, "onr...

How can admins see which users authorized Facebook application? -

How can admins see which users authorized Facebook application? - is possible see users authorized facebook app, assuming you're app admin? if so, how? we rather not store our own database of authorized users. prefer similar google analytics, except can log in , see snapshot of has authorized app (diff daily/monthly active users). this info isn't available api. i'm not sure available on website. app info log info on server (access token, user id) can query later. facebook facebook-graph-api facebook-fql

android - ANT build error : Incorrect Classpath -

android - ANT build error : Incorrect Classpath - i'm using ant build of android project. unfortunately, i'm getting error: [javac] wrong classpath:....... and lists class path in eclipse project. we're using ejc compiler because otherwise have stuff break in generics. i thought reason must picking .classpath file info, deleted libraries listed in there, , still show in error. so i'm wondering, where's getting classpath from? directories i'm seeing aren't specified anywhere in build.xml file. also, error mean? i've googled hell out of it, , doesn't seem create sense. figured out. have brackets in our folder name, e.g. c:[whatever] , causes fail. it's ant bug. android ant classpath

asp.net mvc - Add HTML content to a view Dynamically in MVC (without AJAX) -

asp.net mvc - Add HTML content to a view Dynamically in MVC (without AJAX) - i have many static html files (lets 1.html 100.html). there way can create link files/get/1 (where "files" controller , "get" action). read file based on passed id , set file's content within site layout , send user. in way format of html file preserved, , wouldn't need create view each file. i new mvc , appreciate suggestion/hint. allow me know if question not clear. thanks help in advance. reza, edit: added ended doing. answer: used darin said below, combined little bit of jquery , got needed. loading static html files within layout. here sample of did: first created 2 methods in controller: public actionresult gethelp(string id) { var folder = server.mappath(config.get().help_folder); var file = path.combine(folder, id + ".html"); if (!system.io.file.exists(file)) { homecoming httpnotfound(); ...

svn: externals history with parent repository in redmine -

svn: externals history with parent repository in redmine - setting ups bug tracking redmine , svn. have 1 app has collection of smaller apps within stored in different svn repos, have svn: externals controlling grouping of them 1 checkout. allows tie main svn checkout within redmine. the thing history reported redmine seems parent repository , not include of svn:externals. looking see if knows of way can have redmine see history on of svn:externals well. svn redmine svn-externals

c - how to find different memory segment starting and its size in linux -

c - how to find different memory segment starting and its size in linux - i new linux. want know starting address , size of different segments (like stack, heap, info etc.) , current usage. i know how find both in running process , in core dump. thanks in advance. start looking proc(5) filesystem. man friend. /proc/[number]/maps file containing mapped memory regions , access permissions in gdb, can utilize $ gdb -q (gdb) help info proc show /proc process info running process. specify process id, or utilize programme beingness debugged default. specify of next keywords detailed info: mappings -- list of mapped memory regions. stat -- list bunch of random process info. status -- list different bunch of random process info. -- list available /proc info. have @ info proc mappings , except doesn't work when there no /proc (such during pos-mortem debugging). c linux debugging gdb

Which php design pattern is more powerfull? -

Which php design pattern is more powerfull? - i want know 5 mutual pattern php (the mill pattern, singleton pattern,the observer pattern,the chain-of-command pattern,the strategy pattern) 1 more recommended , powerful , easy utilize ? the 1 best fits problem @ hand. design patterns tools, not way of life. php

NHibernate - three bidirectional relations between three classes gives N+1 -

NHibernate - three bidirectional relations between three classes gives N+1 - i'm having bit complicated object model forms triangle. there user entity has collections of items , taxonomies . item has taxonomy, too. , convenience, wanted item , taxonomy know owner , taxonomy know item , if any. see diagram: so makes 3 bi-directional relations. problem when map in nhibernate , asking user given id, i'm getting select n+1 problem. at first, user loaded eagerly fetched items . taxonomies loaded eagerly fetched item connected it. , expected , defined in mappings. there n+1 queries load items related taxonomies . this redundant parts of object graph loaded. thie problem disappears when create user-item relation unidirectional user side (there 2 queries, expected), don't want remove backward relationship. is possible have optimal fetching 3 relations bidirectional? here mapping parts: public class useroverride : iautomappingoverride<user> { ...

c# - Undo buffer getting cleared after handling OnKeyDown in TextBox -

c# - Undo buffer getting cleared after handling OnKeyDown in TextBox - i subclassing textbox: class editor : textbox i have overridden onkeydown, because want tabs replaced 4 spaces: protected override void onkeydown(keyeventargs e) { if (e.keycode == keys.tab) { selectedtext = " "; e.suppresskeypress = true; } } this works, unfortunately clears undo buffer. end result when user presses tab, ctrl+z doesn't work , 'undo' on right-click menu becomes disabled. problem appears "e.suppresskeypress = true;" part. does have thought of how around this? for more info, creating simple text editor, , i'm handling not tab key (as above), come in key. have problem tab , enter. aware problem doesn't exist richtextbox, various reasons want utilize textbox instead. any help much appreciated, show-stopping problem in project. thanks, tom this isn't result of overriding onkeydown , it's you...

javascript - scrollbars in chrome -

javascript - scrollbars in chrome - why next page give me scrollbars in chrome works fine in every other browser? i pasting everything, in case. though think unrelated java applet since same problem flash movie. <!doctype html> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title>java</title> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <script src="jquery-1.6.2.min.js"></script> <script type="text/javascript"> function getparameter(name, url) { if(!url) { url = window.location.href; } var paramsstart = url.indexof("?"); if(paramsstart !== -1) { var paramstring = url.substr(paramsstart + 1); var tokenstart = paramstring.indexof(name); if(tokenstart !== -1) { var paramtoend = paramstring.substr(t...

javascript - CSS Floats On Same Line Variable Amount -

javascript - CSS Floats On Same Line Variable Amount - i want have horizontal lists can run wide possible within fixed width container. using jquery allow scrolling on wide list, , overflow:automatic users without javascript. i have code along lines of this: <div class="list"> <ul> <li class="feed"> <section> <h1><span class="name">title</span></h1> <div class="scroll_left"><a class="ir" href="#">scroll back</a></div> <div class="article_list"> <ul class="article_list"> <li> <a href="article.php"> <div class="article_thumb"><img src="img/placeholder.png" alt="blah" />...

javascript - How best for a Firefox extension to avoid polluting the global namespace? -

javascript - How best for a Firefox extension to avoid polluting the global namespace? - i've been reading on global namespace pollution when developing extension firefox, , want avoid much possible in extension. there several solutions, generally, solutions seem center around declaring 1 global variable extension, , putting in that. add together 1 variable global namespace, isn't bad. as brief aside, have had solution proposed me avoids putting any variables global namespace; wrap in function. problem here there's nil refer in xul overlays. have declare elements in overlays, , in js add together ton of addeventlistener s replace would've been oncommand="..." in xul. don't want this; want xul include events in xul because think looks cleaner, isn't solution me. hence need @ to the lowest degree 1 global variable xul oncommand="..." attributes refer to. so consensus seems to have 1 (and one) variable extension, , set cod...

java - How to get output in JAXB (marshaling)? -

java - How to get output in JAXB (marshaling)? - i tried hello world illustration here , can't see output in programme (in console when using "java" command). wrong do? code of marshal function looks this: public void marshal() { seek { jaxbelement<greetinglisttype> gl = of.creategreetings( grlist ); jaxbcontext jc = jaxbcontext.newinstance( "hello" ); marshaller m = jc.createmarshaller(); m.marshal( gl, system.out ); } catch( jaxbexception jbe ){ // ... } } i tried tried set output file this: public void marshal() { seek { jaxbelement<greetinglisttype> gl = of.creategreetings( grlist ); jaxbcontext jc = jaxbcontext.newinstance( "hello" ); fileoutputstream fos = new fileoutputstream("plik.xml"); marshaller m = jc.createmarshaller(); //m.marshal( gl, system.out ); m.marshal(gl, fos); ...

javascript - for loop does not execute twice -

javascript - for loop does not execute twice - createmodelview: function (obj,vitalslength,headervalue) { for(i = 0, vitalslen = vitalslength; < vitalslen; i++) { // logic } } two questions where should place homecoming statement function. if place within loop work. when phone call function obj.createmodelview(arguments); why not execute twice or n number of times depending upon vitalslength. it executes once. some possible issues: first create sure declare 2 variables before loop var i=0, vitalslen=0; and check create sure vitalslength number. can isnan or typeof check. if (isnan(vitalslength)) alert("vitalslength not number"); one of these may or maybe not causing issue, allow me know. also... can't remember if it's same in javascript it's in other languages, ++i more efficient utilize i++ . as 2 questions: it can set after loop, if want one. hopefu...

Can any one explain this strange behavior of java HashMap? -

Can any one explain this strange behavior of java HashMap? - i have used hashmap in java lot has never encountered behavior. have types, item , itemgroup. defined shown in next codes snippets. public class item { string id; float total; } public class itemgroup { string keyword; int frequency; list<item> items; } so itemgroup consists of 0..* items. these items have keyword in mutual , keyword appears in scheme frequency. fun part, have next method given list of items creates list of groups. public static itemgroup[] creategroups(item[] items){ hashmap<string, itemgroup> groups = new hashmap<string, itemgroup>(); string[] words; (int i=0; i<items.length; i++){ words = items[i].getid().split(regex); // process keywords (int j=0; j<words.length; j++){ if (words[j].isempty()) break; itemgroup grouping = groups.get(words[j]); if (group != null){ ...

Where should I put the CSS and Javascript code in an HTML webpage? -

Where should I put the CSS and Javascript code in an HTML webpage? - while designing webpage, should set next code? <link rel=stylesheet type="text/css" href="css/layout.css"> should set in <head> or should set in <body> ? please clarify next questions: what difference create if set in <head> or anywhere else around html code? what if having 2 css (or javascript) files? since can include 1 file before one, file used web-browser display webpage? in sentiment best practice place css file in header <head> <link rel="stylesheet" href="css/layout.css" type="text/css"> </head> and javascript file before closing </body> tag <script type="text/javascript" src="script.js"></script> </body> also if have, said 2 css files. browser utilize both. if there selectors, ie. .content {} same in both css files browser over...

c# - System.ArgumentException: Complex DataBinding accepts as a data source either an IList or an IListSource -

c# - System.ArgumentException: Complex DataBinding accepts as a data source either an IList or an IListSource - i'm using c# code below populate winforms listbox. want hide scheme folders however. $recyclingbin example. gives me next error. system.argumentexception: complex databinding accepts info source either ilist or ilistsource. being new linq more confusing me. can tell me i'm going wrong? string[] dirs = directory.getdirectories(@"c:\"); var dir = d in dirs !d.startswith("$") select d; listbox.datasource = (dir.tostring()); change: listbox.datasource = (dir.tostring()); to: listbox.datasource = dir.tolist(); dir.tostring() spit out description of enumerable, isn't useful. error message indicates needs list, hence .tolist() . c# winforms linq

c# - Architecture of an ASP.NET MVC application -

c# - Architecture of an ASP.NET MVC application - i'm in process of doing analysis of potentially big web site, , have number of questions. the web site going written in asp.net mvc 3 razor view engine. in examples find controllers straight utilize underlying database (using domain/repository pattern), there's no wcf service in between. first question is: architecture suitable big site lot of traffic? it's possible load balance site, approach? or should create site utilize wcf services interact data? question 2: adopt cqs principles, means want separate querying commanding part. means querying part have different model (optimized views) commanding part (optimized business intend , containing properties needed completing command) - both deed on same database. think idea? thanks advice! for scalability, helps separate back-end code front-end code. if set ui code in mvc project , much processing code possible in 1 or more separate wcf , business logic ...

Hide body scroll bars from user while still allowing the page to move with jQuery scrollTo -

Hide body scroll bars from user while still allowing the page to move with jQuery scrollTo - sounds ux no-no.. go it. i'm using jquery scrollto move page around absolutely positioned div sections. i'd remove scrollbars user can't move section section without using navigation (which present). possible? overflow:hidden; first thought, doesn't work theoretically. thanks all! got it. html{overflow:hidden;} 'cause they're not in body! jquery scroll overflow scrollto

Auto registering complex generic types in StructureMap -

Auto registering complex generic types in StructureMap - i need help in auto-registering generics using structuremap. here scenario: public class object<t> { } public interface ibehvior<t> { void dosomething(t t); } public class behvior<t> : ibehvior<object<t>> { public void dosomething(object<t> t) { } } what want accomplish like: var x = objectfactory.getinstance<ibehavior<object<int>>(); but when run statement, gives me error no default instance configured. in structuremap configuration i've used connectimplementationstotypesclosing(typeof(ibehavior<>)) but still doesn't work! note worked fine if didn't have object. example, if have: public class intbehavior : ibehavior<int> { } everything works fine. when replace int generic type, doesn't work! any ideas? ok discovered solution here: http://lostechies.com/jimmybogard/2010/01/07/advanced-struct...

mysql - glassfish nested connection pool error -

mysql - glassfish nested connection pool error - i have made mysql connection pool in glassfish. after every 5 mins giving error although can utilize connection pool. severe: sat jul 09 13:57:05 ist 2011 warn: caught while disconnecting... exception stack trace: ** begin nested exception ** java.net.socketexception message: socket not connected stacktrace: java.net.socketexception: socket not connected @ java.net.socket.shutdowninput(socket.java:1379) @ com.mysql.jdbc.mysqlio.quit(mysqlio.java:1686) @ com.mysql.jdbc.connectionimpl.realclose(connectionimpl.java:4388) @ com.mysql.jdbc.connectionimpl.close(connectionimpl.java:1564) @ com.mysql.jdbc.jdbc2.optional.mysqlpooledconnection.close(mysqlpooledconnection.java:205) @ com.mysql.jdbc.jdbc2.optional.jdbc4mysqlxaconnection.close(jdbc4mysqlxaconnection.java:49) @ com.sun.gjc.spi.managedconnection.destroy(managedconnection.java:399) @ com.sun.enterprise.resource.allocator.connectorallocator.destroyresource(connectorall...

javascript - jQuery: How can I use "$" instead of "jQuery"? -

javascript - jQuery: How can I use "$" instead of "jQuery"? - i have simple jquery in site, yet maintain getting error: uncaught typeerror: property '$' of object [object domwindow] not function the error appears if utilize "$" instead of "jquery". // works jquery(document).ready(function() { jquery('#pass').keyup( ... ); }); // doesn't $(document).ready(function() { $('#pass').keyup( ... ); }); do need utilize "$"? you can wrap code: (function($) { // here $ point jquery object $(document).ready(function() { $('#pass').keyup( ... ); }); })(jquery); javascript jquery