Posts

Showing posts from May, 2011

tablesorter - jQuery Table Libraries -

what jquery table libraries (in same vein tablesorter ). bare minimum i'm looking ability sort tables row based on type. handy functions automatic json handling, , predefined ajax handles. any suggestions? you might interested in datatables . has worked out great asp.net mvc application.

Combination button/dropdown in office -

Image
how add combination button/dropdown in office (see below). preferably code. update: if helps any, code isn't needed. you can it, based on following activex controls: microsoft imagelist control, version 6 microsoft imagecombobox control, version 6 manually, select "more controls..." [control toolbox] menu bar , double click mentioned controls them on sheet. position combobox want be, , disregard position of imagelist, visible in design mode. have 2 embedded contros named imagelist1 imagecombo1 the insertion of 2 components creates reference ...\system32\mscomctl32.ocx. then you manually add icons (gif, bmp, etc) image list manually set combo's imagelist property "imagelist1" manually set combo's autoload property true by have combo error no icons. then execute code sub fillcombo() dim sh worksheet, oo oleobjects, idx integer set sh = activesheet set oo = sh.oleobjects oo("imagecombo1"

soap - PHP SoapClient and a complex header -

i have been trying while now, can't figure out how use php soapclient in combination wsdl form complex header (that is, more complex tutorial find). envelope need send looks this: (001) <?xml version='1.0' encoding='utf-8'?> (002) <soap-env:envelope xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xlink="http://www.w3.org/1999/xlink"> (003) <soap-env:header> (004) <eb:messageheader xmlns:eb="http://www.ebxml.org/namespaces/messageheader" eb:version="2.0" soap-env:mustunderstand="1"> (005) <eb:from> (006) <eb:partyid>webservices.example.com</eb:partyid> (007) </eb:from> (008) <eb:to> (009) <eb:partyid>clienturl</eb:partyid> (010) </eb:to> (011) <eb:cpaid>ipcc</eb:cpaid> (012) <eb:conversationid>abc123@clienturl.com</eb:conversationid> (013) <eb:service eb:type="xml">sess

xcode - Methods for obtaining user input on iPhone -

i'm working on iphone app , have simple text input box pop when user clicks custom search button. problem i'm not sure approaches available achieving this. googling results in search overload , presented many views i'm not sure standard , isn't. information requesting user single zip code avoid creating whole new view if possible. still new working in xcode please take easy on me. edit: dialog box itunes uses ask password ideal. called? well, use uialertview including uitextview. honestly, i'm not sure apple it, because uialertview should prompt message inform user, it's @ least kinda cool ;) you can find tutorial on website : http://iphonedevelopment.blogspot.com/2009/02/alert-view-with-prompt.html

c++ - Changing vector value causing seg fault -

i working on school project graphs , here doing depth first search down tree. void wdigraph::depth_first(int v) const { static int firstv = -1; static bool *visited = null; if (firstv == -1) { firstv = v; vector<bool> visited(size); (int = 0; < size; i++) { visited[i] = false; cout << visited[i] << endl; } } cout << label[v]; visited[v] = true; // visited[0] = true; the first input value function 0 (v = 0) , crashes that. size = 5. can see @ end of code, have tried set visited true manually same seg fault. when remove attempts change visited, program runs how should without seg fault. any ideas why can't modified? also, there more code have decided not provide unless necessary. there 2 different variables named visited in code. inside if condition, visited vector, outside block, on last line: visited[v] = true

eclipse - Separate JSF and EJB apps -

how use deployed ejb app separate jsf application? i'm attempting separate 2 applications , access ejb through remote interface. have 2 eclipse projects - 1 contains ejb , persistence logic, tested independently , works. created jsf project references ejb project (so gain access remote interface), fails when attempting either inject ejb instance or lookup jndi name (i've tried several variants no avail). jsf backing bean contains: @ejb(lookup="java:global/locejb/localityejb!com.ame.business.localityejbremote") private localityejbremote locality; this on glassfish, , referencing ejb project , not packaging jsf project. when latter, receive error initializing ejb container problems on jsf project. so, how access remote ejb , way i'm approaching make sense? thanks in advance! your jsf application has know ejb interfaces (at least did on ejb 2.0). you're using proxy pattern hide fact remote component jsf client.

python - Django: Display Choice Value -

model: class person(models.model): name = models.charfield(max_length=200) category_choices = ( ('m','male'), ('f','female'), ) gender = models.charfield(max_length=200, choices = category_choices) to_be_listed = models.booleanfield(default=true) description = models.charfield(max_length=20000, blank=true) views.py: def index(request): latest_person_list2 = person.objects.filter(to_be_listed=true) return object_list(request, template_name='polls/schol.html',queryset=latest_person_list, paginate_by=5) on template, when call person.gender, 'm' or 'f' instead of 'male' or 'female'. how display value ('male' or 'female') instead of code(m/f)? it looks on right track - get_foo_display() want: in templates, don't include () in name of method. following: {{ person.get_gender_display }}

nginx: How to keep double slashes in urls -

