Posts

Showing posts from September, 2014

Automatically adding file locations (pictures) to an Access database via PowerShell or Python -

i have microsoft access database, , pictures have file names matching entries in database (though part of file name irrelevant). need read file names , insert links them database attached correct entries. i've been playing around powershell , python while, have little experience access , can't find lot of documentation on subject. questions are: am better off using powershell, python, or else project? happen have experience 2 languages they're preferred jumping off point. i imagine take amount of work , don't mind getting hands dirty/doing lot of research, after looking around can't seem find place started. there specific commands, documentation, functions, etc. give me jumpstart on project? thanks! edit: @ako bringing point , concerned about. putting photos in db bad idea, i'd instead host them elsewhere automatically have links files generated in db based on file names , matching db entries.

stata - Check if varlist contains factor variables? -

i trying check if varlist in program contains factor variables. follow recommendation statacorp in page ( http://www.stata.com/support/faqs/programming/factor-variable-support/ ). suggested codes are: syntax varlist(fv) local fvops = "`s(fvops)'" == "true" | _caller() >= 11 if `fvops' { // within loop, can expand factor variable list, // create local version control , perform other // steps needed factor operated varlists } nevertheless, appears me macro s(fvops) not check existence of factor variables in varlist . simple example illustrate: capture program drop test_fvops program test_fvops syntax varlist(fv) local fvops = "`s(fvops)'" == "true" | _caller() >= 11 qui reg `varlist' if `fvops' { di "factor variables specified" } else { di "factor variables not specified" } end sysuse auto,clear test_fvops price mpg foreign weight i.rep78 test_fvops price mpg foreign we

WASAPI Exclusive Event Driven skip detection -

i have app uses wasapi exclusive event driven mode. microsoft example code not far i'm doing. have problem if cpu taxed enough, skip on 1 of 3ms buffers supposed write. in exclusive event driven mode, there appears no way check write cursor. in shared mode, getcurrentpadding(), nothing exclusive mode. there no way know whether got behind or skipped ahead or whatever. saw capture, there audclnt_bufferflags_data_discontinuity flag. there similar iaudiorenderclient? when call getbuffer(), how know play cursor position pointer corresponds to? seems surprisingly easy out of sync without knowing it. watch clock , error out if funny happens, want more deterministic. want know sure missed buffer before barf out user.

c# - Can't add selenium ide extension to webdriver -

any suggestion why code below not adding extension? firefoxprofile profile1 = new firefoxprofile(); profile1.addextension(@"c:\\downloads\\selenium-ide-2.5.0.xpi"); iwebdriver driver1 = new firefoxdriver(profile1); the same code working fine firebug add-on. think there compatibilty error latest firefox. tried install 2.0.0 version of selenium ide didnt help. it might help.... file file = new file("firebug-1.8.1.xpi"); firefoxprofile firefoxprofile = new firefoxprofile(); firefoxprofile.addextension(file); firefoxprofile.setpreference("extensions.firebug.currentversion", "1.8.1"); // avoid startup screen webdriver driver = new firefoxdriver(firefoxprofile);

python - Django REST Framework: return 404 (not 400) on POST if related field does not exist? -

i'm developing rest api takes post requests brain-dead software can't patch or else. posts update model objects exist in database. specifically, i'm posting data objects related field (a slugrelatedfield, poster knows 'name' attribute not 'pk'). however, need return 404 if poster sends data 'name' returns nothing on slugrelatedfield (e.g. related object not exist). i've been through debugger seems drf uses django signals magic way drf it™, return 400 bad request. don't know how modify - only when it's above condition , not true 400-worthy post - 404. by way, pre_save() in view not executing during execution of failing test. here's serializer: class characterizationserializer(serializers.modelserializer): """ work-in-progress django-rest-framework use. handles (de)serialization of data characterization object , vice versa. see: http://www.django-rest-framework.org/tutorial/1-serializati

iCloud key value pair entitlement issues -

when tried uploading got following errors invalid code signing entitlements. application bundle's signature contains code signing entitlements not supported on ios. specifically, key 'com.apple.developer.icloud-containter-identifiers' in 'payload/appname.app/appname' not supported invalid code signing entitlements. application bundle's signature contains code signing entitlements not supported on ios. specifically, key 'com.apple.developer.icloud-containter-development-identifiers' in 'payload/appname.app/appname' not supported invalid code signing entitlements. application bundle's signature contains code signing entitlements not supported on ios. specifically, key 'com.apple.developer.icloud-services' in 'payload/appname.app/appname' not supported invalid code signing entitlements. application bundle's signature contains code signing entitlements not supported on ios. specifically, key 'com.apple.develope

beautifulsoup - How to search by name attribute? -

i'm trying find input element <input id="telephone" name="telephone"> . tried soup.find('input', name='telephone') , didn't find it. soup.find('input', id='telephone') works fine. think problem 'name' has 2 meanings, name of tag , name attribute. so, how can search name attribute? obviously in example can search id attribute, that's not there in actual predicament. im not sure wrote. soup.find('input', name='telephone'); would try use this? soup.find('input[name="telephone"]'); hope works.

c - Convert Ascii to Binary -

i writing program need convert ascii characters binary , count. have gotten code working printing additional information , not correct binary. below code output given set of characters. assistance appreciated! #include <stdio.h> #include <stdlib.h> void binaryprinter(int digend, int value, int * noofones); void print(char c); int chartoint(char c) { return (int) c; } int main() { char value; int result = 1; while(result != eof) { result = scanf("%c", &value); if(result != eof) { print(value); } } } void binaryprinter(int digend, int value, int * noofones) { if(value & 1) { (*noofones) = (*noofones) + 1; value = value >> 1; digend--; printf("1"); } else { value = value >> 1; digend--; printf("0"); }

android - Difference between specifying the view.onclicklistener and just having onclicklistener -

i looked on http://developer.android.com/reference/android/view/package-summary.html , saw view class has interface named "view.onclicklistener" "interface definition callback invoked when view clicked" question difference if specify view or not in interface? basically button.setonclicklistener(new button.onclicklistener() same button.setonclicklistener(new onclicklistener()? there 2 of setonclicklistener 1 view class , 1 refer dialoginterface class. so in order manipulate view button or imageview , add action it, need use view.onclicklistener while dealing dialog buttons should use dialogineterface.onclicklistener both have different arguments. usually adding onclicklistener , view class imported default or make choose between both classes. don't need add view.onclicklistener . however, if class dialoginterface have been imported , want use view onclicklistener have write view.onclicklistener differentiate both classes' onc

Swift: NSNumber is not a subtype of Float -

Image
i tried code swift programming language in playground , got following error "nsnumber not subtype of float", modified making x , y of type float in struct point. missing? if added float type centerx , centery, got error: not find overload '/' accepts supplied arguments. the error message unrelated actual error... actual error cannot convert double float . in size , x , y double (default type of float literal) in point , width , height float . different types , can't mix them without explicit conversion. there number of ways fix it. can change them double or float . e.g. class point { var x:double var y:double } or can convert them correct type doing float(centerx) ps: can post code next time can change without retype them

Disable _source field using spring data elasticsearch -

when indexing entity(document) default behavior index fields of entity. default source enabled , store disabled fields. if want index of fields instead of index fields, understood have disable source , explicitly mark fields store yes. can disable source document/entity using spring data elasticsearch? support annotations? if want prevent field being indexed can add field annotation this: @field(store = false) private yourobject yourobject

json - Unhandled exception error, android -

i fetch json object function have unhandled exception error, knows problem, appreciated sample code! thanks! //here error, when want fetch object = jsonobj //acctually error in code cann't run it, it's red line //testvalidator.validatedatewithcriteria(testcriteria, jsonobj); return testvalidator.testwithcriteria(testcriteria, jsonobj); } in definition of datevalidator#validatedatewithcriteria() have said throws exception . however, when call method, aren't putting in try/catch block. because have said throw exception , must attempt catch potential exception whenever call method. example: try{ return datevalidator.validatedatewithcriteria(validationcriteria, jsonobj); }catch(exception ex){ log.e("your tag", "datevalidator", ex); return null; }

android - efficient way to load contacts with name and phone and picture with only one query -

i have following code load contacts phones , pictures on samsung s3 device. public static void getallcontactwithnumberandnameandphoto(context context, arraylist<contactinfo> mcontactlist, boolean starred) { contentresolver cr = context.getcontentresolver(); cursor cur = null; if (starred == true) { cur = cr.query(contactscontract.contacts.content_uri, null, "starred=?", new string[] { "1" }, null); } else { cur = cr.query(contactscontract.contacts.content_uri, null, null, null, null); } if (cur.getcount() > 0) { while (cur.movetonext()) { contactinfo item = new contactinfo(); string id = cur.getstring(cur .getcolumnindex(contactscontract.contacts._id)); string name = cur .getstring(cur .g

c++ - What happens if you don't use "this" within a class? -

suppose have following class: class foo{ public: int somenum; void calculation(int somenum); }; definition: void foo::calculation(int somenum){ somenum = somenum; } now in line somenum = somenum , somenum being referred ? if do: this->somenum = somenum then second somenum ? what naming style avoid problem ? example, in objective-c, 1 prefixes "_" before member variable name. (e.g.: _somenum); inside member function parameter name hides identical class member names, in void foo::calculation(int somenum){ somenum = somenum; } both somenum s referring parameter. it's self-assignment doesn't change this->somenum . in this->somenum = somenum; , second somenum refers function parameter. assigns value of function parameter somenum class member somenum . common naming conventions include m or m_ prefix or postfix _ class members. prefix underscore can problematic because c++ reserves names beginning

javascript - Passing java script function result to Angular ng-table -

i have angular ng-table load json data $data variable , display in table. function ngtable(){ var app = angular.module('main', ['ngtable']). controller('democtrl', function($scope, ngtableparams) { var data = [{name: "moroni", age: 50}, {name: "tiancum", age: 43}, {name: "jacob", age: 27}, {name: "nephi", age: 29}, {name: "enos", age: 34}, {name: "tiancum", age: 43}, {name: "jacob", age: 27}, {name: "nephi", age: 29}, {name: "enos", age: 34}, {name: "tiancum", age: 43}, {name: "jacob", age: 27}, {name: "nephi", age: 29}, {name: "enos", age: 34}, {name: "tiancum", age: 43}, {name: "jacob&quo

How to translate the new Gmail API message/thread IDs to X-GM-MSGID/X-GM-THRID and -

i'm trying use message api , works i'm unable use gmail message id (x-gm-msgid) or message id when trying retrieve. know if there way translate new gmail api id's either message id or x-gm-msgid? the gmail api uses same message ids web ui (you'll see them in url bar when you've loaded message). imap x-gm-msgid same value in decimal format rather hex string format. "the message id 64-bit unsigned integer , decimal equivalent id hex string used in web interface , gmail api." according to: https://developers.google.com/gmail/imap_extensions#access_to_the_gmail_unique_message_id_x-gm-msgid

How we can save a image in a folder yii2 framework? -

when uploading image saved in default folder /web. want save images in user defined folder. if user defined folder, chances pretty have create directory on fly, uploadedfile method not do. yii2 use createdirectory() method in "yii\helpers\basefilehelper" class. ex: use yii\web\uploadedfile; use yii\helpers\basefilehelper; $model->uploaded_file = uploadedfile::getinstance($model, 'uploaded_file'); $unique_name = uniqid('file_'); $model->file_type = $model->uploaded_file->extension; $model->file_name = $unique_name.'.'.$model->file_type; $model->file_path = 'uploads/projects/'. $project_id; basefilehelper::createdirectory($model->file_path); $model->uploaded_file->saveas($model->file_path .'/'. $model->file_name); $model->save(); check out createdirectory

core data - Convert NSSet to Swift Array -

in coredata have defined unordered to-many relationship. relationship defined in swift this: @nsmanaged var types : nsmutableset however, use swift @ it's best, want use normal swift array type[] . however, coredata forces me use ns(mutable)set . how can type-cast / convert nsset array<type>[] ? as of xcode 7.2 swift 2.1.1 actually, found out trial that: @nsmanaged var types : set<type> works fine. the fact coredata generates somethink like: @nsmanaged var types : nsset when creating nsmanagedobject subclass editor. wondering if there not verbose method use filter method without casting. swift supposed bridge automatically between nsset, nsarray , counterparts. tried declaring directly set , works. answering question, converting array becomes trivial: array(types)

active directory - Is Microsoft.Owin.Security.ActiveDirectory for making Owin auth middleware that uses AD? -

i'm trying understand purpose of microsoft.owin.security.activedirectory , can't seem find documentation, tests, or much in way of articles. what package for? trying use create middlewear authenticates against active directory , can't seem trace through parameters useactivedirectoryfederationservicesbearerauthentication nor how use them point @ own ad server. what's going on package? an answer my codeplex issue that package works azure active directory (aad) , active directory federation services (adfs) via wsfederation. don't have support ldap, 3rd parties may. here's 1 example: https://auth0.com/authenticate/aspnet-owin/active-directory contributions new auth middleware best directed here: https://github.com/owin-middleware still nothing on how use or when though.

xml - Changes the Icon's in Dialog's Wix Installer -

Image
i have developed setup project using wix installer.i new it. have finished developing installer need customize icon of dialog window.how set icon of our product it.?? how change icon ?? i have tried below code ,but not working? <icon id="icon.ico" sourcefile="mysourcefiles\icon.ico"/> <property id="arpproducticon" value="icon.ico" /> the icon asking managed windows installer , can't changed. default icon assigned msi packages os. can change default icon msi packages in system registry, not you're trying do.

jquery - How to display bootstrap collapse menu in this particular scenario? -

Image
collapse menu not displaying on smaller screen. have mistaken? using bootstrap 3. have jquery , bootstrap.min.js linked collapse menu not appearing. html: <header> <div class="container"> <div class ="row "> <div class="col-md-2"> <div class="navbar-header"> <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse"> <span class="sr-only">toggle navigation</span> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> <a class ="navbar-brand" href=""><img src ="img/summan-company.png" alt="summan" /></a> </div> </div> <div class ="row navbar-position">

ios - Maxdate not updating after app went in background for a couple days -

i making app datepicker , maxdate work once meaning if app goes in background couple of days maxdate not updating. there method tell app regain focus check maxdate. thx in advance :) when application comes background, delegate method viewwillappear not called. rather should below thing. at time of reactivation, if want carry particular thing viewcontroller, should register notification in viewdidlaod method. 'uiapplicationdidbecomeactivenotification' automatically notify application , given controller, if have registered for. so,add below code in viewdidload method. [[nsnotificationcenter defaultcenter]addobserver:self selector:@selector(setmaxdate) name:uiapplicationdidbecomeactivenotification object:nil]; now write down method, -(void) setmaxdate { myselecteddate.maximumdate = [nsdate date]; } do not forget remove obse

cordova - Where does android phonegap application data saved? -

i using phone gap application, need store data, if use phonegap local storage database, saved in phone? there possibility store data in application self, instead of storing in sd card or phone memory? if use local storage data stored in browser's memory. not saved on phone memory or sd card. however, if want store data can create sqlite plugin phonegap , store sqlite db either in phone memory or in sd card. unfortunately, not possible store data in application itself. hope helps..

java - Which "default Locale" is which? -

with unix locales, breakdown of means relatively documented. lc_collate (string collation) lc_ctype (character conversion) lc_messages (messages shown in ui) lc_monetary (formatting of monetary values) lc_numeric (formatting of non-monetary numeric values) lc_time (formatting of date , time values) lang (fallback if of above not set) java has different categorisation doesn't quite match real world (as usual): locale.getdefault() locale.getdefault(locale.category.display) locale.getdefault(locale.category.format) if read documentation on these, locale.getdefault(locale.category.display) appears correspond lc_messages while locale.getdefault(locale.category.format) appears correspond combination of lc_monetary + lc_numeric + lc_time . there problems, though. if read jdk source, start find many worrying things. instance, resourcebundle.getbundle(string) - entirely string messages - uses locale.getdefault() , not locale.getdefault(locale.category

javascript - Load a codeigniter view in a new window -

i looking way open report in new window using codeigniter. still did not find proper way this. need send array of data view , think won't big problem following code used pass array of data view. $this->load->view('report',$data); my problem how open in new window using javascript,jquery or php if there method. helpful. thanks. try way: echo anchor('controller/function', 'show in new window', array('target' = > '_blank')); or maybe can use jquery trick

selenium - Is there any command for page to load completely in Jmeter Webdriver -

var pkg = javaimporter(org.openqa.selenium) var support_ui = javaimporter(org.openqa.selenium.support.ui.webdriverwait) var wait = new support_ui.webdriverwait(wds.browser, 5000) var url = wds.args[0]; var user = wds.args[1]; var pwd = wds.args[2]; wds.sampleresult.samplestart() wds.browser.get(url) var wait=new support_ui.webdriverwait(wds.browser,15000) var username = wds.browser.findelement(pkg.by.id('login_txtusername')).sendkeys([user]) //username.click() //username.sendkeys(['pandian']) var userpwd = wds.browser.findelement(pkg.by.id('login_txtpassword')).sendkeys([pwd]) //userpwd.click() //userpwd.sendkeys(['1234']) var button = wds.browser.findelement(pkg.by.id('login_btnlogin')).click() if execute above code it's working fine, happen when browser open page not loading it's navigating element, want page load completely, "is there command available jmeter" bcoz command in jmeter differs selenium webdriver.... pleas

django form queryset filter by current user -

i have made search form user can filter news accroding published date , crawlers have selected previously.. here form class searchform(forms.form): pub_date_from = forms.charfield(label="from",max_length=20) pub_date_to = forms.charfield(label="to",max_length=30) crawler = forms.modelmultiplechoicefield(label="crawler",queryset=crawler.objects.filter(created_by=self.request.user) here want crawler shown user have selected previously.. here view.. class singlenewsview(listview): model = news form_class = searchform template_name = "single_news.html" # def post(self, request, **kwargs): # print "request" # form = searchform(request.user) def get(self, request, pk, **kwargs): #form = searchform(request.user) self.pk = pk self.pub_from = request.get.get('pub_date_from',false) self.pub_to = request.get.get('pub_date_to',false) self.crawlers = request.get.get('crawler',false)

function - How to convert a long form table to wide form table in Excel? -

Image
a picture worth thousand words. let's in 1 sheet have following table: using information, want programatically generate table this(sort of un-melting long table wide form) in sheet: how can achieve this? using vba: range("g1:k99").clear each xx in range("a:a") if xx.value = "" exit sub range("g1").offset(xx.value, 0) = xx.value e = 1 99 if range("g1").offset(xx.value, e) = "" range("g1").offset(xx.value, e) = xx.offset(0, 1).value exit end if next next the table it's created column "g". if want sheet: sheets(2).range("g1: ... add sheets before ... without vba, following scheme: adding formulas: m2 -> =iferror(match(l2;$a$1:$a$8;);"") n2 -> =iferror(match(l2;indirect("$a" & (m2+1) & ":$a$8");)+m2;"") o2 -> =iferror(match(l2;indirect("$a" &

javascript - How to load more content with Angular (JSON) -

i'm newbie on angularjs, , now, i'm trying create simplest web-app, load json data server. works fine now, looks this: js file app.controller('mycont', ['$scope', '$http', function($scope, $http) { $scope.moreitems = function() { $http.post('php/index.php'). success(function (data) { $scope.posts = data; } ); console.log('button work'); } }]); html <div ng-controller="mycont"> <span ng-click="moreitems()">load more</span> <ul> <li ng-repeat="some in something">{{some.here}}</li> </ul> </div> php generates json page. every time gives me different data. trouble have no idea how load more data controller. replaces it, want concat it. you can use angular.extend concatenate data. whenever json data retrieved, concatenated previous data in same js

jQuery Split text() to get new lines -

this question has answer here: how replace occurrences of string in javascript? 35 answers javascript - split string 3 answers javascript/jquery: split camelcase string , add hyphen rather space 5 answers how split .text() , should new lines. for suppose have this. var loa = $('.loa_div').text(); alert(loa); alert loa gives me, resultabc.resultdefgh.resultkijklm.result12.result888.kkkresult.123result. i should get resultabc. resultdefgh. resultkijklm. result12. result888. kkkresult. 123result. var str= "resultabc.resultdefgh.resultkijklm.result12.result888"; var stresult=str.split('.').join('\n'); demo: http://jsfiddle.net/dp

Puppet : How to use "defined" type as requirement inside exec -

i have defined type follows define fill_templates() { $filename = $name["filename"] $filelocation = $name["filelocation"] file { "${filelocation}/${filename}/": ensure => present, owner => 'root', group => 'root', mode => '0777', content => template("config/${filename}.erb"), require => exec["unzip_pack"], } } and call type as fill_templates { $foo:} i want make pre-requirement exec. want make "require" exec. exec { "strating": user => 'root', environment => 'java_home=/home/agent2/jdk1.6.0', path => $command_path, command => "${agents_location}/...../bin/myfiler.sh", logoutput => true, timeout => 3600, require =>xxxxxxxxxxx, } how can ? this should

apache - Can Laravel 4 be run without mod_rewrite? -

our client doesn't have mod_rewrite enabled on host. possible run laravel 4 without it? the default .htaccess file looks this: <ifmodule mod_rewrite.c> <ifmodule mod_negotiation.c> options -multiviews </ifmodule> rewriteengine on # redirect trailing slashes... rewriterule ^(.*)/$ /$1 [l,r=301] # handle front controller... rewritecond %{request_filename} !-d rewritecond %{request_filename} !-f rewriterule ^ index.php [l] </ifmodule> if yes, how?

ASP.NET MVC 4 URL or routing issue -

i'm using asp.net mvc 4 create website. in route.config file have following defaults: new { controller = "announcement", action = "index", id = urlparameter.optional } so when type url localhost or localhost/announcement works , index action called right. however, when type localhost/announcement/index should work i'm getting javascript , jquery errors. i'm guessing when type word index such script not recognized reason: <script type="text/javascript" src="js/cufon.js"></script> any appreciated. thanks

php - How to add events in FullCalendar using an array retrieved from a mysql server (phpmyAdmin)? -

i grateful in advance of receive on this. apologise if error obvious. problem can't seem find idea on how display elements of array populate events. for(var = 0;i < count;i++) { // these arrays contain events var primaryasset = primaryassets[i]; var release_date = releasedates[i]; $('#calendar').fullcalendar({ header: { left: 'prev,next today', center: 'title', right: 'month,agendaweek,agendaday' }, editable: true, weekmode: 'liquid', weekends: true, events: [ { title: primaryasset, start: release_date, end: release_date } ] }); } please create event array first pass full calender var evt = [ { title : 

javascript - Finding Specific text in body and removing it via JS -

i creating html , aspx file via c# code in apx works fine in html page appends aspx tag shows plain text in body. want remove text in body starts <% , ends %> here generated html <body> <center> <%string action = "http://" + request.url.authority+"/abc/data/a12.aspx" ; %> <div> <form> // input fields , submit button </form> </div> </center> </body> i have tried document.body.innerhtml = document.body.innerhtml.replace( <%string action = "http://" + request.url.authority+"/abc/data/a12.aspx" ; %>, ""); but didn't work me, generated aspx tag not same time.. in code: document.body.innerhtml = document.body.innerhtml .replace( <%string action = "http://" + request.url.authority+"/abc/data/a12.aspx" ; %>, ""); you are: not using string first argument, invalid.

javascript - Script-output not showing -

iv'e insertet script 2 different pages. (just test it) this site missing menu left this site showing right things the script this: <script language="javascript" src="http://www.altimaskiner.dk/ecatalog/category.asp?userid=4823&amp;type=.js" type="text/javascript" charset="utf-8"> </script> <div id="div1">&nbsp;</div> <div class="ekatalogcat"><script type="text/javascript"> _printviewcat('div1') </script></div> <script src="http://www.altimaskiner.dk/ecatalog/saleslist.asp?userid=4823&amp;type=.js" type="text/javascript" language="javascript" charset="utf-8"></script> <div id="divtest">&nbsp;</div> <div class="ekatalog"><script>_printview('divtest')</script></div

c# - Populate ComboBox from code behind -

i have following in silverlight xaml: <usercontrol........ <scrollviewer grid.row="2"> <listbox x:name="lblist"> <listbox.itemtemplate> <datatemplate> <grid horizontalalignment="stretch" > <grid.columndefinitions> <columndefinition width="auto"/> <columndefinition width="auto"/> </grid.columndefinitions> <image source="images/bild1.png" grid.column="0"/> <combobox name="mycombobox" grid.column="1"></combobox> </grid> </datatemplate> </listbox.itemtemplate> </listbox> </scrollviewer> ............. </usercontrol> a

Show tiles from other zoomlevel in Leaflet -

i'm trying make offline maps leaflet. for data saving, user has option not save zoomlevels. example user has zoomlevels: - 15 , 17. now problem is, when user zooming in level 15 16. how show level 15 (or 17) layers on zoom 16? alternative skip zoomlevel 16, maybe there option? looked sourcecode leaflet, can't figure out. jsfiddle update fiddle plugin skips zoomlevel (by ilja zverev) html <div id="map"></div> <div id="out"></div> javascipt var map = l.map('map').setview([52.084, 5.11], 15); isnozoomlevel = 16; l.tilelayer('http://a.tile.openstreetmap.org/{z}/{x}/{y}.png', { attribution: '&copy; <a href="http://openstreetmap.org">openstreetmap</a>', maxzoom: 18 }).addto(map); map.on('zoomend', function() { console.log("i zoomed level " + map.getzoom()); if(map.getzoom() == isnozoomlevel) { console.log("this o

c# - Entity Framework Concatenated Key in Lookup -

Image
i have code first project , while designing project have come across problem has stumped me, here able propose solution. have 3 tables , had many many relationships each other. resolved many many using new entity look-up table in database. the problem have entity framework won't allow me use entities of a,b , c in look-up entity wants me add id lookup table. mean allowing duplication of data, , not want this. i have tried set key attribute within poco (not practice still tried) purist glad hear not work removed it. public class abc { [key] [column(order=1)] public virtual a { get; set; } [key] [column(order=2)] public virtual b b { get; set; } [key] [column(order=3)] public virtual c c { get; set; } } as did not work tried use mappings file , used following public class abcmappings : entitytypeconfiguration<abc> { public abcmappings() { haskey(x => new { a.id, b.id, c.id}); } } this fails reporti

android - Unity Share Button Implementation -

i'm trying implement share feature shown in blog: http://www.daniel4d.com/blog/sharing-image-unity-android/ but when tried share line on android got error: ( http://triodigitalagency.com/line-error.png ). here relevant part of code: //instantiate class intent androidjavaclass intentclass = new androidjavaclass("android.content.intent"); //instantiate object intent androidjavaobject intentobject = new androidjavaobject("android.content.intent"); //call setaction setting action_send parameter intentobject.call<androidjavaobject>("setaction", intentclass.getstatic<string>("action_send")); //instantiate class uri androidjavaclass uriclass = new androidjavaclass("android.net.uri"); //instantiate object uri parse of url's file androidjavaobject uriobject = uriclass.callstatic<androidjavaobject>("parse","file://"+pathname); //call putextra uri object of file intentobject.call<andr

Learning Weka - Precision and Recall - Wiki example to .Arff file -

i'm new weka , advanced statistics, starting scratch understand weka measures. i've done @rushdi-shams examples, great resources. on wikipedia http://en.wikipedia.org/wiki/precision_and_recall examples explains simple example video software recognition of 7 dogs detection in group of 9 real dogs , cats. understand example, , recall calculation. first step, let see in weka how reproduce data. how create such .arff file? file have wrong confusion matrix, , wrong accuracy class recall not 1, should 4/9 (0.4444) @relation 'dogs , cat detection' @attribute 'realanimal' {dog,cat} @attribute 'detected' {dog,cat} @attribute 'class' {correct,wrong} @data dog,dog,correct dog,dog,correct dog,dog,correct dog,dog,correct cat,dog,wrong cat,dog,wrong cat,dog,wrong dog,?,? dog,?,? dog,?,? dog,?,? dog,?,? cat,?,? cat,?,? output weka (without filters) === run information === scheme:weka

java - Bound Mismatch on new object of generic class -

i have error occuring program assignment. in it, have create own generic public class linkedlist<e extends comparable<t>> implements list<e> { the implemented interface is: public interface list<e extends comparable<t>> { } now, whenever try create new object of type linkedlist follows: linkedlist<termin> k = new linkedlist<termin>(); eclipse gives me following error: bound mismatch: type termin not valid substitute bounded parameter > of type linkedlist the class declaration of class termin follows: public class termin implements comparable<t> { } in case need constructor , variables of linkedlist object: private e item; private linkedlist<e> next; //constructor public linkedlist() { item = null; next = null; } with little google magic, found out there once bug involving generics in eclipse gave same error no reason. i suppose of declarations aren't

java - How do I make an annotation based event system? -

well made 1 don't know if it's best tbh. can write me tutorial? made 1 tutorial , understood 90% of 10% of off , seems aint best way it. eventmanager.java public class eventmanager { private static list<listener> registered = new arraylist<listener>(); public static void register(listener listener) { if (!registered.contains(listener)) { registered.add(listener); } } public static void unregister(listener listener) { if (registered.contains(listener)) { registered.remove(listener); } } public static list<listener> getregistered() { return registered; } public static void callevent(final event event) { new thread() { @override public void run() { call(event); } }.start(); } private static void call(final event event) { (listener registered : getregistered()) { method[] methods = registered.getclass().getmethods(); (int = 0; < methods.length; i+

visual studio 2013 - Crystal report cross tab common column -

i'm trying insert table below in crystal report. i tried use cross-tab function... don't know how insert common columns(?) on left (ex) column 'number', 'name', 'age' in row in below report. ) | group 1 | group 2 | total | number | name | age | a_gr1 | b_gr2 | c_gr3 |a_gr2 | b_gr2 | c_gr2 | | b | c | (sorry bad table... apparently can't post images newly signed member =( ) welcome kinds of advice. :)

java - How does the String class override the + operator? -

why in java you're able add strings + operator, when string class? in the string.java code did not find implementation operator. concept violate object orientation? let's @ following simple expressions in java int x=15; string temp="x = "+x; the compiler converts "x = "+x; stringbuilder internally , uses .append(int) "add" integer string. 5.1.11. string conversion any type may converted type string string conversion. a value x of primitive type t first converted reference value if giving argument appropriate class instance creation expression (§15.9): if t boolean, use new boolean(x). if t char, use new character(x). if t byte, short, or int, use new integer(x). if t long, use new long(x). if t float, use new float(x). if t double, use new double(x). this reference value converted type string string conversion. now reference values need considered: if reference

qt - Finding out how many items fit in the QTreeView (number of rows visible on the screen) -

i'm sure there's easy way number, can't find any. it can't determined empty view because can vary depending on items' content. if there items in view, can calculate qabstractitemview::visualrect , intersect viewport() 's rect() see if particular item visible. can iterate on rows , check if item visible. example: for(int row = 0; row < view.model()->rowcount(); row++) { if (!view.visualrect(view.model()->index(row, 0)).intersects(view.viewport()->rect())) { return row; } } however works if have top level items , have enough items fill viewport. alternatively, can call view.indexat(qpoint(0, 0)) , view.indexat(qpoint(0, view.viewport()->height())) , compare indexes. if these indexes don't share same parent, counting rows become troublesome.

ios - Number Generator wave cycle to graph output -

i'm looking generate wave form generated cycle of numbers increase , decrease on given rate. frequency can vary between 1 40 per minute , amplitude varies between 100 , 3000. idea form breathing pattern "breaths per minute" (1-40) , inhaled volume per breath (100-3000). i'm new here , can find random generators. have looked @ nstimer , uigraphs ios-developer tesla tutorial app. could point me in right direction. many thanks.

javascript - How to get width of an element from an ng-click without Jquery in AngularJS? -

i dynamically width of div.progress-bar ng-click . function move($event) on element div.progress-bar returns event element div.progress-bar . when click on div.time inside div.progress-bar , returns event element div.time . i want width of progress-bar click on children. html : <div class="progress-bar" ng-click="move($event)"> <div class="time" ng-style="{'width': (current_track.time_current / current_track.time_total * 100) + '%'}"></div> </div> controller : $scope.move = function(e) { console.log(e); console.log(e.srcelement.offsetwidth); var widthofprogressbar = e.srcelement.offsetwidth; /* ... */ }; you have check if clicked element .progress-bar , , if not, fetch parent element: var bar = e.srcelement.classname === 'time' ? e.srcelement.parentnode : e.srcelement; var widthofprogressbar = bar.offsetwidth; /* ... */ or alt

java - eclipse is not starting in ubuntu and it is stuck -

i have installed eclipse using command sudo apt-get install eclipse , have added java ee plugin following steps given in link: https://askubuntu.com/questions/81341/install-eclipse-ide-for-java-ee-dev-via-apt-get-is-it-possible i created project in eclipse , worked 2 days without issues. today wen trying start eclipse getting screen select workspace, when selected workspace eclipse showing in dull color , not starting after waiting long time. using eclipse 3.8 version. below details eclipse.ini file --launcher.xxmaxpermsize 1024m --launcher.defaultaction openfile -vmargs -xms1024m -xmx2048m i have set heap memory minimum 1gb , maximium 2gb still facing same issue. if try select different workspace eclipse loading fine. please me how can solve issue.

jquery - Url parameters to array/object -

with jquery.param can do: var myobject = { a: { one: 1, two: 2, three: 3 }, b: [ 1, 2, 3 ] }; var recursiveencoded = $.param( myobject ); var recursivedecoded = decodeuricomponent( $.param( myobject ) ); recursivedecoded; // "a[]=foo&a[]=bar&b[]=1&b[]=2&b[]=3" but how got: var myobject = { a: { one: 1, two: 2, three: 3 }, b: [ 1, 2, 3 ] }; from "a[one]=1&a[two]=2&a[three]=3&b[]=1&b[]=2&b[]=3" ? try var myobject = { a: { one: 1, two: 2, three: 3 }, b: [ 1, 2, 3 ] }; var json = json.stringify(myobject); var _arr = decodeuricomponent($.param(json.parse(json))); var arr = json.parse(json.stringify(_arr.split("=").join("&").split("&"))); var obj = []; var tempobj = []; var tempvals = []; $.each(arr, function(index, value) { if ( /\[/.test(value) ) { var props = value.split(/\[|\]/).slice(0, 2); tempobj.pus

java - Pass array of floats when training Stanford CRFClassifier -

for every word in document, i'm looking add in series of floating point numbers features stanford ner's crfclassifier train on. unfortunately, documentation on stanford ner's .prop files hasn't made clear how pass in custom features. in general, how 1 go adding custom features stanford ner training set? you find answer inside 'nerfeaturefactory' class.

sql server - how to outer join two tables? -

i have following tables: tbla (id, price), tblb (id, minpay) example: tbla id price 001 1.00 003 2.00 tblb id minpay 001 10.00 004 20.00 i need somehow join 2 tables following result: id price minpay 001 1.00 10.00 003 2.00 0 004 0 20.00 does know how achieve this? use coalesce() replace null 0 value select a.id, coalesce(a.price,0) price, coalesce(b.minpay,0) minipay tbla full outer join tblb b on a.id=b.id

java - Setting "Wrap Content" to a view programmatically -

is possible set wrap content identifier int? following code work? edittext et = new edittext(getactivity()); et.setwidth(wrap_content); i suppose should that: edittext edittextview = new edittext(getactivity()); layoutparams params = new layoutparams(layoutparams.wrap_content, layoutparams.fill_parent); edittextview.setlayoutparams(params);

android - Why is the width of toast shorter than its content? -

i wrote activity contains navigation drawer (a simple fragment listview inside), , model , adapter listview. there imageview , textview in single list item, it's in many apps. that's have done, , rest codes of activity , fragment's classes generated automatically android studio. when used toast.maketext in activity, result looks this . i've searched question , tried using toast.maketext(this.getapplicationcontext(), ...) instead of toast.maketext(this, ...) , , worked. i'm wondering why happen , how should solved problem correctly? in official documentation says typical toast looks this: context context = getapplicationcontext(); toast toast = toast.maketext(context, text, duration); i imagine because depending on class have, context varies because not context instances created equal. more info here :

Installing Android SQLite Asset Helper -

i need use ready made database. search solution on internet did not work until decided use mentioned library found here . however, found hard use library in installation procedures shallow beginners. i appreciate step step procedure on how use android studio. in struggle tried copying sources main/libs , adding line gradle did not work. use api 19 if helps. update here build.gradle // top-level build file can add configuration options common sub-projects/modules. buildscript { repositories { mavencentral() } dependencies { classpath 'com.android.tools.build:gradle:0.11.+' compile 'com.readystatesoftware.sqliteasset:sqliteassethelper:+' // note: not place application dependencies here; belong // in individual module build.gradle files } } allprojects { repositories { mavencentral() } } trying compile project error error:(9, 0) no signature of method: org.gradle.api.internal.artifacts

c# - asp.net mvc 4 working as web application not as a website -

i have simple asp.net mvc 4 web application, there no code problem or issues routing. i deploy iis(any version) web application works fine can browse site fine. if deploy web site, throws standard 404 not found exception. i trying understand why happens asp.net mvc web applications? any clues? experience deploying web site? web applications compiled, web sites as-is, meaning c# files served without being compiled in .dll this why isn't working, mvc sites must compiled in .dll

flot - Uncaught Error: Invalid dimensions for plot, width = 335, height = 0 -

everytime refresh page, error in console uncaught error: invalid dimensions plot, width = 335, height = 0 the pie chart loads first time, on refresh, throws error , not appear. any suggestions /solutions ? thanks you forgot specify height div holder of graph. <div id="mygraph" style="height:500px;"></div> this solve issue. :)

c# - How can I get a timeout exception in WCF using TcpClient Class -

i have issue i'm facing. contract implementation (besides other stuff) has this: try { response = _socketrequest.sendrequest(request, emmiterheader); trcode = response.tracecodeint; if (trcode == 0) statusrequest = (int) tsrequestattemptstatus.active; } catch (timeoutexception tex) { throw; } catch (exception) { statusrequest = (int) tsrequestattemptstatus.notactive; throw; } { tsra = createtireasincorequestattemptrow(datetime.now, statusrequest, emmiterheader.headerid, string.empty, string.empty, string.empty,