Posts

Showing posts from March, 2010

Featured post

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

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

animation - problem with jquery animate function help -

i had developed small animation using jquery. problem when animating div using flowing script $('#square').animate({left: -350+"px"},'slow'); it working great.. when replacing left right animation not working $('#square').animate({right: -350+"px"},'slow'); the above not animating any.. what might problem? thank you i'm not sure, might use left . so, use left: '350px' instead of right: '-350px' .

Excel unable to insert more than 255 chars? -

i using ole db driver insert more 255 characters excel sheet, error: exception details: system.data.oledb.oledbexception: field small accept amount of data attempted add. try inserting or pasting less data. seems this thread it's excel limitation. microsoft site seems here . so mean can't programmatically, can manually? because can enter more 255 characters when manually type them in excel. microsoft.ace.oledb.12.0(accessdatabaseengine.exe) driver limitation? the link refering to, 256 columns , not characters. 256 characters problem described here workaround: http://support.microsoft.com/kb/213841

asp.net mvc 2 - How to set a value for MVC2 Html.HiddenFor from ViewData -

i tried below method, not work: <%: html.hiddenfor(m => m.email, (string)viewdata["email"])%> <%: html.hiddenfor(m => m.email, new{value = (string)viewdata["email"]})%> plz adivce. in asp.net mvc data set controller. view there display data passed controller. recommend using typed views , view models instead of viewdata. public actionresult index() { var model = new someviewmodel { email = "foo@bar.com" }; return view(model); } and in view simply: <%= html.hiddenfor(m => m.email) %>

tfs - Adding a Team Project Collection in TFS2010 -

i’m trying add team project collection tfs2010 instance. instance has project collections set-up , in use, when try add warnings data tier configuration. warnings follows: tf255153: service not set start automatically: sql server database services: tf255437: error occurred while querying windows management instrumentation (wmi) interface on following computer: mytfsserver. following error message received: . tf255437: error occurred while querying windows management instrumentation (wmi) interface on following computer: mytfsserver. following error message received: . (tf255437 reported twice) i’ve had around, , found couple of articles implied tf255437 caused wmi compatibility not being enabled in iis (tfs2010 running on iis7.5). however, enabled far can tell. has come across either of these errors before? admin console seems happy me create tpc regardless, without understanding errors fully, i’m reluctant so. this caused "sql server agent" servi

c++builder - Building an STL application in Borland C++ Builder 5.0 -

i new borland c++ builder 5.0.i have used small stl application compiled in 1 machine(window 2003 server sp2), not in machine (windows xp machine sp3). have placed code snippet , error message error e2285 not find match 'distance<>(const ansistring *,const ansistring *,i nt) i have opened borland c++ form , added below code in form create #include <vcl.h> #pragma hdrstop #include <vector> using namespace std; using std::distance; static const ansistring text_fieldsintypen[]= { "code_segment_national_2" }; #include "unit1.h" //--------------------------------------------------------------------------- #pragma package(smart_init) #pragma resource "*.dfm" tform1 *form1; //--------------------------------------------------------------------------- __fastcall tform1::tform1(tcomponent* owner) : tform(owner) { } //--------------------------------------------------------------------------- void __fastcall tform1::for

sql server - stored procedure returning value -

using code : alter procedure [dbo].[get](@i int) begin declare @adate datetime select @adate = adate table i=@i , datediff(day ,getdate(), adate ) > 0 , adate not null order adate asc return select @adate end this returns 0 (or system 0 date time, not desired result data base). execute code declare @res datetime exec @res = 3 print @res why? stored procedures in sql server can return integers . if need return other single integer, should use 1 of these methods (some explained previous answers): use select in procedure use output parameter use user defined function instead

extend jquery draggable/droppable to support on iPad and iPhone -

i've been using jquery draggable/droppables in application last 1 year. now, application needs supported on ipad , iphones. known, above jquery won't support drag/drop on ipads... i'm looking jquery plugin or can connect existing jquery codes drag/drop on ipad. after googling, found alternate ways like, jqtouch, jquerymobile etc.. but, looks need massive changes (or, write complete drag/drop things scratch) in application :( my application heavy , hence looking quick/easy way connect existing jquery solution ipad touch events etc.... please help thanks in advance this project allow use jquery ui on ipad: http://code.google.com/p/jquery-ui-for-ipad-and-iphone/

tcp - Can I send an ACK response to a successfully received SYNACK using BSD raw sockets? -

my code tries manually establish tcp handshaking, , then, sends data segment requesting resource via http get . i'm using raw sockets craft headers , send packets, , libpcap in order check received packet headers. the syn sent receiver, replies me synack . @ point far works, when receive synack , try ack it, , send http get next, doesn't work. can see headers ok in wireshark. so questions are: can ack synack via raw sockets receive using same socket used send syn ? , there required options go along headers in order accomplish that? i'm acking synack , , after send segment ack , psh flags set in order request resource via http . can see them both on wireshark, don't response server. there's no reason can't ack using raw sockets, os's kernel stack see received synack isn't expecting , send rst . doing prevent happening? otherwise, maybe aren't sending right seq/ack numbers.

.net - Is there a way to declaratively set ServicePointManager's ServerCertificateValidationCallback property from *.config file? -