i have web service takes several filter parameters, : http://mydomain.com/filter1/value1/filter2/value2/filter3/value3 the tricky thing of filter variables absent, urls such passed service: http://mydomain.com/filter1//filter2//filter3/value3 now need configure nginx (or fastcgi) keep double slashes. it's replacing double slashes single ones. i'm new nginx & fastcgi configuration , don't know how that. captured request_uri php script when requested second url, , got http://mydomain.com/filter1/filter2/filter3/value3 plz me. in advance. syntax: merge_slashes [on|off] default: merge_slashes on context: http, server you must use: merge_slashes off ;

java - 'adding' two angles -

Image
alright, got 2 angles. 1 joystick's angle, , other camera player angle. camera's angle. want when press on joystick moves player away camera. how this? , there easy way in java or ardor3d? edit: here code of how angles. float camdegree = (float) math.todegrees(math.atan2( _canvas.getcanvasrenderer().getcamera().getlocation().getxf() - colladanode.gettranslation().getxf(), _canvas.getcanvasrenderer().getcamera().getlocation().getyf()) - colladanode.gettranslation().getyf()); player.angle = (float) math.todegrees(math.atan2(padx, pady)); quaternion camq = new quaternion().fromangleaxis(camdegree, vector3.unit_y); i have don't understand question, seems how implement camera-relative control using joystick. the important piece of advice can give it's better not compute angles, work directly vectors. suppose camera looking in direction v (in types of game vector pointing directly @ play

Reinstalling MySQL on Ubuntu -

mysql broken on ubuntu os. throws following error: mysql -u root error 2002 (hy000): can't connect local mysql server through socket '/var/run/mysqld/mysqld.sock' (2) i wasn't able repair it. want reinstall mysql. didn't find effective way. used sudo apt-get remove mysql-server-5.1 , but after re-installation, still throwing same error. help? restart mysqld.

Play video on BlackBerry -

i want play video url. how do this? get url of video. if have vid in local file system fetch path of it. , open blackberry's default browser. browser automatically open in default media player

asp.net mvc - Telerik Grid MVC2 Insert child records in nested grid -

the master grid customers , detail grid customers orders. using editortemplate, have model working fine updates when comes inserting new records i'm @ loss. the customerid not being passed, in way can see, usercontrol. new orders being created customerid of 0. the orders table has unique key on customerid , order # , ordersid primary. need create new customer order record entering order # customer # needs provided form. i missing , don't see on telerik site when comes grid , mvc. any appreciated! from point of view, allowing users enter key field value new items not practice because prone error (the keys may not unique or valid in context of column type). chose grids have key field auto-increment or generate key values new rows myself ensure there no repetitions.

How can I see many grep results page by page? -

i new linux. if use grep , there many results cannot displayed @ once, how can view results page page, chance see them without missing any? try grep your_pattern_and_option your_path | less or grep your_pattern_and_option your_path | more

java - What is the use of this spring class BatchPreparedStatementSetter? -

can give me short description spring class org.springframework.jdbc.core.batchpreparedstatementsetter ( javadoc api link ) it's used bulk insertion of many rows @ once. this code illustrate how it's used. take @ importemployees method, , should become clear.

c# - List box validation in asp.net -

hi how set required feild validator multi select list box in asp.net? i tried in default way like initial value = "0" required feild validator. not working me. any example? @jestges: chek link sure hep out.

iphone - slow xml parsing -

i parsing data xml generated php code mysql database. parse using nsxmlparser. parsing slow. can 1 please me in finding faster solution? thanks pankaj tbxml parser or libxml2 sax more faster , less memory consuming parsers. difference tbxml cannot parse during download , libxml2 sax can here's link compare : how choose fastest xml parser iphone

Different display resolutions on android phones -

how application make sure looks on mobile android phone (there several manufacturers, , each phone has different specifications). there 3 different screen sizes. create 3 folders named that: res/drawable-ldpi/my_icon.png // icon image low density res/drawable-mdpi/dpi/my_icon.png // icon medium density res/drawable-hdpi/my_icon.png // icon image high density and put each screen-size right images. possible layouts: res/layout/my_layout.xml // layout normal screen size res/layout-small/my_layout.xml // layout small screen size res/layout-large/my_layout.xml // layout large screen size http://developer.android.com/guide/practices/screens_support.html

actionscript 2 - Content Pagination in AS2 -

i need develop application in as2 text content indexing. files available? i found useful reference link: www.ultrashock.com/tutorials/flash8/pagination.php

java - Best way to parseDouble with comma as decimal separator? -

following resulting in exception : string p="1,234"; double d=double.valueof(p); system.out.println(d); is there better way parse "1,234" 1.234 than: p = p.replaceall(",","."); ? use java.text.numberformat : numberformat format = numberformat.getinstance(locale.france); number number = format.parse("1,234"); double d = number.doublevalue();

oracle - Printing data from an OleDbDataReader in C# -

basically debugging purposes want print contents of oledbdatareader object console, struggling find away of doing it. me out please. have no way of testing sql (well can in toad oracle thats not point). ideally going transfer contents of in arraylist if exist in c# (i new c# may have guessed!) while (myoledbdatareader.read()) { console.writeline(...) } for every field in sql-query, can data typing string test = myoledbdatareader["fieldname"].tostring(); for example can print with: console.writeline(myoledbdatareader.["fieldname"].tostring()); you can try this foreach(var item in myoledbdatareader) { console.writeline(item.tostring()); } to print out every included item. (not tested!) edit: forgot have put foreach-loop in while(reader.read()) -loop or won't work... edit2: better loop: (int k = 0; k < reader.fieldcount; k++) { console.writeline(reader[k].tostring());

cen xfs - where can i find XFS API reference and samples? -

i wanna work cen/xfs (extensions financial services), possibly in c#.net. could tell me how , can find xfs last release api reference , samples? and .net framework have classes & tools xfs? thanks. i found documentation , api reference: http://www.cen.eu/work/areas/ict/ebusiness/pages/cwa15748.aspx

php - Return all elements from list that don't have a record. (MYSQL) -

i have list of feeds: ('feed1', 'feed2', 'feed3') i have table feeds list of feeds, need find feeds in search list don't appear in database. create table `feeds_filtered` ( `id` char(36) not null, `url` varchar(255) not null, ...... primary key (`id`) ) engine=myisam default charset=utf8; for example feed1 , feed3 exist in table want feed 2 returned. please note: feeds table has feed4, feed5 etc don't want them returned either. feed2 i can write php script this, wondering if there easy way mysql? thanks in adavnce! you create temporary table, left join , records rhs of join null .

.net - Label property to accept escape sequences in C# -

possible duplicate: enter “&” symbol text label in windows forms? is there property label display '&' in c#? i'm trying display customer names in label. when there '&' symbol in name, it's getting displayed '_'. example, a&b xxx getting displayed ab b underlined. instead of hardcoding, there way display & symbols received means of setting property? the label control can't display control characters encoded escape sequences, , there's no property controls that. reason draws text using standard graphics routines built framework, not expand control characters. not mention meaning of \t ambiguous: how many spaces should treated tab? if want display tab or skip new line, you'll need hardcode string: mytablabel.text = "this spaced out label!"; mynewlinelabel.text = "first line" + environment.newline + "second line" edit in response edited question

java - Using FileNamePattern, RollingFileAppender in log4j -

i have log file named app.log. when rolls on (i'm setting every minute testing purposes), renamed app-yyyy-mm-dd_hh-mm.log it's not working. below log4j settings: log4j.appender.mylog=org.apache.log4j.rollingfileappender log4j.appender.mylog.rollingpolicy=timebasedrollingpolicy log4j.appender.mylog.file=logs/app.log log4j.appender.mylog.rollingpolicy.filenamepattern=logs/app-%d{yyyy-mm-dd_hh-mm}.log log4j.appender.mylog.append=true log4j.appender.mylog.layout=org.apache.log4j.patternlayout log4j.appender.mylog.layout.conversionpattern=%d %-5p [%t] %-17c{2} (%13f:%l) %3x - %m%n does know what's problem? during rollover, renames file app.log.1 . according log4j wiki : note timebasedrollingpolicy can configured xml, not log4j.properties the api doesn't mention that, perhaps that's problem?

jquery - JavaScript variable isn't known to inline function (scoping?) -

i have following jquery: function getselectedcheckboxids(classname) { var ln = classname.length; return $('.' + classname + ':checked').map(function() { return this.id.substring(ln); }).get(); } the variable ln unknown inside scope of map function. scoping rules here , how can pass ln value inner function? the variable ln not unknown within scoping function (working live here ), makes think is? because function closes on execution context of call getselectedcheckboxids , ln accessible it. the scoping rules simple, they're unlike many other languages. more in this article closures , basically, function "closes over" (has reference to) data in scope in execution context in created. in case, anonymous function created inside execution context of call getselectedcheckboxids , has access arguments , variables defined in context ( classname , ln , in case), inherited enclosing contexts (including global execution conte

sql server - sql group by only rows which are in sequence -

say have following table: mytable --------- | 1 | | | 2 | | | 3 | | | 4 | b | | 5 | b | | 6 | b | | 7 | | | 8 | | --------- i need sql query output following: --------- | 3 | | | 3 | b | | 2 | | --------- basically i'm doing group by rows in sequence. ideas? note database on sql server 2008. there post on topic uses oracle's lag() function. this known "islands" problem. using itzik ben gan's approach: ;with yourtable ( select 1 n, 'a' c union select 2 n, 'a' c union select 3 n, 'a' c union select 4 n, 'b' c union select 5 n, 'b' c union select 6 n, 'b' c union select 7 n, 'a' c union select 8 n, 'a' c ), t (select n, c, dense_rank() on (order n) - dense_rank() on (partition c order n) grp yourtable) select count(*), c t group c, grp order min(n)

perl - Searching FASTA file for motif and returning title line for each sequence containing the motif -

below code have searching fasta file entered @ command line user-provided motif. when run , enter motif know in file returns 'motif not found'. i'm beginner in perl, , can't fugure out how print motif found, let alone return title line. appreciate in resolving this. thanks. use warnings; use strict; $motif; $filename; @seq; #my $motif_found; $scalar; $filename = $argv[0]; open (dnafile,$filename) || die "cannot open file\n"; @seq = split(/[>]/, $filename); print "enter motif search for; "; $motif = <stdin>; chomp $motif; foreach $scalar(@seq) { if ($scalar =~ m/$motif/ig) { print "motif found in following sequences\n"; print $scalar; } else { print "motif not found\n"; } } close dnafile; there no point in "rolling own" fasta parser. bioperl has spent years developing one, , silly not use it. use strict; use bio::seqio; $us

monads - Haskell error: Couldn't match expected type `Bool' against inferred type `IO b' -

i not understand problem is. 'a' not bool , should not bool. why bool expected? code: probablyprime n 0 = false probablyprime n t = <- randomrio(3, n-1 :: integer) let comp = defcomp(a,n) let ret = (not comp) && (probablyprime n t-1) return ret defcomp n = xcon1 && xcon2 (s,m) = findsm n x = a^m `mod` n xcon1 = x /= 1 || x /= n-1 xcon2 = comploop x n s comploop x n 0 = false comploop x n s = x1 || (comploop x n (s-1)) x1 = (x^2 `mod` n) == 1 findsm n = (s,m) m = findm n s = n/m findm n = m f = (logbase 2 n) - (truncate (logbase 2 n)) m' = 2^f m = m_ify m' m_ify m | m mod 1 == 0 = m | otherwise = m_ify (m*2) error: couldn't match expected type `bool' against inferred type `io b' in stmt of 'do' expression: <- randomrio (3, n - 1 :: integer) in expression: { <- randomrio (3, n - 1 :: integer); l

c# - Best way to test changes in silverlight application -

which best way rebuild silverlight project in visual studio 2010? ask because happen rebuild , not take effect changes made in xaml , a. cs file. thank you. rebuilding ought doing trick. if changes you're making in project not being reflected when build, try clicking "build > clean solution" before rebuild. if doesn't work, restart visual studio.

c# - How do I change a ListView dynamically on DataBound? -

i have listview template, puts bunch of data in, x y z. i want hide show columns based on criteria, have itemdatabound event, don't know how actual listview row can things it. any ideas? you can access listviewitemeventargs' item property @ current item (the 1 being bound data). the sample code below (which shows how customize listview item in itemdatabound event) taken msdn documentation : protected void contactslistview_itemdatabound(object sender, listviewitemeventargs e) { label emailaddresslabel; if (e.item.itemtype == listviewitemtype.dataitem) { // display e-mail address in italics. emailaddresslabel = (label)e.item.findcontrol("emailaddresslabel"); emailaddresslabel.font.italic = true; system.data.datarowview rowview = e.item.dataitem system.data.datarowview; string currentemailaddress = rowview["emailaddress"].tostring(); if (currentemailaddress == "orlando0@adven

html - List full size border -

i've run problem css + lists. for list have following code: <ul class="submenuul"> <li>submenu item 1</li> <li>submenu item 2</li> <li>submenu item 3</li> <li>submenu item 4</li> <li>submenu item 5</li> <li>submenu item 6</li> <li>submenu item 7</li> </ul> with css: .submenuul { margin-left: 20px; width: 250px; } .submenuul li { border-top: 1px solid #edbb98; color: #5f5f5f; } the problem want border extend above list image, goes on text. there way solve cause border extend left? use: .submenuul li { border-top: 1px solid #edbb98; color: #5f5f5f; list-style-position: inside; }

jquery - Exclude click event based on condition? -

Image
i'm trying set conditions on jquery event. have input element , div. want detect click anywhere on page , execute method if click not on input or div. use jquery click() or live() functions , check target of click event using jquery is() function. bind click event on document if target not input or div continue . $(document.body).click(function(e) { if( !$(e.target).is("input, div") ) { console.log("run function because image or div not clicked!"); } }); example webpage => http://mikegrace.s3.amazonaws.com/forums/stack-overflow/example-document-click-exclusion.html example firebug output after clicking around on example page

java - Read <property> value from file within build.xml -

can read the property value external file instead of specifing value within <property> tag. so instead of - <property name="device" value="test" /> use like <property name="device" value="c:\\filetoread" /> where file read contains test,test2,test3 thanks in build.xml <property file="general.properties" /> general.properties file svnant.version=1.0.0 lib.dir=${ant.home}/lib so be: <property file="c:\\filetoread" /> filetorread is device=test

data structures - Could anyone tell me what's the difference between KD-tree and R-tree -

i @ definition of kd-tree , r-tree, seems same. could tell me what's difference between kd-tree , r-tree? thanks r-trees , k d-trees based on similar ideas (space partitioning based on axis-aligned regions), key differences are: nodes in k d-trees represent separating planes, whereas nodes in r-trees represent bounding boxes. k d-trees partition whole of space regions whereas r-trees partition subset of space containing points of interest. k d-trees represent disjoint partition (points belong 1 region) whereas regions in r-tree may overlap. (there lots of similar kinds of tree structures partitioning space: quadtrees, bsp-trees, r*-trees, etc. etc.)

entity framework - retrieve Ids created by savechanges -

apologies asking related question yesterday, after sleep i've simplified question. in example below,i loop through objectquery sourcetable , add rows positions table. after adding new rows , saving changes, primary keys (integer identity column) created. foreach (var row in sourcetable) { var newpos = new positions() { field1 = row.field, field2 = row.field2, field3 = row.field3 }; } entities.savechanges in ef 3.5 possible access list of primary keys added above process? similar can done using output statement in t-sql. sure - need hang on list of entities you're save, , inspect them after they've been saved: list<positions> _newitems = new list<positions>(); foreach (var row in sourcetable) { var newpos = new positions() { field1 = row.field, field2 = row.field2, field3 = row.field3

sql server - How do I get “select for xml” to output to several files? -

our customer complaining our export file long; split export many files no more “n” records per file. there way of doing “select xml” at persent using sql server 2005 project. (if hard, can post process single large file split up) i don't think there's simple'n'easy can here. my approach limit number of rows returned each select statement (by partioning data returned criteria, e.g. date or location or something), , put smaller xml streams files 1 one. doable, not elegant or sophisticated..

MySQL specify arbitrary order by id -

is possible specify arbitrary order mysql select statement? e.g., select * table_name id in (1, 3, 2, 9, 7) order (1, 3, 2, 9, 7); the order of numbers listed directly after in not seem matter. find_in_set function trick select * table_name id in (1, 3, 2, 9, 7) order find_in_set(id, '1,3,2,9,7'); http://dev.mysql.com/doc/refman/5.0/en/string-functions.html#function_find-in-set edit: note lack of spaces in string argument of find_in_set function.

.net - C# Ionic.Zip progressbar as background worker -

i got following code: string path = environment.currentdirectory; private void button1_click(object sender, eventargs e) { using (zipfile zip = zipfile.read("fringe.s03e07.hdtv.xvid-lol.zip")) { zip.extractprogress += extractprogress; foreach (zipentry file in zip) { file.extract(path+"\\temp", extractexistingfileaction.overwritesilently); } } } public void extractprogress(object sender, extractprogresseventargs e) { if (e.eventtype == zipprogresseventtype.extracting_entrybyteswritten) { //bytes transfered of current file label4.text = e.bytestransferred.tostring(); } else if (e.eventtype == zipprogresseventtype.extracting_beforeextractentry) { //filename of current extracted file label2.text = e.currententry.filename; } } when click on butto

c# 4.0 - Calculating fibonacci -

Image
i sent nice non-recursive function computing fibonacci sequence. so coded bit of c# , able verify numbers 1474 correct. the problem comes in when attempting calculate 1475 , above. c# math skills aren't task of figuring out different way. so, have better way of expressing particular math function in c#? other traditional way of doing recursive function? incidentally, started use biginteger return type. problem comes in when trying raise (1+math.sqrt(5) /2) 1475th power. don't see data type need (nor mechanism matter) come other infinity. here's starting point. private double fibsequence(int32 input) { double part1 = (1 / math.sqrt(5)); double part2 = math.pow(((1 + math.sqrt(5)) / 2), input); double part3 = math.pow(((1 - math.sqrt(5)) / 2), input); return (part1 * part2) - (part1 * part3); } and, no, it's not homework. "simple" problem slow day. i don't think c# has data type enough floating precision , ra

Image Comparison Techniques with Java -

i'm looking several methods compare 2 images see how similar are. plan have percentages 'similarity index' end-result. program outline this: user selects 2 images compare. with button, images compared using several different methods. at end, each method have percentage next indicating how similar images based on method. i've done lot of reading lately , of stuff i've read seems incredibly complex , advanced , not me year's worth of java experience. far i've read about: the fourier transform - im finding rather confusing implement in java, apparently java advanced imaging api has class it. though i'm not sure how convert output actual result sift algorithm - seems incredibly complex histograms - easiest out of mentioned far pixel grabbing - seems viable if theres considerable amount of variation between 2 images doesn't it's going produce sort of accurate result. might wrong? i have idea of pre-processing image using sobel

css - @font-face is not working -

i having hardest time getting @font-face load site. 1 know going on? i tried using css font squirrel didn't work either tried simpler code hoping work, no luck far. older css (did not work) @font-face { font-family: 'cartogothicstdbold'; src: url('cartogothicstd-bold-webfont.eot'); src: local('☺'), url('cartogothicstd-bold-webfont.woff') format('woff'), url('cartogothicstd-bold-webfont.ttf') format('truetype'), url('cartogothicstd-bold-webfont.svg#webfontuvgrkg9v') format('svg'); font-weight: normal; font-style: normal; } newer css (still doesn't work) @font-face { font-family: 'cartogothicstdbold'; src: url(css/fonts/cartogothicstd-bold.otf) format("opentype"); } .b-nb { float: left; width: 100%; font-size: 1.25em; color: grey; font-family:'cartogothicstdbold', serif; } i testing here: http://drewlepp.com/testing/laa/laa%20studio/index.html thanks!!

ubuntu - How to configure postgresql so it accepts login+password auth? -

i have fresh ubuntu 10.10 install updates , postgresql 8.4 in order postgresql accept login+password connections have configured via: sudo su postgres psql alter user postgres password 'password'; create database myapp; \q exit sudo vi /etc/postgresql/8.4/main/pg_hba.conf change "local all indent" "local all trust" but, surprisingly, not working! command psql -u postgres password evaluates error: psql: fatal: ident authentication failed user "postgres" any hints how can make psql -u work? it idea leave "postgres" user ident authentication. default believe ubuntu uses "postgres" user perform upgrades, backups, etc, , requires able login without specified password. i recommend creating user (probably own username) , giving admin privileges well. can use user passwords on local connections. here relevant parts of pg_hba.conf like: # allow postgres user use "ident" authentication on unix s

c# - True Fixed Width Fonts in WPF -

i'm trying parse lab data microsoft access database i've formatted data text tables (tables created ascii chars) not display correctly. i'm using fixed pitch font (couier new) pitch seems not fixed when printing underscores in markup eveything looks fine when printing underscored lines come short. the following xaml aligns correctly both on screen (in xamlpad) , on printer (hp cp2025): <stackpanel> <textblock fontfamily="courier new" fontsize="30">abcdefghi</textblock> <textblock fontfamily="courier new" fontsize="30">a_c_e_g_i</textblock> </stackpanel> i check font substitution settings on printer.

Is this proper javascript for making a namespace that encapsulates various methods into different objects? -

var namespaced = { a: function(){ function r(){ //do stuff return something; } var someproperty = 5; function j(){ //do more stuff return something; } }, b: function(){ //can call , c? a.r(); c.d(); }, c: function(){ function d() { //do stuff } } } then do... namespaced.a.j(); namespaced.c.d(); = namespaced.a.someproperty; right? would need too? var = new namespaced.a()? if a() have constructor? i'm confused here :{ i'm trying encapsulate javascript it's easy maintain then do... namespaced.a.j(); namespaced.c.d(); = namespaced.a.someproperty; no couldn't. function j , someproperty local a , not propagated outside. if want access them outside, have make them property of function, using this : var namespaced = { a: function(){ this.r =

vbscript - Add child entry to a specific node in xml file in vbscipt -

i have xml file dataconfiguration.xml entry <datasource> <localdata> <add context="localization"> <parameter name="timeout" type="int" defaultvalue="60"/> <parameter name="address" type="string" defaultvalue="192.168.9.45" /> <parameter name="port" type="int" defaultvalue="6789"/> </add> </localdata> </datasource> i need add entry "localdata" <datasource> <localdata> <add context="localization"> <parameter name="timeout" type="int" defaultvalue="60"/> <parameter name="address" type="string" defaultvalue="192.168.9.45" /> <parameter name="port" type="int" defaultvalue="6789"/> </add> &l

How can I change every http to https using JavaScript in source code? -

i change every instance of http https using javascript. how can this? source code like? anyway, assume after in tags, should easy extrapolate others: if (document.location.protocol === 'https:') { $('a').each(function() { var href = $(this).attr('href'); if (href.indexof('http:') > -1) { href = href.replace('http:', 'https:'); $(this).attr('href', href); } }); }

Strange wordpress search results? -

i'm struggling search results wordpress theme. i've added ajax powered search fallback single page, if no javascript enabled. search.php asks if post parameter set, , if yes, results returned. else whole site returned. but search delivers strange results! post found, doesn't contain related search term , dump searches sdfsdf return sometime result. going wrong here? the searchterm seems found, can use get_search_query(); print out. has else encountered before? the search looking search term in of content, visible , non-visible. try repeating 1 of searches looked incorrect , view page source (ctrl+u in browsers), find (ctrl+f) search term , see if turns in link or file name.

filter - Anomaly Detection Algorithms -

i tasked detecting anomalies (known or unknown) using machine-learning algorithms data in various formats - e.g. emails, ims etc. what favorite , effective anomaly detection algorithms? what limitations , sweet-spots? how recommend limitations addressed? all suggestions appreciated. statistical filters bayesian filters or bastardised version employed spam filters easy implement. plus there lots of online documentation it. the big downside cannot detect unknown things. train large sample of known data can categorize new incoming data. can turn traditional spam filter upside down: train recognize legitimate data instead of illegitimate data doesn't recognize anomaly.

What are the different gettext file formats used for? -

i started trying translate few of used text entries in c program using gettext, when digging got little bit confused different file formats since there seems overlap in functionality? i overview of different formats .po .pot .mo .gmo (other formats have excluded?) and learn what normal workflow? what file format contain? what tools typically used? what "opposite" direction conversions possible (1)? (1) know msgunfmt can convert .mo .po, since .mo final end format assume not lossless process. i.e. if convert hello1.mo hello2.po , convert hello2.po hello3.mo, assume hello1.mo , hello3.mo contain identical language strings meta information lost along way, right? i wrong but: .pot - human readable gettext template file - give translator (person?). .po - human readable gettext translated file based on pot - translator gives back. .mo - machine readable code (bytecode?) used php when doing actual translation. format feed php. it's generic

How to Structure a C# WinForms Model-View-Presenter (Passive View) Program? -

i designing gui has following basic idea (similarly modeled after visual studio's basic look-and-feel): file navigation control selector (for selecting display in editor component) editor logger (errors, warnings, confirmation, etc.) for now, using treeview file navigation, listview selecting controls displayed in editor , richtextbox logger. editor have 2 types of editing modes depending on selected in treeview. editor either richtextbox manually editing text inside files, or panel drag/drop datagridviews , sub-textboxes editing in panel. i attempting follow passive view design pattern complete separation of model view , vice versa. nature of project component add subject edit/removal. such, need there independence given control next. if today using treeview file navigation, tomorrow told use else, want implement new control relative ease. i not understand how structure program. understand 1 presenter per control, not know how make work such have view (the entire

c# - redirecting stdout to a file question? -

hi why getting access denied error when try execute process? running (msbuild "projectfile here" "additional args") command new process public bool cmdexecute(string command,string args) { bool isok = true; try { using (system.diagnostics.process proc = new system.diagnostics.process()) { proc.enableraisingevents = false; proc.startinfo.useshellexecute = false; proc.startinfo.redirectstandardoutput = true; proc.startinfo.filename = command; proc.startinfo.arguments = args; // console.out.writeline(proc.startinfo.arguments); proc.start(); string output = proc.standardoutput.readtoend(); proc.waitforexit(); console.writeline(output); } } } catch(exception e) { console.wri

java - I need a simple rules engine, I think? -

i need advice on best approach solving problem. i've researched drools, java rule engine , few others. of these powerful, , have things them. don't know (if any) best choice me. i have 1 business object. (simplified demo) person firstname:string lastname:string department:string hiredate:date i need write editor in web application allow complex rules built around these fields. need support complex nested and/or logic. need basic operators, , rule should evaluate true or false. if rule evaluates true or false, 1 action occur respectively. for example, firstname contains "value" , (lastname equals "input" or department contains "input") i had thought, maybe should write own parser , evaluate logic in own code. don't know do, advice or links read appreciated. there specific design pattern research? how solve problem? 1 reservations rules engines maybe complex simple problem? this not

Restricting BING Map searches to a country in Windows Phone 7 -

the question title pretty sums up. want restrict map search usa only. right i'm using bing maps geocode service , guess there should way in there this. example, if search paris, want 'paris, tx' , not 'paris, france'. thanks! have tried appending ", usa" query? without knowing how you're capturing/sourcing values you're searching it's hard offer more specific solution.

html - How to fallback to a different flash movie if the first one requires a newer flash player version -

i want display videos using flash (for older, non-html5 video browsers). possible: using flv video files since flash version 7 and h264 video files , high-def since flash version 10. so i'd first try version 10 variant , , if not available, try version 7 variant (i don't care browsers no flash installed, or version < 7). note have 2 different swf media players each case (don't know if there single 1 work both formats in cases). if possible, should happen without javascript. otherwise, using swfobject ok, however, don't know how use case. so far have tried have 2 nested <object> tags, outer 1 containing flash 10 media player, playing mp4 file, , inner 1 containing flash 7 media player, playing flv file. not work browsers flash player version between 7 , 9, since failure doesn't happen @ browser level, because there is flash player installed. failure happens inside swf media player doesn't when necessary version 10 video playback suppor

html - Display input label underneath input element -

i've been trying display label underneath input element form: http://www.appnitro.com/demo/view.php?id=7 i have been able labels underneath, using current method cant have multiple inputs on same line form linked to. what best , cleanest way this? here's current code: http://jsfiddle.net/6zngu/ you can see looking @ source of example gave. put each input label span has float: left set. see here: http://jsfiddle.net/ab9hv/ and way, can put input inside label , don't need for attribute. <span style="float: left;"> <label><input type="text" name="fn"/>first</label> </span> <span style="float: left;"> <label><input type="text" name="ln"/>last</label> </span> new code: http://jsfiddle.net/qwdmr/

Get array keys when in argument in PHP -

i'm passing arrays arguments inside function. example: test($somearray[2][3]); in case function gets value stored in (2,3) there way keys value (2,3) inside function work with? function should use x,y position of value calculations. thanks! not way, no. if call test($somearray[2][3]) , php pass value, not reference value comes from. cleaner pass values separately anyway function test($x, $y, $value) { /* */ }

cakephp - Better solution for non-model request on CakePHP1.3 -

there parameter withought relayting model. router::connect("/ctrl/action/:mode/:year" , array('controller' => 'ctrl', 'action' => 'action'), array('mode' => 'modea|modeb', 'year' => '[12][0-9]{3}')); how validate , sanitize? should create dummy model? or implement on component? well, current route wouldn't match /ctrl/action/modea/5010 , fall through route, standard route, dispatch request ctrl_controller::action('modea', 5010) . i.e. have same result. the best thing skip route, since doesn't route anywhere wouldn't go anyway. validate in controller action before using values: function action($mode, $year) { if (!in_array($mode, array('modea', 'modeb')) || $year < 1900 || 3000 < $year) { $this->cakeerror('error404'); } ... business usual ... } or: function action($mode, $year) { switch

tsql - sql select count -

i have 2 tables: calls , attachments , want display that's in calls table display whether call has attachments, - determining if there attachment record call_id in it. maybe there attachments, maybe there isn't. calls call_id title description attachments attach_id attach_name call_id if write: select call_id, title, description calls to give me list of calls.... how can include whether call record has attachment(s) or not? thanks, you can use outer join accomplish this: select c.call_id, title, description, attach_name calls c left outer join attachments on c.call_id = a.call_id the above display (null) attach_name if no attachment found. can use isnull() supply default value if no attach_name found, such as: select c.call_id, title, description, isnull(attach_name, '(no attachment)') attach_name calls c left outer join attachments on c.call_id = a.call_id

dom - jquery nextALL traversal -

<div><a href="" class="deletenextsomething">delete something!</a></div> <div class="something">this something</div> obviously, this: $('.deletenextsomething').click(function() { $(this).parent('div').next('.something').remove(); }); but, if html more this: <div><div><div><a href="" class="deletenextsomething">delete something!</a></div></div></div> <div class="something">this something</div> point is, don't want know how many parents need go before start going across. want traverse dom in "next" direction" until hit next node i'm looking for. does know how solve this? pleasssse. additional info. in next example, want delete something1. can't parents('div').next - because ignore next element. <div> <a href="" class="deletenexts

c# - Memory leak happens when using thread inside another thread -

below sample code has memory leak. if comment out 2 lines inside refreshtimer_elapsed, memory leak gone. know what's wrong? help. static void refreshtimer_elapsed(object sender, system.timers.elapsedeventargs e) { thread innerthread = new thread(delegate() { }); innerthread.start(); } static void main(string[] args) { system.timers.timer refreshtimer = new system.timers.timer(); refreshtimer.interval = 5000; refreshtimer.elapsed += new system.timers.elapsedeventhandler(refreshtimer_elapsed); refreshtimer.start(); (; ; ) { } } are sure theres memory leak? or notice memory grows? until garbage collector cleans threads create, memory grow, not leaking, garbage collector knows dead memory. the way memory "leaks" in managed enviroment .net or java when have objects being referenced never used or needed. thats not case here. you're creating bunch of thr

java - Easiest way to do SSLSocketServer (certificate generation at runtime) -

i want simple way create sslserversocket. self-signed certificate generated , used @ runtime because data needs protected, isn't super important very, secure. i found tutorials on making sslserversocket assume had proper certificate. psuedo-code, code examples , simple paragraph acceptable answers. the easiest way may invoking external program. openssl great tool many encryption things... make self signed cert with: openssl req -new -newkey rsa:1024 -days 365 -nodes -x509 -keyout www.example.com.pem -out www.example.com.pem you run such generation runtime.exec() or using processbuilder .

java - Passing an array of values from Android Activity to JavaScript in a WebView -

i'm using js charts library draw graphs in webview of android application. want provide data sqlite database. @ moment i'm stuck on how pass array of data java javascript. javascript part expects that: data = new array([10, 10], [20, 10]); i know addjavascriptinterface , managed pass single values activity webview. it's array gives me trouble. thought that: final class chartdataloader { public double[][] getdata() { double[][] data = {{10, 10}, {20, 10}}; return data; } } note i'm hard-coding data, pulled out database. expose js: webview.addjavascriptinterface(new chartdataloader(), "dataloader"); and try read in javascript: <html> <head> <script type="text/javascript" src="jscharts.js"></script> </head> <body> <div id="chartcontainer">you should see chart here.</div> <script type="text/javascript"> mydata = dataloader.g

actionscript 2 - Problem using JSON.as -

my code import json; var j = "{fef:34}"; var json = new json(); trace(json.parse(j)); // undefined !!! it doesn't work; trace return undefined. i'm compiling flash 8 in actionscript 2. file json.as in same folder (see below). when debugging says value json after json = new json() undefined. json.as (from json.org) class json { var ch:string = ''; var at:number = 0; var t,u; var text:string; function stringify(arg):string { var c, i, l, s = '', v; switch (typeof arg) { case 'object': if (arg) { if (arg instanceof array) { (i = 0; < arg.length; ++i) { v = stringify(arg[i]); if (s) { s += ','; } s += v; } return '[' + s