Posts

Showing posts from September, 2014

c# - How to connection string in web.config from databases names in dropdown -

i have dropdown has list of databases. user has select database has use , gridview shown. so display gridview i'm giving below connection string in code behind file. using (sqlconnection con = new sqlconnection(@"data source=hki-d-sql05\sql2k12;initial catalog=" + dropdownlist1.selectedvalue + ";user id=sa;password=sa123")) but there anyways list connection string in web.congfig file? database name has selected in code behind. means server name, user id , password can given in web config initial catalog in code behind. you can use placeholder database name in web.config (e.g. " data source=hki-d-sql05\sql2k12;initial catalog={{placeholder}};user id=sa;password=sa123 "). in code behind connection string value web.config , replace placeholder selected database (using .replace("{{placeholder}}", dropdownlist1.selectedvalue) ).

.htaccess - simple "Up a directory" button in htaccess? -

a while ago using htaccess display files, , started project again , found had somehow deleted "go level" button then. can tell me code line in htaccess looks button back? should relatively simple cant find it... heres got. options +indexes # directory customization <ifmodule mod_autoindex.c> indexoptions ignorecase fancyindexing foldersfirst namewidth=* descriptionwidth=* suppresshtmlpreamble # set display order indexorderdefault descending name # specify header file headername /partials/header.html # specify footer file readmename /partials/footer.html # ignore these files, hide them in directory indexignore .. indexignore header.html footer.html icons # ignore these files indexignore header.html footer.html favicon.ico .htaccess .ftpquota .ds_store icons *.log *,v *,t .??* *~ *# # default icon defaulticon /icons/generic.gif addicon /icons/dir.gif ^^directory^^ addicon /icons/pdf.gif .txt .pdf addicon /icons/back.png .. </ifmodule> options -i

Error when trying to install PHP curl - Ubuntu 14.10 -

when try run sudo apt-get install php5-curl i error php5-curl : depends: php5-common (= 5.5.9+dfsg-1ubuntu4.14) 5.5.12+dfsg-2ubuntu4.6 installed what mean , how fix it? apt-get install php5 (or php5-core or php5-common) apt-get install php5-curl

android - Realm with RxAndroid not picking up latest data changes -

