Posts

Showing posts from September, 2014

Free project collaboration tools - SVN + tasks + auto deployment -

i'm looking free / open source tool allow me set tasks manager integrated svn repository , auto-deployment tool (so each commit autodeployed http server). need integrate tasks users svn users etc. must run linux! types? go cruise server + mingle + twist http://www.thoughtworks-studios.com/forms/form/go/download have if suits requirement continuous integrated(ci) build/deployment process !

what kind of username should be given in sql server 2005? -

i trying install sql server 2005 last hour can't create username , password , domain in sql server 2005. became mad bcz sql server not accepting username , password of mine. tried lots of ones. making simple application test purpose only. 1 can gave me name & password or link in have given valid username , password of sql server 2005. edit: trying give mixed mode authentication in sql server 2005. had tried follow link can't make it. hostname\username should username has permissions mssql.

android - An error about listview -

i tried make file choose following below link http://www.dreamincode.net/forums/topic/190013-creating-simple-file-chooser/ however, got error "your content must have listview id attribute 'android.r.id.list' " i have googled error , need listview tag in xml file. however, above example not have , seems working well. although not triggering file chooser in main page, think code not have differences it. me see if there ways solve problem, please? file_view.xml <?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="wrap_content"> <textview android:id="@+id/fd_text1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:singleline="true" android:textstyle="bold" android:layout_margintop="5dip

jQuery daterangepicker: executes alert twice? -

i want alert "ok" when change/make date. 2 alerts instead of one? how can fix this? here's code: $(document).ready( function(){ $('#datepicking') .daterangepicker({ arrows:true, onchange: function(){ $('#viewer') alert('ok'); } }); }); here's working example: http://jsfiddle.net/bu5pj/2/ jquery 1.4.4, ui 1.8.5, + daterangepicker filamentgroup.com by looks of documentation found here http://www.filamentgroup.com/lab/date_range_picker_using_jquery_ui_16_and_jquery_ui_css_framework/ onchange: function, callback executes whenever date input changes (can happen twice on range selections). when picked specific date got 1 alert box.

How can I force a compile-time warning in VB.NET when using an unassigned local variable? -

today discovered had assumed vb.net many years not true (worrying!). assumed variable declared within loop had lifetime of iteration declared in, in fact seems has lifetime of whole procedure. for example: integer = 0 1 dim var1 boolean console.writeline(var1.tostring()) var1 = true console.writeline(var1.tostring()) next console.readkey() i had assumed output of false, true, false, true instead false, true, true, true. in c# equivalent code not compile compile time error of error "use of unassigned local variable 'var1'". i realise there many ways fix , best practice declare variable outside of loop , reset @ beginning of every loop through. i find behaviour counter-intuitive me @ least compile time warning in vb.net when/if this. (i set on projects have , warning allow me check assumptions aren't causing errors). does know how/if can generate compile time warning in vb.net

objective c - detected an attempt to call a symbol in system libraries that is not present on the iPhone -

im using x-code 3.2.4 , i'm using ios4.1 sdk. i'm getting following error when try call "extaudiofileopenurl" audio toolbox. detected attempt call symbol in system libraries not present on iphone: _unwind_resume called function _zn15id3parserhandlec2epvpfls0_mmmps0_pme in image audiotoolbox. why happening , how can fix it? thanks, db. edit in addition when running on 4.1 device error "error: 805297555" what hell? the exact line of code causing problem this. // open audio file , associate extended audio file object. osstatus result= extaudiofileopenurl (sourceurlarray[audiofile], &audiofileobject); it's straight out of sample code project. sample code project runs fine. i don't understand why if start new project same code errors. this means extaudiofileopenurl unsupported api on iphone. extaudiofileopenurl makes use of exception handling api not available on iphone, why seing sympton of un

php - How can I reset session when user navigates away from page? -

i've created a session keep track of user actions on specific page. when user navigates away specific page (but still on same site), need reset session. i can set set timer when session expires, that's not want. how can reset session on page navigation? just make resetting session first thing when loading new page.

unit testing - test location provider in android instrumentation test project -

i have application, uses locationmanager. therefore i'm writing instrumentation test. i've found similar answer , won't work me. public class locationsensortest extends androidtestcase { /*package*/ locationmanager lm; private locationsensor sensor; @override protected void setup() throws exception { super.setup(); sensor = new locationsensor(getcontext()); lm = (locationmanager) getcontext().getsystemservice(context.location_service); lm.addtestprovider("test", false, false, false, false, false, false, false, criteria.power_low, criteria.accuracy_fine); lm.settestproviderenabled("test", true); } public void testhasanyactivelocationprovider() { asserttrue(sensor.hasanyactivelocationprovider()); } } the test fails during "addtestprovider" securityexception "android.permission.access_mock_location" missing. point instrumentation test androidmanifest.xml has uses permission, application tes

Most efficient data structure to add styles to text -

i'm looking best data structure add styles text (say in text editor). structure should allow following operations: quick lookup of styles @ absolute position x quick insert of text @ position (styles after position must moved). every position of text must support arbitrary number of styles (overlapping). i've considered lists/arrays contain text ranges don't allow quick insert without recalculating positions of styles after insert point. a tree structure relative offsets supports #2 tree degenerate fast when add lots of styles text. any other options? i have never developped editor, how this: i believe possible expand scheme used store text characters themeselves, depending of course on details of implementation (language, toolkits etc) , performance , resource usage requirements. rather use separate data structure styles, i'd prefer having reference accompany each character , point array or list applicable characters. characters same set of