i looking way disable cert validation in declarative way. usefull i.e. when using svcutil.exe. so far know how disable hostname validation: <system.net> <settings> <servicepointmanager checkcertificatename="false" /> </settings> </system.net> but not sufficent. i've seen claiming can done, wihtout sample. i'm using ugly hack using in unittests :( app.config: <system.net> <webrequestmodules xdt:transform="insert"> <clear/> <add prefix = "http" type = "httprequestcreatorwithservercertificatevalidationcallback, testhelpers"/> <add prefix = "https" type = "httprequestcreatorwithservercertificatevalidationcallback, testhelpers"/> </webrequestmodules> </system.net> httprequestcreatorwithservercertificatevalidationcallback.cs public class httprequestcreatorwithservercertificatevali

how to change image name while uploading into folder in coldfusion -

implementing application in coldfusion in whis have store image user defined name not actual name, able store image folder actual name not user defined name ,i have upload image folder named "user_images", how can change actual name user defined name. better if 1 provide code. thanks yugal you can provide specific file name when upload file using cffile tag. whatever filename use in destination attribute used save file.

Python home directory in Windows / Problem with multiple versions -

i'm using python 3 developing , collabnet subversion edge versioning software. subversion edge comes little program called viewvc written in python 2, directly bundled it. there system environment variable called pythonhome. if set python 2 distribution subversion edge, python 3 won't start (not idle), instead giving runtime error messagebox. if set python 3, viewvc doesn't work. is there way make both work @ same time? you shouldn't need set pythonhome @ all. python uses (if set) locate installation. typically, should able locate without variable, well: looking @ path name of python executable, and, failing that, looking registry.

PHP/MySQL Show first X results, hide the rest -

does know how bring in of mysql tables' results, show first x, (say 10), , hide rest using jquery? need know how show first x results in 1 page, rest in seperate page using href. my aim show first 10 results, provide link @ bottom of page allowing user show of results. thinking hyperlink re-execute query thought easier show/hide using jquery.thanks actually searching pagination. there useful jquery paginations plugins: jquery pagination plugin datatables plugin or using php: pagination in php

windows - Oracle tns listener error -

i've installed oracle 10g when try connect oracle db error: could not start oracleorahome92tnslistener when got services , try start it, says file doesnt exist. service file c:\oracle\ora92\bin\tnslsnr (tnslsnr file not directory) c:\oracle\ora92\bin\tnslsnr doesn't exist on machine @ all. know how it? could not start oracle ora92 listener service on local computer.error 2: system cannot find file specified here's couple of issues see. installed 10g error 9.2 error. computer had oracle 9i on mis-configured or uninstalled , leading error. you need check disk , find oracle_home (directory) oracle 10g installed. once find can adjust path , oracle_home , tns_admin environment variables point right place. should allow start database , listener. if need install oracle client 10g information below helpful well. the oracle client can installed separately. go address, download client , unzip subdirectory , run oracle universal installer runnin

javascript - Adjusting the position of FB.ui() dialog box -

i'm using fb.ui() post update user's wall dialog appears in same spot in browser (center middle if scrolled up). problem i'm opening dialog bottom of screen. there way dialog show user's current scroll location? the fb.ui() dialog should positionned relative place user scroll is. if not, can position #fb-root in css : #fb-root { position:fixed; top:10%; } that way, pop-in on scroll position of user , follow if continue scroll or down page.

rest - Retrieving Client Information on the Server-Side via WCF -

i'm using wcf build rest-based services. these services connected via client-side silverlight , java applications. know information requester. question is, class exposes requester information in wcf , how access it? i know in asp.net can use httprequest. can more details via httprequest.browser property. i read this: weboperationcontext.current.incomingrequest where should info clinet , http request headers. hope helps.

c# - How to programmatically add a custom component to Visual Studio toolbox? -

i creating installer custom ssis component have written. add custom component automatically, rather asking user manually add it. i'm trying this code: public void addtoolboxitem(string toolboxtabname, string toolboxitemname, string toolboxitempath) { type dtereference; envdte.toolbox toolbox; envdte80.toolboxitem2 addedtoolboxitem; // reference visual studio development environment. dtereference = type.gettypefromprogid("visualstudio.dte.9.0"); if(dtereference != null) { // reference toolbox of development environment. envdte80.dte2 dte = (envdte80.dte2)activator.createinstance(dtereference); toolbox = (envdte.toolbox)dte.windows.item("{b1e99781-ab81-11d0-b683-00aa00a3ee26}").object; // loop through tab pages find toolbox tab page specified // in toolboxtabname parameter. foreach (envdte80.toolboxtab2 toolboxtab in toolbox.toolboxtabs) { // right toolbox? if(string.compare(toolboxtab.name, toolboxtabnam

Eclipse, JDT: Find a file on the classpath knowing its fully qualified name -

given name ch/mollusca/sample/snippet.xml , there easy way hold of file in jdt code, when located in projects classpath either source file or inside jar? the file may inside project, referenced one, i'm trying hold of actual file behind name. this specific java projects, it's possible hold of ijavaproject if helps. this not answer want, it's best can (and since question has 2 days, might has throw this): eclipse corner articles: abstract syntax tree eclipse jdt - abstract syntax tree (ast) , java model - tutorial these 2 great articles point right direction.

javascript - initialization of dojo widget -

i tried create custom widget site. when loaded page says: mixin #0 not callable constructor. clsinfo.cls.prototype undefined can't find information clsinfo, don't know it. maybe problem use dojo google: and own script located on localhost. when dojo on page initializes goes wrong script. can't find info on dojo, maybe search in wrong places? please me resolve problem i ran when trying override dijit.dialog bind events controls within it. we've yet see if binding part work, if @ source, happens when 1 of bases passed in second argument fails resolve "[object function]". in case, passing string in. dojo.declare takes 3 arguments: the name of custom object "class" you're building an array of base classes, parents provide functionality ( not string names of classes) a hash of functions , declarations so if want override dijit.dialog, have do: dojo.declare("mydialogtype", [dijit.dialog], { function1() {/*c

MSMQ Message Viewer? -

Image
i have messages in msmq queue , view full message. i know can write code peek queue, wondering if there viewer exists let me read entire message? there few options - found commercial (not terribly expensive, not free, either): mqueue viewer (free) mulholland q set queueexplorer

iphone - Application crashes after installing iOS 4.2 -

i installed ios 4.2 ipod after application started crash. the scenario is: launch application wait until it's , running hit ipod home button launch application again, application starts again seconds crashes. my application job search engine, in of navigation pages it's communicating internet server. i think problem has applicationdidenterbackground, applicationwillenterforeground, or applicationdidbecomeactive methods. not have code in these methods , not know if need to, prevent crash. i not understand happens after hit home button , application goes background: will still running in background (because of multithreading thing in ios4.2). sometimes when relaunch application goes last page left in before hitting home button , sometime starts home page. i not understand what's going on, want every time starts start in home page. i submit application apple store before updated ios4.2 , crash starts happen. i'd appreciate if can me issue i'm not a

Mysql column with null values - what are the space requirements? -

i have table quite lot entries. need additional column integer value or null. thing few rows have field populated. so wonder whether better create seperate table link entries in 1:1 relation. i know 1 integer entry takes 4 bytes in mysql/myisam. if have column set allow null values, , 100 of 100 000 rows have field populated, rest still consume 4 bytes every null value? or mysql intelligent enough set value populated , regard null, nothing set? this depends on row_format value give when create table. before version 5.0.3, default format set "redundant" : fixed-length field use same space, if it's value null. starting version 5.0.3, value set "compact" : null values never use space in database. you can alter table sure use correct format : alter table ... row_format=compact more details here : http://dev.mysql.com/doc/refman/5.1/en/data-size.html

ios - HTTP live streaming with encryption -

i trying understand how http live streaming protocol apple supports on ios devices on safari protects key unlocks content. the way understand it, .m3u8 file holds whole thing , references content (in mpeg2 ts container, aes 128 encrypted) , key ts file. like in example: #extm3u #ext-x-media-sequence:7794 #ext-x-targetduration:15 #ext-x-key:method=aes-128,uri="https://priv.example.com/key.php?r=52" #extinf:15, http://media.example.com/filesequence52-1.ts #extinf:15, http://media.example.com/filesequence52-2.ts #extinf:15, http://media.example.com/filesequence52-3.ts #ext-x-key:method=aes-128,uri="https://priv.example.com/key.php?r=53" #extinf:15, http://media.example.com/filesequence53-1.ts assuming browser based playback <video> element fed m3u8 file in "src" attribute. in case, if key delivered via https, how can make sure user not enter https url in browser , saves key hard drive? way understa

jQuery and iframes and weird positioning: is there a workaround? -

i've got draggable thing outside iframe, , droppable target inside it. here i've shown iframe containing snippet of html loaded src attribute. <div id="draggables"> <img src="drag-me.gif"> </div> <iframe src="iframe-src.html" id="iframe"> <!-- html gubbins --> <div id="droppable">&nbsp;</div> <!-- more html gubbins --> </iframe> i use jquery (ui draggable/droppable) stuff: $("#iframe").load(function() { var $this = $(this); var contents = $this.contents(); contents.find('#droppable').droppable({ drop: function (event, ui) { alert('dropped'); } }); $('#draggables img').draggable(); }); the draggables become draggable , droppable drop target. problem landing zone drop area not displayed on screen. is, alert fired when draggable dropped somewhere above drop target, , not on target itself.

java - Dynamic update of Spinner2 based on choice in Spinner 1 -

in using code (adapted here ) following error: the constructor arrayadapter(new adapterview.onitemselectedlistener(){}, int, string[]) undefined can correct this? thanks private void setdynamicspinnerbe() { bespinner = (spinner) findviewbyid(r.id.spbe); final string[] itemsspinner2; lensspinner.setonitemselectedlistener(new onitemselectedlistener() { public void onitemselected(adapterview<?> parent, view view, int position, long id) { integer focallength = (integer) parent.getadapter().getitem( position); itemsspinner2 = getbellowsextension(focallength, maxbellows, precision); arrayadapter<charsequence> beadapter = new arrayadapter<charsequence>( this, android.r.layout.simple_spinner_item, itemsspinner2); beadapter .setdropdownviewresource(android.r.layout.simple_spin

php - Session issue with unset() and the browser back button -

i'm using session variable set pre-allocated record id postgres (getting record id sequence) using pear's db nextid() . set id session variable because of scoping issues in legacy code i'm working with. after insert happens use unset() remove session variable (this clear used record id). there more information in session remains intact, it's next_id element being removed. pseudo code: // next id , set session $_session['next_id'] = $db->nextid(); ... more code here // after insert unset($_session['next_id']); my question is, clicking button on browser somehow reset session variable $_session['next_id'] ? maybe causing null? how cache handle session after element has been removed user has returned previous state? edit: reason question code in production randomly (by user) trying insert null record id (which next_id session). trying debug process code minimal, reviewed peers , has stumped us??? edit 2: wow guess there issue how

CK metrics from C# project with Ndepend -

i have project school. need make report of metrics ck (chidamber kemerer metrics). report has table of metrics. question how make ndepend report generates not looking for. please , how it... maybe tips, documents or important... ok, if talking of these chidamber kemerer metrics , ndepend ability write code queries , rules on linq queries (cqlinq) answer needs. example: wmc weighted methods per class warnif count > 0 t in application.types let methods = t.methods .where(m => !m.ispropertygetter && !m.ispropertysetter && !m.isconstructor) methods.count() > 20 orderby methods.count() descending select new { t, methods } dit depth of inheritance tree warnif count > 0 t in justmycode.types t.isclass let baseclasses = t.baseclasses.exceptthirdparty() baseclasses.count() >= 5 select new { t, baseclasses, // metric value depthofinheritance takes account // of third-pa

actionscript 3 - Flex Smooth Drag of Objects -

i'm trying create object can moved in flex 4. i tried http://help.adobe.com/en_us/flex/using/ws2db454920e96a9e51e63e3d11c0bf64595-7fed.html in examples leaves actual object (at pause) until drag completed, i'm looking update done/shown while drag still on ... in lines i've tried: problems replicating drag-and-drop mouse events ... here dint understand 'what mousehelper & eventhelpers'. also tried this: flash as3 custome dragging using mouse_move event movement not smooth, jig-jag. any suggestions welcome. regards here's an example 5 ways of dragging (four commented out): * mouseevent.mouse_move * event.enter_frame * startdrag(true) * timer(10) sets x = mousex   y = mousey every 10ms * timer(100) creates tween mousex, mousey instead of applying values if move mouse fast enough of modes (at 30fps) if sprite chasing mouse cursor, not being dragged, , animation not smooth @ all. smoothest animation provided

Silverlight TextBlock Binding to SelectedItem in ComboBox -

i have combobox bound collection of clr objects. each item in combobox displayed via datatemplate. datatemplate contains image , title associated item. after user clicks item in combobox, want display selected items title in textblock in screen. my question is, how bind text property of textblock title property of item selected in combobox? thank you! assuming called combobox "combobox1" use- <textblock text="{binding elementname=combobox1,path=selecteditem.title}"/>

php - How to display text on multiple lines? -

i using radphp build php application. want display several independent lines of text in edit control (using $this->edit->text property ) seems impossible. if use \n displays instead of braking line in two. ps: can add 'radphp' tag question? i have no experience on radphp, instead of \n character, try using <br/> break lines two.

algorithm - Fastest primality test -

could suggest fast, deterministic method usable in practice, testing if large number prime or not? also, know how use non-deterministic primality tests correctly. example, if i'm using such method, can sure number not prime if output "no", other case, when output "probably"? have test primality manually in case? thanks in advance. the deterministic, polynomial-time algorithm primality testing know of aks primality test ( http://en.wikipedia.org/wiki/aks_primality_test ). however, there lot of randomized primality tests fast , have extremely probability of success. work finding whether number composite exponentially probability, they'll either report number composite or require "maybe" confidence.

c# - Shortening Really long Client ids -

i'mm getting long client ids 1 such example below. of them 100 characters long ridiculous. there or tool can use shorten pages ids? id="ctl00_ctl00_maincontent_membermain_abc_asdsad...._dlsadasdasdasd_ctl00_pnsadasdasdnshf" edit: nesting lot cause of problem. using .net 3.5. , collisions not ok of ids being used javascript funcitons if using asp .net 4, can set clientidmode static. have make sure control ids in hierarchy unique. see this .

jquery - javascript test if div has text in it -

1. <div id="div_msg"> test div </div> 2. <div id="div_msg"> </div> in first instance there text in div. in second instance there no text. using javascript how can tested if div has text in it. if using jquery, can this: if($.trim($('#div_msg').text()) != "") { // code here } in plain javascript, this: if(document.getelementbyid("div_msg").innerhtml.replace(/^\s*/, "").replace(/\s*$/, "") != "") { // code here } both cases text , trim whitespace off beginning , end of string, compare empty string.

multithreading - Windows App. Thread Aborting Issue -

i'm working on application has make specific decisions based on files placed folder being watched file watcher. part of decision making process involves renaming files before moving them off folder processed. since i'm working files of different sizes created object checks file in seperate thread verify "available" , when fires event. when run rename code inside available event works. public void renamefile_test() { string psfilepath = @"c:\file1.xlsx"; tgt_file target = new fileobject(psfilepath); target.fileavailable += new fileeventhandler(onfileavailable); target.fileunavailable += new fileeventhandler(onfileunavailable); } private void onfileavailable(object source, fileeventargs e) { ((fileobject)source).renamefile(@"c:\file2.xlsx"); } the problem i'm running when extensions different source file , rename file making call conversion factory returns factory object based on type of conversion , converts fi

apache - Can someone look into a web servers folders? -

more web server security question. is possible "probe" folder on web server, if index file in place? i assume can't, if wanted store .pdf applications random names (93fe3509edif094.pdf) want make sure there's no way list pdfs in folder. thank you. just disable directory listing in web server

c# doing a custom sort on a datatable -

i have data in datatable needs sorted on first column way: a02 blank0010 d02 blank0007 b04 blank0011 g05 blank0012 c06 blank0014 e08 blank0013 f10 blank0016 h12 blank0015 b02 g112486 c02 g125259 e02 g125257 f02 g112492 g02 g125095 h02 g112489 a03 g125090 b03 g112499 c03 g125256 d03 g002007 e03 g112494 f03 g002005 g03 g112495 h03 g002008 a04 g115717 if regular sort, sort this: a02, a03, a04. need a02, b02, c02... etc how can this>? here code far: dataview view = dt.defaultview; view.sort = "position"; you'll want custom sort. see following question hints: dataview.sort - more asc/desc (need custom sort) you might want break first column 2 separate columns.

C# and ASP.NET custom property attributes and determining if properties changed -

i working on project want keep history of particular object. on save want method on object determine if has changed can call method save current state history. e.g. populate form object user makes changes (or possibly not) , submits from. want take original object , copy of object has been updated form , determine if has changed @ all. additionally may decide @ point properties don't matter (e.g. if name changes won't track it). i'm thinking easiest/most flexible way accomplish if give properties care custom attribute [changetracked] , use reflection list of properties attribute , loop through them comparing a.property == b.property determine if have changed. would work? there better/easier way handle this, sort of built in method can add object determine if values of properties have changed? whatever solution psudo code appreciated. point of clarification solution needs determine if value care has changed not if has been assigned since created i.e. if set name=&quo

How to pass an array of structure as [in, out] paramenter in COM interface definition -

i'm having problems in passing array of structures in definition of com interface. example, i'm trying define series of variables ids in 1 read function , i'm expecting reply function (the same function) bring array of values corresponds defined variable ids: [helpstring("method readvariables")] hresult readvariables([in] variant varids, [out] _valstruct* retvals); for _valstruct, definition is: struct _valstruct { int varid; double varval; int timestamp; double funcid; .... } i'm not familiar com , know basic types, such int, double, etc... sincerely experts here give me detailed example code or related information. appreciated... thanks!!! man, it's been ages since did that! anyway, according code have dug 2002, used safearray .. maybe vb interoperability, so: [id(9), helpstring("method keys")] hresult keys([out, retval] safearray(comint128)* pkeys); you can use api functions such safearrayallocdescr

Using CSS selectors to access specific table rows with selenium -

if have following html: <tbody id="items"> <tr><td>item 1</td></tr> <tr><td>item 2</td></tr> <tr><td>item 3</td></tr> <tr><td>item 4</td></tr> <tr><td>item 5</td></tr> <tr><td>item 6</td></tr> </tbody> how use css selectors selenium access item 4(or item wanted)? you can use nth-child selector: #items tr:nth-child(4) {color:#f00;} live example: http://jsfiddle.net/flack/g8qpb/ but no idea if works selenium. but according docs should. currently css selector locator supports css1, css2 , css3 selectors except namespace in css3, pseudo classes(:nth-of-type, :nth-last-of-type, :first-of-type, :last-of-type, :only-of-type, :visited, :hover, :active, :focus, :indeterminate) , pseudo elements(::first-line, ::first-letter, ::selection, ::before, ::after).

BST Supernodes Generation in C/C++ -

how can generate binary search tree supernodes in c/c++? obtain reference describing data structure. http://www.cise.ufl.edu/~sahni/papers/super.pdf implement data structure in c/c++.

image - Photo as website home page background dimensions? -

hope question ok on stackoverflow. want use photo background homepage of website. photo take entire page. don't know resolution should make photo. thinking 1920 x 1200px people 24 inch screen don't see 'ends' of photo. big enough? i'm worried site looking ok on screens larger 24 inches. also know how should optimize photo loads fast possible? thanks. overall, seems question of trade-offs. better resolution, slower page load do-nothing page. worth slow-down have better resolution , avoid pixellation? also, think you're asking wrong question, since 24-inch screen can in multiple resolutions. i approach in following manner: what largest resolution must have photo "good" on? make photo resolution. if 24" target, @ resolutions size monitor "typically" supports , target that. what number of colors want? (or perhaps b&w / grayscale). if reduce number of colors (preferably "web-safe" colors), can lo

python - nth word in a text -

how can find nth word in text. example: my_txt("hello all" , 3) i don't wanna use built in function ...and not homework :d ok asked this. need "split words" function. here is. assumes "words" delimited whitespace. no built-in functions, no imported anythings, no methods of built-in types, not panty-waist stuff += . , it's tested. c:\junk>\python15\python python 1.5.2 (#0, apr 13 1999, 10:51:12) [msc 32 bit (intel)] on win32 copyright 1991-1995 stichting mathematisch centrum, amsterdam >>> def mysplit(s): ... words = [] ... inword = 0 ... c in s: ... if c in " \r\n\t": # whitespace ... inword = 0 ... elif not inword: ... words = words + [c] ... inword = 1 ... else: ... words[-1] = words[-1] + c ... return words ... >>> mysplit('') [] >>> mysplit('x') ['x'] >>> mysplit

Converting a string into a key->value array in PHP -

if have string of key->value pairs in following format: mime-version: 1.0 from: "tim lincecum" reply-to: "tim lincecum" return-path: "tim lincecum" content-type: text/html; charset=iso-8859-1 subject: giants win world series! how array such arr['from'] = "tim lincecum", etc i know there's explode() function, delimiter see (colon) in middle of key , value rather between each pair. how can approach this? since did guess in comments - think need repeat here answer: there newlines between parameters, with $parameters_pairs = explode("\r\n", $parameters_string); you can split name-value pairs, separated colon.

asp.net - Converting Declaractive PrincipalPermission to Programmatic .Demand -

i have 2 roles this: [principalpermission(securityaction.demand, role="domain\admin")] [principalpermission(securityaction.demand, role="domain\anotherrole")] the problem inherited code specific domain, , want roles web.config file, can work on vm not in domain. i have seen example this: principalpermission permcheck = new principalpermission( null, @"domain\admin"); permcheck.demand(); since throws exception if user not in role, how change example allow either of 2 roles? use multiple iprincipal.isinrole() , throw own exception, seems there way use .demand method multiple roles. update 12/21: sample code based on union link ladislav's answer below: principalpermission ppadmin = new principalpermission(null, @"domain\admin"); principalpermission ppanother = new principalpermission(null, @"domain\anotherrole"); (ppadmin.union(p

winapi - Executable version isn't fully displayed in Windows 7 shell -

according winapi executable files may contain resource section. 1 of common resource types version info ( versioninfo ). consists of fixed part, plus may contain arbitrary number of string entries (pairs of name + value). my build environment arranged whenever build executable - version info automatically adjusted reflect current state of source control. contains build information. until last month, when still worked on old-good xp machine, right-click such executable, select properties/version, , - voila! see build information. i've upgraded machine windows 7. and, discovered, doesn't show rich version info anymore. shows fixed version info part. does know if can fixed? perhaps there exist option somewhere enable former version info tab? p.s. rich version info is there, it's not build problem. can see when open file resource editor. thanks in advance. upd: what mean "rich version information". http://msdn.microsoft.com/en-us/library/ms64700

Macros script Excel, filling in blanks with NULLS, error 400 -

all i'm trying fill in null in cells blank. source code: sub fillnulls() dim count integer count = 0 dim col integer col = 2 while count < 23403 if (cells(count, col) = "") cells(count, col) = "null" end if count = count + 1 wend end sub i run macros , 400 , okay button. can spot issue i guess count should 1 @ first before while loop

mysql - what some ways to mask a mysqldump? -

anybody knows efficiency in masking(anonymization) of tables in mysqldump? have finished parser unfortunately doesn't work on big dumps (let dump of 1gb++) because increases dump time due parsing. what did parse table columns first (which shouldn't take long) , parse whole insert string specific table. i using ruby , use if possible. i looked idea of exporting dump, dumping it, updating (masking) through internal ruby code exporting dump again. although haven't tried how long going take. the current workflow be: dump server, uncompress, dump mysql the new 1 dump server, uncompress, masked confidential data , dump mysql the current workflow take @ 2 hours 1-2gb++ dump unfortunately spent 4hrs on new 1 still not finished on parsing/masking part. i advised improvise code taking out variables , things consumes more memory since ruby gc said not on 1:1 ratio. believe optimized on ree(ruby enterprise edition) using ree now. has done , maybe share thoughts? tha

wpf - How to make textbox resize as the window resize -

any property set make textbox resize according window size? layout in wpf heavily influenced parent container. example, if creating form labels , input fields, consider using grid panel. controls in wpf default resize according layout behavior of parent. here example of window 2 labeled text boxes , 2 buttons resize along window. <window> <grid> <grid.columndefinitions> <columndefinition width="auto" /> <columndefinition width="*" /> </grid.columndefinitions> <grid.rowdefinitions> <rowdefinition height="auto" /> <rowdefinition height="auto" /> <rowdefinition height="*" /> </grid.rowdefinitions> <label content="contact name" grid.row="0" grid.column="0" /> <textbox grid.row="0" grid.column="1&q

wpf - How to make data grid autoscrolling? -

after adding other elements in grid, found data grid no longer auto scrolling. want know how make data grid autoscrolling in case. check below link , see if solves problem how can enable scrollbars on wpf datagrid?

High-level level language for image processing -

my final year project group planning build real time application neural network support , need handle image processing efficiently, language suggestions helpful. thanks. my suggestion opencv , c++. opencv usable python, don't recommend if need write fast code, python can slow.

how to save android application's global data to SavedSate -

we know how save activity's state savedstate via onsaveinstancestate before killed. when application has global data used activities. not have method save global data. when application killed on backgound. you can consider storing data in shared preferences. data persist across activites. check using shared preferences.

Trace.WriteLine in ASP.NET Azure -

when use diagnostics.trace.writeline("message", "information"); in azure-asp.net not show in azure compute emulator, if same worker-role works, idea why? thanks! this sdk 1.3, right? in 1.3, web roles default run full iis, means actual web app code in different app domain roleentrypoint. believe compute emulator shows messages roleentrypoint (webrole.cs or workerrole.cs). to double check, try putting trace message in onstart in webrole.cs; i'm guessing show up.

winapi - How to read memory values using VBScript? -

i want use vbscript read values directly out of memory of running application. can't seem find information on using readprocessmemory() in vbscript. i intend use in quick test pro screen scraping of application needs testing. application not use standard controls , using qtp's ocr abilities not provide reliable results. we have code written in autoit reads values of application directly memory , converts ascii. want remove reliance on , using vbscript within qtp ideal. so can tell me how can read values executable in memory using vbscript? you can't in vbscript directly. josh einstein's comment above mentions, it's impossible call native windows api functions directly vbscript. there 2 major reasons why case. first, pose obvious security risks code written in such scripting language able call native code directly. , second, vbscript has 1 data type ( variant ), not going work return values of of windows api functions. instead, you'll hav

c# - Is there any way to disable the JSON ModelBinder in ASP.NET MVC 3 RC2? -

in asp.net mvc 3 rc2, default modelbinder automatically parse request body if content-type set application/json . problem is, leaves request.inputstream @ end of stream. means if try read input stream using own code, first have reset beginning: // client sends http request content-type: application/json , json // string in body // requestbody null because stream @ end var requestbody = new streamreader(request.inputstream).readtoend(); // resets position beginning of input stream var reader = new streamreader(request.inputstream); reader.basestream.position = 0; var requestbody = reader.readtoend(); since i'm using json.net serialization/deserialization, i'd disable default modelbinder doing parsing. there way that? you can put following in application_start in global.asax: valueproviderfactories.factories.remove( valueproviderfactories.factories.oftype<jsonvalueproviderfactory>().first()); this assumes there 1 of type (which default

php - Failed to load resource - ajax file upload with Zend Framework -

i using ajax uploader handle image uploads in zend framework based project. ajax uploader takes path controller handles file upload yet when click button attached see "failed load resource" in firebug's console , resource listed file upload controller. here how call ajax uploader: new ajaxupload('addphoto', { action: '/admin/pix/upload', name: 'photo', autosubmit: true, onchange: function(file, extension) { // sets data , checks few things... reached in code }, oncomplete: function(file, response) { // fires after completion... reached in code }, onsubmit: function(file, ext) { // fires after submit... reached in code } }); when try upload photo (in firebug's console): failed load resource admin/pix/upload

iphone - How to achieve this font appearance? -

Image
how can acheive font this? it's name below icons on ios platform. helvetica, , how can achieve soft shadow has in code? in advance! reposting comment here requested: this answer may help. as discussed in comments, font indeed helvetica, at least on standard-resolution devices . i'm not sure if it's neue helvetica on retina display devices.

How can we know a new contact is Added to Android? -

hello guys m using following code open android add contact page , intent intent1 = new intent(intent.action_insert); intent1.settype(contacts.content_item_type); intent1.setdata(contactscontract.contacts.content_uri); startactivityforresult(intent1,300); but result code sends -1 inside onactivityresult function want have contactid of newly added person , how can this? when there error in adding contact the contacts database return -1 else returns contactid of contact. try using following code: intent intent1= new intent(intent.action_insert, contacts.content_uri); startactivityforresult(intent1,300);

Android Pie Chart Legend -

i can draw pie chart using this: http://blog.gafmediastudio.com/2010/04/01/draw-a-pie-chart-with-android/comment-page-1/#comment-1340 but want show pie chart legend in pie chart view. can help? so, you'd place legend left or right of chart? why don't add necessary stuff in ondraw(canvas canvas) method? e.g. draw rectangle strings in it.

javascript - Convert "pt" to "px" using regular expression -

in wysiwyg editor, have <table style="width: 162pt; border-collapse: collapse" border=0 cellspacing=0 cellpadding=0 width=216> i can convert to <table style="width: 162px; border-collapse: collapse" border=0 cellspacing=0 cellpadding=0 width=216> using "wysiwygdata".replace(/pt/g ,"px"); is there way change associated value of pt value of px using regex. 162pt might 162*96/72px. looking help. you can use regular expression this, feed function string#replace : s = /* ...the data... */; s = s.replace(/([0-9]+)pt/g, function(match, group0) { return math.round(parseint(group0, 10) * 96 / 72) + "px"; }); live example when supply function second argument of replace, gets called each match, complete match first argument, , value of capture groups subsequent arguments; return value used replacement. above i'm using capture group capture number, , doing math , returning new string. you mi

android - Unable to run imported project -

i have few projects tested working in 1 pc. i've since moved windows xp pc, , i've setup development tools on xp system. i've downloaded , installed following in order: 1. eclipse classic 3.6.1 2. jdk v6(jdk-6u23-windows-i586.exe) 3. android sdk tools rev8(installer_r08-windows.exe) 4. sdk platform v2.3/2.2, google apis, android api8, rev2, google usb driver, rev4 5. adt 8.0.1 i created new empty project make sure things working, , seem able new project run on emulator fine. however, when imported existing project workspace, bunch of errors, such as: "the import java.util cannot resolved" "the import android cannot resolved" when @ project properties->java build path, shows "unable system library project" under "libraries" , "order , export". what's wrong? i've tried copying , pasting .java files , main.xml files imported project new project, , runs correctly...but somehow imported project doesn&#

gps - Detect a speed in android -

is possible detect speed of car using gps or accelerometer in android phone ? can give me road map implement ? yes, it's possible using gps via object of location class. there getspeed() method in class. it's easy find code of getting location. check this link example.

java - Reading binary file without knowing file format -

i'm working on java project , have read files these: - entryid.data - entryid.index - keytext.data - keytext.index ... i think these files used in dictionary project can't find document this. how can read them or know format of them ? sorry english =.= thanks alot! this looks files database management system. 1 file store data, 1 store @ least 1 index speed queries. i'd start hex editor , @ file. sometimes, content binaries gives hint. another idea: @ classpath , inspect property , resource files. maybe you'll find database driver or config files jdbc connect strings. google told me, that 4 files used apple's dictionary.app . have @ blog , can point in correct direction. last note - reading undocumented binaries challenge. start 010 editor analyse datastructure , develop java based test tool read data. it's sort of try , error evolutionary process.

bash - Save stdout, stderr and stdout+stderr synchronously -

for testing purposes, save stdout , stderr separately inspection subsequent code. example, test run erroneous input should result in output stderr, nothing on stdout, while test run correct input should result in output stdout, nothing stderr. saving has synchronous, avoid race conditions tests (so can't use process substitution ). to able debug test after fact, also need see stdout , stderr in sequence output. have either save them both same file/variable/whatever or send them terminal @ same time saving them separately. to test error happened, also need exit code of command. for reasons of efficiency , accuracy, of course cannot run each test twice. is example possible redirect stdout stdout.log, stderr stderr.log, and both of them output.log in same command? or use synchronous tee command separately stdout , stderr? or save copy of stdout , stderr separate variables? update : looks tim's solution works (modified output on terminal instead of logging all.l

jQuery compatible JavaScript documentation generator -

i need choose documentation generator (similar jdoc in java or rdoc in ruby) javascript project (built jquery, underscore , backbone) candidates: jsdoc toolkit pdoc natural docs docco yui doc doctool http://jquery.bassistance.de/doctool/doctool.html other ? requirements should work jquery, underscore , backbone. means object-literal methods etc i really pdoc centered around prototype, poorly documented, , don't want make files (sections?) make work (not sure this) docco nice want structured output (as in menu + class/func structure jdoc) must command line/makefile compatible (not web pastie) tips, tricks, tutorials, success stories, advice welcomed. why doesn't jquery use jsdoc? i rate jsduck sencha on top. have used on many projects. simple use https://github.com/senchalabs/jsduck a single command generate docs http://docs.sencha.com/touch/2-0/

variables - What does this php code means -

hello new php , don't know exactaly code means $de = array('Ä'=>'ae','ä'=>'ae','Ü'=>'ue','ü'=>'ue', 'Ö'=>'oe', 'ö'=>'oe', 'ß'=>'ss'); strtr($str, ${$de}); the thing need know ${$de} mean? it's variable variable , 1 of intriguing part of php implementation. sometimes usefull, confusing: $bar = "a"; $foo = "bar"; $world = "foo"; $hello = "world"; $a = "hello"; $a; //returns hello $$a; //returns world $$$a; //returns foo $$$$a; //returns bar $$$$$a; //returns $$$$$$a; //returns hello $$$$$$$a; //returns world ....

asp.net - Disabled all the records book button in gridview1 whose name column values is sumit? -

Image
i have textbox1 default text sumit , gridview records , button field in each row .. on page load event i want if textbox1 text sumit .... records in gridview1 name column values sumit .... rows book button disabled , rest of remain in enableed form ... i m using visual studio 2008 vb is coding right : ? protected sub gridview1_databound(byval sender object, byval e system.eventargs) handles gridview1.databound each myrow gridviewrow in gridview1.rows 'find checkbox dim lab1 label = directcast(myrow.findcontrol("label1"), label) if lab1.text = "sumit" 'find delete linkbutton , hide dim deletebutton button = directcast(myrow.findcontrol("button1"), button) deletebutton.enabled = false end if next end sub but coding doesn't disabled button .... in rows name field sumit in grid view item data bound eventhand

php - How to make a site in malayalam language? -

i want create website. contents must displayed in malayalam language. in admin panel can edit malayalam contents of site also. how can that? please share ideas me. me on this, how create kind of content editor? it no different other kind of website. need make sure character encoding being used supports characters need. modern websites should use unicode encoding (such utf-8) should taken care of already.

vba - Using FileSystemObject or the Input # statement to read data from text files -

i have read in data text files formated example below, e.g. 5 variables separated tab or space delimiter (not fixed-width columns). montreal 0.2 h 3 500 otherplace 0.1 m 50 25 thirdplace 0.05 m 62 112 [...] i read these in using input # statement, , that's i've been doing, because it's easiest/laziest approach. but: the input # statement doesn't recognize tabs delimiters. the whole input # vernacular has "deprecated" feel it! i'm thinking modernizing , reading files using filesystemobject methods (already writing files). but doesn't requires lot of string manipulation parse out 5 variable values? suggestions on how best this? also, what's way of determining how many lines there in text file? can redim arrays ahead of time. have considered using jet read textfile recordset? http://www.connectionstrings.com/textfile jet installed recent versions of windows.

c# - return jsonresult behaves unexpextedly with jquery post -

okay please help, i've been frustrated issue. i need either set error value or perform redirect when user hits submit button. (its standard login form). need ajax. i think working, when user clicks submit page displays: {"redirect":"/home/index"} or {"error":"the user name or password provided incorrect."} its not redirecting/displaying error how i'm intending to. some background - form login form, , placed inside modal popup dialog.(jqueryui) heres jquery: $("#submit").click(function () { $.post({ url: "account/logon", datatype: "json", success: function (data) { if (data.redirect) { // data.redirect contains string url redirect window.location.href = data.redirect; } else { // data.form contains html

php - Join two tables, where one is not uniqe -

hey everyone. need join 2 tables according parameters: 1) need data both in first , in second table 2) data in second table can have more rows attached 1 row of first table, need rows displayed once. i tried this select * table p join `table2` ps on (p.id = ps.`id_table2`) order p.id but getting duplicates, mentioned. thanks assuming care final output, use distinct: select distinct * table p join `table2` ps on (p.id = ps.`id_table2`) order p.id

javascript - Google Maps API v3 - changed in the last week or so? -

i using following code obtain lat , lng values user input. seemed working fine, until recently. if (status == google.maps.geocoderstatus.ok) { var lat = parsefloat(results[0].geometry.location.wa).tofixed(3); var lng = parsefloat(results[0].geometry.location.xa).tofixed(3); .... now if console.log results[0].geometry.location (51.4793388, -2.5933342) { va=51.4793388, wa=-2.5933342} . it appears if xa has changed va . what correct way reference these values? i ran same issue on google map api 3.0 application. basically, wa , xa variables if remember correctly latlng() variables. can call them way: results[0].geometry.location.lat().tofixed(3); results[0].geometry.location.lng().tofixed(3); where va = lat , wa = lng

Ruby regex, is there a way to only match literal matches? -

i'm trying parse using case/when statement regex in it. i'm having trouble match give me match if it's not literal match. example: if input ($45, x), back: "address mode: indirect, x -> value: 45" regex: /[(][$][1-9a-fa-f]{1,2}\s*,\s*[xx]\s*[)]/ now, if input ($45, p), match regex: /[$][1-9a-fa-f]{2,4}/ which understandable, match literal matches. if there characters not match regex want match function return false. is there other functions match() or arguments can given match() behavior? from question, little unclear after. second regex matching on substring $45 if want avoid this, use anchors ^ , $ ensure entire string matched. like: ^\(\$[1-9a-za-z]+,\s*[xx]\s*\)$

Restoring an old MySQL backup -

i have large file 2007 containing backup (as sql script) of mysql database. it's unknown version of mediawiki. -- phpmyadmin sql dump -- version 2.6.2-debian-3sarge3 -- http://www.phpmyadmin.net -- -- host: localhost -- generation time: aug 29, 2007 @ 12:42 pm -- server version: 4.0.24 -- php version: 4.3.10-19 i've tried installing mysql-5.5.8-win32 , mysql-workbench-gpl-5.2.31a-win32 getting syntax errors. there easy way of making old script compatible, or better of using older version of mysql? dev tools still available older versions? i looking quickest simplest option want restore hold of old raw data, not set fully. it worth showing error. but anyway, set sql_mode = mysql40 might if syntax problem. there might issue not keyword before , is, have escape in case.

ms access - Reserved error (-1524) -

i upgrading of ms access programs 2003 2007 version. have variable stored "public" in main menu of program. in form, write variable record (the form using unbound data). vba line "rst![fieldname]=forms![main menu].struser" gives runtime error of 3000, reserved error (-1524). what heck going on??????? thanks given. i encouteredthe error when updating mdb split database (frontend backend) access 2010. original mdb database used internal linkage (an autoid number in 1 table linked same number defauted in second table). encountered problem when trying import first table mentioned above. not import table or copy-paste table without getting "reserved error (-1624) error. the solution import other tables imported ok without problem new 2010 database, , use make table query duplicate problem table in new 2010 version. process preserved auto id numbering, internal relationship preserved in new, updated database.

java - Forcing GWT to assume List is implemented as ArrayList -

for reason i'm stucked model classes using list collection type , use model on client side. gwt of course fails serializing java.util.list. implementations of list in model based on arraylist. possible tell gwt assume list arraylist? edit gwt fails on compile time, since possible candidate list java.util.collections.singeltonlist - can not compiled. i'm using gwt 2.1 , java 1.6 . you can use gwt-rpc blacklist prevent gwt trying compile classes in situations this. see this issue .

javascript events - Firefox Extension link extractor -

i want create extension in firefox extracts links embedded on web page users moving mouse on link. similar link target display on status bar @ bottom of browser. the problem having getting access document object of loaded webpage. tried document.getelementsbytag("a") didn't work. tried content.document.getelementbytag("a") didn't work. ideally want behave this: webpage loaded. all anchors on web page assigned attribute onmouseover. user points link. the event triggered , link's url extracted , displayed on alert box. a few things: for script inserted browser overlay, document document of browser, not of webpage, want content.document . the function getelementsbytagname . use error console -- should tell getelementsbytag not function. you can use content.document.links it might simpler add event listener entire document when loads, , in event listener, if (event.target instanceof htmlanchorelement) or see if it's lin

sql - Possible to round down to second decimal place based off 3+ decimal spots in MySQL -

i trying figure out how create "floor" call based on specific decimal place opposed whole value. below table of actual values , desired result: =========|========= 3.125 | 3.12 4.187 | 4.18 1.212 | 1.21 5.999 | 5.99 is possible mysql? using round function 2nd decimal place returns "bad" data , rounding third not reach goal either. use truncate function : select truncate(3.125, 2) output: 3.12

javascript - PHP redirect on extjs form submission -

i have extjs formpanel login process, standartsumbit: false ... loginform.getform().getel().dom.action = 'index_files/login.php'; loginform.getform().getel().dom.method = 'post'; loginform.getform().submit(); login.php contains: if ( $name == '1') { header("location: http://www.google.com/ "); exit; } but instead of redirecting i'm getting chrome debugger failed load resource www.google.com what problem? thank you. ps: can't use get in success function of extjs, try success:function(){ var redirect = 'http://www.google.com'; window.location = redirect; },

c# - How to get a list of uncommitted files from tortoise or svn -

i writing c# app needs @ folder , list of files need committed. tortoise svn guaranteed installed on machine. how can list programmatically? i don't think tortoisesvn can this, should not effort doing using c# svn library. take @ question: does know of c# api subversion? .