Posts

Showing posts from September, 2010

java - Maven: class not found compiling osgi bundle -

i have 3 osgi projects: projecta (has dependency projectb <scope>provided</scope> ) has class code ... classb b=new classb(); projectb (has dependency projectc <scope>provided</scope> ) has following class: public class classb extends abstractclassc{ ... } projectc has following class: public abstract class abstractclassc{ } projectb , projectc export necessary packages. in order: i compile projectc - ok. i compile projectb - ok. i compile projecta - throws abstractclassc not found. when add in projecta dependency projectc compiles without problem. why happen? understand projecta must compiled 1 dependency projectb. wrong? i've checked several times abstractclassc not used in projecta , not imported. first of all, can't make instance of classb unless know abstractclassc , code won't compile without reference. the main problem you're having, though, <scope>provided</scope> not transitive :

Rails: render_to_string without escaping HTML chars (i.e. < and >) -

i need export strings in markdown format (that lie in database) ms word docx format. decided use pandoc this. i have registered new mime type docx , can stuff in show.docx.erb file: # <%= @boilerplate.title %> ## <%= @boilerplate.class.human_attribute_name :intro %> <%= @boilerplate.intro %> ## <%= @boilerplate.class.human_attribute_name :outro %> <%= @boilerplate.outro %> then pandocruby.convert render_to_string(options), to: :docx . creates nice word document. but has problem: escapes html chars < , > , when have e.g. html code blocks in source, brackets escaped &lt; . i need unescaped string render_to_string(options) . possible? related issue: https://github.com/alphabetum/pandoc-ruby/issues/14 try <%= raw @boilerplate.into %> instead.

c++ - How to give a member function as a parameter? -

