Posts

Showing posts from September, 2015

javascript - Play sound in jquery mobile on different pages -

i need play sound in background repeat time - background music. have added <audio> tag in page html , added event $("#audio-player").on('ended', function() { //play again } in pageinit event of page. , works, music should continue when navigate other page, , not sure how make this. appreciate help. you use ajax load new page. use jquery's load() load #content part of new page #content div of current page. html <header> <audio controls> <source src="horse.ogg" type="audio/ogg"> </audio> </header> <a href="page2.html">page 2</a> <div id="content"> page 1 content </div> </body> </html> javascript / jquery $('a').click(function(e){ e.preventdefault(); var target = $(this).attr('href'); $('#content').load(target + ' #content'); });

php - wordpress show unserialize data in a smart way -

in wordpress have stored data in database serialize method. have fetched data in array. code this global $wpdb; $results = wpdb->get_results("select * `table` `id` = 3"); foreach($results $result) { echo '<pre>'; print_r($result); echo '</pre>'; } this 1 getting me data this array ( [0] => stdclass object ( [id] => 1 [title] => a:3:{i:1;s:8:"test1";i:2;s:8:"test2";i:0;s:0:"test3";} [page] => a:3:{i:1;s:3:"dsa";i:2;s:4:"dsds";i:0;s:0:"sdvdsvds";} ) ) now want count values , want show values in listing. here can see have 3 values title , page. took title counter. made this foreach($results $result) { $count = count(unserialize($result->title)); // gave 3 for( $i = 0; $i<$count; $i++ ) { echo '<li></li>'; // gave me 3 li's wanted } } now

jquery - Backbone Router doesn't appear to correctly Extending Router -

Image
define([ 'jquery', 'underscore', 'backbone', 'app', 'models/sessionmodel', 'views/home/homeview', ], function( $, _, backbone, app, sessionmodel, homeview ){ approuter = backbone.router.extend({ initialize: function(options){}, routes : { '' :'showhome', }, showhome : function(){ this.show(new homeview()); }, }); return approuter; }); and here main first hit per backbone standards. have file called app created empty object , returns it... require.config({ paths: { jquery: 'libs/jquery/jquery-1.8.2', underscore: 'libs/underscore/underscore-min', backbone: 'libs/backbone/backbone-1.0.0-min', text: 'libs/require/text', router: 'router', app: 'app' }, shim: { jquery: { exports: '$' }, underscore: { exports: '_' }, backbone:

javascript - Why in IE loading image not show at center bottom of page? -

this question has answer here: how “position:fixed” css work in ie 7+ transitional doctype? 2 answers why in ie loading image not show @ center bottom of page ? this function load content on load page , load content on scroll bottom. first, load page index.php see loading image @ center bottom of page. but test on ie 7,8 loading not show @ center bottom of page , how can ? index.php <script src="http://code.jquery.com/jquery-1.7.2.js"></script> <script> // on submit form call function code // $("#f1").submit(send_requests()); </script> <body> <form method="post" id="f1"> <input type="hidden" name="something"/> </form> <div id="loading" style="padding: 0px; margin: 0px; position: fixed; bottom: 135px; right: 50%;

ios - Append ASCII symbol to the string -

i have string , ascii code in hex 0x1111 . how can append ascii code @ end/beginning of string see symbol of code? nsstring* = @"some"; the simplest way: nsstring *some = @"some"; = [[@"@\u1111" stringbyappendingstring:some] stringbyappendingstring:@"@\u1111"]; nslog(@"some: %@", some); returns: some: @á„‘some@á„‘

android - Set app activity to accept action.VIEW action -

when user tap on button code happen: uri web = uri.parse("http://www.google.com"); intent = new intent(intent.action_view,web); startactivity(i); and it's runs ok, open website in default web browser. trying display menu, appears if have more applications capable display web pages installed. prepared blank application fakebrowser androidmanifest file: <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.pavel.fakebrowser" > <application android:allowbackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/apptheme" > <activity android:name=".myactivity" android:label="@string/app_name" > <intent-filter> <action android:name="android.intent.action.main"

c# - ASP checkbox 'checked' attribute always returning true -

i have several asp:checkboxes on webform filled in on page load, returned on button submit. the buttons returning same server boolean behind them, no matter whether changed on client side before being returned. after checking clientid of variables, same not down hidden ids or that. aspx <script type="text/javascript"> function slidetable(link) { $(link).parent().next().toggle() $(link).find(".navplus").toggleclass("rotate1"); $(link).find(".navplus").toggleclass("rotate"); var txt = $(link).parent().next().is(':visible') ? 'minimise' : 'view all'; $(link).find(".navplus").text(txt); }; function boxchange(box) { //change has happened @ point if ($(box).prop("checked")==true) { $(box).attr("checked", "checked"); } else { $(box).removeattr("che

Leaving margin at bottom of print (JSP, CSS) -

Image
could please tell how shall leave margin @ bottom of page when table extending on page (please see image). while printing missing 1 or 2 rows @ bottom. i have tried using @page{ body {margin-bottom:2cm;}} not seem work me.

database - Storing lots of duplicate strings. Looking for good hash function to save storage. -

i looking hash function save on storage space while storing lot of duplicate strings in database. i have db have store date rate description xxx yyyy zzzz 100s of millions of rows; description max 1k string. description string has high repeat; many duplicates. avoid (wasted) storage thinking of doing this table 1 date rate desc_id table 2 desc_id description approach 1: desc_id == md5 hash --> db has primary key on descid; app generates hash; db writes fast (that thinking) approach 2: desc_id == db generated id; unique key has description; db writes might slower above approach. question1: should stick md5 or there better algos out there? worthwhile go sha-x functions theoretically better collision avoidance, while taking hit on storage d compute time? question2. should consider going approach 2?

string - Trouble understanding istringstream in C++ -

i new c++ , wondering how can understand functions , classes do. example told use "istringstream" homework assignment. have looked online , found site cplusplus.com lot of references. problem have understanding reference page . on "istringstream" reference page given following code: // istringstream constructors. #include <iostream> // std::cout #include <sstream> // std::istringstream #include <string> // std::string int main () { std::string stringvalues = "125 320 512 750 333"; std::istringstream iss (stringvalues); (int n=0; n<5; n++) { int val; iss >> val; std::cout << val*2 << '\n'; } return 0; } in code above, need assignment not understand why works. created istringstream object called iss, later used "iss >> val". part confused with. do? i have tried reading text above explains each function in class did not understand of it. examp

parallel processing - How to use pmap on a single large Matrix -

i have 1 large matrix m (around 5 gig) , have perform operation f: column -> column on every column of m . suppose should use pmap (correct me if wrong), understand should give list of matrices. how process m in order pass pmap ? the second question if preferable f can take multiple columns @ once or not. i think might idea try sharedarray this. better multithreading instead of julia's current multiprocessing, isn't released yet. f should take reference matrix, , list of columns, rather columns themselves, avoid copying. edit: here attempt @ sharedarray example - i've never used myself before, written poorly. addprocs(3) @everywhere rows = 10000 @everywhere cols = 100 data = sharedarray(float64, (rows,cols)) @everywhere function f(col, data) row = 1:rows new_val = rand()*col dowork = 1:10000 new_val = sqrt(new_val)^2 end data[row,col] = new_val end end tic() pmap(g->f(g...), [(col,data

AngularJS Email Validation Fails -

you can test original address: https://docs.angularjs.org/api/ng/input/input%5bemail%5d it fails when remove dot. how can add requirements? the perceived problem lies in fact email without dot legal. bob@localhost valid email address. until rfc spec changes require dot, choices apply validation client side via regex or handle server side. see post lengthier explanation. using regular expression validate email address

php - How to append file upload paths to a Form using JavaScript? -

below jquery/javascript code have handles file uploads on form have. user can upload many files need to, after upload file, show preview image of uploaded file in div. what need with, need somehow add files uploaded, hidden form field when submit form, post file name/path of each file uploaded other form data backend php script. i'm not sure on best way this? i thinking might work... <input type="text" name="uploads[]" id="uploads" value="file path here"> but i'm not sure if overwrite previous values each time new file added if there more 1 upload? any ideas on how handle this? need access filename of each uploaded file in backend once form submitted. jquery(function () { jquery('#fileupload').fileupload({ url: '<?php echo mage::geturl('signwizard/index/savefile') ?>', sequentialuploads: true, datatype: 'json', dropzone: jquery('#dropzo

java - TestNG dataproviders with a @BeforeClass -

i trying run class multiple tests under 2 different conditions. have bunch of tests related search. adding new functionality of new search strategy, , in meantime want run written tests under both configurations. have multiple classes each multiple tests want streamline process as possible. ideally it'd great setup in @beforeclass data provider tests in class run twice under different configurations, doesn't possible. right have: public class searchtest1 { @test(dataprovider = "searchtype") public void test1(searchtype searchtype) { setsearchtype(searchtype); //do test1 logic } @test(dataprovider = "searchtype") public void test2(searchtype searchtype) { setsearchtype(searchtype); //do test2 logic } @dataprovider(name = "searchtype") public object[][] createdata() { return new object[][]{ new object[] {searchtype.scheme1, searchtype.scheme2} }

c++ - Problems adapting member functions in Phoenix -

i use boost_phoenix_adapt_function time in spirit. i'd able adapt member functions of same reason. however, compile errors if this: struct { int foo(int i) { return 5*i; }}; boost_phoenix_adapt_function(int, afoo, &a::foo, 2) is there easy way adapt member function? note can't store bind expression in auto because on vc2008. how come doesn't work in bind , function ? thanks, mike the boost_phoenix_adapt_function(return,lazy_name,func,n) is simple. creates functor templated operator() returns return , has n template parameters. in body invokes func(parameters...) . &a::foo not directly callable, , error occurs. can use: boost_phoenix_adapt_function(int,afoo,boost::mem_fn(&a::foo),2) running on coliru #include <iostream> #include <boost/phoenix.hpp> #include <boost/phoenix/function.hpp> #include <boost/mem_fn.hpp> struct { a(int f) : f_(f) {} int foo(int i) { return f_*i; } private:

python 3.x - Unregistring a GTK application -

i running gtk.application/gtk.window in python3. when running itself, shuts down properly. i run in "ipython3 --gui=gtk3" , invoking program "%run -d xxx.py" appropriate breakpoints. when shutdown icon on window or when unrecoverable error , try restart "%run -d xxx.py", in ipython console: > failed register: object exported interface org.gtk.application @ /org/gtk/application/anonymous exception has occurred, use %tb see full traceback. <<< is there place can manually unregister application? (i happier documentation explaining how gnome , apps work together:). way, want app have unique instance; unregistering problem. is there perhaps better way @ internal objects %run -d command , breakpoints? by way, os ubuntu 14.04 64 bit.

c# - info for page if requiment roles -

i have controller requirement role names "admin": it's part of controller: [authorize(roles="admin")] public class rolesadmincontroller : controller { public rolesadmincontroller() { } public rolesadmincontroller(applicationusermanager usermanager, applicationrolemanager rolemanager) { usermanager = usermanager; rolemanager = rolemanager; } private applicationusermanager _usermanager; public applicationusermanager usermanager { { return _usermanager ?? httpcontext.getowincontext().getusermanager<applicationusermanager>(); } set { _usermanager = value; } } private applicationrolemanager _rolemanager; public applicationrolemanager rolemanager { { return _rolemanager ?? httpcontext.getowincontext().get<applicationrolemanager>(); } private set {

asp.net mvc - What can cause automapping to behave differently in different MVC app with same code? -

i have test app works following classes in 1 app, not in another: public class valuechange { public int groupid { get; set; } public list<itemvaluechange> changes { get; set; } } public class itemvaluechange { public int itemid { get; set; } public string value { get; set; } public string key { get; set; } } my plugin posts js structure matches structure ( changes jquery array). the raw post data (from fiddler2) looks like: groupid 1000 changes[0][value] changes[0][key] changes[0][itemid] 1 in test app works , maps data sent valuechange object correctly. [httppost] public jsonresult validate(valuechange change) { // changes property has required array of objects/properties } in our main application, ported plugin , classes, post data sent looks like: groupid 3705 changes[0][value] changes[0][key] changes[0][itemid] 81866 and validate method called looks identical: [httppost] public jsonresu

javascript - Script load on xhr response -

i have problem responsetext. want load script includes/dodaj-slike.php (which echo) xhr.onreadystatechange = function(e) { if(this.readystate === 4) { alert(xhr.responsetext); } }; xhr.open('post', 'includes/dodaj-slike.php', true); xhr.send(formdata); alert responsetext (example) : <script type='text/javascript'> $('ul li:nth(0)').append('<img src='uploads/cropped_2013-08-12 00.50.37.jpg'/>'); </script> <script type='text/javascript'> $('ul li:nth(1)').append('<img src='uploads/cropped_2013-08-18 12.56.24.jpg'/>'); </script> i , want somehow load script after response. my question how load script on way? you can with document.head.appendchild(responsetext); correct way suggested $("head").append(xhr.responsetext);

Spring Integration FTP - poll without transfer? -

i'd utilize spring integration initiate messages about files appear in remote location, without transferring them. require generation of message with, say, header values indicating path file , filename. what's best way accomplish this? i've tried stringing ftp inbound channel adapter service activator write header values need, causes file transferred local temp directory, , time service activator sees it, message consists of java.io.file refers local file , remote path info gone. possible transform message prior local transfer occurring? we have similar problem , solved filters. on inbound-channel-adapter can set custom filter implementation. before polling filter called , have informations files, can decide file downloaded or not, example; <int-sftp:inbound-channel-adapter id="test" session-factory="sftpsessionfactory" channel="testchannel"

webserver - LabView web server cannot access -

i create web server labview vi when did vi interface part missing (that part blank , gave error). tried solution internet , says plugins missing downloaded , installed plugin suggest (windows silverlight , labview run time) result still same. have suggestion? (when did followed link: http://www.ni.com/white-paper/4791/en/ ) thanks, tanja try install latest version of microsoft silverlight. after make sure open interface via internet explorer. chrome not open silverlight gui.

node.js - socket.io without running a node server -

i have web application requires push notifications. looked node.js , socket.io , have example that's working. question have is, possible use socket.io in client side js without running node.js server? can third party server send requests proxy server , may socket.io listens port on proxy server , sends events it? thanks, you need server side technology send data , forth via web sockets. socket.io communication layer. means, need have server side method send data. however, you can use various third party services use web sockets , notifications. relatively easy use, , have support many other languages. check of these out: http://pusher.com/ https://www.firebase.com/ http://www.pubnub.com/ https://www.tambur.io/ https://fanout.io/ you don't need run node.js have real time push notifications. can use third party service you. of them cheap, free low traffic instances.

internet explorer 9 - Javascript window.open menubar always showing -

i have question regarding javascript window.open function, have requirement in new window menu bar of browser appears always, using internet explorer 9, , when add option menubar=1 in window.open function menu bar appears hidden in new window, need press "alt" key make menu bar appear , when click in other place of window menu bar hides again, there way using javascript or other type of code make menubar appear unhidden time in new window?, here window.open call using: window.open("destination.aspx","title","menubar=1",true); the new window open pdf file inside it. thanks in advance.

xslt - How to pass javascript variable to xsl variable? -

this has been asked before, want evaluate if possible?... is there simple way pass javascript variable xsl variable? reason being, variable coming external script. here's non-working code... <?xml version="1.0" encoding="iso-8859-1"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/xsl/transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt"> <xsl:template match="/"> <div> <script type="text/javascript"> var key = window.location.href; </script> <xsl:variable name="jsvar">$key</xsl:variable> <xsl:value-of select="$jsvar"/> </div> </xsl:template> i want display "term1" on web page. any idea? the script tag being output xsl, it's not defines that's executable in context of xsl. can define xsl variable @ global scope , re-use both in

css - DFP Background Skin - can't get it centered -

i'm loading google dfp background skin ad unit. i've got showing correctly, cannot background image stay centered once web browser shrinks smaller width image width itself. rather image gets pegged left hand side of browse , collapses right left resulting in center content panel not being centered on background image anymore. my html code is: <div id="background-skin" class="desktop-ad"> <div id='div-gpt-ad-xxxxxxxxxxx-x'> <script type='text/javascript'> googletag.cmd.push(function() { googletag.display('div-gpt-ad-xxxxxxxxxxx-x'); }); </script> </div> </div> the css use is: #background-skin { position: fixed; z-index: 1; width: 100%; height: 1600px; margin-left: auto; margin-right: auto; top: 0px; text-align: center; } one way desired effect setting fixed wrapper @ 50% horizontally, left , , no width needed. let grow content: #background-skin { position: fixed; z

c# - Is it possible to write a .NET library that targets .NET 4.0 but uses .NET 4.5 features if invoked by a .NET 4.5 application? -

the library must able run on machines have .net 4.0. if run on machines have .net 4.5, , if invoked .net 4.5 application, nice if same library able use .net 4.5 specific functionality. of course, hardcoding dependencies on types , methods not introduced until .net 4.5 make library no longer .net 4.0 compliant, possible .net 4.0 library loaded .net 4.5 application load , use .net 4.5 types , methods using reflection? yes can,since @ disposal. 1 example paint.net does; compiler 4.0 if 4.5 installed, enables multi-core jit using reflection. can find details in http://blog.getpaint.net/2012/09/08/using-multi-core-jit-from-net-4-0-if-net-4-5-is-installed/

c# - Searching for a String in a text file -

hello i'm trying search word "jeep" located in text file. have constructor class , set items. use loop cycle through cars , if statement word "jeep". if there take mileage of jeeps , pop in message box. not think word search working. thank you! private void btnjeep_click(object sender, eventargs e) { double jeepmile = 0; (int = 0; > cars.count; i++) { if (cars[i].make == "jeep") { jeepmile = cars[i].mileage; } } messagebox.show("the average mileage of jeeps is: " + jeepmile, "jeep mile avg.", messageboxbuttons.ok); } change: (int = 0; > cars.count; i++) to: (int = 0; < cars.count; i++)

c++ - Find exponent of a complex number -

i want find out exponent of complex number such as: 2+3i . how can find value? know e^(jt)=cos(t)+jsin(t) is there built in function in opencv? if yes, please explain me example. what’s wrong cexp( ) function declared in complex.h ? why want use opencv instead of standard library? #include <complex.h> #include <stdio.h> int main(int argc, char *argv[]) { double complex z = 2 + 3*i; double complex w = cexp(z); printf("%f + %fi\n", creal(w), cimag(w)); return 0; } if you’re targeting platform doesn’t provide complex types or operations, can use following quick-and-dirty solution: struct mycomplex { double real; double imag; } struct mycomplex my_exp(struct mycomplex z) { struct mycomplex w; w.real = exp(z.real)*cos(z.imag); w.imag = exp(z.real)*sin(z.imag); return w; } and finally, since you’re using msvc, rudimentary c++ example: #include <complex> #include <iostream> int main(int argc, c

jquery - Ajax success callback- DOM not updating -

i running $.ajax function. data want returned in json format, , able parse , properties want. then, when try change dom, isn't changing. console.log() statements show things changing, when view source of page original element still there. code: $.ajax({ success: function (jsonimagestring) { if (jsonimagestring.length > 0) { var embeddedimages = $.parsejson(jsonimagestring); $.each(embeddedimages, function () { var currpin = this.pin; var currurl = this.url; var currtitle = this.title; //statement displays correct pin console.log(currpin); //statement shows correct original html console.log($("a[href='" + currpin + "']").html()); //nothing changes- viewing source of page shows original elements $("a[href='" + currpin + "

javascript - When should I use $(object), and when should I use $object? -

this question has answer here: jquery object: cache or not cache? 6 answers suppose have element matching ".foo". <div class="foo"></div> i've learned experience performance hit calling finders more once, in, if i'm trying change same object several times. $(".foo").doonething(); $(".foo").doanotherthing(); $(".foo").dosomethingelse(); // makes jquery ".foo" 3 times, bad! versus $foo = $(".foo"); $foo.callallthreeofthethingmethodsinthepreviousblock(); // calls $(".foo") once, occupies memory jquery object version of foo div. my question is, how many times have use finder before setting aside memory hold jquery object instead of making jquery method call again? i ask since other day had made every finder called more once stored $object variable; boss had s

javascript - How to show slider with caption? -

jquery $('.slider').cycle({ fx: 'scrollhorz', slides: '>a', swipe: true, easing: 'easeinoutexpo', prev:'.btn_prev', next:'.btn_next', timeout: 5000, speed: 1000, }); html <div class="slider"> <a class="cycle-slide"> <img src="slide07.jpg"> <div class="caption"> skdfksfksdfksdhfvdkvdk </div> </a> <a class="cycle-slide"> <img src="slide07.jpg"> <div class="caption"> skdfksfksdfksdhfvdkvdk </div> </a> <a class="cycle-slide"> <img src="slide07.jpg"> <div class="caption"> skdfksfksdfksdhfvdkvdk </div> </a> </div> css .caption { position: absolute; top: 0

mongodb - Mongo shell can't connect to server -

this must simple problem, i've followed excellent , simple documentation provided @ https://docs.c9.io/setting_up_mongodb.html , read every cloud9-ide tagged question includes 'mongodb' - no avail. i'd appreciate possible. following directions referenced above, appear able mongo running fine. (see below.) however, when try shell - instructed - following error: cliffchaney@sacs:~/workspace $ mongo --host $ip mongodb shell version: 2.6.4 connecting to: 0.0.0.0:27017/test 2014-09-10t17:53:55.570+0000 error: couldn't connect server 0.0.0.0:27017 (0.0.0.0), address resolved 0.0.0.0 @ src/mongo/shell/mongo.js:148 exception: connect failed any suggestions? as noted, appears can mongod running. after following mentioned instructions, can execute following (though warning): cliffchaney@sacs:~/workspace $ ./mongod 2014-09-10t17:52:29.370+0000 ** warning: --rest specified without --httpinterface, 2014-09-10t17:52:29.370+0000 ** enabling http interf

java - Is there any use in caching very small objects? -

taggedlogger has string field - tag . public class taggedlogger { private final string tag; public static taggedlogger forinstance(object instance) { return new taggedlogger(gettagofinstance(instance)); } public static string gettagofinstance(object instance) { return gettagofclass(instance.getclass()); } public static taggedlogger forclass(class<?> someclass) { return new taggedlogger(gettagofclass(someclass)); } public static string gettagofclass(class<?> someclass) { return someclass.getname(); } public static taggedlogger withtag(string tag) { return new taggedlogger(tag); } private taggedlogger(string tag) { this.tag = tag; } public void debug(object obj) { log.d(gettag(), string.valueof(obj)); } public string gettag() { return tag; } public void exception(string message) { log.e(gettag(), string.valueof(messag

Dojo data attribute finding and Dojo equivalent to jQuery's $(this) -

hey trying value 1 of elements. data element called data-lang , here example of it: <p class="maintext" data-lang="es">welcome</p> this dojo javascript: dojo.query("[data-lang]").foreach( function(item){ var thetext = dojo.attr(item, "innerhtml"); } ); this doesn't seem work don't anything. looking above "es" also, how dojo handle jquery equivalent of $(this) ? the query above should work fine. sure you're waiting dom ready? if you're using amd, should use following: require([ "dojo/query", "dojo/domready!" ], function(query) { // code }); or following non-amd: dojo.addonload(function() { // code }); about second question, there no alternative. dojo/query not pass current node scope of callback functions 1 you're using in foreach() . however, can current node parameter, can following: dojo.query("[data-lang]").fo

python - Perform check on lists -

i have 2 lists: main_voltages = [5.5, 15.7, 28.5] limit_list = [[5,10], [15,20], [25,30]] i have perform check see if 5.5 in range of 5 10, if 15.7 in range of 15 20 , 28.5 in range of 25 30. how should make happen without hardcoding anything? ponder lot on functions couldn't exact way it. this 1 way using zip() : >>> main_voltages = [5.5, 15.7, 28.5] >>> limit_list = [[5,10], [15,20], [25,30]] >>> result = [b[0] <= <= b[1] (a, b) in zip(main_voltages, limit_list)] >>> result [true, true, true] or @ovgolovin pointed out, can unpack elements in limit_list , do: result = [a <= value <= b (value, (a, b)) in zip(main_voltages, limit_list)]

dotnetnuke - Custom error handling in DNN 7? -

anyone here have experience custom error handling inside dnn 7? the built in logging fine, company has need extend dnn's built in error handling include sending custom emails when all exceptions occur. created httpmodule added event listener on application_error, , have been emailing exceptions way. however, after exception emailed, not being consistently redirected specified 500 error page set in dnn's properties under admin > site settings. have different behavior depending on exception type. exceptions (nullreferenceexception) result in application_error firing , email being sent no redirection, others (httpexception) result in redirect 500 page without application_error event being fired. possible in dnn catching these errors before application_error fires, , ideas on how fix these issues? here httpmodule added web.config: /// /// class error handling , emailing exceptions error distribution list. /// public class errormodule : ihttpmo

r - Rd2pdf - special (and German) characters -

yesterday used rd2pdf convert documentation of r package pdf , discovered special characters '§' , german umlauts (ä, ö, ü) not displayed. i'm using debian 7 , have texlive installation - latex documents use packages 'ngerman' display special german characters ä, ö , ü , ß . so, rd2pdf uses whole latex thing, question is: is there way include these additional packages enable rd2pdf displaying these special characters? thanks in advance! the following works on ubuntu 14.04 system: r cmd rd2pdf --encoding=utf-8 file.rd see command-line text r cmd rd2pdf --help ... the rd sources assumed ascii unless contain \encoding declarations (which take priority) or --encoding supplied or if using package sources, if package description file has encoding field. output encoding defaults package encoding 'utf-8'.

hibernate - hql select attribute null in tables -

i have 2 entities empleado , cargo : @entity @table(name = "empleado") public class empleado { private integer id; private string nombre; private string codigo; private cargo cargo; @id @column(name = "id") @sequencegenerator(name = "seq", sequencename = "empleado_id_seq",allocationsize=1) @generatedvalue(strategy = generationtype.sequence, generator = "seq") public integer getid() { return id; } public void setid(integer id) { this.id = id; } @column(name = "nombre") public string getnombre() { return nombre; } public void setnombre(string nombre) { this.nombre = nombre; } @column(name = "codigo") public string getcodigo() { return codigo; } public void setcodigo(string codigo) { this.codigo = codigo; } @manytoone @joincolumn(name = "id_cargo_empresa") public cargo getcargo() { return cargo; } public void setcargo(cargo cargo) { this.cargo = cargo; } }

bash - Shell script: How to restart a process (with pipe) if it dies -

i use technique described in how write bash script restart process if dies? lhunath in order restart dead process. until myserver; echo "server 'myserver' crashed exit code $?. respawning.." >&2 sleep 1 done but rather invoking process myserver , invoke such thing: myserver 2>&1 | /usr/bin/logger -p local0.info & how use first technique process pipe? the until loop can piped logger : until myserver 2>&1; echo "..." sleep 1 done | /usr/bin/logger -p local0.info & since myserver inherits standard output , error loop (which inherits shell).

sql server - SQL to retrieve first sentence from a block of text -

i have following sql sql server: declare @summary1 nvarchar(max) declare @summary2 nvarchar(max) set @summary1='this long text. rest of text' set @summary2='some text no full stops' select substring(@summary1, 1,charindex('.', @summary1)) sentence select substring(@summary2, 1,charindex('.', @summary2)) sentence i want able first sentence "summary" , if there no full stop return text. example @summary1 works fine no full stop in text nothing returned. anyone have bright ideas how can achieve this? i use case expression : select case charindex('.', @summary1) -- determine if sentence contains full stop when 0 @summary1 -- if not return whole sentence else substring(@summary1, 1, charindex('.', @summary1)) -- else first part end sentence

java - Pmd error regarding logger -

i have line in code: private transient final logger logger = loggerfactory.getlogger(getclass()); i build project , pmd check tells me that: the logger variable declaration not contain static , final modifiers. what can fix this? tried putting static modifier comes error: cannot make static reference non-static method getclass() type object if using in main make static and use logger this private static final logger log = logger.getlogger(main.class.getsimplename());

rally - Listeners on rallytextfield -

i grab text value input text field "workitemtextfield" can't keypress event fire below code. ext.define('customapp', { extend: 'rally.app.app', componentcls: 'app', _onworkitemkeypress: function() { console.log('in _onworkitemkeypress'); console.log(this); }, launch: function() { this.add({ title: 'time entry', width: 800, padding: 10, bodypadding: 10, renderto: ext.getbody(), layout: { type: 'vbox', align: 'bottom' }, items: [ { xtype: 'rallytextfield', itemid: 'workitemtextfield', fieldlabel: 'work item id', labelalign: 'top', listeners: { scope: this, keypress: this._onworkitemk

Setting up app development environment for Android -

i quite new big android world. going through first app go easy on me. there lots of api levels , lots of devices , think makes lots of hard stuff on android. so questions :- which minimum api level should choose , why ? which virtual device should start - there lots of options available ? should check ui every time when make changes on devices ? thanks. appreciated :) 1) there 2 ways here. right (2014/09) can go sdk 10+ or sdk 15+ . sdk 10 still has 12% of total active users. indicated here: https://developer.android.com/about/dashboards/index.html?utm_source=ausdroid.net supporting api 10+ pain, requires using lot of backports , compatibility libraries. you're in luck! it's pretty safe develop on sdk 15+, can see dashboards cover close 90% of devices. 2) can use genymotion . it's free small developers , beginners. can use native emulator it's laggy, if use intels hax , gpu rendering decent. have here. 3) yes , no. should develop best devi

ios - Is application bundle fully replaced on upgrade from App Store? -

the following use case: create strings file (not localized) , deploy application test device localize file (en.lproj or similar), make changes new file , remove original file deploy application on device what noticed (always?) application still use old non-localized file. reason apparently file still in somewhere application bundle, though has been removed project. ios's logic if file of specific type looked up, first checks in root of bundle non-localized version, , if doesn't find go deeper localized folders. (is me, or logic kind of backwards? i'm used first looking language specific file, , falling defaults, might java background.) sometimes (always?) removing app device doesn't either. in case cmd+shift+k, cleans build folder, , after app built , deployed again, correct file used. a worse problem if such thing leads app crash, strange issues nibs or whatever - have seen well... the question is: happen if first version of app in apple store had non

Graphics Drawing only drawing the last item in a ListBox C# -

i messing around drawing using simple graphics panel. adding multiple triangles create simple images. using simple list of objects hold of triangles. when tried make more interactive using list box can reorder, add, , remove in random spot drawing last item in listbox. guys have thoughts on why when use list work fine moment made listbox stopped?

wordpress queries not working in functions.php -

the following code, in functions.php file returning nothing, not hi: ... <?php wp_reset_postdata(); $qr = new wp_query(); while( $qr -> have_posts() ) { echo "hi"; $qr -> the_post(); echo comments_number('0', '1', '%'); } ?> try this: $qr = new wp_query(' '); while( $qr->have_posts() ) { echo "hi"; $qr->the_post(); comments_number('0', '1', '%'); } wp_reset_postdata(); first, have pass @ least wp_query . also, comments_number echoes result, don't need echo there.

java - Need help creating a program that finds lightest and heaviest dog -

i have huge amount of trouble java project. have write class keeps track of name, breed, date, , weight of dog must input file containing 1 line per dog. need accessor,modifier, arraylist , tostring method. main program needs determine lightest dog , heaviest dog. import java.io.*; import java.util.*; import java.util.arraylist; public class kennel { public static void main(string args[]) { string line = ""; // string var hold entire line if (args.length < 1) { system.out.println("\n forgot put file name on command line."); system.exit(1); }; string infile = args[0]; // file name off command line scanner sc = null; try { sc = new scanner(new file(infile)); } catch (exception e) { system.out.println("file not found"); system.exit(1); } // print message explaining purpose of program. system.out.println("\nthis program inputs file "); system.out.print

angularjs - How do I code a custom ordering function in angular? -

having <div class="item" data-ng-repeat="course in courses | filter:filtercourses | orderby:predicate">... and $scope.predicate = function(course) { //$scope.orderprop }; what code need put inside predicate can order same way default orderby:predicate order(not sure if makes sense) place empty course.startdate @ end of list notes: course object different properties title, startdate, code $scope.orderprop contains value sort by: title, startdate, code. when startdate empty place items @ end of list still keep sorting date properly, start date "integer" later display ng-date in nicer form thank you answer: here's ended http://jsfiddle.net/3hz2j8j7/ orderby can accept list of predicates (a bit saying "order a, b"). first predicate ensure blank start dates go @ end, , second 1 use value of orderprop: <div ... orderby:[nonemptystartdate, orderprop]"> $scope.nonemptystartdate = function

javascript - for var index in vs. forEach -

in javascript, if want loop through every element in array, have several methods that: 1. for(var =0; i<array.length; i++){} 2. array.foreach(function(item, index){}); 3. for (var index in array){} the first 1 common one, if feel lazy, want use second or third one. but wonder if there's difference between them, , in situation should choose which? they subtly different approaches. for(var = 0; i<array.length; i++){} tried-and-true method; feels c, works c. iterates on every array index , without corresponding property/item. works on object supporting .length , properties names [0..length); while works on sparsely-populated arrays additional guard may required. unlike foreach , allows use of continue/break/return manual adjustment of index within loop body, if such ever required. array.foreach(function(item, index){}) approach prefer because sufficient, feels cleaner, , "lazy" . iterates on every array value/index that ha

php - Wordpress - Display a post a week in advance -

i have speakers category each speaker set post the wordpress published date, date coming speak (so speakers posts "scheduled") there new speaker each week (every 7 days) on speakers page display "featured speaker of week" contains post information underneath featured speaker, list of upcoming speakers (just title, not whole post) what i'm trying accomplish have "featured speaker", show week (including day speaking), , once day after have spoken comes, show next person speaking on site week until have spoken , on , forth. i'm getting stumped on logic. doing until hit: if($postdatenum >= $todaynum + 6) which not work when it's different month. i know code convoluted , outdated, if can shed light on logic calculating 7 days thing, awesome. here's have far: <?php query_posts(array( 'post_type' => 'post', 'category_name' => 'speakers', 'showposts&#

c# - Know when first and last loop in foreach -

is there way find out when i'm @ first , last loop on foreach? foreach(string str in list){ if(str.isfirst(list) == true){...} if(str.islast(list) == true){...} } ^ this? for (int = 0; < list.length; i++) { if (i == 0) { // first iteration } if (i >= list.length - 1) { // last iteration } }

ios - -[NSDateComponents week] deprecated, which enum gives same behavior as before? -

the documentation nsdatecomponents says of ios 7, week deprecated , use weekofday or weekofyear instead. if want same logic got when used week , of these should use? i have used in many places in code, thinking through each scenario cumbersome. if there 1 enum mapped same thing week did, save lot of time. didn't find in documentation, have in code: nsdatecomponents *todaycomps = [calendar components:nsyearcalendarunit | nsmonthcalendarunit | nsweekdaycalendarunit | nsweekcalendarunit fromdate:[nsdate date]]; when printed todaycomps.week console got 39. so think should replace todaycomps.week todaycomps.weekofyear. don't forget use nsweekofyearcalendarunit instead of nsweekcalendarunit. good luck!