Posts

Showing posts from May, 2015

PostgreSQL environment file on Mac OSX? -

postgresql seems have environment file allows settings environment variables. on linux (kubuntu 11.10 in case), located @ e.g. /etc/postgresql/8.4/main/environment , empty default, apart few helpful comments. on mac osx lion, file not seem exist: expect @ e.g. /library/postgresql/9.0/data/ that's other configuration files are, not there - , if create it, not seem used. how can set environment variables postgresql server on mac osx ? there no standard way specify environment variables postgresql, assume file kubuntu specific. what did ease life copying approach used oracle: i have /etc/pgtab file on each server run postgresql databases; i specify each cluster run on single line in /etc/pgtab ; i've created script pgenv based on /etc/pgtab shows menu of clusters (in case there're more one) , initialize path s , variables. it works on macbookpro , on linux , hp-ux based servers.

html - How to get grid view presence in google search of my website as shown in google search for "twitter"? -

i have website live , visible in google search want displayed in grid view shown in google search of key word example "twitter". can guide me how make happen? its called sitelinks . there's no explicit way can define sitelinks. it's google's algorithm decide links, if any, should appear on sitelinks. make sure site adheres google seo guidelines , if popular links enough traffic, may show sitelinks of search results.

java - Freemarker - template preprocessing -

i wondering, whether there way preprocess freemarker template rules - add syntactic sugar, not directive, nor method. fo instance have variables, print this: ${item.getlocale(currentlocale).name} ${item.getlocale(currentlocale).text} ${item.parent.getlocale(currentlocale).name} ${item.parent.getlocale(currentlocale).text} obviously, getlocale construct makes whole expression pretty ugly. achieve able write: ${item.l.name} ${item.l.text} ${item.parent.l.name} ${item.parent.l.text} so .l. during compilation rewritten .getlocale(currentlocale) . is there nice way that? thanks! this pretty why object wrapping exists in freemarker; can present data templates in custom way. suppose item belongs specific java class. extend defaultobjectwrapper or beanswrapper wrap items specially, , use configuration.setobjectwrapper(new yourobjectwrapper()) once initialize freemarker. (see source code of defaultobjectwrapper example of customization; extends beanswrapper wrap

python - Manipulating a list to increase code efficiency, struggling -

from visual import * planet = ['merc','venus','earth','mars','jupiter','saturn','uranus','neptune'] planetv = [2, 3, 4, 5, 6, 7, 8, 9] planetp = [10, 20, 30, 40, 50, 60, 70, 80] essentially, want create new variables follows: merc.m = 2 venus.m = 3 earth.m = 4 ... merc.p = 10 venus.p = 20 earth.p = 30 ... without changing planet list, need access 'merc', 'venus', etc. later in code. if understood correctly, want create global variables names given list planet , each variable bound object has attributes m , p , set values in lists planetv , planetp , respectively. if correct, here way it: # create class represent planets. each planet # instance of class, attributes 'm' , 'p'. class planet(object): def __init__(self, m, p): self.m = m self.p = p # iterate on 3 lists "in parallel" using zip(). name, m, p in zip(planet, planetv, pl

html - seo difference between a nav or just a ul -

if use ul navigation menu, worse regards seo nav element? i rather use ul don't need shiv older browsers. seo broad concept worry using ul or nav . what main aim needs semantics . so basically, enclosing ul within nav gives more meaning code , appreciated search engines

knockout.js - Knockout custom binding handlers - multiple arguments and function callbacks best practice? -

i created binding handler incorporate jquery validation plugin form using data-bind syntax. found myself needing supply more 1 piece of info handler. needed supply flag enforce validation , callback fire once validation passed. questions: what best practice supplying multiple args? relied on object notation syntax, supply binding , check binding via "allbindings" param passed handler... what best practice supplying callback function handler? below js code defining handler , html code apply handler: <form id="step1" data-bind="jqvalidation:{enforce: true, submithandler: dosomethinginvm}"> <fieldset data-bind="with:searchrequest"> //fields </fieldset> <button type="submit">submit</button> </form> ko.bindinghandlers.jqvalidation = { update: function (element, valueaccessor, a

javascript - D3 mouse release event -

i looking release event on d3. actually, examples has: .on("mouseover", function(data){...} ) .on("mousemove", function(data){...} ) .on("mouseout", function(data){...} ) which works perfect, but. if try like .on("release", function(data){...} ) it doesn't works. any idea? thanks! done! the attribute is: .on("mouseup", function(data){alert(1);} ); the problem related

Ruby - IO#ioctl throws range error in 1.9.3 but not 1.9.1 for 32bit -

ruby-1.9.1-p243 :008 > a,b = io.pipe => [#<io:0x2010670>, #<io:0x2010654>] ruby-1.9.1-p243 :009 > a.ioctl(0x80000000, "\x00\x00") errno::enotty: inappropriate ioctl device (irb):9:in `ioctl' (irb):9 /users/dlampa/.rvm/rubies/ruby-1.9.1-p243/bin/irb:16:in `<main>' this work if io object appropriate device , command valid. ruby-1.9.3-p0 :022 > a,b = io.pipe => [#<io:fd 9>, #<io:fd 10>] ruby-1.9.3-p0 :023 > a.ioctl(0x80000000, "\x00\x00") rangeerror: bignum big convert `long' (irb):23:in `ioctl' (irb):23 /users/dlampa/.rvm/rubies/ruby-1.9.3-p0/bin/irb:16:in `<main>' on macosx 10.6.8 i'm assuming has bit signing (maybe), , have packed , unpacked things signed , unsigned, nothing seems prevent 1.9.3 throwing range error. of course, there's no problem in 64-bit implementations. i'm totally confused. can explain why happening , perhaps provide wor

create video from streamed images c# -

how can build video stream image (only image without sound) in c#? here code of application: static int ii = 1; public void drawbitmap(byte[] data) { memorystream ms = new memorystream(data); try { bitmap b = new bitmap(ms); b.save(@"c:\test\" + (ii++) + ".jpg"); image = (image)b; picturebox1.image = i; ii++; } catch (exception e) { } } you might want take @ thread: http://social.msdn.microsoft.com/forums/en-us/csharpgeneral/thread/f23caf50-85a9-4074-8328-176c8bcc393e/ same question. answers. more available here: http://www.codeproject.com/articles/7388/a-simple-c-wrapper-for-the-avifile-library

Accessing Visual FoxPro COM server from VB 6.0 -

the problem related usage of vfp com server visual basic 6.0 (sp 6). code (relevant) private movfpserver f_vfpsvr.vfpserver in sub: dim orec f_vfpsvr.vfprecord set orec = movfpserver.newrecord("loanmstr") orec .setfield "ssn", sssn .setfield "awdyr", sawardyear .setfield "tran_date", format(now, "mm/dd/yyyy") .commit end method "newrecord" movfpserver returns object represents new, empty record in vfp table "loanmstr". code follows populate properties/fields , save data. all works if vfp com server built using vfp 8.0 , does not work when built using vfp 9.0 . specifically, vb application errors out @ line of code: set orec = movfpserver.newrecord("stdmstr") com server throws exception: automation error -2147417851. this happening on same machine. vfp built com objects can behave little oddly @ times, when comes trickling errors stack. b

aptana - Eclipse IDE: incorrect errors after loading a JSP page in a javascript editor -

i installed aptana plugin, , made mistake of opening .jsp page in javascript source editor. generated hundreds of errors won't go away. how rid of errors? they dumb errors "missing semicolon" on html syntax lines. i've tried reopening jsp in jsp editor, errors still won't go away. there few steps can do... the first, , easiest, try clean workspace. application menu, project | clean , select clean all if didn't help, might need manually delete error markers project. go workspace location , /.metadata/.plugins/org.eclipse.core.resources/.projects/<project name>/ . there should .markers file in there. delete it, restart eclipse command line -clean , clean all mentioned above. cheers

Manually forward a sequence - oracle sql -

i need forward set of sequences dml access. due bug in piece of code several values grabbed without sequence instead manually, sequence duplicating values. so, push sequence max value next time nextval called, gives value higher maximum. i've got 50 sequences each have go few thousand forward. is possible dml access? if so, how should go it? you can use dynamic sql this. example, bit of code select next 10,000 values each of list of sequences. declare l_num integer; begin seq in (select * all_sequences sequence_name in (<<list of 50 sequences>>) , sequence_owner = <<owner of sequences>>) loop in 1 .. 10000 loop execute immediate 'select ' || seq.sequence_owner || '.' || seq.sequence_name || '.nextval dual' l_num; end loop; end loop; end; if had ability issue ddl against sequence, use similar approach set increment 10,

What is the C# .NET Silverlight equivalent of componentsSeparatedByString in Objective-C? -

what c# .net silverlight equivalent of componentsseparatedbystring in objective-c? here how method works in objective-c: nsstring *namesstr = @"john;michael;jason"; nsarray *namesarray = [namesstr componentsseparatedbystring:@";"]; is there c# .net list? you can use string.split : var names = namesstr.split(';');

Template functions in C++? Maybe not the correct term -

i not sure if using right term curious if there more efficient way of doing things. have file loader deals numerous fragments (about 30 in total). class littered with: void fragment_03(char* location, int frag_num); void fragment_04(char* location, int frag_num); void fragment_05(char* location, int frag_num); void fragment_06(char* location, int frag_num); ...and forth. there way better way declare these functions in more generic way rather writing out 30 different function declarations? thanks! i'm not sure if want do, but: you have declare , define of functions separately, can store function pointers in array. typedef void (fragment_function) (char* location, int frag_num); frag_function fragment_0, fragment_1, fragment_2; //define functions in cpp file fragment_function *fragment [] = { fragment_0, fragment_1, fragment_2 }; then define them this: void fragment_0(char* location, int frag_num) { /**your definition here*/ } so can called

How do I update the Solr version in grails-solr-plugin without affecting the plugin? -

we using solr-grails plugin our website. , recent version of plugin (grails-solr-plugin 0.2) uses solr 1.4, whereas latest version of solr 3.5. there way can update solr version without affecting plugin? kindly help. you install plugin, excluding version of solr library therein, explicitly include more recent version. details described here in context of plugin. assuming have plugin developer account, easier download plugin source code, upgrade library , release new version. fyi, new plugin version can released anyone, not original plugin author. fellow solr plugin users thank this.

setsockopt - Is the tcp window size relevant to the SND_BUF or RCV_BUF of the tcp socket? -

i want know when change snd_buf of socket via setsockopt api, original window size of tcp layer changed accordingly? it doesn't change since receive window size, whereas so_sndbuf controls size of send buffer.

linux - Given the directory name, how to find the Filesystem on which it resides in C? -

for example, sample df command output filesystem mb blocks free %used iused %iused mounted on /dev/hd4 512.00 322.96 37% 4842 7% / /dev/hd2 4096.00 717.96 83% 68173 29% /usr /dev/hd9var 1024.00 670.96 35% 6385 4% /var /dev/hd3 5120.00 0.39 100% 158 10% /tmp now if specify /tmp/dummy.txt should able /dev/hd3 or hd3 . edit : torek answer. probing /proc become tedious. can suggest me system calls can same internally? df `pwd` ...super simple, works, , tells how space there... [stackuser@rhel62 ~]$ pwd /home/stackuser [stackuser@rhel62 ~]$ df `pwd` filesystem 1k-blocks used available use% mounted on /dev/sda7 250056240 196130640 41223408 83% / [stackuser@rhel62 ~]$ cd isos [stackuser@rhel62 isos]$ pwd /home/stackuser/isos [stackuser@rhel62 isos]$ df `pwd` filesystem 1k-blocks used available use% mounted on /dev/sda5 103216

c - Most efficient file writing method for Linux video recorder -

i'm working on embedded linux video recorder application writes mp4 format video file (on fat format sd card). some complicating factors video , audio data come hardware codecs have serviced low latency, , must write dma-capable buffers. at moment output file use open() , write(), find write() can take hundreds of milliseconds return when system under load, writes done in separate thread. as stands copy data (small, limited number) dma buffers multi-megabyte malloc'd circular buffer, write() in thread. means i'm doing @ least 2 copies, once app buffer, , once system buffer cache. i considering trying o_direct writes avoid copy, interested in comments. note robert love comments o_direct terrible not why. on flip side, interested if knows way write() not stall longish periods of time (aio?), use buffer cache linus intended. this question not unrelated my old question write stalls . if embedded product in control driver source, i'd looking mmap

version control - git wildcard - remove all instances of a subdirectory -

i trying execute git rm --cached -r <folder> remove instances of folder named .svn recursively. have tried this: .svn /.svn /*/.svn /*/*/.svn etc and works, i'm sure there more dynamic way. thanks the right solution be: find . -type d -name '.svn' -print0 | xargs -0 git rm --cached -r -- @gregor's fail on directories spaces.

php - View word docs and PDF in browser? -

i working on site has have ability users view documents uploaded, need viewable in browser. i know there google docs viewer (however not seem work when trying toopen in fancybox overlay), other alternatives, maybe api's turn them flash or similar, , embed swf? any appreciated. you said "however not seem work when trying toopen in fancybox overlay" did tried headers : header("content-type:application/pdf"); header("content-type: application/vnd.ms-word"); for swf conversion see this

javascript - Strategy to retrieve the current user -

i'm looking classy strategy retrieve current user information emberjs (and ember-data). currently, following : my api responds /users/me current user. in adapter, when retrieved object id isn't 1 i'm hoping for, add real_id id (the user's id in database) , replace real returned id i'm expecting. so when adapter has "me" user's id, server returns 1, following json : {"real_id": 1, "id": "me"} this works. i'm not big fan, , i'd avoid mush possible change default content of adapter. do use strategy ? recommend ? i use controller app.currentusercontroller this. app.currentusercontroller = ember.objectcontroller.extend({ content: null, retrievecurrentuser: function() { var controller = this; ember.$.getjson('/users/me', function(data) { app.store.load(app.user, data); var currentuser = app.store.find(data.id); controller.

android - MediaPlayer unable to prepare? -

i wrote streaming radio app basic in functionality devices refuse "prepare" such optimus 1 running 2.2. app runs on other 2.2 devices brother's s2 running 2.3 , prime running 4.0.3. any idea why specific devise not prepare audio? edit: added code below private void toggleplay() { try { if(!this.player.isplaying()) { this.player.setaudiostreamtype(audiomanager.stream_music); this.player.setdatasource(this.address); this.player.prepareasync(); } else { this.player.reset(); } } catch (illegalargumentexception e) { ; } catch (illegalstateexception e) { ; } catch (ioexception e) { ; } } edit: added adb log 03-09 08:17:26.933: i/activitymanager(1352): starting activity: intent { cmp=com.landonmanning.mediaplayer.celestiaradio/.media } 03-09 08:17:27.003: v/pvplayer(1281): pvplayer constructor 03-09 08:17:27.003: v/pvplayer(1281): construct playerdriv

javascript - DOM/jQuery events propagation differences between input types -

as know, returning false dom event handler stop propagation of event. discovered behavior of different elements varies respect event. example, consider following: <div id="container"> <input type="checkbox" name="foo" value="1" /> check me! <br /> <select> <option>1</option> <option>2</option> <option>3</option> </select> <br /> <input type="text" size="30" /> </div> the surrounding container has click handler returns false: $('#container').click(function(e) { $('#clicks').append('<span>clicked</span>'); return false; });​ within div , can still click on text box , enter text, , can still click on dropdown change value. clicking on checkbox nothing (actually, that's not quite true - checks box, fires handler, unchecks it). jsfiddle here: http://jsfi

javascript - Fullscreen API: Which events are fired? -

i need know (dom) events fired when user enter fullscreen mode via new fullscreen api . tried example snippet doesn't fire: jquery('body').on('fullscreenchange', function() { alert("fired!"); }); your link shows answer ... when full-screen mode engaged, document contains full-screen element receives fullscreenchange event. when full-screen mode exited, document again receives fullscreenchange event. note fullscreenchange event doesn't provide information whether document entering or exiting full-screen mode, if document has non null fullscreenelement , know you're in full-screen mode.

Adding a leaf to Binary Search Tree, Haskell -

the type defined data bst = makenode bst string bst | empty i'm trying add new leaf tree, don't understand how recursion. the function set this add :: string -> bst -> bst the advantage of using binary trees need @ "current part" of tree know insert node. so, let's define add function: add :: string -> bst -> bst if insert empty tree (case #1), create leaf directly: add s empty = makenode empty s empty if want insert node (case #2), have decide sub-node insert value in. use comparisons test: add s t@(makenode l p r) -- left, pivot, right | s > p = node l p (add s r) -- insert right subtree | s < p = node (add s l) p r -- insert left subtree | otherwise = t -- tree contains value, return note not rebalance binary tree. binary tree rebalancing algorithms can complicated , require lot of code. so, if insert sorted list binary tree (e.g. ["a", "b", "c", "d&

jquery to php same issue but specified -

i still having same issue before 1 more specified , more info here's form: <form method="post"action=""> <table> <tr> <td>login</td></tr> <tr><td> <input name="lemail" id="lemail" value="email"/></td> <td> <label class="error" id="lemail_error">*invalid</label></td> </tr> <tr> <td><input name="lpassword" id="lpassword" value="password"/></td> <td><label class="error" id="lpassword_error">*invalid</label> </td> </tr> </table> <input type="button" class="lbutton" id="lbutton" value="submit"/> </form> and here jquery $(document).ready(function(){ $('.error').hide(); $(".lbutton").click(funct

nlp - changing every non letter character to \n in a file using unix utilities -

i watching tutorial using unix utilities guy using on mac had windows laptop downloaded gnuwin32 package came part want replace non letter character in file newline "\n" the command line in tutorial : tr -sc 'a-za-z' '\n' < filename.txt |less it worked him when tried it put singleqoute "'" character after character 's'h'a'k'e's'p'e'a'r'e't'h'e't'e'm'p'e's't'f'r'o'm'o'n'l'i'n'e'l'i'b'r'a'r'y'o'f'l'i'b'e'r't'y'h't't'p'o'l'l'l'i'b'e'r't'y'f'u'n'd'o'r'g' i tried tr -sc "a-za-z" "\n" < filename.txt |less it added new line after each character n e l b r i tried remove compliment option , add ^ in regex tr "[^a-za-z]

git - Project not commiting to github correctly -

Image
when commit project remote github repository right clicking on project , selecting "push", new project folder created same name project folder created on github. in github have 2 folders same name shown : the source code should directly below "mark", not below "mark" -> "mark". how can commit source code remote repository without creating new project directory in remote repository ? structure in attached image should be `"mark" -> ".settings","src","war",".classpath",."project"` instead of "mark" -> "mark" -> ".settings","src","war",".classpath",."project" note : whitespace between names "mark" because removed part of repository name.

Unable to start activity android.view.InflateException -

i have created android project , within have created 2 package --net.website.custom_listview --main_activity_customview.java --other files ..... --net.website.dashboard --main_activity_dashboard.java --other files ..... in androidmanifest.xml file <activity android:name="net.website.dashboard.main_activity_dashboard" android:label="@string/app_name" > <intent-filter> <action android:name="android.intent.action.main" /> <category android:name="android.intent.category.launcher" /> </intent-filter> </activity> so when run android app getting following errors.. here logcat: 03-08 22:02:03.941: e/androidruntime(691): fatal exception: main 03-08 22:02:03.941: e/androidruntime(691): java.lang.runtimeexception: unable start activity componentinfo{net.website/net.website.dashboard.main_activity_dashboard}: android.view.inflateexc

multithreading - Threads in Ruby -

why code work (i see output 1 2 3): for in 1..3 thread.new{ puts } end however, following code not produce same output (i not see output 1 2 3)? for in 1..3 thread.new{ sleep(5) puts } end when hit end of script, ruby exits. if add sleep 10 after final loop, can see output show up. (albeit, 3 each time, because binding i reflects value @ end of processing, , sleep causes thread switch loop.) you might want like: threads = [] in 1..3 threads << thread.new { sleep 5 puts } end threads.map {|t| t.join } that wait threads terminate before exiting.

Matlab addpath() does not stick on the path when current directory is changed? -

i have matlab_xunit, folder bunch of functions used writing unit tests. it's stored in ../external/matlab_xunit. want call runtests part of package. here sample code: addpath(genpath('../external/matlab_xunit')) runtests subdirectory subdirectory sub-directory of current directory. runtests change current directory subdirectory, , find tests in folder , run tests. problem is, found out, current directory gets changed, matlab_xunit no longer on path. thus, functions runtests has call inside become invalid - 'vanish'. anyway around shortcoming of addpath()? thanks much! use full path. work: addpath(genpath(fullfile(pwd,'../external/matlab_xunit')))

bash - How to properly escape characters for backquotes for ssh in Perl? -

i have code: $script = "console.log(\"it works!\");"; $output = qx/ssh user@123.123.123.123 $script | interpreter/; it's supposed run $script through interpreter , write $output . problem doesn't work. how escape characters correctly? think you're trying ssh. both of these produce same output, work differently: ssh user@host 'echo "puts 2+2" | ruby' echo "puts 2+2" | ssh user@host ruby in first, remote shell executing pipeline. (if don't have single quotes, happens?) in second, it's piped through local shell ssh command , interpreter launched. rather perform convoluted escapes of code come out correctly when crammed through sh, prefer pipe text in through stdin. it's simpler. using ipc::run heavy lifting: #!/usr/bin/env perl use strict; use warnings; use ipc::run qw(run); $in = <<ffff; 2 + 2 8 * (2 + 3) ffff $cmd = [qw(ssh user@host perl calc.pl)]; run $cmd, \$in, \my $out, \

validation - Java: Validate a TAR file -

is possible validate tar file in java can sure other tar utilities (i.e unix tar command) can extract tar? in code , not resort executing tar -tf application , report based on return code. i have been using apache commons compress read through tars entries (not extract them). have manually modified of tar using text editor represent "corrupt" tar file. commons compress doesn't fail read entries unix tar command or 7zip have failed consistently no matter modify. more needs done ensure tar file not corrupt, it? note: haven't tried extract tar via commons compress means of validation. don't think option; tar file sizes have work large (3 4 gigs) , rather not see process take longer does. since don't want execute tar command, use org.apache.tools.tar.tarinputstream implementation of apache ant . personaly, have not tried , i'm not expert in tar file format , try iterating on tar file using getnextentry method. assuming once you

c++ - How does photoshop blend two images together? -

how-does-photoshop-blend-two-images-together somebody explain how photoshop combine 2 pictures divide mode? want implement effect in java or c++. since multiply this: #define channelblend_multiply(a,b) ((uint8)((a * b) / 255)) divide must be: #define channelblend_multiply(a,b) ((uint8)((a / b) * 255))

objective c - how to get ios 5.1 into xcode simulator? -

ios 5.1 released , want test on simulator highest available ios 5.0. went developer centre download find list sdk ios 5.1 devices (ipad, iphone, ipad 2 etc etc). how 5.1 simulator? thanks! you have install lion and new xcode 4.3.1.

change css on cron job in cakephp -

i have table displaying data table in ctp file. want know whether possible change css property of particular row on cron job trigger. say table display title, description, starttime. when starttime equals current time, want change background of particular row only. it doesn't sound you'd need cron job such feature. you can check whether data date current date , add special class row. exact technique you'd use depends on how display table, using html helper: foreach( $data $row ) { echo $this->html->tablecells( array( array( 'column 1', 'column 2', '...' ) ), ( $row[ 'date' ] == date( 'y-m-d' ) ) ? 'highlight' : '', ( $row[ 'date' ] == date( 'y-m-d' ) ) ? 'highlight' : '' ); } in css: .highlight { background-color:yellow; }

download - Maven: does dependency management mean that I don't have to ship libraries (such as log4j)? -

i'm new maven. i'm trying build test project, includes log4j. java class 'hello world' import log4j this: import org.apache.log4j.logger; my pom.xml includes following section: <build> ... <dependencymanagement> <dependencies> <dependency> <groupid>log4j</groupid> <artifactid>log4j</artifactid> <version>1.2.12</version> </dependency> </dependencies> </dependencymanagement> ... </build> i haven't downloaded log4j jars @ point ..... i run: mvn install. i get: ... [info] ------------------------------------------------------------------------ [error] build failure [info] ------------------------------------------------------------------------ [info] compilation failure app.java:[2,23] package org.apache.log4j not exist ... so misunderstanding how maven works here.... i thought should able s

java - Forbid developer to use some API in Eclipse -

do have plugin/way in eclipse forbids(show error/warning) while using method. in code, want way confirm system.currenttimemillis() / calendar.getinstance() not being called if tries use this, eclipse should show error. thanks ankush you write own findbugs plugin relies on findbugs api provide metadata method invocations (among other opcodes found in bytecode). you'll need implement custom bytecodescanningdetector can verify if operation involves execution of set of banned apis ( system.currenttimemillis() , calendar.getinstance() ) in case. here's tutorial started on writing findbugs plugin. can use plugin in eclipse, preferable run in ci server part of build. you may find other static analysis tools pmd may have same features, exposed using own apis. also, if want run part of build, can delegate these checks sonar, allows easy construction of architectural rules these . note - haven't tried on methods, , i'd warn sonar architectural constraints

php - CakePHP multiple file upload field only uploading one image -

i trying upload files using multiple upload file field. post information gets sent correctly , looks this: array ( [uploads] => array ( [photos] => array ( [0] => array ( [name] => image - copy - copy.jpg [type] => image/jpeg [tmp_name] => /tmp/phpalamwt [error] => 0 [size] => 60892 ) [1] => array ( [name] => image - copy.jpg [type] => image/jpeg [tmp_name] => /tmp/phpoigtta [error] => 0 [size] => 60892 ) [2] => array (

SQL Server 2005 into Excel with OPENROWSET MSG 7399/7303 -

my patience @ end issue. run jobs via ssms or agent have been working fine until last week insert data tables/views various excel files. most recently, jobs/code keep running while never finishing...these jobs use take up-to 15-25 seconds complete never end. i've tested code below on new sheet , goes instantaneously! error i'm getting doesn't help, solutions i've found in google no or set. any ideas cause openrowset export bomb out , not job? code run works: insert openrowset('microsoft.ace.oledb.12.0', 'excel 12.0;hdr=yes;database=c:\automation\dynamic\output\file.xlsx;', 'select * [data$]') select * [reporting].[dbo].[tbl_table] the current error message: msg 7399, level 16, state 1, line 1 ole db provider "microsoft.ace.oledb.12.0" linked server "(null)" reported error. provider did not give information error. msg 7303, level 16, state 1, line 1 cannot initialize data source object of ole db p

c# - HTMLAgillityPack Parsing -

i trying parse following data html document using htmlagillitypack: <a href="http://abilene.craigslist.org/">abilene</a> <br> <a href="http://albany.craigslist.org/"><b>albany</b></a> <br> <a href="http://amarillo.craigslist.org/">amarillo</a> <br> ... i parse out url , name of city 2 separate files. example: urls.txt "http://abilene.craigslist.org/" "http://albany.craigslist.org/" "http://amarillo.craigslist.org/" cities.txt abilene albany amarillo here have far: public void parsehtml() { //clear text box textbox1.clear(); //managed wrapper around html document object model (dom). htmlagilitypack.htmldocument hdoc = new htmlagilitypack.htmldocument(); //load file hdoc.load(@"c:\allcities.html"); try { //execute input xpath query

html - jquery get the value using class name -

i trying value of input text field based on class name through jquery. the html is: <form> <input type="text" id="datepicker" style="display: none;"> <div class="dp_wrapper dp_input_6"> <div class="dp_tagbox"> <span class="dp_tag dp_tag_day">11</span> <span class="dp_tag dp_tag_month">jun</span> <span class="dp_tag dp_tag_year">2009</span> <input type="text"> </div> </div> <input type="button" onclick="getcontents()" value="submit"> </form> the jquery is: var myvalue=$('.dp_tag dp_tag_day').val() but myvalue coming undefined. know why? var days_as_nums = parseint($('.dp_tag_day', '.dp_input_6').text(), 10);

c# - Read Complex Rss feed -

hi i'am try read digg feed, code doesnt not return item rss, think namespace problem <?xml version="1.0" encoding="utf-8"?> <feed xml:lang="en-us" xmlns="http://www.w3.org/2005/atom" xmlns:digg="http://digg.com/docs/diggrss/" xmlns:media="http://search.yahoo.com/mrss/"> <title>top news</title> <subtitle>top news</subtitle> <updated>2012-03-10t13:27:08z</updated> <link href="http://services.digg.com/2.0/story.gettopnews?type=rss" rel="self"/> <id>http://services.digg.com/2.0/story.gettopnews?type=rss</id> <link href="http://pubsubhubbub.appspot.com/" rel="hub"/> <author> <name>digg</name> </author> <entry> <title>the windows 8 power struggle: metro vs desktop , why don't mesh well</title> <link href="http://digg.com/news/technology/the_windows_8_power_str

ruby on rails - Information about geo-locations via coordinates -

are there ways information different places (cities, mountains, rivers , etc) via latitude/longtitude? i'm planning use in rails project. of course, perfect use information wiki. example of searching on wiki via lat/lon? may other technology/website/api? you may check geocoder gem find address latitude , longtitude. can use wiki api find articles, this: en.wikipedia.org/w/api.php?action=opensearch&search="place_name"&prop=info&format=xml or, maybe wikilocation you

join - MySQL query to return custom structure with values as field type and titles -

sorry bizarre title, isn't easy summarize want achieve. goal have general table structure store "any" kind of data, , make it... describe itself, custom table output of query. i have table structure: id (int) iditem (int) fieldtitle (varchar) field (varchar) value_label (varchar) value_text (text) value_bool (tinyint) value_int (int) value_float (float) an example of data inside table: id iditem fieldtitle field value_label value_text value_bool value_int value_float -------------------------------------------------------------------------------------------------------------- 1 15 title value_label product 1 null null null null 2 15 description value_text null product... null null null 3 15 visible value_bool null null 1 null null 4 15 price value_float null null

machine learning - Python scikits SVM grid search and classification -

i beginner in scikits , svm , check couple of questions. have sample of 700 items , 35 features , have 3 classes. have array x samples , features scaled using "preprocessing.scale(x)". first step find suitable svm parameters , using grid search nested cross validation (see http://scikit-learn.org/stable/auto_examples/grid_search_digits.html# ). using samples (x) in "grid search". during grid search, data split training , testing (using stratifiedkfold). when svm parameters, perform classification divide data training , testing. ok use same data in grid search using during real classification? is ok use same data in grid search using during real classification? it ok use data training (fitting) classifier. cross validation, done stratifiedkfold , intended situations don't have enough data hold out validation set while optimizing hyperparameters (the algorithm settings). can use if you're lazy make validation set splitter , want rely on sc

php - Returning NULL not working with tabs plugin -

this code works when have data rows returned messages object when there isn't have returning null in case having hard time getting code still show correctly works tabs plugin have up. i'm using datatables tables. anybody have ideas? <!-- start of main content --> <div id="main_content"> <h2 class="grid_12">personal messages</h2> <div class="clean"></div> <div class="grid_8"> <div id="tab-panel-1" class="box"> <div class="header"> <img src="<?php echo base_url() ?>assets/img/icons/packs/fugue/16x16/shadeless/mail.png" width="16" height="16" /> <h3>messages</h3><span></span> <ul> <li><a href="#tab-1">inbox messages</a></li> <li><a href="#tab-2"&

security - What mechanisms does ssh-agent use to keep unlocked private keys secure in memory? -

i'm working on library make quick access keepassx database files easier power users. right application short-lived in memory security around unencrypted keepass database not huge concern. however, i'd add ability hold database unlocked period of time in background, similar way keepassx gui does. allow immediate query of passwords without being prompted master password. means there sort of daemon process holds database in memory , communicates client. it seems security implications of similar of ssh-agent , , i'm wondering if 'round these parts familiar how project approaches long-term secure storage of sensitive data (namely, unlocked ssh private keys). perhaps help: man: mlock(2) note unix domain sockets more secure internet domain sockets since can reached local host and access them can further constrained specific users , groups (using chown , chgrp and, of course, chmod ).

session - CakePHP 2.0 Automatic Login after Account Activation -

i'm working on user management-component of our new project. plan is: user registers on page minimal amount of account data (username, pass, email) user gets email activation link activate account user clicks on link , activates account the system logs in user after automatically after activation , redirects him kind of dashboard account information (last login, hi "username", etc.) but there problems auto login. part of code use: <?php ... // set userstatus "active" , delete meta information "activation_key" // automatically login $this->user->id = $id; $this->user->savefield('modified', date('y-m-d h:i:s') ); $this->user->savefield('status', 1 ); // $this->user->deleteactivationkey .... $this->auth->login($this->user->read()); $this->session->setflash(__('successfully activated account. logged in.')); $this->user->savefield('last_login', date(

c# - LINQ to SQL execute method on select -

im new linq i'm trying figure out how execute method lambda expressions. public void getdata() { using (myclassesdatacontext context = new myclassesdatacontext()) { var problems = (from p in context.problems select p).take(10); problems.select(t => displaydata(t.text)); } } public void displaydata(string text) { } i'm getting error: the type arguments method 'system.linq.enumerable.select(system.collections.generic.ienumerable, system.func)' cannot inferred usage. try specifying type arguments explicitly. at line: problems.select(t => displaydata(t.text)); what doing wrong? select operator used create projection - i.e. lambda expression passed argument instructs how create new object out of each object in collection. what want is, instead, perform action on each item collection. use foreach loop that:

cdi - Can I lookup EJB from BeanManager in web module? -

i have app package in ear estructure bellow: myapp.ear - myapp-ejb.jar - myapp-ejbclient.jar - myapp-web.war i have beans.xml in both myapp-ejb , myapp-web modules. web module have write code lookup ejb cdi, no beans found in jboss 7.1. if use code in jboss 7.0 webprofile, code works fine. there way lookup ejbs using beanmanager? set<bean<?>> beans = beanmanager.getbeans(myejb.class, qualifiers); bean<?> bean = (bean<?>) beans.iterator().next(); creationalcontext<?> ctx = beanmanager.createcreationalcontext(bean); myejb ejb = beanmanager.getreference(bean, myejb.class, ctx); [update] my ejbs remote, , application deployed in 1 ear modules inside.

html - Apply opacity to an element in CSS -

i have div element named signup-box , want have opacity value of 0.65 applied it, there appears side affect doing so. reason getting applied within div well. instance, white text wont show white , inputs aren't white. can keep transparent effect without losing design aspects want keep? http://jsfiddle.net/hky3f/5/ this behavior of opacity property (it applies everything in element). if want apply opacity background only, you'll need either create image 65% transparent black box, or can use css3 colors rgba function generate color black @ 65% opacity (doesn't work ie < 9). background: rgba(0, 0, 0, 0.6); which produces jdfiddle. hope that's looking for.

c# - efficient powerset algorithm for subsets of minimal length -

i using following c# function powerset limited subsets of minimal length string[] powerset(int min_len, string set) { ienumerable<ienumerable<string>> seed = new list<ienumerable<string>>() { enumerable.empty<string>() }; return set.replace(" ", "") .split(',') .aggregate(seed, (a, b) => a.concat(a.select(x => x.concat(new[] { b })))) .where(subset => subset.count() >= min_len) .select(subset => string.join(",", subset)) .toarray(); } the problem when original set large, algorithm has work hard if minimal length large well. e.g: powerset(27, "1,11,12,17,22,127,128,135,240,254,277,284,292,296,399,309,322,326,333,439,440,442,447,567,580,590,692,697"); should easy, lengthily above function. looking concise modification of function efficiently handle these cases. taking qui

php - Database structure for stock trading website? -

i have created simple stock trading simulation website. users can sign , buy/sell stocks. now, i've come problem. when use buys stock (can more 1 share), how put database? this bit of challenge because each user can buy stock exists , can buy quantity. here's example of i'm trying store db: stocks owned username1261817 symbol: quantity goog: 3 yhoo: 8 aapl: 3 etc... you might have design table how shopping cart do. include fields - userid (comes user table), stock symbol, quantity, stock price @ time of purchase, date purchased. generate necessary reports total stocks of 1 type, total stocks owned user etc.

css - Highlighting a field in a table and have it print -

does know how yellow highlight field in table , have yellow color print? hightlights on screen, not print yellow: <td style="background-color: yellow">total:</td> i found out browsers, design, not print background colors. workaround able find can make ultra-thick border of cell or div: <td style="border-left: 999px solid yellow"> unfortunately, cell contents won't overlay on thick yellow border. checked everywhere online , closest answer find on stack overflow: best ways around css backgrounds not printing however, answer untested , unable working on computer. tried toying around , experimenting no luck. ok, found solution problem, solution rather inelegant. said in above question, have create div tag big color border on it. thing is colored borders can print correctly. then, highlighted color displayed, lay div tag text on top. inelegant, works. it's best set both text div , highlight div's within third "o

html - How to position a row of text based on a particular letter? -

i have line of text follow: ->a b c d e f g h j <- i want position line of text using css such letter d @ centre of page shown below: -> b c d e f g h j <- any idea? if use monospaced font can use position:relative; , move row of text, since every letter , space has same size ( demo ). can achieve similar result on fonts without fixed-width, offset ( left:; ) little bit harder calculate, every letter occupies amount of horizontal space. <nav class="letter monospace"> <div>a b c d e f g h j</div> <!-- monospaced font demo --> </nav> <nav class="letter"> <div>a b c d e f g h j</div> <!-- standard browser font demo --> </nav> <div id="leftmiddle"> </div> <div id="rightmiddle"> </div> nav.letter{ font-size:2em; text-align:center; } nav.letter > div{ /* standard browser fo

C++ | main function error | beginners -

this question has answer here: what should main() return in c , c++? 19 answers i'm totally new c++ , i'm using eclipse. but... don't know why error @ main function: error: ::main must return int my code is: void main() { char a; while (a!='q') { string ln = "enter option: "; cout<< ln; switch(a) { case 1: if (a=='1') func1(); break; case 2: if (a=='2') break; break; } } } because in c++, main function must have return type of int . your version return type of void incorrect , being correctly rejected compiler. just change declaration from void main() to int main() there alternative form allows process arguments passed on command line program. looks this: int main (int argc, char *argv[]) but w