Posts

Showing posts from August, 2015

c# - .NET ListView row padding -

there doesn't seem way change padding (or row height) rows in .net listview. have elegant hack-around? i know post old, however, if never found best option, i've got blog post may help, involves utilizing lvm_seticonspacing. according blog, initially, you'll need add: using system.runtime.interopservices; next, you'll need import dll, can utilize sendmessage, modify listview parameters. [dllimport("user32.dll")] public static extern int sendmessage(intptr hwnd, int msg, intptr wparam, intptr lparam); once complete, create following 2 functions: public int makelong(short lowpart, short highpart) { return (int)(((ushort)lowpart) | (uint)(highpart << 16)); } public void listviewitem_setspacing(listview listview, short leftpadding, short toppadding) { const int lvm_first = 0x1000; const int lvm_seticonspacing = lvm_first + 53; sendmessage(listview.handle, lvm_seticonspacing, intptr.zero, (intptr)ma...

Using the result of a command as an argument in bash? -

to create playlist of music in folder, using following command in bash: ls > list.txt i use result of pwd (print working directory) command name of playlist. something like: ls > ${pwd}.txt that doesn't work though - can tell me syntax need use this? edit: mentioned in comments pwd end giving absolute path, playlist end being named .txt in directory - d'oh! i'll have trim path. spotting - have spent ages wondering files went! use backticks substitute result of command: ls > "`pwd`.txt" as pointed out landon, $(cmd) equivalent: ls > "$(pwd).txt" note unprocessed substitution of pwd absolute path, above command creates file same name in same directory working directory, .txt extension. thomas kammeyer pointed out basename command strips leading directory, create text file in current directory name of directory: ls > "`basename "$(pwd)"`.txt" also erichui bringing problem of space...

CSS / JavaScript Navigation Menu on top of Flash in Firefox -

Image
my site has drop-down menu built in css , javascript drops down on flash animation. in ie (6&7) drop-down menus drop on flash animation, however, in firefox (2&3) menus appear underneath flash animation. there way dynamic menu flow on flash in firefox? in ie 7 menu appears on flash: in firefox menu appears under flash: (how can fix this?!) try setting wmode transparent - see here

visual studio 2008 - Recent Projects panel on VS2008 not working for fresh installs -

the recent projects panel on start page of vs2008 professional doesn't appear work, , remains empty. i've noticed on 3 of our developers vs2008 installations, in fact installations weren't updated 2005 installed scratch. treat bit of curiosity, have new laptop , fresh install of vs2008, it's happening me, , i've upgraded phenomena curio annoyance. anyone know if bug or if there setting i'm missing somewhere. thanks edit thanks, tools | options | environment | general | "items shown in used lists" , set 6 default is tools | options | environment | general | "items shown in used lists" set number greater 0?

debugging - Can I set a breakpoint on 'memory access' in GDB? -

i running application through gdb , want set breakpoint time specific variable accessed / changed. there method doing this? interested in other ways monitor variable in c/c++ see if/when changes. watch breaks on write, rwatch let break on read, , awatch let break on read/write. you can set read watchpoints on memory locations: gdb$ rwatch *0xfeedface hardware read watchpoint 2: *0xfeedface but 1 limitation applies rwatch , awatch commands; can't use gdb variables in expressions: gdb$ rwatch $ebx+0xec1a04f expression cannot implemented read/access watchpoint. so have expand them yourself: gdb$ print $ebx $13 = 0x135700 gdb$ rwatch *0x135700+0xec1a04f hardware read watchpoint 3: *0x135700 + 0xec1a04f gdb$ c hardware read watchpoint 3: *0x135700 + 0xec1a04f value = 0xec34daf 0x9527d6e7 in objc_msgsend () edit: oh, , way. need either hardware or software support . software slower. find out if os supports hardware watchpoints can see can-use-hw-watchpoin...

MYSQL ERROR: PROCEDURE can't return a result set in the given context -

i new stored procedure in mysql this procedure returning difference of date excluding weekends, returns error #1312 - procedure blog1.daycount can't return result set in given context this procedure drop procedure if exists daycount; create procedure daycount( d1 date, d2 date ) select dd.idiff, dd.idiff - dd.iweekenddays iworkdays, dd.iweekenddays ( select dd.idiff, ((dd.iweeks * 2) + if(dd.isatdiff >= 0 , dd.isatdiff < dd.idays, 1, 0) + if (dd.isundiff >= 0 , dd.isundiff < dd.idays, 1, 0)) iweekenddays ( select dd.idiff, floor(dd.idiff / 7) iweeks, dd.idiff % 7 idays, 5 - dd.istartday isatdiff, 6 - dd.istartday isundiff ( select 1 + datediff(d2, d1) idiff, weekday(d1) istartday ) dd ) dd ) dd ; call daycount( '2009-8-1','2009-9-15'); check stored proc in mysql console, if works fine should check call php. found same p...

c# - Problems using UpdateProgress -

i have button on asp.net page, fetches data database , displays on gridview. this process takes while, thought i'll add updateprogress ajax control. when click button, updateprogress image shows , data being fetched database (i checked logs have in db). there 2 issues: (1) updateprogress image shows 2 minutes. buttonclick event takes 5 minutes complete. updateprogress stops showing before task complete, defeats purpose. (2) gridview doesn't show up. shows correctly if don't use scriptmanager/ajax. any ideas? some relevant code snippets: <div style="position: absolute; top: 300px; left: 19px; width: 568px; height: 48px;"> <table> <tr> <td> <asp:button id="btngeneratereport" runat="server" height="37px" text="generate report" width="132px" onclick="btngeneratereport_click" /> </td> <td class="style5...

linux - How else might a PHP CLI script determine its memory limit? -

i need run php cli script , give lot of memory (it's automatic documentation generator needs cover large code base). have powerful machine , have allocated 5gb php, both in php.ini , in inline ini_set('memory_limit','5120m') declaration in script file. if add these lines top of script: phpinfo(); exit(); ... claims has memory limit of 5120m, specified. but script still errors out, saying fatal error: allowed memory size of 1073741824 bytes exhausted ... 1gb, not 5gb specified. is there other place script might looking determine memory limit? running in fedora linux. (yes, ultimate solution may rewrite script more efficient, didn't write in first place, before resort that, want throw resources @ , see if works.) the heap limit property size_t, 32 bits on 32-bit machine. if in bytes, limit memory limit 4 gb. may try running on 64 bit machine, 64-bit php. edit: confirmed, heap->limit size_t (unsigned int) , in bytes. memory_limit...

c# - Convert this delegate to an anonymous method or lambda -

i new anonymous features , need help. have gotten following work: public void fakesavewithmessage(transaction t) { t.message = "i drink goats blood"; } public delegate void fakesave(transaction t); public void sampletestfunction() { expect.call(delegate { _dao.save(t); }).do(new fakesave(fakesavewithmessage)); } but totally ugly , have inside of anonymous method or lambda if possible. tried: expect.call(delegate { _dao.save(t); }).do(delegate(transaction t2) { t2.message = "i drink goats blood"; }); and expect.call(delegate { _dao.save(t); }).do(delegate { t.message = "i drink goats blood"; }); but these give me cannot convert anonymous method type 'system.delegate' because not delegate type** compile errors. what doing wrong? because of mark ingram posted, seems best answer, though nobody's explicitly said it, this: public delegate void fakesave(transaction t); expect.call(delegate { _dao.save(t); })....

jquery ui tab appending content when reloaded -

i have jquery ui tab gets loaded via ajax , remote page: <div id="tabs" style="width:1200px" class="ui-tabs"> <ul> <li><a href="/bugs/loadtab1">view</a></li> <li><a href="#tabs-2">add bug/request</a></li> </ul>... <script type="text/javascript"> jquery(function($) { $('#tabs').tabs({ ajaxoptions: { error: function(xhr, status, index, anchor) { $(anchor.hash).html("couldn't load tab."); }, data: {}, success: function(data, textstatus) { }, } }); }); </script> in page gets loaded table rows of php data, , jquery-ui boxes. problem when reload tab via .tabs("load",0); , tabi s reloading, appending div's contain dialog's. once each time ...

javascript - How do I stop an effect in jQuery -

i have page uses $(id).show("highlight", {}, 2000); to highlight element when start ajax request, might fail want use like $(id).show("highlight", {color: "#ff0000"}, 2000); in error handler. problem if first highlight haven't finished, second placed in queue , wont run until first ready. hence question: can somehow stop first effect? from jquery docs: http://docs.jquery.com/effects/stop stop currently-running animation on matched elements. ... when .stop() called on element, currently-running animation (if any) stopped. if, instance, element being hidden .slideup() when .stop() called, element still displayed, fraction of previous height. callback functions not called. if more 1 animation method called on same element, later animations placed in effects queue element. these animations not begin until first 1 completes. when .stop() called, next animation in queue begins immediately. if clearqueue parameter ...

C++ inheritance and member function pointers -

in c++, can member function pointers used point derived (or base) class members? edit: perhaps example help. suppose have hierarchy of 3 classes x , y , z in order of inheritance. y therefore has base class x , derived class z . now can define member function pointer p class y . written as: void (y::*p)(); (for simplicity, i'll assume we're interested in functions signature void f() ) this pointer p can used point member functions of class y . this question (two questions, really) then: can p used point function in derived class z ? can p used point function in base class x ? c++03 std, §4.11 2 pointer member conversions : an rvalue of type “pointer member of b of type cv t,” b class type, can converted rvalue of type “pointer member of d of type cv t,” d derived class (clause 10) of b. if b inaccessible (clause 11), ambiguous (10.2) or virtual (10.1) base class of d, program necessitates conversion ill-formed. result of conversio...

javascript - HTML/CSS/JS Want to colour group of objects and then re-colour one of them? -

basically have 6 labels acting buttons. when clicked on, change white blue. click on label, blue label turns white again , click label turns blue. at moment code below sets them white doesnt appear colour newly clicked label blue. if comment out line: document.getelementsbytagname('label').style.backgroundcolor = '#fff'; then each label clicked on turns blue, remains blue when click on new label. need know how set label class background white, turn background of clicked label blue. the result should each time clicked label background should blue , others white. thanks in advance <script = "text\javascript"> function toggle(label) { document.getelementbyid('one').style.display = 'block'; document.getelementsbytagname('label').style.backgroundcolor = '#fff'; document.getelementbyid(label).style.color = 'rgb(54, 95, 145)'; document.getelementbyid(...

database - If possible how can one embed PostgreSQL? -

if it's possible, i'm interested in being able embed postgresql database, similar sqllite . i've read it's not possible . i'm no database expert though, want hear you. essentially want postgresql without configuration , installation. if it's possible, tell me how. unless major rewrite of code, not possible run postgres "embedded". either run separate process or use else. sqlite excellent choice. there others. mysql has embedded version. see @ http://mysql.com/oem/ . several java choices, , mac has core data can write too. hell, can use foxpro. os on , services need database?

OrderBy("it." + sort) -- Hard coding in LINQ to Entity framework? -

i have been trying use dynamic linq entity in application specifying orderby attribute @ runtime. when using code described in majority of documentation: var query = context.customer.orderby("name"); i received following exception: system.data.entitysqlexception: 'name' not resolved in current scope or context. make sure referenced variables in scope, required schemas loaded, , namespaces referenced correctly. after searching found msdn page: http://msdn.microsoft.com/en-us/library/bb358828.aspx which included following code example: objectquery<product> productquery2 = productquery1.orderby("it.productid"); this prompted me change code following: var query = context.customer.orderby("it.name"); after code works perfectly. able confirm indeed correct way orderby working linq entity? can’t believe framework have been implemented in way, perhaps have overlooked something? thanks, matt the it.name syntax esql ...

How to implement two periodical processes in C++ under Linux? -

i doing real time programming in c++, under linux. i have 2 process, let me , b. process being started periodically, every 5ms. b process being started every 10ms. process doing change of data. process b reading data , displays it. i confused how run periodically processes, , should have 2 .cpp programs each process? i think that, if possible, create single process 2 threads might solution also, since might easier them share resources , synchronize data. but, if need more this, think need clearer when stating problem.

smooth - Smoothing Zedgraph linegraphs without 'bumps' -

when use zedgraph linegraphs , set issmooth true, lines nicely curved instead of having hard corners/angles. while looks better graphs -in humble opinion- there small catch. smoothing algorithm makes line take little 'dive' or 'bump' before going upwards or downwards. in cases, if datapoint smooth, isn't problem, if datapoints go 0 15, 'dive' makes line go under x-axis, makes seems though there datapoints below 0 (which not case). how can fix (prefably ;) no simple answer this. keeping tension near 0 simplest solution. zedgraph uses gdi's drawcurve tension parameter apply smoothness, hermite interpolation. can try implement own cosine interpolation, keep local extremes because of nature. can @ link see why: http://local.wasp.uwa.edu.au/~pbourke/miscellaneous/interpolation/ edit: website down. here cached version of page: http://web.archive.org/web/20090920093601/http://local.wasp.uwa.edu.au/~pbourke/miscellaneous/interpolation/...

php - Start download automatically when a user navigates to another page -

i wondering how accomplish effect i've seen on several websites, click download link, takes me page, , download starts automatically. best way accomplish this? redirect page emits following headers: header("content-disposition: attachment; filename=$filename"); header("content-length: $length"); see this post restrictions on $filename . edit in response andr's answer, php equivalent of redirect-after-x-seconds be: header("refresh: 2; url=start_download.php"); (although should officially specify complete url, think) start_download.php contain 2 lines above.

C# How to find WCF IIS deployment/virtual directory at runtime to change name of log file? -

i trying change name of c# wcf logfile based on name of iis virtual directory deployed to. i tried use directory.getcurrentdirectory() call returns directory c:\windows\system32\inetsrv regardless virtual directory wcf apps deployed to.. so should looking virtualdirectory class ?? sample code on how find current virtual directory ? thanks ! did try this: string path = hostingenvironment.mappath("~");

Linq List<> problem -

northwinddatacontext db = new northwinddatacontext(); list<category> lresult = (db.categories .select(p => new { p.categoryid, p.categoryname, p.description })).tolist(); in above query don't want use var instead of var want use list<> show me error .why error occur ,how correct query. your query selecting anonymous type, not instances of category . that's why you're going need either: use var instead of list<> create named type instead of using anonymous type in query. anonymous types unspeakable - there no type name can refer them in code. exist make easier create projections in linq queries without having write explicit type each result. in case, there's no real downside using var . that's why exists. allows refer anonymous types without having give them name (since can't). use: var lresult = (db.categories.select( ... // query...

How to disable a warning in Delphi about "return value ... might be undefined"? -

i have function gives me following warning: [dcc warning] filename.pas(6939): w1035 return value of function 'function' might undefined the function, however, clean, small, , have known, expected, return value. first statement in function is: result := ''; and there no local variable or parameter called result either. is there kind of pragma-like directive can surround method remove warning? delphi 2007. unfortunately, system on delphi installation not working, therefore can't pop warning right now. anyone know off top of head can do? are sure have done solve warning? maybe post code at? you can turn off warning locally way: {$warn no_retval off} function func(...): string; begin ... end; {$warn no_retval on}

data storage - Where to save high scores in an XNA game? -

i'm making simple 2 player game in xna , started looking saving player's high scores. i want game work on xbox 360 windows, have use framework save data. it seems save data particular user's gamer tag - question is, high scores? save user's own scores in profile? (so can see own scores if you're 1 signed in) try , save other player's scores in profiles? (seems pain try , keep sync'd) store scores online the 360 seems have standard method showing friend's high scores. can accessed within xna, or available published games? roll own. (seems excessive such small personal project.) the xna live api doesn't give access leaderboards ... real option store scores locally. if want users see each other's scores ... use 2 different stores. player's store own save data ... , title storage store scores. of course then, if 360 has more 1 storage device, they'll have select twice ... let them choose device scores if go high...

php - SQLite suitable for concurrent reading? -

will sqlite database perform around 50 reads/second without locking? i'm trying decide whether it'd feasible use on php website won't 'written' - it'll reads of same data small handful of tables no problem. concurrent reading/writing serialized sqlite don't need care it. for details : http://www.sqlite.org/lockingv3.html

python cgi on IIS -

how set iis can call python scripts asp pages? ok, found answer question here: http://support.microsoft.com/kb/276494 so on next question: how call cgi script within classic asp (vb) code? particularly 1 not in web root directory. i don't believe vbscript hosted iis has way of executing external process. if using python axscripting engine use sys module. if script you're calling meant cgi script you'll have mimic environment variables cgi uses. alternative put script on python path, import , hope modular enough can call pieces need , bypass cgi handling code.

java - WSDL2Java Throws Could not find main class: org.apache.axis.wsdl.WSDL2Java -

i'm trying use wsdl2java on mac. i setup classpath in bash. axis=/users/bernie/axis-1_4/lib classpath=".:$axis/axis-ant.jar:$axis/axis.jar:$axis/commons-discovery-0.2.jar:$axis/commons-logging-1.0.4.jar:$axis/jaxrpc.jar:$axis/log4j-1.2.8.jar:$axis/saaj.jar:$axis/wsdl4j-1.5.1.jar"; but when run java -cp $classpath org.apache.wsdl.wsdl2java mywsdl.wsdl i error. exception in thread "main" java.lang.noclassdeffounderror: org/apache/wsdl/wsdl2java caused by: java.lang.classnotfoundexception: org.apache.wsdl.wsdl2java @ java.net.urlclassloader$1.run(urlclassloader.java:202) @ java.security.accesscontroller.doprivileged(native method) @ java.net.urlclassloader.findclass(urlclassloader.java:190) @ java.lang.classloader.loadclass(classloader.java:307) @ sun.misc.launcher$appclassloader.loadclass(launcher.java:301) @ java.lang.classloader.loadclass(classloader.java:248) can me fix class path issue please.

asp.net - Conversion of crystal report of Desktop application to web application's crystal report -

i have got desktop application build in vs2005, doing conversion of web application (vs2008). have got around 40 crystal reports in (desktop application). please tell me can use them (rpt files) directly in web application or have create new reports? please provide me solution or give me url can me. there no need creating new reports can use rpt files in web application desktop 1 , regardless of version of vs. all need install crystal redistributable packs on server hosting application.

c# - creating ports and initiating communication between client and server -

what need server listens 5060 port , when client sends data port server should open port ( port after 1250 believe ) , forward clients data port keeping 5060 idle can perform same function next client so need server a) open multiple ports 1 each client b) voice data client , able send voice data client i m looking hardware specs , other such details of scenario dont have time make such program myself if theres code can run directly ( both server , client side ) on visual studio .net 2010 perform these tasks extremely helpful thanks alot in advance sounds typical tcp socket server implementation. don't know c# i'm sure there's mapping in there of berkeley sockets / winsock listen() , accept() functions, you're looking @ raw sockets api level. imagine should looking tcpserver or tcpsocket class (or similar) in .net library.

c++ - How do I detect application Level Focus-In in Qt 4.4.1? -

i need determine when qt 4.4.1 application receives focus. i have come 2 possible solutions, both don’t work like. in first possible solution, connect focuschanged() signal qapp slot. in slot check ‘old’ pointer. if ‘0’, know we’ve switched application, , want. seems reliable method of getting application detect focus in of 2 solutions presented here, suffers problem described below. in second possible solution, overrode ‘focusinevent()’ routine, , want if reason ‘activewindowfocusreason’. in both of these solutions, code executed @ times when don’t want be. for example, have code overrides focusinevent() routine: void applicationwindow::focusinevent( qfocusevent* p_event ) { qt::focusreason reason = p_event->reason(); if( reason == qt::activewindowfocusreason && hasnewupstreamdata() ) { switch( qmessagebox::warning( this, "new upstream data found!", "new upstream data exists!\n" ...

c# - Multithreaded drawing in .NET? -

( edit : clarify, main goal concurrency, not multi-core machines) i'm new concepts on concurrency, figured out needed have parallel drawing routines, number of reasons: i wanted draw different portions of graphic separatedly (background refreshed less foreground, kept on buffer). i wanted control priority (more priority ui responsiveness drawing complex graph). i wanted have per-frame drawing calculations multithreaded. i wanted offer cancelling complex on-buffer drawing routines. however, being such beginner, code looked mess , refactoring or bug-fixing became awkward decided need play more before doing serious. so, i'd know how make clean, easy mantain .net multithreaded code makes sense when @ after waking next day. bigest issue had structuring application parts talk each other in smart (as opposed awkward , hacky) way. any suggestion welcome , have preference sources can digest in free time (e.g., not 500+ pages treatise on concurrency) , c#/vb.net, late...

java - why does this code output "0"? -

package algorithms; import cs1.keyboard; import java.util.*; public class sieveoferatosthenes2 { public static void main (string[] args){ //input number , create array length of (num-1) int num = keyboard.readint(); arraylist prime = new arraylist(num); //populate array numbers 2 num for(int = 0; < prime.size()-1; i++) { integer temp = new integer(i+2); prime.add(i, temp); } system.out.println(prime.size()); the constructor here doesn't set size of arraylist num , sets capacity num : arraylist prime = new arraylist(num); the size of arraylist still zero, loop body never runs. try instead: for (int = 0; < num - 1; i++) { integer temp = new integer(i+2); prime.add(temp); } definition of size : the number of elements in list. definition of capacity: each arraylist instance has capacity. capacity size of array used store elements in list. @ l...

ruby - Is there any Windows API that can "normalize" or "maximize" a window? -

i using ruby's win32api movewindow move window , resize it. but if window minimized, won't show. setwindowpos works too, , has flag hide or show window, make window visible or invisible, not minimizing or normalizing. i tried setforegroundwindow , setactivewindow , won't work either. there call make window normalized or maximized? showwindow(hwnd, sw_restore) may you're looking for. see: msdn docs

iphone - "Not Writable! - Root.plist" greyed out when building -

was having play settings bundles before in xcode 3.2.3 (sdk 4.0.1), deleted settings.bundle folder , 'also moved trash'ed. now every time build have dialogue "save before building?" , root.plist file there, greyed out , unselectable. i checked directory claiming be, nothing there. its getting annoying. ideas? i added bundle again , deleted it... fixed bug

c# - Why don't we use new operator while initializing a string? -

i asked question in interview: string reference type or value type. i said reference type. asked me why don't use new operator while initializing string ? said because c# language has simpler syntax creating string , compiler automatically converts code call construcor of system.string class. is answer correct or not ? strings immutable reference types. there's ldstr il instruction allows pushing new object reference string literal. when write: string = "abc"; the compiler tests if "abc" literal has been defined in metadata , if not declare it. translates code following il instruction: ldstr "abc" which makes a local variable point string literal defined in metadata. so answer not quite right compiler doesn't translate call constructor.

.net - Favorite Visual Studio keyboard shortcuts -

what favorite visual studio keyboard shortcut? i'm leaving hands on keyboard , away mouse! one per answer please. ctrl + - , opposite ctrl + shift + - . move cursor (or forwards) last place was. no more scrolling or pgup / pgdown find out were. this switches open windows in visual studio: ctrl + tab , opposite ctrl + shift + tab

SQL Server Management Studio – tips for improving the TSQL coding process -

i used work in place common practice use pair programming. remember how many small things learn each other when working on code. picking new shortcuts, code snippets etc. time improved our efficiency of writing code. since started working sql server have been left on own. best habits pick working other people cannot now. so here question: what tips on efficiently writing tsql code using sql server management studio? please keep tips 2 – 3 things/shortcuts think improve speed of coding please stay within scope of tsql , sql server management studio 2005/2008 if feature specific version of management studio please indicate: e.g. “works sql server 2008 only" edit: i afraid have been misunderstood of you. not looking tips writing efficient tsql code rather advice on how efficiently use management studio speed coding process itself. the type of answers looking are: use of templates, keyboard-shortcuts, use of intellisense plugins etc. basically little things...

android - Text Size of a Spinner -

how can decrease font size of spinner? have reduced spinner size 35 pix because of text gets cut in half. how do that? dont want selected beforehand. default text should "select value" . after tests, there easier way subclassing arrayadapter. change arrayadapter<charsequence> adapter = arrayadapter.createfromresource(this, r.array.planets_array,android.r.layout.simple_spinner_item);//this tutorial, adapt line to line : arrayadapter<charsequence> adapter = arrayadapter.createfromresource(this, r.array.planets_array, r.layout.textview); you have change design of textview use of spinner. tried this, layout of textview.xml : <textview xmlns:android="http://schemas.android.com/apk/res/android" android:text="@+id/textview01" android:id="@+id/textview01" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textsize="30sp"></textview>

iphone - Refresh tableView \ View -

i have tab bar application , when press on 1 of tabs viewdidload called if moving tab , return previous 1 vewdidload didnt call how can know window load again? and how can refresh view? example viewtable made logic changes , want refresh new data. thanks. the viewdidload method called once. method want viewwillappear , can override one. to refresh tableview use [tableview reloaddata]

What do you think are the useless tags in HTML? -

as moving on html5, there tags hold least importance did in past.for example <dl> defination list, dont remember last time used tag. and not this, there tags have better , more efficient versions or clear redundancy <strong> , <b> , <basefont> , <font> etc. in opinion, tags developer can live out with?, , tags can ignored? because have better version. it suggested make answer, here excellent page discusses tags , attributes should avoided in html5 pages, , why, though doesn't include elements blink tag. http://www.html-5.com/avoid/

Can I (re)map Ex commands in vim? -

i love vim , speed gives me. sometimes, fingers speedy , find myself typing :wq instead of :wq . (on german keyboard, have press shift colon : .) vim complain wq not editor command . is there way make w , q editor commands? try :command wq wq :command wq wq :command w w :command q q this way can define own commands. see :help command more information.

html - Aligning text. Using tables or css or &nbsp;? -

frequently aligning text such as: to: 07/02/2010 from: 07/02/2010 id displayed this: to: 07/02/2010 from: 07/02/2010 so quickest/easiest/best way this? css ? using few nbsp (would work if mono spacing) or using tables . if not in anti-hating table mood, ill use tables. what recommend? i'd recommend tables. best way, seeing tabular data there, , html doesn't support tab stops. but silly avoid tables sake of avoiding tables. unless want option later style so: to: from: 07/02/2010 07/02/2010 you this, if reason didn't want use tables: css .sideheading { width: 3em; float: left; } html <div class="sideheading">to:</div>07/02/2010 <div class="sideheading">from:</div>07/02/2010 or use definition list (but if reason avoiding tables due semantics, dls avoided same thing). but of course, it's layout, no customer or web surfer ever going care how it, long can read it!

svn - VS2010 Integration with Subversion -

i might in minority, dislike how subversion client integrates windows shell. there subversion client integrates vs2010 , that's , doesn't mess windows shell? try ankh-svn have found works pretty me.

python - How to break a large CSV data file into individual data files? -

i have csv file first row of contains variables names , rest of rows contains data. what's way break files each containing 1 variable in python? solution going robust? e.g. if input file 100g in size? trying perform divide conquer strategy new python. in advance help! the input files looks like var1,var2,var3 1,2,hello 2,5,yay ... i want create 3 (or many variables) files var1.csv, var2.csv, var3.csv files resemble file1 var1 1 2 ... file2 var2 2 5 ... file3 var3 hello yay as lomg number of columns isn't absurdly huge (larger number of files can have open @ once on platform), number of rows, , total size, no big deal (as long of course have ample free space on disk;-) since you'll processing column @ time -- suggest following code: import csv def splitit(inputfilename): open(inputfilename, 'rb') inf: inrd = csv.reader(inf) names = next(inrd) outfiles = [open(n+'.csv', 'wb') n in names] ouwr = [csv.wri...

A good way of leaving code writers information inside HTML? -

i'm wondering, best way of leaving code writers (programmers) information/initials/(maybe even) copyright... well, information web developer, not content maintainer inside html. is leaving link site inside footer way, or there maybe can used <meta> tags that? thanks in advance! do want visible end user or not? if not, use comments: html <!-- comment here --> css /* comment here */ javascript // comment /* multi-line comment*/ if yes, of times it'll on bottom, along other copyright information.

iphone - How do I make a custom UITableViewCell curved? -

like settings app, or uitablecellstylevalue1? i'm trying replicate tableviews in settings.app, have label , textfield. i'm stuck trying make cells curved. how can go doing this? thanks! you need use table view grouped, not plain style , rounded table cells free. [[uitableview alloc] initwithframe:cgrectmake(0,0,320,460) style:uitableviewstylegrouped];

Where can i found Power Control Widget source android? -

where can found below link 07-26 11:32:31.865: verbose/makiservice(1081): received broadcast:android.intent.action.start_tether 07-26 11:32:31.865: verbose/makiservice(1081): datastring:null 07-26 11:32:31.865: verbose/makiservice(1081): tostring:intent { act=android.intent.action.start_tether } i need use 1 bluetooth tether enabling .while pressing on power widget tether button observed 1 on log.where can found makiservice? at least give me code link of power control widget.this available android 1.6 onwards? this might looking for: settingsappwidgetprovider.java

asp.net mvc - ReSharper 5.0 choking on strong-typed view model that's located in same project -

i'm using vs2010, asp.net mvc 2, , resharper 5.0. when create new view that's typed off of model same project view, resharper doesn't see reference model. this definition of view: <%@ page language="c#" inherits="system.web.mvc.viewpage<web.domain.userviewmodel>" %> domain.userviewmodel red, , reshaper tooltip add reference pops up. annoying because cannot use intellisense model , resharper shows numerous errors in view. this strictly resharper code-inspection issue. view functions if run code. if change web.domain.userviewmodel object project red dissapears , fine. know how can make recognize models web project correctly? did try latest bug fix update, resharper 5.1?

javascript - Is there a cross-browser onload event when clicking the back button? -

for major browsers (except ie), javascript onload event doesn’t fire when page loads result of button operation — it fires when page first loaded. can point me @ sample cross-browser code (firefox, opera, safari, ie, …) solves problem? i’m familiar firefox’s pageshow event unfortunately neither opera nor safari implement this. guys, found jquery has 1 effect: page reloaded when button pressed. has nothing " ready ". how work? well, jquery adds onunload event listener. // http://code.jquery.com/jquery-latest.js jquery(window).bind("unload", function() { // ... by default, nothing. somehow seems trigger reload in safari, opera , mozilla -- no matter event handler contains. [ edit(nickolay) : here's why works way: webkit.org , developer.mozilla.org . please read articles (or summary in separate answer below) , consider whether really need , make page load slower users.] can't believe it? try this: <body onunload=""...

python - How do I split a multi-line string into multiple lines? -

i have multi-line string literal want operation on each line, so: inputstring = """line 1 line 2 line 3""" i want following: for line in inputstring: dostuff() inputstring.splitlines() will give list each item, splitlines() method designed split each line list element.

actionscript 3 - Flex in IntelliJ: Embeded fonts not showing after compile -

i'm trying set old flex project in intellij idea having problem embeded fonts. font installed on windows 7 pc , located in folder fonts in directory actionscript sources located. i'm using sdk compiler config flex_sdk_4.1 additional option of -static-link-runtime-shared-libraries=true. code example: { [embed(source="fonts/org_v01_.ttf", fontname="org_v01", mimetype='application/x-font-truetype')] public var org_v01:class; var format:textformat = new textformat(); format.font = "org_v01"; format.color = 0x000000; format.size = 8; label = new textfield(); label.defaulttextformat = format; label.embedfonts = true; label.text = "loading..."; addchild(label); } needed set embedascff='false'

cache mpeg files on page load, html + php -

i have page ajax page prowser. on 2 slides embedded player play mpeg or flv video file. first time page viewed file loaded , on slow internet connections stop-start since is beeing showen , loaded @ same time. can auto-cache 2 files on page load cached , ready when visitor ready watch them? br. anders first of should take care http headers cache control. make sure static files being served following header (use firebug verify): cache-control: max-age=3600 however, not have full control on caching, it's web-browser cache large files or not.

Which formal language class are XML and JSON with unique keys (they are not context-free) -

please don't answer here @ cstheory.stackexchange, i copied question to ! json , xml both called context-free languages - both specified formal grammar in ebnf. true json defined in rfc 4329, section 2.2 not require uniqueness of object keys (many may not know {"a":1,"a":2} valid json!). if require unique keys in json or unique attribute names in xml cannot expressed context-free grammars. language class of json unique keys , well-formed xml (which implies unique attribute names?). one of best paper found on subject (murato et al, 2001: taxonomy of xml schema languages using formal language theory ) explicitly excludes integrity constraints such keys/keyrefs , uniqueness checked on additional layer. beside subset of xml defined xml schema or dtd context-free. not full set of well-formed xml documents. i think nested stack automaton (=indexed language) should able parse json unique key constraint. xml can simlify question language s of comma-seper...

Java Escaping String for Storage in csv file -

if want store user created strings in csv file. there preferred library use escaping string or should write own function? i suggest use 1 of libraries recommended post(s) here. while may seem easy write own csv creator/parser, going run issues need handle scenarios such user strings commas or quotes in them, can quite cumbersome. used following libraries , worked fine:- com.ostermiller.util java utilities opencsv

How can I get table names from an MS Access Database? -

microsoft sql server , mysql have information_schema table can query. not exist in ms access database. is there equivalent can use? to build on ilya's answer try following query: select msysobjects.name table_name msysobjects (((left([name],1))<>"~") , ((left([name],4))<>"msys") , ((msysobjects.type) in (1,4,6))) order msysobjects.name (this 1 works without modification mdb) accdb users may need this select msysobjects.name table_name msysobjects (((left([name],1))<>"~") , ((left([name],4))<>"msys") , ((msysobjects.type) in (1,4,6)) , ((msysobjects.flags)=0)) order msysobjects.name as there table included appears system table of sort.

delphi - Text to speech in Vista -

i did creating ole object delphi in 2000/nt/xp following: voice := createoleobject('sapi.spvoice'); voice.speak(...) but not work in vista, how can make program speak text in vista? i tried (d2009 on vista home premium) following code , works! unit unit1; interface uses windows, messages, sysutils, variants, classes, graphics, controls, forms, dialogs, stdctrls, comobj; type tform1 = class(tform) button1: tbutton; procedure button1click(sender: tobject); private { private declarations } public { public declarations } end; var form1: tform1; implementation {$r *.dfm} procedure tform1.button1click(sender: tobject); var voice: variant; begin voice := createoleobject('sapi.spvoice'); voice.speak('hello world'); end; end. fyi, there nice paper on using speech in delphi programming brian long... (very) late update: for why might not work in vista , give ezerodivide exception outside ide, see othe...

php gtk - Does anyone here use PHP-GTK? Is there a better alternative? -

i had made questions regarding php-gtk (there 4 php-gtk tagged questions , 3 mine) , end answering myself because no 1 answer them. i know strange language selection attracted because runs on several oss , fact can reuse of code (also apps end looking , can make little installers in nsis rocks). is there better alternative, free (as in freedom) , can run on several platforms? both python , ruby can work gtk libraries. these may better chocies of languages (you'll more folk here answering questions :) see is ruby gui development? , https://stackoverflow.com/questions/115495/is-python-any-good-for-gui-development links ruby , python respectively.

.net - BindingFlags for Type.GetMethods excluding property accessors -

suppose i've got following program: namespace reflectiontest { public class example { private string field; public void methodone() { } public void methodtwo() { } public string property { { return field; } set { this.field = value; } } } class program { static void main(string[] args) { iterate(typeof(example)); console.readline(); } public static void iterate(type type) { methodinfo[] methods = type.getmethods( bindingflags.declaredonly | bindingflags.instance | bindingflags.public); foreach (methodinfo mi in methods) { console.writeline(mi.name); } } } } when run program i'm getting following output: methodone methodtwo get_property set_property i want skip property accesor methods...

Code documentation for delphi similar to javadoc or c# xml doc -

i need code documentation tool similar javadoc or c# xml doc delphi code. best tool? prefer technology, in future compatible microsoft sandcastle project. take @ synproject , open source tool written in delphi. it designed handle full documentation workflow, specifications release notes, including tests, architecture , design; , of course there integrated delphi parser generate architecture documentation existing delphi source code. for architecture document, source code can extract comments (ala pasdoc) embed text main architecture document (with class hierarchy diagrams , unit dependencies). you write plain text file using wiki-like syntax in dedicated text editor, synproject creates formated word documents it. wizards available access content. since it's stored plain file, multiple programmers can write on it, using scm tool (svn, fossil...). for instance, use writing maintenance documentation huge , old delphi application (about 2,000,000 lines of code wri...

Objective-C : Just another stupid properties question -

in objective-c properties can set alternative names fpr accessors. @property(setter=namewrite:,getter=nameread,copy) nsstring *name; i thinking real hard don't know situation ever that. not kvc standard , see no advantage @ all. use of it? mostly, used bool properties: @property(getter=ishidden) bool hidden; @property(readonly, getter=isfinishedlaunching) bool finishedlaunching; but, yeah, beyond that, isn't used @ (nor should be).

Managing Android services in tabhosts or custom contexts? -

i have tabhost number of tabs need access same service through out life of application. 'best practice' suggests unbind services when pausing activity, mean disconnecting service, reconnect on selection of next tab, daft (not least because service maintains connection server). store reference service in tabhost, don't know how reference tabhost child activities. alternative extend application class , manage service there. does have better ideas or reasons why shouldn't either of above? thanks extending application class alternative. however can extend activity , make child activities inherit extended activity, way implement same code (service handling) in 1 activity(the parent). activity -> myparentactivity -> mychildactivity1

embedded - What is the best .NET Micro Framework dev board, for under US$300? -

i'm looking relativity cheap .net micro framework development board use on personal robotics project. i'd don't need i/o, want @ least 1 serial port , 1 ethernet port. i prefer not have spend more us$300 on board, if there obvious reason better 1 i'm flexible. currently i'm looking @ this device sjj embedded micro solutions . has had experience device? here 2 different boards have been researching. both of these around $100.00 , meant hobbyist. neither of these boards has ethernet on board, relatively easy add adding external ethernet module meridianp usbizi usbizi tcp/ip , ethernet support

serial port - Weird random data being sent from Arduino to Processing -

Image
i'm trying read data photocell resistor , arduino decimila , graph in real-time processing. should painfully simple; growing little bit of nightmare me. code i'm running on arduino: int photopin; void setup(){ photopin = 0; serial.begin( 9600 ); } void loop(){ int val = int( map( analogread( photopin ), 0, 1023, 0, 254 ) ); serial.println( val ); //sending data on serial } code i'm running in processing: import processing.serial.*; serial photocell; int[] yvals; void setup(){ size( 300, 150 ); photocell = new serial( this, serial.list()[0], 9600 ); photocell.bufferuntil( 10 ); yvals = new int[width]; } void draw(){ background( 0 ); for( int = 1; < width; i++ ){ yvals[i - 1] = yvals[i]; } if( photocell.available() > 0 ){ yvals[width - 1] = photocell.read(); } for( int = 1; < width; i++ ){ stroke( #ff0000 ); line( i, yvals[i], i, height ); } println( photocell.read() ); // debugging } i...

javascript - Is possible to add waypoints to Google Maps API without using JSON? -

i'm on asp.net mvc , i'm using google maps api javascript. send model view 1 or more waypoints add route. function calcroute() { initialize(); var start = "<%= model.startaddress %>"; var end = "<%= model.clientaddress %>"; var waypts = []; waypts.push({ location: "<%= model.pickupaddress[0] %>", stopover:true }); var request = { origin: start, destination: end, waypoints: waypts, travelmode: google.maps.directionstravelmode.driving }; directionsservice.route(request, function (response, status) { if (status == google.maps.directionsstatus.ok) { directionsdisplay.setdirections(response); } }); } is possible add waypoints way addresses in model.pickupaddress array? have seen examples code using json (for markers), if ...

sql scripts - In the Visual Studio SQL editor, how do I get rid of the boxes? -

i create sql tables , stored procedures writing script inside visual studio. works me except 1 simple annoyance: vs puts blue boxes around sql queries , data-manipulation commands. purpose of these boxes draw undue attention fact vs thinks query can edited in “query builder.” i don’t want use query builder. want nice, clean script reflects fantastic vision of db engine should do. blast it, jim, i’m programmer not microsoft access hobbyist! i do, however, syntax highlighting , source-control integration vs provides. so question this: how turn off annoying blue boxes? set color of sql query outline same color background.

performance - JavaScript/MooTools - Better to save element in object property vs. accessing each time with $('elem')? -

in terms of speed/memory efficiency, make sense save element (retrieved via $) variable in object or use $ access each time? does accessing object properties (especially if nested few levels - object within object) perform faster using $? caching selectors used idea. namespacing behind several levels deep object creates longer neccessary global scope chain, imo. tend cache selectors within simple closures or via using mootools' element storage. for example, if have link in div locates parent, finds 2 elements down , first img , can see user clicking multiple times, can this: document.id("somelink").addevent("click", function() { var targetimg = this.retrieve("targetimg") || this.store("targetimg", this.getparent().getnext().getnext().getelement("img.close")); targetimg.fade(.5); ... }); on first click target img , store under link's storage key targetimg , subsequent clicks use stored reference. moot...

php - Magento : How to check if admin is logged in within a module controller? -

i'm creating magento module. within controller, want check if admin logged in or not. controller accessible if there logged in admin. i'm trying use code on controller. mage::getsingleton('core/session', array('name' => 'adminhtml')); $session = mage::getsingleton('admin/session'); // use 'admin/session' object check loggedin status if ( $session->isloggedin() ) { echo "logged in"; } else { echo "not logged in"; } but "not logged in", if i'm logged in magento admin. can me resolve issue?? appreciated. thanks that strange. use same code , works time: //get admin session mage::getsingleton('core/session', array('name'=>'adminhtml')); //verify if user logged in backend if(mage::getsingleton('admin/session')->isloggedin()){ //do stuff } else { echo "go away bad boy"; } did try var_dumping $session variable? maybe on ri...