Posts

Showing posts from September, 2015

php - Remove before echoing -

say have list this hello1 hello2 hello3 hello4 goodbye hello6 hello7 hello8 how can remove goodbye , print everything else besides goodbye? use unset , array_search this: $array = array('hello1','hello2','hello3','hello4','goodbye','hello6','hello7','hello8'); if(($key = array_search('goodbye', $array)) !== false) unset($array[$key]); this 2 things in 1 if statement: if assigned value of $key (the return value of array_search ) truthy, proceed , use index, otherwise, don't anything. necessary because if return value of array_search false , resulting $array[false] not intended behavior @ all.

sql server - python to mssql encoding problem -

Image
greetings by using pymssql library, want write data mssql database encounter encoding issues. here sample code write db: # -*- coding: utf-8 -*- import _mssql .... connection info data here .... def mssql_connect(): return _mssql.connect(server=host, user=username, password=pass, database=db, charset="utf-8") con = mssql_connect() insert_ex_sql = "insert mydatabsae (id, programname, programdetail) values (1, 'test characters ÜŞiçÇÖö', 'löşüiiğĞü');" con.execute_non_query(insert_ex_sql) con.close() sadly data written db corrupted: the collacation of mssql db is: turkish_ci_as how can solved? here possible solution : the key insert_ex_sq.encode('your language encoder') . try instead: con.execute_non_query(insert_ex_sq.encode('your language encoder'))

compression - File formats with included versioning -

i idea of using compressed folders containers file formats. used libreoffice or dia. if want define special purpose file format, can define folder , file structure , zip root folder , have single file data in single file. imported files live originals inside compressed file. defining binary file format 0 features lot of work. now question: there applications using compressed folders file formats , versioning inside folder? benefits great. commit state in project file , versioning decorated functions own application. diffs presented own way. libraries working compressed files , versioning available. used versioning system should distributed system, repository lives inside working folder , not seperate example subversion client-server model. what think? i'm sure there applications out there using approach, couldn't find one. or there major drawback in approach? sounds interesting idea. know many applications claim have "unlimited" undo , redo, that...

command line - HELP: UDP broadcast vlc stream weirdness! -

hi i'm trying using vlc broadcast udp stream within lan, making tv channel. i used command line launch vlc vlc ok run = cvlc --repeat filename.avi --sout '#standard{access=udp,mux=ts,dst=239.255.12.42:8001} problem works on network, , have problem receiving on network without router! question: magical address "239.255.x.x" ? network hardware require udp broadcast besides switches , cables? wireless can accept udp broadcast? thanks answers! the 239.255.x.x addresses part of multicast address space, ranging 224.0.0.0 239.255.255.255 (and there specific-use areas in there). you've correctly noted doesn't work without router. because basic ip stack still wants know how route addresses determine interface send them on. can either add static route multicast (that address or multicast addresses), or put in default gateway.

.net - Probably simple regex search -

what regex find text#2? pattern it's first occurance of "z=" after c. text want rest of line after z=. i'm using regex in .net a x b x z=text#1 x c x z=text#2 .*c.*z=([^\n]*).* you'll need turn on . matching newlines ( regexoptions.singleline below). here's c# code generated my regex tester : using system; using system.text.regularexpressions; namespace myapp { class class1 { static void main(string[] args) { string sourcestring = "source string match pattern"; regex re = new regex(@".*c.*z=([^\n]*).*",regexoptions.singleline); matchcollection mc = re.matches(sourcestring); int midx=0; foreach (match m in mc) { (int gidx = 0; gidx < m.groups.count; gidx++) { console.writeline("[{0}][{1}] = {2}", midx, re.getgroupnames()[gidx], m.groups[gidx].value); } ...

opengl - Given a 4x4 homogeneous matrix, how can i get 3D world coords? -

so have object getting rotated translated , rotated again. storing matrix of these translations object member. when come object picking need know 3d world coords of object. currently have been able position of object so coords[0] = finalmatrix[12]; coords[1] = finalmatrix[13]; coords[2] = finalmatrix[14]; this giving me correct positions of objects want take rotations account well. any great... the matrix 4x4 matrix, you've got single dimensional matrix appears elements arranged follows: [0] [4] [8] [12] [1] [5] [9] [13] [2] [6] [10] [14] [3] [7] [11] [15] the rotation part top left 3x3 matrix see here , in case elements [0]-[2] , [4]-[6] , [8]-[10]

cmd - Consoles and Tabs -

when start tomcat server console using startup.bat script, new command window opens filled java logging statements. i use console2 leverages tabs each open console window. possible let java system create new tab within console2 instead of opening new command window? this has nothing java, merely down way catalina.bat called startup.bat catalina.bat can called either "start" argument or "run" argument. run start catalina in current window start start catalina in separate window so open startup.bat, scroll bottom should see "%executable%" start %cmd_line_args% change "%executable%" run %cmd_line_args% exit i add exit after close calling window.

build - Building and installing Perl subsystem in a project that uses make (Makefile) -

