Posts

Showing posts from May, 2014

Featured post

c# - Usage of Server Side Controls in MVC Frame work -

i using asp.net 4.0 , mvc 2.0 web application. project requiremrnt have use server side control in application not possibl in noraml case. ideally want use adrotator control , datalist control. i saw few samples , references in codepleax mvc controllib howwver found less useful. can tell how utilize theese controls in asp.net application along mvc. note: please provide functionalities related adrotator , datalist controls not equivalent functionalities thanks in advace. mvc pages not use normal .net solution makes use of normal .net components impossible. a normal .net page use event driven solution call different methods service side mvc use actions , view completly different way handle things. also, mvc not use viewstate normal .net controlls require. found article discussing mixing of normal .net , mvc.

osx - iPhone and Mac connection through Bonjour -

i have task in want import , export csv files iphone mac. have used 0 configuration network bonjour.in want export file iphone mac.in mac bonjour server running.how select directory exported file should save in path. you'll want use instanceof nssavepanel : http://developer.apple.com/library/mac/#documentation/cocoa/reference/applicationkit/classes/nssavepanel_class/reference/reference.html

objective c - iPhone SDK - Table view, error with spaces -

Image
i have little knowledge iphone skd (don't know code objective c?). have far got table view working, , showing content on nib file once row clicked. i have elseif statements each row, telling them load nib file inside viewcontroller. however, 1 row causing problem, crases app. else if ([[array objectatindex:indexpath.row] isequal:@"ascii characters"]) { asciicharacters *asciicharacters = [[asciicharacters alloc] initwithnibname:@"ascii characters" bundle:nil]; [self.navigationcontroller pushviewcontroller:asciicharacters animated:yes]; [asciicharacters release]; } here image of debugger console: i don't do, there no errors displaying @ all. crashes app, if row clicked (both on simulator , iphone). think is't spaces in name. row has space. need space otherwise silly. :) i think need change line asciicharacters *asciicharacters = [[asciicharacters alloc] initwithnibname:@"ascii characters"

c - inter processes shared memory and pthread_barrier: how to be safe? -

i wanted simple solution inter processes barrier. here solution: solution but totally lost mmap... first try, fails 1 out of ten times (segfault or deadlock). i understand problem comes synchronization issue, can't find it. found example set mmaped memory ( example ), not sure mmaped pthread_barrier. here extract of code: #define mmap_file "/tmp/mmapped_bigdft.bin" void init_barrier() { pthread_barrier_t *shared_mem_barrier; pthread_barrierattr_t barattr; pthread_barrierattr_setpshared(&barattr, pthread_process_shared); hbcast_fd = open(mmap_file, o_rdwr | o_creat | o_trunc, (mode_t)0600); result = lseek(hbcast_fd, sizeof(pthread_barrier_t)-1, seek_set); result = write(hbcast_fd, "", 1); shared_mem_barrier = (pthread_barrier_t*) mmap(0, sizeof(pthread_barrier_t), prot_read | prot_write, map_shared, hbcast_fd, 0); if (mpi_rank == 0) { int err = pthread_barrier_init(shared_mem_barrier, &barattr, host_size); } mpi_barri

c# - How do I add interop assembly that changes its version number? -

my c# program uses com component via interop assembly. com component changes (methods added @ end of interface). i need build program in automated build , have interop assembly incrementing version number - can achieved using tlbimp pre-build step. the problem reference in project file set specific version (say 4.0.0.34) - 1 interop assembly had when reference added. once number incremented automated build , pre-build step done version number store in project file no longer matches number in assembly properties , get warning msb3245: not resolve reference. not locate assembly "interop.mycomcomponent, culture=neutral, version=4.0.0.34, processorarchitecture=msil". check make sure assembly exists on disk. if reference required code, may compilation errors. and then the type or namespace name 'mycomcomponent' not found (are missing using directive or assembly reference?) can somehow tell visual studio don't want store exact assembly version ins

domain service calling from domain entity -

can domain service can call domain entity, through service interface. for eg- : employee.fire() calling iemployee firing service. calling through interface not through concrete one. is possible ? though can without complilation error, don't think it's idea call domain service in domain entity. normally if action affects more 1 entities, put logic in service method. if fire action affects current employee, should encapsulate inside employee.fire(). else if affects multi employees, should put in service , application should invoke service.fire() instead of employee.file()

c# - How do I explicitly run the static constructor of an unknown type? -

possible duplicate: how invoke static constructor reflection? i've got initialization code in static constructor of various classes. can't create instances, nor know types in advance. ensure classes loaded. i tried this: footype.typeinitializer.invoke (new object[0]); but got memberaccessexception: type initializer not callable. i'm assuming because cctor private? there way fix without changing architecture? edit: found workaround using runtimehelpers.runclassconstructor , way seems barely documented in msdn , i'm not sure if hack or reasonable, prod system way. i'm not sure why works, far reason (with skeet ) if have static class public static class statics1 { public static string value1 { get; set; } static statics1() { console.writeline("statics1 cctor"); value1 = "initialized 1"; } } the code: type statictype = typeof (statics1); statictype.typeinitializer.invoke(null)

uml - Reverse Engineering C++ code using "Enterprise Architect" -

it again sort of "how properly" question. sorry if annoyed. i've got understand ca 150 tlocs of c/c++ mixture. i've imported code in uml-tool "enterprise architect" , got messy chart. many structs , enums had anonymous names because of c-ish constructs: typedef struct/enum {...} mytype; in second run i've converted c++ form: struct/enum mytype{...}; got bunch of unrelated structs. unfortunately, enterprise architect doesn't resolve typedefs. e.g. no relations between a, b , c recognized: struct a; struct b; typedef *ptra; typedef list<b> blist; struct c{ ptra pa; blist lb; }; thanks throughout naming convention, able replace typedefs original type this: struct c{ pa; b lb; }; now importing source-code in "enterprise architect" gave nice diagram relations. of cause, code doesn't compile, , not same. changes in code require annoying conversion making "pseudo" code understandable ea again. therefore ques

ruby - Regular expression: if three letters are included -

i've got number of word: hello, poison, world, search, echo ... , i've got letters e, h, o need find words includes letters. search, echo e, h, o i can search way: words = %w[hello poison world search echo] matched = words.select |w| %w[e,h,o].all?{ |l| w =~ /#{l}/ } end the problem if letters o, o, o , or l, b, l search return true words open or boil , need search words includes 3 of o or 2 of l , 1 b upd: leters = "abc" words.select{ |w| w.count(letters) >= 3 } upd 2 bad solution, example: "lllllll".count("lua") #=> 5 are sure want regexp? strings support counting values in them, use feature. this: words = ["pool", "tool", "troll", "lot"] letters = "olo" #find how many of each letter need counts = {} letters.each { |v| counts[v] = letters.count(v) } #see if given work matches counts # accumulated above res = words.select |w| counts.keys.inject(true

actionscript - change color of flash component? -

sorry if question kind of newbie i'm new flash i'm using dice on site http://www.flashvalley.com/fv_components/dice/ , managed chage color wondering if possible change dots color white well? thanks in advance! you need target movieclips/sprites , color transform on them lets have called each of movieclips want transform "dot_mc" var c:colortransform = new colortransform(); // instantiate color transform c.color = 0xffffff; // set color of transform white dot_mc.transform.colortransform = c; //apply color transform so if had many of these dots put them in array , loop through array , apply whatever color these dots var arr:array = new array(); arr.push(dot1_mc); arr.push(dot2_mc); arr.push(dot3_mc); // var c:colortransform = new colortransform(); c.color = 0xffffff; // (var i:int=0; i<arr.length;i++){ var mc:movieclip = arr[i]; mc.transform.colortransform = c; } you put above in function , call whenever want, passing whichever co

c# - Implementing the Bentley-Ottmann algorithm -

i having trouble correctly implementing bentley-ottmann algorithm in c#. trying implement according pseudocode here . have posted main code below. assuming bst , priorityqueue classes implemented correctly, see problems code? there no errors, not intersection points found, some. guess there's error in else part of code (when current event intersection point). i'm not sure pseudocode means swapping position of 2 segments in bst. way fine? because in end, 2 aren't swapped in bst. can't change positions either, because break bst properties. also, right in assuming segments ordered in bst y -coordinate of left endpoint? another error i've noticed can't seem able track down point (0, 0) gets eventlist . (0, 0) outputted geometry.intersects in case there no intersection, in case if conditions should stop getting added. have no idea how gets in. if print contents of eventlist after adding point in, (0, 0) never shows up. if print contents after extra

java - Live Memory not matching Core Dumped Memory -

we're trying investigate memory corruption on application , exact issue we're seeing can seen in live memory of application (i.e. debug code has been added displays corrupted information), when through core dumps taken @ point data doesn't have corruption. from rudimentary understanding of core dump process due os flushing every buffer, finishing off partial writes , on. can go detail on occurs , if there's anyway determine causing corruption? mprotect() blocks writes, not non owning processes , data has lot of r/w access our application (and have problems on new machines) turned out rhel4 , kernel running on, customer upgraded rhel5 latest kernel , problem vanished

php - PostgreSQL: how to format date without using to_char()? -

i have php-script i'd keep unchanged: $display = array( 'qdatetime', 'id', 'name', 'category', 'appsversion', 'osversion', ); $sql = sprintf(" select %s quincytrack qdatetime > (now() - interval '2 day') , qdatetime <= now()", join(', ', $display)); $sth = $pg->prepare($sql); $sth->execute($args); my problem qdatetime printed 2010-12-18 15:51:37 while need 2010-12-18 . know call to_char(qdatetime, 'yyyy-mm-dd') qdatetime , prefer find other way affect date output format... using postgresql 8.4.5 under centos 5.5 linux / 64 bit. thank you! alex a better approach relying on database date formatting rely on php this. echo date("y-m-d", strtotime($row['column'])); this both solves initial problem (of confusing join statement when building query), , gives lot more flexibility (eg, maybe later user can set pref

Best way to represent constraints on values in Scala? -

what best way express that, say, int field or parameter should never negative? the first thing comes mind annotation on type, case class foo(x: int @notnegative) . i'd have invent own annotation, , there wouldn't sort of compile-time checking or anything. is there better way? why not using separate data type? class natural private (val value: int) { require(value >= 0) def +(that:natural) = new natural(this.value + that.value) def *(that:natural) = new natural(this.value * that.value) def %(that:natural) = new natural(this.value % that.value) def |-|(that:natural) = natural.abs(this.value - that.value) //absolute difference override def tostring = value.tostring } object natural { implicit def nat2int(n:natural) = n.value def abs(n:int) = new natural(math.abs(n)) } usage: val = natural.abs(4711) val b = natural.abs(-42) val c = + b val d = b - // works due implicit conversion, d typed int println(a < b) //works due implici

How do I access the first key of an ‘associative’ array in JavaScript? -

i have js 'associative' array, array['serial_number'] = 'value' serial_number , value strings. e.g. array['20910930923'] = '20101102' i sorted value, works fine. let's object 'sorted'; now want access first key of 'sorted' array. how do it? can't think need iteration with for (var in sorted) and stop after ther first one... thanks edit: clarify, know js not support associative arrays (that's why put in high commas in title). javascript object properties specified have no order, much though many people wish different . if need ordering, abandon attempt use object , use array instead, either store name-value objects: var namevalues = [ {name: '20910930923', value: '20101102'}, {name: 'foo', value: 'bar'} ]; ... or ordered list of property names use existing object: var obj = { '20910930923': '20101102', 'foo': 'b

c# - How to catch exact USB-HID device interaction from a software and reimplement it in my own code -

i'm trying work usb hid device. have proprietary software (from device's vendor) can interact device. need write own one. of sniffer tool i've catched traffic between host , device. tool busdog . able reproduce same traffic via writefile device's handle createfile (for path got setupapi.dll apis). device doesn't react on commands ("requests" they're called in usb/hid world). then took tool - hhd device monitoring studio. tool shows not "interrupt transfer" kinds of transfers. can see following log: 008852: class-specific request (down), 20.12.2010 18:58:10.242 +0.031 destination: interface, index 0 reserved bits: 34 request: 0x9 value: 0x30d send 0x8 bytes device 0d 01 01 00 00 00 00 00 ........ 008853: control transfer (up), 20.12.2010 18:58:10.242 +0.0. status: 0x00000000 pipe handle: 0x8638c5c8 0d 01 01 00 00 00 00 00 ........ setup packet 21 09 0d 03 00 00 08 00

c# 4.0 - Using Task Parallel Library (C# .NET 4.0) with an external exe (ffmpeg) without conflicts -

i've been trying solve problem several days. beginner in multithreading. goal run several video encoding tasks simultaneously using ffmpeg.exe , use power of server. i've got c# wrapper launches ffmpeg.exe process , works without threading (or ffmpeg internal threading (not available flv encoding)) looks this: using (process process = new process()) { process.startinfo.filename = encoderpath + "ffmpeg.exe"; process.startinfo.useshellexecute = false; process.startinfo.redirectstandardoutput = true; process.startinfo.redirectstandarderror = true; process.startinfo.createnowindow = false; string arguments = "-y -i " + filenameinput + " -f " + getvideoformatname(format) + " -vcodec " + getvideocodecname(codec); // (most argument setup has been omitted brevity) arguments += " " + filenameoutput + " "; process.startinfo.arguments = arguments; process.startinfo.wi

testing - Creating a test project to test classes in another project in Android -

i have project many classes , activities. test of classes creating project , using them. possible? tried creating android test project in eclipse, linking project want test, creating activity , there using of classes. unfortunately, noclassdeffounderror. please address me right direction on how create kind of test? thanks! what looking junit testing. there is plenty out there to get you started. to test activities can fire intents using activityinstrumentationtestcase2

c# - Why is my MVC app throwing a blank page? -

deploying asp.net mvc 2 application iis7 staging server leads blank page, regardless of action called. attempts access controller actions require authentication correctly redirected /account/logon , page shows blank page on both local machine , remote server. i have checked site permissions , think assembly issue, no errors show in application log. how determine cause of error? i installed asp.net mvc 3 on dev machine, made no changes project , using structuremap di, if makes difference. you try installing elmah nuget. in package manager console, type install-package elmah . run app. also, if you're not getting errors, have checked rendered source in browser? master page have commented out in it. not though! another suggestion empty bin directory after doing clean solution , rebuild, , try again. in cases this, helps breaking problem down smallest steps needed replicate problem. in case, remove routes, barring one/s need, empty out master page , view sim

rubygems - Error installing ScrAPI gem: ffi requires Ruby version >= 1.9.2 -

i having issues installing scrapi gem: error: error installing scrapi: ffi requires ruby version >= 1.9.2. i running rvm , if ruby -v get: ruby -v ruby 1.9.2p110 (2010-12-20 revision 30269) [i686-linux] i guessing did $ sudo gem install scrapi sudo ruby -v unless followed wayne's sudo rvm install i'm guessing root uses different ruby.

osx - Best practice for Bash start-up files on a Mac -

as understand it, order start-up files read bash shell on mac are... ~/.bash_profile ~/.bash_login ~/.profile ..and once 1 file in list found, contents of other ignored. that being said, there best practice of these files should 1 true bash start-up file? on 1 hand, if .bash_profile take precedence on other potential start-up file, should used, because can sure 100% of time info in start-up file being run. on other hand, if .profile file exists on mac systems default, , .bash_profile needs manually created, perhaps should used, , there never reason create .bash_profile file. thoughts? it depends on whether use shells other bash, , whether use bash-only features in profile. if use other sh-style shells (sh, ksh, zsh, etc not csh or tcsh), don't use bash-only features , want same setup no matter shell you're in, should use .profile. if want use bash-only features, use .bash_profile. if want use multiple shells use bash-only features, put common stu

.net - Which constructor should I use for the StringBuilder class? -

i'm building large string list of items. each item generate string approximately 200 characters long (plus or minus 100%). will (noticeable) performance benefit using dim sb = new stringbuilder(averagecharactercount * items.count) instead of dim sb = new stringbuilder() even if specified capacity guess? starting in right ball-park save few reallocations/copies, note since doubling algorithm approach size pretty quickly. if within 100% 1 more reallocation/copy worst case, yes - starting approach some . but in many ways micro-optimisation; you're doing right way, unless our profiling shows still bottleneck (ad therefore need squeeze last few cycles out), forget , move on next thing.

grails/gorm/mysql/hibernate -

i have simples question. have been trying learn grails own, , managed simple application using grails/gorm. 1 ) later, decided use mysql instead of gorm - needed configure 'datasource' , download driver. 2 )so if want use hibernate between both (grails , mysql) this: http://www.grails.org/doc/latest/guide/15.%20grails%20and%20hibernate.html , need make 'hibernate.cfg.xml' file, , specify mysql database url, user, pw etc .. , have map each class in grails mysql columns. so diference between 1) , 2) ? , hibernate does. give examples if possible ps. please correct me if said wrong, im kinda new this i think bit confused here. gorm not database, orm maps groovy classes database tables. uses hibernate under covers achieve (hibernate orm). the default database grails uses in-memory hsql db. if want use mysql instead of that, need change settings in conf/datasource.groovy. you don't need create hibernate xml files. part of documentation you'

