Posts

Showing posts from September, 2013

How java.exe and javaw.exe are used in Eclipse? -

i know use of java.exe , javaw.exe in command console, how used in eclipse? the eclipse launcher uses javaw internally launch eclipse. can see settings in eclipse.ini file in installation. lets identify eclipse in list of processes in task manager instead of seeing java process. when run/debug java programs inside eclipse, defaults using java launch jvm, believe can set use javaw if need. launchers use javaw default, think tomcat launcher (in wtp) 1 of them.

.NET WPF Window FadeIn and FadeOut Animation -

below code snippets of window fadein , fadeout animation: // create fade in storyboard fadeinstoryboard = new storyboard(); fadeinstoryboard.completed += new eventhandler(fadeinstoryboard_completed); doubleanimation fadeinanimation = new doubleanimation(0.0, 1.0, new duration(timespan.fromseconds(0.30))); storyboard.settarget(fadeinanimation, this); storyboard.settargetproperty(fadeinanimation, new propertypath(uielement.opacityproperty)); fadeinstoryboard.children.add(fadeinanimation); // create fade out storyboard fadeoutstoryboard = new storyboard(); fadeoutstoryboard.completed += new eventhandler(fadeoutstoryboard_completed); doubleanimation fadeoutanimation = new doubleanimation(1.0, 0.0, new duration(timespan.fromseconds(0.30))); storyboard.settarget(fadeoutanimation, this); storyboard.settargetproperty(fadeoutanimation, new propertypath(uielement.opacityproperty)); fadeoutstoryboard.children.add(fadeoutanimation); below helper methods trigger animation: /// <summar...

ruby on rails - Unit testing an OpenID server -

i'm working on authentication system derived of openid. work in ruby , use ruby-openid library. currently, tests, use fakeweb fake openid consumer , server , check works well. don't way it. , i'm sure there'd better way so. so question : has written tests openid server? have used ? they're not yet available offline, great battery of tests both providers , relying parties exist @ http://test-id.org . openid foundation sponsored development of many of these tests. test interop , security.

python - How to copy a file from a network share to local disk with variables? -

if use following line: shutil.copyfile(r"\\mynetworkshare\myfile.txt","c:\temp\myfile.txt") everything works fine. however, can't seem figure out how use variable network share path, because need 'r' (relative?) flag. end result imagine like: source_path = "\\mynetworkshare" dest_path = "c:\temp" file_name = "\\myfile.txt" shutil.copyfile(r source_path + file_name,dest_path + file_name) but have had no luck different variations of approach. the r used in first code example making string "raw" string. in example, means string see backslashes , not try use them escape \\ \ . to second code sample working, you'd use r on strings, , not in copyfile command: source_path = r"\\mynetworkshare" dest_path = r"c:\temp" file_name = "\\myfile.txt" shutil.copyfile(source_path + file_name, dest_path + file_name)

c# - How do I load views independent of the site.master? -

i'm preparing application wrote in asp.net mvc light ajax-y stuff. basically, want users able go different parts of page without reloading. to want able reload body of page. my site master broken down head body , foot div. want able use $("body").load(whateverlink) refresh body, in case doing causes website rendered inside body. how can successfully? edit: page made of views, not partialviews. in theory go , convert pages partials i'm looking way around if possible. thanks you can controllers return partial views, using jquery request , update div page content: jquery: function navigate(url){ $.ajax({ url: "/home/index", cache: false, success: function(html){ $("#content").html(html); } }); } controller: public class homecontroller : controller { public void index() { return this.partialview(); } }

Utilising a file association in a Java application -

i in process of writing cross platform swing based application in want utilize file association has been registered os. so iv got point can click on file , app loads, need know how can application know file launched , query contents. is there further have file association registration? or can java me? i'm not positive, i'd expect name of file you're processing file click end in arguments main() method. have tried/checked that?

dojo - dojox.charting Setting Custom Tooltip Labels from ItemFileReadStore -

i discovered dojox.charting.action2d.tooltip takes custom function provide text labels. challenge text of label want display contained within dojo.data.itemfilereadstore chart series pointed at. trying figure out way tie information passed in object in function item in store. understanding notification object can contain following: event - raw event object type - can "onmouseover", "onmouseout", "onclick" or "onplotreset" run - series object plot - plot2d object index - numeric index series element - can "bar", "column", "circle", "slice", "marker" shape - dojox.gfx shape object element haxis - horizontal axis object or null vaxis - vertical axis object or null x - x value (on horizontal axis) y - y value (on vertical axis) cx, cy - center of marker/circle/slice in geometric coordinates cr - radius of circle/slice in geometric coordinates i trued access run.store , seeme...

wpf - Datagrid SelectedItem lost on window.IsEnabled = false -

i have (main) window containing frame . page loaded frame , viewmodel datacontext. the view has datagrids, 1 bound viewmodel , other bound selected.item (so master-details view..) the problem occurs when display popup box, , set mainwindow isenabled = false. when happens, selected item datagrid bound viewmodel gets unselected, , of course other datagrids selected items unselected well. how can preserve "state" of ui when mainwindow.isenabled set false? if want add insanity mix. after installing vs 2011 beta (which replaces .net 4.0 framework .net 4.5) created small test application vs 2010 targets 4.0 , behaviour of has changed once again not set selecteditem = null when grid disabled. don't know if make final version of 4.5 or not....

