Posts

Showing posts from March, 2015

Java add a list to class and modification -

i have problem list. adds list class. in class list more items added. when want display list of class not have items. add people mysqlcategorydao -> modify in mysqlcategorydao -> return people in class model. public class model { public list<category> people = new vector<category>(); public list<category> getpeople() { (category person : people) { system.out.println(person.getname()); //no data } return new arraylist<category>(people); } public void load() throws exception { daofactory factory = daofactory.getfactory(daofactory.mysql); new mysqlcategorydao(job.select,people).execute(); } } class in modifies list public class mysqlcategorydao extends swingworker<void, category> implements categorydao{ private job job; public list<category> list; public mysqlcategorydao(job job, list<category> list){ this.job = job; thi

java - XSD with import in Gradle resource folder can't be read by SAX -

i have generated xsd validation files schemagen. there both one-file validation xsd , two-file validation xsd imports. there no problem include one-file validation xsd file in java application validation gradle resource folder. if try load two-file validation xsd import gradle resource folder shown below, crash following error: org.xml.sax.saxparseexception; linenumber: 12; columnnumber: 98; src-resolve: name "ns1:stringarray" kann nicht als "type definition"-komponente aufgelöst werden. means in english: name can't resolved type definition component if two-file validation xsd located in gradle source folder, works properly, there can't error in file except resolving of import location. my xsd file looks following: <?xml version="1.0" encoding="utf-8" standalone="yes"?> <xs:schema version="1.0" targetnamespace="" xmlns:ns1="http://jaxb.dev.java.net/array" xmlns:tns="

c - Calling main menu is displaying sub menu -

i doing airplain seat booking system. here have main menu of chooseflight() , submenu of printmenu(). whenever press 'f' printmenu's options should return mainmenu. cannot. please me! int main() { chooseflight(); fflush(stdin); return 0; } void chooseflight(void) { char selectflight; printf("a) flight 102 b) flight 311 c) flight 444 d) flight 519 e)quitprogram\n"); scanf("%c",&selectflight); switch(selectflight) { case 'a': puts("welcome flight 102 service"); while(1){ printmenu102(); } break; case 'b': puts("welcome flight 311 service"); printmenu311(); break; case 'c': puts("welcome flight 444 service"); printmenu444(); break; case 'd':

java - Mainapp does not start -

i need debug main app , can't find error. app doesn't start personoverviewcontroller . need fix issue, in fmxl= messages in control javafx.fxml.loadexception: /users/stefanhegetschweiler/documents/weiterbildung/fh/programmierung/projekt/17.08.2014/vokabulartrainer/bin/ch/makery/address/view/personoverview.fxml @ javafx.fxml.fxmlloader.constructloadexception(fxmlloader.java:2617) @ javafx.fxml.fxmlloader.loadimpl(fxmlloader.java:2587) @ javafx.fxml.fxmlloader.loadimpl(fxmlloader.java:2441) @ javafx.fxml.fxmlloader.load(fxmlloader.java:2409) @ ch.makery.address.mainapp.showpersonoverview(mainapp.java:162) @ ch.makery.address.mainapp.start(mainapp.java:120) @ com.sun.javafx.application.launcherimpl$8.run(launcherimpl.java:837) @ com.sun.javafx.application.platformimpl$7.run(platformimpl.java:335) @ com.sun.javafx.application.platformimpl$6$1.run(platformimpl.java:301) @ com.sun.javafx.application.platformimpl$6$1.run(platformimpl.java:298) @ java.security.accesscontrolle

performance - Fortran strange behavior when timing subroutines -

the strangest behavior happens when i'm timing code shown below. it's long it's doing matrix multiplication different ways of passing arguments. matmul0 use explicit shape, matmul1 use assumed shape, , matmul2 use assumed shape plus use pointers inside subroutine point matrices (don't ask me why this, doesn't matter). thing is, when time 3 subroutines, like: time explicit shape: 3.712099 time assumed shape: 12.55620 time assumed shape + pointer: 3.821299 now, if comment third subroutine (the 1 pointers), time like: time explicit shape: 3.712099 time assumed shape: 3.824401 time assumed shape + pointer: 0.00000 why happening? , why doesn't happen first subroutine too? i'm running on intel core i3, intel compiler, no optimization flags, ifort test.f90 -fpp (the fpp preprocessing timer macro). full code below. #define timer(func, store) call system_clock(start_t, rate); call func; call system_clock(end_t); store = store + real(end_t - start_

c# - File.ReadLine adds line breaks to CSV -

Image
i have been converting exported document outlook csv used interpreted c# further manipulations. problem arises when using: string path = @"contacts.csv"; program self = new program(); // open file read from. var readline = file.readlines(path); foreach (string line in readline) { console.writeline(line); console.readkey(true); } to display following data: which not expected output, , after hitting key pass readkey rest of data displayed following: (blanked out contact numbers) when csv it's self not contain line breaks (used replace function using ctrl+j mimic line break , replace nothing). csv looks like: there no line breaks present, problem persists throughout document on iterations not others. why there new line breaks being added , being pushed iteration, why occouring? i've exhausted possibilities within skillset i've tried forcefully removing new line breaks string toprint = line.replac

floating point - atof() returns 3 digit number into 2 digits -

i trying parse string sent arduino uno using serial communication float. want use these floats set rgb led's color. issue is, read first 2 digits. sorta. entered 100. come out 10.00. if it's 231, come out 23.00. weird thing is, if put 32.43, come out 32.4300. have no idea why this. here code: float led1color[3]; ... (int = 0; < 3; i++) { int index = content.indexof(","); content = content.substring(index + 1); //removes additional text in front of numbers led1color[i] = atof(content.substring(0, index).c_str()); serial.println(led1color[i], 4); } now lets sent following: "rgbled,43.61,52,231". first, rgbled removed. then, 3 values console shows me followed: 43.6100 52.0000 23.0000 obviously issue here need value 231, not 23.0000. i've never programmed in c/c++ before, there i'm missing? why 3 digit number being converted 2 digit number? your error value of index. finds first comma correctly int ind

python - Upload .xls file with html input file -

i can upload .csv, , .json file following code. however, when try upload .xls files, app gets locked up. need make work correctly excel files? class createteam(basehandler): def post(self): file = self.request.get('file') # line locks excel files my html looks this... <form method="post" action="/create_team" enctype="multipart/form-data"> <div> <p>upload file</p> <input type="file" name="file"> </div> </form> i have other input fields on form posted same submit button. mime type issue. if so, how set mime type uploaded file?

c# - Get list of recently listened music -

i'm developing windows phone app needs retrieve , manipulate information songs played on device. i know possible song playing using mediaplayer.queue.activesong . however, need have access list of played tracks. mediahistory , mediahistoryitem classes don't seem provide this. is possible? how? the current api, @igor has pointed out in answer not allow this. however, there way reasonably assume particular media file has been played recently, getting information actual file. we can use getbasicpropertiesasync() along retrievepropertiesasync() give dateaccessed property file. here code snippet taken this msdn page: public async void test() { try { storagefile file = await storagefile.getfilefrompathasync("filepath"); if (file != null) { stringbuilder outputtext = new stringbuilder(); // basic properties basicproperties basicproperties = await file.getbasicpropertiesasyn

node.js - Message "Failed to instantiate module growlNotifications..." appear on production env -

i current using mean.io development framework of application , have been using growlnotifications plug-in time , works perfect on both server , client side. while after coding commit (does not affect plug-in), following error appear on production server: uncaught error: [$injector:modulerr] failed instantiate module acleague due to: error: [$injector:modulerr] failed instantiate module growlnotifications due to: error: [$injector:nomod] module 'growlnotifications' not available! either...<omitted>...3) but won't have problem running on local. ensure bower install work on production server , did nth in grunt file. could me or give me hints solve problem? lot! as set bower component latest, production server run bower update command latest 1 while local not. so upgraded plugin , run on both sides, works now.

css - Getting child div columns to inherit height of the tallest column / fill entire parent height -

site can seen here: http://storagestaging.com/pricing/ question regards 4 column pricing grid. i have 4 column pricing grid. each column has different height (due more or less content). i'd 4 columns fill entire length of tallest column / fill entire parent div. i've tried display: table , display:table-cell, , adding height=100% parent , child divs. closer, make worse. appreciated. thanks! in case decide use divs, js (this jquery version, if need vanilla js lemme know) solution possible: var max = 0; $('.mydiv').each(function() { if ($(this).height() > max) max = $(this).height(); }); $('.mydiv').css('height', max + ' px');

javascript - MEAN.IO how do I change default template? -

i finding difficult figure out how mean.io stack defines default.html template used through-out modules and/or packages. trying change 1 view instead used default.html template, use 1 define. their documentation http://mean.io/#!/docs says use 'swig' templating system. however, did file search , inside templates, find 5 occurrences of 'swig' , declared in html text. not see swig being used, or injected in end neither. should in end. ideas? . default html template other pages use parent. want change html another. here default.html looks like: <!doctype html> <html lang="en" xmlns="http://www.w3.org/1999/xhtml" xmlns:fb="https://www.facebook.com/2008/fbml" itemscope="itemscope" itemtype="http://schema.org/product"> {% include '../includes/head.html' %} <body> <div class="navbar navbar-default navbar-fixed-top" data-ng-include="'/system/views/header.html'&q

node.js - Does a readable start reading before a writable emits "writable"? -

let's want read in 1gb file uploaded network endpoint. issue is, before making network upload request, have make network request token allow upload go through. so, if someone's code looked like... fs.createreadstream('1-gb-file').pipe(mywritablestream); ...should worried data buffering in memory before writestream says it's ready (after having fetched token)? what i've found fs.createreadstream readable has highwatermark of 64kb. mean max in-buffer limit 64kb, before more data sucked out of readable? will data start being read (beyond highwatermark) readable after call this.emit('writable') (or other trigger)? edit: maybe trigger calling callback first call _write receives? i'm quite new streams api, appreciated. i've searched around similar questions, , couldn't find any. sad face. thanks!

debugging - GDB doesn't disassemble program running in RAM correctly -

i have application compiled using gcc stm32f407 arm processor. linker stores in flash, executed in ram. small bootstrap program copies application flash ram , branches application's resethandler. memcpy(appramstart, appflashstart, appramsize); // run application __asm volatile ( "ldr r1, =_app_ram_start\n\t" // load pointer application's vectors "add r1, #4\n\t" // increment vector pointer second entry (resethandler pointer) "ldr r2, [r1, #0x0]\n\t" // load resethandler address via vector pointer // bit[0] must 1 thumb instructions otherwise bus error occur. "bx r2" // jump resethandler - not return here ); this works ok, except when try debug application ram (using gdb eclipse) disassembly incorrect. curious thing debugger gets source code correct, , accept , halt on breakpoints have set. can single step source code l

database - Wordpress 3.9.2 and MYSQLI -

sorry if simple question cannot answer wp forums i have since update server latest php version , running wordpress 3.9.2 because of updates wordpress uses mysqli instead of mysql , have custom data connections running of course not work now. i have changed mysql msqli functions, of course not run correctly unless use database connection suffix example $results = $wpdb->query("select county counties"); while($row = $results->fetch_assoc()) { echo $row["county"]. "<br>'; } $results->free(); though know there results, produces none , thinking have wrong connection name wpdb does know db connection name in wordpress many p all sorted now $results = $wpdb->get_results ("select county counties"); foreach ($results $row) { echo $row->county; }

shell - Can not change gnome-terminal to solarized by running script with ansible playbook -

i'm writing roles setting virtual machine using ansible. i'm trying set gnome-terminal color theme solarized https://github.com/anthony25/gnome-terminal-colors-solarized i can run script terminal , color changes immediately $ ~/solarized/gnome-terminal-colors-solarized/install.sh -s dark -p default but when run ansible: - name: set solarized color default profile script: /home/someuser/solarized/gnome-terminal-colors-solarized/install.sh -s dark -p default the result ok task: [solarized | set solarized color default profile] *********************** changed: [localhost] but nothing changed! check config file @ ~/.gconf/apps/gnome-terminal/profiles/default/ , did not change well i tried shell, command still same result. i tried run install.sh -s lkefjefj -p lefjelkfj and throws errors, reads arguments the script run sudo option. so not understand why not working? i found problem. script run in ansible root user when declare "s

Python Recursion List Sum of Pairs -

i supposed write 2 functions exact same thing implementation different. the function takes input list of positive integers , positive integer n, , returns true if 2 of numbers in list equal n. otherwise, returns false. the first function supposed use nested loop, able get. the second functions not supposed use nested loop. however, supposed sort list out , solve problem. here have second function. def pairs2(lst, n): lst.sort() if len(lst) == 2: if lst[0] + lst[1] == n: return true else: return false elif len(lst) >= 3: in range(len(lst) - 1): if lst[0] + lst[i + 1] == n: return true lst.remove(lst[0]) pairs2(lst, n) the function works until last 2 lines implemented. after that, doesn't return anything. wrong function? also, other alternatives not use recursion? came using recursion since first idea got. a recursive algorithm eliminates largest numbe

python - Creating all combinations of a set and running out of memory -

i need generate every combination of 6 numbers set of 55. believe there 28,989,675 indexes in set of combinations. guess i'm running out of memory, because can generate combinations 4 numbers nothing larger that. how can fix problem? i'm using modification of code borrowed tutorial here: https://www.youtube.com/watch?v=vyxdqxuiwpu import itertools text_file = open("comb3.txt", "w") harmonics = [28, 33, 36, 38, 40, 43, 45, 47, 48, 50, 52, 55, 55.86, 57, 59, 60, 60.86, 61.69, 62, 63.86, 64, 65.86, 66, 66.69, 67, 69, 69.69, 70.86, 71, 71.69, 72, 74, 75.86, 76, 76.69, 77.86, 79, 81, 81.69, 82.86, 83.69, 84, 84.86, 86, 88, 88.69, 89.86, 90.69, 91, 93, 95, 95.69, 96.86, 98, 100] combos = itertools.combinations(harmonics, 4) usable_combos = [] e in combos: usable_combos.append(e) print usable_combos s = str(usable_combos) text_file.write(s) text_file.close() thanks! one reason why you're running out of memory due fact (as quite rig

objective c - How can I check if a file is an image file without checking the path extension? -

i need differentiate between text file , image file without taking path extension. i check if file image or not. after searching, there way check mimetype path extension, however, solution verify file's content itself. uiimage *image = [uiimage imagenamed:@"somefile.xyz"]; if (image == nil) { nslog(@"this text file"); } if image nil means file may text or type of file.

View File Permissions In Windows 7 Like Linux OS -

is there way view file permissions file in windows give same output linux machine (e.g. -rw-rw-r--)? thanks. you can install gnu win32 tools. it contains lot of useful linux/unix tools windows. includes ls. , unlike cygwin, it's windows native exe's. no need cygwin. see here: https://u-tools.com/msls.asp , here: http://gnuwin32.sourceforge.net

Do I need to put AngularJS in the <head> if I want to hide {{ xxx }} from showing on my page? -

i have html this: <div id="top" ng-hide="app.stateservice.displaymodal"> <div>{{ app.userservice.data.name }}</div> </div> // body html here. no images loaded. divs <script src="scripts/jquery-2.1.1.min.js"></script> <script src="/scripts/angular.js"></script> now page briefly shows {{ app.userservice.data.name }}. if want not show have have angularjs in head of document? reason placed angularjs @ end because wanted have page appear possible. can advise me , tell me how can make {{ xxx }} hidden when page first loads up. you use ng-cloak hide elements until compiled. <div id="top" ng-cloak ng-hide="app.stateservice.displaymodal"> <div>{{ app.userservice.data.name }}</div> </div> the css rules hide elements ng-cloak added automatically angular.js . if isn't fast enough add css rules @ head:

java - Unable to load class declared as < mapping class="Package.Class" /> in the configuration -

hibernate.cfg.xml ?xml version="1.0" encoding="utf-8"?> <!doctype hibernate-configuration public "-//hibernate/hibernate configuration dtd 3.0//en" "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd"> <hibernate-configuration> <session-factory> <property name="hibernate.dialect">org.hibernate.dialect.mysqldialect</property> <property name="hibernate.connection.driver_class">com.mysql.jdbc.driver</property> <property name="hibernate.connection.charset">utf8</property> <property name="hibernate.connection.characterencoding">utf8</property> <property name="hibernate.connection.url">jdbc:mysql://localhost:3306/usosurvey</property> <property name="hibernate.connection.username">us

html - persian font not applied in android WebView -

i have html content (combined persian english text) attached css, css style applied correctly font. the css have fontface this: @font-face{ font-family: 'byekan'; font-weight: normal; font-style: normal; src: url(../fonts/byekan.ttf); } the font applied english text , not persian . font standard ttf persian font (byekan.ttf) nothings wrong it. i googled lot , every body said it's bug in webview android > 3.0, problem still exist in android 4. https://code.google.com/p/android/issues/detail?id=38536 https://groups.google.com/forum/#!topic/persian-computing/4fm7jfiokjk the workaround found using svg fonts instead, does not work me either. custom font webview so how can solve this? note1 : question probobly asked alot, this: persian @font-face doesn't work in chrome, bug or not? it's old question , given advice not working anymore (at least me). note2 : when open page in chrome desktop browser font a

c# - How to get Email address of external login in ASP.NET MVC 5 -

we using asp.net identity in mvc 5 allow user log in social media accounts. var logininfo = await authenticationmanager.getexternallogininfoasync(); we use above api retrieve information of accounts, of accounts except facebook have empty value logininfo.email , how can email address 2 social accounts: microsoft account twitter i believe none of providers propagate user email claims. have query apis directly obtain email addresses. to email addresses microsoft account, poke the /me endpoint twitter not allow retrieve user email address. advice here (as others have ended too) ask user email address within application.

how to Show progress Bar In Display While Executing Method in c# -

in application want show progress bar in display while user click on specific button, i implemented below code private bool importdata() { bool result = false; //thread othread = new thread(new threadstart(frmwaitshow)); try { thread backgroundthread = new thread( new threadstart(() => { //othread.start(); (int n = 0; n < 100; n++) { thread.sleep(50); progressbar1.begininvoke(new action(() => progressbar1.value = n)); } } )); backgroundthread.start(); // progress bar should start here intdevid = int.parse(cmbdevicename.selectedvalue.tostring()); fetchdevicedata(intdevid); // fetch remove device info sql database //ftptcompletedbatchtransfer(); fetchmaxreportid(); getftpfile(strdeviceip,

html - Wordpress text editor tags does not work, what do I need to change? -

Image
as title suggest, when using wordpress html editor has following tags: i tried using ul tag , li tags content on published page, shows in single paragraph tag using chrome inspect element. i believe should setting in wordpress life of me cannot find related it. which setting needs adjusted correct issue? p.s. wordpress not clean install, came live site html tags not stripped. , issue happens pages not posts. any appreciated. i checked website http://dev.wlh.co.za/ , there css code prevents render expect. it's not problem wordpress, theme or plugin. i found line many times in code, stops browser render ul or ol usual: list-style: none; another 1 should fix is padding: 0; have on example:

How to check ARGF is empty or not in Ruby -

i want argf this. # file.rb if argf.??? puts argf.read else puts "no redirect." end $ echo "hello world" | ruby file.rb hello world $ ruby file.rb no redirect. i need without waiting user input. tried eof? or closed? doesn't help. ideas? note misunderstood argf . please see comments below. basically you'd examine #filename . 1 way is: if argf.filename != "-" puts argf.read else puts "no redirect." end and more complete form: #!/usr/bin/env ruby if argf.filename != "-" or (not stdin.tty? , not stdin.closed?) puts argf.read else puts "no redirect." end another: #!/usr/bin/env ruby if not stdin.tty? , not stdin.closed? puts stdin.read else puts "no redirect." end

surfaceview - Android onTouch multi-touch not receiving all touch events -

i using android surfaceview , listening multi-touch events. able detect multiple touches seems action_pointer_up touch event not getting fired. here quick snip of code. public class gameview extends surfaceview implements runnable { ... @override public boolean ontouchevent(motionevent motionevent) { log.i("pointer count", integer.tostring(motionevent.getpointercount())); return true; } ... } when put 2 fingers on screen pointer count log out 2. if remove 1 of fingers pointer count log out not 1 , stays @ 2. goes 1 if move finger still on screen. why , how firkin fix it? thanks! edit this problem occurs on 1 plus 1 , friends samsung galaxy note 2. interesting when put on samsung galaxy s4 problem did not occur. do not use getaction() == motionevent.action_pointer_up action contain pointer index. getactionmasked() strip out information, , used comparison. see http://developer.android.com/reference/android/view/mo

java - Unbound classpath container: 'JRE System Library [OSGi/Minimum-1.2]' -

hi experts new java programming. i have installed adt bundle , came eclipse version: 1.4.1.v20120912-144938-8r7xfoxflwul7ppnbh_higkb4 , build id: m20130204-1200 jdk version installed "1.8_0_11". i build simple android apps worked well, simple java project shows me following errors : unbound classpath container: 'jre system library [osgi/minimum-1.2]' in project. tried solutions provided above, did not work. please me fix it.

sql server - How to increase the performance of sql query that contains a lot of joins and union -

i have created procedure in following way, create procedure proc_foo begin declare @somevar int set @somevar=0 if exists (select column1 tbl1) begin set @somevar = 1 end if exists (select column2 tbl2) begin set @somevar = 1 end .... ... .... if exists (select columnn tbln) begin set @somevar = 1 end if(@somevar =1) begin select count(column1) tbl1 union select count(column2) tbl2 union ... ... ... select count(columnn) tbln end end the select statements contains lot of joins , taking lot of time execute.can explain me different approach more faster. i first suggest use "with recompile" hint on stored procedure. recompile sp , generate new execution plan based on how variable ends being set. fresh execution plan every time. additionally, adding indexes on columns joining on , use include columns if creating non-clustered indexes columns you're outputting.

git - Clone bitbucket repo to local machine failed -

i'm trying clone repository bitbucket: git clone git@bitbucket.org:myname/mynamerepo.git and getting error: cloning 'folder_name'... conq: repository access denied. deployment key not associated requested repository. fatal: not read remote repository. please make sure have correct access rights , repository exists. the problem happened after i've installed new clean mac os on laptop. generated new ssh key , added bitbucket ssh keys still no luck. help? maybe this can you. double check key client offering 1 associated account running "ssh -v git@bitbucket.org".

android - Share the file folder image audio video using wifi -

how can share file , folder ,image ,audio, video using wifi directly ?.i want share data 1 android device android device using wifi connection. want implement https://play.google.com/store/apps/details?id=com.majedev.superbeam&hl=en

web services - Call Nintex Workflow StartWorkflowOnListItem from client application -

i'll trying start nintex workflow 2010 outside of sharepoint. can't seem find samples on how can call maybe console application. have code samples or knows blogs shows this. thanks, jimbo csom workflows api not supported in sharepoint 2010, consume sharepoint workflow web services (soap) purpose. use workflow.startworkflow method start workflow on item client. how consume sharepoint workflow web services in visual studio create new console application project in visual studio right click on references , add service reference put in url workflow.asmx service on server example: <web url>/_vti_bin/workflow.asmx , specify namespace name, example workflowsvc in order sharepoint web services work ntlm authentication please make following changes app.config file. replace security section from: <security mode="none"> <transport clientcredentialtype="none" proxycredentialtype="none" realm

excel vba - Multiple cell selection in VBA using ActiveCell.Offset(0, 1).Value -

i'm starting in vba , had program able retrieve value selected cell used reference. i'm able when select 1 cell activecell function , playing around activecell.offset(0, 1).value etc. how make same thing while selecting multiple cells @ same time , able take 1 cell value @ time , activecell.offset... identify second cell value , retrieve proper information , on. using macro recorder see when select multiple values point to range("y8,y9,y10,y11").select 'etc.... thank , hope i've been precise enough on i'm trying do. many olivier i know kinda late , op has solution think wants can achieved using selection like: dim r range, c range if typeof selection range set r = selection else exit sub each c in r '/* put code want here */ debug.print c.address debug.print c.offset(0,1).value next posting answer in case stumbled on same problem/issue/requirement.

django - DJANGO_PATH errors and settings issues -

i upgraded ubuntu 14.04, , consulted question solve erros, importerror: no module named _io in ubuntu 14.04 . solved perfectly. i checked out question it's similar mine, consistently getting importerror: not import settings 'myapp.settings' error , not use same solution. i not use manage.py in project , have done numerous exports of python_path no end of issues. here traceback; traceback (most recent call last): file "/home/thabang/.virtualenvs/lottostar/bin/django-admin.py", line 5, in <module> management.execute_from_command_line() file "/home/thabang/.virtualenvs/lottostar/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 399, in execute_from_command_line utility.execute() file "/home/thabang/.virtualenvs/lottostar/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 392, in execute self.fetch_command(subcommand).run_from_argv(self.argv) file "/home/thabang/.virtualenvs/l

android - Using the formula px = dp * (dpi/160) for creating image resources does not result in sharp images -

although question not related programming, related app development. suppose have imageview dimensions 40dp*40dp. if use above formula create icon device screen density 217 ppi, size of icon fits imageview 55px*55px. if use icon in view in consideration, result icon not appear sharp. on other hand, if use larger image of size, 80px*80px, appears sharp. larger image larger fitting 1 factor of 1.6. what know whether there value of above factor efficient , conventional. follow conventions while developing apps. thanks time. your imageview size 40dp, thats equal to: 40 x 1.0 = 40 pixel on mdpi devices 40 x 1.5 = 60 pixel on hdpi devices 40 x 2.0 = 80 pixel on xhdpi devices 40 x 3.0 = 120 pixel on xxhdpi devices 40 x 4.0 = 160 pixel on xxxhdpi devices now device hdpi (217). thats device need 60x60 pixel bitmap, , have put in drawable-hdpi directory. using drawable directory using drawable-mdpi directory. fro each resource in directory android scale u

xaml - WPF MVVM Light dynamic list source on data grid -

okay, have admin screen in application. originally, plan have datagrid each entity , hide/show them. believe there better way 1 data grid. way, not need make add/edit buttons each datagrid (you can't have same name) leads mess of codes , re-writing things feel can made dynamic. so, created custom class called admindatagrid: public class admindatagrid : datagrid { public admindatagrid() { messenger.default.register<string>(this, "updatedatagrid", (action) => updatedatagrid(action)); messenger.default.register<icollectionview>(this, "receivedriverlist", (x) => this.currentitemssource = x); } public void updatedatagrid(string model) { switch (model) { case "driver": messenger.default.send<string>("getdriverslist", "getdriverslist"); break; default: break; } } #r

Jquery CountUP timer from specific date -

i need countup timer specific date. (year, month, day, hour, min., sec.,) for example need count timer date 2012 august 24, , when refresh page, timer must still work/count up. i found many counter every counter down, not up. this timerlook http://flipclockjs.com/ but missing count specific date. well, since you've mentioned flipclock, guess should work: calculate difference between current date , desired date: var date1 = new date("8/24/2012"); var date2 = new date(); var timediff = math.abs(date2.gettime() - date1.gettime()); var diffseconds = math.ceil(timediff / 1000); create flipclock (it counts default, change set countdown: true): var clock = $('.your-clock').flipclock({ // ... options here }); use settime() method set time: clock.settime(diffseconds); now start clock: clock.start(); i haven't checked this, should work according documentation. edit: since flipclock doesn't support nothing beyond 99 day

c++ - call to another function in a dll causes access violation -

okay i'm starting realize dll arn't simplest of things understand, i'm trying make dll vc6 compatible, got code working in vs2010 in trying work out how code work vc6 project i've found following issue: my call dll looks this mydll::connect(); when try , run program uses function, starts out fine gets function call i.e. void connect() { hello(); //0xc0000005: access violation } void hello() { int = 1; } the disassembly looks this: -> 00000000 ??? 00000001 ??? 00000002 ??? 00000003 ??? 00000004 ??? 00000005 ??? 00000006 ??? 00000007 ??? 00000008 ??? 00000009 ??? etc... you didn't exported function .....a program not permitted access function in dll unless function registered exported function. should prototype this to export function inside class function should 1- public member. 2- static member class mydll{ public: static void connect(); } //then redeclare #i

How to use regex in notepad++ in this condition? -

i want search strings in notepad++ such nullpointerexception, anotherexception , other exceptions except jmsexception or connectexception , have "(connect|jms)exception" , searching jmsexception , connectexception. add regex make work? have try with: find what: (?<!jms)(?<!connect)exception make sure regular expression checked. (?<!....) negative lookbehind

VBA REGEX MS ACCESS -

i using ms access implement regex wish find after ")" in statement excluding bracket itself i use following regex strpart3 = regexp(stringtocheck, "(?<=\)).*", false) where function is function regexp(stringtocheck variant, patterntouse string, optional, casesensitive boolean = true) dim re new regexp re.pattern = patterntouse re.global = false re.ignorecase = not casesensitive dim m each m in re.execute(stringtocheck) regexp = m.value next end function i error ms access saying method execute of object iregexp2 failed think because ms access doesn't support behinds based on previous thred opened up can suggest alternative way (preferably in regex im using project learn it) by using regex code strpart3 = regexp(stringtocheck, "[^/)]*$", false) gives me looking for

database - Postgresql: direct replication on demand -

i have 2 postgresql databases (on different servers): lets call them stable , unstable. stable read purposes only. time time the stable updated current unstable. i improve update process. dumping file , restoring not possible more due size of database. found many replication tools designed master-slave configuration, not do, slave (stable) updated on demand. tools seem more complicated problem want them solve. ideally, simple tool interface pg_replicate source target result in target db being exact clone of source , data being transfered directly between 2 database servers (they connected local network) without creating large temporary files. database size 50 gb , growing, transfering sql inserts might not suffice. so, there tool it? or close?

c# - Resize WPF Canvas control not maintaining aspect ratio correctly -

i using resize code this answer works when testing when placed real application (with larger render time) aspect ratio no no longer maintained. if move mouse or wiggle in directions can make control distort out of original aspect ratio , seems happen once in actual application. i'm not 100% sure wonder if because uses actualheight , actualwidth calculate current ratio , values might not date. some of related code, rest available on question linked above: called on drag this.checkaspectratio(ref dragdeltahorizontal, ref dragdeltavertical, item.actualheight / item.actualwidth); the function itself private void checkaspectratio(ref double? dragdeltahorizontal, ref double? dragdeltavertical, double aspectratio) { double? dragvalue = null; if (dragdeltavertical.hasvalue && dragdeltahorizontal.hasvalue) { dragvalue = math.max(dragdeltavertical.value, dragdeltahorizontal.value); } else if (dragdeltavertical.hasvalue) { dr

Export multiple datasets to one Excel sheet in Matlab -

hej, have data, want export excel. data consists of several sequences, , each sequence stored dataset. normally, 'dataset' class quite neat, allowing store variable , observation names. therefore, keep it. for single datasets use 'export' function (as opposed 'xlswrite'), e.g.: export(data, 'xlsfile' ,[pathname '\' filename],'sheet',1); this writes dataset 'data' specified spread sheet. now want export multiple datasets 1 spread sheet. thus, can't use 'export' function anymore (as far know). i know can specify range function 'xlswrite' , make nice loop, e.g.: for isequence 1:nrsequences xlrange= ...; xlswrite([pathname '\' fname],data{isequence},sheetnumber,xlrange); end this works fine if 'data{isquence}' array, but... not work datasets. trying datasets produces following error: 'error using xlswrite (line ...) input data must numeric, cell, or logical array

Find non scientific notation value in excel -

i wish find cell value in excel 2013 using vba. have tried works fine long column wide enough. set foundcell = thisworkbook.sheets(1).rows(1).find(what:="201402", lookin:=xlvalues) however, if column not wide enough number shown in scientific notation, "2e+05", not found above row, if search value in non-scientific notation. work long cell contains value , not formula: set foundcell = thisworkbook.sheets(1).rows(1).find(what:="201402", lookin:=xlformulas) however, in case cell value formula referencing cell ("=c1"), in case neither of above work. so, possible search "201402" , find in row 2, in following scenario? create new workbook in excel 2013 insert 201402 in cell c1 insert =c1 in cell c2 make column c narrow enough scientific notation shown neither of work: set foundcell = thisworkbook.sheets(1).rows(2).find(what:="201402", lookin:=xlvalues) set foundcell = thisworkbook.sheets(1).rows(2).find(wha

javascript - filters with wildcards in angularjs -

i'm trying filter list of values wildcards. searchstring = "ab*cd" should return values start "ab" , end "cd". so far i've tried split string in multiple substrings asterisk , search word starts first substring , simultaneously end second 1 (or 1 of two, depending on position of asterisk). i'm asking if there better method of doing this. this code search strings start searchstring: function escaperegexp(string){ return string.replace(/([.*+?^=!:${}()|\[\]\/\\])/g, '\\$1'); } $scope.query = ''; var regex; $scope.$watch('query', function (value) { regex = new regexp('\\b' + escaperegexp(value), 'i'); } $scope.filterbysearch = function(article) { if (!$scope.query) return true; return regex.test(article.title); }; write custom filter like: iapp.filter('myfilter', function() { return function( items, types) { var filtered = []; angular.foreach(items, function(i

collections - Updating the objects of a Set in Java -

i trying read file , count how many times each string appears in file. using hashset on object item have created follows : now in main trying read file , add each string in file set. while adding trying increment count of item in set appearing more once. here's implementation : package pack; public class item { public string name; public int count=1; public item(string name) { this.name = name; } @override public int hashcode() { final int prime = 31; int result = 1; result = prime * result + count; result = prime * result + ((name == null) ? 0 : name.hashcode()); return result; } @override public boolean equals(object obj) { if (this == obj) return true; if (obj == null) return false; if (getclass() != obj.getclass()) return false; item other = (item) obj; if (count != other.count) return false;

javascript - How to set the Height of the Iframe Dynamically as per the content loading in it? -

this question has been posted lot of times, have referred them not working me. have iframe loads wesite in it. want height of iframe must change dynamically per height of website page loading in it. no manual height settings. how can that? <iframe src="http://www.w3schools.com/" width:150;></iframe> could please fiddle , show me? advance help. fiddle link below: [link] ( http://jsfiddle.net/vineetgnair/5p0pl5zu/ ) it's not easy in cross-browser safe way may seem. better off using javascript library you. have used this one success before.

php - How to use getQuery()->getOneOrNullresult() return -

in test project have 2 entities : - enduser (extend of fosuserbundle) - rezo (will containt approved relation between 2 members) the both entities have been defined : enduser entity : <?php namespace core\customerbundle\entity; use doctrine\orm\mapping orm; use fos\userbundle\model\user baseuser; use symfony\component\validator\constraints assert; /** * enduser * * @orm\table() * @orm\entity(repositoryclass="core\customerbundle\entity\enduserrepository") */ class enduser extends baseuser { /** * @var integer * * @orm\column(name="id", type="integer") * @orm\id * @orm\generatedvalue(strategy="auto") */ protected $id; /** * @var string * @orm\column(name="firstname", type="string", length=255) */ private $firstname; /** * @var string * @orm\column(name="lastname", type="string", length=255) */ private $