google email app and a web host switch: redirecting? -

i have organization using google email app. switched hosts website , email disabled because google doesn't have right configurations new host of web. how deliver correct info google email enabled again? it due changes in dns rather switching web hosting provider. should read the guide setting dns google mail .

localization - What's the proper way to handle localized name-spaced routes in Rails 2.3.8? -

i'm localizing application , struggling how handle routes specific portion of app. initially had routes looked this: map.namespace :admin |admin| admin.resources :people, :member => {:confirm_destroy => :get}, :collection => {:follow => :post, :sync_friends => :get, :upload => :post, :import => :get, :recommendations => :get, :mark_recommendations => :post, :batch_create => :post} admin.resources :jobs, :collection => {:remove => :post} admin.resources :users, :member => {:confirm_destroy => :get} admin.resources :sites, :member => {:update_design => :post, :design => :get, :update_links => :post, :links => :get, :content => :get, :update_content => :post, :add_admin => :post, :remove_admin => :post, :set_system_account => :get, :confirm_system_account => :get}, :collection => {:remove => :post, :upload => :post} admin.resources :subscriptions, :member =>

Can a WCF Data Service be hosted by something other than IIS? -

is possible host wcf data service servicehost class can wcf services or workflow services? if not, limits being hosted in manner? yes. you'll have best luck using dataservicehost described in this msdn reference page .