iphone - ASIHTTPRequest: check if username/password is correct -

how can check webservice if username/password correct? i don't want transfer whole response body. want know if username/password exists , correct. i'm sending request webservice this: self.request = [asihttprequest requestwithurl:urlobject]; [self.request setusername:username]; [self.request setpassword:password]; [self.request addrequestheader:@"accept" value:@"application/json"]; [self.request setdelegate:self]; [self.request startasynchronous]; if access webservice browser , insert wrong password, again authentication dialog displayed. tried same in xcode , status code = 200 if password wrong. thought can status codes 401 , on. didn't worked, because status code = 200. have change on serverside? i'm using rest webservice, uses restlet 2.0 java framework. docs i'm still not sure how webservice works, information given think can answer question. if getting 'requestfailed:' when username , password wrong, should abl...

security - How long should I wait to publicize a vulnerability in a free/open source project? -

in review of free package distributed under apache license found number of bugs ranging obscure code issues security holes. i've taken following steps: i notified project lead through private email 2 weeks ago, , other acknowledgment of said emails, haven't seen any internal or external activity regarding issues raised. i've followed policies laid out sans , wiretrip . questions should follow email? if no response, should go ahead , post these issues publicly? does has been through (from either side) have suggestions how handle this? truthfully have no obligation either way if: you found problems under legitimate installation of software (following tos/fair usage guidelines, etc) you did not modify or compromise security of system in known way purposefully setting system in such way insecure (i.e. purposefully uninstalling security measures has) you cannot conceivably considered rival financial gain in same market space. if product pur...

php - Building an SQL query using multiple (optional) search fields -

i have form going used search through table of support tickets. the user can search few difficult optional fields. date (to/from) ticket status engineer ticket contact i'm wondering best way deal optional search filters. have query takes in parameters user. if user searches using both , dates query want include between. have write different query if user searches from. or query when user has not added date parameters? if status dropdown blank? query? any clear great! jonesy build query in parts. start whatever constant in query, , add on more sql depending on conditions: $query = "select ... ... [where conditions going present]"; if (isset($_post['date_from']) && isset($_post['date_to'])) { $query .= ... // query code dealing dates } if (isset($_post['status'])) { $query .= ... // deal status } // etc. // once have query built, execute $result_set = mysql_query($query); this code skeleton, that...

html - Having trouble with my menu on mac Safari. Works fine on Windows Safari -

http://wilwaldon.com/itsbroken/stay.html if take , tell me if works in safari awesome. screenshot if find bug. according adobe browser lab looks fine, according friend mac it's sorts of messed (the second tier's messed up, vertical lines after links offset 7px lower menu). and supposedly works fine offline, not when viewed on live server. there's fishy. works me, safari 4.0.4 , webkit r52951 on mac os x 10.6.2.

php - MySQL ND SSL in PHP5.3.3 -

according http://www.php.net/manual/en/mysqlnd.overview.php mysqlnd supports ssl does know of examples of setup of ssl connection mysqlnd? is assumption use existing mysqli route under hood it's using mysqlnd? the nd driver under hood. replaces old linked mysql c library php native library. to use ssl connection, need use mysqli::ssl_set pass in certificate paramaters. usage should pretty straight forward (assuming mysqli): $db = new mysqli($host, $user, $pass, $db); $db->ssl_set($key, $cert, $ca, $capath, $cipher);

c# - Accessing XAML controls in WPF -

i'm using code in .xaml, created user defined control( textbox ) numerictextbox : <local:numerictextbox grid.column="1" local:numerictextbox.mask="decimal" local:numerictextbox.maximumvalue="55" local:numerictextbox.minimumvalue="0" name="abc" grid.row="0" text="{binding path=ipaddressproperty}" /> i want access numerictextbox in .xaml.cs , have give minimum , maximum value in .xaml.cs file, can me out please? this question more readable if put xaml in original post. you need give name in xaml: <local:numerictextbox x:name="mytextbox" /> then can reference properties name in c# code-behind: this.mytextbox.minimumvalue = 0; this.mytextbox.maximumvalue = 255;

Can someone provide an example for how to post XML using HTTParty and Ruby on Rails? -

i need post xml webservice , i'm trying use httparty. can provide example how go doing so? here format of xml need post: <candidate xmlns="com.mysite/2010/10/10" xmlns:i="http://www.w3.org/2001/xmlschema-instance"> <firstname></firstname> <lastname></lastname> <email></email> <gender></gender> </candidate> here class far: require 'httparty' class webservice include httparty format :xml base_uri 'mysite.com' default_params :authorization => 'xxxxxxx' def self.add_candidate(first_name,last_name,email,gender) post('/test.xml', :body => "") end end i'm not quite sure how flesh out add_candidate. any appreciated. thanks. you've got 2 options. httparty allows post both string or hash. the string version be: post('/test.xml', :body => "<candidate xmlns=\"com.mysite/2010/10/10\...

php - SQL MAX() in multiple query string -