i struggling c++ templates, functions , bind. let's class a : class { void set_enabled_for_item(int item_index, bool enabled); void set_name_for_item(int item_index, std::string name); int item_count(); } i create method in a : template <typename t> void set_for_all_items(t value, ??? func) { auto count = trackcount(); (auto = 0; < count; ++i) { func(i, value); } } so call member function of in parameter, (or this) : auto = new a; a->set_for_all_items("foo bar", &a::set_name_for_item); the 3 ??? type of second paramter. since i'm pretty new std::function, std::bind , templates, tried knew use got compilation errors. so how ? the syntax standard member function ret (class::*) (args...) . in case, might (untested): template <typename t, typename arg> void set_for_all_items(t value, void (a::* func) (int, arg)) { auto count = trackcount(); (auto

Simple Selenium RegEx Java -

i not familiar how use reg ex within selenium, hoping assistance this. currently, when run, doesn't locate elements not surprising. list<webelement> elements = seleniumcommands.mydriver.findelements(by.id("assessment-answer-{[0-9]+}-1")); the ids of i'm trying grab like <input id="assessment-answer-5713185-1" ...> here larger html parse of site selection-writing purposes. <div id="assessment-page-1"> <ul id="question-row-5713185" class="plus-card card-white question-row"> <li id="question-collapsible-5713185" class="question-collapsible"> <li id="answers-container-5713185" class="answers-container"> <div class=" assessment-two-answers"> <input id="assessment-answer-5713185-1" type="radio" value="1" name="assessment-answer-5713185"/> <label class=&q

c# - Outlook code compile error due to `Application` reference missing -

Image
i trying write c# code interact outlook 2010. using this example microsoft . my code follows: using system; using system.text; // stringbuilder using system.diagnostics; // debug using system.linq; using system.reflection; using system.runtime.interopservices; using outlook = microsoft.office.interop.outlook; namespace directreports { public class program { private void getmanagerdirectreports() { outlook.addressentry currentuser = application.session.currentuser.addressentry; //outlook.addressentry currentuser = outlook.application.session.currentuser.addressentry; if (currentuser.type == "ex") { outlook.exchangeuser manager = currentuser.getexchangeuser().getexchangeusermanager(); if (manager != null) { outlook.addressentries addrentries = manager.getdirectreports(); if (

ios - AFNetworking background downloading automatically stop after some time, I need to resume it -

i using afnetwork (its base on nafdownloadrequestoperation) , task in downloading multiple zip files 1 one amazon bucket. when app in foreground every thing working well, when app goes in background mode time downloading running time , automatically stop. read blog in following method called before downloading stop. [self.operationupdate setshouldexecuteasbackgroundtaskwithexpirationhandler:^{ nslog(@"downloading stop"); }]; problem in background mode downloading automatically stop what want : if downloading stop in background , when app again comes foreground need resume downloading point. i use following code in appdelegate not understand how resume previous downloading. __block uibackgroundtaskidentifier backgroundtaskidentifier = [application beginbackgroundtaskwithexpirationhandler:^(void) { [application endbackgroundtask:backgroundtaskidentifier]; nslog(@"applicationwillresignactive"); [__se

Deploying Ruby on Rails 2.3 on Production -

am sorry noobness this, i developing ruby on rails application on ubuntu 14.04. development, i'm starting application using ruby script/server . ruby -v 1.8.7 rails -v 2.3.14 mysql now question how deploy on production? planning use ubuntu 14.04 server well. i read phusion passenger did not understand for. i hoping make ubuntu server localhost. if point browser myrailsapp , application available (normally use script/server ). have use script/server command everytime server restart? please tell me if im on right track. ------------ follow tutorial -------------- i follow tutorial 1 can't figure out how make virtual host working created virtual host this: /etc/hosts 0.0.0.0 example.com /opt/nginx/conf/nginx.conf server { listen 80; server_name example.com; passenger_enabled on; location / { root /opt/nginx/html/ror/blog/public; } } on browser 403 forbidden , have start rails app script/server? try foll

python - How can I configure pytest to generate useful names when generating tests? -

i'm using py.test execute suite of selenium tests. i'm running collector in conftest.py generates tests (i stole pytest documentation): def pytest_generate_tests(metafunc): funcarglist = metafunc.cls.cases[metafunc.function.__name__] argnames = list(funcarglist[0]) metafunc.parametrize(argnames, [[funcargs[i] in argnames] funcargs in funcarglist]) my test cases placed in objects this: class testobject(object): def __init__( self, parameter_1, ): self.parameter_1 = parameter_1 self.parameter_2 = parameter_2 i instantiate them this: test_cases_values = { "friendly_case_name_1": testobject( "parameter_1_value", "parameter_2_value" ), "friendly_case_name_2": testobject( "parameter_1_value", "parameter_2_value" ), } my browsers attached grid server, make list of them this: browsers = [

django - Combining unrelated Models in Formset and saving results -

these models related problem: models.py class sequencediagram(models.model): name = models.textfield(blank=true) attributemappingname = models.textfield(blank=true) class attributefilter(models.model): seqdiagram = models.foreignkey(sequencediagram) attributename = models.textfield(blank=true) protocol = models.textfield() isdisplayed = models.booleanfield(default=false) class attributemapping(models.model): mappingname = models.textfield() protocol = models.textfield(blank=true) nativename = models.textfield(blank=true) customname = models.textfield(blank=true filters specific each sequencediagram mappings generic , applicable different diagrams. i want formset attributefilters , attributemappings linked sequencediagram. these displayed in table isdisplayed , customname can edited , saved database. how can combine them formset , save users changes? can many-to-many relationship solve problem? if so, in end should defined?

openid connect - Equivalent of SAML's back-channel Single Log-out in OIDC? -

for openid connect, there equivalent of saml's soap-based single log-out protocol enable identity provider ability terminate remote sessions in rp application? necessary component several security requirements in enterprise environments including not limited to: enact limits on number of concurrent sessions terminating previous sessions. ability administrators terminate specific sessions or sessions given user. ability terminate sessions upon other trigger events, such password change. that not part of core openid connect specification ( http://openid.net/specs/openid-connect-core-1_0.html ), nor implementers draft extension session management ( http://openid.net/specs/openid-connect-session-1_0.html ) btw. include "javascript postmessage based" frontchannel logout. there work-in-progress on separate logout extension openid connect may standardize backchannel logout, see: http://openid.net/specs/openid-connect-logout-1_0.html , esp. chapter 2 http://

reporting services - Limit the displayed data on first page of Report then continue to next page -

can me achieve this. have report displays monthly attendance of employees.(the columns employeename, monday, tuesday, wednesday, thursday, friday, saturday, sunday , totalworkhours sum of hours monday sunday). want display these columns in first page, continue on next page. report displays wide page depends on given date range.let me know if explanation unclear

sql server 2008 - Limited result is coming when I run Join query? -

i getting only 5001 rows of result when run query: select case v_all.job_qty_blankpages when 0 v_all.job_qty_bwpages + v_all.job_qty_colorpages + (v_all.job_qty_blankpages + ((v_all.job_qty_simplexpages + v_all.job_qty_duplexpages * 2) - (v_all.job_qty_bwpages + v_all.job_qty_colorpages))) else v_all.job_qty_bwpages + v_all.job_qty_colorpages + v_all.job_qty_blankpages end printedpages, v_all.job_qty_bwpages bwpages, v_all.job_qty_colorpages colorpages, case v_all.job_qty_blankpages when 0 v_all.job_qty_blankpages + ((v_all.job_qty_simplexpages + v_all.job_qty_duplexpages * 2) - (v_all.job_qty_bwpages + v_all.job_qty_colorpages)) else v_all.job_qty_blankpages end blankpages, v_all.job_qty_simplexpages simplexpages, v_all.job_qty_duplexpages * 2 duplexpages, v_all.job_qty_simplexpages + v_all.job_qty_duplexpages totalsheets, v_all.job_lab_ntdomainname, v_all.lab_groupname, v_a

haskell - RethinkDB: convert ReQL to an Integer type -

cannot figure out how convert reql type i insert document , result object "errors" key. need see if 0 or not? so simple function this: saveperson :: handler () saveperson = let load = fromjust . extract ["data", "attributes"] doc <- load <$> jsonbody' res <- rundb $ table "articles" # insert doc if (res r.! "errors") == 0 setstatus status204 else setstatus status500 this obveously not compile gives example of want. need convert reql integer comparison. how convert types reql haskell types? thanks edit apologies not providing data types. import web.spock (runquery) import database.rethinkdb.noclash rundb :: (result a, expr q) => q -> handler rundb act = runquery $ \hdl -> run hdl act rundb' :: expr q => q -> handler datum rundb' act = runquery $ \hdl -> run' hdl act edit2 thank atnnn answer first example works. still cannot figure out reql conversion. b

angularjs - How to test promise in jasmine & karma -

i have test case follow: it("should have valid structure", function(done){ var data; module(app_module_name); inject(function(_metaservice_){ metaservice = _metaservice_; }); metaservice.fetchentitymeta('person').then(function(data){ expect(data.status).tobe( true ); done(); }); }); but getting following error: error: timeout of 2000ms exceeded. ensure done() callback being called in test. i have increased jasmine.default_timeout_interval not use. following code work. settimeout(function(){ expect(true).tobe(true); done(); }, 5000); so, understanding having problem promise. question how can check data returned promise. you not calling done() callback anywhere in test. change last statement to metaservice.fetchentitymeta('person').then(function(data) { expect(data.status).tobe(true); done(); }); another option is metaservice.fetchen

knockout.js - restore page status, knockout site tutorial section -

this how knockout site restore page status. every time go page http://learn.knockoutjs.com/#/?tutorial=intro , type in click run button, , go site, click button browser go tutorial page. page prompt window saying "you've been on introduction before. continue left off?". how implement that? in advance.

php - onsite booking for expedia by rest api calling using curl post -

onsite booking process using rest api calling data booking process.but problem when set form url :- $url = 'https://book.api.ean.com/ean-services/rs/hotel/v3/res? minorrev=99 &cid=55505 &sig=1893d9f7e3e9fbd3f8a36f43cd61287d &apikey=1bn8n4or4tjajq23fe4l6m18lp &customeruseragent=mozilla/5.0 (windows nt 6.1; wow64; rv:38.0) gecko/20100101 firefox/38.0 &customeripaddress=223.30.152.118 &customersessionid=e80df6de9008af772cfb48a389465415 &locale=en_us &currencycode=usd &hotelid=106347 &arrivaldate=10/30/2015 &departuredate=11/01/2015 &suppliertype=e &ratekey=469e1aff-49de-4944-a64d-25d96ccde3aa &roomtypecode=200127420 &ratecode=200706716 &chargeablerate=257.20 &room1=2,5,7 &room1firstname=test &room1lastname=testers &room1bedtypeid=23 &room1smokingpreference=ns &email=test@yoursite.com &firstname=tester &lastname=testing &homephone=2145370159 &workphone=2145370159 &creditcar

EnsureUser using email address in SharePoint client object model -

i need update fielduservalue field in sharepoint 2013. given email address data. can't user ensureuser since accepts logonname. used fromuser method gives me error says "the user not exist or not unique" fielduservalue user = fielduservalue.fromuser(email); it worked when tried using email address when use email addresses in data results in error. how fix issue? you resolve user email address using utility.resolveprincipal method , example: var result = microsoft.sharepoint.client.utilities.utility.resolveprincipal(ctx, ctx.web, emailaddress,microsoft.sharepoint.client.utilities.principaltype.user,microsoft.sharepoint.client.utilities.principalsource.all, null, true); ctx.executequery(); if (result != null) { var user = ctx.web.ensureuser(result.value.loginname); ctx.load(user); ctx.executequery(); } references get user identity , properties in sharepoint 2013

c++ - Memory Mapped FIle is slow -

i trying read memory mapped file, access file taking long time. mapping whole file program, , initial access fast, begins drastically slow down the file ~47gb , have 16gb of ram. running 64-bit application on windows 7 using visual studios ide. below snippet of code hfile = createfile( "valid path file", // name of write generic_read , // open reading 0, // not share null, // default security open_existing, // existing file file_attribute_normal, // normal file null); // no attr. template if (hfile == invalid_handle_value) { cout << "unable open vals" << endl; exit(1); } hmapfile = createfilemapping( hfile, n

java - what these buzz words actually stand for? -

m2e :- know maven 2 eclipse 2 stands maven version 2 or english literal "to" ? j2ee :- java 2 enterprise edition 2 stands java version 2 or english literal "to" ? both "version" numbers. j2ee no longer used, it's java ee. i suspect m2e meaning maven 2, evolved name.

Show WPF window with WindowStyle=None and no resize -

Image
i'm trying display window border windowstyle="none" (picture 2), without option resize it! when set resizemode="noresize" border disappears (picture 1) does know how this? you can around setting max , min size properties same values, forcing window have fixed size. should work: window w = new window(); w.maxheight = w.minheight = 300; w.minwidth = w.maxwidth = 400; w.windowstyle = system.windows.windowstyle.none; w.show();

React Native : Is it possible (/how) to pass props to a class of static functions? -

normally when passing props, 1 like: var myclass = require('./myclass.js'); <myclass prop1={prop1} prop2={prop2} /> these available in this.props scope of child component. if have helper class has static functions in it. how pass props class? declaration simply var myhelperclass = require('./myhelperclass.js'); the contents similar to var myhelperclass = react.createclass({ getinitialstate: function(){ return null; }, statics: { functionone: function(string){ var returnobject = {}; // this.props.. return returnobject; }, }, render: function() {} }); for i've created initalise function call in componentdidmount passes of data , function references down helperclass i'm curious. if myhelperclass stores static functions , doesn't render anything, create own store them. here's how package api calls: var api = { getallposts: function(token, daysago) { daysago = daysago || 0;

php - How i can enable WordPress Posts Pagination -

how can enable pagination in page (template page wordpress) my code <?php $catquery = new wp_query( 'cat=2&posts_per_page=10' ); while($catquery->have_posts()) : $catquery->the_post(); ?> <div> <br /> <div class="news"><!-- start news box --> <div class="img_news"><!-- start image news --> <?php $url_thumb = wp_get_attachment_url( get_post_thumbnail_id($post->id) ); ?> <img class="img_thumbs" title="" alt="" src="<?php echo $url_thumb; ?>"> </div><!-- end image news --> <div class="title_news"><!-- start title news --> <h2> <?php the_title(); ?> </h2> <div class="details"> <?php the_content_limit(500, "read more..."); ?> </div> </div><!-- end title news --> <hr> </div><!-- end news box --> </div> <?php endwhile

php - Implement a State Pattern with Doctrine ORM -

i have class using state pattern. here's simple example /** * @enitity **/ class door { protected $id; protected $state; public function __construct($id, doorstate $state) public function setstate(doorstate $state) { $this->state = $state; } public function close() { $this->setstate($this->state->close()) } ... } interface doorstate { public function close; public function open; public function lock; public function unlock; } class dooraction implements doorstate { public function close() { throw new doorerror(); } ... } then several classes define appropriate actions in states class openeddoor extends dooraction { public function close() { return new closeddoor(); } } so have thing like $door = new door('1', new openeddoor()); doctrinedoorrepository::save($door); $door->close(); doctrinedoorrepository::save($door); how implement mapping in doctrine can persist it? i'm hung o

javascript - How to check if element exists after the current element with jQuery? -

i need check following if after $('.brandmodellinewrapper') there isn't clearfix div, add it: $('.brandmodellinewrapper').after("<div class='clear'></div>") how that? you can use .next() :is selector check if div class clear. , can use .after() or insertafter() append clear div based on first condition: if(!$('.brandmodellinewrapper').next().is('div.clear')){ $('.brandmodellinewrapper').after("<div class='clear'></div>"); }

r - Get the SHA of the version used when run -

is possible sha of version of code being run in r? i have following code, outputs sha master head: readme<-file("info.txt") writelines(paste(c("document produced using version", paste(readchar("./.git/refs/heads/master", 10)), "of code")), readme) close(readme) but if makes mistake , accidentally runs code different branch? possible r active branch that? possibly this, activebranch figured out other bit of r code? readme<-file("code version info.txt") writelines(paste(c("document produced using version", paste(readchar(paste("./.git/refs/heads/", activebranch, collapse = ""), 10)), "of git instructions")), readme) close(readme)

How to track the GPS coordinates as user walks, from xamarin.forms for ios platform -

i went through link to track gps co-ordinates of current location user walks xamarin.forms app (ios platforms) but not find how it, born new xamarin.forms, can in xamarin.forms or should create xamarin ios project? any links/tutorials track user location through xamarin.forms ios platfomrs appreciated, in advance. we used xamarin-forms-labs this. works perfect xamarin.forms on platforms. for more information: geolocator

performance - Java: Find similar strings -

i have java list (it map if necessary) lot of strings. list(hello,hell,car,cartoon,...) i want find similar strings given string in efficient way. i think should use levenshtein distance, don't want iterate through list. do think idea divide main list in pieces common prefix? then have map prefixes key , list value: hel -> list(hello,hell,...) car -> list(car,cartoon,...) in way search strings same prefix searched one. apply levenshtein distance strings , not main-list. is idea? thanks you once calculate soundex code of every entry, , map soundex list of original word. soundex reducing code 1 single key similar sounding words. map<string, set<string>> soundextowords = ... (string word : words) { string sdex = soundex(word); set<string> similarwords = soundextowords.get(sdex)); if (similarwords == null) { similarwords = new hashset<>(); soundextowords.put(sdex, similarwords); } sim

python - Creating template from different block in django? -

i trying create single page different content different template in django can print it. kind of summary of different page base.html - maincontent block rendered inside template main.html - need maincontent block here graph.html - need maincontent block here charts.html - need maincontent block here summary.html - need content main, graph, charts here (require) i have base template extended on every page (it has navbar, footer , sidebar) {% extends "base.html" %} there block inside base template graph, main, chart content displayed. trying accomplish maincontent page , add new template called summary.html since every page extending base not sure how that? tried using include include base every page. edit: know can separate maincontent own separate files have lot of templates , looking other solutions. you separate content. i guess have this: <!-- graph.html --> {% extends "base.html" %} {% block 'maincontent'%}

objective c - Compile-time warning about missing category method implementation -

in our xcode project have multiple targets share common code. each target includes sources used it. when use category methods inside classes shared between targets need make sure category implementation included in targets. xcode doesn't show warnings during compile time or link time if forget include category implementation of targets. , troublesome hand. is there automated way ensure category implementations included targets use them? categories not automatically linked final binary. they linked if linker finds file defined used (which source of constant bug times ago). what can use special flag on linker: '-all_load' , '-objc' in build settings/linking/other linker flags -objc loads members of static archive libraries implement objective-c class or category. and discussion : -all_load , -force_load tell linker link entire static archive in final executable, if linker thinks parts of archive unused. another way use force link m

android - Why do I need to add the configuration file to my project to setup gcm correctly? -

https://developers.google.com/cloud-messaging/android/client i've read article. , says need download , add configuration file project. not explain, why should this? won't work without adding configuration file? i working on multiple gcm-projects still using eclipse, eclipse-adt-plugin , old project structure , did not include config-file projects. confused @ beginning , hence tried in android-studio project using gradle config file not necessary either. so rémond´s answer might make sense me working fine (including generating instanceid-token , topic-messaging working). so in fact, should work without adding file , not need file anyway.

html - Combining two regular expressions in java -

i have text this: [image]bdaypic.jpg[caption]my pic[/caption][/image] i should output as: <figure><img src='bdaypic.jpg'/><figcaption>my pic</figcaption></figure> i'm using below code: string = string.replaceall("\\[image\\](.*?)\\[\\/image\\]", "<figure><img src='$1'/></figure>"); string = string.replaceall("\\[caption\\](.*?)\\[\\/caption\\]", "<figcaption>$1</figcaption>"); but i'm getting output <figure><img src='bdaypic/><figcaption>my pic</figcaption>'</figure> [caption][/caption] optional.if there should replaced tag. the problem seems lie within first replace. capturing between [image] tag , replacing quoted version of content. merged 2 expressions , got after: string string = "[image]bdaypic.jpg[caption]my pic[/caption][/image]"; string=string.replaceall("

How to make POST call using HttpURLConnection with JSON data in Android -

please me out problem. want make post call json data should appear in body request not able that. made post call , getting data data not in json format. code : data = "{'mobile':'"+mobile_number+"','password':'"+mypassword+"'}"; byte[] datapost = data.getbytes(); urlconnection = (httpurlconnection) url.openconnection(); urlconnection.setdooutput(true); urlconnection.setchunkedstreamingmode(0); urlconnection.setinstancefollowredirects(false); urlconnection.setrequestproperty("accept", "application/json"); //urlconnection.setrequestproperty("content-type", "application/json"); urlconnection.setrequestproperty("charset", "utf8"); urlconnection.setusecaches(false); outputstream os = urlconnection.getoutputstream(); os.write(datapost); os.close(); result coming below body: {'a':'b','c':'d'}:"" please me. new and

smartcard - Select by AID command is not working -

i want re-develop new desktop application read information emv smart card , i have logs previous (working) application . assume, there app aid = 44 44 44 44 44 44 44 44 (dddddddd) in emv smart card. i sending apdu command: 00 a4 04 00 08 44 44 44 44 44 44 44 44 00 , getting timeout exception (timeout = 60s). i tried send apdu command: 00 a4 04 00 08 44 44 44 44 44 44 44 44 , got response code = 61 37. i tried select file 1pay.sys.ddf01, got response = 6a82 (it right). error code 61xx means receive data after calling response command le=xx: example: --> 00 a4 04 00 08 44 44 44 44 44 44 44 44 <-- 61 37 --> 00 c0 00 00 37 <-- data of length 0x37 , status code 90 00. related question: about response command in javacard docs oracle: there may several apdu connections open @ same time using different logical channels same card. however, since apdu protocol synchronous, there can no interleaving of command , response apdus across logical cha

r - error in calculation of relative frequency of groups based on different combinations -

i calculate frequency , relative frequency of categorical variables based on different combinations. have calculated frequency , not successful in piping output relative frequency calculation. me in identifying error ? # random generation of values categorical data set.seed(33) df <- data.frame(cat1 = sample( letters[1:2], 100, replace=true ), cat2 = sample( letters[3:5], 100, replace=true ), cat3 = sample( letters[2:4], 100, replace=true ), var1 = sample( letters[1:3], 100, replace=true ), var2 = sample( letters[3:8], 100, replace=true ), var3 = sample( letters[2:3], 100, replace=true ), vre1 = sample( letters[2:7], 100, replace=true ), vre2 = sample( letters[1:5], 100, replace=true ), ref3 = sample( letters[2:9], 100, replace=true ), con1 = runif(100,0,100), con2 = runif(100,23,45)) # calculating frequency library

jquery - Change class in all TDs that are children to a given TH? -

simple question (i think) - want add checkbox few table headers (th) in given table, , when checked should add class tds in column, , vice versa - when unchecked should remove class tds in specific column. is doable jquery? can't figure out... it possible. here 1 solution. $("th input[type=checkbox]").on("click", function () { var index = $(this).parent().index() + 1; $("td:nth-child(" + index + ")").toggleclass("highlight"); }); table, tr, th, td { border: 1px solid black; border-collapse: collapse; } .highlight { background-color: red; color: white; } <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <table> <thead> <tr> <th>column 1 <input type="checkbox" /> </th> <th>column 2

python - Translation in Django 1.6.5 -

recently had been working on website made 2 or 3 years ago predecessor (i write because app mess , it's not fault). boss asked me make multilingual adding english version. followed instructions djangoproject docs, made nice .po , .mo files in locale directory, set urls i18n views , added form proper select html. problem is, when send post language code setlang view i18n, django not change language nor throw errors. unfortunately, in 1.6.5, django.utils.translation doesn't have language_session_key, don't know how should change session data... so, here have settings: """ django settings profilaktyka project. more information on file, see https://docs.djangoproject.com/en/1.6/topics/settings/ full list of settings , values, see https://docs.djangoproject.com/en/1.6/ref/settings/ """ # build paths inside project this: os.path.join(base_dir, ...) import os import time socket import gethostname root = base_dir = os.path.dirname(os.path.di

asp.net mvc - Error page in MVC while error occurred from Ajax call -

in mvc application using custom error attribute class inherited handleerrorattribute globally handle exceptions. my objective : showing error page while exception occurred. showing custom error page. in application of control action method called using ajax.i able show error page when exception occurs controller action ajax call not used in case of ajax call error logged error page not displaying. set error trap in ajax setup: $.ajaxsetup({ error: function(jqxhr, exception) { if (jqxhr.status === 0) { alert('not connect.\n verify network.'); } else if (jqxhr.status == 404) { alert('requested page not found. [404]'); } else if (jqxhr.status == 500) { alert('internal server error [500].'); } else if (exception === 'parsererror') { alert('requested json parse failed.'); } else if (exception === 'timeout') { alert(&

ios - Use of unimplemented initializer 'init(realm:schema:)' when calling Realm().objects -

i'm trying retrieve realm's objects using realm(path: realm.defaultpath).objects(fruits) this in result: 12: 7: fatal error: use of unimplemented initializer 'init(realm:schema:)' class db.fruits the object has following init: required init() { super.init() nextprimarykey() } i've gone through information init()s issues, none of them solved problem (including almost-exact question ). idea how solve it? overriding init is supported . however, may run issue when using convenience init designated initializer if override required init . can fixed removing required init . for example: required init() { super.init() } convenience init(dict: [string: anyobject]) { self.init() // custom init work } should become: convenience init(dict: [string: anyobject]) { self.init() // still calling self.init(), not super.init() // custom init work }

java - imageIO to open .HDR file -

i need open .hdr file , work on it, imageio doesn't supports format. the problem need keep information loss little possible: 32bpc perfect, 16 fine , less 16 won't work. there 3 possible solutions came to: find plugin allow me open .hdr file. i've been searching lot without luck; find way convert .hdr file format can find plugin for. tiff maybe? tried still no luck; reduce dynamic range 32bpc 16bpc , convert png. tricky because once have png file win, it's not easy cut range without killing image.. what recommend me do? know way make 1 of 3 options works? or have better idea? you can read .hdr using imageio . :-) this first version, might little rough around edges, should work standard (default settings) radiance rgbe .hdr files. you'll have download , build project sources now, i'll hope make release soon. the returned image custom bufferedimage databufferfloat backing (ie., samples in 3 samples, 32-bit float interleaved rgb for

javascript - Codemirror's Onload Function -

trying instance of codemirror using angularjs's tabs. <p ng-bind-html="tab.content | unsafe"></p> insert textarea: <tabset class="tab-container"> <tab id = "tabcontent" ng-repeat="tab in tabs" active="tab.active"> <script> </script> <tab-heading> <span>{{tab.title}}</span> <i class="glyphicon glyphicon-remove" ng-click="removetab($event, $index)"></i> <!-- tab close button --> </tab-heading> <p ng-bind-html="tab.content | unsafe"></p> </tab> <button class="btn btn-default" ng-click="addtab()"></button> </tabset> when add tab.content in, first add html tags around text in order insert textarea: var formattext = function(text){ return "<textarea ui-codemirror='cmoption' ng-model='cmmode

framelayout - scrolling up in webview causes refresh by SwipeRefreshLayout -

i have webview inside framelayout, add tabs because creating browser. framelayout inside swiperefreshlayout. the problem: whenever scroll content fast in webview, refresh icon appears behind toolbar. should happen when webview content @ top. has framelayout, when remove it, issue gone. the layout looks this: <swiperefreshlayout android:id="@+id/swiperefresh" android:layout_width="match_parent" android:layout_height="match_parent" > <framelayout android:id="@+id/webviewframe" android:layout_width="match_parent" android:layout_height="match_parent" > <webview android:id="@+id/webview" android:layout_width="match_parent" android:layout_height="match_parent" /> </framelayout> </swiperefreshlayout> just implement fragment

Android: Custom Animation lost after Orientation change -

i've done ton of research , literally tried can think of. basically, have 3 activities activity 1 -> activity 2 -> activity 3 i have set slide_left , slide_right animation files. when user clicks go activity 2 - page slides in right. but, when user clicks go (the home button on action bar). should slide in opposite direction. when gets activity 3 , user rotates device, slide animation going in wrong direction. =( occurs when user rotates device. oncreate() // override animation animates slide in left overridependingtransition(r.anim.slide_left_in, r.anim.slide_left_out); it's loses animation changes when user rotates device. i found bug: https://code.google.com/p/android/issues/detail?id=25994 does know of work around?? what's best way handle this?? i figured out! in oncreate() method: // run animation if coming parent activity, not if // recreated automatically window manager (e.g. device rotation) if (savedinstancestate == null) {

javascript - Jquery empty() or remove() wont work -

i working on little game practicing jquery , php. clicking on right spot you'll go next question or have fail. checking right answer use img(img of question) usemap <img id="questions" src="../img/items/question1.png" style="height: 450px;width: 700px;" usemap="#result"> <map name="result"> </map> as can see, map has no area's. add in script: $(document).ready(function(){ var score = 0; var answer1 = '<area class="true" shape="circle" coords="145, 175, 40" href="#">'; var entireimg = '<area class="false" shape="rect" coords="0, 0, 700, 450" href="#">'; $(answer1).appendto('map'); $(entireimg).appendto('map'); $('.true').click(function(){ score++; $('#questions').attr({src: "../img/items/question2.png"})

javascript - onkeyup Event Firing delay -

i have input textbox people enter username, has onkeyup event attribute attached fires off ajax request check if username taken. what delay between first key second ? meaning if type 5 letter word 1 letter after other. ajax fire 5 times ? if there no delay, "computationally expensive" since there many database queries ? or there no noticeable difference ? if there difference in performance, methods take using javascript check if user "done" typing. still want automatically check after typing. ruling out onblur attributes etc. my code: http://pastebin.com/hxfgk7nl (code indentation wasn't working me on stack overflow) yes, fire every key-up event. can reduce performance hit using following approach. i sure must have minimum character length username . wait until user type number of characters query database. you bring usernames starting user typed username , process in local memory . may not real time reduce number database queries. de

Is there a predefined no-op Action in C#? -

this question has answer here: c#: create do-nothing action on class instantiation [duplicate] 2 answers .net framework supported empty action syntax or singleton 1 answer some functions expect action argument don't need in cases. there predefined no-op action comparable following? action noop = () => {};

android - How to square a custom view when layout_height and layout_width are set to have different magnitudes? -

as per understanding when user specifies views height/width in pixels/dp, view receives spec mode. spec mode means view must use size. suppose want make sure view remains square. how can achieved if user sets different values layout_height , layout_width. override onmeasure custom view, determine smallest dimension is, , set both width , height minimum dimension. something like: @override protected void onmeasure(int widthmeasurespec, int heightmeasurespec) { super.onmeasure(widthmeasurespec, heightmeasurespec); int specwidth = measurespec.getsize(widthmeasurespec); int specheight = measurespec.getsize(heightmeasurespec); int lesserdimension = (specwidth > specheight)?specheight:specwidth; setmeasureddimension(lesserdimension, lesserdimension); }

visual studio 2010 - Changing encoding while merging in TFS -

we're using tfs , visual studio's source control (2010) version control tools in our java project. there 2 branches, 1 in cp1251 encoding (source), , other in utf-8 (target). there way merge these 2 branches correctly? mean, encoding of both source , target branches should stay now. sry poor english , maybe incorrect question, new version control tools

javascript - Grid system for a 3D Earth -

so basically, tasked "recreating" 3d earth, comprised of (very small) tiles made of nasa landsat 8 images (png). each point on earth imaged once every 16 days or so, , api i'm using serves latest images (ie can't compiled offline , used statically) . these tiles ~150kb each, , have width , height of 0.025 lat/long. means i'll have use static mesh low zoom levels, , user zooms in, landsat tiles dynamically generated based on viewport. have of built 3d earth custom tiling before? looking @ webgl earth api , it's limited. i've taken @ cesium , i'm not sure if it's capable of want do. basically, i'm looking 3d model of earth (or sphere) allow me "stick" images specific lat/lon points. otherwise, suppose i'll have make sphere in threejs , calculations myself, i'm afraid without using pre-existing map system (like leaflet ), whole thing come out totally inaccurate. cesium can want quite easily. depending on api u

android - Failed to resolve: com.github.ozodrukh:CircularReveal:1.1.0 -

i'm trying import library ( https://github.com/ozodrukh/circularreveal ) project writing: compile 'com.github.ozodrukh:circularreveal:1.1.0@aar' but error : error:(25, 13) failed resolve: com.github.ozodrukh:circularreveal:1.1.0 <a href="openfile">show in file</a><br><a href="open.dependency.in.project.structure">show in project structure dialog</a> i dont understand why since have succeded in importing other libraries way. on github page of repository: this library not released in maven central, instead can use jitpack. add remote maven url: repositories { maven { url "https://jitpack.io" } } might possible forget add gradle file?

wpf - CMD command on c# -

i need write windows form app, wpf, or console application should run command prompt: @echo off echo test or del c:\b.txt the c# code needs on button it's not important now. tried this: using system; using system.diagnostics; using system.componentmodel; private void button1_click(object sender, eventargs e) { process process = new process(); process.startinfo.filename = "cmd.exe"; //process.startinfo.workingdirectory = "c:\temp"; //process.startinfo.arguments = "somefile.txt"; process.start("cmd", "/dir"); } but can't put cmd code in ^ code. i believe want this: process p = new process(); processstartinfo psi = new processstartinfo("cmd.exe"); // add /c command, space, command psi.arguments = "/c dir"; p.startinfo = psi; p.start(); the above code allows execute commands directly in cmd.exe instance. example, launch co

watchkit - How to make HKworkoutsession always an active workout session -

i'm working on apple watch app , i'm using hkworkoutsession access heart rate data sample. in newest watchos2 beta3 release bug "during active workout session, new heart rate samples not generated when screen off." fixed. my question how set hkworkoutsession "active work out session" keep getting heart rate sample need. thanks ryan code following how start or stop workout session. let healthstore = hkhealthstore() healthstore.startworkoutsession(workoutsession) { (result: bool, error: nserror?) -> void in } healthstore.stopworkoutsession(workoutsession) { (result: bool, error: nserror?) -> void in } there hkworkoutsessiondelegate notifies session state. protocol hkworkoutsessiondelegate : nsobjectprotocol { func workoutsession(workoutsession: hkworkoutsession, didchangetostate tostate: hkworkoutsessionstate, fromstate: hkworkoutsessionstate, date: nsdate) func workoutsession(workoutsession: hkworkoutsession, didfai