msbuild - Visual Studio BeforeBuild using xcopy command -

i using following beforebuild target , works fine: <target name="beforebuild" condition=" $(configuration) == 'debug' "> <exec command="xcopy ..\mycomponent\mylateboundassembly\bin\debug\*.* bin /q /r /y"> </target> however when folder mycomponent has space in (my component) cannot remove(legacy code), cannot xcopy work anyone know way use xcopy in beforebuild paths have space? thanks i got work performing following: add item property group (test) <propertygroup condition=" '$(configuration)|$(platform)' == 'debug|anycpu' "> ..... <test>"..\x space\classlibrary2"</test> </propertygroup> then in exec command use property group item <target name="beforebuild" condition=" $(configuration) == 'debug' "> <exec command="xcopy $(test)\bin\debug\*.* bin /q /r /y"> </exec>

unit testing - How to test for situation where a specific library is missing in Python -

i have packages have soft dependencies on other packages fall default (simple) implementation. the problem hard test using unit tests. set separate virtual environments, hard manage. is there package or way achieve following: have import x work usual, but hide_package('x') import x will raise importerror. i keep having bugs creep fall-back part of code because hard test this. it looks bit dirty, can override __import__ builtin: save_import = __builtin__.__import__ def my_import(name, *rest): if name=="hidden": raise importerror, "hidden package" return save_import(name, *rest) __builtin__.__import__ = my_import btw, have read pep 302? seems can make more robust mechanism import hooks.

