Posts

javascript - Why no error when accessing a DOM element that doesn't exist? -

Image
i have divs partial views in them. why reference div doesn't exist not show kind of error? example, have 1 taskn div right now: <div id="task1"> @html.partial("~/views/partialviews/taskdoscommand.cshtml") </div> this jquery show div: $('#task' + task.prestotasktype).show(); when task.prestotasktype 1, task1 div correctly displays. however, when task.prestotasktype 1, 2, nothing displays (which good), there no error; no error shows on web page, , nothing displays in chrome developer tools console: shouldn't kind of error display when accessing dom element doesn't exist? no, because jquery .show() all elements jquery object wraps . if that's no elements @ all, it. that's precisely monad-like aspect of jquery makes useful: imagine code 'd have write if things didn't work way: var $whatever = $(...); if ($whatever.length) $.dosomething(); this worse: need introduce variable (in order a...

java - Entity hierarchies in Objectify 4.0 -

is there way how define entity hierarchy enables query particular subclass? consider situation below. let's have abstract base class defines common properties , concrete subclasses , b. class abstract base { ... } class extends base { ... } class b extends base { ... } i run example queries follows. to retrieve entities of type , b base base = this.objectify.load().type(base.class).list(); to retrieve entities of type a base base = this.objectify.load().type(a.class).list(); to retrieve entities of type b base base = this.objectify.load().type(b.class).list(); furthermore, store such entities single type (base entity) in gae datastore. we tried use polymorphic hierarchy of related entity classes described here: https://code.google.com/p/objectify-appengine/wiki/entities#polymorphism but seems not capable of handling situation there multiple entity subclasses common parent. i don't think base can abstract, should work: @entity class b...

javascript - Incompatibility between GM_xmlhttpRequest and jQuery in Firefox but not with Chrome -

Image
i'm facing strange problem. i need use gm_xmlhttprequest() function request , parse pages outside of site. i need use colorbox imported , custom in script. // ==userscript== // @name test // @namespace test // @description test // @include http://stackoverflow.com* // @require http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js // @version 1 // ==/userscript== //import colorbox. if (!$.colorbox) { (function(e,t,n){function g(n,r,i){var o=t.createelement(n);return r&&(o.id=s+r),i&&(o.style.csstext=i),e(o)}function y(e){var t=t.length,n=(u+e)%t;return n<0?t+n:n}function z(e,t){return math.round((/%/.test(e)?(t==="x"?tt():nt())/100:1)*parseint(e,10))}function et(e){return b.photo||/\.(gif|png|jp(e|g|eg)|bmp|ico)((#|\?).*)?$/i.test(e)}function tt(){return n.innerwidth||n.width()}function nt(){return n.innerheight||n.height()}function rt(){var t,n=e.data(r,i);n==null?(b=e.extend({},r),console&&console...

forms - Submit Google Custom Search with Jquery -

im using google custom search , submit form using own div jquery. tried many things no luck, 1 of them: the google code: <script> (function() { var cx = 'partner-pub-2789521296837340:9402765321'; var gcse = document.createelement('script'); gcse.type = 'text/javascript'; gcse.async = true; gcse.src = (document.location.protocol == 'https:' ? 'https:' : 'http:') + '//www.google.com/cse/cse.js?cx=' + cx; var s = document.getelementsbytagname('script')[0]; s.parentnode.insertbefore(gcse, s); })(); </script> <gcse:search></gcse:search> the jquery part: $( document ).ready(function() { $( "div.button" ).click(function() { $( "form.gsc-search-box" ).submit(); return false; }); }); live example: jsfiddle we cannot submit form (i.e., google created internally using jquery) directly. have change code change , feel. ...

ruby - Blog and Static Pages in Rails 4 -

i add static pages existing rails 4.0 app. these page such about, contact , this: examble.com/about also, want add blog engine publish news: the first type static , won't change. however, second type news, i'd add posts using form admins can add posts easily. i looked different gems example jekyll not allow add posts using form if want add have write codes , create files. so suggestions please? regards, one thing can set separate blog server (let's using wordpress) , point dns blog.example.com ip address of blog server. then can give individual users accounts on blog, can upload content. i suggest using existing blog engine such wordpress (there several others) because out of box include bunch of stuff image uploading, tagging, comments, antispam, , seo optimizations pretty permalinks. wouldn't rebuild scratch. if want blog reside @ www.example.com/blog, there bit of trick configure web server serve content 2 different servers, that's no...

c# - SQLite and Entity Framework configuration -

im trying set sqlite database layer tests , im not getting how config file should written (wasnt able find documentation this). seems duplicate configuration on file, people write db factories entityframework section, in system.data section. this current configuration file: <?xml version="1.0" encoding="utf-8"?> <configuration> <configsections> <!-- more information on entity framework configuration, visit http://go.microsoft.com/fwlink/?linkid=237468 --> <section name="entityframework" type="system.data.entity.internal.configfile.entityframeworksection, entityframework, version=5.0.0.0, culture=neutral, publickeytoken=b77a5c561934e089" requirepermission="false" /> </configsections> <connectionstrings> <add name="swechancontext" connectionstring="data source=:memory:; new=true; version=3" providername="system.data.sqlite" /> </co...

c# - How to use DotConnect For PostgreSQL and entity framework code first -

i trying use postgresql database in project. learn code first developement.. download dotconnect postgresql (trial version) , added devart.data.postgresql dll references. then, added lines in app.copnfig <connectionstrings> <add name="schooldbconnectionstring" connectionstring="server=localhost;port = 5432;database=mydatabase;user id=postgres;password=*****" providername="devart.data.postgresql" /> </connectionstrings> <system.data> <dbproviderfactories> <remove invariant="devart.data.postgresql" /> <add name="dotconnect postgresql" invariant="devart.data.postgresql" description="devart dotconnect postgresql" type="devart.data.postgresql.pgsqlproviderfactory, devart.data.postgresql, version= 6.8.333.0, culture=neutral, publickeytoken=09af7300eec23701" /> </dbproviderfactories> </system.data> </configuratio...