i using realm rxandroid. having strange issue realm not picking latest modification done on db. there 2 methods using. observable<integer> save(bitmap bitmap). observable<integer> getimagelist(context applicationcontext). like this activity 1 getimagelist(applicationcontext) button click -> activity 2 save(bitmap) finish() getimagelist(applicationcontext) this method "save" adds newly created model realmlist. private observable<integer> save(bitmap bitmap) { return observable.create((observable.onsubscribe<integer>) subscriber -> { -------------------------------------- -----various file creation stuff------ -------------------------------------- userimagesmodel model = realm .where(userimagesmodel.class) .findfirst(); //imagemodel class extends realmobject imagemodel imagemodel = new imagemodel();

javascript - Construct function from strings -

this question has answer here: javascript property access: dot notation vs. brackets? 10 answers i wondering if possible. let's use 'canvas' example: (function(){ function canvas(canvas){ this.canvas = document.queryselector('#canvas'); this.ctx = this.canvas.getcontext('2d'); this.testmethod('fillrect',[10,10,10,10]); } canvas.prototype.testmethod = function(method,params){ this.method = method; this.params = params; this.ctx.method.apply(this.ctx, params); } var canvas = new canvas(); })() <canvas id='canvas' width=400 height=400></canvas> of course doesn't work wonder if it's possible dynamically construct functions in way. achive sort of user interface input method name , parameters , executed in specific context (canvasrenderingcontext2d in particular example)

javascript - AnyChart APEX5 Integration -

Image
i'm developing web page apex 5. want show anychart of type, not included in apex chart region options, e.g. area charts or marker charts. i've had multiple ideas, couldn't make work. has succeeded in showing custom anycharts in apex pages of standard anychart javascript api or xml? i tried both xml , javascript, called dynamic action on page load. couldn't find right configuration, never worked. glad if has example of functioning anychart integration, i'd know place , when. we use custom anychart xml on of our diagrams. use application proccesses. html code: <span id="chartspan"> </span> the js code following: for adding element (change paths accordingly): var chart = new anygantt('/i422/flashchart/anygantt_4/swf/anygantt.swf'); chart.addeventlistener('resourceselect', onresourceselect); chart.addeventlistener('periodselect', onperiodselect); chart.addeventlistener('periodeditingend', on

How do I resize the combo box horizontally in python using pyqt4 -

this code i'm implementing right now, want resize combo box horizontally occupy maximum space possible. combo.resize gives me option stretch vertically. import sys pyqt4 import qtgui, qtcore class phaseone(qtgui.qwidget): def __init__(self): super(phaseone, self).__init__() self.initui() def initui(self): self.resize(350,150) self.center() self.setwindowtitle('programmer') self.setwindowflags(qtcore.qt.windowminimizebuttonhint) qtgui.qtooltip.setfont(qtgui.qfont('sansserif', 10)) btn = qtgui.qpushbutton('next', self) btn.settooltip('proceed next step') btn.resize(btn.sizehint()) btn.move(250, 110) btn = qtgui.qpushbutton('exit', self) btn.settooltip('exit application') btn.resize(btn.sizehint()) btn.move(175, 110) self.lbl = qtgui.qlabel("select programming langua

visual c++ - CDocTemplate and m_templateList -

i upgrading software 16 bit 32 bit in vc++ using mfc, , understand in recent versions of mfc can no longer access m_templatelist in cdoctemplate , must use getfirstdoctemplateposition , getnextdoctemplate instead. no problem far enumerating templates concerned (a dialog being opened in case there more 1 template). question approach best round fact reference template list being passed dialog on creation, , selected template being returned? here code: void cmtapp::onfilenew() { cstring s; if (m_templatelist.isempty()) { trace0("error : no document templates registered cwinapp\n"); afxmessagebox(afx_idp_failed_to_create_doc); return; } cdoctemplate* ptemplate = (cdoctemplate*)m_templatelist.gethead(); if (m_templatelist.getcount() > 1) { // more 1 document template choose // bring dialog prompting user copentypedlg dlg(&m_templatelist); if (dlg.domodal() != idok) return; // none - cancel operation ptemplat

xcode - Create NSManagedObjectSubclasses generate class outside of my project -

Image
i have problem when use create nsmanagedobjectsubclasses. when use in swift project generated classes file automatically saved outside of project structure. need manually move inside project "copy items if needed" checked every time. how can avoid behavior? you should select group need. if choose editor -> create nsmanagedobject subclass, group of project not selected default.

c# - Detect XAML FlipView swipe states -

<flipview x:name="camerafilpview" manipulationmode="all" manipulationstarted="camerafilpview_manipulationstarted" manipulationdelta="camerafilpview_manipulationdelta" manipulationcompleted="camerafilpview_manipulationcompleted"> </flipview> i'm trying detect swipe gesture state of flipview component none of events used. doing wrong? i solved using scrollviewer , horizontalsnappoints instead of flipview.

javascript - Word Cloud for Other Languages -

Image
i using jasondavies's word cloud project, there problem using persian[farsi] strings , problem here words have overlapping in svg. this project's output: what happened farsi words? as explained on about page project , generator needs retrieve shape of glyph able compute "safe" put other words. page explains process in more detail, here's care for: glyphs rendered individually hidden <canvas> element. pixel data retrieved bounding boxes derived the word cloud generated. now, critical insight in western (and many other) scripts, glyphs don't change shape based on context often. yes, there such things ligatures, rare, , not necessary script. in persian, however, glyph shape change based on context. non-persian readers, @ ی , س which, when combined, become یس. yes, last 1 two glyphs! the algorithm has no problem dealing persian characters, can see hacking demo on page, putting breakpoint after d.code generated, able mod

database - Sharding schemes -

i looking sharding schemes, , need literature on that. far ones have found: - key based partitioning - vertical partitioning - directory based partitioning any more ideas on sharding? , glad if can provide literature on or books etc. disclaimer: work scalebase , provider of complete mysql scale-out solution "automatic sharding machine" if like... we've seen thing or 2 shrading... we have resources key-based sharding (hash, range, list) , data distribution on our site: http://www.scalebase.com/products/database-sharding/ http://www.scalebase.com/resources/webinars/ - (search "webinar – 10.23.12: benefits of automatic data distribution") i invite @ blog, posts such as: http://database-scalability.blogspot.co.il/2013/01/partial-partitioning-and-sharding.html i'll happy answer question or give more material!

c# - Sum two dates represented in a hh:mm:ss string format -

this question has answer here: c# method sum hh:mm data ??? 1 answer how can put 2 times , want stay in time format: hh:mm:ss string time1 = "00:49:35"; string time2 = "00:31:34"; totaltime = time1 + time2; this should result 01:21:09 (1 hour , 21 min , 09 sec) how using timespan class: timespan time1 = timespan.parse("00:49:35"); timespan time2 = timespan.parse("00:31:34"); timespan res = time1 + time2; console.writeline(res.tostring()); // 01:21:09, may omit tostring() call if don't want parse string, can construct timespan object: timespan time1 = new timespan(00, 49 ,35); timespan time2 = new timespan(00, 31 ,34); timespan res = time1 + time2; console.writeline(res); // 01:21:09

ios - How to get Mobile Number from vCard String Objective C -

i working on action extension objective c. have created extension share recent contact in extension. in getting v card string. how can mobile number v card string. appreciated. using contactswithdata:error: class method of cncontactvcardserialization , can retrieve info vcard. it's contacts.framework , available since ios9. earlier version, can use addressbook.framework . can read info here . nserror *errorvcf; nsarray *allcontacts = [cncontactvcardserialization contactswithdata:[contactstr datausingencoding:nsutf8stringencoding] error:&errorvcf]; if (!errorvcf) { nsmutablestring *results = [[nsmutablestring alloc] init]; //nslog(@"allcontacts: %@", allcontacts); (cncontact *acontact in allcontacts) { nsarray *phonesnumbers = [acontact phonenumbers]; (cnlabeledvalue *avalue in phonesnumbers) { cnphonenumber *phonenumber = [avalue value];

ssl - New Certificate - PKIX path building failed -

i have bought new wildcard ssl certificate our domain our old 1 expire. have installed on our cas server , our application server, getting following stacktrace on our app server: message: javax.net.ssl.sslhandshakeexception: sun.security.validator.validatorexception: pkix path building failed: sun.security.provider.certpath.suncertpathbuilderexception: unable find valid certification path requested target cause: javax.net.ssl.sslhandshakeexception: sun.security.validator.validatorexception: pkix path building failed: sun.security.provider.certpath.suncertpathbuilderexception: unable find valid certification path requested target trace: org.jasig.cas.client.validation.saml11ticketvalidator.retrieveresponsefromserver(saml11ticketvalidator.java:231) org.jasig.cas.client.validation.abstracturlbasedticketvalidator.validate(abstracturlbasedticketvalidator.java:207) the certificate identical on both servers. i think godaddy certificate in jvm had expired, no longer trusted,

installshield - How to find the install location and GUID of 3rd party application whose GUID changes for every installation using install shield? -

i know application name , trying find install location , guid of application using install shield. i found application registry values(like displayname, installlocation, uninstallstring, etc) in following location manually: hkey_local_machine\software\wow6432node\microsoft\windows\currentversion\uninstall{guid} but guid of application different in each client machine, i'm not able hard code registry path these values using following function. regdbgetkeyvalueex(); can able find guid of application if know application name? thanks. you can list uninstall keys code similar regdbquerykey example : #define uninstallkeypath "software\\microsoft\\windows\\currentversion\\uninstall" listkeys = listcreate(stringlist); regdbquerykey(uninstallkeypath, regdb_keys, listkeys); and can iterate these keys looking appropriate value using code similar listgetnextitem example : nresult = listgetfirstitem(listkeys, sitem); while (nresult != end_of_list)

excel - Deleting or keeping multiple rows by a specific word content -

i'm trying write code either deletes or keeps rows specific word input end-user. i've created 2 button actions: sub button1_click() dim cell range word1 = inputbox("enter word want keep rows", "enter") each cell in selection cell.entirerow.hidden = (instr(1, cell, word1, 1) = 0) 'keep word input user next end sub sub button2_click() dim cell range word2 = inputbox("enter word want delete rows", "enter") each cell in selection cell.entirerow.hidden = (instr(1, cell, word2, 1) = 1) 'delete word input user next end sub however, these buttons don't work quite way them do. problems: 1) have select cells in column of text searched; if select whole block of data,everything deleted. 2) actually, program handier, if did magic cell j22 onwards (to right , downwards) until end of data reached, without need select anything. best way this? 3) if use these buttons several times sequentially, rows i've deleted

html - div-width depends on width of sibling -

following menu trying create. i want menu item divs independent in width, , have width required text inside thought default behavior. did go wrong? .patlelast { padding: 10px; border-radius: 1000px 0px 1000px 1000px; background-color: black; width: auto; margin: 1px; } .patlefirst { padding: 10px; border-radius: 1000px 1000px 0px 1000px; background-color: black; margin: 1px; } .patle { padding: 10px; border-radius: 1000px 0px 0px 1000px; background-color: black; } .toppan { position: fixed; top: 10px; right: 0px; color:white; font-family: 'raleway', sans-serif; z-index: 1000; text-align: right; } <div class="toppan"> <div class="patlefirst"> book tickets </div> <div class="patle"> screening schedule </div> <div class="patlelast"> book tickets </div> </div> this

javascript - Replace all specific characters with counter ascending? -

i have string this: var str = "some text here - first case - second case - third case text here"; now need output: var newstr = "some text here 1. first case 2. second case 3. third case text here"; all can removing - . need replace $1 dynamic number... possible? something this: .replace (/(^\s*-\s+)/gm, "{a dynamic number ascending}. ") you can use string#replace callback , counter. using es2015 arrow function : str.replace(/^\s*- /gm, () => counter++ + '. '); var str = `some text here - first case - second case - third case text here`; var counter = 1; str = str.replace(/^\s*- /gm, () => counter++ + '. '); console.log(str); document.write(str); // demo purpose equivalent code in es5 str.replace(/^\s*

excel - Save As - "filename & date from cell", in 20160127 format -

so i've been looking here , googling quite bit, , can find tips on how code this, nothing on how keep dateformat. i want save file i've opened in routine, date in particular format, 20160127 (as in source-cell) added filename. right now, value in fname gets stored 01/27/2016, not in current format. fname = [cellwithdate] daily.saveas ("d:\docs\vba\daily summary_us_ " & fname & ".xlsx") current filename "daily summary_us_.xlsx". can add fname so? , how keep in correct format? cheers. or can use: fname = [cellwithdate].text to keep cell's original format (as in source-cell).

django - Show information based on users -

i have class called schedule field (is correct?) i've set using admins = models.manytomanyfield(user) . field contains list of users can select multiples of. in view schedule, show bunch of information. show couple additional things based on if logged in user included in admins of schedule being viewed. according django philosophy, should have business logic within views , presentation logic in template. computation if logged user among admins should done in view, , if user is, displayed should determined in template. can accomplish by: # views.py def schedule(request, id): schedule = get_object_or_404(schedule, pk=id) if request.user.is_authenticated(): is_admin = schedule.admins.filter(pk=schedule.pk).exists() else: is_admin = false data = { 'schedule': schedule, 'is_admin': is_admin, } return render_to_response('template.html', data) # template.html {% if is_admin %} <p>

hapijs - How to call Hapi Plugins for certain routes? -

im using hapi 12.1. trying figure out how call extension points on routes. for example : '/hello' want call 3 different extension points work on 'onrequest' step. for: '/goodbye' want call different extension point works on 'onrequest' different operation , 'onpreauth' step. for: '/health' dont call extension points, , drop handler straight away.. i have tried various ways create plugin, define routes, , extension points. seems the extension points global, , dont operation on plugin's scoped routes. what missing? you have access path on extension points, using request.route.path . that, can define want run, depending on path. example: server.ext('onpreauth', function (request, reply) { switch(request.route.path) { case '/test1': case '/test2': // break; case '/test3': // else break; } rep

Jquery UI sortable update single record -

i have list this: <ul id="sortable"> <li class="ui-state-default" id="31"> list item </li> <li class="ui-state-default" id="32"> list item </li> </ul> and in backend (cakephp) have following action: public function ajaxupdateorder(){ $this->autorender = false; if(!empty($this->request->data)){ $meetingstable = tableregistry::get('meetings'); $meeting = $meetingstable->newentity(); $meeting->id = $this->request->data['id']; $meeting->priority = $this->request->data['priority']; $meetingstable->save($meeting); } } i need able catch id li element , current possition able make request fits backend function, cannot figure out docummentation. any or guidance appreciated. edit as requested in comments be

Erlang vs Elixir Macros -

i have came across erlang code trying convert elixir me learn both of languages , understand differences. macros , metaprogramming in general topic still trying head around, understand confusion. the erlang code -define(p2(mat, rep), p2(w = mat ++ stm) -> m_rep(0, w, stm, rep)) % m_rep function defined. to me, seems in above code, there 2 separate definitions of p2 macro map private function called m_rep . in elixir though, seems possible have 1 pattern matching definition. possible have different ones in elixir too? these not 2 definitions. first line macro, second line replacement. confusing bit macro has same name function generating clauses. example when using macro this: ?p2("a", "b"); ?p2("c", "d"). the above expanded to: p2(w = "a" ++ stm) -> m_rep(0, w, stm, "b"); p2(w = "c" ++ stm) -> m_rep(0, w, stm, "d"). you can use erlc -p produce .p file show ef

c# - Interface IDataErrorInfo isn't working -

i have following class have implemented idataerrorinfo interface doesn't work i.e doesn't validation. code seems perfect. dont know why. put break point , doesn't enter idataerrorinfo members region. product class [datacontract()] public class product : idataerrorinfo { [datamember()] public string name{get;set;} [datamember()] public string code{get;set;} #region idataerrorinfo members public string error { { return null; } } public string this[string property] { { switch (property) { case "name": if (string.isnullorempty(name)) return "name required"; break; case "code": if (string.isnullorempty(code)) return "code required"; break;

python - My game keeps calling a method for the wrong sprite -

when try run game code tries run method wrong sprite. think line "player.handle_keys()" problem when run it, says can't find "handle_keys()" method "meteor" class. haven't got line run "meteor.handle_keys()" class should not have method. here code: import pygame import random # define colors black = ( 0, 0, 0) white = (255, 255, 255) red = (255, 0, 0) bg = pygame.image.load("bg1.png") class space_ship(pygame.sprite.sprite): def __init__(self, color, width, height): super().__init__() # create image of space_ship1, , fill color. # image loaded disk. self.image = pygame.surface([width, height]) self.image.fill(white) self.image.set_colorkey(white) self.rect = self.image.get_rect() #draw image self.image = pygame.image.load("player1.gif").convert() # draw ellipse #pygame.draw.ellipse(self.image, color, [0, 0, width, heig

Java SWT StyledText event to detect when the Control autoscrolls to show cursor position -

for rcp text editor styledtext used. the styledtext background-image , text need scrolled @ once. how can detected event of autocroll? if exists. for example: if user press end_key , line in caret located is longer size of styledtext control area, control autoscrolls show caret position. same happeds if user press lef_arrow , cursor @ beggining of line , previous line has lenth greater control size. so when autoscroll detected, listener can redrawn background accordingly. up date solution found write listeners each event produced autoscroll. i.e. write events for: st.addcaretlistener(new caretlistener (){...}; st.addlistener(swt.modify, new listener() {...}; ... st.addkeylistener(){...}; st.addmouselistener(){...}; so inside of each event write code paint background image. whith listener notified when controls scrolls itself, code shall more efficient. thanks in advance

c# - Find unhandled exception in windows service OnStart -

i have selfhosting wcf service consists of dll , windows service. in dll wcf service , app.config described. wcf service meant host whole thing. my problem when try start service wont start. "your service has been started , stopped" kind of thing. i tried search error outcommenting code. did until there structure (initialisation, onstart, onstop) , didn't work? is happens more often? system.diagnostics.debbuger.launch doesn't work debug. has better ideas of debugging onstart method? add try...catch in 'onstart' method logging event log , see if receive exceptions. there chance problems might exist in wcf binding or service contract implementation. so, please check wcf config issues. if can post contents of config, better give more guidance. for quick troubleshooting, can host wcf in console application , see if working fine rather starting service every time.

sql - need an oracle query joining 2 tables with 2 conditions -

i have master table select * table_master pkid empno name 1 101 aaa 2 102 bbb 3 103 ccc select * table_txn txn_pkid master_fkid empno remarks 1 1 101 na 2 2 500 wrong entry 3 3 123 wrong entry i need query fetch records: 2 2 500 wrong entry 3 3 123 wrong entry something like: select * table_master a, table_txn b a.pkid = b.txn_pkid a.empno <> b.empno i think logic works fine join: select t.* table_txn t join table_master m on t.txn_pkid = m.pkid , t.empno <> m.empno ; your code sample work if replaced but and . however, don't use implicit joins. explicit join s introduced in sql more 2 decades ago; explicit syntax clearer, more powerful, , accepted databases.

qt5 - Obfuscated source-code in Qt Community Edition. Still comply the license? -

one customer not adviced former freelancer , used community license of qt5. (lgpl) close release, , found out, should open source-code. ty bye license, not question of money, license model of qt doesn't allow switch community commercial. so question is: allowed obfuscate @ least parts of code, , still use community edition? p.s.: know it's not fair. have valid license myself. yes, in lgpl license can publish binary without source code. there exception, if changed qt's source code (or other [l]gpl source code modified it) must publish changes. , application must not depend on open-source (e.g. gpl) library.

php - alert message displays in new window -

i want display alert message if condition fails.so used following code display message print '<script type="text/javascript">'; print 'alert("you cannot leave field empty")'; print '</script>'; it works fine problem is, showing message in new window blank page background.i need show message in same window.please figure out way this. thanks in advance. show on load print '<script type="text/javascript">'; print 'window.onload = function(){' print 'alert("you cannot leave field empty")'; print '};' print '</script>';

boolean - ElasticSearch bool should_not filter -

i'm newbie in elasticsearch, querion is: there 3 sections in bool filter: must of these clauses must match. equivalent of and. must_not of these clauses must not match. equivalent of not. should @ least 1 of these clauses must match. equivalent of or. how preform should_not query? thanks in advance :) that depends on how wishing "should_not" function. since should equivalent boolean or (i.e. return documents or b or c true), 1 way think of "should_not" equivalent not (a or b or c) . in boolean logic, same not , not b , not c. in case, "should_not" behavior accomplished adding clauses must_not section of bool filter.

android - Max number of devices can GCM send push notifications to -

i wondering limit max number of registered android devices can gcm send message to. know documentation says payload needs 4 kb in size, include list of gcm ids. size of each gcm id 160 bytes, can send multicast push notification 20 devices @ point? based on official google documentation, specifies list of devices (bases on registration tokens or ids) receiving multicast message. must contain atleast 1 , @ 1000 registration tokens. multicast messaging, not single recipients. multicast messages (sending more 1 registration tokens) allowed using http json format only. you may check official google documentation here: https://developers.google.com/cloud-messaging/http-server-ref

bash - sed command to replace part of file -

this question has answer here: use slashes in sed replace 1 answer hi want replace part of /etc/sysconfig/file consists: options='--para' cert_path=/etc/cert i want replace options='--para' options='--para --para2 172.0.0.0/16' so tried: sudo sed -i 's/"options='--para'"/"`options='--para --para2 172.0.0.0/16'"/' /etc/sysconfig/file but error: edit /etc/sysconfig/file sed: -e expression #1, char 88: unknown option `s' can me correct sed-command try this: sudo sed -i "s#options='--para'#options='--para --para2 172.0.0.0/16'#" /etc/sysconfig/file

jquery - How to make accordian display after ajax call is completed -

on click of accordian doing ajax call , appending data accordian contents the accoridian working fine without ajax call , please see jsfiddle here (without ajax call) http://jsfiddle.net/cze3q/1145/ but when integrated ajax accordian , accordian not opening http://jsfiddle.net/cze3q/1144/ this code $(function() { $('#accordion .content').hide(); $('#accordion h2').click(function() { var clcikedid = $(this).attr('id'); var ajaxcall = $.ajax({ url: 'test', success: function(data) { alert('ajx call completed'); } }); ajaxcall.done(function() { if ($(this).next().is(':hidden')) { $('#accordion h2').removeclass('active').next().slideup('slow'); $(this).toggleclass('active').next().slidedown('slow'); } }); }); }); could please tell me how resolve issue ?? you have not use this in done function: if

c# - Happy number out put -

i doing happy number exercise. fyi https://en.wikipedia.org/wiki/happy_number here code using system; using system.collections.generic; using system.linq; using system.text; using system.threading.tasks; namespace consoleapplication23 { class program { static void main(string[] args) { list<string> happynum = new list<string>(); program test = new program(); string number = "7"; if (test.checkhappy(number)) { happynum.add(number); } if (happynum.contains(number)) { console.writeline("1"); } else { console.writeline("0"); } } public bool checkhappy(string num) { int sum = 0; int temp = int.parse(num); while (temp != 1) { while (temp != 0) {

access can't find the field '|' referred to in expression -

i encountered error 'microsoft office access can't find field '|' referred in expression" when using dcount function count number of orderno occurence in table. datatype orderno number. here's i've done if dcount("[orderno]", "tbldisposition", "[orderno]='" & [txtorderno.value] & "'") > 1 msgbox "duplicate data", vbokonly, "error" else msgbox "succeed" end if on form's load event set txtorderno control source orderno in tbldisposition. try use dlookup function , seems same errors. the expression [txtorderno.value] looks wrong. try without square brackets, e.g: if dcount("[orderno]", "tbldisposition", "[orderno]=" & txtorderno.value) > 1 msgbox "duplicate data", vbokonly, "error" else msgbox "succeed" end if

asp.net mvc 3 - MVC3 - Update jQuery from 1.5.2 to latest -

i have mvc3 project uses jquery 1.5.2 , update latest version. bit new mvc3 , wondering consequences of updating jquery? have experience whit this? , how can achieved? best regards dep. in general there big changes in jquery 1.9.x compared previous versions. can check changes here . jquery team did great work , created jquery migrate plugin . idea change 1.5.2 version latest , add link jquery migrate plugin (after jquery). what migration plugin checks if you're using deprecated features (like .live) , plugin works proxy new implementation. should check developer toolbar console messages , make changes according tips. the jquery migration plugin temporary solution adds overhead , should make changes if you're using deprecated features. asp.net mvc depending on 3rd party libraries you're using (telerik, devexpress etc.) might errors if use features/api calls not supported anymore. maybe have newer version implemented using current jquery version.

Is there a Facebook Business API? Data from the Ads not from the Graph API -

ok here's problem. want know if there exist api facebook business. clear, not graph api see user's data via json facebook business create ad. https://business.facebook.com/ does know if possible check data facebook business or kinds of api. company i'm working on needs have report can lead comparison between ads working , not. need grab data each ad's performance. i've done googling facebook business api think there's none. wanna know if there's way work problem around.

php - I keep getting this error when I try input phpunit -

i keep getting error in command line on phpstorm when try use phpunit. can explain me? i'm new phpunit. c:\xampp\php\phpunit.bat warning: missing argument 3 phpunit_textui_testrunner::dorun(), called in c:\xampp\php\pear\phpunit\textui\command.php on line 176 , defined in c:\xampp\htdocs\tutorials\php_unit_testing\vendor\phpunit\phpunit\src\textui\testrunner.php on line 148 phpunit 5.3-dev sebastian bergmann , contributors. fatal error: class 'controllers\core\web\pages' not found in c:\xampp\htdocs\tutorials\php_unit_testing\tests\app\controllers\core\web\pagestest.php on line 6 process finished exit code 255 @ 22:23:20. execution time: 186 ms. here code xml file: <?xml version='1.0' encoding='utf-8' ?> <phpunit bootstrap="./vendor/autoload.php" color="true" converterrorstoexceptions="true" convertnoticestoexceptions="true" conve

python 3.x - How to convert a string array to its ASCII equivalent? -

i'm couple of weeks in gsce computer science coursework , lots of people have been stuck on how convert string array ascii equivalent. i using code: c = input("enter character: ") print ("the ascii vlaue of '" +c+ "' ",ord(c)) but doesn't work entire string. so i'm asking how convert string array equivalent ascii code? i guess search find answer, advice first. you use this: r = [ord(c) c in s] and can (course)work there hth, edwin.

<Python> while statement if the condition is in itself -

while (/*condition include a*/): //for reason has create in process. recently encountered python program has built way. switched method , avoid problem. got me thinking if need while statement condition of statement in excution process of statement. , give error when run not defined. can make work. know it's easy problem, beginner please me if want to, thank you! i think talking do-while loop when first iteration should executed anyway , should checked. if correct there good answer on topic on already.

vba - I need to create a stopping condition for my program -

i have program highlights words between start , end point , loops through extract find same conditions. program works well, except not stop looping. have break running program stop it. can please me write condition says if end reached , start , end condition don't exist, stop program. sub somesub1() dim startword string, endword string dim find1strange range, findendrange range dim delrange range, delstartrange range, delendrange range application.screenupdating = false application.displayalerts = false 'setting ranges set find1strange = activedocument.range set findendrange = activedocument.range set delrange = activedocument.range 'set start , end find words here cleanup script startword = "from: yussuf ismail" endword = "kind regards" 'starting find first word find1strange.find .text = startword .replacement.text = "" .forward = true .wrap = wdfindask .format = false .matchcase = false .matchwholewor

algorithm - Is there any locality-preserving way to flatten a binary tree? -

Image
short version: it possible flatten 2d space 1d space such if 2 points on 2d space close together, mappings 1d close together. similarly, there way map arbitrary position in binary tree, flat index in array, such if 2 nodes close on tree, close on array? long version: let tree type of tagged binary trees. / \ b c / \ / \ d e f g / \ / \ / \ / \ h j k l m n o a position on in tree can given bit string 0 means go left , 1 means go right , empty string root ( a ). example, 011 points k on tree above. moreover, let distance between 2 nodes number of steps takes go 1 another. what map f :: bitstring -> nat node locations (bitstrings) natural numbers such if distance(a, b) small, |f(a) - f(b)| small? i think tilmannz's answer (which uses infix ordering) it's going get. consider every node in binary tree, apart root, has 3 neighbors, , in 1d memory

Intelligent Comparison based Update - Access / VBA -

need intelligently perform updates on access table. expert vba / intelligent thinking required. table1 (for reference only) companycode text regioncategory number (1-99) regioncount number(0 - 25000) table2 invoicenumber number companycode text numrows number regioncode fourdigitnumber confirmationremark y / n ourobjective put yes or no in 'confirmationremark' column. rules : 1.select invoicenumbers have 2 rows table2 , different regioncode. these have same companycode. regioncategory first 2 digits of regioncode. 2.for these 2 invoices - difference between 2 regioncategory must greater two. 3.lookup regioncount , table1 decision making : comparing 2 invoices different regioncodes. idea , invoice higher regioncount 1 marked yes. 1.the difference between regioncount must considerable. 'considerable' - trying determine right number. let take 500 now. 2.the invoice lower region count - should have regio

c++11 - C++ standard library forward_list issue -

i need solving exercise 9.28 c++ primer 5th edition. here task: write function takes forward_list , 2 additional string arguments. function should find first string , insert second following first. if first string not found, insert second string @ end of list. i can't idea written in book how forward_list works , why indeed need it, i'm asking help. below code wrote incomplete , need me finish it: #include <iostream> #include <forward_list> using namespace std; void find_and_insert(forward_list<string>& flstr, const string& needle, const string& rplc) { auto curr = flstr.begin(); auto last = flstr.end(); bool found = false; while (curr != last) { if (*curr == needle) { found = true; // put here?! break; } // put here?!... ++curr; } (const auto& elem : flstr) { cout << elem << endl; } return; }

java - Spring and Ehache : Cachemanger -

i trying use eh-cache 2.8 spring 4.2.3 , found can use spring ehcache manager in blog found can directly use ehcache manager directly in spring , use ehache annotataion . confused better , right approach. below code configuration : applicationcontext.xml <?xml version="1.0" encoding="utf-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:p="http://www.springframework.org/schema/p" xmlns:context="http://www.springframework.org/schema/context" xmlns:cache='http://www.springframework.org/schema/cache' xmlns:jee="http://www.springframework.org/schema/jee" xmlns:tx="http://www.springframework.org/schema/tx" xmlns:jms="http://www.springframework.org/schema/jms" xsi:schemalocation="http://www.springframework.org/schema/beans http://www.springframework.org/schem

javascript - Accessors Composition in ES6 Classes -

let's have thing class want both hideable , openable . using similar approach douglas crockford's object creation through composition, have been able "inherit" multiple classes. this approach not work accessors (getter/setters). i need use classes it's requirement. i'm finding duplicating functionality class class, don't want these inherit base class. any ideas? the progress have made far in below snippet: class openable { constructor(isopen = false) { this._isopen = isopen; } isopen() { return this._isopen + ' stupid.'; } set isopen(value) { this._isopen = value; } } class hideable { constructor(ishidden = false) { this._ishidden = ishidden; } ishidden() { return this._ishidden + ' stupid.'; } set ishidden(value) { this._ishidden = value; } } class thing { constructor(config) { let { isopen, ishidden } = config;

Swift iOS NSDictionary setValue crash - but why? -

i have code (porting language, hence bit different naming conventions, please bear now) var fdefaultslist: nsdictionary = [string:string](); let tmpkey: string = tmpkeyvalue[0]; let tmpvalue: string = tmpkeyvalue[1]; if (tmpkey != "") && (tmpvalue != "") { //let tmpanyobjectvalue: anyobject? = tmpvalue; //fdefaultslist.setvalue(tmpanyobjectvalue, forkey: tmpkey); fdefaultslist.setvalue(tmpvalue, forkey: tmpkey); } however, no matter setvalue variation use, call setvalue throws error (not meaningful far can tell) , exits app (xcode editor taken class appdelegate: uiresponder, uiapplicationdelegate ) i guess using nsdictionary wrong? trying read in text file each line key=value strings you should declare actual nsmutabledictionary instead of casting nsdictionary. and can use subscript bit simpler use setvalue (which should setobject ): var fdefaultslist = nsmutabledictionary() let tmpkey: string = "a" let tmpvalue: s

c# - Exclude columns in database and mapping with Nhibernate -

Image
i have following situation one purchaseorder has many line items , 1 invoice has many line items. purchaseorder , invoice quite different. if specific lineitem has 1 puchaseorder hasn't invoice , vice versa. need persist these relationships. in app i'm using nhibernate. i thought on database, lineitems table have column foreign key purchaseorder , column foreign key invoice. what best approach this? model you map lineitem heirarchy. lineitem heirarchy public class lineitem { //common properties of lineitem } public class purchaselineitem : lineitem { public purchaseorder purchaseorder { get; set; } } public class invoicelineitem : lineitem { public invoice invoice { get; set; } } modify purchaseorder , invoice refer specific child purchase order : public class purchaseorder { public ilist<purchaselineitems> lineitems { get; set; } } invoice : public class invoice { public ilist<invoicelineitems> line