Posts

Showing posts from January, 2014

php - Display categories on BigCommerce store homepage -

i'm trying custom homepage set bigcommerce store. store has handful of products, in 2 categories. customer wants products both categories displayed on homepage of store. unfortunately bigcommerce provides panels display "new" or "featured" products on homepage. does know how create custom panel display contents of chosen category? have rss links categories, hoping this: <div class="block moveable panel" id="homepagecategories"> <h2>category one</h2> <div class="blockcontent"> <display first 6 items url source="rss-url-category-1"> </div> <h2>category two</h2> <div class="blockcontent"> <display first 6 items url source="rss-url-category-2"> </div> </div> anyone have suggestions or hints how achieve this? i wound ajaxing in contents of respective content page's .productlist ul's. not id

Split and count number of string in xslt 1.0 -

i have strings below, 788565591,1,444,0,15956,555,126.99,15956,666,0,15956,777,101.66,15956 788565591,1,444,0,,555,126.99,,,0,15956,777 i trying write xslt template find out number of comma's in string. based on count need add/delete few more normalize length 32. please advice/ give me idea in form of code. assuming current context node 1 value want process, then <xsl:variable name="numcommas" select="string-length() - string-length(translate(., ',', ''))" /> would give number of commas in string (literally it's calculating length of string minus length of the-string-with-all-commas-removed). if have variable containing 32 commas (this global variable defined outside templates): <xsl:variable name="thirtytwocommas" select="',,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,'" /> then can take substring($thirtytwocommas, $numcommas + 1) string containing number of c

vb.net - How to split string, apply function to every part and rejoin back without loops in .NET? -

i perform these actions inside single evaluation, if possible: split string input parts according separator separator apply function fnc(string) -> string every part rejoin parts string result using same separator separator that's all. the best figure out (this in vb) result = input.split(separator).aggregate(string.empty, function(result, part) _ result & if(result = string.empty, string.empty, separator) & fnc(part)) as can see, ugly because aggregate() needs initialization in 1st parameter (if aggregate() used without first parameter, doesn't call fnc() 1st element of array) this approach forces if() usage, otherwise separator added start of result i experimented using select() , selectmany() on array created through split() , when apply string.join() on result, i'm getting cast error(!) during runtime (build works ok) , not understand why. here effective form crashes during run

phplist - does php-list have any api for integration to other softwares -

i've tried searching forums , going through documentation. didn't find information on how integrate php-list existing web-app. it's complete new software in itself, new users , everything. need create users, add/remove them lists using form of rest or other integration. as far i've searched, there's means add list, using single http-request. didn't find means remove such list. i found out there plugins etc. various cmses integration. but have java-webapp , looking easy implement, otherwise way see use htmlunit (or similar tool) send requests everything. no does not have api integration other apps. had develop custom phplist integration api employer.

sql - Access Loop Thru Columns to update records -

i have access table 20 columns, each column unique name, columns want update start tt. columns have 1 word in them "applied", not records populated. want run summary reports on data, want change word "applied" number "1". problem column names change, new column added or removed @ time, don't want hard code column names in sql statement. what best way cycle thru of columns , update records in each column without defining each column static name? need keep original record "applied", able use number 1 in it's place needed. there 6mil records in table. you can't updated fields or (columns), can update records (or rows). however, can figure out fields fit description. don't understand question, maybe can add field names array, strip array out , update fields start "tt". code find field names follows: function tableinfo(strtablename string) on error goto tableinfoerr ' purpose: display field

SSIS Truncate with in a transaction -

Image
i have execute truncate table command in transaction execution freezes if so. in sequence container, have enabled transaction required , have placed execute sql task , data flow task. in execute sql task have set truncate table command. when run package freezes after truncate command. please let me know if require additional details. in advance. there's known issue ( kb2253391 ) truncate can block other processes. workaround specify validateexternalmetadata false. this effect of doing if change data types or column names, ssis won't identify until things go south during execution. stable packages , environments, isn't concern (in experience). feel free give kin love on over dba stackexchange having done leg work ssis package blocks if uses truncate

activerecord - Rails Migration Prepend Column? -

