Posts

Showing posts from April, 2011

statistics - Python: generating a continuous distribution (type Maxwell-Boltzmann) to generate random values -

i want generate continuous distribution (type maxwell-boltzmann) python. mean, want create distribution in order generate random values. this link kinda helps: create continuous distribution in python i don't have idea start, know analytical function generates distribution don't know how implement that. can me? thanks in advance scipy has maxwell-boltzmann distribution built-in, maxwell , , pdf method give probability density function.

vb.net - Inserting a String inside a String -

i want insert word inside existing word? both strings. for example: given string word: hello sample sentence i want insert word i a output be: hello sample sentence i inserting here basing on word sample . insertion starts before word sample . possible? based on description of logic (which isn't go on), use: dim input string = "hello sample sentence" dim isample integer = input.indexof("sample") dim output string = input.insert(isample, "i ") this uses bcl function string.insert, inserts string string @ particular position.

c# - how do i change the width of my textbox in css? -

i added asp.net textbox webpage , cover css shown below <tr> <td id="policeprofileachievement" colspan="2" align="center"> <b>achievement : <asp:textbox id="txtachievement" runat="server" readonly="true" textmode="multiline"></asp:textbox> <br /> </td> </tr> in source code have added width textbox. in css, added didnt resize textbox width #policeprofileachievement [type="text"] { position:absolute; margin-top:250%; left:0%; width:150px; } and/or i removed policeprofileachievement css , added ( recommended many ) #txtachievement{ position:absolute; margin-top:250%; left:0%; width:150px; } but there doesn't seem have changes on textbox size either is there other way resize textbox size? regards .txtbox { position:absolute; margin-top:250%; le...

php - Keeping track of users and photos they've viewed -

i have high traffic site lots of photos on , trying track photo each user has viewed. my first instinct sql table 2 columns: user_id & photo_id. but, wouldn't scale traffic level, , table unmanageable quickly. recommendations anoher solution, either sql or nosql (mongodb,couch,redis,...) my code php if matters. thanks! edit there 10s of millions of views day. edit don't need know total times user viewed particular photo, whether been viewed @ user your best bet create collection { _id:generated automagically, pictureid, viewerid } with find( pictureid, viewerid ).limit(1) , index on pictureid and viewerid make checking super ultra fast level 99. important set index. use find().limit(1) because faster findone, @ least current benchmarks. why not have 1 entry per user array of viewed images? because searching through array slower searching whole document in collection. 10 million images? no problem. mongodb shines. designed scale big-ass ...

javascript - Content within DIV areas -

i have following jsfiddle , place content within each of different coloured #div sections. however, when try so, information exceeds passed allocated space, seen in jsfiddle . how able achieve this? remove css attribute: white-space: nowrap;

UIautomator with two scroll views -

i trying automate settings app-> storage i need scroll through storage part in right pane(tablet) couldnt so. scroll left pane storage, display etc any ideas? i couldn't find way either. found workaround though. in settings app, under storage use like: int width = getuidevice().getdisplaywidth(); int height = getuidevice().getdisplayheight(); getuidevice.swipe(width*3/4, height*9/10, width*3/4, height*1/10, 10);

linux - How to compile this code implementing Xm on Ubuntu 64 bit using Netbeans? -

i new x-windows , trying code calls simple messagebox on linux window's. i on ubuntu 12.04lts 64bit , installed netbeans full version. included "/usr/include/xm" project, , libs, included "motif" libs. and following error occurs when compile code: main.cpp:24:63: error: invalid conversion ‘void (*)(widget, xtpointer, xmpushbuttoncallbackstruct*) {aka void (*)(_widgetrec*, void*, xmpushbuttoncallbackstruct*)}’ ‘xtcallbackproc {aka void (*)(_widgetrec*, void*, void*)}’ [-fpermissive] /usr/include/x11/intrinsic.h:1241:13: error: initializing argument 3 of ‘void xtaddcallback(widget, const char*, xtcallbackproc, xtpointer)’ [-fpermissive] i not understand error, @ least have never seen syntax like, "aka void blah blah~~". can please me fix compile error and, if possible, please explain me error message mean? here original source code: #include <xm/xm.h> #include <xm/pushb.h> /* prototype callback function */ void pushed_...

java - synchronizedList access by multiple threads -

i have basic question synchronizedlist . lets have synchronizedlist - list synclist = collections.synchronizedlist(new arraylist<>()) now scenario thread trying access add() api , thread b trying access remove() api of synchronizedlist. both thread able access both(add , remove) api @ same time. i believe threads should not access api(add() , remove()) same time. please correct me if wrong. will both thread able access both(add , remove) api @ same time. the answer no. if chance @ collections.synchronizedlist(list) source code, see that, method creating instance of static inner class named synchronizedlist or synchronizedrandomaccesslist , depending on type of list send argument. now both these static inner class extend common class called synchronizedcollection , maintains mutex object, on method operations synchronize on this mutex object assigned this , means that, mutex object same returned instance . since add() , remove() ...

java - Package plink with jar -

i have written code (java using eclipse juno) uses plink (c: installation) connect remote server. string command = "c:\\program files\\putty\\plink -load session-name -l login -pw password"; process p = runtime.exec (command); is there anyway can safely export (putty/plink) along jar file. there not need of separate installation. have alter code call plink locally. thanks. use jar utility comes java sdk package putty executables application jar file. upon installation can extract exe file folder. , later call code .

php - generate code using form button and then display generated code on page -

i have 2 file code_generator.html. takes input image url , landing url when click on submit button calls code_created.php <html> <head> </head> <body> <form action ="code_created.php" method ="post"> image : <input type ="text" name ="image"> landing url : <input type ="text" name="landingurl"> <input type= "submit"> </form> </body> </html> i want show generated code below on web page <div id='banner-img' style='display:none;text-align:center' onclick='landing()'><img style='text-align:center' id='bannerimage'/> <img id='t'/> <img id='trackeridimg' style='display:none;width:0px;height:0px'/> </div> <script type="text/javascript"> function showad() {...

sql server - Compare calling data from Stored Procedures and .NET 'Entity' objects -

i know what's best (fastest) way gain in performance (memory usage, cpu, ...) between these: you create .dbml or .edmx file call list of entities follows myentitiesdatacontext db = new myentitiesdatacontext(); var models = db.labels.tolist(); you create stored procedure, drag/drop on .dbml / .edmx file call follows myentitiesdatacontext db = new myentitiesdatacontext(); var models = db.listlabelprocedure(); this second way of coding further work because need develop stored procedures yourself. ps: working big data. smallest table can register 10g. rows can tell me best approach? all depend on need datas... if need them .net server side think both approaches similar. if can process them sql server side stored procedure, retrieve result, stored procedure approach idea. moreover think should carefull linq .tolist() because "load" datas sql server (network , memory usage), if have huge tables, impact asp.net server's memory, call store...

gcc - Is there a way to convert .so using the new ELF ABI to the old -

i build product on recent ubuntu version , pack executable , shared lib. 3.2.0-48-generic #74-ubuntu smp thu jun 6 19:43:26 utc 2013 x86_64 x86_64 x86_64 gnu/linux distributor id: ubuntu description: ubuntu 12.04.2 lts release: 12.04 codename: precise my .so file return : elf 64-bit lsb shared object, x86-64, version 1 (gnu/linux), dynamically linked, not stripped when unpack , try product on old debian (2.6.26-2-amd64 ... 2010 ... x86_64) got following error : elf file os abi invalid i picked info file of .so found on old debian , get: elf 64-bit lsb shared object, x86-64, version 1 (sysv), dynamically linked, stripped is there tool convert binary new abi version 1 (gnu/linux) old sysv ? or best options able deliver product both system (debian 5 / debian 12) ?

objective c - NEED HELP to send an string to another viewcontroller -

my nsstring dynamically generated in tableview should send viewcontroller: (message) -(void)tableview:(uitableview *)tableview didselectrowatindexpath:(nsindexpath *)indexpath { [self.tableview deselectrowatindexpath:indexpath animated:yes]; loanmodel* loan = _feed.users[indexpath.row]; nsstring* message = [nsstring stringwithformat:@"%@ from", loan.name ]; } the detailviewcontroller should message // detailviewcontroller.h #import <uikit/uikit.h> @interface detailviewcontroller : uiviewcontroller @property (strong, nonatomic) id detailitem; @property (weak, nonatomic) iboutlet uilabel *message; @end what procedure connect message label named name ? (with assistant editor) thanks you can either create delegate protocol , call method in detail page set message or instantiate detail view passing message.

openerp - Usage of Search Attribute in field tag in openerp7 -

can tell me use of search attribute in field tag. sample documentation below <field name="partner_id" search="[]" model="res.partner"/> sample openerp code below <field name="fields_id" search="[('model','=','res.partner'),('name','=','property_account_receivable')]"/> # account/demo/account_minimal.xml <field model="res.country.state" name="state_id" search="[('code','ilike','ca')]"/> # base/res/res_partner_demo.xml <field name="account_debit" search="[('code', 'like', '4540%')]"/> # l10n_be_hr_payroll_account/l10n_be_hr_payroll_account_data.xml documentation explanation below the search attribute allows find record associate when not know xml id. can specify search criteria find wanted record. criteria list of tuples of same form predefined searc...

r - change data frame so thousands are separated by dots -

at moment, i'm working rmarkdown , pandoc. data.frames in r this: 3.538e+01 3.542e+01 3.540e+01 9.583e+00 9.406e+00 9.494e+00 2.601e+05 2.712e+05 5.313e+05 after ran pandoc, result looks this: 35.380 35.420 35.400 9.583 9.406 9.494 260116.000 271217.000 531333.000 what should is: 35,380 35,420 35,400 9,583 9,406 9,494 260.116 271.217 531.333 so want commas instead of dots , want no comma or dot after 260116 (thousand numbers). dots separate thousand nice. there way directly change appearance in r or have set options in knitr/markdown? thanks here's example of of conversions can done format() : x <- c(35.38, 35.42, 35.4, 9.583, 9.406, 9.494, 260100, 271200, 531300) format(x, decimal.mark=",", big.mark=".", scientific=false) # [1] " 35,380" " 35,420" " 35,400" " 9,583" " 9,406" # [6] " 9,494" "260.100,000" "271.200,000"...

javascript - Hiding certain DIVs (not nested unfortunately) -

i working legacy code generated automatically , must comply following structure: <div id="title1"></div> <div id="div-1"></div> <div id="div-2"></div> <div id="div-3"></div> <div id="div-4"></div> .... (there can more divs here, ids can vary well) ... <div id="title2"></div> what want following: make title1 clickable once clicked hide underlying divs (not nested , not possible nest) another click on title1 shows hidden divs again only hide divs follow title next title (excluding) the solution may use jquery or such frameworks. try $('div[id^=title]').click(function(){ $(this).nextuntil('div[id^=title]').toggle(); }) demo: fiddle the underlying logic simple - make divs id starting title clickable adding click handler - attribute starts with selector used. find divs between clicked element , next e...

ios - NSXMLParserErrorDomain error 64 -

i have call xml parsing receiving error "nsxmlparsererrordomain error 64", if parse dynamically error. statically parsing on same xml attribute values. if try 1 server different request,url , response working xml parsing , getting attribute values. please check link==> http://brandontreb.com/wordpress-for-iphoneipad-nsxmlparsererrordomain-error-64-resolved *after scouring internet, found result of few issues. 1) special characters in post body not supported nsxmlparser 2) special characters in comment 3) invalid post or comment rss 4) error in theme/plugin file for me, turned out issue comments rss feed. loaded in browser , long behold, browser threw error. causing this? turns out, had left space in plugin created. caused space output @ beginning of comments xml, causing error. notice space between ?> , after removing space plugin, loaded wordpress iphone , added blog without problem. so, take away don’t output spaces when create plugin.* ...

java - A required class was missing while executing org.apache.maven.plugins:maven-war-plugin:2.1.1:war -

here clean install -x result: [info] scanning projects... [info] [info] ------------------------------------------------------------------------ [info] building test maven webapp 0.0.1-snapshot [info] ------------------------------------------------------------------------ [info] [info] --- maven-clean-plugin:2.5:clean (default-clean) @ test --- [info] deleting c:\users\utopcu\workspace\test\target [info] [info] --- maven-resources-plugin:2.6:resources (default-resources) @ test --- [warning] using platform encoding (cp1254 actually) copy filtered resources, i.e. build platform dependent! [info] copying 0 resource [info] [info] --- maven-compiler-plugin:2.5.1:compile (default-compile) @ test --- [info] no sources compile [info] [info] --- maven-resources-plugin:2.6:testresources (default-testresources) @ test --- [warning] using platform encoding (cp1254 actually) copy filtered resources, i.e. build plat...

Build failure when generating site with maven-site-plugin -

after having merged big set of changes projects master branch own branch, build performed ci server configured 'mvn package site' fails ('mvn package' works fine). site generation works on local development machine running win7. maven-site-plugin 3.3 being used (as there other issues using 3.0) i can't find useful hint in stack trace shown @ end of maven build: mavenexecutionresult exceptions not empty message : failed execute goal org.apache.maven.plugins:maven-site-plugin:3.3:site (default-site) on project pms-core: error during page generation cause : error during page generation stack trace : org.apache.maven.lifecycle.lifecycleexecutionexception: failed execute goal org.apache.maven.plugins:maven-site-plugin:3.3:site (default-site) on project pms-core: error during page generation @ org.apache.maven.lifecycle.internal.mojoexecutor.execute(mojoexecutor.java:217) @ org.apache.maven.lifecycle.internal.mojoexecutor.execute(mojoexecutor.java:153) ...

unix - How to perform sort on all files in a directory? -

how perform sort on files in directory? i have done in python, seems of hassle. import os, glob d = '/somedir/' f in glob.glob(d+"*"): f2 = f+".tmp" # unix~$ cat f | sort > f2; mv f2 f os.system("cat "+f+" | sort > "+f2+"; mv "+f2+" "+f) use find , -exec : find /somedir -type f -exec sort -o {} {} \; for limiting sort files in directory itself, use -maxdepth : find /somedir -maxdepth 1 type f -exec sort -o {} {} \;

php - Wordpress Form + vTiger CRM Ajax -

i'm trying create form in wordpress send information vtiger crm , go custom registration page. i have account-form.php loaded in own plugin - <form id="quickreg" name="quick registration" action="<?php bloginfo('url'); ?>/registration/" method="post" accept-charset="utf-8" onsubmit="return submitform();"> <p> <input type="hidden" name="publicid" value="86705670b55224a08b5ec544c86f5e93"> </input> <input id="name" type="hidden" name="qname" value="quick registration"> </input> </p> <p> <input id="firstname" type="text" value="" name="qfirstname" required="true" placeholder="first name"> </input> </p> <p> <input type="tex...

javascript - adding event listener to audio element doesn't work -

i have made simple music player , there 2 events 1 updating elapsed time , durationchange...elapsed time's function works fine total time function doesn't...i have looked in http://www.w3schools.com/tags/ref_av_dom.asp , durationchange standard event don't why doesn't work. thought maybe reason script defined before label elements moving scripts end of file didn't worked either. here code: <!doctype html> <html> <head> <link rel="stylesheet" href="style.css"/> <script type="text/javascript"> var audio = document.createelement("audio"); audio.id = "audio1" audio.src = "music.mp3"; audio.autoplay = true; window.onload = function () { audio.addeventlistener('timeupdate', updatethetime, false); audio.addeventlistener('durationchange', settotal, false); } function updatethetime() { var sec = audio.cur...

css3 - Border radius with ems? -

is better responsive design set border-radius in ems rather px? ive read column , media query widths better ems pixels more responsive design, ive never heard of using ems border radius. em better responsive design , can convert here http://pxtoem.com/

unix - Passing multiple parameters from shell script to mysql query -

i have write unix shell script take parameters mysql , export result csv file. have written extent unable pass multiple parameters shell script sql. can me out in this? thanks!! assuming call script $ ./script param1 param2 param3 in script echo $0 #will echo 'script' (the name of script) echo $1 #will echo 'param1' echo $2 #will echo 'param2' echo $3 #will echo 'param3' echo $# #will echo '3' number of params passed script echo $@ #will echo 'param1 param2 param3' (all parameters passed) host="127.0.0.1" user="root" password="pass" result=`mysql -h $host --user=$user --password=$password --skip-column-names -e "select $param1 $param2 $param3 = 3"` echo $result

Python 3.3.2 - How to Set Out a Small Database? -

i creating small database 'trial', per se. have tried few setting outs ( [{key: value}, {key: value}] . but, need solution can called id (12345), name (rob alsod), area (a4 (like apartment building)), or job (manager, administrator, etc). so, dictionary (which can called one key) not work. tried making 'person' class, need way keep track of classes, , assign them easily. example, for whatever in whatever: = person(name = 'rob alsod', id = 12345, job = 'admin', area = 'a1') # can make iterate with? (badly formed question) my point is, loops through, cannot assign same thing again , again. could try make sense of saying, , suggest way format database? you use sqlalchemy sqlite. sql queries few lines of code away: from sqlalchemy import * db = create_engine('sqlite:///people.db') metadata = metadata() user = table('people', metadata, column('id', integer, primary_key = true), column('name...

html - WebGL in QuickLook -

is possible use webgl in quicklook plugin? i followed tutorial replacing relevant code in generatepreviewforurl.m with osstatus generatepreviewforurl(void *thisinterface, qlpreviewrequestref preview, cfurlref url, cfstringref contenttypeuti, cfdictionaryref options) { nsstring *_content = [nsstring stringwithcontentsofurl:(__bridge nsurl *)url encoding:nsutf8stringencoding error:nil]; nsstring* path = @"/users/myusername/downloads/todoql/demo.html"; nserror *error = nil; nsstring* _html = [nsstring stringwithcontentsoffile:path encoding:nsutf8stringencoding error:&error]; if(error) { // if error object instantiated, handle it. nslog(@"error while loading file: %@", error); } nslog(@"\n%@\n",_html); qlpreviewrequestsetdatarepresentation(preview,(__bridge cfdataref)[_html datausingencoding:nsutf8stringencoding],kuttypehtml,null); return noerr; } void cancelpreviewgeneration(void *thisin...

dispatch - C# Dispatching code to run at a later time? -

how can dispatch code run @ later time? : threadpool.queueuserworkitem(callback, timespan.fromseconds(1)); // call callback() 1 second you can try following: system.threading.timer _timeouttimer; //... int timeout = (int)timespan.fromseconds(1).totalmilliseconds; _timeouttimer = new system.threading.timer(ontimerelapsed, null, timeout, system.threading.timeout.infinite); //... void ontimerelapsed(object state) { // _timeouttimer.dispose(); }

javascript / jQuery functions not firing -

updated : thanks feedback. did have multiple faults in code, my problem string in code inside jquery/javascript functions (that did not post here, because didn't think of faulty) faulty string: var deleteanswer = prompt("are sure want delete project?\nname: "+<?=$project['projname']?>+"\ncompany: "+<?=$project['compname']?>); correct string: var deleteanswer = prompt("are sure want delete project?\nname: <?=$project['projname']?>\ncompany: <?=$project['compname']?>"); i switch use document.ready , instead of window.load and use firefox, start check errors in f12 console -> errors jshint nice tip, can check code there. thanks lot feedback guys! =) i've been using javascript , jquery on page now, , it's been working until now. for reason none of code inside <script> tag fire anymore. maybe i'm missing important. i've removed of code hope enou...

extract string from xml java -

i receive xml string client <?xml version="1.0" encoding="utf-8"?> <esp:interface version="1.0" xmlns:esp="http://***confidential****/"> <esp:transaction actioncode="approve" cardnumber="474849********28" expirydate="0824" responsecode="00" terminalid="03563001" track2="474849********28=08241261234" transactionamount="300" transactionid="00051" type="purchase" localdate="0823" localtime="152006" posoperatorid="1234" authorizationnumber="123456" messagetype="referal"> </esp:transaction> </esp:interface> i want extract each string like actioncode="approve" cardnumber="474849********28" expirydate="0824" responsecode="00" terminalid="03563001" track2="474849********28=08241261234" transactiona...

qt - python crashed with Pyqt5 and QComboBox (QBasicTimer error) -

python crashed when close program error : qbasictimer::start: qbasictimer can used threads started qthread i havn't timer or thread in program. and discover line make crashing : self.combobox = qcombobox(self) or combobox = qcombobox(self) or combobox = qcombobox() self.mylayout.addwidget(combobox) in otherword, when "draw" qcombobox, there crash when close program if switch qcombobox classic widget (for example, qtoolbutton), there no crash i work python 3 , pyqt5 i hope here can point out or guess why happening.

ios - Is there a way I change the time ago text for a UILocalNotification? -

Image
is there way can change "now" text in screenshot? i'm creating calendar app , notify users 10 minutes before event. text "now" can misleading. i sure 99% can't. system-wide notification system , label show time since notification arrived , change timestamp. i've seen no way send notification past. if find 1 - let me know.

javascript - Ember.js anchor link -

i have login box on homepage need link to. login box has id="login " in html , have link <li><a href="#login">login</a></li> on click takes me login div when hit refresh or go directly link anchor uncaught error: no route matched url 'login' anybody has ideas how can accomplish simple task in ember? thanks. update here's how code looks like: the navigation <ul class="nav navbar-nav pull-right"> <li><a href="#login">signup</a></li> <li>{{#linkto 'about'}}about{{/linkto}}</li> </ul> and somewhere below on page have <section id="login"> -- content </section> query params updated answer based on query params approach (currently featured flag of dec 21 2013) based on alexspellers original jsfiddle, complete demo can found here: http://jsfiddle.net/e3xph/ in router , add support query params app...

ruby on rails - FactoryGirl:create the same object multiple times -

in 1 of rspec test, creating multiple objects same factory definition eg factorygirl.create(:model_1) factorygirl.create(:model_1) factorygirl.create(:model_1) is there method factory_girl provides in 1 line i know can do 3.times {factorygirl.create(:model_1)} but looking factory_girl provides creating multiple objects of same model. you can create list (hence create x objects @ once): factorygirl.create_list(:model_1, 3) documentation lives here .

sql - nhibernate queryover join temp table -

here sql: declare @temp table (id uniqueidentifier not null primary key nonclustered, tadate datetime) insert @temp select ta.accountid, max(ta.date) data ta inner join account taac on ta.accountid=taac.id ta.firmid = '7d78f9c2-1604-456a-84f2-4b85cd9da1c4' , ta.date between '2011-09-01' , '2011-09-30' group ta.accountid select ta.* data ta inner join @temp temp on ta.accountid=temp.id , ta.date = temp.tadate; i want same thing using query over. answer appreciated.

java - Want to exit from for loops -

i want exit 2 loops when count become 9. use break can exit first loop. how can done? arraylist<string> list = new arraylist<string>(); int count = 0; system.out.println("before entering loop"); for(int i=0;i<5;i++){ list.add("xyz"+i); for( int j=0;j<5;j++){ list.add("abc"+j); count++; if(count==9){ system.out.println("i want exit here."); break; } system.out.println("i="+i+"::j="+j); } system.out.println("------------"); } for(string str:list){ system.out.println(str); } } you can use labels: outer: (...) { // <-- ... (...) { if (...) break outer; // <-- } } this covered in branching statements section o...

regex - How Do I redirect to php file with Htaccess -

is there way redierct url php file based on 1 part of url. for example have url - http://www.website.org/cat/89/diamond-wedding-rings.htm i have few different of these urls. wish redirect pages /cat/ php file pull id , display category , products. in htaccess have rewriterule ^cat/([0-9]+)/(.*)\.htm category.php?cat_id=$1&title=$2 [nc,l] i'm not getting 404 because cms system redirects homepage if page not found. i'm complete noob when comes htaccess , i'm basing on of existing rules in htaccess similar. don't need title part it's id. if need id work rewriterule ^cat/([0-9]+)/(.*) category.php?cat_id=$1

c++ - Get the horizon for a point during incremental Convex Hull 3D -

Image
i'm implementing incremental ch 3d in c++ qt, can't overcome problem: i have find view horizon of given point: i have map list of visible faces of given point "pr", don't know how horizon without changing algorithm complexity (it's o(nlogn)). my idea was: visible faces' edge, check if twin's incident face visible or not. if it's not visible add in horizon edge list, change algorithm's complexity (i think). note have list have set of points can view given face (maybe helps). really in advance if have convex polytopes, , idea should (it's complexity o(1), have results). yep, lookup complexity o(n).

.net - Xml Validation error: validating against empty schema set -

i getting error the xmlschemaset on document either null or has no schemas in it. provide schema information before calling validate. but have schema file located in location specified: c:\invschema.xsd there no specific namespace passed, set empty. so, why getting error? i need know if xml schema validated, validate function no return boolean value confirming it. how can value invimp.validate(evthandler) ? below code: private function validateschema() boolean try dim settings xmlreadersettings = new xmlreadersettings() settings.schemas.add("", "c:\invschema.xsd") settings.validationtype = validationtype.schema dim evthandler validationeventhandler = new validationeventhandler(addressof validationeventhandler) dim reader xmlreader = xmlreader.create(_filename, settings) dim invimp xmldocument = new xmldocument invimp.v...

vba - Loop through to copy multiple outlook attachments type mismatch error -

i trying loop through message copy multiple attachments, no success, i'm getting 13 - type mismatch error!!! any suggestions appreciated. my code follows, private sub items_itemadd(byval item object) on error goto errorhandler 'only act if it's mailitem dim msg outlook.mailitem if typename(item) = "mailitem" set msg = item 'set folder save in. dim oldestfldr outlook.mapifolder dim myattachments outlook.attachments dim att string dim integer 'location save in. can root drive or mapped network drive. const attpath string = "c:\users\pkshahbazi\documents\emailattachments\" = 0 'save attachment set myattachments = item.attachments if msg.attachments.count <> 0 each myattachments in msg.attachments att = myattachments.item(i).displayname myattachments.item(i).saveasfile attpath...

css - Thinking of the 'zoom' in responsive design -

i trying responsive design using html , css, here problem: if resize window, layout fits , if zoom, layout fits again, have no problem it, if zoom when window resized, layout breaks little. does important find solution this? have no problem 200%, 300% levels of zoom, 400% or 500% make problems me. in general, responsive layout shouldn't need zoomed because fits device/browser window , has been designed "finger-friendly". that, can use viewport stop users zooming: <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">

ios - 'NSInvalidArgumentException', reason: '-[UINavigationController setMed:]: unrecognized selector sent to instance 0x746dda0' -

i making app people health conditions manage medication. have created modal add medication works , saves new medication using core data. i trying allow people edit medication after has been saved. trying send managed object of medication "fibromappmedseditviewcontroller" , assign information in viewdidload method of class. i keep getting error: 'nsinvalidargumentexception', reason: '-[uinavigationcontroller setmed:]: unrecognized selector sent instance 0x746dda0' could tell me doing wrong? relevant methods in fibromappmedslistviewcontroller.m - (void)tableview:(uitableview *)tableview didselectrowatindexpath:(nsindexpath *)indexpath { //selmed declared @ top of file nsmanagedobject *selmed; selmed = [self.meds objectatindex:indexpath.row]; nslog(@"selected med: %@",[selmed valueforkey:@"name"] ); uistoryboardsegue *seguestring = [nsstring stringwithformat:@"%@",@"editmeds"]; nslog(@...

Compare two lists in excel and find uniques and dupes -

Image
there 2 lists need compare, see below pic: what want compare if each id , option in left list exists or not in right list. tried use vlookup , countif dont know how deal , condition(id , option) in both of them. how can this? =if(countifs(k:k,h2,l:l,i2)>0,"duplicate","unique")

java - Call constructor within constructor with self(this)-parameter -

i need link object of type b instance of type (circular dependencies). declare method, must called after constructor of , link new b a-instance. want achieve not having call such method manually. sample code: public class a{ b b; public a(){ b = new b(this); // not work, // references object has not been created yet } } public class b{ a; public b(a a){ this.a = a; //or else } } i commented problematic line. understand why can't work. need know is, if there well-known design pattern avoid problematic? or should redesign class model, putting in b a? suggestions? it does work. it's problematic in exposes object before it's been initialized (so if b constructor calls methods on parameter, example, bad thing), work . reference b.a reference instance of a that's been/being constructed. i recommend trying avoid cyclic reference possible, alternative worse, code you've given work. ...

jquery - Word wrap function in Javascript -

i trying write javascript function takes 1, 2 or 3 word phrase , returns same phrase, first found space replaced <br> so hello world becomes hello<br>my world or hello world becomes hello<br>world. ideas? you equally change set of options, passing blanks works fine optional ordered params: http://jsfiddle.net/mhrbf/ <div id='test'></div> <div id='test2'></div> <div id='test3'></div> then in js: function replaceme(sstring, starget, swith, ncount){ if(!sstring) return 'please provide string'; if(!starget) starget = /\s/; if(!swith) swith= '<br/>'; if(!ncount) ncount = 1; for(var c = 0; c < ncount; c++) sstring= sstring.replace(starget, swith); return sstring; } x = 'hello crazy world full of people!'; y = replaceme(x); document.getelementbyid('test').innerhtml = y; y = replaceme(x,'','',10);...

ios7 - Issue with uitableview cell background -

ok, broken of ios 7 beta 6. on startup, changed background of table view image (it same thing if set color) , table cells white... when select cell, go next view, , go view... cells same view background (except cell selected)... this set background... - (void)viewwillappear:(bool)animated { paclisttableview.backgroundcolor = [uicolor colorwithpatternimage:[uiimage imagenamed:@"dotted-pattern.png"]]; paclisttableview.backgroundview = nil; [super viewwillappear:animated]; } any ideas? works fine on ios , below. try setting background color of table view cell clear color. until ios 7 default background clear color. ios 7 has changed white color. have manually set clear color.

Remove html table row using javascript or jquery? -

i have dynamic table in html form has functionality add/drop rows. name of each element has number appended end of specifying row number (e.g. id.0 , id.1 , etc.). have written function attempt remove each row update name of each element: function remove() { var thename=getitemnames(); var counter=thename.length; var index=0; f.preventdefault(); $(this).parents("tr").remove(); counter--; $('input[name*="id."]').each(function() { $(this).attr("name", "id."+index); index++; }); $('input[name*="date."]').each(function() { $(this).attr("name", "date."+index); index++; }); $('input[name*="value."]').each(function() { $(this).attr("name", "value."+index); index++; }); $('input[name*="required."]').each(function() { $(this).a...

swing - Java - get click off the limits of JPanel -

Image
i have following doubt: possible "mouse left click event" off limits of component mouselistener? or should try approach? my problem following. creating wysiwyg panel suitable project. panel sibling panel displays images loaded according user selection. need get, instance, background color of image. when color clicked change bgcolor of wysiwyg panel. using robot class color of pixel, works if image , color selector in same panel, won't be. update: code mean. mainframe has 2 independent jframes. need rgb color of images on imageloader click on mousecolorpane. on case, robot can black border of jlabel. import java.awt.*; import java.awt.event.mouseevent; import java.awt.event.mouselistener; import java.awt.image.bufferedimage; import java.io.file; import java.io.ioexception; import javax.imageio.imageio; import javax.swing.*; public class whatsmycolor { public static void main(string[] args) throws ioexception { new whatsmycolor(); } public...

ios - Facebook App ID for multiple Apps -

do need unique facebook app id every single app or use facebook app id multiple apps. a unique app must have unique id, isn't it? so, yes each app has unique app id; different platforms same app, single app id used.

python - Import txt file and having each line as a list -

i'm new python user. i have txt file like: 3,1,3,2,3 3,2,2,3,2 2,1,3,3,2,2 1,2,2,3,3,1 3,2,1,2,2,3 but may less or more lines. i want import each line list. i know can such: filename = 'myfile.txt' fin=open(filename,'r') l1list = fin.readline() l2list = fin.readline() l3list = fin.readline() but since don't know how many lines have, there way create individual lists? do not create separate lists; create list of lists: results = [] open('inputfile.txt') inputfile: line in inputfile: results.append(line.strip().split(',')) or better still, use csv module : import csv results = [] open('inputfile.txt', newline='') inputfile: row in csv.reader(inputfile): results.append(row) lists or dictionaries far superiour structures keep track of arbitrary number of things read file. note either loop lets address rows of data individually without having read contents of file memory ...

java - Trying to not Omit Leading 0's when writing from Int to Hex using buffered writer -

i create buffered writer bufferedwriter errorreport = new bufferedwriter(new filewriter("errorreport.txt")); then wanted write while converting integer hex. errorreport.write(integer.tohexstring(version)) this works perfectly, except omits leading 0's writes minimum possible length. 'version' byte in length , prints 6. know actual value 06. how keep these leading 0's? i tried errorreport.write(string.format("%03x", integer.tohexstring(version)), error illegalformatconversionexception x != java.lang.string the x specifies hexadecimal format perform conversion passing integer directly errorreport.write(string.format("%03x", version));

c# - Pass values from view to controllers -

i starting off mvc framework , trying things. 1 of them create simple registration page has few textboxes , passes values controller in turn saves database. i have used form posting method achieve similar task @using (html.beginform()) { @html.label("username:") @html.textbox("texbotusername", "") <br /> @html.label("password:") @html.textbox("texbotpassword", "") <br /> <input type="submit" value="signin" name="action:signin" /> <input type="submit" value="register" name="action:register" /> } [httppost] [multibutton(name = "action", argument = "signin")] public actionresult signin(string textboxusername) { return content(textboxusername); } apart above, there better way pass values (using models maybe?) per best practices stuff. thanks an...

sql - select total count() group by year and month? -

for example imagine table below select accountid, createdon account 73c56f61-5ff1-e111-a4f8-005056977fbc 2012-08-28 22:26:47.000 a7c56f61-5ff1-e111-a4f8-005056977fbc 2012-08-28 22:26:48.000 b7c56f61-5ff1-e111-a4f8-005056977fbc 2012-08-28 22:26:48.000 fbc56f61-5ff1-e111-a4f8-005056977fbc 2012-08-28 22:26:49.000 cbc66f61-5ff1-e111-a4f8-005056977fbc 2012-08-28 22:26:54.000 87c66f61-5ff1-e111-a4f8-005056977fbc 2012-08-28 22:26:53.000 53c76f61-5ff1-e111-a4f8-005056977fbc 2012-08-28 22:26:55.000 87c76f61-5ff1-e111-a4f8-005056977fbc 2012-08-28 22:26:56.000 2ed89924-5cfc-e111-a4f8-005056977fbc 2012-09-11 22:01:51.000 c0d79924-5cfc-e111-a4f8-005056977fbc 2012-09-11 22:01:49.000 then in january 2012 count 10 accounts query select count(*) account let's have 5 new accounts in february 2012, querying count(*) in february 2012 returns 15 accounts. if have 10 new accounts in march 2012, then querying count(*) in march 2012 returns 35 accounts in total...