Can an HTTP connection be passed from IIS/ASP.NET to another application or service? -

i'm looking building asp.net mvc application exposes (other usual html pages) json , xml rest services, web sockets . in perfect world, able use same urls web sockets interface other services (and determine data return user agent requests) but, knowing iis wasn't built persistent connections, need know if there's way can accept (and possibly handshake) web sockets connection , pass connection off service running on server. i have workaround in mind if isn't possible involves using asp.net check web sockets connection upgrade headers, , responding http/1.1 302 found points different host has web sockets service configured directly listen appopriate endpoint(s). if understand goal, believe can use iis7/7.5 application request routing module accomplish this. here's quick reference: http://learn.iis.net/page.aspx/489/using-the-application-request-routing-module/

I want to use the Jquery BBQ plugin with a little wordpress ajax -

i have tried head round jquery bbq seems brilliant can't work. here code have it's been messed around quite bit me: $(".loadingallarticles").hide(); jquery('a.nextpostslink, a.previouspostslink').live('click', function(e){ $(".loadingallarticles").show(); e.preventdefault(); var link = jquery(this).attr('href'); $.bbq.pushstate({ url: link }); jquery('#allarticles').fadeout(500).load(link + ' #leftandrightpostbottom, #leftandrightposttop, #featuredposts, .postnav, .pagetitle, #footer', function() { $(".loadingallarticles").fadeout(500); jquery('#allarticles').fadein(500); }); }); $(window).bind( "hashchange", function(e) { var url = $.bbq.getstate( "link" ); }); essentially idea goto next set of posts want enable button , bookmark support, jump page 5 via link rather pressing next button on site 5 times. feel