what build system (make, extutils::makemaker , module::build , ...) use in perl subsystem (e.g. perl bindings, or auxillary command implemented in perl), , how connect build system of main project. project uses make build system. perl subsystem in separate subdirectory. we can assume if there perl installed, @ least version 5.8.3. for 5.8 eumm okay. connect main makefile straight-forward way, write perl-binding target contains usual incantation .

php mysql combine queries -

if have 2 mysql_query commands in single php file, way combine them? for example, have: $a=mysql_query(select * table1); $b=mysql_query(select id table3); but want combine them single mysql_query, more efficient? faster? multiple queries not supported in mysql_query descripted on php manual , can't combine both query in php mysql_query way here reference php manual notes : executed multiple queries @ once, mysql_query function return result first query. other queries executed well, won't have result them.

user interface - form close event in c# -

i trying cleaning when form closes. using following signature private void batchgui_closing(object sender, formclosingeventargs e) the issue is, if put breakpoint in there code never executes, how write method form close event? thanks in winforms event called formclosing: private void form1_formclosing(object sender, formclosingeventargs e) { } make sure attached event in designer. adding method not enough!

php - Why does everyone use latin1? -

someone said utf8 has variable length encoding 1 3 bytes. so why still use latin1? if same thing stored in utf8 1 byte, utf8 has advantage can adapt larger character set. is hidden reason uses latin1? what disadvantages of using utf8 vs. latin1? iso 8859-1 (at least de facto) default character encoding of multiple standards http (at least textual contents): when no explicit charset parameter provided sender, media subtypes of "text" type defined have default charset value of "iso-8859-1" when received via http. data in character sets other "iso-8859-1" or subsets must labeled appropriate charset value. the reason iso 8859-1 chosen it’s superset of us-ascii fundamental character set internet based technologies. , world wide web invented , developed @ cern in geneva, switzerland, might reason choose characters of western european languages 128 remaining characters. when unicode standard developed, character set of iso 8859-1 ...

objective c - How to increment a NSNumber -

how increment nsnumber? i.e. mynsnumber++ update: fyi, boltclock's , darkdusts's one-line answers better. they're more concise, , don't require additional variables. in order increment nsnumber , you're going have value, increment that, , store in new nsnumber . for instance, nsnumber holding integer: nsnumber *number = [nsnumber numberwithint:...]; int value = [number intvalue]; number = [nsnumber numberwithint:value + 1]; or nsnumber holding floating-point number: nsnumber *number = [nsnumber numberwithdouble:...]; double value = [number doublevalue]; number = [nsnumber numberwithdouble:value + 1.0];

linker - Problem in creating a shared library for Android platform -

i using android toolchain. i have make changes stack has lot of static libraries , make shared library. able compile changes .o file (using gcc). when trying create shared library linking existing static libraries, getting error saying 'linker input file unused because linking not done'. i compiling files using -fpic , , using -shared linking still getting error. let me know if there has faced similar problem or if can suggest solution. see if this link helps you. there's similar question on stackoverflow

ajax - xmlhttp not supporting in IE -