i have string of 3 queries designed find messages have other messages same id represents replies find messages of results first query have specified user entering first message of string of messages (min timestamp) find latest message of string of messages (max timestamp) the problem comes third query. expected results second query, when third executed, without max(timestamp) max, expected results. when add that, first message each string of messages when should last, regardless of whether use min or max , row count says 1 row returned when there 2 rows shown. got ideas on went wrong? $sql="select reply_chunk_id messages group reply_chunk_id having count(reply_chunk_id) > 1 "; $stmt16 = $conn->prepare($sql); $result=$stmt16->execute(array('specified_user')); while($row = $stmt16->fetch(pdo::fetch_assoc)){ $sql="select user,reply_chunk_id, min(timestamp) grp_timestamp messages reply_chunk_id=? ...

Refresh div using JQuery in Django while using the template system -

i want refresh in django contains temperature data. data fetched every 20 seconds. far have achieved using these functions: function refresh() { $.ajax({ url: '{% url monitor-test %}', success: function(data) { $('#test').html(data); } }); }; $(function(){ refresh(); var int = setinterval("refresh()", 10000); }); and urls.py: urlpatterns += patterns('toolbox.monitor.views', url(r'^monitor-test/$', 'temperature', name="monitor-test"), url(r'^monitor/$', 'test', name="monitor"), ) views.py: def temperature(request): temperature_dict = {} filter_device in temperaturedevices.objects.all(): get_objects = temperaturedata.objects.filter(device=filter_device) current_object = get_objects.latest('date') current_data = current_object.data temperature_dict[filter_device] = current_data return render_to_response('temp.html', {'tempe...

javascript - how to disable F5 keyboard keys -

am doing online cab booking services, once user reached completed journey, we showing thank booking , show booking id, people hit f5 key, page refresh , new entry inserted , so want deactivate f% on cashthankyou page, thanks bharanikumar you won't have luck - control / detection of key presses heavily browser dependant, , overriding standard behaviour impossible. rather approach, need detect , appropriately handle duplicate form submission: how handle multiple submissions server-side

iphone - MPMoviePlayerController fullscreen lockup -

i have strange bug regarding mpmovieplayercontroller . if reverse pinch gesture, (move 2 touch locations apart), while video playing (landscape), video switches portrait mode, broadcasts mpmovieplayerwillenterfullscreennotification , mpmovieplayerdidenterfullscreennotification , , stuck. no touches seems registered after point , video 'stuck' playing until has finished. upon relaunching mpmovieplayercontroller , video fails , presented black screen. i have tried forcing video leave fullscreen mode received mpmovieplayerwillenterfullscreennotification without luck. i have tried implement uipinchgesturerecognizer on player's view, unable capture gestures... have tried changing controlstyle property mpmoviecontrolstylenone?

How do I efficiently do the intersection of joins in SQL? -

i have 3 tables, books , tags , , taggings ( books-xref-tags ): books id | title | author 1 | blink | malcolm gladwell 2 | 1984 | george orwell taggings book_id | tag_id 1 | 1 1 | 2 2 | 1 2 | 3 tags id | name 1 | interesting 2 | nonfiction 3 | fiction i'd search books tagged both "interesting" and "fiction." best i've come is select books.* books, taggings, tags taggings.book_id = books.id , taggings.tag_id = tag.id , tag.name = "interesting" intersect select books.* books, taggings, tags taggings.book_id = books.id , taggings.tag_id = tag.id , tag.name = "fiction" that seems work, i'm not sure how scale, either in rows or number of tags. is, happens add hundreds of books, hundreds of tags, , thousands of taggings? happens search becomes "'interesting' and 'fiction' and 'aquatic' and 'stonemasonry...

asp.net - IE not printing disabled radio button's selection -

i have set of radio buttons disabled, , 1 of them selected. in ie8, when print web page, selected radio button not showing selected. however, works fine in firefox. any ideas? as turns out, had javascript manipulating radio buttons after page load, , causing issue. find interesting issue manifested in print mode, though.

php - How to get first 5 characters from string -

how first 5 characters string using php $mystr = "hellowordl"; result should this $result = "hello"; for single-byte strings (e.g. us-ascii, iso 8859 family, etc.) use substr , multi-byte strings (e.g. utf-8, utf-16, etc.) use mb_substr : // singlebyte strings $result = substr($mystr, 0, 5); // multibyte strings $result = mb_substr($mystr, 0, 5);

Returning SQL version using C# -

i'm struggling return sql version using c#, i'm new sql programming great. i'm getting various errors below latest attempt. private void buttonok_click(object sender, system.eventargs e) { string strsqlversion = sqlversion(); messagebox.show(strsqlversion); } private void sqlversion(string sqlver) { odbcconnection conn = null; try { conn = getconnection(comboboxdatabase.text); string strsql = "select @@version"; conn.open(); odbccommand cmd = new odbccommand(strsql, conn); string returnvalue = (string)cmd.executescalar(); return returnvalue; } catch (exception ex){ } { conn.close(); } } what about: private string sqlversion() { string version = ""; try { using (odbcconnection cn = new odbcconnection("...")) using (odbccommand cm = cn.createcommand()) { cn.open(); cm.command...

JSON Best Practice for Property Names -

is "best practice" use guid property name? (see sample json below) { "errortype": 0, "i9e4f0477549111d997e0acd5cbb90d3f": { "statuscode": "0", "guid": "i9e4f0477549111d997e0acd5cbb90d3f", "moreproperties": "more values" }, "n51d209f0505711dea52dfad621371b7c": { "statuscode": "0", "guid": "n51d209f0505711dea52dfad621371b7c", "moreproperties": "more values" } } i assume no because isn't whole "object" part of json gone? no longer have access namespace because property name random. , serializing (using json.net) no longer one-liner. furthermore there repeated data. guid name of property , within property object property name of "guid". data normalization not being considered. i'm not writing json consuming it. if writin...

regex - Scala regexps: how to return matches as array or list -

is there simple way return regex matches array? here how trying in 2.7.7 : val s = """6 1 2""" val re = """(\d+)\s(\d+)\s(\d+)""".r (m <- re.findallin (s)) println (m) // prints "6 1 2" re.findallin (s).tolist.length // 3? no! returns 1! but tried: s match { case re (m1, m2, m3) => println (m1) } and works fine! m1 6, m2 1, etc. then found added confusion: val mit = re.findallin (s) println (mit.tostring) println (mit.length) println (mit.tostring) that prints: non-empty iterator 1 empty iterator the "length" call somehow modifies state of iterator. going on here? ok, first of all, understand findallin returns iterator . iterator consume-once mutable object. change it. read on iterators if not familiar them. if want reusable, convert result of findallin list , , use list. now, seems want matching groups , not matches. method findallin return matches of full rege...

winforms - Windows Forms resolution problem -

i have developed 1024 *780 resolution screen in windows forms, not fit @ higher resolutions. there way handle this? is there way make windows forms applications same @ resolutions? my recommendation not "make same" on screens, rather design gui scales , down more gracefully. layout managers, docking, , anchors friends in winforms. tablelayoutpanel quite useful sort of thing. splitters help... finally, 1 of problems wpf sets out solve. wpf makes extensive use of layout managers. feels more java or gtk winforms or vb (old school vb).

scripting - awk script as a webservice -

i made awk script stuff on input files want avoid installing gawk on windows machines want awk script available webservice or form can either upload file or copy text of file in box , run script on , result of awk script. how can this. my suggestion, set web server, create form using php (or fav language). @ end, can either make system call gawk binary or can recode gawk script using php(or favorite language). users need go web page , submit files parsing. need have 1 copy of gawk interpreter @ server.

php - Select * to table where datetime is 24 hours ago -

i need select data in table created not less 24 hours ago. know how this? assuming table has datetime field, in example called date_field select * tablename date_field >= subdate( now(), interval 24 hour) or select * tablename date_field > now() - interval 1 day

wpf - The Background of the selected row do not change in ListView Control -

i have following listview listview.itemtemplate: <listview.itemtemplate> <datatemplate> <stackpanelname="stackpanel" orientation="horizontal"> <textboxname="textboxorg" background="transparent" borderthickness="0" textwrapping="wrap" text="{bindingorgtext}" isreadonly="true"/> <textboxname="textboxnew" background="transparent" borderthickness="0" textwrapping="wrap" text="{bindingnewtext}" acceptsreturn="true"/> </stackpanel> </datatemplate> </listview.itemtemplate> and following listviewitemstyle <style targettype="listviewitem"> <setter property="snapstodevicepixels" value="true" /> <style.triggers> <trigg...

html - Formating a database generated list of links into 4 columns -

i have database query returns ilist 12 results in it. each result link , format results 4 lists of 3 results side side, kind of this: item1 item4 item7 item10 item2 item5 item8 item11 item3 item6 item9 item12 also, cannot hard code because query results range 4 16. know want 4 columns , want co in ascending order filling in first column, second, third, , fourth. if you're looking html , css, try this: html <div class="ilist"> <div class="column"> <span class="item">item1</span> <span class="item">item2</span> <span class="item">item3</span> <span class="item">item4</span> </div> <div class="column"> <span class="item">item5</span> <span class="item">item6</span> <span class="item...

javascript - Add two variables using jquery -

var = 1; var b = 2; var c = a+b; c show 12 ; need 3 how do using jquery? it looks have strings , not numbers, need parseint() or parsefloat() (if may decimals) here, this: var = "1"; var b = "2"; var c = parseint(a, 10) + parseint(b, 10); //or: var c = parsefloat(a) + parsefloat(b); you can test difference here , it's worth noting these not jquery base javascript functions, isn't dependent on jquery library in way.

.net - Replacing Classes in the System Namespace -

i'm working hack .net operating system running on top of ms.net/mono (previously ran bare-metal only), , i've hit small snag. need implement own system.console talks service infrastructure, , can't find way replace without either 1) not linking against mscorlib (would hellacious do), or 2) using notquitesystem namespace replacements, break compatibility. is there mechanism can cleanly replace system classes without doing 1 of things? edit: 1 thought use mono.cecil rewrite references system.console renraku.system.console or somesuch, i'd prefer work within framework if possible. you should free tool postsharp . allows change existing .net assemblies @ design time automating modification of msil. see this page more information on compile-time weaving in postsharp. , this page information on load-time weaving (occurs @ runtime before assembly loaded in memory). for runtime weaving (modifying existing methods @ runtime), @ linfu . [except page]...

javascript - How to remove square brackets in string using regex? -

['abc','xyz'] – string want turn abc,xyz using regex in javascript. want replace both open close square bracket & single quote empty string ie "" . use regular expression match square brackets or single quotes: /[\[\]']+/g replace empty string. "['abc','xyz']".replace(/[\[\]']+/g,'')

Assistance with a class method in PHP -

i trying make function can pass mysql query , result or error, should check see if user running code admin, if session variable holds number count of mysql queries ran on page , increment 1 number , set session, if user admin show error messages. i know not best code appear should work? tips improve please. you can see running method gets session variables value, set variable in current method, increment it's value 1 number , run setter method save session again. not sure if correct way of doing that? need run methods , save them local variable am? also getting error fatal error: using $this when not in object context in c:\webserver\htdocs\project2\includes\classes\database.class.php on line 37 line 37 $this->user_role = $session->get('user_role'); method... public static function query($sql) { global $session; // $session object //get session value see if user admin $this->user_role = $session->get('user_role'...

asp.net - How to stop Visual to put web.config when I compile web site project -

in web application (dotnetnuke 5) site, development purposes made virtual directory under main website. as result, in solution have main web site virtual directory website folder inside main web site. now want have virtual directory because want focus differently on virtual directory project. however, problem following. ---real problem here--- when try compile virtual directory reason, places web.config in vd screws system. ---questions 1. how can prevent vs automatically place web.config here? 2. or alternatively how can make web.config ignorant or in other works let have 0 effect how? do have nant installed , knowledge of msbuild? use msbuild compile project, , use nant script perform post build operations (such deleting stray web.config file, or updating connection strings particular environment etc.)

html - Differences between type="image" and type="submit"? -

(this question related this question ) i've simple form: <html> <head> </head> <body> <form name="aspnetform" method="post" action="http://www.startupseeds.com/default.aspx"> <input type="hidden" name="__viewstate" id="__viewstate" value="..." /> <input type="hidden" name="__eventvalidation" id="__eventvalidation" value="/wewcalmynwrbqkoz5h1callmob9dgkmz6hzawkf8boxcqkc7qlkawk5knvvaqkk7amsa53tgbgr+ji7lti0eykvqumzrf/g" /> <input name="ctl00$login1$tbemail" type="text" /> <input name="ctl00$login1$tbpassword" type="password" /> <input type="image" name="ctl00$login1$iblogin" /> </form> </body> </html> when change this: <input type="image" name="ctl00$login1$iblogi...

sql server - Unused sql parameters - are they of any harm? -

consider following code: dim sql = "select * mytable value1 = @param1" if somecondition sql = sql + " , value2 = @param2" end if dim cmd new sqlcommand(sql, conn) cmd.parameters.addwithvalue("@param1", param1value) cmd.parameters.addwithvalue("@param2", param2value) assuming built complex sql statement dynamically may or may not have included @param2 parameter - there harm in adding command parameter? my real use-case far more complicated this, in general, pattern should avoid; , if so, why? the point take note fact if call .addwithvalue , leave sql server figure out data type of parameter be. sql server remarkably job of guessing - sometimes, gets "sub-optimally" , helpful provide details. so tend use snippet of code: sqlparameter aparam = new sqlparameter("@param1", sqldbtype.varchar, 50); aparam.value = param1value; this has 2 main benefits: you define explicit type, important e.g. when u...

php - Zend_Pdf manipulating PDF Form Fields -

i have project there number of forms processed , stored in db. upon successful completion admin notified email contents of form submission. the problem 1 of these forms need mail order version have in pdf format. so have 2 basic options: figure out coordinates of "field" need write to, , overlay drawn text @ coordinates turn pdf pdf form using acrobat pro's form wizard , set field values programmatically option 1 know doable. i've done similar things before. problem form pretty complex , there lot of coordinates figure out... moreover, there lot of trial , error process. option 2 seems easier long can access fields through iteration or name/id , set values. so question is, zend_pdf support manipulation of pdf form fields? dont see in api other submit , reset form actions denote supports this. additionally, if there other oo f/oss pdf libraries support option 2 interested in hearing them alternative approaches. sorry bit late thought may u...

Asynchronous NAnt batch call -

in nant project, i'd fire off batch file , forget it. tried pulling this: <exec program="start" commandline="cmd /c c:\mybat.bat" /> but nant complains: 'start' failed start system cannot find specified fileblockquote start cmd /c c:\mybat.bat works if run straight command line. ideas? take @ asyncexec task . also, iirc start not real program command, why you're getting error.

Single channelled images in CImg -

i use cimg image processing work. work on gray scale jpg, bmp, tiff images presently. problem facing cimg function follows: cimg stores pixel values in following way. r1r2r3r4............g1g2g3g4.........b1b2b3b4......... even grey scale images, 3 different channels created separately. makes work complicated. copying values 1 image another, need copy components of pixels. need iterate across channels make algorithm slow. since work grey scale images not matter me whether single channelled or multichannelled.is there way convert 3 channelled image single channelled in cimg. please let me know asap. thank in advance use cimg::channel(int c) function: cimg<float> img("input.jpg"); //3 channel img.channel(0); //now single channel img.save("output.jpg"); //will save 3 channel image again http://cimg.sourceforge.net/reference/structcimg__library_1_1cimg.html#a83af84298188d07c59c49dd0ed4d2714

web services - UDDI Best Practices -

my organisation getting soa world (a bit late, that's it's here!) , we're looking esb toolkit 2.0 (we have biztalk server 2009). we're keen on implementing uddi (specifically, uddi services v3.0 ships bts 2009), we're low on actual uddi experience. want manage ever-burgeoning number of web services have across our environments. what best practices implementing uddi? example:- would implement single highly-available resilient uddi server hosts services , bindings, including test environment versions? or implement separate uddi repositories test , production environments? i'm aware of oasis technical note v2.0 on wsdl , uddi, implement that? i.e. abstract parts of wsdl tmodels, implementation parts of wsdl bindings? would go effort of capturing non-web service endpoints in uddi, or use wsdl? what "gotchas"? ibm has stopped using uddi , , using http , rest interface wsrr. oracle not using uddi in of solution, yet have registry , r...

Python & C#: Is IronPython absolutely necessary? -

i'm c# programmer, have been left project leaves me 2 options: call out python script (saved .py file) , process return value, or... rewrite whole python script (involving 6 .py files in total) in c#. naturally, option 2 major waste of time if can implement option 1. moreover, option 1 learning opportunity, while option 2 total geek copout. so, question this: there way build c# process object trigger .py file's script , catch script's return value without using ironpython? don't have against possibly using ironpython, need solution possible, if can sidestep i.p. learning curve until have less urgent work do, optimal. thanks. use process.start run python script. in processstartinfo object, specify: filename = path , file name of python script. arguments = arguments want pass script. redirectstandardoutput = true (and redirectstandarderror if needed) useshellexecute = false then process object on can things, in particular: us...

c# - Is Silverlight able to change a file on a local user's computer? -

i considering writing application in c#/.net programmatically alter xml file on user's computer , trying determine if silverlight (and versions, in modes) work task. here's workflow: user selects file application modifies file application saves file, overwriting original file is possible in silverlight? if so, in versions , under conditions? some answer here concentrate on isolated storage. if no other application need access data perhaps isolated storage answer you. link blog describing how isolated storage used in nutshell. i suspect possibly isn't want since have user select file. certainly in sl3 can have user select file , can read it. however in order save again have have show "save file" dialog user, aquire file stream can write to. in sl4 running oob elevated privs can save files directly in users folder such documents. edit just absolutely clear, cannot write file acquired using openfiledialog read, cannot read file ...

3d - WPF-based graph visualization -

does know sample of graph(vertices connected edges) 3d visualization written on wpf or silverlight? the graph viewer silverlight i've seen part of silverlight bag-o-tricks . believe port of wpf project. i'm not sure if meet 3d requirements. 2 3d graph viewers i've seen wilmascope can find on sourceforge, , ubigraph has free basic version. also, if interested there's package flash called prefuse (prefuse.org) provides graph layouts , more.

tsql - Stored Procedure vs User Defined Function for Error Handling -

my erp database uses non-nullable datetime fields. however, enters '' datetime when 1 isn't available , returns ‘1900-01-01 00: 00: 00.000’ value. i want suppress 1900 dates while stripping date datetime field. created following udf that: create function extractdate(@dirtydate datetime) returns varchar(10) begin declare @cleandate varchar(10) select @cleandate = case when @dirtydate = '' '' else convert(varchar(10), @dirtydate, 101) end return @cleandate end this works, wanted add error handling in case user used on other datetime field. after googling, found out isn't possible udf. however, if write stored procedure, still able call in select statement? can point me in right direction? no, can't call stored proc in select statement. i applaud ambition in wanting include error handling, best bet check on app side - don't allow people use function on...

Lookup function in VB6 -

i have table in excel file called " employee_states_file".this table contains 2 columns name , states. both columns filled data. province table contains abbreviation of states such " ne, wa" , so. have excel file called " states_file" contains table has 2 columns: abbreviation , fullstatename. table considered lookup table full state names based on abbreviation. now, want write code in vb6 when user click button, abbreviation names in table of excel file " employee_states" changes full state names based on lookup table of excel sheet " states_file". make sense? please help, if allowed convert them csv files (comma delimited text files) can use jet database engine , normal sql joins. i use setup connection. public function opentextconnection(byval filename string) connection dim fso filesystemobject dim dbfolder string dim ts textstream set fso = new filesystemobject dbfolder = fso.getparentfoldernam...

How to download a file from the web using Android 1.6 -

i trying download zipped file web on first instance of application; can point me tutorial (i don't see documentation on developer.android)? understand how check if it's initial start or not, , how use java.util.zip once file, it's in-between i'm lost. i think question how download file. so, download file, use code similar following: url u = new url("http://www.example.com/downloadfile.zip"); httpurlconnection c = (httpurlconnection) u.openconnection(); c.setrequestmethod("get"); c.setdooutput(true); c.connect(); fileoutputstream fnew = new fileoutputstream(new file(root,"downloadfile.zip")); inputstream instream = c.getinputstream(); byte[] buffer = new byte[1024]; int inlen = 0; while ( (inlen = instream.read(buffer)) > 0 ) { fnew.write(buffer,0, inlen); } fnew.close(); instream.close(); of course, wrap appropriate error checking

python - Create constants using a "settings" module? -

i have done searches on google , here @ stackoverflow can not find looking for. i relatively new python. looking create "settings" module various application specific constants stored. here how wanting setup code settings.py constant = 'value' script.py import settings def func(): var = constant --- more coding --- return var i getting python error stating: "global name 'constant' not defined. i have noticed on django's source code settings.py file has constants named do. confused on how can imported script , referenced through application. edit thank answers! tried following: import settings print settings.constant i same error: importerror: cannot import name constant the easiest way have settings module. (settings.py) constant1 = "value1" constant2 = "value2" (consumer.py) import settings print settings.constant1 print settings.constant2 when import python module, hav...

svn - Problem with SvnInfo in MSBuild (using MSBuildCommunityTasks) -

i have script, use cc.net. i'm facing problem repositorypath attribute. following script (extract of sample script msbuildcommunitytask) giving me troubles: <?xml version="1.0" encoding="utf-8"?> <project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" toolsversion ="3.5"> <import project="$(msbuildextensionspath)\msbuildcommunitytasks\msbuild.community.tasks.targets" /> <target name="remoteinfo"> <svninfo repositorypath="http://msbuildtasks.tigris.org/svn/msbuildtasks/trunk/master.proj"> <output taskparameter="repositorypath" propertyname="repositorypath" /> <output taskparameter="repositoryroot" propertyname="repositoryroot" /> <output taskparameter="lastchangedauthor" propertyname="lastchangedauthor" /> <output taskparameter="lastchangedrevi...

Aligning text to the right in the C++ console -

how format console output it's aligned right in c++? use manipulator flag std::right example or this works... #include<iostream> using std::cout; using std::endl; #include<iomanip> using std::setw; int main(){ int x = 12345; cout << "blah blah blah" << endl << setw(80) << x << endl; system("pause"); return 0; }

c++ - Performance issues when reading a file from HD that dosen't follow computer byte alignments -

i have file format (.stl, stereo lithography, structure standard , can not changed. not confused standard template library) uses 50 byte data structure. reading hd directly leads wrong data being read 50 bytes not multiple of 4. out of entire 50 byte structure, need 36 of bytes. method using right extract data manually offset read position of file point next set of data begins, read off 36 bytes temporary variable , dump data in temporary variable it's proper position on array. here's code chunk: threepoints* output = new threepoints [numtriangles]; // create array hold entire file threepoints* temp = new threepoints [1]; // temp variable pull data out of each "cell" // extract each triangle individualy (int = 0; < numtriangles; i++) { stlfile.seekg (96 + * 50, ios::beg); //read vertex data , put them tempoary array // offset = 80 header + 4 #triangles + 12 normal vector stlfile.read(reinterpret_cast...

jquery solutions to post to another site from static html page -

need post data static html page page hosted on domain. i'd create , iframe form inside of post method, , actions directed web page, , submit form. complexity i'd collect data static html page , create similar (replica) form inside iframe (with above attributes viz method & action mainly); if there lot of fields i'd struggle via javascript alone. there jquery solutions thing? you try using jsonp alternative method. quick overview of jsonp can found on wikipedia ( http://en.wikipedia.org/wiki/json#jsonp ). jquery implements jsonp support through .getjson method ( http://docs.jquery.com/ajax/jquery.getjson ). unfortunately, use jsonp need submit form data query string (get request, instead of post request). can serialize form query string using jquery's serialize method ( http://docs.jquery.com/ajax/serialize ).

winforms - .NET Compact Framework: how to ensure form is visible before running code? -

we've got model-view-presenter setup our .net compact framework app. standard cf form implementing view interface, , passed constructor of presenter. presenter tells form show calling view.run(); view show() on itself, , presenter takes on again, loading data , populating view. problem view not finishing showing before control returned presenter. since presenter code blocks few seconds while loading data, effect form not visible few seconds. it's not until after presenter finishes it's data load form becomes visible, though form called show() on before presenter started data loading. in standard windows environment, use .shown event on form... compact framework doesn't have this, , can't find equivalent. does know of even, pinvoke, or other way form visible before kicking off code on presenter? @ point, i'd ok form calling presenter , telling presenter start it's data load. fyi - we're trying avoid multi-threading, cut down on complexity , re...

jQuery/ajax form - send to php problem -

i have nice looking slideup/slidedown jquery form on website. sends data same file send email. works fine: $(document).ready(function(){ $('div.contact a.submit').click(function() { var name = $('div.contact input.name').val(); var email = $('div.contact input.email').val(); var message = $('div.contact textarea.message').val(); $('div.contact').slideup('slow', function() { $.ajax({ type: "post", url: "test.php", data: "name=" + name + "&email=" + email + "&message=" + message, success: function(msg) { $('div.contact').html('<h1>contact</h1><div class="comment">success!</div><div class="clear"></div><p class="indent">thank you, in contact shortly....

python - Finding elements not in a list -

so heres code: item = [0,1,2,3,4,5,6,7,8,9] item in z: if item not in z: print item z contains list of integers. want compare item z , print out numbers not in z when compared item. can print elemtens in z when compared not items, when try , opposite using code above nothing prints. any help? your code not doing think think doing. line for item in z: iterate through z , each time making item equal 1 single element of z . original item list therefore overwritten before you've done it. i think want this: item = [0,1,2,3,4,5,6,7,8,9] element in item: if element not in z: print element but like: set(item) - set(z)

vb.net - Do While Loop - how to remove the last number in a list? -

learning loops (still beginner) in vb.net. have got below code , meant stop loop once reaches number above 20. now, problem stop after number 20 last number displayed in list above 20.....any idea how can stop showing last number above 20? if guys know can explain bit answer - learn have code..thanks! private sub btndowhileloop_click(byval sender system.object, byval e system.eventargs) handles btndowhileloop.click dim objrandom new random dim intrandomnumber integer = 0 clearlist() while intrandomnumber < 20 intrandomnumber = objrandom.next(25) lstdata.items.add(intrandomnumber.tostring) loop end sub the problem adding random item after generated, without checking whether should add it. you can check number should added list before adding it: private sub btndowhileloop_click(byval sender system.object, byval e system.eventargs) handles btndowhileloop.click dim objrandom new random dim intrandomnumber integer = 0 ...

iphone - uiimage allocation problem -

i have 3 uiimages in uiscrollview , initializing these images in following way: uiimage *dimage = [[uiimage alloc] initwithdata:data]; where data nsdata gotten url request. after caching images. when check memory allocation 3 images takes 472 kb each , allocation has been requested "img_data_lock" coregraphics library. when check size of image on disk cache 230kb each. i dont know how can take more space. hope question clear. not sure "disk cache" you're looking @ memory , disk usage weakly related. data used create uiimage part of data object uses. means active object can use more memory data created it. to further complicate things, uiimage purge of image data under low memory situations size of uiimage object can vary on course of existence.

database - SQL Server Reporting Services SQL server 2005 publish a report via web service -

imagine have 2 applications application , application b. insert records exist in application application b. sql server reporting server available on application a and wondering if possible build report gathers record need , publish web service can consume on application b , inserts. application , b in 2 different web servers separated internet. if possible post link shows example? btw: experience ssrs null, have been web developer quite while have general understanding of need 1 point me right direction. thanks in advance. ssrs not designed serve data other webservers, designed nicely layout , display data 1 or more sql servers. it seems can connect ssrs external sql servers when have the right licensing . if want application b display data both sql servers can use 1 ssrs report on computer b display data both. however seems want inserts on computer b, using report computer a. not use report that, direct connection using odbc, jdbc or inter-database connecti...

mysql - Is using rand() in an INSERT statement also slow? -

the mysql rand() function notoriously slow in select statements, true insert statements well? insert new row random number in following way: insert new_table (field1, field2, randomfield) values ('hello', 'ola', rand()); will rand() function become slow table gets larger , larger? will rand() function become slow table gets larger , larger? no. rand() getting slower on big tables when used in conjunction order by or where . in example, making one call rand() not performance problem.

date - LaTeX command for last modified -

is there latex command prints "last modified" date of actual document? since latex projects consist of more 1 file command ideally prints date of actual file, not of project. unfortunately, tex not provide commands such information; way such information by running non-tex script create tex file before running latex , including file in main latex document somehow, or by running external script from tex (which works if so-called write18 or shellescape feature enabled; you'd have consult manual of tex implementation this, , not have stubborn sysadmin). it possible extended texs support file info commands (luatex perhaps?), it's not part of tex proper.

c++ - Help understanding boost::bind placeholder arguments -

i reading stackoverflow post regarding sorting vector of pairs second element of pair. obvious answer create predicate, 1 answer used boost caught eye. std::sort(a.begin(), a.end(), boost::bind(&std::pair<int, int>::second, _1) < boost::bind(&std::pair<int, int>::second, _2)); i've been trying figure out how boost::bind works, or @ least how use it, can't figure out purpose of placeholder arguments _1 , _2 are, , boost documentation doesn't sink in @ all. could explain specific usage of boost::bind? p.s. original question: how sort vector of pairs based on second element of pair? this expression: boost::bind(&std::pair<int, int>::second, _1) < boost::bind(&std::pair<int, int>::second, _2) namely, use of < operator defines functor between 2 other functors, both of defined bind . the functor expected sort needs have operator() looks this: bool operator()(const t& arg1, const t& arg2);...

Visual Studio unable to load necessary dll's to run project -

i trying run project in visual studio 2010, , reason seems can't... command-line window closed instantly , debug info following: 'exercise01.exe': loaded 'e:\e\work spaces\c++ projects\exercise01\debug\exercise01.exe', symbols loaded. 'exercise01.exe': loaded 'c:\windows\system32\ntdll.dll', cannot find or open pdb file 'exercise01.exe': loaded 'c:\windows\system32\kernel32.dll', cannot find or open pdb file 'exercise01.exe': loaded 'c:\windows\system32\msvcr100d.dll', symbols loaded. program '[5900] exercise01.exe: native' has exited code 0 (0x0). what might cause these 2 dll's not loaded? , fact program exited code 0 related program not running, or there problem? i know others have published such questions before, unfortunately couldn't fine useful info anywhere, forgive me if i'm re-uploading question... i'm pretty noob when comes programming in c, , in visual studio in general, ple...

ruby on rails - link_to send parameters along with the url and grab them on target page -

how can have link on page takes user url , passes along parameter , on target url how can pick parameter. usually add links following: <%= link_to "add product", '/pages/product' %> but how can send parameters along url? can pick them in target action using params[:parm_name] just add them link: <%= link_to "add product", '/pages/product?param1=value1&param2=value2' %> and in controller: param1 = params[:param1] # "value1" param2 = params[:param2] # "value2" if use helper methods routes (for example company_path ), can add hash of params, 2 should similar: <%= link_to "add product", new_product_path(:param1 => "value1", :param2 => "value2") %> <%= link_to "add product", "/products/new?param1=value1&param2=value2" %> from documentation : link_to "comment wall", profile_path(@profile, :anchor => ...