iphone - Partial Curl Modal Transition Style While Preserving Tool/Tab Bar -

is there way present modal view controller doesn't cover tab bar of uitabbarcontroller? specifically want use uimodaltransitionstylepartialcurl, preserve bottom bar, la iphone maps app. have 2 view controllers in first have second subview add toolbar subview first , call bringsubviewtofront: present modal in second

Form validation with jquery - return false -

can 1 tell why folowing code doesn't work. alerts should. return true afterwards, if field empty. <form id="theform" method="post" action="mailme.php"> <input id="field1" name="a" value="field1" type="text" /> <input id="field2" name="b" value="field2" type="text" /> <input id="field3" name="c" value="field3" type="text" /> <input id="field4" name="d" value="field4" type="text" /> <input type="submit" /> </form> <script> $('#theform').submit(function(){ $('#theform input[type=text]').each(function(n,element){ if ($(element).val()=='') { alert('the ' + element.id+' must have value'); return false; } }); return true; }); </script>

ruby - Rails helper method that works differently in different environments -

in ruby on rails application, have controller i'd functionality conditionally run, condition dependent on environment application running in. contrived example, in development mode i'd do: if foo == 5: ... end and in production mode, i'd like: if foo > 6: ... end the difference between 2 conditions more complicated single constant (5 or 6 in example above). what idiomatic way in rails? write helper methods directly in environments/ files? or add method application controller checks current environment? or else? i add check env['rails_env'] in logic statements. http://guides.rubyonrails.org/configuring.html#rails-environment-settings i change code to: if foo == 5 && env['rails_env'] == "development" ... elsif foo > 6 && env['rails_env'] == "production" ... end it condition in flow-control, no need complicate it. if need lot, few methods in application.rb help

bash - When i Choose from The main Menu I Get: game.sh: 423: Syntax error: end of file unexpected (expecting "fi") -

!# /bin/sh # game.sh: # chooses games based on genre , title # shows descriptions of games # genre menu clear printf "%s\n" "game genre menu" printf "%s\n" printf "%s\n" "1. first person shooter" printf "%s\n" "2. arcade" printf "%s\n" "3. rpg" printf "%s\n" "4. rpg (infocom a-jo)" #1-12 printf "%s\n" "5. rpg (infocom le-st)" #13-24 printf "%s\n" "6. rpg (infocom su-zo)" #25-36 printf "%s\n" "7. rpg (infocom zzinvisiclues)" #37-45 read -p "enter number: " genre if [ $genre = 1 ] # menu first person shooters clear printf "%s\n" "first person shooter menu" printf "%s\n" printf "%s\n" "1. doom" printf "%s\n" "2. doom ii" printf "%s\n" "3. final doom (tnt)" printf "%s\n" "4. final doom (pluto

iphone - UINavigationController popView behavior -

i'm writing iphone app , i'm having problems uinavigationcontroller bug can't replicate @ will. i have 3 table views , @ end detail / normal uiview. when navigate detail view table views bit weird: the title animate (so slidy thing , title change expected), content doesn't. (titles v content) t1 -> t2 -> t3 -> d1 t1content t2content t3content d1content [hit button] t1 <- t2 <- t3 <- t2content t3content t3content and go further , it's seg_fault. i'm sure me doing weird along way - don't know what, suggestions on mistakes might manifest way hugely appreciated. thanks, pete. edit - include code: // push view code [self.navigationcontroller pushviewcontroller:updatecontroller animated:yes]; [updatecontroller release]; // pop view code [self.navigationcontroller popviewcontrolleranimated:yes]; wasn't pushing content twice -

C# Project has auto generated classes, but what auto generated them? -

i working on project original developer on, on last couple of years 2 other developers have maintained , upgraded project. there class files inside following @ top: //------------------------------------------------------------------------------ // <auto-generated> // code generated tool. // runtime version:2.0.50727.1433 // // changes file may cause incorrect behavior , lost if // code regenerated. // </auto-generated> //------------------------------------------------------------------------------ using system.xml.serialization; // // source code auto-generated xsd, version=2.0.50727.1432. // any idea have generated these files? there issues inside 1 of them want clean up, says changes might overwritten. it's xml schema definition tool . want clean up? note 1 of operations performed xsd.exe "xsd classes", generated class files in question: xsd classes generates runtime classes xsd schema file. generated classe

gis - What is relationship between GDAL, FDO and OGR? -

their documentations simple , professional. don't mention relationship between these open source projects. when should use one? , 1 suitable scenario? if gis developer familiar these projects, can explain? in basic terms, gdal used reading, writing , transforming raster data, while ogr can same vector data. not familiar fdo, appears api used access (from database sources), manipulate , analyze kinds of geospatial data, , relies on gdal , ogr purposes.

How to resize and display images from another domain using php? -

i want resize images using php. out losing quality. have 2 domains. have display images portfolio section of old site new website. how resize images , display in new portfolio section. how can that? there many functions creating images, of not have problem external domains. instance, imagecreatefromjpeg() . http://php.net/manual/en/function.imagecreatefromjpeg.php if go link, , check out functions on left, find ones crop, resize, etc., , of them have examples. for question, believe best way go create 1 image existing image, , create blank new image, use imagecopyresized() function copy portfolio image blank one.