xmlhttp not supporting in ie ,actually had created 1 facebook app users can play game each other randomly,problem when want test it, login in facebook userid in firefox,and login brother facebook id in chrome connecting each other,do think beacuse of same ip address not connecting or not creating xmlhttprequest object ie , chrome.... function getxmlhttpobject() { var xmlhttp = null; try { // firefox, opera 8.0+, safari xmlhttp = new xmlhttprequest(); } catch (e) { //internet explorer try { xmlhttp = new activexobject("msxml2.xmlhttp"); } catch (e) { xmlhttp = new activexobject("microsoft.xmlhttp"); } } return xmlhttp; ...

vb.net - assign value without open excel file -

imports microsoft.office.core imports microsoft.office.interop imports microsoft.office.interop.excel i have code: dim oapp new excel.application() dim wb excel.workbook wb = oapp.workbooks.open("d:\noriamail\23120011\lpo summary per month_view 3 - allmonths.xlsx") can tell me how can assign value wb witout open file (i want function give wb value without open file) thank's help what type of value want "assign"? sort of metadata? in experience, code above correct way open file; there, can begin manipulating file.

observer pattern - Clone all 'observe' of a cloned element using Prototype -

i have sortable list (done using prototype , scriptaculous): can sort elements or drag them list. when drop element (let's call element_1) of list 1 'clone' of dropped element , insert (appendchild) new list. element1 had 'observe' (clicking on something, double-clicking on else) of course lost when cloning.. want cloned element have same 'observe' of element1. how can that? thanks in advance observe lists instead of items , allow event bubbling work you. $('list1','list2').invoke('on', 'click', 'li', function(event, element){ // "this" either list1 or list2 // "element" list item }

profiling - gprof messing up -

i trying 2 profile cpp code. compiled -pg flags , after profiled output got weird function names. make file using: # makefile parallel simulated annealer prefix=${parsecdir}/pkgs/kernels/canneal/inst/${parsecplat} target=canneal libs:=$(libs) -lm cxxflags+=-pg ifdef version ifeq "$(version)" "pthreads" cxxflags+=-denable_threads -pthread endif endif all: $(cxx) $(cxxflags) annealer_thread.cpp -c -o annealer_thread.o $(cxx) $(cxxflags) rng.cpp -c -o rng.o $(cxx) $(cxxflags) netlist.cpp -c -o netlist.o $(cxx) $(cxxflags) main.cpp -c -o main.o $(cxx) $(cxxflags) netlist_elem.cpp -c -o netlist_elem.o $(cxx) $(cxxflags) $(ldflags) *.o $(libs) -o $(target) clean: rm -f *.o $(target) install: mkdir -p $(prefix)/bin cp -f $(target) $(prefix)/bin/$(target) this sample of gprof output: flat profile: each sample counts 0.01 seconds. % cumulative self self total time seconds sec...

javascript - fitBounds and getZoom not playing nice -

i have following code running after map initialised function showaddress(address) { geocoder.geocode( { 'address': address}, function(results, status) { if (status == google.maps.geocoderstatus.ok) { map.fitbounds(results[0].geometry.bounds); if (map.getzoom() < 12) { map.setzoom(12); } } else { alert("geocode not successful following reason: " + status); } }); } the problem tha zoom check , set doesn't work. have checked , map initiated map.getzoom() function returns undefinted @ time. is there can force wait until fitbounds have been set , zoom level known can control zoom appropriately? // define bounds changed event handler "once-only" zoom level check google.maps.event.addlistener(map, 'bounds_changed', function() { initialzoomcheck() }); geocoder.geocode( { 'address': address}, function(results, status) { if (status == google....

asp.net - mvc with ajax post -

i have form includes list of records. when user clicks edit image on table modal div show him. modal div ajax. after changing fields posting via ajax. watched firebug. sends parameter. when debug code in vs method calls no parameter has been send. have done before in other pages. can not. problem can here in code? c# code here [httppost] //[authorize(roles = "operator")] public actionresult editrow(string name, string secondname) { //code goes here return content("saved"); } jquery ajax code here $.ajax({ type: 'post', contenttype: 'application/json; charset=utf-8', url: 'editrow', data: { name: "php", secondname: "mvc" }, datatype: 'html', success: function (response) { //some code goes here } }); have tried simplify ajax call to: $.ajax({ type: 'post', url: 'editrow', data: { ...

Maven release setup with svn tags per module -

goal multimodule maven release tags per module situation assume following project structure maven-based java project: xx-parent xx-modulea xx-moduleb xx-modulec/submodule1 xx-modulec/submodule2 xx-modulec/submodule3 the project structure in subversion follows: xx-parent/trunk xx-modulea/trunk xx-moduleb/trunk xx-modulec/trunk/submodule1 xx-modulec/trunk/submodule2 xx-modulec/trunk/submodule3 my goal create tags per module when performing release: xx-parent/tags/xx-parent-1.0 xx-modulea/tags/xx-modulea-1.0 xx-moduleb/tags/xx-moduleb-1.0 xx-modulec/tags/xx-modulec-1.0 in past, each module built , released separately. project grew larger (30 modules), time build release increased. change project multi-module set perform reactor build , release. building doesn't seem problem, creating tags per module is. the maven-release-plugin seems insist on making single tag whole project/release. i'm looking way create multiple tags, e.g. tag per module. what have tri...

osx - Are there promo codes for Mac App Store applications? -

does apple provide developers promo codes mac app store applications? can't find options on itunes connect (it's there our ios apps, though), guess answer "not @ moment"? good news: it possible now .

html - jwPlayer in IE does not auto start video on display of rolling banner -

i got probleme famous jwplayer. in fact probleme way ie (8 or 7) handle flash player. their's probleme: got rolling banner (using jquery cycle), in banner got 2 images video. video drive using jwplayer. way expect banner work this: roll on each banner if banner video start it. this javascript: $('#slideshow') .before('<div id="nav">') .cycle({ fx: 'fade', timeoutfn: calculatetimeout, timeout: 20000, pause: 1, pager: '#nav' }); function calculatetimeout(currelement, nextelement, opts, isforward) { if ($(nextelement).attr("class") == "video-banner") { return 20000; } else { return 8000; } i have set loop variable @ true , autostart @ true either can see: <div runat="server" id="video" class="video-banner"> <!-- start o...

php - Pagination not working properly on author and category archives -

i've made category page has pagination on bottom of it. everytime try go page 2, url structure changes posts loop not. pagination working fine blog page exact same loop. hints doing wrong? using wp-paginate plug in. <ul class="blogpostings"> <?php if (have_posts()) : ?> <?php while (have_posts()) : the_post();?> <li> <?php if ( has_post_thumbnail() ):?> <?php $image_id = get_post_thumbnail_id(); $image_url = wp_get_attachment_image_src($image_id, 'thumbnail', true); echo '<a href="' . get_permalink($post->id) . '" title="' . get_the_title($post->id) . '"><img src="' . $image_url[0] . '" title="' . get_the_title($post->id) . '" alt="' . get_the_title($post->id) . '" /></a>'; ?> ...

Sql CASE statement with SUBSTRING? -

hi have small query below : select subscriberdataid, substring(facetsdata, 5, 9) subscribercode, substring(facetsdata, 14, 35) subscriberlastname, substring(facetsdata, 50, 15) subscriberfirstname facets.facetsimport dataindicator = 'dem1' i trying use case statement in query dont know how. have have find invalid records 3 fields above. gonna use len(subscribercode) > 9 (9 lenght of data type) , when greater 9 insert error table. same way other 2 columns having lenght 35 , 15. thanks the strings have correct lengths if , if input string 64 characters or longer: insert main_table select subscriberdataid, substring(facetsdata, 5, 9) subscribercode, substring(facetsdata, 14, 35) subscriberlastname, substring(facetsdata, 50, 15) subscriberfirstname facets.facetsimport dataindicator = 'dem1' , len(facetsdata) >= 64 insert error_table select subscriberdataid, ...

web applications - Help emulating Heroku, GAE, etc : Building a web service privately (PaaS) -

i'm not 1 question, haven't found lot of information in research far, me out. we small crowd in organization. we're looking build small, private service emulate heroku/gae workflow. basics of this: deploy app git repository, , have scale in 'cloud' environment. basically, platform service (paas). pretend amateur pm's, programmers, , sysadmins tasked this. recommend? know needed: sort of routing, database, caching, authentication, etc. other tools need? we prefer tools along ruby/python/haskell/erlang dimension, on linux/bsd stack, postgres databases(couchdb or cassandra in future). not touching in ms/.net area, nothing on jvm (we've looked @ steamcannon, no; scala , clojure tools not entirely out of question). have basic grasp of bootstrapping cloud (e.g. eucalyptus) build on. have understanding of basics in server admin, , physical infrastructure limitations aren't factor right now. we're not looking why gaerokuyardspace best choice, lis...

Is it possible to apply Gradient to a Background Image in Silverlight? -

i want apply gradient image how can achieve that? thanx you host image within border, applying gradient border background: <border> <border.background> <lineargradientbrush endpoint="0,1" startpoint="0,0"> <gradientstop color="red" offset="0" /> <gradientstop color="blue" offset="1" /> </lineargradientbrush> </stackpanel.background> <image source=..your image source .." /> </border> this assumes image has opaque regions show gradient beneath it.

blackberry - Do screen transitions when the user clicks on a bitmap -

i working on ebook app need transition screens left right , right left. tried many samples i've found, not successful. how change screen when user clicks on screen left right , right left. basic idea transition of pages. went through developer support forum thread "page-flip effect" looking solution, can't see it. the following code not logical. in position have implement flip effect flipping pages in screen , how implement it? public class transitionscreen extends fullscreen implements runnable{ private int angle = 0; bitmap frombmp,tobmp; public transitionscreen(){ } public transitionscreen(animatablescreen from,animatablescreen to) { frombmp = new bitmap(display.getwidth(), display.getheight()); tobmp = new bitmap(display.getwidth(), display.getheight()); graphics fromgraphics = graphics.create(frombmp); graphics tographics = graphics.create(tobmp); object eventlock = getapplicat...

php - Substring with dots -

i using substring function retreive "excerpt" of message body: select m.id, m.thread_id, m.user_id, substring(m.body, 1, 100) body, m.sent_at message m; what add 3 dots end of substring, if source string more upper limit (100 characters), i.e. if substring had cut off string. if source string less 100 characters no need add dots end. i using php scripting language. that can done in query, rather php, using: select m.id, m.thread_id, m.user_id, case when char_length(m.body) > 100 concat(substring(m.body, 1, 100), '...') else m.body end body, m.sent_at message m the term 3 trailing dots "ellipsis".

objective c - Is it possible to manually traverse nested if statements? -

binary trees confusing me inactivity, thought i'd try simpler (if messier) approach. example... if (a) { // wait button press before checking next 'if' if (aa) { } else if (ab) { } } else if (b) { else } et cetera. how force app wait button press before asking if 'aa' returns true? (and on , forth.) switches seem cleaner alternative, if has answer method instead, i'd happy give go. it's same problem, though. can't figure out how progress step step rather @ once. here's different approach, using state or control variable view, determine should next given button presses. // pseudo-code based on example -(ibaction) buttonpress1 if (a) { self.setstate = statea; } else if (b) { else self.setstate = stateb; } -(ibaction) buttonpress2 if (self.state == statea) { if (a) { } else if (b) { } } hope helps, if not, ask away in comments. [edit] ok...

java - Determine Which JTable Cell is Clicked -

when user clicks cell on jtable , how figure out row , column of clicked cell? how show information in jlabel ? the existing answer works, there alternate method may work better if you're not enabling cell selection. inside mouselistener , this: public void mouseclicked(java.awt.event.mouseevent event) { int row = thetable.rowatpoint(event.getpoint()); int col = thetable.columnatpoint(event.getpoint()); // ...

UITableView how to make clickable links -

could point me in direction on how please? have made twiter app open links users timeline. have sourced code on how open link in webvie not know hot make links clickable. any appreciated. thanks in advance mike i believe need: http://furbo.org/2008/10/07/fancy-uilabels/ more infos discussion: create tap-able "links" in nsattributedstring of uilabel?

mysql - SQL Checking if a user relationship exist -

i have user relationship table set looks this. user_relationship relationship_id requesting_user_id requested_user_id relationship_type relationship_status now want check relationship see if exist between 2 users lets example ids 1 & 2. a: select * user_relationship (requesting_user_id='1' , requested_user_id='2') || (requesting_user_id='2' , requested_user_id='1') but wondering if better faster way this? ors notoriously bad performers. try union instead: select a.* user_relationship a.requesting_user_id = '1' , a.requested_user_id = '2' union select b.* user_relationship b b.requesting_user_id = '2' , b.requested_user_id = '1' union remove duplicates; union all not (and faster it). if there columns coming don't use -- shouldn't in query. indexing should on: requesting_user_id requested_user_id ...either separately or single composite ind...

c# - Creating an image button in .NET Winforms application -

i'm trying create button in .net 4.0 winforms app in visual studio 2010 image. have window borderless , has background image makes custom skin application. close/minimize buttons in top right of window, wanted create 2 simple buttons images typical windows close/minimize buttons. i may going design wrong, if please let me know. far i've determined need create subclass button renders image. final implementation needs render different images each button state (normal, hover, clicked, etc). here have far: public class imagebutton : button { pen pen = new pen( color.red, 1.0f ); public imagebutton() { setclientsizecore( backgroundimage.width, backgroundimage.height ); } protected override void onpaint( painteventargs e ) { e.graphics.drawimage( backgroundimage, 0, 0 ); //e.graphics.drawrectangle( pen, clientrectangle ); //rectangle bounds = new rectangle( 0, 0, width, height ); //buttonrenderer.drawbutton( e....

lock file between C and php -

although title mentions file, doesn't have file. locking mechanism do. here situation: have daemon process written in c, , web page in php. i'd have way of mutual locking under situation, c daemon lock file , php detects situation , tells client side system busy. is there easy way of doing this? thanks, flock properly. in php script, use non-blocking lock : $fd = fopen('/var/run/lock.file', 'r+'); if (!flock($fd, lock_sh | lock_nb, $wouldblock) && $wouldblock) { // buzy } the lock_nb flag make call non blocking. if file locked exclusively, return immediately. multiple pages allowed lock file @ same time. you can release lock with flock($fd, lock_un); in c daemon, use blocking , exclusive lock: flock(fd, lock_ex); // wait until no page has locked file see php's flock() documentation , c's one

c++ - Sequence points, conditionals and optimizations -

i had argument today 1 of collegues regarding fact compiler change semantics of program when agressive optimizations enabled. my collegue states when optimizations enabled, compiler might change order of instructions. that: function foo(int a, int b) { if (a > 5) { if (b < 6) { // } } } might changed to: function foo(int a, int b) { if (b < 6) { if (a > 5) { // } } } of course, in case, doesn't change program general behavior , isn't really important. from understanding, believe 2 if (condition) belong 2 different sequence points , compiler can't change order, if changing keep same general behavior. so, dear users, truth regarding ? if compiler can verify there no observable difference between two, free make such optimizations. sequence points conceptual thing: compiler has generate code such behaves as if semantic rules sequence points followed. generated code doesn't have f...

c# - Reporting services using assembly function with optional parameters -

i have reportingservices report optional integer parameter. parameter nullable. report uses assembly localization , formatting of strings in textboxes. assembly has several overload different parameter types (strings, booleans, etc) problem comes when parameter takes null value, , value passed method of assembly. tried several options: c# method: public static string method1(string name, int value, string culturename) expression: assemblyname.class1.method1('somestring',parameters!param1.value, 'en') c# method: public static string method1(string name, string culturename, int? value) c# method: public static string method1(string name, string culturename, int? value = null) expression: assemblyname.class1.method1('somestring','en', parameters!param1.value) and also: public static string method1(string name, object objectinstance, string culturename) public static string method1(string name, string culturename, object objectinstance = null) t...

Acessing the web from android application -

this isnt programming question, more on logic. basically have website making android app for. on app want user able login entering username , password prompt on app. when user clicks login data posted site url. bit lost... how app know whether login successful or not, and, if successful, want app show form or whatever user able post new content site, posted again. i'd imagine involves retrieving cookie check authentication? have set custom response page? , how app maintain session? to answer questions: how app know whether login successful or not? on server side, can respond post command value. value can whatever want, including information on whether login successful or not. i'd imagine involves retrieving cookie check authentication? you can use cookie validate on server side request comes valid session. would have set custom response page? it's not strictly necessary, this. how app maintain session? you can store "coo...

iphone - Using distanceFromLocation: on none CLLocation objects? -

i have defined class called fglocation conforms mkannotation protocol, trying measure distance between 2 of these objects. noticed use method distancefromlocation: defined method cllocation class. can see below creating 2 temp cllocation objects calculation, can't thinking maybe missing better / easier way. have comments on doing or how might better? // there better way this? fglocation *root = [annotations objectatindex:counter-1]; fglocation *leaf = [annotations objectatindex:counter]; cllocation *rootlocation = [[cllocation alloc] initwithlatitude:[root coordinate].latitude longitude:[root coordinate].longitude]; cllocation *leaflocation = [[cllocation alloc] initwithlatitude:[leaf coordinate].latitude longitude:[leaf coordinate].longitude]; cllocationdistance thisdistance = [rootlocation distancefromlocation:leaflocation]; [rootlocation release]; [leaflocation release]; nb: fglocation object defined (see below) noticed in docs should not...

configuration - Visual Studio: Set default project on project or solution settings -

i have visual studio 2010 solution several projects. 1 of projects set default project, want change default. i know can right click project want startup project , select "set startup project", setting stored in user's files (.slo , .user files). as company policy, don't check these files in source control system, therefore when user opens solution have different project startup object. is there way set these values? setting on .sln or .proj files? thanks from arian kulp's site , way change default startup project solution edit .sln file. you'll see project , endproject lines. first project listed default startup project, move 1 want top.

c# - FormatConvertedBitmap - No imaging component suitable to complete this operation was found error -

i'm using code below converting rgb tif file cmyk format. works great on local development machine(windows 7) throwing error in our windows 2003 production server. error: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ [notsupportedexception: no imaging component suitable complete operation found.] system.windows.media.imaging.formatconvertedbitmap.finalizecreation() +376 system.windows.media.imaging.formatconvertedbitmap.endinit() +158 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ below code i'm using: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ formatconvertedbitmap newformatedbitmapsource = new formatconvertedbitmap(); newformatedbitmapsource.begininit(); newformatedbitmapsource.source = mybitmapsource; newformatedbitmapsource.destinationformat = pixelformats.cmyk32; newformatedbitmapsource.endinit(); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~...

java - Is it possible to use regular expression for Jetty's servlet-mapping? -

i have 1 mapping <servlet-mapping> <servlet-name>service</servlet-name> <url-pattern>/service/*</url-pattern> </servlet-mapping> but want /service/master map master servlet. <servlet-mapping> <servlet-name>master</servlet-name> <url-pattern>/service/master</url-pattern> </servlet-mapping> i believe there conflict here since calling /service/* trigger service servlet right away. there way me use kind of exclusion in servlet-mapping or may regexp want do? servlet mappings use specific match, path <context>/service/master map master . this 1st rule of mappings servlet 3.0 spec : the container try find exact match of path of request path of servlet. successful match selects servlet. the container recursively try match longest path-prefix. done stepping down path tree directory @ time, using ’/’ character path separator. longest match determines servlet selected. ...

javascript - Displaying text as soon as a radio button is clicked, dynamically -

i have bunch of radio buttons. each correspond number 1 - 24. want display number somewhere else in page radio button selected. how this? you create div id "displaynum", "display:none" style property then create "onclick" handler radio buttons. the function called handler figure out button clicked (from button's id) , change content of "displaynum" div number (using innerhtml property of div), change "display" property of div invisible "none" visible "block".

android - Camera Preview: No errors but no picture :-( -

have read books , hints, got rid of compile errors , warnings , put in debug statements. package com.cit.broadcastsim; import java.io.ioexception; import android.app.activity; import android.hardware.camera; import android.os.bundle; import android.util.log; import android.view.surfaceholder; import android.view.surfaceview; public class broadcastactivity extends activity implements surfaceholder.callback { public camera mycamera; @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.broadcast); // inflate broadcast.xml file log.d("broadcast", "creating activity"); surfaceview camerasurface = (surfaceview)findviewbyid(r.id.camerasurface); surfaceholder cameraholder = camerasurface.getholder(); cameraholder.settype(surfaceholder.surface_type_push_buffers); cameraholder.addcallback(this); log.d("broadcast", "now wait callbacks"); } ...

.net - Adding arrays without copying duplicate values in C# -

what fastest way this: var firstarray = enumerable.range(1, 10).toarray(); // 1,2,3,4,5,6,7,8,9,10 var secondarray = enumerable.range(9, 3).toarray(); // 9,10,11,12 var thirdarray = enumerable.range(2, 3).toarray(); // 2,3,4,5 //add these arrays expected output 1,2,3,4,5,6,7,8,9,10,11,12 is there linq way this. quite have huge list of array iterate. example var firstarray = enumerable.range(1, 10).toarray(); // 1,2,3,4,5,6,7,8,9,10 var secondarray = enumerable.range(12, 1).toarray(); // 12,13 //add these arrays expected output 1,2,3,4,5,6,7,8,9,10,12,13 note: prefer function work on date ranges. .union give distinct combination of various sequences. note: if working custom type, need provide overrides gethashcode/equals inside class or provide iequalitycomparer<t> type in overload. bcl types such int or datetime , fine. example: var sequence = enumerable.range(0,10).union(enumerable.range(5,...

Conditionally showing span in ASP.Net MVC -

i have following.. <span class="error">@model.errormessage</span> the problem css error class makes yellow box showing when errormessage empty. is there best practice handling this? thinking of @if (using razor) seems odd have logic in view. it seems odd have logic in view. view have view logic in it. mvc not mvp or mvvm code behind discouraged. believe having if in view quite normal. alternative have model (view model) have property set css class of span . if error empty, css class have display:none;

objective c - How to display documents as grid of icons? -

what's best way let ipad user browse documents folder, documents displayed grid of icons captions? (like events view in iphoto , files , folders in place of events.) there no built-in control sort of ui. either use aqgridview (on github) or build own subclassing uiscrollview.

visual studio 2008 - Tool that will check for redundant includes in C++ project -

i need tool scan c++ project see if there includes not being referenced or being referenced redundantly. thanks. you don't want this. want include header declares/defines used cpp file you're writing. if remove "redundant" headers included you're including when minor changes you'll editing files on damn place. use proper header guards make sure don't break one-definition rule.

Python: Simplest (non-PIL) way to get image metadata (mainly size) -

i'm gathering basic metadata images - dimensions, although it'd nice other available metadata well. image formats i'm interested in png, jpg, , gif. i'm using pil @ moment, occurred me there may simpler way doesn't involve external dependencies or binary libraries. there one? answer: no there not simpler way using external library. if going care 1 , 1 file format only, yes. it's easy implement specific that. if want generic, need support lot of file formats, , don't want work yourself. to simplify install of pil, might @ pillow, friendly fork§ makes pil easy_installable.

dom - php DomDocument adds extra tags -

i'm trying parse document , image tags , change source different. $domdocument = new domdocument(); $domdocument->loadhtml($text); $imagenodelist = $domdocument->getelementsbytagname('img'); foreach ($imagenodelist $image) { $image->setattribute('src', 'lalala'); $domdocument->savehtml($image); } $text = $domdocument->savehtml(); the $text looks this: <p>hi, test, here image<img src="http://mysite.com/beer.jpg" width="60" height="95" /> because beer!</p> and output $text: <!doctype html public "-//w3c//dtd html 4.0 transitional//en" "http://www.w3.org/tr/rec-html40/loose.dtd"> <html><body><p>hi, test, here image<img src="lalala" width="68" height="95"> because beer!</p></body></html> i'm getting bunch of tags (html, body, , comment @ ...

Cannot get rid of texture wrapping seam in OpenGL -

take @ following image - see clouds in background have annoying seam: http://simoneschbach.com/seam.png this seam occurring when wrap around occurs, supplying texture coordinates programmatically following code: gbackgroundpos += 0.0003f; // gbackgroundpos climbs indefinitely... glfloat bgcoords[] = { gbackgroundpos, 1.0, gbackgroundpos + 0.5f, 1.0, gbackgroundpos, 0.0, gbackgroundpos + 0.5f, 0.0 }; i have enabled texture wrapping during texture init follows: gltexparameteri(gl_texture_2d, gl_texture_wrap_s, gl_repeat); gltexparameteri(gl_texture_2d, gl_texture_wrap_t, gl_repeat); does know can here rid of visible seam? the problem have solved technique, extremely simple implement: http://vcg.isti.cnr.it/~tarini/no-seams/ there open-source demo @ link, exposes used fragment shader. the trick easy adopt without complete understanding of why works, explained in journal of graphic tools article: "cylindrical ,...

session - Delete cookie failure -

i facing big issue cookie. my domain abc.com at first time login facebook connect, facebook created cookie @ computer as cookie name fbs_12345 cookie value gdgdfgdf cookie host: abc.com then after logout facebook connect. @ point try delete cookie setting cookie date- 10 fail, success set cookie value "" then relogin via facebook connect again, facebook created cookie @ computer as cookie name fbs_12345 cookie value gdgdfgdf cookie host: .abc.com (with dot in front) at point, cannot access cookie anymore, apparently due cookie host, 1 without prefix dot, 1 prefix dot if delete 1 of cookie, cookie values show out. any way clean removal of first cookie? ..... function printcookie dim x,y each x in request.cookies response.write("<h3>") if request.cookies(x).haskeys each y in request.cookies(x) response.write(x & ":" & y & "=" & request.cookies(x)(y)) response.write("...

Print histogram in python 3 -

i have word length_of_word | repetitions dictionary , want make histogram of 1 in link below using python built in functions no numpy or it. http://dev.collabshot.com/show/723400/ please me out @ least pointers. i guess must have dict looks one, right ? >>> d = {1:1, 2:10, 3:10, 4:6, 5:5, 6:4, 7:2, 8:1} >>> d {1: 1, 2: 10, 3: 10, 4: 6, 5: 5, 6: 4, 7: 2, 8: 1} if so, have function trick: >>> def histo(dict_words): # max values, plus delta ease display x_max = max(dict_words.keys()) + 2 y_max = max(dict_words.values()) + 2 # print line per line print '^' j in range(y_max, 0, -1): s = '|' in range(1, x_max): if in dict_words.keys() , dict_words[i] >= j: s += '***' else: s += ' ' print s # print x axis s = '+' in range(1, x_max): s += '---' s += '>' ...

java - Why JVM does not support forced class/classloader unloading? -

disclaimer: know how classes loaded in jvm , how , when unloaded. question not current behaviour, question is, why jvm not support "forced" class/classloader unloading? it have following semantics: when classloader "forced unloaded", classes loaded marked "unloaded", meaning no new instances created (an exception thrown, "classunloadedexception"). then, instances of such unloaded classes marked "unloaded" too, every access them throw instanceunloadedexception (just nullpointerexception). implementation: think, done during garbage collection. example, compacting collector moves live objects anyway, can check if class of current object "unloaded" , instead of moving object change reference guarded page of memory (accessing throw abovementioned instanceunloadedexception). make object garbage, too. or done during "mark" phase of gc. anyway, think technically possible, little overhead when no "unloading...

cil - Creating a DynamicType in .NET implementing an interface but using member implementations from a base class -

i attempting generate dynamic class implementing interface, 1 or more of members exists in base. compiled following code in c# , examined in reflector see c# compiler does. class baseclass { public string bob { { return "bob"; } } } interface istuff { string bob { get; } } class subclass : baseclass, istuff { } reflector not show implementation in subclass. .class private auto ansi beforefieldinit subclass extends enterprise.services.operationalactions.business.filters.baseclass implements enterprise.services.operationalactions.business.filters.istuff { } but if not emit member explicitly, typebuilder.createtype() throws invalidoperationexception stating member not have implementation. question is, how tell typebuilder interface member should take it's implementation base? it looks typebuilder have add private pass-thru, make happy (below). try using ikvm builder - identical api, might not have limitation. using s...

What is the best way to communicate between two process with C#? -

use net remoting or others ?? i want sample way, think no socket or other more easy deploy ... anyway ,help please , thanks. you want begin namedpipes. since dealing c#, have at: http://msdn.microsoft.com/en-us/library/aa365590(v=vs.85).aspx essentially, got me going instantly when looking it: http://msdn.microsoft.com/en-us/library/bb546085.aspx#y1920 good luck.

flash - AS3: Does `FullScreenEvent` temporarily add things to the display list? -

short answer: yes, fullscreenevent temporarily adds 1 child stage. long rant: how that.. i'm not crazy.. don't know if documented - it's true. little message pops saying 'you can press esc exit full-screen' adds single child stage temporarily , keeps on top level until fades out. sudden intrusion of indexes messed me up.. there's answer, guess. need figure out how around slight annoyance. searching phantom child: tried find child, suggested, in project using stage.getchildat(11)+" "+stage.getchildat(10)+ ..etc etc.. , stage.getchildat(11).name+" "+stage.getchildat(10).name+ ..etc etc..(a quick sloppy way trace text box on stage..) couldn't tie specific name.. name came 'instance(whatever number in line created was)'. type interesting though because null .. don't know if that's normal or anything, if 1 of things had made, [object sprite] or similar.. odd indeed. furthermore, when trying information adobe live...

iphone - How can I play custom alarm(saved in my application bundle as m4r format) obtained from push notification -

how can play custom alarm(saved in application bundle m4r format) obtained push notification it won't play m4r format sounds. information on formats supports (and how convert them), see here .

java - Suggest a persistent strategy for a workflow system -

i in process of creating ui configuration tool pet project. 1 aspect of tool lets end user define orchestration. need save orchestration definition database. there executable version of definition in running system. executable version created dynamically on-demand. idea separate definition executable version have flexibility choose runtime version among bpmn or jpdl or pojo based workflow solution (beanflow). limitation : can't use bpmn editors come frameworks jbpm, activiti etc wan't use own ui specific domain. i need suggestions on how persist definition. should use rdbms tables? if so, there db schema can borrow close orchestration concepts? should serialize definition bpmn/jpdl xml instance document? are there other simple formats can use? by "orchestration" i'm assuming mean finite state machine . current state dictates transitions can followed other states. representation of states , transitions edges , vertices produces directed a...

latex - How to redifine (via ENVIRON package) the "pmatrix" environment? -

i want redefine "pmatrix" environment provided amsmath package (and changed mathtools package) adding good-looking delims. code below: \documentclass{article} \usepackage{amsmath,amstools,environ} \renewenviron{pmatrix}{\parens{\begin{matrix}\body\end{matrix}}} "parens" command provided mtpro2 package curved left/right parensis. not work. further, there's star-ed version pmathix* envrionment (with optional arg l/c/r), don't have idea either. code can give below: \documentclass{article} \usepackage{amsmath,amstools,environ} \renewenviron{pmatrix*}[1][c]{\parens{\begin{matrix*}[c]\body\end{matrix*}}} i mail environ package's author robertson (wspr81[at]gmail[dot]com) no reply. maybe been seen here usually. logged in , posted.

java - spring BeanCreationException confusion about mapping -

trying integrate hibernate , spring ,i ran error severe: context initialization failed org.springframework.beans.factory.beancreationexception : error creating bean name ' org.springframework.web.servlet.mvc.annotation.defaultannotationhandlermapping ': initialization of bean failed; nested exception java.lang.illegalstateexception : cannot map handler ' org.me.spring.hib.school.web.schoolcontroller#0 ' url path [ /allschools ]: there handler of type [class org.me.spring.hib.school.web.schoolcontroller ] mapped. my controller looks like package org.me.spring.hib.school.web; import javax.servlet.http.httpservletrequest; import javax.servlet.http.httpservletresponse; import org.me.spring.hib.school.dao.schooldao; import org.springframework.stereotype.controller; import org.springframework.ui.modelmap; import org.springframework.web.bind.annotation.requestmapping; import org.springframework.web.servlet.modelandview; @controller public class schoolcon...