i'm trying figure out how run migration prepends string beginning of column. in specific case have column called url stores after domain (e.g. /test.html ). want prepend single string http://google.com beginning of url. in case of example, resulting string value of url entry http://google.com/test.html . how can accomplish migration? i'm not sure qualifies should put migration; generally, migrations change structure of database, rather change format of data inside of it. the easiest , quickest way not futz around in database @ all, , instead make url method of model return "http://google.com#{read_attribute(:url)}" . if want change data in database, i'd make rake task it, like: namespace :data task :add_domain model.each |model| model.url = "http://google.com#{model.url}" if model.url !~ /google\.com/ model.save if model.changed? end end end if must migration you, migration's up similar internals of ra

c# - Pass data from controller to View - MVC -

i´m tryin make query receive data in database show in view. but it´s not working. can´t figured out going on because don´t error. anybody can pls? thanks in advance controller: public actionresult details(int id = 0) { persons p= db.persons.find(id); var query = in db.images a.id_person== id select a.filename; viewbag.imgrev= query; if (mag == null) { return httpnotfound(); } return view(p); } view: @foreach (var p in viewbag.imgrev) { <div> <img src="~/files/" + @p /></div> } the linq statement not have evaluated before assigned viewbag . try: controller: viewbag.imgrev = query.tolist(); view: @ { var imglist = viewbag.imgrev ienumerable<string>; } @foreach (va

php - change name on upload -

i’m updating admin side of website. i have managed include add page uploads database site display content. within page image upload button. when select file upload button saves image /images folder. however. when upload images using feature on ipad, uploads images image.jpg. what need this: i need uploaded images save name of brand , not original uploaded image name. if upload "image.jpg", enter apple brand, want image save apple.jpg upload file. my current add.php page this: <?php session_start(); include_once('../include/connection.php'); if (isset($_session['logged_in'])){ if (isset($_post['title'], $_post['content'])) { $title = $_post['title']; $content = nl2br($_post['content']); if (!empty($_post['image'])) { $image = $_post['image']; } else { $image = $_post['imageupload']; i

php - Header not redirecting if __DIR__ is used -

header ('location:'.__dir__.'/view/prijava_view.php' if use above header in index.php file shows blank page "localhost" url. works if use include instead of header though. is issue dir magic constant? seems can't use in headers, or have problem code? __dir__ file-system path. has nothing urls client browsers see. if site's files physically stored @ /home/sites/example.com/html/view/projava_view.php and code inside php script looks @ dir , you'll get /home/sites/example.com/html/view/ if pass out via header() redirect, you'll redirecting file-system path header("location: http://example.com/home/site/example.com/html/view/....."); which not reachable external users. path not inside document root, , browser requesting full path, server tack on document root again, full end-request be /home/sites/example.com/html/view/home/sites/example.com/html/view/projava_view.php in general, __dir__ magic constant

java - Groups in Pattern compilers and Matchers -

so playing around groups in patterns , matchers , when dealing multiple regexs in pattern compiler there particular group call don't understand. here's it. pattern p=pattern.compile("((\\s+)(\\s+))"); matcher m=p.matcher("hello people yeah"); while (m.find()){ string line=m.group(2); system.out.println("first match "+line); } so can see have regex in compiler, first 1 looks non-whitespaces , second 1 looks whitespaces. now far can understand group 0 whole expression, group 1 ((\s+)(\s+)) group 2 is/supposed (\s+) , group 3 (\s+) however when call group 2, hello people but not yeah weird because if compiler ("\s+") hello people yeah so yeah don't understand why yeah not returned when call group 2. what regex searching is: one or more non-whitespace characters, followed by one or more whitespace characters. now, match twice in string: first match: [g

java - WebDriver Explorer Menu Scroll -

Image
our web app ui based of gxt framework (gwt+ext js) , has explorer (tree) kind of menu. want scroll down reach tree node in explorer. here tried @test public void test() { logger.info("*************** started create template ******************"); string nodeelement = //span[@class='x-tree3-node-text'][contains(text(),'qe auto template585 [1]')]"; webelement treenode = driver.findelement(by.xpath(nodeelement)); treenode.click(); } still 'nosuchelementexception' though element present in dom pointers? i using selenium v2.35/ firefox v23 <!doctype html> <html class=" ext-strict" style="overflow: hidden;"> <head> <body class=" ext-gecko ext-windows x-theme-gray"> <div id="x-auto-4" class=" x-viewport x-component" style="width: 1378px; height: 577px;"> <div id="x-auto-5" class=" x-component x-borde

xml - jQuery - AJAX call returns count, IE8 will not get the value -

using jquery 1.9.1 & doing ajax call stored procedure returns count. in success part of ajax call, processing data supposed returned. works in firefox, not in ie8. i've confirmed stored procedure returning data each time (0 if nothing counted, , positive integer if counted). success: function (data) { notecount = $(data).find("notescounted").text(); if (notecount > 0) { .... processing } } in firefox, works & if there x notes counted, if statement processed. in ie8, above code not work - if statement never fires & displays i've had in code in ie8 never show notecount > 0 (even when have manipulated test data force counted). i doing wrong above code, not know what. appreciate anyone's assistance in getting work same way in both firefox , ie8. thanks! -- edit -- the call is: $.ajax({ type: "get", url: myurl, datatype: "xml", success: function(data) {

ruby on rails - Creating form for STI Model -

referring post: rails: deal several similar model classes? using combination of sti , store feature organize similar models. "declare base model student text column called settings. class student < activerecord::base store :settings # name, email, phone, address etc.. end class highschoolstudent < student # declare highschoolstudent specific attributes store_accessor :settings, :gpa end how can create form highschoolstudent, while remaining under student controller? i dont want add separate controller or route resource highschoolstudent, there way have 1 form student , highschoolstudent, checkbox indicate whether student or highschoolstudent? can require attributes created subclass required form submitted if specific class checked? <%= simple_form_for(@student, html: {class: "form-horizontal"}) |f| %> <%= f.input :name, as: :text, input_html: {rows: "1"} %> <%= f.input :email, as: :text, input_html: {row

abi - Are there tools to check whether changes to a C++ class will break a previous version of that class? -

Image
if you've been programming in c++ while, ran program crashed "for no obvious reason" find out abi of library not compatible anymore , had recompile software against new version of library. the reason abi breaks multiple: change in virtual table, adding/removing constructors, destructor, or variable members... what i'm wondering this: there tool can used compare 2 class definitions (old version , current version) , tell me whether abi compatible or not. this useful determine version of project (i.e. if abi changed, go 1.2.7 1.3.0, if abi did not change, go 1.2.8). many people program in c++ have had problem. example qt states patches not break binary compatibility (although once in while make mistake, generally, code quite solid). http://qt-project.org/wiki/qt-version-compatibility http://qt-project.org/faq/answer/is_qt_binary_compatible however, qt has staff can spend time in verifying (all manually?) public classes have not changed in way break compa

ruby on rails - simple_form association not working as expected -

i have simple_form building form responseset . response set collection of responses questionnaire (which has_many questions). question can have many answers. (it's complicated, know). when attempting render out radio buttons answers particular question, none of radio buttons selected though there answers related response. changing as: :check_boxes seems work correctly. bug w/ simpleform? = simple_form_for @response_set |rs| = rs.simple_fields_for :responses |r| - if r.object.question.class <= question::singlechoice = r.association :answers, as: :radio_buttons, collection: r.object.question.answers, label_method: :text, label: false response_set.rb class responseset < activerecord::base has_many :responses accepts_nested_attributes_for :responses end response.rb class response < activerecord::base belongs_to :question has_and_belongs_to_many :answers belongs_to :response_set has_many :questions, through: :answers accepts_nested_

c - Makefile Difficulties -

makefiles confusing me. trying separate off functions separate file, can't compile. missing? thanks! makefile: all: clientfunctions client clientfunctions.o: clientfunctions.c gcc -c clientfunctions.c -o clientfunctions.o client.o: client.c clientfunctions.o gcc -c client.c -o client.o client: client.o gcc client.o -o client the .c , .h files simple: clientfunctions.h #ifndef _clientfunctions_h #define _clientfunctions_h #endif void printmenu(); clientfunctions.c #include <stdio.h> #include "clientfunctions.h" void printmenu() { fprintf(stdout, "please select 1 of following options\n"); } client.c #include "clientfunctions.h" int main (int argc, char * argv[]) { printmenu(); return 0; } this error getting: undefined symbols architecture x86_64: "_main", referenced from: implicit entry/start main executable ld: symbol(s) not found architecture x86_64 clang: error: linker comm

jenkins - calculate remote fs root from master hostname -

i have 2 jenkins masters - call them "master1" , "master2" - , remote node, call "node1". want keep node configuration "node1" same in master1 , master2. - dynamically calculate remote fs root property of node1 different depending on whether jenkins slave process started master1 or master2. so, in node configuration, here: remote fs root = /home/jenkins/<????> is there can enter ???? result in different absolute workspace path slaves started on master1 vs master2? (note: key want ???? same on masters; want avoid hard-coding in unique values "master1" or "master2".)

javascript - GET Request in node.js is not working -

i'm having big troubles loading page through node.js. code of node.js application, please note works if try load other resources (like www.google.com) question specific domain name www.egopay.com: var http = require('http'); var options = { hostname: 'www.egopay.com', port: 80, path: '/', method: 'get' }; var req = http.request(options, function(res) { console.log('status: ' + res.statuscode); console.log('headers: ' + json.stringify(res.headers)); res.setencoding('utf8'); res.on('data', function (chunk) { console.log('body: ' + chunk); }); }); req.on('error', function(e) { console.log('problem request: ' + e.message); }); // write data request body req.write('data\n'); req.write('data\n'); req.end(); using curl works, node.js won't. around 1 minute after request error shows up: problem request: read econnreset

java - Conflict of "addSelectionChangedListener" and "addDoubleClickListener" for TableViewer -

all related with jface tableviewer , want select entry(e.g select file) single-click, , other operations(e.g go directory) double-click. noticing addselectionchangedlistener() , adddoubleclicklistener() via webpage: http://javafact.com/2010/08/07/example-tableviewer-events/ , add selectionchangedlistener , doubleclicklistener tableviwer , , find out: either of 2 listeners can work, can't work - it's doubleclicklistener can't work. what's problem? how should implement listeners single-click , double-clicks? comments appreciated. about code: created tableviewer, , want show filesystem structure. expected behavior: user can double click directory entry , tableviewer show structure of selected directory; user select generic file single-click. other operations, warning message dialog shown. the following code related event handlers. tableview.addselectionchangedlistener( new iselectionchangedlistener() { public void selectionchanged(selectionchang

python - Pulling multiple, non-consecutive index values from a Pandas DataFrame -

i've created pandas dataframe reading scipy.io in following way (file.sav idl structure created on different machine. scipy.io creates standard python dictionary): from scipy import io import pandas p import numpy np tmp=io.readsav('file.sav', python_dict = true) df=pd.dataframe(tmp,index=tmp['shots'].astype('int32')) the dataframe contains set of values (from file.sav) , indices series of integers of form 19999,20000,30000 etc. take subset of these indices, says df.loc[[19999,20000]] for reasons errors of form raise valueerror('cannot index multidimensional key') plus other , @ end valueerror: big-endian buffer not supported on little-endian compiler but i've checked both machine i'm working on , machine has created file.sav both little endian. don't think problem. your input file big endian. see here transform it: http://pandas.pydata.org/pandas-docs/dev/gotchas.html#byte-ordering-issues compare before , a

javascript - Lambda expressions in PEG.js -

i have peg grammar problem lambda expressions, work if use syntax: x:{y:{x+y}}(20)(30) which equivalent of (function(x) { return function(y) { return x+y; }; })(20)(30); but don't work f:{f(10)}(x:{x*x}) which equivalent of: (function(f) { return f(10); })(function(x) { return x*x; }) is possible make second function work peg.js? after trial , error on online grammar parser , found works: f:{f}(x:{x*x})(10)

ruby - Helper function in Sinatra -

i'm using sinatra monitor server. need read list of folders in master folder, , content of meta.xml inside each folder. desired output: <folders> <folder 1> <meta.xml content> <folder 2> <meta.xml content> <\folders> this current code: require 'sinatra' require 'json' require 'haml' '/processed' status 200 meeting_dir="/home/default" dir.entries(meeting_dir) end i'm confused sinatra printing values of variable inside block. if want write subfunction getxml generate xml, should put it? the helper : require 'sinatra' require 'json' require 'haml' helpers def get_xml( *args ) # code here… end end '/processed' # getxml available here status 200 meeting_dir="/home/default" dir.entries(meeting_dir) end now, i'm assuming want output xml, route won't work, you'll evaluation of

Scala error: class file is broken, bad constant pool index -

i'm trying call selenium java libraries scala. i'm using scala ide (eclipse), , scala 2.10.2. causing compiler error? error while loading function, class file '/dev/selenium-2.35.0/libs/guava- 14.0.jar(com/google/common/base/function.class)' broken (class java.lang.runtimeexception/bad constant pool index: 0 @ pos: 479) sometimes fix broken class file errors including more jars -- jars javac not need see, apparently scalac does. case don't know other jars can add. found answer. it's caused this: https://code.google.com/p/guava-libraries/issues/detail?id=1095 . error disappeared when added jsr305 jar.

android - How to start SSH on a chroot Linux -

i managed initiate linux on android phone through terminal , start ssh service , tested using connectbot. however, manual operation. thinking more of automated way of doing this. i used linux mechanism: http://mitchtech.net/android-backtrack-chroot/ my main issue believe i'm trying steps before , after chroot done, didn't seem work on android app: runtime.getruntime().exec("su"); //mount image runtime.getruntime().exec("startbt"); //chroot linux runtime.getruntime().exec("bt"); //from inside chroot, start ssh service runtime.getruntime().exec("/etc/init.d/ssh start"); this did not seem work: runtime.getruntime().exec("su & startbt & bt & /etc/init.d/ssh start"); i'm guessing again issue interpreted inside or outside chroot. main quest start ssh service automatically, not through android app. if execute runtime.getruntime().exec("su"); this launch su , exit. next exec wo

php - Text Based Game - XP, Rank, Percent -

i'm pretty new programming, i've learned php , html. trying make text based "rpg" game. i've made few functions gambling, killing, , doing crimes (yes, it's mafia related game). i've made possible "level up" in game, , stunningly enough, made work perfectly, ran on small issue. want let players see progress, using "rank bar", it's same concept experience points, want show percent. of now, looks this: $percent = $currentxp / $nextlevelxp; $percent2 = $percent * 100; $percent3 = number_format($percent2, 0); this worked me (you can see xp, , level up), problem is, when level up, show percent next level using current xp, means might 50% when you've leveled up. there way can make 0% @ next rank, , make go 100% before level up? i'd prefer basic kind of code. thank in advance! change first line to: $percent = ($currentxp - $curlevelxp) / ($nextlevelxp - $curlevelxp); this isn't programming problem, it's

python - how to disable the window maximize icon using PyQt4? -

i know how disable window maximise button in pyqt4. @ present using qwidget.setfixedsize (self, qsize) prevent user window resizing, maximise button still enabled , when pressed causes application move top left corner of screen. wanting replicate behaviour of windows calculator application, maximise icon greyed out. know how achieve pyqt4? haven't worked research seems point messing window flags. qwidget has method called setwindowflags . here doc qt.windowflags class. here reference of flags. qt.windowmaximizebuttonhint in general seems need find way enable qt.customizewindowhint flag , disable qt.windowmaximizebuttonhint flag. either way, want in addition setfixedsize that's start. edit: something like win.setwindowflags(win.windowflags() | qtcore.qt.customizewindowhint) win.setwindowflags(win.windowflags() & ~qtcore.qt.windowmaximizebuttonhint) assuming import this from pyqt4 import qtcore this turn on customizewindowhint flag , tu

Is it possible to build a metro interface app with Vb.net in Visual Studio 2005? -

we've been asked change webapp we're making metro interface, thing is, have visual studio 2005, should able change our app metro? you need visual studio 2012 far aware. can use free express edition of visual studio 2012 building windows 8 apps. need running windows 8. cannot develop windows 8 apps on windows 7, vista, or other os version less 8. you can install express edition of 2012 along side visual studio 2005 , have them run side-by-side, doesn't replace 2005, can keep using it.

Coordinating system in console c++? -

i don't know wheres error. looks forgot basic stuff. int xy [2]; cout << "input x: "; cin >> xy[0]; cout << "\ninput y: "; cin >> xy[1]; ( int y = 0; y < 10; y++ ) { ( int x = 0; x < 10; x++) { if ( x = xy[0] + 5 && y == xy[1] + 5) { cout << "°"; } else { cout << "+"; } } cout << "\n"; } may missed : if ( x == xy[0] + 5 && y == xy[1] + 5) ^ equality which why you're getting infinite loop = assignment operator , while == used check equality putting x= xy[0] + 5 assigns x value , rather comparing hence never ending inner loop

c# - comboboxitem to be replaced by textbox on clicking -

i implementing combobox consisting of normal comboboxitems , allow modification of list bound combobox. eg: need following go combobox - option1, option2, option3, addnewoption where, upon clicking on addnewoption, want comboboxitem expose textbox enter content , dynamically added list bound combobox. how implement highlighted portion? i bind editable collection view adds newitemplaceholder @ end, 1 define datatemplate place-holder contains outlined logic.

javascript - Link versus onClick -

i have web application exclusively uses ajax there no full refreshes , set <a href="javascript:...()"> it works on chrome , firefox ie asks confirm page reload every time click on anything. better change links to href="#" and make functionality onclick? thanks. just stop using inline javascript together. don't need it. output id associated element in data attribute: <a href="#" data-id="34" class="list-item">listitem1</a> now can bind click events external js file: $(document).ready(function(){ $(".list-item").click(function(e){ e.preventdefault(); // stop jump top var theid = $(this).attr("data-id"); // id somefunction(theid); // execute terribly written function }); }); this does work cross-browser.

progress bar - FineUploader Progressbar questions -

Image
i'm bit confused using progress event in v3.8 (using jquery wrapper) understand browsers support progressevent interface, i'm testing in firefox v20.0.1. using of another's code, i've added this: .on('progress', function (id, filename, uploadedbytes, totalbytes) { alert('uploadedbytes: ' + uploadedbytes + '\n totalbytes: ' + totalbytes); if (uploadedbytes < totalbytes) { progress = '"' + filename + '" uploading... ' + math.round(uploadedbytes / totalbytes*100) +'%'; $('#qq-progress-bar').html(progress); } else { $('#qq-progress-bar').html('saving'); } }) please @ alert function within event, above. if input parameters of method correct, shouldn't see name of uploaded file displayed in

How to set programmatically recipients of Jenkins Email-ext plugin? -

i'm trying set recipients of email-ext (aka editable email notficiation ) owners of failed tests. since owners can't calculated until after build fails, inject environment variables plugin can't used. how can done? in advanced... section create following pre-send script : import javax.mail.message import javax.mail.internet.internetaddress msg.addrecipient(message.recipienttype.to, new internetaddress('recipient@example.com')) you'll need set project recipient list (maybe dummy value) since if it's empty, plugin decides there's nothing do. the script runs on master you'll need ssh onto slave master if need process workspace.

java - Hibernate Criteria API join through id -

when using criteria api, in order add filters entity referenced current one, use code: criteria.createalias("customer", "customer", criteria.inner_join); where customer customer entity property in entity criteria created for. problem is, need remove referenced entity , leave it's id in class, i.e. replace @manytoone @joincolumn(name = "id_customer") private customerentity customer; by @column(name = "id_customer") private long customerid; so, change need make in criteria alias in order keep working? filter example have on it, along join above: criteria.add(restrictions.eq("customer.statusid", statusid));

Python FTP-SSL / FTP-TLS: Verifying Public Certificate? -

i'm using python 2.7.5 (not 3.x) , need verify ftps (ftp-tls) public certificate. is, want verify against standard certificate authority, not custom key. (similar https.) i see options cannot them work: ftp_tls() class doesn't seem offer ability verify certificates, unless i'm mistaken: class ftplib.ftp_tls([host[, user[, passwd[, acct[, keyfile[, certfile[, timeout]]]]]]]) i've read certifi , m2crypto, while can connect , transfer using ftp/tls, can't seem find way verify certificate. also, don't think able use curl libraries in case :( note. let's try make possible answer: http://heikkitoivonen.net/blog/2008/10/14/ssl-in-python-26

c# - ItemSource in DataGrid Error: Exception has been thrown by the target of an invocation -

when call headersdatagrid.itemssource application throws exception. can please me debug , determine error is? thanks code public static list<item> getheaders() { item i1 = new item(); i1.label = "tst"; i1.description = "this header testing"; item i2 = new item(); i2.label = "ts2"; i2.description = "this second header , used testing purposes :)"; item i3 = new item(); i3.label = "ts3"; i3.description = "this third header , used testing purposes :d"; list<item> headers = new list<item>(); headers.add(i1); headers.add(i2); headers.add(i3); return headers; } public mainwindow() { displayheaders(); initializecomponent(); } /// <summary> /// purpose of method display of headers /// </summary> public void displayheaders() {

c# - Hosting a WCF service in a windows service - configuration, debugging -

situation: i have solution 3 projects: project 1: type wcf service project 2: type console application (hosts project 1) project 3: type console application (calls methods of wcf service, has service reference project 1) right debugging run project 2 executable administrator, opens service. run project 3 executable call methods of wcf service. question 1: install service windows service available, meaning when want test/use methods of service can. how instlal wcf service windows service? question 2: wcf service has console.writeline statements display results of method calls. because service hosted in project 2 console.writelines write stuff project 2 executable. happen writelines when wcf service inside windows service? question 3: wcf service gets config values app.config using system.configuration.configurationmanager.appsettings - windows service still have access app.config? if how resolve where/which app.config use? question 4: how debug wcf service hosted i

deployment - How to deploy an Excel XLL Add-In and automatically register the Add-In in Excel -

i have developed excel xll using exceldna , c#. @ point begin testing deployment, cannot find information provides steps work. my project developed class library exceldna references. in .dna file, have code below pack resources packed version of xll (i.e. pack="true" attribute). <dnalibrary name="excelxll" runtimeversion="v4.0" language="c#"> <externallibrary path="excelxll.dll" loadfrombytes="false" pack="true" /> i deploy packed xll target machine in path: %appdata%\microsoft\addins in order automatically register xll excel, need add registry key depends on version of excel user has. for instance, on computer (windows 7 64 bit running excel 2007 32-bit), need add registry key following path: hkey_current_user\software\microsoft\office\12.0\excel\options\ the key type reg_sz name open (or open1, open2, etc.) , value /r "excelxll-packed.xll" i have 2 problems though

java - Trying to call child method, but instantiated it as parent -

i've tried searching answer this, couldn't find answer exactly... here's situation. have class , subclass, , defined them this: public class shape{ public methoda{ system.out.println("hello!"); } } public class square extends shape{ public methodb{ system.out.println("i'm square!); } } at main, instantiate them unable call methodb because "gave" (not sure of terminology here) type shape: shape square = new square(); square.methodb() // doesn't work. did design wrong if wanted able call child class' methods? i'm doing way because have many shapes inheriting shape class, didn't want import every single shape class project. tried searching, didn't find answer in way understood it. thanks. -rb you need decide want. the point of polymorphism can abstract away details specific implementation programming in common (interface or base or abstract class). did design wrong if want

Change Link href Based on Viewport (Javascript) -

i'm in special scenario need change href of <a> inside <li> , if <li> has child <ul> , , if viewport sub 480px. i know little writing javascript, i'm thinking how logic work: is viewport equal or lesser 480px? if so, find <li> 's directly inside <nav id="navigation1"> 's top-level <ul> . from #2 returns, find contain child <a> . from #3 returns, find contain child <ul> . from #4 returns, change href value of <a> in top <li> 's ''#navigation1``. here's html: <nav id="navigation1" class="navigation" style="height:auto; z-index:1; overflow:visible"> <ul class="f-fp f-lp" id="fwnav1"> <li class="fwnavitem"><a href="change-this-link.html"><span class="navigation">about</span></a> <ul class="sub">

Shell script: copying columns by header in a csv file to another csv file -

i have csv file i'll using input format looking this: xvalue,value1-avg,value1-median,value2-avg,value3-avg,value3-median 1,3,4,20,14,20 the key attributes of input file each "value" have variable number of statistics, statistic type , "value" separated "-". want output statistics of "values" separate csv files. the output this: value1.csv xvalue,value1-avg,value1-median 1,3,4 value2.csv xvalue,value2-avg 1,20 i've tried finding solutions this, can find ways copy column number, not header name. need able use header names append associated statistics each of output csv files. any appreciated! p.s. output file may have been written during previous runs of script, meaning code should append output file untested should close: awk -f, ' nr==1 { (i=2;i<=nf;i++) { outfile = $i sub(/-.*/,".csv",outfile) outfiles[i] = outfile } } { delete(o

ios - the height of sizeToFit not correct in UILabel -

Image
i create uilabel following code: uilabel *textlabel = [[uilabel alloc] initwithframe:cgrectzero]; textlabel.font = [uifont systemfontofsize:30]; textlabel.backgroundcolor = [uicolor redcolor]; textlabel.text = @"0"; [textlabel sizetofit]; textlabel.center = cgpointmake(100, 100); [self.view addsubview:textlabel]; and textlabel.bounds.height seems higher text font actual height. following: but because designer marks space of 2 uilabel based on real text size, can't assign value 2 uilabel use designer's mark space, need run app in simulator check it's correct. i wan know how make uilabel sizetofit real height of text, no padding between text. there room around 0 in example because label has take account entire set of metrics font, cocoanetics has nice illustration of in blog post "understanding uifont" . example, running code on machine , putting "g" next "0", can see "g" touches bottom of label: if im

Titanium Appcelerator - how do i just shut down the app -

in java, can call system.exit if want shut shop , go home. in titanium appcelerator, command that? don't want have keep track of open windows, want entire app give , let user manually restart. i've tried closing "root" window, or setting "exitonclose" true, work on android, not ios. any ideas? in android, can use following code var appactivity = ti.android.currentactivity; appactivity.finish(); the ti.android.currentactivity property provides reference context's current activity.this code finish current activity. reference titanium android- application close\exit

css - Border-top works inside first-child, but not border-bottom -

i trying learn of css, i'm having little trouble. in project have 1 searchbar "ui autocomplete", works, i'm trying edit style of "returns box" , having troubles. now autocomplete result box doesn't show border-bottom, , i'm trying solve this. when type border-bottom: 10px inside last-child don't have success, when type border-top: 10px inside first-child have! css: .ui-corner-all{ background-color: #fff; outline: none; margin: 0px; padding: 0px; border-radius: 0px; -moz-border-radius: 0px; border-bottom: 1px solid #fff; border-left: 1px solid rgb(223, 223, 223); border-right: 1px solid rgb(223, 223, 223); } ul.ui-autocomplete{ border-top: 0px solid rgb(223, 223, 223) !important; border-radius: 0px; -moz-border-radius: 0px; } ul.ui-autocomplete li:first-child{ /* border-top: 10px solid rgb(223, 223, 223); */ } ul.ui-autocomplete li:last-child{ border-bottom: 10px solid rgb(223,

java - Getting Contacts based on the GroupID in Android -

i'm having kind of problem here, since startet developing android. downloaded sample official android website " http://developer.android.com/training/contacts-provider/retrieve-names.html ", capable of retrieving showing contacts phone. feature wanted add show contacts group "friends" (hardcoded). as far narrowed down have change selection part final static string selection = (utils.hashoneycomb() ? contacts.display_name_primary : contacts.display_name) + "<>''" + " , " + contacts.in_visible_group + "=1"; to this final static string selection = contacts.groupid = "friends"; which gives me errors, because can't find column. i'm eager explore potential of android, 1 giving me headache. there 2 ways getting list of contacts of group. first, suppose have groupid , want related list of contacts. string[] projection = { contactsc

serial port - Arduino output pins go HIGH on start? -

i have aceduino board similar arduino. tried making sample led , button using demo . had notice when plug usb, led flashing couple of times. just wanna ask if normal when using usb power arduino. is there way can avoid it? thank in advance. the onboard led (pin 13) flashes couple of times to indicate arduino executing bootloader . happen every time power or reset board. you can avoid modifying bootloader inside arduino board. require avr in-system programmer (a piece of hardware program microcontrollers) burn bootloader. can use arduino board special sketch avr in-system programmer. this link explains how implement both approaches burn arduino uno's bootloader (which uses same microcontroller of clone). my advice: avoid if can.

backbone.js - Add model to collection after fetching it -

im having trouble figuring out how populate model's attributes server , add populated model collection , have collection rendered view. here's code have: var moviedetails = new cinephile.models.moviedetailsmodel({ id: movie.get('id') }); this.collection.add(moviedetails); inside of moviedetailsmodel: cinephile.models.moviedetailsmodel = backbone.model.extend({ url: function() { return '/cinephile/api/index.php?action=getmoviedetails&movieid=' + this.id; }, initialize: function() { this.fetch(); } }); and this.collection collection model set cinephile.models.moviedetailsmodel i listening items added collection , when are, following executed: displaymovie: function(movie) { var view = new cinephile.views.movieview({ model: movie, classname: 'movie clearfix', template: jst['app/scripts/templates/movieview.ejs'], }); this.$("#my-movies").appe