facebook - What's a good way to integrate FB and Twitter into my commenting system (PHP) -

there many options out there integration. at moment have comments posted on articles, user types in name , comment. sent moderation queue , displayed when approved. i want acheive this: comment facebook login (ie facebook account listed name w/ avatar) comment twitter login (ie twitter account name listed name w/ avatar) push comment website twitter , facebook i go down few paths far know: integrate xfbml, don't because find annoying setup , messy. integrate facebook comments system, although can't push twitter, or allow me moderate comments backend (as far can tell i'd have login under facebook login dev account moderate comment) find php class open auth , integrate both face book , twitter @ once find pre-created php class anyone have solution bias: a. easy integrate b. lightweight c. free thanks suggestions in advance. okay guys, caved in , began writing own simple class. i'm using xfbml i'm not using name spaced tag in doct

javascript - jQuery Value Help -

i'm having problems getting value of input field. function send(id){ var send_to=$("#id").val(); $.post("send.php", { id:id }, function(data) { if(data==="ok"){ } else { } }); } below example of page. <input type=text id=4543><button onclick=send(4543);>send</button> <input type=text id=8643><button onclick=send(8643);>send</button> <input type=text id=8645><button onclick=send(8645);>send</button> <input type=text id=2421><button onclick=send(2421);>send</button> i need value of input control id passed send method. thank you! :) if understood correctly, then: var send_to=$("#id").val(); should var send_to=$("#" + id).val();

kettle - swapping selected values from one column to other using any transformation -

i have 2 columns named amount , work data in format of given below: amount 58220 84151 65999 23 78544 52656 work 15 14 20 85597 22 19 and want swap values of 23 , 85597 in same row. can suggest me suitable solution? create transformation following steps: build file inputdata.txt (or other source of data flow) value1, value2 58220, 15 84151, 14 65999, 20 23, 85597 78544, 22 52656, 19 add code in javascript step var t1 = value1; var t2 = value2; in menu "fields" choose rename t1 value2 , t2 value1 , check option replace values??. the results are: value1, value2 15, 58220 14, 84151 20, 65999 85597, 23 22, 78544 19, 52656 if need source code send email.

c++ - memory alignment issues with union -

is there guarantee, memory object aligned if create object of type in stack? union my_union { int value; char bytes[4]; }; if create char bytes[4] in stack , try cast integer there might alignment problem. can avoid problem creating in heap, however, there such guarantee union objects? logically there should be, confirm. thanks. well, depends on mean. if mean: will both int , char[4] members of union aligned may use them independently of each other? then yes. if mean: will int , char[4] members guaranteed aligned take same amount of space, may access individual bytes of int through char[4] ? then no. because sizeof(int) not guaranteed 4. if int s 2 bytes, knows 2 char elements correspond int in union (the standard doesn't specify)? if want use union access individual bytes of int , use this: union { int i; char c[sizeof(int)]; }; since each member same size, they're guaranteed occupy same space. believe want know about

parsing - Alternative for XPath for Android 2.1 -

i have port application working in android 2.1 made android2.2 now have problem in xml parsing xpath not supported in android 2.1 using sax parser. in xmlparsing method in older code use xpath complile key \employee\designation\value\" eg: key = \employee\designation\value\" xml file personnel> address> /address> employee type="permanent"> name> seagull /name> id> 3674 /id> age> 34 /age> designation> value>34 /value> /designation> /employee> - employee type="contract"> name>robin /name id>3675 /id> age>25 /age> designation> value>34 /value> /designation> /employee> employee type="permanent"> name>crow /name> id>3676 /id> age>28 /age> designation> value>38 /value> /designation> /employee> /personnel>` o/p comes 34 , 38`enter code here , returns mw corresponding values many in xml fil

regex - PHP regular expression -

i know little regular expression. question is: have string can 1 of followings- $code = "123456 - us"; $code = "12-3456 - us"; $code = "wd123 - us"; $code = "a0-12 - us"; $code = "123456 - poland"; how can find out first part(like-123456 or a0-12) , last part(like-us or poland)? in php using preg_match function. thanks. you use explode split 2 parts. $split = explode(" - ",$code); that give array 2 elements: "123456" , "us"

windows - No matter what, I can't get this progress bar to update from a thread -

i have windows app written in c (using gcc/mingw) works pretty except few ui problems. one, cannot progress bar update thread. in fact, can't ui stuff update. basically, have spawned thread processing, , thread attempt update progress bar in main thread. tried using postmessage() main hwnd, no luck though can other things open message boxes. however, it's unclear whether message box getting called within thread or on main thread. here's code: // in header/globally accessible hwnd wnd; // main application window hwnd progress_bar; //progress bar typedef struct { //to pass thread dword mainthreadid; hwnd mainhwnd; char *filename; } threadstuff; //callback function lresult callback wndproc(hwnd hwnd, uint msg, wparam wparam, lparam lparam){ switch (msg){ case wm_create:{ // create progress bar progress_bar = createwindowex( 0, progress_class, (lpctstr) null,

c++ - Storing passwords while keeping the integrity of getch() -

whats easy way can store password user inputs while still keeping password hidden? char password[9]; int i; printf("enter password: "); (i=0;i<9;i++) { password[i] = getch(); printf("*"); } (i=0;i<9;i++) printf("%c",password[i]); getch(); } i wanna store password can simple if (password[i] == root_password) proper password continues on. your problem appears you're not checking newline '\n' nor end-of-file. printf("enter password: "); char password[9]; int i; (i = 0; < sizeof password - 1; i++) { int c = getch(); if (c == '\n' || c == eof) break; } password[i] = c; printf("*"); } password[i] = '\0'; this way, password end being asciiz string, suitable printing puts , printf("%s", password) , or - crucially... if (strcmp(password, root_password)) == 0) your_wish_is_my_command(); note read @ 8 characte

Percentage loading bar for a SWF file through Javascript -

i have jsp suppose load .swf file large in size takes of 7 sec load completely, hide loading , put javascript percentage loading bar swf file. as far know, can't build proper progress bar single file in javascript. progress bars web sites monitor load completion multiple images fake having access actual percentage of page being loaded (if 1 out of 10 images loaded, that's 10 percent, right?). alternatively, show animated gif, spinning wheel or else moves , not directly related size of file being loaded. add listener page's onload event, , hide gif when it's fired. ...or can still have nice progress bar, if don't in javascript: try reorganizing flash file instead! here tutorial on preloading single swf file .