ios4 - iphone sigkill error -

hey im working on game iphone using cocos2d , sdk 4.1 , getting sigkill error randomly (or appears randomly) while running. error wont appear hours of trying simulate it. have read around on forums , sigkill problems seem when user tries close app, happening during gameplay. can think of why sigkill msg being set off without user trying actively close app. advise or tips on trying track down appreciated g i think sigkill can raised number of different errors. should try using debugger , checking out stack trace (function calls) see error happening if can narrow down.

remoting - How to pass an unknown type between two .NET AppDomains? -

i have .net application in assemblies in separate appdomains must share serialized objects passed value. both assemblies reference shared assembly defines base class server class , defines base class entiy type passed between domains: public abstract class serverbase : marshalbyrefobject { public abstract entitybase getentity(); } [serializable] public abstract class entitybase { } the server assembly defines server class , concrete implemetation of entity type: public class server : serverbase { public override entitybase getentity() { return new entityitem(); } } [serializable] public class entityitem : entitybase { } the client assembly creates appdomain in server assembly hosted , uses instance of server class request concrete instance of entity type: class program { static void main() { var domain = appdomain.createdomain("server"); var server = (serverbase)activator.createinstancefrom( domai

c# - Search Hierarchical List Recursively -

i have hierarchical list of objects. assume structure follows: root node parent node child node parent node child node parent node child node the child nodes have own children, objective search "parent nodes". so, let's parent node class has property called "name" - , user enters partial name, want of parent nodes name contains user's search criteria returned. basically, more of "filter" functionality anything. so, know how this, however, problem running key objective keep hierarchical structure in tact. in other words, if there 1 parent node matches filter criteria, want structure below returned: root node parent node child node my current efforts yield: parent node child node i using linq. suggestions appreciated. thanks! chris code snippet below current filter implementation: filteredreports = reports.firstordefault().children.cast<ihierarchicalresult>()

c# - How to avoid declaring database fields twice, once in database, once in a repository/model? -

i began reading pro asp.net mvc framework . the author talks creating repositories, , using interfaces set quick automated tests, sounds awesome. but carries problem of having declare fields each table in database twice: once in actual database, , once in c# code, instead of auto-generating c# data access classes orm. i understand great practice, , enables tdd looks awesome. question is: isn't there workaround having declare fields twice: both in database , c# code? can't use auto-generates c# code still allows me tdd without having manually create business logic in c# , creating repository (and fake 1 too) each table? if use entity framework 4, can generate poco object automatically database. ( http://blogs.msdn.com/b/adonet/archive/2010/01/25/walkthrough-poco-template-for-the-entity-framework.aspx ) then can implement generic irepository , generic sqlrepository, allow have repository objects. explained here : http://msdn.microsoft.com/en-us/ff714955.as

How to manipulate a DOM tree before it is displayed on screen ? ( javascript, jquery, ...) -

the problem simple, can't figure out solution. many helps. want modify web page (dom tree) before displayed on screen. understand dom tree loaded in memory before being processed. do of knows way process loaded dom tree while on memory , let displayed new structure ? the reason want that, because i'm working on addon adding content existing web site. added-> need mention existing web site not mine, can't use php modify website content not mine. but right now, web site displayed without addon content , see content coming after 1 second (because append content after website displayed), see website content moving. thanks helping. it's not difficult. hide body using css , on onload-event of document manipulation , show body. short example: <html> <head> <title>example</title> <style type="text/css"> <!-- html.scripted body{display:none;} --> </style> <script type="text/javascript"

c++ - MFC - extend app to run from command line -

i have existing mfc application i'm trying extend accept command line parameters , run unattended. i need kick off events after initinstance() has finished , existing gui has been loaded. i've looked @ winmain.cpp, it's not clear me how run events seems kick off thread , 'disappear' debugger (i.e. gets executed next? must mfc loop, right? possible hook there?) i'm new , it's entirely possible i'm missing insight @ higher level, not googled. grateful pointers. thanks. i parse command line in initinstance usual, instead of processing commands find, add special processing ones care (for example) post messages own message queue when you're ready start processing messages, they'll show first things do. to that, i'd probably derive class ccomandlineinfo , , override parseparam handle commands care (and have send other arguments doesn't recognize ccomandlineinfo::parseparam handled normally). then, in initinstance, replac

nested - Nesting PHP-functions: to what purpose? -

why php allow nesting functions? <?php function foo() { function bar() { return "bar"; } return "foo"; } print foo(); print bar(); .. valid php. but: why nesting needed ever? and if so, why can call bar anywhere (and not, e.g. withing foo(), or trough foo.bar() or such). i ran today, because forgot closing bracket somewhere, , had 1 many further down. code valid , no errors thrown; started acting weird. functions not being declared, callbacks going berserk , on. feature, , if so, purpose? or idiosyncrasy? answer : commentor points out duplicate of what php nested functions for . note order important here; cannot call bar() before calling foo() in example. logic here appears execution of foo() defines bar() , puts in global scope, it's not defined prior execution of foo(), because of scoping. the use here primitive form of function overloading; can have bar() function perform different operations depending u

c# - How to add grab handle in Splitter of SplitContainer -

there used 3 dots in splitter bar of splitcontainer. there 3 lines in question details text box on stackoverflow shows can grabbed. how can splitter bar of splitcontainer in .net? not have against alex's answer, thought i'd share solution looks bit nicer me (on xp machine anyway?). private void splitcontainer_paint(object sender, painteventargs e) { var control = sender splitcontainer; //paint 3 dots' point[] points = new point[3]; var w = control.width; var h = control.height; var d = control.splitterdistance; var sw = control.splitterwidth; //calculate position of points' if (control.orientation == orientation.horizontal) { points[0] = new point((w / 2), d + (sw / 2)); points[1] = new point(points[0].x - 10, points[0].y); points[2] = new point(points[0].x + 10, points[0].y); } else { points[0] = new point(d + (sw / 2), (h / 2)); points[1] = new point(points[0].

php - preg_match not returning expected results -

i'm attempting use regexp parse search string time time may contain special syntax. syntax im looking [special keyword : value] , want each match put array. keep in mind search string contain other text not intended parsed. $searchstring = "[startdate:2010-11-01][enddate:2010-11-31]"; $specialkeywords = array(); preg_match("/\[{1}.+\:{1}.+\]{1}/", $searchstring, $specialkeywords); var_dump($specialkeywords); output: array(1) { [0]=> string(43) "[startdate:2010-11-01] [enddate:2010-11-31]" } desired output: array(2) { [0]=> string() "[startdate:2010-11-01]" [1]=> string() "[enddate:2010-11-01]"} please let me know if not being clear enough. your .+ matches across boundaries between 2 [...] parts because matches character, , many of them possible. more restrictive characters may matched. {1} redundant , can dropped. /\[[^:]*:[^\]]*\]/ should work more reliably. explanation: \

Changing email format with javascript -

i sending emails via html page using javascript , outlook activex object (outlook.application) trying change format of mail message html don't know value must set .bodyformat property. i've tried this: objmail.bodyformat = olformathtml; but olformathtml undefined; can use constant vbscript? you can use htmlbody property this: objmail.htmlbody = "your html code here"; more info: http://www.tek-tips.com/viewthread.cfm?qid=1003014&page=1

java - massive INSERT - spring framework -

i'm doing massive import in sql server using java application spring framework , simplejdbcinsert class. results not , i'm trying optimize it. i support every simplejdbcinsert implicit transaction wish make explicit transaction 'begin' @ start , 'commit' @ end of file import procedure. how can this? i'm looking, can't find it. http://static.springsource.org/spring/docs/3.0.x/spring-framework-reference/html/ thanks! you try use simplejdbcinsert.executebatch() execute multiple large sets of inserts. maybe increase performance bit.

sql - Best way to join unique month and year from db in rails 3 ( or otherwise ) -

i trying figure out nice way of doing , thought maybe there nicer way in newer rails 3.0 activerecord query. i have bunch of posts have published_at field. now want present archive in sidebar unique months , year contains posts , display archive. what's best way avoiding heavy hits on db on every pageload? suggestions? you need query along lines of select distinct date_format(published_at, '%m %y'), count(id) posts group 1 . it's trivial matter convert ar syntax.

Tcl + Check file existance -

i'm trying check if file exists or not in tcl, can't seem true result. though know present. while {true} { if { [file exists $file_name] == 1} { exp_send "copy file.txt destination \r" puts " file copied!" } puts "file not copied" } i execute file not copied line. did put [file exists $file_name] , end 0. know fact file exists in current directory. suggestions? edit: an alternative method i'm trying pursue, when dir using tcl script. output of files in directory. need match file list outputted , satisfy if when match found ... i'm executing script location a, using script telnet location b. when file exists, checks location itself. problem ... since need searching in location b ... the file exists command works local filesystems. if want check whether remote system has file, you'll have exp_send instructions check you. unfortunately, can't quite tell you&#

android - App keeps dying after http request results are put into layout -

i not think of title. sorry. anyway, have app making pull information custom web api. pull data api , fill in layout information. problem takes while app stalls few seconds before information pulled since in oncreate method of activity. resolve implemented loading dialog. problems began. put http requests seperate thread , downloads fine. no problem. keeps force closing every time try modify layout afterward. question how modify layout after background thread finished? try keeps force closing app. use asynctask. you're trying update ui different thread. can't that. there's 11 billion other questions on exact same subject

php - Lucene Search index breaks regularly on shared hosting when site has high volume of write access -

i have implemented lucene on website. once every 4 days search index breaks. error saying index unreadable , site shows 500 error users. i ssh in, rebuild index , eveything goes normal. the part of project different normal high number of writes doing db. incrementing viewcount field on every page view. presume lucene updates document every time. presuming issue: there way tell lucene not update index when incrementing count field? nb: project uses sfluceneplugin within symfony nb2: error message similar to: sep 03 18:52:21 symfony [err] {sfexception} file '/home/username/symfony_project/data/index/myindex/en/_1nws_s.del' not readable. in /home/username/symfony_project/plugins/sfluceneplugin/lib/vendor/zend/search/lucene/storage/file/filesystem.php line 59 are seeing messages in log files? sep 03 18:52:21 symfony [err] {sfexception} file '/home/username/symfony_project/data/index/myindex/en/_1nws_s.del' not readable. in /home/username/symfon

javascript - Trying to Detect Characters to determine if Page Should Reload, or not. (Safari Extension) -

just knows, i'm relatively new javascript, (and i've been trying things in pure js rather using jquery, etc.). @ place contract for, have exchange server, use webmail client. to prevent timing me out when there isn't activity, started putting safari extension since inject js page using one. , thought exercise since i'm learning js scratch. well, part of works, except when you're replying, or sending new email, tried adding in second bit of code prevent that, still refreshes. can't figure out why. appreciate help! going have add in rules if i'm replying, or replying all, think if can working, can going to. so here's code: if (location.host === "mail.exmx.net") { /* domain https://mail.exmx.net/owa/?ae=folder&t=ipf.note */ var timer = settimeout(function() { location.reload( ); }, 30000 /* 30 seconds used test speed waiting time*/ ); } else (location.href.indexof("?ae=item&t=ipm.note&a=new")

winapi - c++ picking function is not working -

i have picking function doesn't seems work. function should return true if collide object return 0; , never change. here picking function bool d3ddevice::picking(hwnd hwnd, lpdirect3ddevice9 d3ddev, cxfileentity *entity) { d3dxvector3 v; d3dxmatrix matproj; point pt; d3dviewport9 vp; getcursorpos(&pt); screentoclient(hwnd, &pt); d3ddev->gettransform(d3dts_projection, &matproj); d3ddev->getviewport(&vp); v.x = ( ( ( 2.0f * pt.x ) / vp.height ) - 1 ) / matproj._11; v.y = -( ( ( 2.0f * pt.x ) / vp.width ) - 1 ) / matproj._22; v.z = 1.0f; d3dxmatrix m; d3dxvector3 rayorigin,raydir; d3dxmatrix matview; d3ddev->gettransform(d3dts_view, &matview); d3dxmatrixinverse( &m, null, &matview ); // transform screen space pick ray 3d space raydir.x = v.x*m._11 + v.y*m._21 + v.z*m._31; raydir.y = v.x*m._12 + v.y*m._22 + v.z*m._32; raydir.z = v.x*m._13 + v.y*m._23 + v.z*m._33; rayorigin.x = m._41; rayorigin.y = m._42; rayori

html5 - javascript / canvas5 error from simple code -

error: uncaught exception: [exception... "component returned failure code: 0x80040111 (ns_error_not_available) [nsidomcanvasrenderingcontext2d.drawimage]" nsresult: "0x80040111 (ns_error_not_available)" location: "js frame :: http://127.0.11.1/test/canvas5_b.php :: setup :: line 27" data: no] function setup() { var e = document.getelementbyid("mycanvas"); var ctx = e.getcontext('2d'); var meter = new image(); meter.src = "meter.jpg"; var meter_bar = new image(); meter_bar.src = "meter_bar.jpg"; //alert(meter); ctx.beginpath();/////////line 27//////////// ctx.drawimage(meter, 50, 100); //ctx.globalcompositeoperation = "lighter"; ctx.drawimage(meter_bar, 68, 123); ctx.closepath(); } window.onload = setup; both images in right folder. thing gets me works if put alert(meter); before line 27. if not loaded, have running on window.onload, dont see h

mercurial - HG Push Failed; Permission denied .hg/store/lock -

i have been trying setup mercurial repository on server team can work theirs. running ubuntu server 10.4 , did install of mercurial using apt-get. went smoothly. i init dir hg fine, setup hgrc follows: [web] push_ssl = false allow_push = * [trusted] users = * groups= then run hg serve . server begins listening. can clone repository computer when try , push changes error: c:\users\username\project1>hg push http://myinternalip:8000 pushing http://myinternalip:8000 searching changes abort: http error 500: internal server error on server side following error: lockunavailable: [errno 13] permission denied: '/home/username/projects/project1/.hg/store/lock' if has solution how fix amazing. have googled , found people similar issues , may have web user not having permissions new of , none of them give solutions on how fix issue. time. you must allow write access repository directories user running mercurial server process. i.e user account running hg serv

soap - What's the logic behind WCF generated names for DataContracts -

when use wcf expose datacontract soap wevservice funky genenerated names, such as: [flags] public enum enumtype1 { enummember1 = 1; enummember2 = 2; enummember3 = 4; } [datamember] private dictionary< enumtype1, class1> class1dictionary; has soap representation on wire: (i'm paraphrasing): <class1dictionary> <keyvalueofenumtype1class1utlv0ze5> <key>enummember1 </key> <value> ... </value> </keyvalueofenumtype1class1utlv0ze5> </class1dictionary> what's logic behind keyvalueofenumtype1class1utlv0ze5? can explain keyvalueofenumtype1class1 part, utlv0ze5 come from? furthermore wcf client break if arbitrary string charges? it bit random me. don't know whether funk random , subject changes break contracts. but if in search of less funcky wsdl, workaround (from here ) subclass dictionary , use collectiondatacontractattribute override output during serialization: [co

php - file_get_contents - Connection timed out -

<?php $a = file_get_contents('http://www.google.com'); echo $ why browser returning error? warning: file_get_contents(http://www.google.com) [function.file-get-contents]: failed open stream: connection timed out in /home/test.php on line 2 mostly server cannot connect external resource, example, because of firewall restrictions.

java - Configure spring datasource for hibernate and @Transactional -

at moment i'm using drivermanagerdatasource @transactional annotation manage transactions. transactions very slow, because data source open , close connection db each time. what data source should use speed transaction? drivermanagerdatasource isn't connection pool , should used testing. should try basicdatasource apache commons dbcp . like: <bean id="datasource" destroy-method="close" class="org.apache.commons.dbcp.basicdatasource"> <property name="driverclassname" value="${jdbc.driverclassname}"/> <property name="url" value="${jdbc.url}"/> <property name="username" value="${jdbc.username}"/> <property name="password" value="${jdbc.password}"/> </bean>

c# - Given coordinates, how do I get all the Zip Codes within a 10 mile radius? -

i have location (latitude & longitude). how can list of zipcodes either partially or within 10 mile radius of location? the solution call known web service (google maps, bing maps, etc...) or local database solution (the client has sql server 2005) or algorithm. i have seen similar question , answers there pretty pertain using sql server 2008 geography functionality unavailable me. firstly, you'll need database of zipcodes , corresponding latitudes , longitudes. in australia, there few thousand of these (and information available), assume it's more difficult task in us. secondly, given know are, , know radius looking for, can zipcodes fall within radius. simple written in php follows: (apologies it's not in c#) function distancefromto($latitude1,$longitude1,$latitude2,$longitude2,$km){ $latitude1 = deg2rad($latitude1); $longitude1 = deg2rad($longitude1); $latitude2 = deg2rad($latitude2); $longitude2 = deg2rad($longitude2); $delta_lat

php - Unusual notation of passing by reference? -

in legacy php script found following line of code: $cachelite =& ( "string" ); which provokes error: parse error: syntax error, unexpected '(', expecting t_new or t_string or t_variable or '$' is mistake or way of passing reference or else don't know. have enable/disable in php configuration in order work? you can't assign reference literal value, or expression, in php; has reference variable. have no idea how line of code got there (why $cachelite being assigned random string anyway?) — mistake in legacy code.

java - Converting a Delphi 5 engine control app to Android - need advice on the approach -

i have app written in delphi 5 want convert run on android 2.x. app pretty simple; used upload/download configuration files separate microprocessor on modbus serial link. (it's engine management chip use in boosting horsepower in turbo-diesel engines). haven't programmed since pascal days @ uni complete beginner willing invest time , have source code of course. from reading have done far, appears re-writing app in java seems common solution suggest using monodroid? appreciate definitive advice around versions , tools should put - eg install java sdk or @ monodroid , convert existing code? thing find challenging getting right approach/environment setup - i'm overwhelmed information , choice here! once sure have right approach, figure out details go there nothing worse spending hours , hours fiddling 1 approach later learn wasted! my objective here functionality of existing code replicated possible in android, not replicate , feel , not become android programming

java - Deploying GWT in tomcat -

i new gwt , satisfied needs problem how can deploy , run in tomcat webserver , tried googleing cant success in can 1 explain how deploy samples ...... read article: http://code.google.com/webtoolkit/doc/latest/devguidedeploying.html the webaps directory can found directly under tomcat home.

jquery - How to show a hidden div on mouse over on a series of images -

i have series of images have description div hidden. i'm trying show description on hover event. can't see work. here's code. <div class="peopleimage" id="image1"> <img src="image1.jpg"> <div class="peopleinfo">description goes here</div> </div> <div class="peopleimage" id="image1"> <img src="image1.jpg"> <div class="peopleinfo">description goes here</div> </div> <div class="peopleimage" id="image1"> <img src="image1.jpg"> <div class="peopleinfo">description goes here</div> </div> here's jquery i'm working with: $(".peopleimage").hover(function () { var peopleinfo = $(this).closest('.peopleinfo'); peopleinfo.show(); }); nothing seems happen. suggestions appreciated! try this: $(".

php - How to redirect if not from $_SERVER['HTTP_REFERER']? -

<?php if (ereg("www\.test", $_server['http_referer']) != true) { header("location http://www.example.com"); end; } echo "111"; //dosomting? ?> it still not working try this: <?php if (!preg_match("www\.test", $_server['http_referer'])) { header("location: http://www.example.com"); exit(); } //do stuff... ?>

vb.net - How to re-write url in asp.net 3.5 -

i converted project html aspx issue is, extension got changed. e.g. " www.example.com\index.html " changed " www.example.com\index.aspx " which give problem seo's. so when search web link www.example.com\index.html , if try go in it, give me error of 404 file not found . i tried couple of methods url-rewriting, works fine @ local side, fails @ server side. both tried in global.asax 1. protected overloads sub application_beginrequest(byval sender object, byval e system.eventargs) dim currentpath string = request.path.tolower() dim strpagename string = currentpath.substring(currentpath.lastindexof("/") + 1, (currentpath.lastindexof(".") - currentpath.lastindexof("/")) + 4) if strpagename.endswith(".html") select case strpagename case "index.html" rewriteurl(currentpath) end select end if end sub protec

Create Circular Path for an iPhone Application -

how can create circular path in iphone application on can detect finger touches? you use $1 gesture recognizer. there open source gesture recognizer iphone here created adam preble. you use 1 aspect of recognizer predefine shapes. once shapes defined , stored application, can use recognizer test if touch strokes match of defined shapes. i use code adapted adam's recognize 6 different gestures in application (circle, s, squiggle...), , happy results. it might lot of work 1 shape, although benefits of using $1 gesture recognizer recognize size circle drawn clockwise or counter-clockwise.

How to get country name from IP address in php -

this question has answer here: how parse , process html/xml in php? 27 answers i want find country, city, latitude , longitude ip address using php. using url , returning data in xml format. http://www.ipgp.net/api/xml/122.163.6.58 the data coming this: <iplookup> <ip>122.163.6.58</ip> <code>in</code> <country>india</country> <flag>http://www.ipgp.net/flags/in.png</flag> <city>calcutta</city> <region>west bengal</region> <isp></isp> <lat>22.5697</lat> <lng>88.3697</lng> </iplookup> can suggest how parse , result use simplexml_load_string() .

ios4 - Realtime time message in iPhone SDK -

i'm finding way realtime messaging in iphone sdk. iphone safari doesn't support web socket. apple push notification working on application close. want make chat program real time. there other way except web socket ? it's next version of ios (4.2) add websockets support. ios 4.2 should out month . you might looked @ socket.io if control server side too. socket.io javascript library client , server uses best communication transport both ends support starting native websockets, flash based websockets fallback, various long-poll/comet options. api on client , server sides normal websockets api regardless of underlying transport used. allow use websockets protocol when available , fall still works when don't have websockets (without requiring use different api).

caching - Youtube Video View Count -

if notice, number of views of youtube video doesn't change if refresh video page multiple times. also if open same url on different browser same computer still shows old count. any guess can logic of maintaining view count? do have 2 count fields , sync nightly , page show synced value not count gets updated page refresh? thanks i think record page views increments counter, output (the html receive) cached - or @ least portion of is. it makes sense - youtube popular website serving many concurrent people. performance important.

jquery - Upload progress bar Java Servlet? -

i want show upload progress bar uploads using servlet. tried ajax, iframe technique. page not reloading , file getting uplaoded. but, progress bar not coming. there jquery progress plugin available java servelts? thanks!! i recommend jquery uploadify plugin ajax file uploads. comes progress bar well. can find example on demo page . integration jsp/servlet isn't hard. can keep servlet code "regular" file uploads unchanged. i've ever written mini tutorial in answer here (check "update" part of answer), may find useful well.

enhancing a rails gem/plugin -

i want enhance functionality of acts-as-taggable-on adding parent_id , acts_as_tree tag model. how edit gem/plugin ? go github page , fork application. make changes , commit them . simple.

c# - Parsing pair of floats -

given string like: "0.123, 0.456" simplest way parse 2 float values 2 variables a , b ? i suggest: split on comma ( string.split ) trim ( string.trim ) parse either float.parse or float.tryparse . (if want exception thrown if format incorrect, go parse . if want handle parsing failures part of normal control flow, use tryparse .) if numbers going in format, explicitly specify cultureinfo.invariantculture . consider using decimal (or double ) instead of float .

Get index of Enumerator.Current in C# -

possible duplicate: (c#) index of current foreach iteration good morning, is there way can index of enumerator 's current element (in case, character in string) without using ancillary variable? know perhaps easier if used while or for cicle, looping through string using enumerator more elegant... drawback case need each character's current index. thank much. no, ienumerator interface not support such functionality. if require this, either have implement yourself, or use different interface ilist .

css - html banner with overlaying images and texts -

im looking way dynamically create banners can placed on other pages. banner consists background image, 2 overlaying images , 2 text labels on top of background image. is right can use absolute positioning achieve overlaying elements? how can make sure, banner in own gets placed relatively in integrated page? i guess need able place elements absolute inside relative box. possible? thanks markus it possible. containing element need have position:relative , inner elements want place need have position:absolute; , position x , y this: top:10px; right:20px or bottom:10px; left:230px so example: css: #banner_wrap {position:relative; width:860px; height:60px;} #inner_element {position:absolute; top:10px; left:20px; width:40px; height:40px;} html <div id="banner_wrap"> <div id="inner_element"></div> </div> if want them dynamic can change css specific page.

asp.net - Cross domain call not working in FireFox and Chrome -

i making asynchronous request different server data using jquery. works fine in ie, doesn't work in firefox , chrome, when reaches code request other server made, freezes there , blank page shown. if remove piece of code, ajax works fine. also, when place breakpoint @ document.ready, breakpoint hit when debugging using ie, it's not hit when debugging using firefox. following jquery using jquery(document).ready(function ($) { $('.tabs a, .tabs span').livequery('click', function () { var currenttab = $(this).parents('li:first'); if (!currenttab.is('.active')) { var currentcontent = $('.tab_container .' + currenttab.attr('class')); $('.tabs li').removeclass("active"); currenttab.addclass("active"); var url = $(this).attr("href"); var newcontent = ""; if (currentcontent.length == 0)

asp.net mvc - How to bind a table without(edit,delete,create) in mvc contrib grid -

i have used mvccontrib grid in mvc 2.0 want bind table in gridview...so far coding is....i dont no whther correct or wrong... homecontroller.cs: public actionresult list(int? page) { using (productdatacontext db = new productdatacontext()) { viewdata["product"] = db.products.tolist().aspagination(page ?? 1, 10); return view("product"); } } i have cretaed list view that....... coding should write in index.aspx so far used coding not working...... <% html.grid((list<product>)viewdata["product"]) .columns(column => { column.for(c => c.categoryid); column.for(c => c.supplierid); }).render(); %> it shows there no data available. or there other coding? my issue want bind table in mvccontrib grid. if shows there's no data available problem db.products.tolist().aspagination(page ?? 1, 10) returns no elements (empty collection). why happ

c# - Where are my System.Management.* classes? -

i installed visual studio 2010 .net framework 4.0 , c# , can't find under system.management namespace except system.management.instrumentation . online documentation @ msdn wmi keeps telling me have use classes such system.management.managementobjectsearcher or system.management.managementscope don't see classes. what happened classes , how can access them? you need add reference system.management.dll project. you can see system.management.instrumentation without adding reference system.management.dll because included in different library ( system.core.dll , included reference automatically), cannot access other types contained namespace without explicitly adding reference system.management.dll library.

php - GD Lib to save a image -

i have code snippet of following $code = generatecode($characters); /* font size 75% of image height */ $font_size = $height * 0.75; $image = imagecreate($width, $height) or die('cannot initialize new gd image stream'); /* set colours */ $background_color = imagecolorallocate($image, 255, 255, 255); $text_color = imagecolorallocate($image, 20, 40, 100); $noise_color = imagecolorallocate($image, 100, 120, 180); /* generate random dots in background */ for( $i=0; $i<($width*$height)/3; $i++ ) { imagefilledellipse($image, mt_rand(0,$width), mt_rand(0,$height), 1, 1, $noise_color); } /* generate random lines in background */ for( $i=0; $i<($width*$height)/150; $i++ ) { imageline($image, mt_rand(0,$width), mt_rand(0,$height), mt_rand(0,$width), mt_rand(0,$height), $noise_color); } /* create textbox , add text */ $textbox = imagettfbbox($font_size, 0, $font, $code)

Is it possible mount two separate tmpfs filesystems during boot? -

when execute df command can see tmpfs mounted on /. need create directory in /etc, tmp , mount tmpfs on /etc/tmp. can adding entry in /etc/fstab saying tmpfs should mounted on /etc/tmp. yes, example (in /etc/fstab) tmpfs /etc/tmp tmpfs defaults,size=50% 0 0

iphone - How to redownload an in-App purchase application programmatically -

i able implement in-app purchase successfully. able purchase product through in - app purchase.i storing purchase information in nsuserdefaluts.so if next time user tries purchase same product again able handle locally.my problem if user deletes application device,how handle re-downloading of application without charging same product again.i know if application has been deleted device having in app purchase has downloaded again.can show sample code same? thanks aditya hi prompt reply.i have implemented same have suggested.what i'm wondering if delete app , install again , asked purchase again.do have pay again upgrade or handled apple server(i.e if upgrade same product again charged again?).is there way know upgraded without asking upgrade again? the storekit api takes care of , gives you, on request, list of identifiers of purchased items. once got those, it's re-download products again(if not bundled inside app). excerpt storekit api help: -(void)resto

Symbian, Java ME: determine if phone has touch screen -

is there way know code if phone has touch screen or not? i need smth if (phonehastouchscreen) enable_something() perhaps call canvas.haspointermotionevents() . bear in mind there 2 types of touch screen in java me; touch screen uses usual style pointer/softkey events, , style returns pointer co-ordinates when touch screen. usefulness on app, consider former not touch screen @ all.

css - Firefox adds extra width with padding -

i have question regarding css in firefox. if set width of floated div - lets 200px - setting padding-left 10px in firefox add 10px width. in ie not case. what can prevent firefox adding width div? it's not firefox that's problem, it's ie. ie not perform standards, there few tricks pain in ass: http://en.wikipedia.org/wiki/internet_explorer_box_model_bug the easiest way include valid strict doctype tag: <!doctype html public "-//w3c//dtd xhtml 1.0 strict//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-strict.dtd"> then rewrite css standards-compliant box model more doctypes here

r - How to create monthly ordered Periods from datevector without looping? -

while difftime class pretty straight forward use when want obtain yearly or daily differences between dates. monthly differences weren't straight forward me. since r standard arithmetic allows substraction of date objects looping through vector possible, here´s solution avoids looping: # generate reproducible example x<-seq(as.date("2010-11-15"),as.date("2011-05-20"),"months") y<-seq(as.date("2010-04-15"),as.date("2012-05-20"),"months") z<-seq(as.date("2012-08-15"),as.date("2013-05-20"),"months") d <- c(z,x,y) # function – suggestions welcome! getperiods <- function(datevector){ x <- floor((as.numeric(datevector)-as.numeric(min(datevector))) / 30) +1 return(x) } # returns vector of monthly ordered periods. is there better, more native way it? example can use seq() in combination lenght() somehow? not able because seq´s "to" argument not allow vectors. fee

winapi - WIN32 - Last user to login -

is there reliably way determine last user name login system? i've looked @ lsaenumeratelogonsessions() , lsagetlogonsessiondata() require elevation on vista , later (which i'm keen avoid). wmi has same problem (presumably it's calling lsa behind scenes). i've looked @ "software\microsoft\windows\currentversion\authentication\logonui\lastloggedonuser" in hklm, in testing that's unreliable , doesn't updated. i'm interested in console logons, rather fast user switching or ts logons. i've read various articles, have yet come solution. you might able use audit logon events - requires service have user access right see security log, not full administrator. eventid 528 indicates logged on, you'd have find recent instance of this.

asp.net mvc - New window using asp mvc in html form -

i building mvc app reporting. have page has form on contains multiple dropdownlist choose criteria report. have input button create report. button call new view same controller. new view gets values page criteria chosen parameters , uses populate it's own view model. working fine. i open reports in new window. when @ controller, of parameters supposed coming selection page null. assume have pass these in via querystring picked controller. there way can values of dropdownlists within viewpage construct querystring? is way accomplish trying do? better of using actionlink instead of input button? make difference? i hope makes sense. thoughts. just set target attribute on form _blank , should open request in new page/tab depending on browser being used. <% using (html.beginform(myaction, mycontroller, formmethod.post, new { target = "_blank" }) { %> <%-- ... --%> <% } %>

java - Can I marshal my own data structures with JAXB? -

i using own iterable structures - various binarytrees. can marshal them? it's quite easy marshal f.e. java.util.list implementations, in case, it's absolutely unacceptable. need use own structures, no internal containers whatsoever - memory chains (root.leftson.rightson etc.) in other words, possible marshall structure like: class binarytree<t> implements iterable<t> ? edit: structure supposed (for binarytree<person> ): <persons> <person> <name>john</name> <surname>black</name> </person> <person> <name>joe</name> <surname>blue</name> </person> </persons> so when add annotation structure like: @xmlelement private binarytree<person> persons = new binarytree<person>(); public binarytree<person> getpersons() { return persons; } ,it creates empty element <persons /> . tried @xmlelementwrapper annotations, won't take c

serialization - Dictionary in protocol buffers -

is there way serialize dictionary using protocol buffers, or i'll have use thrift if need that? people typically write down dictionary list of key-value pairs, , rebuild dictionary on other end. message pair { optional string key = 1; optional string value = 2; } message dictionary { repeated pair pairs = 1; }

.net - Suggestions to run a program every specific period of time -

there program crawls , index documents stored in sharepoint. need run every period of time. of suggestions had: transfering application windows service , schedualing run every period. having program trigger application every period of time. which of 2 ways consider more efficient. other suggestions pretty welcome. thank you. if program simple enough, use windows' task scheduler run periodically (your option #2). there no need write windows service this.

java - Can't start up: not enough memory with -Xmx30G -

i error message "can't start up: not enough memory" when run code "java -xmx30g examplecode". this error not happen when don't specify java virtual machine size. have clue why error message when set virtual machine size? if -xmx smaller 1g runs, if not got mentioned error message. thanks in advance help! and yes, there enough ram :) (72g available). btw, javahome /opt/jre1.6.0_20 the os can impose limit on how large process can be. example, in 32-bit windows, limit ~2gb, if machine has 4gb ram. check or os settings, , sure running jvm allowed (i.e. if you're on 64-bit system supports size process, sure run 64-bit jvm)

objective c - iPhone, how I hide a tab bar button? -

how hide individual tab bar button ? i've searched , not found anything, full bar. i've made progress still having problems, code in app delegate outlet tab bar, i'm calling within viewdidload of first view shown in tab bar. -(void)hidetabbutton { nsmutablearray *aitems = [[roottabbar items] mutablecopy]; (uitabbaritem *tabbutton in aitems) { if ([tabbutton.title isequaltostring:@"first"]) { [aitems removeobject:tabbutton]; break; } } [roottabbar setitems:aitems animated:yes]; [aitems release]; } but gives me error, seem possible otherwise why have setitems . terminating app due uncaught exception 'nsinternalinconsistencyexception', reason: 'directly modifying tab bar managed tab bar controller not allowed.' call stack @ first throw: heres full code, think i'm close. my sample project you need use setitems:animated: this. create array of buttons want keep on uitabbar , pass i

wpf - Layers issue using Z-Index -

i've 2 controls 1 on top of another: border on slider. on border user can mark segment appear in different color on slider. because border written after slider in xaml, appear on top of slider. , that's ok. problem is, thumb of slider appears under border. how can set thumb element (belong slider control , inside it) appear on top of all, , border appear on top of slider? tried use zindex without success. idea? in css: make sure elements positioned absolutely or relatively. z-index doesn't have play in layering unless elements positioned absolutely or relatively. should able set 1 with: z-index: 1; and other with: z-index: 2; and desired result. in wpf: use syntax specified here here's example: make sure both of elements in same parent, otherwise displayed in order in loaded.

optimization - Should I pass a commonly used array using a reference or by value in a game [C++] -

this simple, wanted feedback, guess. long story short super novice programming, , i've (about 6 months ago) started doing game programming, , it's going fine. can work , that, that's not question. instead, has passing objects. pretty pass same object or variable several times through game loop. so, cameras, camera used draw objects. first camera passed container object (like drawing frames of animation, animation object contains frames), passes individual object, draws. now, passes camera maybe 3 times max, it's no worry, yet. what more concerning similar multiple-passing array of tiles makes map. first array passed 'update' function of player or enemy, passed individual move , input functions check collisions, , in functions it's passed collision detection function. anyway, pretty happens object (in case, array of 100~1000 tiles) gets passed 4-5 times per game loop. wondering if should use constant reference instead of passing on , on again. pre

sql server - After Update Triggers and batch updates -

i have following trigger avoid updating column. alter trigger [dbo].[mytrigger] on [dbo].[mytable] after update begin -- set nocount on added prevent result sets -- interfering select statements. set nocount on; if update(someid) begin declare @id int, @newsomeid int, @currentsomeid int select @id = id, @newsomeid = someid inserted select @currentsomeid = someid deleted id = @id if (@newsomeid <> @currentsomeid) begin raiserror ('cannot change someid (source = [mytrigger])', 16, 1) rollback tran end return end end since i'm selecting inserted , deleted, work if updates table using clause encapsulates multiple rows? in other words possible inserted , deleted table contain more 1 row within scope of trigger? thanks... why not use instead of update trigger , join inserted , push