what will be the simple mysql query for this -

i want customer info customer id should 2 , log_id should maximum value tried below query fetching first record found. what simple query mysql> select * log_customer customer_id =2 group customer_id having max(log_id); +--------+------------+-------------+---------------------+-----------+----------+ | log_id | visitor_id | customer_id | login_at | logout_at | store_id | +--------+------------+-------------+---------------------+-----------+----------+ | 2 | 56 | 2 | 2010-02-19 19:34:45 | null | 1 | +--------+------------+-------------+---------------------+-----------+----------+ 1 row in set (0.00 sec) mysql> select * log_customer customer_id =2 limit 5; +--------+------------+-------------+---------------------+---------------------+----------+ | log_id | visitor_id | customer_id | login_at | logout_at | store_id | +--------+------------+-------------+---------------------+---------------------+------

java me - j2me zoom in zoom out in E-72 -

i want zoom in , zoom out in j2me application. using nokia e-72. how can this? jsr 234 required purpose. see link... didnt use before , may helps you.. :)

php - Form validation losing variables -

let's enter registration form ending url: registration.php?accounttype=a form parsed on same page (registration.php). if user doesn't pass form validation taken registration.php error messages. see lost variable accounttype=a. question: can submit form validation , retain accounttype variable? i'm aware done using cookie. want further understanding. solution: although of answers below valid, went session variable , <form action="registration.php?<?php print 'accounttype=' . $_session['accounttype']; ?>" etc. help. you should use in form: <form action="registration.php?accounttype=a"> you should use in php: if ($validation_success) { header('sucess.php') } else { // don't anything. page(registration.php?accounttype=a) loads } i'm giving idea.

Unable to connect to ftp server java -

i should able send , receive file to/from ftp server. but then, no changes occurred in code , started getting : error: java.net.connectexception: connection timed out: connect what doing is: ftpclient ftp = new ftpclient(); ftp.connect( ipaddress of ftp server); connect() giving execption. not understanding cause it. the error message telling os's attempt connect server timed out. typically means that: the remote server has dropped off network, or something (e.g. firewall) "black holing" packets sent server on ftp port.

python - import webkit fails with an ImportError -

when import webkit on ubuntu 10.04 following error: traceback (most recent call last): file "test.py", line 1, in <module> import webkit file "/usr/lib/pymodules/python2.6/webkit/__init__.py", line 19, in <module> import webkit importerror: /usr/lib/pymodules/python2.6/webkit/webkit.so: undefined symbol: webkit_web_frame_get_global_context i think packages need installed. have idea of why failing? your /usr/lib/pymodules/python2.6/webkit/webkit.so linked against older version of libwebkit. in case you'll need install correct versions of both software packages.

How to communicate two android applications? -

i want sent data 1 applications android application, new android please me... look intents. that's preferred way it. apps can support number of intents, , can pass data along intent.

algorithm - bubble sort for linked list in c++ -

i tried implement buble sort university project , have problems. happy if can me it. void trainmanagerlinkedlist:: swap(trainmanager & x,trainmanager & y) { trainmanager temp; temp =x; x = y; y = temp; } void trainmanagerlinkedlist::bubblesort() { trainmanagerlink* outercurr = this->m_head; trainmanagerlink* curr = null; while(outercurr != null) { curr = this->m_head; while(curr != null && curr->m_next != null) { /*if current link greater next swap between them*/ if (curr->m_data->getdate() > curr->m_next->m_data->getdate()) { swap(&(curr->m_data),&(curr->m_next->m_data)); } else if((curr->m_data->getdate() == curr->m_next->m_data->getdate())&(curr->m_data->gettime() > curr->m_next->m_data->gettime())) { swap(&(curr->m_data),&(curr->m_next->m_data)); } curr = curr->m_next; } outercurr =

java - AffineTransform and flipping the y-axis -

i ran strange problem when trying flip y-axis of coordinate system im creating: private affinetransform gettransform() { if (transform == null) { transform = new affinetransform(); double scalex = (double) this.getwidth() / (coordinatesystem.getmaxx() - coordinatesystem.getminy()); double scaley = (double) this.getheight() / (coordinatesystem.getmaxy() - coordinatesystem.getminy()); transform.settoscale(scalex, scaley); double deltax = (coordinatesystem.getmaxx() - coordinatesystem.getminx()) / 2; double deltay = (coordinatesystem.getmaxy() - coordinatesystem.getminy()) / 2; transform.translate(deltax, deltay); } return transform; } the affinetransform set scaling , translation. , works fine except y-values inverted (max value bottom of coordinate system, min value @ top). tried switching inverting scale factor y axis. not working. do have let transform rotate p

How to download youtube videos for iphone - using objective-c programmatically -

possible duplicate: save youtube video iphone in app i want download , save youtube video given youtube video link, programmatically. can point sample app. appreciated. does avassetwriter class @ all? http://developer.apple.com/library/ios/#documentation/avfoundation/reference/avassetwriter_class/reference/reference.html

html - AddressBook like Outlook -

Image
i implement sort of addressbook 1 in outlook in following picture can markup , style address card? i made quick example you: can see live here on jsfiddle.net . html: <div class="outl-add"> <div class="outl-add-top"> duck, daffy </div> <div class="outl-add-left-vert"> &nbsp; </div> <div class="outl-add-right-info"> <p class="info-top"> <span class="user-name">daffy duck</span> <span>acme international</span> <span>manager</span> </p> <p class="address-info"></p> <span> +122323i9092<span class="grey-text">uiofcio</span> <p>daffy@acme.org</p> <p>666, 5th avenue</p> <p>new york</p> <p>www.daffysite.com</p>

osx - I'm confused, what's the easiest way to install Ruby 1.9.2 on OS X? -

my current version ruby 1.8.7 (2010-08-16 patchlevel 302) [i686-darwin10] step 1. install homebrew: https://github.com/mxcl/homebrew this enables install various *ix projects on mac. may need install xcode part of this, may need os x disc hand. homebrew useful many other things - thing have installed anyway. step 2. install ruby version manager: brew install rvm step 3. install whichever ruby version want. means can have multiple ruby installations (with own sets of rubygems) running independently of 1 another. 1.9.2 try this: rvm install 1.9.2 if 'readline' error, try this: rvm package install readline rvm remove 1.9.2 rvm install 1.9.2 --with-readline-dir=$rvm_path/usr you should able test ruby version: ruby --version to switch version of ruby, use rvm command.

xul - Calling a method from XBL -

from xbl method, when need call method, like: <method name="mymethod_1"> <body> <![cdata[ // staff ]]> </body> </method> <method name="mymethod_2"> <body> <![cdata[ document.getelementbyid("thiselementid").mymethod_1(); ]]> </body> </method> i know if there way call local method without need element id? i've tried this.mymethod_1() says method don't exist. can show code calling mymethod_2? if call like: document.getelement(...).mymethod_2() that's fine, if have someelement.addeventhandler("click", myxbl.mymethod_2,...); won't work since event target this . this important determining this in context edit: (tom's reply) ow, think got it.. it's problem.. i

sql - PHP is truncating MSSQL Blob data (4096b), even after setting INI values. Am I missing one? -

i writing php script goes through table , extracts varbinary(max) blob data each record external file. code working (i used virtually same code go through images) except when file on 4096b - data truncated @ 4096. i've modified values mssql.textlimit , mssql.textsize , , odbc.defaultlrl without success. am missing here? <?php ini_set("mssql.textlimit" , "2147483647"); ini_set("mssql.textsize" , "2147483647"); ini_set("odbc.defaultlrl", "0"); include_once('common.php'); //connection db takes place here. $id=$_request['i']; $q = odbc_exec($connect, "select id,filename,documentbin projectdocuments id = $id"); if (odbc_fetch_row($q)){ echo "trying $filename ... "; $filename="projectphotos/docs/".odbc_result($q,"filename"); if (file_exists($filename)){ unlink($filename); } if($fh = fopen($filename, "wb")) { $bind

asp.net - How to create a non-persistent (in memory) http cookie in C#? -

i want cookie disappear when user closes brower-- i've set promising looking properties, cookies pop live after closing entire browser. httpcookie cookie = new httpcookie("mycookie", "abc"); cookie.httponly = true; //seems affect script access cookie.secure = true; //seems affect https transport what property or method call missing achieve in memory cookie? this question has been posted online 1000+ times. best way handle non-persistent cookies timeout browser open add key value timeout. code below used log in user id key value , encryption(not included) security browser compatibility. not use forms authentication. httpcookie cookie = new httpcookie(name); cookie.values["key1"] = value; cookie.values["key2"] = datetime.now.addminutes(70).tostring(); //timeout 70 minutes browser open cookie.expires = datetime.minvalue; cookie.domain = configurationmanager.appsettings["website_domain"];

C# Multithreading -

lets have event gets fired 10 times per secod void session_onevent(object sender, customeventargs e) { //dostuff dolongoperation(e); } i want method dolongoperation(e); processed on seperated thread everytime event gets fired, i : new thread(dolongoperation).start(e); but have feeling not performance, wanna achieve best performance, the best thing can ? thanks idvance.. edit:when said long didnt mean opration take more 1 sec maximum dont want event wait time wanna make in seperated thread... use 1 thread process request, , enqueue work items thread event. concretely: copy e create list< customeventargs > , insert copy end synchronize access list thread , event as member objects of class, this: list< customeventargs > _argsqueue; thread _processor; in constructor of class, do: _argsqueue=new list< customeventargs >(); _processor=new thread(processormethod); define processormethod: void processormethod() { while